Source Code Cross Referenced for Window.java in  » Workflow-Engines » osbl-1_0 » org » osbl » client » wings » shell » 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 » Workflow Engines » osbl 1_0 » org.osbl.client.wings.shell 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.osbl.client.wings.shell;
002:
003:        import org.wings.SComponent;
004:        import org.wings.SButton;
005:
006:        import javax.swing.*;
007:        import java.util.*;
008:
009:        public class Window implements  Environment {
010:            protected Window parent;
011:
012:            boolean active;
013:            boolean visible;
014:            private SComponent contentPane;
015:
016:            private String titleCode;
017:            private Object[] titleArguments;
018:            private List<SComponent> controls;
019:            private List<Tool> tools;
020:            private List<Action> developmentActions;
021:            private Client.Message statusMessage;
022:            private boolean hasChanges;
023:            private SButton defaultButton;
024:
025:            protected final Client client;
026:
027:            public Window() {
028:                client = Client.getInstance();
029:            }
030:
031:            public Window(SComponent contentPane) {
032:                this .contentPane = contentPane;
033:                client = Client.getInstance();
034:            }
035:
036:            public Window(SComponent contentPane, String titleCode,
037:                    Object... titleArguments) {
038:                this .contentPane = contentPane;
039:                this .titleCode = titleCode;
040:                this .titleArguments = titleArguments;
041:                client = Client.getInstance();
042:            }
043:
044:            void setParent(Window parent) {
045:                this .parent = parent;
046:            }
047:
048:            public Environment getParent() {
049:                return parent;
050:            }
051:
052:            /**
053:             * The respective window stack is active.
054:             * @return
055:             */
056:            public boolean isActive() {
057:                return active;
058:            }
059:
060:            public void setActive(boolean active) {
061:                this .active = active;
062:                install();
063:            }
064:
065:            /**
066:             * The window is lying on top of its stack.
067:             * @return
068:             */
069:            public boolean isVisible() {
070:                return visible;
071:            }
072:
073:            public void setDelegate(Environment delegate) {
074:                // TODO: the delegate is actually the process client
075:            }
076:
077:            public Environment getDelegate() {
078:                return null;
079:            }
080:
081:            public void setVisible(boolean visible) {
082:                this .visible = visible;
083:                install();
084:            }
085:
086:            private void install() {
087:                if (active && visible) {
088:                    client.setContent(contentPane);
089:                    client.setTitle(title());
090:                    client.setControls(controls);
091:                    client.setTools(tools);
092:                    client.setDevelopmentActions(developmentActions);
093:                    client.setStatusMessage(statusMessage);
094:                    client.setDefaultButton(defaultButton);
095:                }
096:            }
097:
098:            private String title() {
099:                String title = titleCode != null ? client.getResourceProvider()
100:                        .getMessage(titleCode, titleArguments) : null;
101:                return parent != null ? parent.title() + " / " + title : title;
102:            }
103:
104:            public SComponent getContentPane() {
105:                return contentPane;
106:            }
107:
108:            public void setContentPane(SComponent contentPane) {
109:                if (this .contentPane != contentPane) {
110:                    this .contentPane = contentPane;
111:                    if (active && visible)
112:                        client.setContent(contentPane);
113:                }
114:            }
115:
116:            public SButton getDefaultButton() {
117:                return defaultButton;
118:            }
119:
120:            public void setDefaultButton(SButton defaultButton) {
121:                if (this .defaultButton != defaultButton) {
122:                    this .defaultButton = defaultButton;
123:                    if (active && visible)
124:                        client.setDefaultButton(defaultButton);
125:                }
126:            }
127:
128:            public void setTitle(String titleCode, Object... titleArguments) {
129:                if (isDifferent(this .titleCode, titleCode)
130:                        || isDifferent(this .titleArguments, titleArguments)) {
131:                    this .titleCode = titleCode;
132:                    this .titleArguments = titleArguments;
133:                    if (active && visible)
134:                        client.setTitle(title());
135:                }
136:            }
137:
138:            public String getTitleCode() {
139:                return titleCode;
140:            }
141:
142:            public void setTitleCode(String titleCode) {
143:                if (isDifferent(this .titleCode, titleCode)) {
144:                    this .titleCode = titleCode;
145:                    if (active && visible)
146:                        client.setTitle(title());
147:                }
148:            }
149:
150:            public Object[] getTitleArguments() {
151:                return titleArguments;
152:            }
153:
154:            public void setTitleArguments(Object[] titleArguments) {
155:                if (isDifferent(this .titleArguments, titleArguments)) {
156:                    this .titleArguments = titleArguments;
157:                    if (active && visible)
158:                        client.setTitle(title());
159:                }
160:            }
161:
162:            public List<SComponent> getControls() {
163:                return controls;
164:            }
165:
166:            public void addControl(SComponent component) {
167:                controls.add(component);
168:                if (active && visible)
169:                    client.setControls(controls);
170:            }
171:
172:            public void removeControl(SComponent component) {
173:                boolean changed = controls.remove(component);
174:                if (changed && active && visible)
175:                    client.setControls(controls);
176:            }
177:
178:            public void setControls(List<SComponent> controls) {
179:                if (isDifferent(this .controls, controls)) {
180:                    this .controls = controls;
181:                    if (active && visible)
182:                        client.setControls(controls);
183:                }
184:            }
185:
186:            public List<Tool> getTools() {
187:                return tools;
188:            }
189:
190:            public void addTool(Tool tool) {
191:                tools.add(tool);
192:                if (active && visible)
193:                    client.setTools(tools);
194:            }
195:
196:            public void removeTool(Tool tool) {
197:                boolean changed = tools.remove(tool);
198:                if (changed && active && visible)
199:                    client.setTools(tools);
200:            }
201:
202:            public void setTools(List<Tool> tools) {
203:                if (isDifferent(this .tools, tools)) {
204:                    this .tools = tools;
205:                    if (active && visible)
206:                        client.setTools(tools);
207:                }
208:            }
209:
210:            public List<Action> getDevelopmentActions() {
211:                return developmentActions;
212:            }
213:
214:            public void addDevelopmentAction(Action action) {
215:                developmentActions.add(action);
216:                if (active && visible)
217:                    client.setDevelopmentActions(developmentActions);
218:            }
219:
220:            public void removeDevelopmentAction(Action action) {
221:                boolean changed = developmentActions.remove(action);
222:                if (changed && active && visible)
223:                    client.setDevelopmentActions(developmentActions);
224:            }
225:
226:            public void setDevelopmentActions(List<Action> actions) {
227:                if (isDifferent(this .developmentActions, actions)) {
228:                    this .developmentActions = actions;
229:                    if (active && visible)
230:                        client.setDevelopmentActions(developmentActions);
231:                }
232:            }
233:
234:            public Client.Message getStatusMessage() {
235:                return statusMessage;
236:            }
237:
238:            public void setStatusMessage(Client.Message statusMessage) {
239:                this .statusMessage = statusMessage;
240:                if (active && visible)
241:                    client.setStatusMessage(statusMessage);
242:            }
243:
244:            public boolean getHasChanges() {
245:                return hasChanges;
246:            }
247:
248:            public void setHasChanges(boolean hasChanges) {
249:                this .hasChanges = hasChanges;
250:            }
251:
252:            protected static boolean isDifferent(Object oldObject,
253:                    Object newObject) {
254:                return oldObject != newObject
255:                        && (oldObject == null || !oldObject.equals(newObject));
256:            }
257:
258:            protected static boolean isDifferent(Object[] oldObjects,
259:                    Object[] newObjects) {
260:                return oldObjects != newObjects
261:                        && (oldObjects == null || !Arrays.equals(oldObjects,
262:                                newObjects));
263:            }
264:
265:            public String toString() {
266:                return titleCode;
267:            }
268:
269:            @Deprecated
270:            public static Window currentWindow(SComponent component) {
271:                return Client.getInstance().currentWindow(component);
272:            }
273:
274:            public static Window currentWindow(Environment environment) {
275:                do {
276:                    if (environment instanceof  Window)
277:                        return (Window) environment;
278:
279:                    environment = environment.getDelegate();
280:                } while (environment != null);
281:
282:                return null;
283:            }
284:
285:            public static Window getWindow(Environment environment) {
286:                if (!(environment instanceof  Window)) {
287:                    do {
288:                        environment = environment.getDelegate();
289:                    } while (environment != null
290:                            && !(environment instanceof  Window));
291:                }
292:                return (Window) environment;
293:            }
294:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.