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: /*
043: * ElementCastException.java
044: *
045: * Created on 31 Март 2005 г., 16:42
046: */
047:
048: package org.netbeans.test.umllib.exceptions;
049:
050: /**
051: * example: can be thrown on attemp to
052: * @author psb
053: */
054: public class UnexpectedMenuItemStatusException extends
055: UMLCommonException {
056:
057: /**
058: * Creates a new instance of UnexpectedMenuItemStatusException
059: * @param message
060: */
061: public UnexpectedMenuItemStatusException(String message) {
062: super (message);
063: }
064:
065: /**
066: * Creates a new instance of UnexpectedMenuItemStatusException
067: * @param message
068: * @param st
069: */
070: public UnexpectedMenuItemStatusException(String message, Status st) {
071: super (message);
072: status = st;
073: }
074:
075: /**
076: * Creates a new instance of UnexpectedMenuItemStatusException
077: * @param message
078: * @param mn
079: */
080: public UnexpectedMenuItemStatusException(String message, MenuType mn) {
081: super (message);
082: type = mn;
083: }
084:
085: /**
086: * Creates a new instance of UnexpectedMenuItemStatusException
087: * @param message
088: * @param st
089: * @param mn
090: */
091: public UnexpectedMenuItemStatusException(String message, Status st,
092: MenuType mn) {
093: super (message);
094: status = st;
095: type = mn;
096: }
097:
098: /**
099: * Creates a new instance of UnexpectedMenuItemStatusException
100: * @param message
101: * @param st
102: * @param mn
103: * @param Id
104: */
105: public UnexpectedMenuItemStatusException(String message, Status st,
106: MenuType mn, int Id) {
107: super (message);
108: status = st;
109: type = mn;
110: id = Id;
111: }
112:
113: private Status status = Status.UNKNOWN;
114: private MenuType type = MenuType.UNKNOWN;
115: private int id;
116:
117: /**
118: *
119: * @return
120: */
121: public Status getStatus() {
122: return status;
123: }
124:
125: /**
126: *
127: * @return
128: */
129: public MenuType getMenuType() {
130: return type;
131: }
132:
133: /**
134: *
135: * @return
136: */
137: public int getId() {
138: return id;
139: }
140:
141: /**
142: * Status for popup or menu items
143: */
144: static public enum Status {
145: UNKNOWN("Any or unknown status for menu item."), DISABLED(
146: "Item is disabled."), ENABLED("Item is enabled."), EXIST(
147: "Item exists."), ABSENT("Item is absent.");
148:
149: private String description = "";
150:
151: /**
152: *
153: * @param desc
154: */
155: Status(String desc) {
156: description = desc;
157: }
158:
159: Status() {
160: description = name();
161: }
162:
163: }
164:
165: /**
166: * MenuType
167: */
168: static public enum MenuType {
169: UNKNOWN("Any or unknown menu type."), TREENODE_POPUP(), DIAGRAMELEMENT_POPUP(), MAINMENU();
170:
171: private String description = "";
172:
173: /**
174: *
175: * @param desc
176: */
177: MenuType(String desc) {
178: description = desc;
179: }
180:
181: MenuType() {
182: description = name();
183: }
184:
185: /**
186: *
187: * @param dsc
188: * @return
189: */
190: public static MenuType TREENODE_POPUP(String dsc) {
191: MenuType ret = TREENODE_POPUP;
192: ret.description = dsc;
193: return ret;
194: }
195:
196: /**
197: *
198: * @param dsc
199: * @return
200: */
201: public static MenuType DIAGRAMELEMNT_POPUP(String dsc) {
202: MenuType ret = DIAGRAMELEMENT_POPUP;
203: ret.description = dsc;
204: return ret;
205: }
206:
207: /**
208: *
209: * @param dsc
210: * @return
211: */
212: public static MenuType MAINMENU(String dsc) {
213: MenuType ret = MAINMENU;
214: ret.description = dsc;
215: return ret;
216: }
217: }
218:
219: }
|