001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041:
042: package org.netbeans.modules.sql.framework.ui.editor.property.impl;
043:
044: import org.netbeans.modules.sql.framework.ui.editor.property.INode;
045: import org.netbeans.modules.sql.framework.ui.editor.property.IOption;
046:
047: /**
048: * @author Ritesh Adval
049: * @version $Revision$
050: */
051: public class BasicOption implements IOption {
052:
053: private String displayName;
054: private String name;
055: private INode parent;
056: private String toolTip;
057: private String value;
058:
059: /** Creates a new instance of GUIOption */
060: public BasicOption() {
061: }
062:
063: public BasicOption(String name, String val) {
064: this .name = name;
065: this .value = val;
066: }
067:
068: /**
069: * get the display name of of element
070: *
071: * @return display name
072: */
073: public String getDisplayName() {
074: if (this .displayName == null) {
075: return this .getName();
076: }
077:
078: return this .displayName;
079: }
080:
081: public String getName() {
082: return this .name;
083: }
084:
085: /**
086: * get the parent element
087: *
088: * @return parent
089: */
090: public INode getParent() {
091: return parent;
092: }
093:
094: /**
095: * get the tooltip of of element
096: *
097: * @return tooltip
098: */
099: public String getToolTip() {
100: return this .toolTip;
101: }
102:
103: public String getValue() {
104: return this .value;
105: }
106:
107: /**
108: * set the display name of the element
109: *
110: * @param dName display name
111: */
112: public void setDisplayName(String dName) {
113: this .displayName = dName;
114: }
115:
116: public void setName(String name) {
117: this .name = name;
118: }
119:
120: /**
121: * set parent parent element
122: */
123: public void setParent(INode parent) {
124: this .parent = parent;
125: }
126:
127: /**
128: * set the tooltip of the element
129: *
130: * @param tTip tool tip
131: */
132: public void setToolTip(String tTip) {
133: this .toolTip = tTip;
134: }
135:
136: public void setValue(String val) {
137: this .value = val;
138: }
139:
140: @Override
141: public String toString() {
142: return this.getDisplayName();
143: }
144: }
|