001/* 002 * CDDL HEADER START 003 * 004 * The contents of this file are subject to the terms of the 005 * Common Development and Distribution License, Version 1.0 only 006 * (the "License"). You may not use this file except in compliance 007 * with the License. 008 * 009 * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt 010 * or http://forgerock.org/license/CDDLv1.0.html. 011 * See the License for the specific language governing permissions 012 * and limitations under the License. 013 * 014 * When distributing Covered Code, include this CDDL HEADER in each 015 * file and include the License file at legal-notices/CDDLv1_0.txt. 016 * If applicable, add the following below this CDDL HEADER, with the 017 * fields enclosed by brackets "[]" replaced with your own identifying 018 * information: 019 * Portions Copyright [yyyy] [name of copyright owner] 020 * 021 * CDDL HEADER END 022 * 023 * 024 * Copyright 2009 Sun Microsystems, Inc. 025 * Portions Copyright 2015 ForgeRock AS. 026 */ 027package org.opends.guitools.controlpanel.ui.nodes; 028 029import javax.swing.tree.DefaultMutableTreeNode; 030 031/** 032 * Abstract class with some common methods for all the nodes in the 033 * 'General Information' tree. 034 * 035 */ 036public class GeneralMonitoringTreeNode extends DefaultMutableTreeNode 037{ 038 private static final long serialVersionUID = 7896765876669863639L; 039 private String displayName; 040 private Object identifier; 041 private boolean isRoot; 042 043 /** 044 * Constructor of the node. 045 * @param displayName the name of the node. 046 * @param identifier the identifier that is unique among all the nodes. 047 * @param isRoot whether the node is the root or not. 048 */ 049 public GeneralMonitoringTreeNode(String displayName, 050 Object identifier, 051 boolean isRoot) 052 { 053 super(displayName); 054 this.displayName = displayName; 055 this.identifier = identifier; 056 this.isRoot = isRoot; 057 } 058 059 /** 060 * Returns the name of the node. 061 * @return the name of the node. 062 */ 063 public String getDisplayName() 064 { 065 return displayName; 066 } 067 068 /** 069 * Returns the identifier that is unique among all the nodes. 070 * @return the identifier that is unique among all the nodes. 071 */ 072 public Object getIdentifier() 073 { 074 return identifier; 075 } 076 077 /** {@inheritDoc} */ 078 public boolean isRoot() 079 { 080 return isRoot; 081 } 082 083 /** {@inheritDoc} */ 084 public boolean isLeaf() 085 { 086 return getChildCount() == 0; 087 } 088}