Source Code Cross Referenced for ShellOption.java in  » Development » Tracelog » net » sourceforge » tracelog » ui » 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 » Development » Tracelog » net.sourceforge.tracelog.ui 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package net.sourceforge.tracelog.ui;
002:
003:        import net.sourceforge.tracelog.listeners.GenericListener;
004:        import net.sourceforge.tracelog.utils.Util;
005:
006:        import org.eclipse.jface.viewers.ISelectionChangedListener;
007:        import org.eclipse.jface.viewers.IStructuredSelection;
008:        import org.eclipse.jface.viewers.ITreeContentProvider;
009:        import org.eclipse.jface.viewers.SelectionChangedEvent;
010:        import org.eclipse.jface.viewers.TreeViewer;
011:        import org.eclipse.jface.viewers.Viewer;
012:        import org.eclipse.swt.SWT;
013:        import org.eclipse.swt.events.MouseEvent;
014:        import org.eclipse.swt.graphics.Image;
015:        import org.eclipse.swt.layout.GridData;
016:        import org.eclipse.swt.layout.GridLayout;
017:        import org.eclipse.swt.widgets.Button;
018:        import org.eclipse.swt.widgets.Composite;
019:        import org.eclipse.swt.widgets.Control;
020:        import org.eclipse.swt.widgets.Shell;
021:
022:        public class ShellOption extends AbstractWidget {
023:            // private Logger log = Logger.getLogger(ShellOption.class);
024:
025:            private Composite buttonComposite;
026:            private Composite categoryComposite;
027:            private Composite contentComposite;
028:            private GridLayout defaultGL;
029:            private Composite frameComposite;
030:            private ShellOptionMenu optionMenu;
031:            private Shell optionShell;
032:
033:            /**
034:             * Package-access constructor.
035:             */
036:            ShellOption() {
037:                super ();
038:                this .optionShell = null;
039:
040:                defaultGL = new GridLayout();
041:                defaultGL.horizontalSpacing = 0;
042:                defaultGL.verticalSpacing = 0;
043:                defaultGL.marginHeight = 0;
044:                defaultGL.marginWidth = 0;
045:            }
046:
047:            public void run() {
048:                optionShell = new Shell(parentShell, SWT.SHELL_TRIM
049:                        | SWT.SYSTEM_MODAL);
050:                optionShell.setImage(new Image(display, Util
051:                        .getOwnResource(projectProperties.getShellIconPath())));
052:                optionShell.setLayout(defaultGL);
053:                optionShell.setText("Options");
054:                optionShell.setMinimumSize(800, 600);
055:
056:                frameComposite = new Composite(optionShell, SWT.NONE);
057:                frameComposite.setLayout(new GridLayout(2, false));
058:                frameComposite.setLayoutData(UIUtil.getGridDataFillBoth());
059:
060:                categoryComposite = new Composite(frameComposite, SWT.BORDER);
061:                categoryComposite.setLayout(defaultGL);
062:                GridData categoryGD = UIUtil.getGridDataFillVertical();
063:                categoryGD.widthHint = 150;
064:                categoryComposite.setLayoutData(categoryGD);
065:                categoryComposite.setBackground(UIUtil.getColorWhite());
066:
067:                contentComposite = new Composite(frameComposite, SWT.NONE);
068:                contentComposite.setLayout(defaultGL);
069:                contentComposite.setLayoutData(UIUtil.getGridDataFillBoth());
070:
071:                GridData buttonGD = new GridData(GridData.FILL_HORIZONTAL
072:                        | GridData.HORIZONTAL_ALIGN_END);
073:                buttonGD.horizontalSpan = 2;
074:
075:                buttonComposite = new Composite(frameComposite, SWT.NONE);
076:                buttonComposite.setLayout(defaultGL);
077:                buttonComposite.setLayoutData(buttonGD);
078:
079:                setupMenu();
080:                setupCategoryList();
081:                setupButton();
082:
083:                optionMenu.getChildren()[0].showContent();
084:
085:                UIUtil.centerAlignedShell(parentShell, optionShell);
086:                optionShell.open();
087:                optionShell.layout();
088:            }
089:
090:            private void clearContent() {
091:                for (Control control : contentComposite.getChildren()) {
092:                    control.dispose();
093:                }
094:            }
095:
096:            private void setupButton() {
097:                Button closeBtn = new Button(buttonComposite, SWT.PUSH);
098:                closeBtn.setText("Close");
099:                GridData gd = UIUtil.getGridDataFillHorizontal();
100:                gd.minimumWidth = 100;
101:
102:                closeBtn.setLayoutData(gd);
103:
104:                closeBtn.addMouseListener(new GenericListener() {
105:                    public void mouseUp(MouseEvent e) {
106:                        optionShell.dispose();
107:                    }
108:                });
109:            }
110:
111:            private void setupCategoryList() {
112:                final TreeViewer treeViewer = new TreeViewer(categoryComposite,
113:                        SWT.NONE);
114:                treeViewer.getTree().setLayout(new GridLayout());
115:                treeViewer.getTree().setLayoutData(
116:                        new GridData(GridData.FILL_BOTH));
117:                treeViewer
118:                        .addSelectionChangedListener(new ISelectionChangedListener() {
119:                            public void selectionChanged(
120:                                    SelectionChangedEvent event) {
121:                                if (event.getSelection() instanceof  IStructuredSelection) {
122:                                    clearContent();
123:
124:                                    IStructuredSelection structuredSelection = (IStructuredSelection) event
125:                                            .getSelection();
126:                                    ((ShellOptionMenu) structuredSelection
127:                                            .getFirstElement()).showContent();
128:                                }
129:                            }
130:                        });
131:
132:                treeViewer.setContentProvider(new ITreeContentProvider() {
133:                    public void dispose() {
134:                    }
135:
136:                    public Object[] getChildren(Object arg0) {
137:                        return ((ShellOptionMenu) arg0).getChildren();
138:                    }
139:
140:                    public Object[] getElements(Object arg0) {
141:                        return optionMenu.getChildren();
142:                    }
143:
144:                    public Object getParent(Object arg0) {
145:                        return ((ShellOptionMenu) arg0).getParent();
146:                    }
147:
148:                    public boolean hasChildren(Object arg0) {
149:                        return ((ShellOptionMenu) arg0).hasChildren();
150:                    }
151:
152:                    public void inputChanged(Viewer arg0, Object arg1,
153:                            Object arg2) {
154:                    }
155:                });
156:
157:                treeViewer.setInput("root");
158:                treeViewer.expandAll();
159:            }
160:
161:            private void setupMenu() {
162:                optionMenu = new ShellOptionMenu("Root", null);
163:
164:                optionMenu.addChild(new ShellOptionMenu("General",
165:                        widgetFactory.createOptionShellGeneral(optionShell,
166:                                contentComposite, mediator)));
167:
168:                ShellOptionMenu logConfig = new ShellOptionMenu(
169:                        "Log Configuration", null);
170:                logConfig.addChild(new ShellOptionMenu("Log Groups",
171:                        widgetFactory.createOptionShellLogGroup(optionShell,
172:                                contentComposite, mediator)));
173:                logConfig.addChild(new ShellOptionMenu("Log Files",
174:                        widgetFactory.createOptionShellLogFile(optionShell,
175:                                contentComposite, mediator)));
176:
177:                optionMenu.addChild(logConfig);
178:            }
179:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.