KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > de > qfs > apps > qflog > command > CommandEditOptions


1 // {{{ copyright
2

3 /********************************************************************
4  *
5  * $Id: CommandEditOptions.java,v 1.11 2000/07/05 14:07:43 gs Exp $
6  *
7  * The contents of this file are subject to the Mozilla Public
8  * License Version 1.1 (the "License"); you may not use this file
9  * except in compliance with the License. You may obtain a copy of
10  * the License at http://www.mozilla.org/MPL/
11  *
12  * Software distributed under the License is distributed on an "AS
13  * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
14  * implied. See the License for the specific language governing
15  * rights and limitations under the License.
16  *
17  * The Original Code is qfs.de code.
18  *
19  * The Initial Developer of the Original Code is Gregor Schmid.
20  * Portions created by Gregor Schmid are
21  * Copyright (C) 1999 Quality First Software, Gregor Schmid.
22  * All Rights Reserved.
23  *
24  * Contributor(s):
25  *
26  *******************************************************************/

27
28 // }}}
29

30 package de.qfs.apps.qflog.command;
31
32 // {{{ imports
33

34 import java.awt.Frame JavaDoc;
35
36 import de.qfs.lib.command.Command;
37 import de.qfs.lib.command.CommandException;
38 import de.qfs.lib.command.Invokable;
39 import de.qfs.lib.log.Log;
40 import de.qfs.lib.log.Logger;
41 import de.qfs.lib.option.OptionDialog;
42
43 import de.qfs.apps.qflog.App;
44
45 // }}}
46

47 /**
48  * This command brings up the option dialog, waits for the user to finish and
49  * sets the Options in the server as well as all registered clients.
50  *
51  * @author Gregor Schmid
52  * @version $Revision: 1.11 $
53  */

54 public class CommandEditOptions extends Command
55 implements Invokable
56 {
57     // {{{ variables
58

59     /**
60      * The Logger used for logging.
61      */

62     private final static Logger logger = new Logger (CommandEditOptions.class);
63
64     /**
65      * The dialog displaying the options.
66      */

67     private static OptionDialog dialog;
68
69     /**
70      * The parent for the dialog.
71      */

72     private Frame JavaDoc parent;
73
74     // }}}
75

76     // {{{ CommandEditOptions
77

78     /**
79      * Create a new CommandEditOptions.
80      *
81      * @param source The source of the Command.
82      * @param parent The parent frame for the dialog.
83      */

84     public CommandEditOptions (Object JavaDoc source, Frame JavaDoc parent)
85     {
86         super (source);
87         if (logger.level >= Log.MTD) {
88             logger.log(Log.MTD, "CommandEditOptions(Object,Frame)", "");
89         }
90         this.parent = parent;
91     }
92
93     // }}}
94
// {{{ invoke
95

96     /**
97      * Invoke the command.
98      *
99      * @return Always null.
100      *
101      * @throws CommandException Never.
102      */

103     public Object JavaDoc invoke()
104          throws CommandException
105     {
106         if (logger.level >= Log.MTD) {
107             logger.log(Log.MTD, "invoke()", "");
108         }
109
110         if (dialog == null) {
111             dialog = new OptionDialog
112                 (parent,
113                  App.getResources().getString ("optionDialog.title"),
114                  App.getOptions(), "main");
115         } else {
116             dialog.update(App.getOptions());
117         }
118         dialog.doModal();
119
120         return null;
121     }
122
123     // }}}
124
}
125
Popular Tags