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-2016 ForgeRock AS. 016 */ 017package org.opends.guitools.controlpanel.ui.nodes; 018 019import javax.swing.tree.DefaultMutableTreeNode; 020 021/** Abstract class with some common methods for all the nodes in the 'General Information' tree. */ 022public class GeneralMonitoringTreeNode extends DefaultMutableTreeNode 023{ 024 private static final long serialVersionUID = 7896765876669863639L; 025 private String displayName; 026 private Object identifier; 027 private boolean isRoot; 028 029 /** 030 * Constructor of the node. 031 * @param displayName the name of the node. 032 * @param identifier the identifier that is unique among all the nodes. 033 * @param isRoot whether the node is the root or not. 034 */ 035 public GeneralMonitoringTreeNode(String displayName, 036 Object identifier, 037 boolean isRoot) 038 { 039 super(displayName); 040 this.displayName = displayName; 041 this.identifier = identifier; 042 this.isRoot = isRoot; 043 } 044 045 /** 046 * Returns the name of the node. 047 * @return the name of the node. 048 */ 049 public String getDisplayName() 050 { 051 return displayName; 052 } 053 054 /** 055 * Returns the identifier that is unique among all the nodes. 056 * @return the identifier that is unique among all the nodes. 057 */ 058 public Object getIdentifier() 059 { 060 return identifier; 061 } 062 063 @Override 064 public boolean isRoot() 065 { 066 return isRoot; 067 } 068 069 @Override 070 public boolean isLeaf() 071 { 072 return getChildCount() == 0; 073 } 074}