View Javadoc

1   /*
2    * JarInspector - Copyright (C) 2004 Che Inc., Rosario Argentina
3    *
4    * This program is free software; you can redistribute it and/or
5    * modify it under the terms of the GNU Library General Public
6    * License as published by the Free Software Foundation; either
7    * version 2 of the License, or (at your option) any later version.
8    *
9    * This library is distributed in the hope that it will be useful,
10   * but WITHOUT ANY WARRANTY; without even the implied warranty of
11   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12   * Library General Public License for more details.
13   *
14   * You should have received a copy of the GNU Library General Public
15   * License along with this library; if not, write to the Free
16   * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17   */
18  
19  package inc.che.jarinspector;
20  
21  // Imports
22  
23  import inc.che.common.config.Config;
24  import inc.che.common.gui.ConfigDialog;
25  import inc.che.common.resource.ResourceManager;
26  
27  import java.awt.Color;
28  import java.util.Locale;
29  
30  import javax.swing.JFrame;
31  
32  import org.apache.log4j.Logger;
33  
34  /***
35   *  <b>@todo</b>
36   * @version $Id: JarInspectorConfigDialog.java,v 1.1 2005/03/06 12:56:57 stevemcmee Exp $
37   * @author <address> Steve McMee &lt;stevemcmee@sourceforge.net&gt; </address>
38   */
39  
40  public class JarInspectorConfigDialog extends ConfigDialog {
41  
42      /*** CVS ID of this file */
43      public static final String CVS_ID =
44          "$Id: JarInspectorConfigDialog.java,v 1.1 2005/03/06 12:56:57 stevemcmee Exp $";
45  
46      /*** logger instance for this class */
47  
48      private static Logger log =
49          Logger.getLogger(JarInspectorConfigDialog.class);
50  
51      /***
52       * The ResourceManager
53       */
54      private static ResourceManager resourceManager =
55          ResourceManager.getResourceManager(StringResources.TEXT_RESOURCES);
56  
57      private Color colorSearch =
58          config.getColorParameter("color.highlight.search");
59      private Color colorHit = config.getColorParameter("color.highlight.hit");
60  
61      public JarInspectorConfigDialog(JFrame owner, Config config) {
62          super(
63              owner,
64              config,
65              config.getLocaleParameter("locale", Locale.GERMAN));
66          PropertyGroup propGroup = null;
67          setAvailableLocales(new Locale[] {Locale.ENGLISH, Locale.GERMAN });
68          propGroup =
69              createPropertyGroup(
70                  resourceManager.getText("config.propgroup.sort"));
71          propGroup.addPropertyItem(
72              "sort.jar",
73              new ConfigDialog.PropertyItem(
74                  "sort.jar",
75                  resourceManager.getText("config.sortjar.label"),
76                  ConfigDialog.BOOLEAN_PROPERTY,
77                  false,
78                  false));
79  
80          propGroup =
81              createPropertyGroup(
82                  resourceManager.getText("config.propgroup.misc"));
83  
84          propGroup.addPropertyItem(
85              "sound.play",
86              new ConfigDialog.PropertyItem(
87                  "sound.play",
88                  resourceManager.getText("config.playsound.label"),
89                  ConfigDialog.BOOLEAN_PROPERTY,
90                  false,
91                  true));
92          propGroup.addPropertyItem(
93              "dir.last",
94              new ConfigDialog.PropertyItem(
95                  "dir.last",
96                  resourceManager.getText("config.dirlast.label"),
97                  ConfigDialog.DIR_PROPERTY,
98                  false,
99                  false));
100 
101         propGroup =
102             createPropertyGroup(
103                 resourceManager.getText("config.propgroup.locale"));
104         propGroup.addPropertyItem(
105             "locale",
106             new ConfigDialog.PropertyItem(
107                 "locale",
108                 resourceManager.getText("config.locale.label"),
109                 ConfigDialog.LOCALE_PROPERTY,
110                 false,
111                 true));
112 
113         propGroup =
114             createPropertyGroup(
115                 resourceManager.getText("config.propgroup.search"));
116 
117         propGroup.addPropertyItem(
118             "search.case",
119             new ConfigDialog.PropertyItem(
120                 "search.case",
121                 resourceManager.getText("config.searchcase.label"),
122                 ConfigDialog.BOOLEAN_PROPERTY,
123                 false,
124                 false));
125         propGroup.addPropertyItem(
126             "color.highlight.hit",
127             new ConfigDialog.PropertyItem(
128                 "color.highlight.hit",
129                 resourceManager.getText("config.highlight.hit.label"),
130                 ConfigDialog.COLOR_PROPERTY,
131                 false,
132                 false));
133         propGroup.addPropertyItem(
134             "color.highlight.search",
135             new ConfigDialog.PropertyItem(
136                 "color.highlight.search",
137                 resourceManager.getText("config.highlight.search.label"),
138                 ConfigDialog.COLOR_PROPERTY,
139                 false,
140                 false));
141         propGroup.addPropertyItem(
142             "search.recursive",
143             new ConfigDialog.PropertyItem(
144                 "search.recursive",
145                 resourceManager.getText("config.rsearch.label"),
146                 ConfigDialog.BOOLEAN_PROPERTY,
147                 false,
148                 false));
149 
150     }
151 
152     protected void closeDialog() {
153         if (changedColor()) {
154             JarInspectorFrame.getJarInspectorFrame().setHighlighter();
155         }
156 
157         super.closeDialog();
158     }
159     private boolean changedColor() {
160         return (
161             !this.colorSearch.equals(
162                 config.getColorParameter("color.highlight.search"))
163                 || !this.colorHit.equals(
164                     config.getColorParameter("color.highlight.hit")));
165     }
166 
167 }