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