Source Code Cross Referenced for InternalFrameCG.java in  » Swing-Library » wings3 » org » wings » plaf » css » 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.plaf.css 
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.plaf.css;
014:
015:        import org.apache.commons.logging.Log;
016:        import org.apache.commons.logging.LogFactory;
017:        import org.wings.*;
018:        import org.wings.event.SInternalFrameEvent;
019:        import org.wings.io.Device;
020:        import org.wings.io.StringBuilderDevice;
021:        import org.wings.plaf.Update.Handler;
022:        import org.wings.plaf.css.FrameCG.AddWindowUpdate;
023:        import org.wings.plaf.css.FrameCG.RemoveWindowUpdate;
024:        import org.wings.plaf.css.script.OnPageRenderedScript;
025:        import org.wings.plaf.Update;
026:        import org.wings.resource.ResourceManager;
027:        import org.wings.session.ScriptManager;
028:        import org.wings.util.SStringBuilder;
029:
030:        import java.io.IOException;
031:        import java.util.HashMap;
032:        import java.util.Map;
033:
034:        public class InternalFrameCG extends AbstractComponentCG implements 
035:                org.wings.plaf.InternalFrameCG {
036:            private static final long serialVersionUID = 1L;
037:            private final static Log log = LogFactory
038:                    .getLog(InternalFrameCG.class);
039:            protected static final String WINDOWICON_CLASSNAME = "WindowIcon";
040:            protected static final String BUTTONICON_CLASSNAME = "WindowButton";
041:            private SIcon closeIcon;
042:            private SIcon deiconifyIcon;
043:            private SIcon iconifyIcon;
044:            private SIcon maximizeIcon;
045:            private SIcon unmaximizeIcon;
046:
047:            /**
048:             * Initialize properties from config
049:             */
050:            public InternalFrameCG() {
051:                setCloseIcon((SIcon) ResourceManager.getObject(
052:                        "InternalFrameCG.closeIcon", SIcon.class));
053:                setDeiconifyIcon((SIcon) ResourceManager.getObject(
054:                        "InternalFrameCG.deiconifyIcon", SIcon.class));
055:                setIconifyIcon((SIcon) ResourceManager.getObject(
056:                        "InternalFrameCG.iconifyIcon", SIcon.class));
057:                setMaximizeIcon((SIcon) ResourceManager.getObject(
058:                        "InternalFrameCG.maximizeIcon", SIcon.class));
059:                setUnmaximizeIcon((SIcon) ResourceManager.getObject(
060:                        "InternalFrameCG.unmaximizeIcon", SIcon.class));
061:            }
062:
063:            protected void writeIcon(Device device, SIcon icon, String cssClass)
064:                    throws IOException {
065:                device.print("<img");
066:                if (cssClass != null) {
067:                    device.print(" class=\"");
068:                    device.print(cssClass);
069:                    device.print("\"");
070:                }
071:                Utils.optAttribute(device, "src", icon.getURL());
072:                Utils.optAttribute(device, "width", icon.getIconWidth());
073:                Utils.optAttribute(device, "height", icon.getIconHeight());
074:                Utils.attribute(device, "alt", icon.getIconTitle());
075:                device.print("/>");
076:            }
077:
078:            protected void writeWindowIcon(Device device, SInternalFrame frame,
079:                    int event, SIcon icon, String cssClass) throws IOException {
080:                Utils.printButtonStart(device, frame, Integer.toString(event),
081:                        true, frame.getShowAsFormComponent(), cssClass);
082:                device.print(">");
083:                writeIcon(device, icon, null);
084:                Utils.printButtonEnd(device, true);
085:            }
086:
087:            protected void writeWindowIcon(Device device, SInternalFrame frame,
088:                    int event, SIcon icon) throws IOException {
089:                writeWindowIcon(device, frame, event, icon, null);
090:            }
091:
092:            public void writeInternal(final Device device, final SComponent _c)
093:                    throws IOException {
094:
095:                SInternalFrame frame = (SInternalFrame) _c;
096:
097:                // Optional attribute to identify the internal frame for
098:                // SDialog and SOptionPane usage.
099:                Map optionalAttributes = new HashMap();
100:                optionalAttributes.put("SComponentClass",
101:                        "org.wings.SInternalFrame");
102:
103:                writeDivPrefix(device, frame, optionalAttributes);
104:                writeWindowBar(device, frame);
105:                // write the actual content
106:                if (!frame.isIconified()) {
107:                    device.print("<div class=\"WindowContent\"");
108:                    SStringBuilder contentArea = Utils.inlineStyles(frame
109:                            .getDynamicStyle(SInternalFrame.SELECTOR_CONTENT));
110:                    Utils.optAttribute(device, "style", contentArea);
111:                    device.print(">");
112:
113:                    Utils.renderContainer(device, frame);
114:                    device.print("</div>");
115:                }
116:                writeDivSuffix(device, frame);
117:            }
118:
119:            /**
120:             * Convenience method to keep differences between default and msie
121:             * implementations small
122:             * @param device
123:             * @param frame
124:             * @throws IOException
125:             */
126:            protected void writeWindowBar(final Device device,
127:                    SInternalFrame frame) throws IOException {
128:                String text = frame.getTitle();
129:                if (text == null)
130:                    text = "wingS";
131:
132:                device.print("<div class=\"WindowBar\" id=\"");
133:                device.print(frame.getName());
134:                device.print("_titlebar\"");
135:
136:                SStringBuilder titleArea = Utils.inlineStyles(frame
137:                        .getDynamicStyle(SInternalFrame.SELECTOR_TITLE));
138:                Utils.optAttribute(device, "style", titleArea);
139:                device.print(">");
140:
141:                if (frame.isClosable() && closeIcon != null) {
142:                    writeWindowIcon(device, frame,
143:                            SInternalFrameEvent.INTERNAL_FRAME_CLOSED,
144:                            closeIcon, BUTTONICON_CLASSNAME);
145:                }
146:                if (frame.isMaximized() && unmaximizeIcon != null) {
147:                    writeWindowIcon(device, frame,
148:                            SInternalFrameEvent.INTERNAL_FRAME_UNMAXIMIZED,
149:                            unmaximizeIcon, BUTTONICON_CLASSNAME);
150:                }
151:                if (frame.isMaximizable() && !frame.isMaximized()
152:                        && maximizeIcon != null) {
153:                    writeWindowIcon(device, frame,
154:                            SInternalFrameEvent.INTERNAL_FRAME_MAXIMIZED,
155:                            maximizeIcon, BUTTONICON_CLASSNAME);
156:                }
157:                if (frame.isIconified() && deiconifyIcon != null) {
158:                    writeWindowIcon(device, frame,
159:                            SInternalFrameEvent.INTERNAL_FRAME_DEICONIFIED,
160:                            deiconifyIcon, BUTTONICON_CLASSNAME);
161:                }
162:                if (frame.isIconifyable() && !frame.isIconified()
163:                        && iconifyIcon != null) {
164:                    writeWindowIcon(device, frame,
165:                            SInternalFrameEvent.INTERNAL_FRAME_ICONIFIED,
166:                            iconifyIcon, BUTTONICON_CLASSNAME);
167:                }
168:
169:                device.print("<div class=\"WindowBar_title\">"); // float right end
170:
171:                if (frame.getIcon() != null) {
172:                    writeIcon(device, frame.getIcon(), WINDOWICON_CLASSNAME);
173:                }
174:                device.print(text);
175:                device.print("</div>");
176:
177:                device.print("</div>");
178:            }
179:
180:            protected String getDragHandle(SComponent component) {
181:                return component.getName() + "_titlebar";
182:            }
183:
184:            public SIcon getCloseIcon() {
185:                return closeIcon;
186:            }
187:
188:            public void setCloseIcon(SIcon closeIcon) {
189:                this .closeIcon = closeIcon;
190:            }
191:
192:            public SIcon getDeiconifyIcon() {
193:                return deiconifyIcon;
194:            }
195:
196:            public void setDeiconifyIcon(SIcon deiconifyIcon) {
197:                this .deiconifyIcon = deiconifyIcon;
198:            }
199:
200:            public SIcon getIconifyIcon() {
201:                return iconifyIcon;
202:            }
203:
204:            public void setIconifyIcon(SIcon iconifyIcon) {
205:                this .iconifyIcon = iconifyIcon;
206:            }
207:
208:            public SIcon getMaximizeIcon() {
209:                return maximizeIcon;
210:            }
211:
212:            public void setMaximizeIcon(SIcon maximizeIcon) {
213:                this .maximizeIcon = maximizeIcon;
214:            }
215:
216:            public SIcon getUnmaximizeIcon() {
217:                return unmaximizeIcon;
218:            }
219:
220:            public void setUnmaximizeIcon(SIcon unmaximizeIcon) {
221:                this .unmaximizeIcon = unmaximizeIcon;
222:            }
223:
224:            /**
225:             * {@inheritDoc}
226:             */
227:            public Update getAddWindowUpdate(SContainer container,
228:                    SWindow window) {
229:                return new AddWindowUpdate(container, window);
230:            }
231:
232:            protected class AddWindowUpdate extends AbstractUpdate {
233:
234:                private SWindow window;
235:
236:                public AddWindowUpdate(SContainer container, SWindow window) {
237:                    super (container);
238:                    this .window = window;
239:                }
240:
241:                @Override
242:                public int getPriority() {
243:                    return Integer.MAX_VALUE;
244:                }
245:
246:                public Handler getHandler() {
247:                    UpdateHandler handler = new UpdateHandler("addWindow");
248:                    handler.addParameter(component.getName());
249:                    handler.addParameter("<div id=\"" + window.getName()
250:                            + "\"/>");
251:                    return handler;
252:                }
253:            }
254:
255:            public Update getRemoveWindowUpdate(final SContainer container,
256:                    final SWindow window) {
257:                return new RemoveWindowUpdate(container, window);
258:            }
259:
260:            protected class RemoveWindowUpdate extends AbstractUpdate {
261:
262:                private SWindow window;
263:
264:                public RemoveWindowUpdate(final SContainer container,
265:                        final SWindow window) {
266:                    super (container);
267:                    this .window = window;
268:                }
269:
270:                public Handler getHandler() {
271:                    UpdateHandler handler = new UpdateHandler("removeWindow");
272:                    handler.addParameter(window.getName());
273:                    return handler;
274:                }
275:            }
276:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.