Source Code Cross Referenced for SDialog.java in  » Swing-Library » wings3 » org » wings » 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 » Swing Library » wings3 » org.wings 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2000,2005 wingS development team.
003:         *
004:         * This file is part of wingS (http://wingsframework.org).
005:         *
006:         * wingS is free software; you can redistribute it and/or modify
007:         * it under the terms of the GNU Lesser General Public License
008:         * as published by the Free Software Foundation; either version 2.1
009:         * of the License, or (at your option) any later version.
010:         *
011:         * Please see COPYING for the complete licence.
012:         */
013:        package org.wings;
014:
015:        import org.apache.commons.logging.Log;
016:        import org.apache.commons.logging.LogFactory;
017:        import org.wings.plaf.DialogCG;
018:        import org.wings.plaf.FrameCG;
019:
020:        /**
021:         * Top-level window with a title and a border that is typically used to take
022:         * some form of input from the user. <p/> As opposed to Swing, wingS dialogs are
023:         * non modal. However, the dismission of the dialog is propagated by means of
024:         * ActionEvents. The action command of the event tells, what kind of user
025:         * activity caused the dialog to dismiss.
026:         * 
027:         * @author <a href="mailto:engels@mercatis.de">Holger Engels</a>
028:         * @author <a href="mailto:Roman.Raedle@uni-konstanz.de">Roman R&auml;dle</a>
029:         */
030:        public class SDialog extends SWindow {
031:            private final transient static Log log = LogFactory
032:                    .getLog(SDialog.class);
033:
034:            /**
035:             * Action command if dialog window was closed
036:             */
037:            public static final String CLOSE_ACTION = "CLOSE";
038:
039:            /**
040:             * Action command if user hit return
041:             */
042:            public static final String DEFAULT_ACTION = "DEFAULT";
043:
044:            /**
045:             * The Title of the Dialog Frame
046:             */
047:            protected String title;
048:
049:            protected SIcon icon = null;
050:
051:            protected boolean modal = false;
052:
053:            protected boolean draggable = true;
054:
055:            protected int x = -1;
056:            protected int y = -1;
057:
058:            private boolean closable = true;
059:            private boolean closed = false;
060:
061:            /**
062:             * Creates a Dialog without parent <code>SFrame</code> or
063:             * <code>SDialog</code> and without Title
064:             */
065:            public SDialog() {
066:            }
067:
068:            /**
069:             * Creates a dialog with the specifed parent <code>SFrame</code> as its
070:             * owner.
071:             * 
072:             * @param owner
073:             *            the parent <code>SFrame</code>
074:             */
075:            public SDialog(SFrame owner) {
076:                this (owner, null, false);
077:            }
078:
079:            /**
080:             * Creates a modal or non-modal dialog without a title and with the
081:             * specified owner <code>Frame</code>. If <code>owner</code> is
082:             * <code>null</code>, a shared, hidden frame will be set as the owner of
083:             * the dialog.
084:             * <p>
085:             * This constructor sets the component's locale property to the value
086:             * returned by <code>JComponent.getDefaultLocale</code>.
087:             * 
088:             * @param owner
089:             *            the <code>Frame</code> from which the dialog is displayed
090:             * @param modal
091:             *            true for a modal dialog, false for one that allows others
092:             *            windows to be active at the same time returns true.
093:             */
094:            public SDialog(SFrame owner, boolean modal) {
095:                this (owner, null, modal);
096:            }
097:
098:            /**
099:             * Creates a dialog with the specified title and the specified owner frame.
100:             * 
101:             * @param owner
102:             *            the parent <code>SFrame</code>
103:             * @param title
104:             *            the <code>String</code> to display as titke
105:             */
106:            public SDialog(SFrame owner, String title) {
107:                this (owner, title, false);
108:            }
109:
110:            /**
111:             * Creates a modal or non-modal dialog with the specified title and the
112:             * specified owner <code>Frame</code>. If <code>owner</code> is
113:             * <code>null</code>, a shared, hidden frame will be set as the owner of
114:             * this dialog. All constructors defer to this one.
115:             * <p>
116:             * NOTE: Any popup components (<code>JComboBox</code>,
117:             * <code>JPopupMenu</code>, <code>JMenuBar</code>) created within a
118:             * modal dialog will be forced to be lightweight.
119:             * <p>
120:             * This constructor sets the component's locale property to the value
121:             * returned by <code>JComponent.getDefaultLocale</code>.
122:             * 
123:             * @param owner
124:             *            the <code>Frame</code> from which the dialog is displayed
125:             * @param title
126:             *            the <code>String</code> to display in the dialog's title bar
127:             * @param modal
128:             *            true for a modal dialog, false for one that allows other
129:             *            windows to be active at the same time returns true.
130:             */
131:            public SDialog(SFrame owner, String title, boolean modal) {
132:                this .owner = owner;
133:                this .title = title;
134:                this .modal = modal;
135:            }
136:
137:            public int getX() {
138:                return x;
139:            }
140:
141:            public void setX(int x) {
142:                int oldX = x;
143:                this .x = x;
144:                if (oldX != x)
145:                    reload();
146:            }
147:
148:            public int getY() {
149:                return y;
150:            }
151:
152:            public void setY(int y) {
153:                int oldY = y;
154:                this .y = y;
155:                if (oldY != y)
156:                    reload();
157:            }
158:
159:            /**
160:             * Sets the title of the dialog.
161:             * 
162:             * @param t
163:             *            the title displayed in the dialog's border; a null value
164:             *            results in an empty title
165:             */
166:            public void setTitle(String t) {
167:                String oldTitle = title;
168:                title = t;
169:                if ((title == null && oldTitle != null)
170:                        || (title != null && !title.equals(oldTitle)))
171:                    reload();
172:            }
173:
174:            /**
175:             * Gets the title of the dialog. The title is displayed in the dialog's
176:             * border.
177:             * 
178:             * @return the title of this dialog window. The title may be null.
179:             */
180:            public String getTitle() {
181:                return title;
182:            }
183:
184:            public void setIcon(SIcon i) {
185:                if (i != icon || i != null && !i.equals(icon)) {
186:                    icon = i;
187:                    reload();
188:                }
189:            }
190:
191:            public SIcon getIcon() {
192:                return icon;
193:            }
194:
195:            public boolean isModal() {
196:                return modal;
197:            }
198:
199:            public void setModal(boolean modal) {
200:                this .modal = modal;
201:            }
202:
203:            public boolean isDraggable() {
204:                return draggable;
205:            }
206:
207:            public void setDraggable(boolean draggable) {
208:                this .draggable = draggable;
209:            }
210:
211:            public void hide() {
212:                super .hide();
213:            }
214:
215:            public void setClosable(boolean v) {
216:                boolean old = closable;
217:                closable = v;
218:                if (old != closable)
219:                    reload();
220:            }
221:
222:            public boolean isClosable() {
223:                return closable;
224:            }
225:
226:            // public void setClosed(boolean v) {
227:            // v &= isClosable();
228:            // boolean old = closed;
229:            // closed = v;
230:            // if (old != closed)
231:            // reload();
232:            // }
233:            //
234:            // public boolean isClosed() {
235:            // return closed;
236:            // }
237:
238:            // LowLevelEventListener interface. Handle own events.
239:            public void processLowLevelEvent(String action, String[] values) {
240:                processKeyEvents(values);
241:                if (action.endsWith("_keystroke"))
242:                    return;
243:
244:                if (action.indexOf("_") > -1) {
245:                    String[] actions = action.split("_");
246:                    if ("xy".equals(actions[1])) {
247:                        String[] coords = values[0].split(",");
248:
249:                        x = Integer.parseInt(coords[0]);
250:                        y = Integer.parseInt(coords[1]);
251:                        return;
252:                    }
253:                }
254:
255:                // is this a window event?
256:                try {
257:                    switch (new Integer(values[0]).intValue()) {
258:                    case org.wings.event.SInternalFrameEvent.INTERNAL_FRAME_CLOSED:
259:                        hide();
260:                        actionCommand = CLOSE_ACTION;
261:                        break;
262:                    default:
263:                        // form event
264:                        actionCommand = DEFAULT_ACTION;
265:                    }
266:                } catch (NumberFormatException ex) {
267:                    // no window event...
268:                }
269:                SForm.addArmedComponent(this ); // trigger later invocation of fire*()
270:            }
271:
272:            public void setCG(DialogCG cg) {
273:                super.setCG(cg);
274:            }
275:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.