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 com.sun.rave.designtime.impl;
043:
044: import java.awt.Image;
045: import com.sun.rave.designtime.DisplayAction;
046: import com.sun.rave.designtime.Result;
047:
048: /**
049: * A basic implementation of DisplayAction to use for convenience.
050: *
051: * @author Joe Nuxoll
052: * @version 1.0
053: * @see DisplayAction
054: */
055: public class BasicDisplayAction implements DisplayAction {
056:
057: protected String displayName;
058: protected String description;
059: protected String helpKey;
060: protected Image smallIcon;
061: protected Image largeIcon;
062: protected boolean enabled = true;
063:
064: public BasicDisplayAction() {
065: }
066:
067: public BasicDisplayAction(String displayName) {
068: this .displayName = displayName;
069: }
070:
071: public BasicDisplayAction(String displayName, String description) {
072: this (displayName);
073: this .description = description;
074: }
075:
076: public BasicDisplayAction(String displayName, String description,
077: String helpKey) {
078: this (displayName, description);
079: this .helpKey = helpKey;
080: }
081:
082: public BasicDisplayAction(String displayName, String description,
083: String helpKey, Image smallIcon) {
084: this (displayName, description, helpKey);
085: this .smallIcon = smallIcon;
086: }
087:
088: public BasicDisplayAction(String displayName, String description,
089: String helpKey, Image smallIcon, Image largeIcon) {
090: this (displayName, description, helpKey, smallIcon);
091: this .largeIcon = largeIcon;
092: }
093:
094: public void setDisplayName(String displayName) {
095: this .displayName = displayName;
096: }
097:
098: public String getDisplayName() {
099: return displayName;
100: }
101:
102: public void setDescription(String description) {
103: this .description = description;
104: }
105:
106: public String getDescription() {
107: return description;
108: }
109:
110: public void setSmallIcon(Image smallIcon) {
111: this .smallIcon = smallIcon;
112: }
113:
114: public Image getSmallIcon() {
115: return smallIcon;
116: }
117:
118: public void setLargeIcon(Image largeIcon) {
119: this .largeIcon = largeIcon;
120: }
121:
122: public Image getLargeIcon() {
123: return largeIcon;
124: }
125:
126: public void setEnabled(boolean enabled) {
127: this .enabled = enabled;
128: }
129:
130: public boolean isEnabled() {
131: return enabled;
132: }
133:
134: public void setHelpKey(String helpKey) {
135: this .helpKey = helpKey;
136: }
137:
138: public String getHelpKey() {
139: return helpKey;
140: }
141:
142: public Result invoke() {
143: return Result.SUCCESS;
144: }
145: }
|