Source Code Cross Referenced for DebugPanel.java in  » Web-Framework » wingS » com » javujavu » javux » demo » 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 » Web Framework » wingS » com.javujavu.javux.demo 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *	Javu WingS - Lightweight Java Component Set
003:         *	Copyright (c) 2005-2007 Krzysztof A. Sadlocha
004:         *	e-mail: ksadlocha@programics.com
005:         *
006:         *	This library is free software; you can redistribute it and/or
007:         *	modify it under the terms of the GNU Lesser General Public
008:         *	License as published by the Free Software Foundation; either
009:         *	version 2.1 of the License, or (at your option) any later version.
010:         *
011:         *	This library is distributed in the hope that it will be useful,
012:         *	but WITHOUT ANY WARRANTY; without even the implied warranty of
013:         *	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014:         *	Lesser General Public License for more details.
015:         *
016:         *	You should have received a copy of the GNU Lesser General Public
017:         *	License along with this library; if not, write to the Free Software
018:         *	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
019:         */
020:
021:        package com.javujavu.javux.demo;
022:
023:        import java.awt.GridBagConstraints;
024:        import java.awt.GridBagLayout;
025:        import java.awt.Insets;
026:        import java.awt.event.ActionEvent;
027:        import java.awt.event.ActionListener;
028:        import java.awt.event.ItemEvent;
029:        import java.awt.event.ItemListener;
030:        import java.awt.event.KeyEvent;
031:        import com.javujavu.javux.wings.MenuRadioGroup;
032:        import com.javujavu.javux.wings.RadioGroup;
033:        import com.javujavu.javux.wings.WingButton;
034:        import com.javujavu.javux.wings.WingCheckBox;
035:        import com.javujavu.javux.wings.WingComponent;
036:        import com.javujavu.javux.wings.WingLabel;
037:        import com.javujavu.javux.wings.WingMenu;
038:        import com.javujavu.javux.wings.WingMenuItem;
039:        import com.javujavu.javux.wings.WingPanel;
040:        import com.javujavu.javux.wings.WingTextPane;
041:        import com.javujavu.javux.wings.dialogs.WingMessageBox;
042:        import com.javujavu.javux.wings.item.LabelItem;
043:        import com.javujavu.javux.wings.text.ImageNode;
044:
045:        public class DebugPanel extends WingPanel implements  ActionListener,
046:                ItemListener {
047:            private WingCheckBox cbDisDoubleBuf;
048:            private WingCheckBox cbShowEvents;
049:            private final WingSetPanel owner;
050:            private WingCheckBox cbDelayNo;
051:            private WingCheckBox cbDelay10;
052:            private WingCheckBox cbDelay50;
053:            private WingCheckBox cbDelay100;
054:            private WingCheckBox cbDelay200;
055:            private WingCheckBox cbDelay500;
056:            private WingCheckBox cbSkinDelayNo;
057:            private WingCheckBox cbSkinDelay50;
058:            private WingCheckBox cbSkinDelay250;
059:            private WingButton bRemoveSkins;
060:            private WingCheckBox cbLightPopups;
061:            private WingCheckBox cbHeavyPopups;
062:            private WingMenuItem miShowEvents;
063:            private WingMenuItem miLightPopups;
064:            private WingMenuItem miHeavyPopups;
065:            private WingMenuItem miDisDoubleBuf;
066:            private WingMenuItem miDelayNo;
067:            private WingMenuItem miDelay10;
068:            private WingMenuItem miDelay50;
069:            private WingMenuItem miDelay100;
070:            private WingMenuItem miDelay200;
071:            private WingMenuItem miDelay500;
072:            private WingMenu mPaintDelay;
073:            private WingMenuItem miSkinDelayNo;
074:            private WingMenuItem miSkinDelay50;
075:            private WingMenuItem miSkinDelay250;
076:            private WingButton bInfo;
077:            private WingMenuItem miInfo;
078:
079:            public DebugPanel(WingSetPanel owner) {
080:
081:                this .owner = owner;
082:                this .setLayout(new GridBagLayout());
083:                WingPanel panel = new WingPanel(new GridBagLayout());
084:                panel.setStyleId("border1");
085:                GridBagConstraints c0 = new GridBagConstraints();
086:                c0.insets = new Insets(10, 10, 10, 10);
087:                c0.anchor = GridBagConstraints.CENTER;
088:                c0.fill = GridBagConstraints.BOTH;
089:                c0.gridwidth = GridBagConstraints.REMAINDER;
090:                this .add(panel, c0);
091:
092:                GridBagConstraints c = new GridBagConstraints();
093:                c.insets = new Insets(8, 5, 8, 5);
094:                c.gridwidth = GridBagConstraints.REMAINDER;
095:                c.weighty = 1.0;
096:                c.fill = GridBagConstraints.HORIZONTAL;
097:                WingLabel l;
098:                panel
099:                        .add(
100:                                l = new WingLabel(
101:                                        "Debug options. Read tooltip carefully before click anything!",
102:                                        CENTER), c);
103:                l.setStyleId("warning");
104:
105:                c.gridwidth = 1;
106:                panel.add(cbShowEvents = new WingCheckBox("show event log"), c);
107:                LabelItem tip, tip1;
108:                cbShowEvents
109:                        .setTooltip(tip1 = new LabelItem(
110:                                "Event log displays events\n posted by components\nWingS components post 4 folowing events\nActionEvent\nItemEvent\nTextEvent (WingTextField only)\nAdjustmentEvent (WingScroll only)\nThat's enough in real world",
111:                                WingSet.imgConfused, LEFT, LEFT));
112:                c.gridwidth = GridBagConstraints.REMAINDER;
113:                panel.add(bInfo = new WingButton("System Info"), c);
114:
115:                c.gridwidth = 1;
116:                panel.add(cbLightPopups = new WingCheckBox(
117:                        "enable lightweight popups"), c);
118:                cbLightPopups
119:                        .setTooltip(new LabelItem(
120:                                "Enable/disable lightweight popups\nfor menus,tooltips and comboboxes\nLightweight popups appear in existing window",
121:                                WingSet.imgLaughing));
122:                cbLightPopups.setSelected(true);
123:                c.gridwidth = GridBagConstraints.REMAINDER;
124:                panel.add(cbHeavyPopups = new WingCheckBox(
125:                        "enable heavyweight popups"), c);
126:                cbHeavyPopups.setSelected(true);
127:                cbHeavyPopups
128:                        .setTooltip(new LabelItem(
129:                                "Enable/disable heavyweight popups\nfor menus,tooltips and comboboxes\nHeavyweight popups create new window",
130:                                WingSet.imgUgly));
131:
132:                tip = new LabelItem(
133:                        "Disable double buffering\nto see how components are painted\nChoose paint delay to slow down painting to see it better",
134:                        WingSet.imgGlasses, LEFT, LEFT);
135:                panel.add(cbDisDoubleBuf = new WingCheckBox(
136:                        "disable double buffering"), c);
137:                cbDisDoubleBuf.setTooltip(tip);
138:                c.gridwidth = 1;
139:                panel.add(l = new WingLabel("paint delay: "), c);
140:                l.setTooltip(tip);
141:                RadioGroup g = new RadioGroup();
142:                panel.add(cbDelayNo = new WingCheckBox("no", RADIO), c);
143:                cbDelayNo.setTooltip(tip);
144:                cbDelayNo.setEnabled(false);
145:                g.add(cbDelayNo);
146:                panel.add(cbDelay10 = new WingCheckBox("10ms", RADIO), c);
147:                cbDelay10.setTooltip(tip);
148:                cbDelay10.setEnabled(false);
149:                g.add(cbDelay10);
150:                c.gridwidth = GridBagConstraints.REMAINDER;
151:                panel.add(cbDelay50 = new WingCheckBox("50ms", RADIO), c);
152:                cbDelay50.setTooltip(tip);
153:                cbDelay50.setEnabled(false);
154:                g.add(cbDelay50);
155:                c.gridwidth = 1;
156:                panel.add(new WingLabel(), c);
157:                panel.add(cbDelay100 = new WingCheckBox("100ms", RADIO), c);
158:                cbDelay100.setTooltip(tip);
159:                cbDelay100.setEnabled(false);
160:                g.add(cbDelay100);
161:                panel.add(cbDelay200 = new WingCheckBox("200ms", RADIO), c);
162:                cbDelay200.setTooltip(tip);
163:                cbDelay200.setEnabled(false);
164:                g.add(cbDelay200);
165:                c.gridwidth = GridBagConstraints.REMAINDER;
166:                panel.add(cbDelay500 = new WingCheckBox("500ms", RADIO), c);
167:                cbDelay500.setTooltip(tip);
168:                cbDelay500.setEnabled(false);
169:                g.add(cbDelay500);
170:                cbDelayNo.setSelected(true);
171:
172:                tip = new LabelItem("Skin load delay slow down skin loading",
173:                        WingSet.imgTongue, LEFT, LEFT);
174:                c.gridwidth = 1;
175:                panel.add(l = new WingLabel("skin load delay: "), c);
176:                l.setTooltip(tip);
177:                g = new RadioGroup();
178:                panel.add(cbSkinDelayNo = new WingCheckBox("no", RADIO), c);
179:                cbSkinDelayNo.setTooltip(tip);
180:                g.add(cbSkinDelayNo);
181:                panel.add(cbSkinDelay50 = new WingCheckBox("50ms", RADIO), c);
182:                cbSkinDelay50.setTooltip(tip);
183:                g.add(cbSkinDelay50);
184:                c.gridwidth = GridBagConstraints.REMAINDER;
185:                panel.add(cbSkinDelay250 = new WingCheckBox("250ms", RADIO), c);
186:                cbSkinDelay250.setTooltip(tip);
187:                g.add(cbSkinDelay250);
188:                cbSkinDelayNo.setSelected(true);
189:
190:                c.fill = GridBagConstraints.NONE;
191:                panel.add(bRemoveSkins = new WingButton(
192:                        "remove all skin resources"), c);
193:                bRemoveSkins.setStyleId("warning");
194:                bRemoveSkins
195:                        .setTooltip(new LabelItem(
196:                                "Click here to see what will happen\n"
197:                                        + "if you forget to call loadSkin at startup or lose skin resources.\n"
198:                                        + "Javu WingS doesn't crash on lost resources. \nTo get back just change skin.\n"
199:                                        + "Click this with disabled double buffering if you dare ;-)",
200:                                WingSet.imgStop));
201:
202:                WingMenu m = new WingMenu("\u0332Debug", KeyEvent.VK_D,
203:                        KeyEvent.ALT_MASK);
204:                m.setTooltip(new LabelItem("Debug options. Click carefully!",
205:                        WingSet.imgStop));
206:                m.add(miLightPopups = new WingMenuItem(
207:                        "Enable lightweight popups", CHECKBOX));
208:                miLightPopups.setSelected(true);
209:                m.add(miHeavyPopups = new WingMenuItem(
210:                        "Enable heavyweight popups", CHECKBOX));
211:                miHeavyPopups.setSelected(true);
212:                m.addSeparator();
213:                m.add(miDisDoubleBuf = new WingMenuItem(
214:                        "Disable double buffering", CHECKBOX));
215:                mPaintDelay = new WingMenu("Paint delay");
216:                mPaintDelay.setEnabled(false);
217:
218:                MenuRadioGroup g2 = new MenuRadioGroup();
219:                mPaintDelay.add(miDelayNo = new WingMenuItem("no", RADIO));
220:                g2.add(miDelayNo);
221:                mPaintDelay.add(miDelay10 = new WingMenuItem("10ms", RADIO));
222:                g2.add(miDelay10);
223:                mPaintDelay.add(miDelay50 = new WingMenuItem("50ms", RADIO));
224:                g2.add(miDelay50);
225:                mPaintDelay.add(miDelay100 = new WingMenuItem("100ms", RADIO));
226:                g2.add(miDelay100);
227:                mPaintDelay.add(miDelay200 = new WingMenuItem("200ms", RADIO));
228:                g2.add(miDelay200);
229:                mPaintDelay.add(miDelay500 = new WingMenuItem("500ms", RADIO));
230:                g2.add(miDelay500);
231:                miDelayNo.setSelected(true);
232:                m.add(mPaintDelay);
233:
234:                m.addSeparator();
235:                WingMenu m2 = new WingMenu("Skin load delay");
236:                g2 = new MenuRadioGroup();
237:                m2.add(miSkinDelayNo = new WingMenuItem("no", RADIO));
238:                g2.add(miSkinDelayNo);
239:                m2.add(miSkinDelay50 = new WingMenuItem("50ms", RADIO));
240:                g2.add(miSkinDelay50);
241:                m2.add(miSkinDelay250 = new WingMenuItem("250ms", RADIO));
242:                g2.add(miSkinDelay250);
243:                miSkinDelayNo.setSelected(true);
244:                m.add(m2);
245:
246:                owner.getMenu().addSeparator();
247:                owner.getMenu().add(m);
248:                owner.getMenu().add(
249:                        miShowEvents = new WingMenuItem("Show Event \u0332Log",
250:                                CHECKBOX, KeyEvent.VK_L, KeyEvent.ALT_MASK));
251:                owner.getMenu().add(miInfo = new WingMenuItem("System Info"));
252:                miShowEvents.setTooltip(tip1);
253:                miShowEvents.addItemListener(this );
254:                miInfo.addActionListener(this );
255:                m.addItemListener(this );
256:
257:                this .addActionListener(this );
258:                this .addItemListener(this );
259:            }
260:
261:            public void itemStateChanged(ItemEvent e) {
262:                Object src = e.getSource();
263:                if (src == cbDisDoubleBuf || src == miDisDoubleBuf) {
264:                    if (src == miDisDoubleBuf)
265:                        cbDisDoubleBuf.setSelected(miDisDoubleBuf.isSelected());
266:                    if (src == cbDisDoubleBuf)
267:                        miDisDoubleBuf.setSelected(cbDisDoubleBuf.isSelected());
268:
269:                    boolean debug = e.getStateChange() == ItemEvent.SELECTED;
270:                    cbDelayNo.setEnabled(debug);
271:                    cbDelay10.setEnabled(debug);
272:                    cbDelay50.setEnabled(debug);
273:                    cbDelay100.setEnabled(debug);
274:                    cbDelay200.setEnabled(debug);
275:                    cbDelay500.setEnabled(debug);
276:                    mPaintDelay.setEnabled(debug);
277:
278:                    if (!debug)
279:                        WingComponent.setDebugDelay(0);
280:                    WingComponent.setDoubleBuffering(!debug);
281:                } else if (src == cbShowEvents || src == miShowEvents) {
282:                    if (src == miShowEvents)
283:                        cbShowEvents.setSelected(miShowEvents.isSelected());
284:                    if (src == cbShowEvents)
285:                        miShowEvents.setSelected(cbShowEvents.isSelected());
286:                    owner
287:                            .showEventLog(e.getStateChange() == ItemEvent.SELECTED);
288:                } else if (src == cbLightPopups || src == cbHeavyPopups
289:                        || src == miLightPopups || src == miHeavyPopups) {
290:                    if (src == miLightPopups)
291:                        cbLightPopups.setSelected(miLightPopups.isSelected());
292:                    if (src == cbLightPopups)
293:                        miLightPopups.setSelected(cbLightPopups.isSelected());
294:                    if (src == miHeavyPopups)
295:                        cbHeavyPopups.setSelected(miHeavyPopups.isSelected());
296:                    if (src == cbHeavyPopups)
297:                        miHeavyPopups.setSelected(cbHeavyPopups.isSelected());
298:                    enablePopups(cbLightPopups.isSelected(), cbHeavyPopups
299:                            .isSelected());
300:                }
301:                int delay = (src == cbDelayNo || src == miDelayNo) ? 0
302:                        : (src == cbDelay10 || src == miDelay10) ? 10
303:                                : (src == cbDelay50 || src == miDelay50) ? 50
304:                                        : (src == cbDelay100 || src == miDelay100) ? 100
305:                                                : (src == cbDelay200 || src == miDelay200) ? 200
306:                                                        : (src == cbDelay500 || src == miDelay500) ? 500
307:                                                                : -1;
308:                if (delay != -1) {
309:                    WingComponent.setDebugDelay(delay);
310:
311:                    if (delay == 0) {
312:                        cbDelayNo.setSelected(true);
313:                        miDelayNo.setSelected(true);
314:                    } else if (delay == 10) {
315:                        cbDelay10.setSelected(true);
316:                        miDelay10.setSelected(true);
317:                    } else if (delay == 50) {
318:                        cbDelay50.setSelected(true);
319:                        miDelay50.setSelected(true);
320:                    } else if (delay == 100) {
321:                        cbDelay100.setSelected(true);
322:                        miDelay100.setSelected(true);
323:                    } else if (delay == 200) {
324:                        cbDelay200.setSelected(true);
325:                        miDelay200.setSelected(true);
326:                    } else if (delay == 500) {
327:                        cbDelay500.setSelected(true);
328:                        miDelay500.setSelected(true);
329:                    }
330:                }
331:                int skinDelay = (src == cbSkinDelayNo || src == miSkinDelayNo) ? 0
332:                        : (src == cbSkinDelay50 || src == miSkinDelay50) ? 50
333:                                : (src == cbSkinDelay250 || src == miSkinDelay250) ? 250
334:                                        : -1;
335:                if (skinDelay != -1) {
336:                    WingSet.skinDelay = skinDelay;
337:                    if (skinDelay == 0) {
338:                        cbSkinDelayNo.setSelected(true);
339:                        miSkinDelayNo.setSelected(true);
340:                    } else if (skinDelay == 50) {
341:                        cbSkinDelay50.setSelected(true);
342:                        miSkinDelay50.setSelected(true);
343:                    } else if (skinDelay == 250) {
344:                        cbSkinDelay250.setSelected(true);
345:                        miSkinDelay250.setSelected(true);
346:                    }
347:                }
348:            }
349:
350:            public void actionPerformed(ActionEvent e) {
351:                Object src = e.getSource();
352:                if (src == bRemoveSkins) {
353:                    owner.removeSkin();
354:                } else if (src == bInfo || src == miInfo) {
355:                    showSystemInfo();
356:                }
357:            }
358:
359:            private void showSystemInfo() {
360:                String[] props = { "java.version", "java.vendor",
361:                        "java.vendor.url", null, "os.name", "os.arch",
362:                        "os.version", null, "java.vm.specification.version",
363:                        "java.vm.specification.vendor",
364:                        "java.vm.specification.name", null, "java.vm.version",
365:                        "java.vm.vendor", "java.vm.name", null,
366:                        "java.specification.version",
367:                        "java.specification.vendor", "java.specification.name",
368:                        null, "java.class.version", "java.compiler", null,
369:                        "user.name", null };
370:
371:                String s = "  Javu WingS version: "
372:                        + WingComponent.WINGS_VERSION;
373:                s += "\n\nSystem Info\n";
374:                for (int i = 0; i < props.length; i++) {
375:                    if (props[i] == null)
376:                        s += "\n";
377:                    else
378:                        try {
379:                            s += "\n" + props[i] + ": "
380:                                    + System.getProperty(props[i], "unknown");
381:                        } catch (SecurityException e) {
382:                            s += "\n" + props[i] + " not accessible: "
383:                                    + e.getMessage();
384:                        }
385:                }
386:                WingTextPane ta = new WingTextPane();
387:                ta.setStyleId("about");
388:                ta.setEditable(false);
389:                ta.insert(-1, new ImageNode(WingSet.imgIcon, "[icon]", null));
390:                ta.insert(-1, s);
391:                (new WingMessageBox(getParentFrame(), "System Info", ta, "OK",
392:                        null, null)).showMessage(WingSetPanel.the);
393:            }
394:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.