Source Code Cross Referenced for PreferencesPanelBase.java in  » ESB » cbesb-1.2 » com » bostechcorp » cbesb » console » client » preference » 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 » ESB » cbesb 1.2 » com.bostechcorp.cbesb.console.client.preference 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * ChainBuilder ESB
003:         *          Visual Enterprise Integration
004:         * 
005:         * Copyright (C) 2006 Bostech Corporation
006:         * 
007:         * This program is free software; you can redistribute it and/or modify it 
008:         * under the terms of the GNU General Public License as published by the 
009:         * Free Software Foundation; either version 2 of the License, or (at your option) 
010:         * any later version.
011:         *
012:         * This program is distributed in the hope that it will be useful, 
013:         * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
014:         * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 
015:         * for more details.
016:         * 
017:         * You should have received a copy of the GNU General Public License along with 
018:         * this program; if not, write to the Free Software Foundation, Inc., 
019:         * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
020:         *
021:         * LogPreferencesPanel
022:         * LPS
023:         * Nov 5, 2007
024:         */package com.bostechcorp.cbesb.console.client.preference;
025:
026:        import com.bostechcorp.cbesb.console.client.Admin;
027:        import com.bostechcorp.cbesb.console.client.ConsoleCallback;
028:        import com.bostechcorp.cbesb.console.client.StyleConstants;
029:        import com.bostechcorp.cbesb.console.client.dialogs.ConfirmationLogBufferSizeDialog;
030:        import com.bostechcorp.cbesb.console.client.dialogs.MessageViewDialog;
031:        import com.bostechcorp.cbesb.console.common.ConsoleUserSettingInfo;
032:        import com.bostechcorp.cbesb.console.common.Constants;
033:        import com.bostechcorp.cbesb.console.i18n.ConsoleMessages;
034:        import com.bostechcorp.cbesb.console.rpc.ConsoleSetting;
035:        import com.bostechcorp.cbesb.console.rpc.ConsoleSettingAsync;
036:        import com.google.gwt.core.client.GWT;
037:        import com.google.gwt.user.client.rpc.ServiceDefTarget;
038:        import com.google.gwt.user.client.ui.ClickListener;
039:        import com.google.gwt.user.client.ui.FlexTable;
040:        import com.google.gwt.user.client.ui.HasHorizontalAlignment;
041:        import com.google.gwt.user.client.ui.HasVerticalAlignment;
042:        import com.google.gwt.user.client.ui.HorizontalPanel;
043:        import com.google.gwt.user.client.ui.Label;
044:        import com.google.gwt.user.client.ui.ListBox;
045:        import com.google.gwt.user.client.ui.PushButton;
046:        import com.google.gwt.user.client.ui.TextBox;
047:        import com.google.gwt.user.client.ui.VerticalPanel;
048:        import com.google.gwt.user.client.ui.Widget;
049:
050:        /**
051:         * @author LPS
052:         * 
053:         */
054:        public abstract class PreferencesPanelBase extends Admin {
055:
056:            private TextBox textComponentRefreshRate = new TextBox();
057:            private TextBox textSaRefreshRate = new TextBox();
058:            private TextBox textEndpointStatusRefreshRate = new TextBox();
059:            private TextBox textStatisticsRefreshRate = new TextBox();
060:            private TextBox textAlertViewRefreshRate = new TextBox();
061:            private TextBox textErrorDbPageSize = new TextBox();
062:            private TextBox textAlertViewPageSize = new TextBox();
063:            private TextBox textLogViewerNumOfLine = new TextBox();
064:            private TextBox textLogViewerLineBufferSize = new TextBox();
065:            private ListBox saInEndpointViewListBox = new ListBox();
066:            private TextBox textLogRefreshRate = new TextBox();
067:
068:            private Label componentRefreshRateLabel = new Label(
069:                    ((ConsoleMessages) GWT.create(ConsoleMessages.class))
070:                            .ComponentRefreshRate()
071:                            + ":");
072:            private Label saRefreshRateLabel = new Label(((ConsoleMessages) GWT
073:                    .create(ConsoleMessages.class)).SaRefreshRate()
074:                    + ":");
075:            private Label endpointStatusRefreshRateLabel = new Label(
076:                    ((ConsoleMessages) GWT.create(ConsoleMessages.class))
077:                            .EndpointStatusRefreshRate()
078:                            + ":");
079:            private Label statisticsRefreshRateLabel = new Label(
080:                    ((ConsoleMessages) GWT.create(ConsoleMessages.class))
081:                            .StatisticsRefreshRate()
082:                            + ":");
083:            private Label alertViewRefreshRateLabel = new Label(
084:                    ((ConsoleMessages) GWT.create(ConsoleMessages.class))
085:                            .AlertViewRefreshRate()
086:                            + ":");
087:            private Label errorDbPageSizeLabel = new Label(
088:                    ((ConsoleMessages) GWT.create(ConsoleMessages.class))
089:                            .ErrorDbPageSize()
090:                            + ":");;
091:            private Label alertViewPageSizeLabel = new Label(
092:                    ((ConsoleMessages) GWT.create(ConsoleMessages.class))
093:                            .AlertViewPageSize()
094:                            + ":");;
095:            private Label logViewerNumOfLineLabel = new Label(
096:                    ((ConsoleMessages) GWT.create(ConsoleMessages.class))
097:                            .LogViewerNumOfLine()
098:                            + ":");;
099:            private Label logViewerLineBufferSizeLabel = new Label(
100:                    ((ConsoleMessages) GWT.create(ConsoleMessages.class))
101:                            .LogViewerLineBufferSize()
102:                            + ":");
103:            private Label saInEndpointViewLabel = new Label(
104:                    ((ConsoleMessages) GWT.create(ConsoleMessages.class))
105:                            .SaInEndpointView()
106:                            + ":");
107:            private Label logRefreshRate = new Label(((ConsoleMessages) GWT
108:                    .create(ConsoleMessages.class)).LogRefreshRate()
109:                    + ":");
110:
111:            Label unitLabel;
112:            private VerticalPanel preferencePanel = new VerticalPanel();
113:            private HorizontalPanel buttonPanel = new HorizontalPanel();
114:
115:            FlexTable orderTable = new FlexTable();
116:            PushButton saveButton = new PushButton(((ConsoleMessages) GWT
117:                    .create(ConsoleMessages.class)).Save_Configuration());
118:            private PushButton restoreButton = new PushButton(
119:                    ((ConsoleMessages) GWT.create(ConsoleMessages.class))
120:                            .RestoreToDefault());
121:
122:            private static ConsoleSettingAsync setting = null;
123:            String userId;
124:            private boolean isUser;
125:
126:            //	public ConsoleUserSettingInfo consoleUserSettingInfo;
127:            //	ConsoleUserSettingInfo consoleSetting;
128:            public void init(String userId, boolean isUser) {
129:                this .userId = userId;
130:                this .isUser = isUser;
131:                addSaveButtonClickListener();
132:                createWidget();
133:                initTable();
134:                initWidget(preferencePanel);
135:                showWaitingDialog();
136:                refresh();
137:            }
138:
139:            abstract void addSaveButtonClickListener();
140:
141:            /*
142:             * (non-Javadoc)
143:             * 
144:             * @see com.bostechcorp.cbesb.console.client.Admin#onHide()
145:             */
146:            public void onHide() {
147:
148:            }
149:
150:            public abstract void saveProperties();
151:
152:            /*
153:             * (non-Javadoc)
154:             * 
155:             * @see com.bostechcorp.cbesb.console.client.Admin#onShow()
156:             */
157:            public void onShow() {
158:                refresh();
159:
160:            }
161:
162:            /*
163:             * (non-Javadoc)
164:             * 
165:             * @see com.bostechcorp.cbesb.console.client.Admin#refresh()
166:             */
167:
168:            protected void createWidget() {
169:
170:                restoreButton.addClickListener(new RestoreButtonClickListener(
171:                        this ));
172:                buttonPanel.add(saveButton);
173:                if (isUser)
174:                    buttonPanel.add(restoreButton);
175:                //		logPreferencePanel.add(buttonPanel);
176:                //		logPreferencePanel.add(orderTable);
177:
178:            }
179:
180:            public boolean confirmeText(String getText) {
181:                boolean isvalid = true;
182:                for (int i = 0; i < getText.length(); i++) {
183:                    isvalid = Character.isDigit(getText.charAt(i));
184:                }
185:                return isvalid;
186:            }
187:
188:            private void initTable() {
189:                orderTable.setBorderWidth(3);
190:                orderTable.setStyleName(StyleConstants.TABLE_STYLE);
191:                orderTable.getRowFormatter().setStyleName(0,
192:                        StyleConstants.TABLE_HEADER_STYLE);
193:                for (int i = 1; i < 12; i++) {
194:                    orderTable.getRowFormatter().setStyleName(i,
195:                            StyleConstants.TABLE_TD_STYLE);
196:                }
197:                if (isUser)
198:                    orderTable.setHTML(0, 0, "<h4>"
199:                            + ((ConsoleMessages) GWT
200:                                    .create(ConsoleMessages.class))
201:                                    .UserPreferences() + "</h4>");
202:                else
203:                    orderTable.setHTML(0, 0, "<h4>"
204:                            + ((ConsoleMessages) GWT
205:                                    .create(ConsoleMessages.class))
206:                                    .DefaultPreferences() + "</h4>");
207:                orderTable.setHTML(0, 1, "<h4>"
208:                        + ((ConsoleMessages) GWT.create(ConsoleMessages.class))
209:                                .unit() + "</h4>");
210:                orderTable.getFlexCellFormatter().setVerticalAlignment(0, 0,
211:                        HasVerticalAlignment.ALIGN_MIDDLE);
212:
213:                orderTable.getFlexCellFormatter().setColSpan(0, 0, 2);
214:
215:                //textInterval.setText("100");
216:                orderTable.setWidget(1, 0, componentRefreshRateLabel);
217:                orderTable.setWidget(1, 1, textComponentRefreshRate);
218:                orderTable.getCellFormatter().setHorizontalAlignment(1, 1,
219:                        HasHorizontalAlignment.ALIGN_CENTER);
220:
221:                //textLength.setText("100");
222:                orderTable.setWidget(2, 0, saRefreshRateLabel);
223:                orderTable.setWidget(2, 1, textSaRefreshRate);
224:                orderTable.getCellFormatter().setHorizontalAlignment(2, 1,
225:                        HasHorizontalAlignment.ALIGN_CENTER);
226:
227:                //textMaxLength.setText("3000");
228:                orderTable.setWidget(3, 0, endpointStatusRefreshRateLabel);
229:                orderTable.setWidget(3, 1, textEndpointStatusRefreshRate);
230:                orderTable.getCellFormatter().setHorizontalAlignment(3, 1,
231:                        HasHorizontalAlignment.ALIGN_CENTER);
232:
233:                orderTable.setWidget(4, 0, statisticsRefreshRateLabel);
234:                orderTable.setWidget(4, 1, textStatisticsRefreshRate);
235:                orderTable.getCellFormatter().setHorizontalAlignment(4, 1,
236:                        HasHorizontalAlignment.ALIGN_CENTER);
237:
238:                orderTable.setWidget(5, 0, alertViewRefreshRateLabel);
239:                orderTable.setWidget(5, 1, textAlertViewRefreshRate);
240:                orderTable.getCellFormatter().setHorizontalAlignment(5, 1,
241:                        HasHorizontalAlignment.ALIGN_CENTER);
242:
243:                orderTable.setWidget(6, 0, errorDbPageSizeLabel);
244:                orderTable.setWidget(6, 1, textErrorDbPageSize);
245:                orderTable.getCellFormatter().setHorizontalAlignment(6, 1,
246:                        HasHorizontalAlignment.ALIGN_CENTER);
247:
248:                orderTable.setWidget(7, 0, alertViewPageSizeLabel);
249:                orderTable.setWidget(7, 1, textAlertViewPageSize);
250:                orderTable.getCellFormatter().setHorizontalAlignment(7, 1,
251:                        HasHorizontalAlignment.ALIGN_CENTER);
252:
253:                orderTable.setWidget(8, 0, logViewerNumOfLineLabel);
254:                orderTable.setWidget(8, 1, textLogViewerNumOfLine);
255:                orderTable.getCellFormatter().setHorizontalAlignment(8, 1,
256:                        HasHorizontalAlignment.ALIGN_CENTER);
257:
258:                orderTable.setWidget(9, 0, logViewerLineBufferSizeLabel);
259:                orderTable.setWidget(9, 1, textLogViewerLineBufferSize);
260:                orderTable.getCellFormatter().setHorizontalAlignment(9, 1,
261:                        HasHorizontalAlignment.ALIGN_CENTER);
262:
263:                orderTable.setWidget(10, 0, logRefreshRate);
264:                orderTable.setWidget(10, 1, textLogRefreshRate);
265:                orderTable.getCellFormatter().setHorizontalAlignment(10, 1,
266:                        HasHorizontalAlignment.ALIGN_CENTER);
267:
268:                orderTable.setWidget(11, 0, saInEndpointViewLabel);
269:                orderTable.setWidget(11, 1, saInEndpointViewListBox);
270:
271:                saInEndpointViewListBox.addItem("one");
272:                saInEndpointViewListBox.addItem("many");
273:                saInEndpointViewListBox.setWidth("100%");
274:                orderTable.getCellFormatter().setHorizontalAlignment(11, 1,
275:                        HasHorizontalAlignment.ALIGN_CENTER);
276:
277:                for (int i = 1; i < 12; i++) {
278:                    if (i < 6 || i == 10) {
279:                        unitLabel = new Label(" "
280:                                + ((ConsoleMessages) GWT
281:                                        .create(ConsoleMessages.class))
282:                                        .timeUnit() + " ");
283:                        orderTable.setWidget(i, 2, unitLabel);
284:                    } else {
285:                        unitLabel = new Label("  ");
286:                        orderTable.setWidget(i, 2, unitLabel);
287:                    }
288:                }
289:            }
290:
291:            /**
292:             * @param consoleSetting
293:             * @return
294:             */
295:            public boolean setConsoleUserSetting(
296:                    ConsoleUserSettingInfo consoleSetting) {
297:                if (textComponentRefreshRate.getText().equals("")
298:                        || textSaRefreshRate.getText().equals("")
299:                        || textEndpointStatusRefreshRate.getText().equals("")
300:                        || textStatisticsRefreshRate.getText().equals("")
301:                        || textAlertViewRefreshRate.getText().equals("")
302:                        || textErrorDbPageSize.getText().equals("")
303:                        || textAlertViewPageSize.getText().equals("")
304:                        || textLogViewerNumOfLine.getText().equals("")
305:                        || textLogViewerLineBufferSize.getText().equals("")
306:                        || textLogRefreshRate.getText().equals("")) {
307:                    MessageViewDialog.showWarning(((ConsoleMessages) GWT
308:                            .create(ConsoleMessages.class))
309:                            .nullPropertiesMessage());
310:                    return false;
311:                } else if (!(confirmeText(textComponentRefreshRate.getText())
312:                        && confirmeText(textSaRefreshRate.getText())
313:                        && confirmeText(textEndpointStatusRefreshRate.getText())
314:                        && confirmeText(textStatisticsRefreshRate.getText())
315:                        && confirmeText(textAlertViewRefreshRate.getText())
316:                        && confirmeText(textErrorDbPageSize.getText())
317:                        && confirmeText(textAlertViewPageSize.getText())
318:                        && confirmeText(textLogViewerNumOfLine.getText())
319:                        && confirmeText(textLogViewerLineBufferSize.getText()) && confirmeText(textLogRefreshRate
320:                        .getText()))) {
321:                    MessageViewDialog.showWarning(((ConsoleMessages) GWT
322:                            .create(ConsoleMessages.class))
323:                            .numberConfirmMessage());
324:                    return false;
325:                }
326:                //		else if (Integer.parseInt(textStatisticsRefreshRate.getText())<60)
327:                //		{
328:                //			MessageViewDialog.showWarning(((ConsoleMessages) GWT.create(ConsoleMessages.class)).StatisticsRefreshRateConfirmMessage());
329:                //			return false;
330:                //		}
331:                else if (Integer
332:                        .parseInt(textLogViewerLineBufferSize.getText()) >= 2000) {
333:                    //			return Window.confirm(((ConsoleMessages)GWT.create(ConsoleMessages.class)).hugeSizeWarning());
334:                    showConfirmDialogBox(consoleSetting);
335:                    return false;
336:                } else {
337:                    saveProperties(consoleSetting);
338:                    return true;
339:                }
340:            }
341:
342:            public void saveProperties(ConsoleUserSettingInfo consoleSetting) {
343:                consoleSetting.setComponentRefreshRate(textComponentRefreshRate
344:                        .getText());
345:                consoleSetting.setSaRefreshRate(textSaRefreshRate.getText());
346:                consoleSetting
347:                        .setEndpointStatusRefreshRate(textEndpointStatusRefreshRate
348:                                .getText());
349:                consoleSetting
350:                        .setStatisticsRefreshRate(textStatisticsRefreshRate
351:                                .getText());
352:                consoleSetting.setAlertViewRefreshRate(textAlertViewRefreshRate
353:                        .getText());
354:                consoleSetting
355:                        .setErrorDbPageSize(textErrorDbPageSize.getText());
356:                consoleSetting.setAlertViewPageSize(textAlertViewPageSize
357:                        .getText());
358:                consoleSetting.setLogViewerNumOfLine(textLogViewerNumOfLine
359:                        .getText());
360:                consoleSetting
361:                        .setLogViewerLineBufferSize(textLogViewerLineBufferSize
362:                                .getText());
363:                consoleSetting
364:                        .setSaInEndpointView(saInEndpointViewListBox
365:                                .getItemText(saInEndpointViewListBox
366:                                        .getSelectedIndex()));
367:                consoleSetting.setLogRefreshRate(textLogRefreshRate.getText());
368:                //		return consoleSetting;
369:            }
370:
371:            private void showConfirmDialogBox(
372:                    ConsoleUserSettingInfo consoleSetting) {
373:                ConfirmationLogBufferSizeDialog.showConfirm(this ,
374:                        consoleSetting);
375:            }
376:
377:            public void displayUserProperties(ConsoleUserSettingInfo result) {
378:                textComponentRefreshRate
379:                        .setText(((ConsoleUserSettingInfo) result)
380:                                .getComponentRefreshRate());
381:                textSaRefreshRate.setText(((ConsoleUserSettingInfo) result)
382:                        .getSaRefreshRate());
383:                textEndpointStatusRefreshRate
384:                        .setText(((ConsoleUserSettingInfo) result)
385:                                .getEndpointStatusRefreshRate());
386:                textStatisticsRefreshRate
387:                        .setText(((ConsoleUserSettingInfo) result)
388:                                .getStatisticsRefreshRate());
389:                textAlertViewRefreshRate
390:                        .setText(((ConsoleUserSettingInfo) result)
391:                                .getAlertViewRefreshRate());
392:                textErrorDbPageSize.setText(((ConsoleUserSettingInfo) result)
393:                        .getErrorDbPageSize());
394:                textAlertViewPageSize.setText(((ConsoleUserSettingInfo) result)
395:                        .getAlertViewPageSize());
396:                textLogViewerNumOfLine
397:                        .setText(((ConsoleUserSettingInfo) result)
398:                                .getLogViewerNumOfLine());
399:                textLogViewerLineBufferSize
400:                        .setText(((ConsoleUserSettingInfo) result)
401:                                .getLogViewerLineBufferSize());
402:                textLogRefreshRate.setText(((ConsoleUserSettingInfo) result)
403:                        .getLogRefreshRate());
404:
405:                if (((ConsoleUserSettingInfo) result).getSaInEndpointView()
406:                        .equalsIgnoreCase("one"))
407:                    saInEndpointViewListBox.setSelectedIndex(0);
408:                else
409:                    saInEndpointViewListBox.setSelectedIndex(1);
410:
411:                preferencePanel.add(buttonPanel);
412:                preferencePanel.add(orderTable);
413:            }
414:
415:            public static ConsoleSettingAsync getConsoleSettingAsyncFromModule() {
416:                if (setting == null) {
417:                    setting = (ConsoleSettingAsync) GWT
418:                            .create(ConsoleSetting.class);
419:                    ServiceDefTarget jmxConnectTarget = (ServiceDefTarget) setting;
420:                    String relativeUrl = GWT.getModuleBaseURL()
421:                            + Constants.CONSOLE_SETTING;
422:                    jmxConnectTarget.setServiceEntryPoint(relativeUrl);
423:                }
424:                return setting;
425:            }
426:
427:            class RestoreButtonClickListener extends ConsoleCallback implements 
428:                    ClickListener {
429:                public RestoreButtonClickListener(Admin admin) {
430:                    super (admin);
431:                }
432:
433:                public void onClick(Widget sender) {
434:                    if (sender == restoreButton) {
435:                        getConsoleSettingAsyncFromModule()
436:                                .restoreConsoleUserSetting(userId, this );
437:                    }
438:                }
439:
440:                public void handleSuccess(Object result) {
441:                    refresh();
442:                }
443:            }
444:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.