Source Code Cross Referenced for DisplayOptionsTab.java in  » Source-Control » gruntspud » gruntspud » ui » preferences » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Source Control » gruntspud » gruntspud.ui.preferences 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *  Gruntspud
003:         *
004:         *  Copyright (C) 2002 Brett Smith.
005:         *
006:         *  Written by: Brett Smith <t_magicthize@users.sourceforge.net>
007:         *
008:         *  This program is free software; you can redistribute it and/or
009:         *  modify it under the terms of the GNU Library General Public License
010:         *  as published by the Free Software Foundation; either version 2 of
011:         *  the License, or (at your option) any later version.
012:         *  This program is distributed in the hope that it will be useful,
013:         *  but WITHOUT ANY WARRANTY; without even the implied warranty of
014:         *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
015:         *  GNU Library General Public License for more details.
016:         *
017:         *  You should have received a copy of the GNU Library General Public
018:         *  License along with this program; if not, write to the Free Software
019:         *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
020:         */
021:        package gruntspud.ui.preferences;
022:
023:        import gruntspud.ColorUtil;
024:        import gruntspud.Constants;
025:        import gruntspud.Gruntspud;
026:        import gruntspud.GruntspudContext;
027:        import gruntspud.GruntspudUtil;
028:        import gruntspud.StringUtil;
029:        import gruntspud.ui.ColorComboBox;
030:        import gruntspud.ui.JNumericTextField;
031:        import gruntspud.ui.StringListComboBox;
032:        import gruntspud.ui.UIUtil;
033:        import java.awt.FlowLayout;
034:        import java.awt.Font;
035:        import java.awt.GridBagConstraints;
036:        import java.awt.GridBagLayout;
037:        import java.awt.Insets;
038:        import java.awt.event.ActionEvent;
039:        import java.awt.event.ActionListener;
040:        import java.awt.event.KeyEvent;
041:        import javax.swing.BorderFactory;
042:        import javax.swing.JButton;
043:        import javax.swing.JCheckBox;
044:        import javax.swing.JComboBox;
045:        import javax.swing.JLabel;
046:        import javax.swing.JPanel;
047:        import javax.swing.SwingConstants;
048:        import javax.swing.UIManager;
049:        import javax.swing.border.TitledBorder;
050:
051:        /**
052:         * UI component for editing of display options
053:         *
054:         * @author magicthize
055:         */
056:        public class DisplayOptionsTab extends AbstractOptionsTab implements 
057:                ActionListener {
058:            public final static String[] TAB_PLACEMENT = { "Top", "Left",
059:                    "Bottom", "Right" };
060:            public final static String[] EXPLORER_LINE_STYLE = { "None",
061:                    "Angled", "Horizontal" };
062:            private JCheckBox useSplitExplorer;
063:            private JCheckBox hideFilesInTree;
064:            private JCheckBox showRootTreeNode;
065:            private JCheckBox substTypesInTree;
066:            private JCheckBox useSystemIcons;
067:            private JCheckBox showLineEndings;
068:            private JCheckBox dockReportsAsTabs;
069:            private JCheckBox useToggledFlatMode;
070:            private JCheckBox useScrollingTabs;
071:            private JCheckBox caseInsensitiveSort;
072:            private JCheckBox sortFoldersFirst;
073:            private JCheckBox highlightReadOnlyAndMissing;
074:            private JCheckBox showFiltersOnToolBar;
075:            private JCheckBox showFullPathForHomeLocation;
076:            private JCheckBox showTextOnMainTabs;
077:            private JCheckBox filterTab;
078:            private JCheckBox ctrlModifier, altModifier, shiftModifier;
079:            private StringListComboBox dateFormat;
080:            private StringListComboBox flatCVSNodeTextMask;
081:            private StringListComboBox explorerCVSNodeTextMask;
082:            private StringListComboBox fileCVSNodeTextMask;
083:            private ColorComboBox editorBackground;
084:            private ColorComboBox editorForeground;
085:            private JComboBox tabPlacement, explorerLineStyle;
086:            private JButton chooseEditorFont;
087:            private FontLabel editorFont;
088:            private JNumericTextField tabSize;
089:
090:            /**
091:             * Constructor for the DisplayOptionsTab object
092:             */
093:            public DisplayOptionsTab() {
094:                super ("Display", UIUtil
095:                        .getCachedIcon(Constants.ICON_TOOL_DISPLAY));
096:            }
097:
098:            /**
099:             * DOCUMENT ME!
100:             *
101:             * @param context DOCUMENT ME!
102:             */
103:            public void init(GruntspudContext context) {
104:                super .init(context);
105:                setTabToolTipText("Options for how things are displayed.");
106:                setTabMnemonic('r');
107:                setTabLargeIcon(UIUtil
108:                        .getCachedIcon(Constants.ICON_TOOL_LARGE_DISPLAY));
109:                setTabContext("UI");
110:                //  Explorer related options
111:                JPanel k = new JPanel(new FlowLayout(FlowLayout.CENTER));
112:                TitledBorder kt = new TitledBorder(
113:                        "Command options bypass modifiers");
114:                k.setBorder(kt);
115:                k.add(ctrlModifier = new JCheckBox("Ctrl"));
116:                k.add(altModifier = new JCheckBox("Alt"));
117:                k.add(shiftModifier = new JCheckBox("Shift"));
118:                int i = context.getHost().getIntegerProperty(
119:                        Constants.OPTIONS_DISPLAY_COMMAND_OPTIONS_BYPASS_MASK,
120:                        KeyEvent.CTRL_MASK + KeyEvent.SHIFT_MASK);
121:                ctrlModifier.setSelected((i & KeyEvent.CTRL_MASK) > 0);
122:                shiftModifier.setSelected((i & KeyEvent.SHIFT_MASK) > 0);
123:                altModifier.setSelected((i & KeyEvent.ALT_MASK) > 0);
124:                //  Explorer related options
125:                JPanel e = new JPanel(new GridBagLayout());
126:                TitledBorder et = new TitledBorder("Explorer");
127:                e.setBorder(et);
128:                GridBagConstraints gbce = new GridBagConstraints();
129:                gbce.insets = new Insets(3, 3, 3, 3);
130:                gbce.anchor = GridBagConstraints.WEST;
131:                gbce.fill = GridBagConstraints.BOTH;
132:                gbce.weightx = 2.0;
133:                UIUtil.jGridBagAdd(e, useSplitExplorer = new JCheckBox(
134:                        "Use 'split' explorer"), gbce,
135:                        GridBagConstraints.REMAINDER);
136:                useSplitExplorer
137:                        .setSelected(context.getHost().getBooleanProperty(
138:                                Constants.OPTIONS_DISPLAY_SPLIT_EXPLORER, true));
139:                useSplitExplorer.setMnemonic('s');
140:                UIUtil.jGridBagAdd(e, caseInsensitiveSort = new JCheckBox(
141:                        "Case insensitive sort"), gbce,
142:                        GridBagConstraints.REMAINDER);
143:                caseInsensitiveSort
144:                        .setSelected(context
145:                                .getHost()
146:                                .getBooleanProperty(
147:                                        Constants.OPTIONS_DISPLAY_CASE_INSENSITIVE_SORT,
148:                                        false));
149:                caseInsensitiveSort.setMnemonic('i');
150:                UIUtil.jGridBagAdd(e, sortFoldersFirst = new JCheckBox(
151:                        "Sort folders first"), gbce,
152:                        GridBagConstraints.REMAINDER);
153:                sortFoldersFirst.setSelected(context.getHost()
154:                        .getBooleanProperty(
155:                                Constants.OPTIONS_DISPLAY_SORT_FOLDERS_FIRST,
156:                                false));
157:                sortFoldersFirst.setMnemonic('f');
158:                UIUtil.jGridBagAdd(e, showRootTreeNode = new JCheckBox(
159:                        "Show root node in tree"), gbce,
160:                        GridBagConstraints.REMAINDER);
161:                showRootTreeNode.setSelected(context.getHost()
162:                        .getBooleanProperty(
163:                                Constants.OPTIONS_DISPLAY_SHOW_ROOT_TREE_NODE,
164:                                false));
165:                showRootTreeNode.setMnemonic('h');
166:                UIUtil.jGridBagAdd(e, substTypesInTree = new JCheckBox(
167:                        "Show subst. type icons"), gbce,
168:                        GridBagConstraints.REMAINDER);
169:                substTypesInTree.setSelected(context.getHost()
170:                        .getBooleanProperty(
171:                                Constants.OPTIONS_DISPLAY_SUBST_TYPES_IN_TREE,
172:                                true));
173:                substTypesInTree.setMnemonic('i');
174:                UIUtil.jGridBagAdd(e, hideFilesInTree = new JCheckBox(
175:                        "Hide files in tree"), gbce,
176:                        GridBagConstraints.REMAINDER);
177:                hideFilesInTree.setSelected(context.getHost()
178:                        .getBooleanProperty(
179:                                Constants.OPTIONS_DISPLAY_HIDE_FILES_IN_TREE,
180:                                false));
181:                hideFilesInTree.setMnemonic('h');
182:                gbce.weightx = 0.0;
183:                UIUtil.jGridBagAdd(e, new JLabel("Text Mask: "), gbce,
184:                        GridBagConstraints.RELATIVE);
185:                gbce.weightx = 1.0;
186:                UIUtil
187:                        .jGridBagAdd(
188:                                e,
189:                                explorerCVSNodeTextMask = new StringListComboBox(
190:                                        context,
191:                                        context
192:                                                .getHost()
193:                                                .getProperty(
194:                                                        Constants.OPTIONS_DISPLAY_EXPLORER_CVS_NODE_TEXT_MASK,
195:                                                        Constants.DEFAULT_EXPLORER_CVS_NODE_TEXT_MASK),
196:                                        false), gbce,
197:                                GridBagConstraints.REMAINDER);
198:
199:                gbce.weightx = 0.0;
200:                UIUtil.jGridBagAdd(e, new JLabel("Line style: "), gbce,
201:                        GridBagConstraints.RELATIVE);
202:                gbce.weightx = 1.0;
203:                UIUtil.jGridBagAdd(e, explorerLineStyle = new JComboBox(
204:                        EXPLORER_LINE_STYLE), gbce,
205:                        GridBagConstraints.REMAINDER);
206:                explorerLineStyle.setSelectedItem(context.getHost()
207:                        .getProperty(
208:                                Constants.OPTIONS_DISPLAY_EXPLORER_LINE_STYLE,
209:                                "None"));
210:                gbce.weightx = 2.0;
211:                gbce.weighty = 1.0;
212:                UIUtil.jGridBagAdd(e, new JLabel(), gbce,
213:                        GridBagConstraints.REMAINDER);
214:                //  Flat view related options
215:                JPanel f = new JPanel(new GridBagLayout());
216:                TitledBorder ef = new TitledBorder("Flat");
217:                f.setBorder(ef);
218:                GridBagConstraints gbcf = new GridBagConstraints();
219:                gbcf.insets = gbce.insets;
220:                gbcf.anchor = GridBagConstraints.WEST;
221:                gbcf.fill = GridBagConstraints.BOTH;
222:                gbcf.weightx = 2.0;
223:                UIUtil.jGridBagAdd(f, useToggledFlatMode = new JCheckBox(
224:                        "Use toggled flat mode"), gbcf,
225:                        GridBagConstraints.REMAINDER);
226:                useToggledFlatMode.setSelected(context.getHost()
227:                        .getBooleanProperty(
228:                                Constants.OPTIONS_DISPLAY_USE_TOGGLED_FLATMODE,
229:                                true));
230:                useToggledFlatMode.setMnemonic('s');
231:                gbcf.weightx = 0.0;
232:                gbcf.weighty = 1.0;
233:                UIUtil.jGridBagAdd(f, new JLabel("Text Mask: "), gbcf,
234:                        GridBagConstraints.RELATIVE);
235:                gbcf.weightx = 1.0;
236:                UIUtil
237:                        .jGridBagAdd(
238:                                f,
239:                                flatCVSNodeTextMask = new StringListComboBox(
240:                                        context,
241:                                        context
242:                                                .getHost()
243:                                                .getProperty(
244:                                                        Constants.OPTIONS_DISPLAY_FLAT_CVS_NODE_TEXT_MASK,
245:                                                        Constants.DEFAULT_FLAT_CVS_NODE_TEXT_MASK),
246:                                        false), gbcf,
247:                                GridBagConstraints.REMAINDER);
248:                //  File view related options
249:                JPanel d = new JPanel(new GridBagLayout());
250:                TitledBorder df = new TitledBorder("File");
251:                d.setBorder(df);
252:                GridBagConstraints gbcd = new GridBagConstraints();
253:                gbcd.insets = gbcf.insets;
254:                gbcd.anchor = GridBagConstraints.WEST;
255:                gbcd.fill = GridBagConstraints.BOTH;
256:                gbcd.weightx = 0.0;
257:                gbcd.weighty = 1.0;
258:                UIUtil.jGridBagAdd(d, new JLabel("Text Mask: "), gbcd,
259:                        GridBagConstraints.RELATIVE);
260:                gbcd.weightx = 1.0;
261:                UIUtil
262:                        .jGridBagAdd(
263:                                d,
264:                                fileCVSNodeTextMask = new StringListComboBox(
265:                                        context,
266:                                        context
267:                                                .getHost()
268:                                                .getProperty(
269:                                                        Constants.OPTIONS_DISPLAY_FILE_CVS_NODE_TEXT_MASK,
270:                                                        Constants.DEFAULT_FILE_CVS_NODE_TEXT_MASK),
271:                                        false), gbcd,
272:                                GridBagConstraints.REMAINDER);
273:                //  General panel
274:                JPanel o = new JPanel(new GridBagLayout());
275:                o.setBorder(BorderFactory.createTitledBorder("General"));
276:                GridBagConstraints gbco = new GridBagConstraints();
277:                gbco.insets = gbcd.insets;
278:                gbco.anchor = GridBagConstraints.WEST;
279:                gbco.fill = GridBagConstraints.HORIZONTAL;
280:                if (Gruntspud.is14()) {
281:                    UIUtil.jGridBagAdd(o, useScrollingTabs = new JCheckBox(
282:                            "Use scrolling tabs"), gbco,
283:                            GridBagConstraints.REMAINDER);
284:                    useScrollingTabs
285:                            .setSelected(context
286:                                    .getHost()
287:                                    .getBooleanProperty(
288:                                            Constants.OPTIONS_DISPLAY_USE_SCROLLING_TABS,
289:                                            true));
290:                    useScrollingTabs.setMnemonic('c');
291:                }
292:                UIUtil.jGridBagAdd(o, filterTab = new JCheckBox("Filter tab"),
293:                        gbco, GridBagConstraints.REMAINDER);
294:                filterTab.setSelected(context.getHost().getBooleanProperty(
295:                        Constants.OPTIONS_DISPLAY_FILTER_TAB, false));
296:                filterTab.setMnemonic('t');
297:                UIUtil.jGridBagAdd(o, showFiltersOnToolBar = new JCheckBox(
298:                        "Show filters on tool bar"), gbco,
299:                        GridBagConstraints.REMAINDER);
300:                showFiltersOnToolBar
301:                        .setSelected(context
302:                                .getHost()
303:                                .getBooleanProperty(
304:                                        Constants.OPTIONS_DISPLAY_SHOW_FILTERS_ON_TOOL_BAR,
305:                                        true));
306:                hideFilesInTree.setMnemonic('f');
307:                UIUtil.jGridBagAdd(o,
308:                        showFullPathForHomeLocation = new JCheckBox(
309:                                "Show full home location"), gbco,
310:                        GridBagConstraints.REMAINDER);
311:                showFullPathForHomeLocation
312:                        .setSelected(context
313:                                .getHost()
314:                                .getBooleanProperty(
315:                                        Constants.OPTIONS_DISPLAY_SHOW_FULL_PATH_FOR_HOME_LOCATION,
316:                                        true));
317:                showFullPathForHomeLocation.setMnemonic('u');
318:                UIUtil.jGridBagAdd(o, useSystemIcons = new JCheckBox(
319:                        "Use system icons if possible"), gbco,
320:                        GridBagConstraints.REMAINDER);
321:                useSystemIcons.setSelected(context.getHost()
322:                        .getBooleanProperty(
323:                                Constants.OPTIONS_DISPLAY_USE_SYSTEM_ICONS,
324:                                true));
325:                useSystemIcons.setMnemonic('s');
326:                UIUtil.jGridBagAdd(o, showLineEndings = new JCheckBox(
327:                        "Show line endings (slow)"), gbco,
328:                        GridBagConstraints.REMAINDER);
329:                showLineEndings.setSelected(context.getHost()
330:                        .getBooleanProperty(
331:                                Constants.OPTIONS_DISPLAY_SHOW_LINE_ENDINGS,
332:                                false));
333:                showLineEndings.setMnemonic('l');
334:                UIUtil.jGridBagAdd(o,
335:                        highlightReadOnlyAndMissing = new JCheckBox(
336:                                "Highlight read only / missing"), gbco,
337:                        GridBagConstraints.REMAINDER);
338:                highlightReadOnlyAndMissing
339:                        .setSelected(context
340:                                .getHost()
341:                                .getBooleanProperty(
342:                                        Constants.OPTIONS_DISPLAY_HIGHLIGHT_READ_ONLY_AND_MISSING_FILES,
343:                                        true));
344:                showLineEndings.setMnemonic('l');
345:                UIUtil.jGridBagAdd(o, showTextOnMainTabs = new JCheckBox(
346:                        "Show text on tabs (requires restart)"), gbco,
347:                        GridBagConstraints.REMAINDER);
348:                showTextOnMainTabs
349:                        .setSelected(context
350:                                .getHost()
351:                                .getBooleanProperty(
352:                                        Constants.OPTIONS_DISPLAY_SHOW_TEXT_ON_MAIN_TABS,
353:                                        true));
354:                showTextOnMainTabs.setMnemonic('t');
355:                UIUtil.jGridBagAdd(o, dockReportsAsTabs = new JCheckBox(
356:                        "Dock reports as tabs"), gbco,
357:                        GridBagConstraints.REMAINDER);
358:                dockReportsAsTabs.setSelected(context.getHost()
359:                        .getBooleanProperty(
360:                                Constants.OPTIONS_DISPLAY_DOCK_REPORTS_AS_TABS,
361:                                true));
362:                dockReportsAsTabs.setMnemonic('s');
363:                gbco.weightx = 0.0;
364:                UIUtil.jGridBagAdd(o, new JLabel("Tab placement"), gbco,
365:                        GridBagConstraints.RELATIVE);
366:                gbco.weightx = 1.0;
367:                UIUtil.jGridBagAdd(o, tabPlacement = new JComboBox(
368:                        TAB_PLACEMENT), gbco, GridBagConstraints.REMAINDER);
369:                tabPlacement.setSelectedIndex(context.getHost()
370:                        .getIntegerProperty(
371:                                Constants.OPTIONS_DISPLAY_TAB_PLACEMENT,
372:                                SwingConstants.TOP) - 1);
373:                gbco.weightx = 0.0;
374:                UIUtil.jGridBagAdd(o, new JLabel("Date format "), gbco,
375:                        GridBagConstraints.RELATIVE);
376:                gbco.weightx = 1.0;
377:                UIUtil
378:                        .jGridBagAdd(
379:                                o,
380:                                dateFormat = new StringListComboBox(
381:                                        context,
382:                                        context
383:                                                .getHost()
384:                                                .getProperty(
385:                                                        Constants.OPTIONS_DISPLAY_DATE_FORMAT,
386:                                                        "&"
387:                                                                + Constants.DEFAULT_DATE_FORMAT
388:                                                                + "|dd/MM/yyyy hh:mm:ss|hh:mm:ss MM/dd/yyyy|MM/dd/yyyy hh:mm:ss"),
389:                                        false), gbco,
390:                                GridBagConstraints.REMAINDER);
391:                dateFormat.setToolTipText("Uses Java's SimpleDateFormat class");
392:                gbco.weightx = 2.0;
393:                gbco.weighty = 1.0;
394:                UIUtil.jGridBagAdd(o, new JLabel(), gbco,
395:                        GridBagConstraints.REMAINDER);
396:                //  Editor
397:                JPanel z = new JPanel(new GridBagLayout());
398:                z.setBorder(BorderFactory.createTitledBorder("Editor"));
399:                GridBagConstraints gbcz = new GridBagConstraints();
400:                gbcz.insets = gbco.insets;
401:                gbcz.anchor = GridBagConstraints.WEST;
402:                gbcz.fill = GridBagConstraints.HORIZONTAL;
403:                gbcz.weighty = 0.0;
404:                gbcz.weightx = 0.0;
405:                UIUtil.jGridBagAdd(z, new JLabel("Font"), gbcz, 1);
406:                String s = context.getHost().getProperty(
407:                        Constants.OPTIONS_EDITOR_FONT, "");
408:                Font font = StringUtil.stringToFont(s);
409:                if (font == null) {
410:                    font = UIManager.getFont("EditorPane.font");
411:                }
412:                editorFont = new FontLabel(font);
413:                gbcz.weightx = 1.0;
414:                UIUtil.jGridBagAdd(z, editorFont, gbcz,
415:                        GridBagConstraints.RELATIVE);
416:                gbcz.weightx = 0.0;
417:                UIUtil.jGridBagAdd(z, chooseEditorFont = new JButton("Choose"),
418:                        gbcz, GridBagConstraints.REMAINDER);
419:                gbcz.weightx = 0.0;
420:                UIUtil.jGridBagAdd(z, new JLabel("Background"), gbcz, 1);
421:                gbcz.weightx = 2.0;
422:                UIUtil.jGridBagAdd(z, editorBackground = new ColorComboBox(),
423:                        gbcz, GridBagConstraints.REMAINDER);
424:                editorBackground.setColor(ColorUtil.getColor(
425:                        Constants.OPTIONS_EDITOR_BACKGROUND, UIManager
426:                                .getColor("TextPane.background"), context));
427:                gbcz.weightx = 0.0;
428:                UIUtil.jGridBagAdd(z, new JLabel("Foreground"), gbcz, 1);
429:                gbcz.weightx = 2.0;
430:                UIUtil.jGridBagAdd(z, editorForeground = new ColorComboBox(),
431:                        gbcz, GridBagConstraints.REMAINDER);
432:                editorForeground.setColor(ColorUtil.getColor(
433:                        Constants.OPTIONS_EDITOR_FOREGROUND, UIManager
434:                                .getColor("TextPane.foreground"), context));
435:                chooseEditorFont.addActionListener(this );
436:                chooseEditorFont.setMnemonic('c');
437:                gbcz.weighty = 1.0;
438:                UIUtil.jGridBagAdd(z, new JLabel("Tab size"), gbcz, 1);
439:                gbcz.weightx = 2.0;
440:                UIUtil
441:                        .jGridBagAdd(
442:                                z,
443:                                tabSize = new JNumericTextField(
444:                                        new Integer(1),
445:                                        new Integer(256),
446:                                        new Integer(
447:                                                context
448:                                                        .getHost()
449:                                                        .getIntegerProperty(
450:                                                                Constants.OPTIONS_EDITOR_TAB_SIZE,
451:                                                                4))), gbcz,
452:                                GridBagConstraints.REMAINDER);
453:
454:                //  Left
455:                JPanel l = new JPanel(new GridBagLayout());
456:                GridBagConstraints gbcl = new GridBagConstraints();
457:                gbcl.anchor = GridBagConstraints.WEST;
458:                gbcl.fill = GridBagConstraints.BOTH;
459:                gbcl.weighty = 0.0;
460:                gbcl.weightx = 1.0;
461:                UIUtil.jGridBagAdd(l, k, gbcl, GridBagConstraints.REMAINDER);
462:                UIUtil.jGridBagAdd(l, d, gbcl, GridBagConstraints.REMAINDER);
463:                UIUtil.jGridBagAdd(l, f, gbcl, GridBagConstraints.REMAINDER);
464:                gbcl.weighty = 1.0;
465:                UIUtil.jGridBagAdd(l, e, gbcl, GridBagConstraints.REMAINDER);
466:                //  Right
467:                JPanel r = new JPanel(new GridBagLayout());
468:                GridBagConstraints gbcr = new GridBagConstraints();
469:                gbcr.anchor = GridBagConstraints.WEST;
470:                gbcr.fill = GridBagConstraints.BOTH;
471:                gbcr.weighty = 0.0;
472:                gbcr.weightx = 1.0;
473:                UIUtil.jGridBagAdd(r, z, gbcr, GridBagConstraints.REMAINDER);
474:                gbcr.weighty = 1.0;
475:                UIUtil.jGridBagAdd(r, o, gbcr, GridBagConstraints.REMAINDER);
476:                //
477:                //
478:                setLayout(new GridBagLayout());
479:                GridBagConstraints gbc2 = new GridBagConstraints();
480:                gbc2.anchor = GridBagConstraints.CENTER;
481:                gbc2.fill = GridBagConstraints.BOTH;
482:                gbc2.weighty = 1.0;
483:                gbc2.weightx = 2.0;
484:                UIUtil.jGridBagAdd(this , l, gbc2, GridBagConstraints.RELATIVE);
485:                gbc2.weightx = 2.0;
486:                UIUtil.jGridBagAdd(this , r, gbc2, GridBagConstraints.REMAINDER);
487:            }
488:
489:            /**
490:             * DOCUMENT ME!
491:             *
492:             * @param evt DOCUMENT ME!
493:             */
494:            public void actionPerformed(ActionEvent evt) {
495:                if (evt.getSource() == chooseEditorFont) {
496:                    Font f = FontChooser.showDialog(this , editorFont
497:                            .getChosenFont(), getContext());
498:                    if (f != null) {
499:                        editorFont.setChosenFont(f);
500:                    }
501:                }
502:            }
503:
504:            /**
505:             * Validate the options
506:             *
507:             * @return <code>true</code> if the options were ok
508:             */
509:            public boolean validateTab() {
510:                try {
511:                    if (tabPlacement.getSelectedIndex() == -1) {
512:                        throw new Exception("Must selected a tab placement");
513:                    }
514:                } catch (Exception e) {
515:                    GruntspudUtil.showErrorMessage(this , "Error", e);
516:                    return false;
517:                }
518:                return true;
519:            }
520:
521:            /**
522:             * Invoked when the tab is selection
523:             */
524:            public void tabSelected() {
525:            }
526:
527:            /**
528:             * Apply the options
529:             */
530:            public void applyTab() {
531:                //
532:                getContext()
533:                        .getHost()
534:                        .setIntegerProperty(
535:                                Constants.OPTIONS_DISPLAY_COMMAND_OPTIONS_BYPASS_MASK,
536:                                (ctrlModifier.isSelected() ? KeyEvent.CTRL_MASK
537:                                        : 0)
538:                                        + (shiftModifier.isSelected() ? KeyEvent.SHIFT_MASK
539:                                                : 0)
540:                                        + (altModifier.isSelected() ? KeyEvent.ALT_MASK
541:                                                : 0));
542:                getContext().getHost().setProperty(
543:                        Constants.OPTIONS_DISPLAY_DATE_FORMAT,
544:                        dateFormat.getStringListPropertyString());
545:                getContext().getHost().setBooleanProperty(
546:                        Constants.OPTIONS_DISPLAY_USE_SYSTEM_ICONS,
547:                        useSystemIcons.isSelected());
548:                getContext().getHost().setBooleanProperty(
549:                        Constants.OPTIONS_DISPLAY_SPLIT_EXPLORER,
550:                        useSplitExplorer.isSelected());
551:                getContext().getHost().setBooleanProperty(
552:                        Constants.OPTIONS_DISPLAY_HIDE_FILES_IN_TREE,
553:                        hideFilesInTree.isSelected());
554:                getContext().getHost().setBooleanProperty(
555:                        Constants.OPTIONS_DISPLAY_SHOW_ROOT_TREE_NODE,
556:                        showRootTreeNode.isSelected());
557:                getContext().getHost().setBooleanProperty(
558:                        Constants.OPTIONS_DISPLAY_SHOW_LINE_ENDINGS,
559:                        showLineEndings.isSelected());
560:                getContext().getHost().setProperty(
561:                        Constants.OPTIONS_DISPLAY_EXPLORER_LINE_STYLE,
562:                        (String) explorerLineStyle.getSelectedItem());
563:                getContext().getHost().setBooleanProperty(
564:                        Constants.OPTIONS_DISPLAY_CASE_INSENSITIVE_SORT,
565:                        caseInsensitiveSort.isSelected());
566:                getContext().getHost().setBooleanProperty(
567:                        Constants.OPTIONS_DISPLAY_SORT_FOLDERS_FIRST,
568:                        sortFoldersFirst.isSelected());
569:                getContext()
570:                        .getHost()
571:                        .setBooleanProperty(
572:                                Constants.OPTIONS_DISPLAY_SHOW_FULL_PATH_FOR_HOME_LOCATION,
573:                                showFullPathForHomeLocation.isSelected());
574:                getContext().getHost().setBooleanProperty(
575:                        Constants.OPTIONS_DISPLAY_SUBST_TYPES_IN_TREE,
576:                        substTypesInTree.isSelected());
577:                getContext().getHost().setBooleanProperty(
578:                        Constants.OPTIONS_DISPLAY_USE_TOGGLED_FLATMODE,
579:                        useToggledFlatMode.isSelected());
580:                getContext()
581:                        .getHost()
582:                        .setBooleanProperty(
583:                                Constants.OPTIONS_DISPLAY_HIGHLIGHT_READ_ONLY_AND_MISSING_FILES,
584:                                highlightReadOnlyAndMissing.isSelected());
585:                getContext().getHost().setBooleanProperty(
586:                        Constants.OPTIONS_DISPLAY_DOCK_REPORTS_AS_TABS,
587:                        dockReportsAsTabs.isSelected());
588:                getContext().getHost().setBooleanProperty(
589:                        Constants.OPTIONS_DISPLAY_SHOW_TEXT_ON_MAIN_TABS,
590:                        showTextOnMainTabs.isSelected());
591:                getContext().getHost().setBooleanProperty(
592:                        Constants.OPTIONS_DISPLAY_SHOW_FILTERS_ON_TOOL_BAR,
593:                        showFiltersOnToolBar.isSelected());
594:                getContext().getHost().setBooleanProperty(
595:                        Constants.OPTIONS_DISPLAY_FILTER_TAB,
596:                        filterTab.isSelected());
597:                if (useScrollingTabs != null) {
598:                    getContext().getHost().setBooleanProperty(
599:                            Constants.OPTIONS_DISPLAY_USE_SCROLLING_TABS,
600:                            dockReportsAsTabs.isSelected());
601:                }
602:                getContext().getHost().setIntegerProperty(
603:                        Constants.OPTIONS_DISPLAY_TAB_PLACEMENT,
604:                        tabPlacement.getSelectedIndex() + 1);
605:                Font f = editorFont.getChosenFont();
606:                getContext().getHost().setProperty(
607:                        Constants.OPTIONS_EDITOR_FONT,
608:                        f.getName() + "," + f.getStyle() + "," + f.getSize());
609:                getContext().getHost().setProperty(
610:                        Constants.OPTIONS_DISPLAY_EXPLORER_CVS_NODE_TEXT_MASK,
611:                        explorerCVSNodeTextMask.getStringListPropertyString());
612:                getContext().getHost().setProperty(
613:                        Constants.OPTIONS_DISPLAY_FILE_CVS_NODE_TEXT_MASK,
614:                        fileCVSNodeTextMask.getStringListPropertyString());
615:                getContext().getHost().setProperty(
616:                        Constants.OPTIONS_DISPLAY_FLAT_CVS_NODE_TEXT_MASK,
617:                        flatCVSNodeTextMask.getStringListPropertyString());
618:                getContext().getHost().setProperty(
619:                        Constants.OPTIONS_EDITOR_BACKGROUND,
620:                        StringUtil.colorToString(editorBackground.getColor()));
621:                getContext().getHost().setProperty(
622:                        Constants.OPTIONS_EDITOR_FOREGROUND,
623:                        StringUtil.colorToString(editorForeground.getColor()));
624:                getContext().getHost().setProperty(
625:                        Constants.OPTIONS_EDITOR_TAB_SIZE,
626:                        String.valueOf(((Integer) tabSize.getValue())
627:                                .intValue()));
628:                //
629:                //        getContext().getViewManager().reload(null);
630:            }
631:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.