Source Code Cross Referenced for ShellMainButtonBar.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.swt.SWT;
007:        import org.eclipse.swt.events.FocusEvent;
008:        import org.eclipse.swt.events.ModifyEvent;
009:        import org.eclipse.swt.events.ModifyListener;
010:        import org.eclipse.swt.events.MouseEvent;
011:        import org.eclipse.swt.graphics.Image;
012:        import org.eclipse.swt.layout.GridData;
013:        import org.eclipse.swt.layout.GridLayout;
014:        import org.eclipse.swt.widgets.Button;
015:        import org.eclipse.swt.widgets.Combo;
016:        import org.eclipse.swt.widgets.Composite;
017:        import org.eclipse.swt.widgets.Label;
018:        import org.eclipse.swt.widgets.MessageBox;
019:        import org.eclipse.swt.widgets.Text;
020:
021:        public class ShellMainButtonBar extends AbstractWidget {
022:            private static final int DEFAULT_LINE_THRESHOLD = 1000;
023:            private Image imageStart;
024:            private Image imageStop;
025:            private Text lineThreshold;
026:            private Combo purgePctCombo;
027:            private Button startStopBtn;
028:            private boolean toStopAllGroupLogs;
029:
030:            ShellMainButtonBar() {
031:                super ();
032:                this .imageStop = new Image(display, Util
033:                        .getOwnResource(projectProperties.getIconStop()));
034:                this .imageStart = new Image(display, Util
035:                        .getOwnResource(projectProperties.getIconStart()));
036:                this .toStopAllGroupLogs = false;
037:
038:            }
039:
040:            public int getLineThreshold() {
041:                String s = lineThreshold.getText();
042:                int i = 0;
043:
044:                try {
045:                    i = Integer.parseInt(s);
046:
047:                    if (i < 100) {
048:                        throw new NumberFormatException(
049:                                "Line count less than 100.");
050:                    }
051:                } catch (NumberFormatException e) {
052:                    MessageBox mb = new MessageBox(parentShell, SWT.OK
053:                            | SWT.ICON_ERROR);
054:                    mb.setText("Error");
055:                    mb
056:                            .setMessage("Invalid line count: "
057:                                    + s
058:                                    + ". Please specify a numeric value greater than 100.");
059:                    mb.open();
060:
061:                    i = DEFAULT_LINE_THRESHOLD;
062:                    lineThreshold.setText(String
063:                            .valueOf(DEFAULT_LINE_THRESHOLD));
064:                }
065:
066:                return i;
067:            }
068:
069:            public int getPurgePercentage() {
070:                String s = purgePctCombo.getItem(purgePctCombo
071:                        .getSelectionIndex());
072:                s = s.replaceFirst("\\%", "");
073:                return Integer.parseInt(s);
074:            }
075:
076:            public void resetStartStopButton() {
077:                startStopBtn.setImage(imageStop);
078:                startStopBtn.setToolTipText("Stop All Group Logs");
079:            }
080:
081:            public void run() {
082:                GridLayout gridLayout = new GridLayout(6, false);
083:                gridLayout.marginHeight = 0;
084:                gridLayout.marginWidth = 0;
085:                gridLayout.horizontalSpacing = 2;
086:                gridLayout.verticalSpacing = 0;
087:
088:                Composite barComposite = new Composite(parentShell, SWT.NONE);
089:                barComposite.setLayout(gridLayout);
090:                barComposite.setLayoutData(new GridData(
091:                        GridData.FILL_HORIZONTAL));
092:
093:                Button optionBtn = new Button(barComposite, SWT.FLAT);
094:                optionBtn.setToolTipText("Options...");
095:                optionBtn.setImage(new Image(display, Util
096:                        .getOwnResource(projectProperties.getIconConfig())));
097:
098:                Button zoomInBtn = new Button(barComposite, SWT.FLAT);
099:                zoomInBtn.setImage(new Image(display, Util
100:                        .getOwnResource(projectProperties.getIconZoomIn())));
101:                zoomInBtn.setToolTipText("Increase Font Size");
102:
103:                Button zoomOutBtn = new Button(barComposite, SWT.FLAT);
104:                zoomOutBtn.setImage(new Image(display, Util
105:                        .getOwnResource(projectProperties.getIconZoomOut())));
106:                zoomOutBtn.setToolTipText("Decrease Font Size");
107:
108:                startStopBtn = new Button(barComposite, SWT.FLAT);
109:                startStopBtn.setImage(imageStop);
110:                startStopBtn.setToolTipText("Stop All Group Logs");
111:
112:                Button clearBtn = new Button(barComposite, SWT.FLAT);
113:                clearBtn.setImage(new Image(display, Util
114:                        .getOwnResource(projectProperties.getIconClearAll())));
115:                clearBtn.setToolTipText("Clear All Group Logs");
116:
117:                Composite logPurgeComposite = new Composite(barComposite,
118:                        SWT.NONE);
119:                logPurgeComposite.setLayout(new GridLayout(5, false));
120:                logPurgeComposite.setLayoutData(new GridData(
121:                        GridData.FILL_HORIZONTAL
122:                                | GridData.HORIZONTAL_ALIGN_END));
123:
124:                new Label(logPurgeComposite, SWT.NONE).setText("Purge");
125:                purgePctCombo = new Combo(logPurgeComposite, SWT.READ_ONLY);
126:                purgePctCombo.setItems(new String[] { "25%", "50%", "75%",
127:                        "100%" });
128:
129:                purgePctCombo.select(0);
130:                purgePctCombo.pack();
131:                new Label(logPurgeComposite, SWT.NONE)
132:                        .setText("of the log when reaches ");
133:                lineThreshold = new Text(logPurgeComposite, SWT.BORDER);
134:                lineThreshold.setText(String.valueOf(DEFAULT_LINE_THRESHOLD));
135:                lineThreshold.pack();
136:                new Label(logPurgeComposite, SWT.NONE).setText("lines.");
137:
138:                purgePctCombo.addModifyListener(new ModifyListener() {
139:                    public void modifyText(ModifyEvent e) {
140:                        mediator
141:                                .handleEvent(ActionMediator.EVENT_UPDATE_LOG_SIZE_HANDLER);
142:                    }
143:                });
144:
145:                lineThreshold.addFocusListener(new GenericListener() {
146:                    public void focusLost(FocusEvent e) {
147:                        mediator
148:                                .handleEvent(ActionMediator.EVENT_UPDATE_LOG_SIZE_HANDLER);
149:                    }
150:                });
151:
152:                optionBtn.addMouseListener(new GenericListener() {
153:                    public void mouseUp(MouseEvent e) {
154:                        mediator
155:                                .handleEvent(ActionMediator.EVENT_DISPLAY_OPTIONS);
156:                    }
157:                });
158:
159:                // increase font size
160:                zoomInBtn.addMouseListener(new GenericListener() {
161:                    public void mouseUp(MouseEvent e) {
162:                        mediator
163:                                .handleEvent(ActionMediator.EVENT_INCREASE_FONT_SIZE);
164:                    }
165:                });
166:
167:                // decrease font size
168:                zoomOutBtn.addMouseListener(new GenericListener() {
169:                    public void mouseUp(MouseEvent e) {
170:                        mediator
171:                                .handleEvent(ActionMediator.EVENT_DECREASE_FONT_SIZE);
172:                    }
173:                });
174:
175:                // start/stop all group logs
176:                startStopBtn.addMouseListener(new GenericListener() {
177:                    public void mouseUp(MouseEvent e) {
178:                        // toggle this state
179:                        toStopAllGroupLogs = !toStopAllGroupLogs;
180:                        mediator
181:                                .handleEvent(ActionMediator.EVENT_START_STOP_ALL_GROUP_LOGS);
182:                    }
183:                });
184:
185:                // clear all group logs
186:                clearBtn.addMouseListener(new GenericListener() {
187:                    public void mouseUp(MouseEvent e) {
188:                        mediator
189:                                .handleEvent(ActionMediator.EVENT_CLEAR_ALL_GROUP_LOGS);
190:                    }
191:                });
192:            }
193:
194:            public void setupStartStopLogButton(boolean showStartState) {
195:                if (showStartState) {
196:                    startStopBtn.setImage(imageStart);
197:                    startStopBtn.setToolTipText("Start All Group Logs");
198:                } else {
199:                    startStopBtn.setImage(imageStop);
200:                    startStopBtn.setToolTipText("Stop All Group Logs");
201:                }
202:            }
203:
204:            public boolean toStopAllGroupLogs() {
205:                return toStopAllGroupLogs;
206:            }
207:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.