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 2004-2005 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: package org.netbeans.modules.jmx.runtime;
042:
043: import org.openide.DialogDescriptor;
044: import org.openide.DialogDisplayer;
045: import org.openide.NotifyDescriptor;
046:
047: import java.awt.*;
048:
049: public class ManagementDialogs {
050: private static DialogDisplayer standard = DialogDisplayer
051: .getDefault();
052: private static ManagementDialogs defaultInstance;
053:
054: private ManagementDialogs() {
055: } // avoid direct instance creation
056:
057: public static ManagementDialogs getDefault() {
058: if (defaultInstance == null)
059: defaultInstance = new ManagementDialogs();
060: return defaultInstance;
061: }
062:
063: public Object notify(NotifyDescriptor descriptor) {
064: return standard.notify(descriptor);
065: }
066:
067: public Dialog createDialog(DialogDescriptor descriptor) {
068: return standard.createDialog(descriptor);
069: }
070:
071: public static class DNSAMessage extends NotifyDescriptor.Message {
072: /**
073: * Create an informational report about the results of a command.
074: *
075: * @param message the message object
076: * @see org.openide.NotifyDescriptor#NotifyDescriptor
077: */
078: public DNSAMessage(String key, Object message) {
079: super (message);
080: }
081:
082: /**
083: * Create a report about the results of a command.
084: *
085: * @param message the message object
086: * @param messageType the type of message to be displayed
087: * @see org.openide.NotifyDescriptor#NotifyDescriptor
088: */
089: public DNSAMessage(String key, Object message, int messageType) {
090: super (message, messageType);
091: }
092: }
093:
094: public static class DNSAConfirmation extends
095: NotifyDescriptor.Confirmation {
096:
097: /**
098: * Create a yes/no/cancel question with default title.
099: *
100: * @param message the message object
101: * @see org.openide.NotifyDescriptor#NotifyDescriptor
102: */
103: public DNSAConfirmation(String key, Object message) {
104: super (message);
105: }
106:
107: /**
108: * Create a yes/no/cancel question.
109: *
110: * @param message the message object
111: * @param title the dialog title
112: * @see org.openide.NotifyDescriptor#NotifyDescriptor
113: */
114: public DNSAConfirmation(String key, Object message, String title) {
115: super (message, title);
116: }
117:
118: /**
119: * Create a question with default title.
120: *
121: * @param message the message object
122: * @param optionType the type of options to display to the user
123: * @see org.openide.NotifyDescriptor#NotifyDescriptor
124: */
125: public DNSAConfirmation(String key, Object message,
126: int optionType) {
127: super (message, optionType);
128: }
129:
130: /**
131: * Create a question.
132: *
133: * @param message the message object
134: * @param title the dialog title
135: * @param optionType the type of options to display to the user
136: * @see org.openide.NotifyDescriptor#NotifyDescriptor
137: */
138: public DNSAConfirmation(String key, Object message,
139: String title, int optionType) {
140: super (message, title, optionType);
141: }
142:
143: /**
144: * Create a confirmation with default title.
145: *
146: * @param message the message object
147: * @param optionType the type of options to display to the user
148: * @param messageType the type of message to use
149: * @see org.openide.NotifyDescriptor#NotifyDescriptor
150: */
151: public DNSAConfirmation(String key, Object message,
152: int optionType, int messageType) {
153: super (message, optionType, messageType);
154: }
155:
156: /**
157: * Create a confirmation.
158: *
159: * @param message the message object
160: * @param title the dialog title
161: * @param optionType the type of options to display to the user
162: * @param messageType the type of message to use
163: * @see org.openide.NotifyDescriptor#NotifyDescriptor
164: */
165: public DNSAConfirmation(String key, Object message,
166: String title, int optionType, int messageType) {
167: super(message, title, optionType, messageType);
168: }
169: }
170: }
|