Source Code Cross Referenced for JBRMSEntryPoint.java in  » Rule-Engine » drolls-Rule-Engine » org » drools » brms » client » 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 » Rule Engine » drolls Rule Engine » org.drools.brms.client 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2005 JBoss Inc
003:         * 
004:         * Licensed under the Apache License, Version 2.0 (the "License");
005:         * you may not use this file except in compliance with the License.
006:         * You may obtain a copy of the License at
007:         * 
008:         *      http://www.apache.org/licenses/LICENSE-2.0
009:         * 
010:         * Unless required by applicable law or agreed to in writing, software
011:         * distributed under the License is distributed on an "AS IS" BASIS,
012:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013:         * See the License for the specific language governing permissions and
014:         * limitations under the License.
015:         */
016:
017:        package org.drools.brms.client;
018:
019:        import org.drools.brms.client.JBRMSFeature.ComponentInfo;
020:        import org.drools.brms.client.common.GenericCallback;
021:        import org.drools.brms.client.rpc.RepositoryServiceFactory;
022:
023:        import com.google.gwt.core.client.EntryPoint;
024:        import com.google.gwt.user.client.Command;
025:        import com.google.gwt.user.client.History;
026:        import com.google.gwt.user.client.HistoryListener;
027:        import com.google.gwt.user.client.Window;
028:        import com.google.gwt.user.client.ui.DialogBox;
029:        import com.google.gwt.user.client.ui.DockPanel;
030:        import com.google.gwt.user.client.ui.HTML;
031:        import com.google.gwt.user.client.ui.HasAlignment;
032:        import com.google.gwt.user.client.ui.PopupPanel;
033:        import com.google.gwt.user.client.ui.RootPanel;
034:        import com.google.gwt.user.client.ui.VerticalPanel;
035:
036:        /**
037:         * This is the main launching/entry point for the JBRMS web console.
038:         * It essentially sets the initial layout.
039:         * 
040:         * If you hadn't noticed, this is using GWT from google. Refer to GWT docs 
041:         * if GWT is new to you (it is quite a different way of building web apps).
042:         */
043:        public class JBRMSEntryPoint implements  EntryPoint, HistoryListener {
044:
045:            private ComponentInfo curInfo;
046:            private JBRMSFeature curSink;
047:            private HTML description = new HTML();
048:            private JBRMSFeatureList list = new JBRMSFeatureList();
049:            private DockPanel panel = new DockPanel();
050:            private DockPanel sinkContainer;
051:            private LoginWidget loginWidget;
052:            private LoggedInUserInfo loggedInUserInfo;
053:
054:            public void onHistoryChanged(String token) {
055:                // Find the SinkInfo associated with the history context. If one is
056:                // found, show it (It may not be found, for example, when the user mis-
057:                // types a URL, or on startup, when the first context will be "").
058:                ComponentInfo info = list.find(token);
059:                if (info == null) {
060:                    showInfo();
061:                    return;
062:                }
063:                show(info, false);
064:            }
065:
066:            public void onModuleLoad() {
067:
068:                // Load all the sinks.
069:                JBRMSFeatureConfigurator.configure(list);
070:
071:                // Put the sink list on the left, and add the outer dock panel to the
072:                // root.
073:                sinkContainer = new DockPanel();
074:                sinkContainer.setStyleName("ks-Sink");
075:
076:                VerticalPanel vp = new VerticalPanel();
077:                vp.setWidth("100%");
078:                vp.add(description);
079:                vp.add(sinkContainer);
080:
081:                description.setStyleName("ks-Info");
082:
083:                panel.add(list, DockPanel.WEST);
084:                panel.add(vp, DockPanel.CENTER);
085:
086:                panel.setCellVerticalAlignment(list, HasAlignment.ALIGN_TOP);
087:                panel.setCellWidth(vp, "100%");
088:
089:                History.addHistoryListener(this );
090:
091:                loggedInUserInfo = new LoggedInUserInfo();
092:                loginWidget = new LoginWidget();
093:
094:                RootPanel.get().add(loggedInUserInfo);
095:                RootPanel.get().add(panel);
096:                RootPanel.get().add(loginWidget);
097:                loginWidget.setWidth("100%");
098:
099:                loggedInUserInfo.setVisible(false);
100:                panel.setVisible(false);
101:                loginWidget.setVisible(false);
102:
103:                checkLoggedIn();
104:
105:                // Show the initial screen.
106:                String initToken = History.getToken();
107:                if (initToken.length() > 0)
108:                    onHistoryChanged(initToken);
109:                else
110:                    showInfo();
111:            }
112:
113:            /**
114:             * Check if user is logged in, if not, then show prompt.
115:             * If it is, then we show the app, in all its glory !
116:             */
117:            private void checkLoggedIn() {
118:
119:                RepositoryServiceFactory.getSecurityService().getCurrentUser(
120:                        new GenericCallback() {
121:
122:                            public void onSuccess(Object data) {
123:                                String userName = (String) data;
124:                                if (userName != null) {
125:                                    loggedInUserInfo.setUserName(userName);
126:                                    loggedInUserInfo.setVisible(true);
127:                                    panel.setVisible(true);
128:                                    loginWidget.setVisible(false);
129:                                } else {
130:
131:                                    loginWidget.setVisible(true);
132:                                    loginWidget.setLoggedInEvent(new Command() {
133:                                        public void execute() {
134:                                            loggedInUserInfo
135:                                                    .setUserName(loginWidget
136:                                                            .getUserName());
137:                                            loggedInUserInfo.setVisible(true);
138:                                            loginWidget.setVisible(false);
139:                                            panel.setVisible(true);
140:                                        }
141:                                    });
142:
143:                                }
144:                            }
145:
146:                        });
147:
148:            }
149:
150:            public void show(ComponentInfo info, boolean affectHistory) {
151:                // Don't bother re-displaying the existing sink. This can be an issue
152:                // in practice, because when the history context is set, our
153:                // onHistoryChanged() handler will attempt to show the currently-visible
154:                // sink.
155:                if (info == curInfo)
156:                    return;
157:                curInfo = info;
158:
159:                // Remove the old sink from the display area.
160:                if (curSink != null) {
161:                    curSink.onHide();
162:                    sinkContainer.remove(curSink);
163:                }
164:
165:                // Get the new sink instance, and display its description in the
166:                // sink list.
167:                curSink = info.getInstance();
168:                list.setSinkSelection(info.getName());
169:                description.setHTML(info.getDescription());
170:
171:                // If affectHistory is set, create a new item on the history stack. This
172:                // will ultimately result in onHistoryChanged() being called. It will call
173:                // show() again, but nothing will happen because it will request the exact
174:                // same sink we're already showing.
175:                if (affectHistory)
176:                    History.newItem(info.getName());
177:
178:                // Display the new sink.
179:                sinkContainer.add(curSink, DockPanel.CENTER);
180:                sinkContainer.setCellWidth(curSink, "100%");
181:                //sinkContainer.setCellHeight(curSink, "100%");
182:                sinkContainer.setCellVerticalAlignment(curSink,
183:                        DockPanel.ALIGN_TOP);
184:                curSink.onShow();
185:
186:            }
187:
188:            private void showInfo() {
189:                show(list.find("Info"), false);
190:            }
191:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.