Source Code Cross Referenced for WingSetPane.java in  » Swing-Library » wings3 » wingset » 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 » wingset 
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 wingset;
014:
015:        import org.apache.commons.logging.Log;
016:        import org.apache.commons.logging.LogFactory;
017:        import org.wings.SAnchor;
018:        import org.wings.SBorderLayout;
019:        import org.wings.SComponent;
020:        import org.wings.SConstants;
021:        import org.wings.SContainer;
022:        import org.wings.SDimension;
023:        import org.wings.SLabel;
024:        import org.wings.SPanel;
025:        import org.wings.SResourceIcon;
026:        import org.wings.border.SBorder;
027:        import org.wings.border.SEmptyBorder;
028:        import org.wings.border.SLineBorder;
029:        import org.wings.event.SComponentAdapter;
030:        import org.wings.event.SComponentEvent;
031:        import org.wings.plaf.WingSetExample;
032:        import org.wings.plaf.css.Utils;
033:
034:        import java.awt.Color;
035:        import java.awt.Insets;
036:
037:        /**
038:         * A basic WingSet Pane, which implements some often needed functions.
039:         *
040:         * @author <a href="mailto:haaf@mercatis.de">Armin Haaf</a>
041:         */
042:        abstract public class WingSetPane extends SPanel implements  SConstants,
043:                WingSetExample {
044:            protected final static Log log = LogFactory
045:                    .getLog(WingSetPane.class);
046:            private static final SResourceIcon SOURCE_LABEL_ICON = new SResourceIcon(
047:                    "org/wings/icons/source_java.png");
048:            private boolean initialized = false;
049:            private SComponent controlsComponent;
050:            private SComponent exampleComponent;
051:            private String exampleName;
052:            private String group;
053:
054:            public WingSetPane() {
055:                setLayout(new SBorderLayout());
056:                setPreferredSize(SDimension.FULLAREA);
057:
058:                SAnchor anchor = new SAnchor("../"
059:                        + getClass().getName().substring(
060:                                getClass().getName().indexOf('.') + 1)
061:                        + ".java");
062:                anchor.setTarget("sourceWindow");
063:                anchor.add(new SLabel("View Java Source Code",
064:                        SOURCE_LABEL_ICON));
065:                anchor.setPreferredSize(SDimension.FULLWIDTH);
066:
067:                SPanel south = new SPanel();
068:                if (!Utils.isMSIE(this )) {
069:                    south.setBorder(new SEmptyBorder(0, 1, 0, 1));
070:                }
071:                south.setPreferredSize(SDimension.FULLWIDTH);
072:                south.add(anchor);
073:
074:                SBorder border = new SLineBorder(1, new Insets(0, 3, 0, 6));
075:                border.setColor(new Color(255, 255, 255), SConstants.TOP);
076:                border.setColor(new Color(255, 255, 255), SConstants.LEFT);
077:                border.setColor(new Color(190, 190, 190), SConstants.RIGHT);
078:                border.setColor(new Color(190, 190, 190), SConstants.BOTTOM);
079:                south.setBorder(border);
080:                south.setBackground(new Color(240, 240, 240));
081:
082:                add(south, SBorderLayout.SOUTH);
083:
084:                // lazily initialize components when first shown
085:                addComponentListener(new SComponentAdapter() {
086:                    public void componentShown(SComponentEvent e) {
087:                        activateExample();
088:                    }
089:
090:                    public void componentHidden(SComponentEvent e) {
091:                        // TODO FIXME : Uncommenting the following line MUST work but doesnt:
092:                        // I leads to the correct unregistering of headers.
093:                        // Switch between XCalendar and XColorpicker i.e. --> Application hangs.
094:                        // passivateExample();
095:                    }
096:                });
097:            }
098:
099:            /**
100:             * @inheritDoc
101:             */
102:            public final void activateExample() {
103:                if (!initialized) {
104:                    controlsComponent = createControls();
105:                    if (controlsComponent != null) {
106:                        if (!Utils.isMSIE(this )
107:                                && controlsComponent instanceof  SContainer) {
108:                            controlsComponent.setBorder(new SEmptyBorder(0, 1,
109:                                    0, 1));
110:                        }
111:                        controlsComponent
112:                                .setVerticalAlignment(SConstants.TOP_ALIGN);
113:                        if (controlsComponent.getHorizontalAlignment() == SConstants.NO_ALIGN) {
114:                            controlsComponent
115:                                    .setHorizontalAlignment(SConstants.LEFT_ALIGN);
116:                        }
117:                        add(controlsComponent, SBorderLayout.NORTH);
118:                    }
119:
120:                    exampleComponent = createExample();
121:                    if (exampleComponent != null) {
122:                        if (!Utils.isMSIE(this )) {
123:                            exampleComponent.setBorder(new SEmptyBorder(0, 1,
124:                                    1, 1));
125:                        }
126:                        if (exampleComponent.getVerticalAlignment() == SConstants.NO_ALIGN) {
127:                            exampleComponent
128:                                    .setVerticalAlignment(SConstants.TOP_ALIGN);
129:                        }
130:                        if (exampleComponent.getHorizontalAlignment() == SConstants.NO_ALIGN) {
131:                            exampleComponent
132:                                    .setHorizontalAlignment(SConstants.CENTER_ALIGN);
133:                        }
134:                        add(exampleComponent, SBorderLayout.CENTER);
135:                    }
136:                    initialized = true;
137:                }
138:            }
139:
140:            /**
141:             * @inheritDoc
142:             */
143:            public final void passivateExample() {
144:                // Dumb: Always dropp all components to test header deregistration etc.
145:                // Maybe make this configurable per example
146:                remove(controlsComponent);
147:                remove(exampleComponent);
148:                initialized = false;
149:            }
150:
151:            protected abstract SComponent createControls();
152:
153:            protected abstract SComponent createExample();
154:
155:            /**
156:             * @inheritDoc
157:             */
158:            public SComponent getExample() {
159:                return this ;
160:            }
161:
162:            /**
163:             * @inheritDoc
164:             */
165:            public String getExampleName() {
166:                if (exampleName == null)
167:                    naming();
168:                return exampleName;
169:            }
170:
171:            /**
172:             * @inheritDoc
173:             */
174:            public String getExampleGroup() {
175:                if (group == null)
176:                    naming();
177:                return group;
178:            }
179:
180:            private void naming() {
181:                exampleName = getClass().getName();
182:                exampleName = exampleName.substring(exampleName
183:                        .lastIndexOf('.') + 1);
184:                if (exampleName.endsWith("Example")) {
185:                    group = getExampleName().startsWith("X") ? "wingX"
186:                            : "wingS";
187:                    exampleName = exampleName.substring(0, exampleName.length()
188:                            - "Example".length());
189:                } else if (exampleName.endsWith("Test")) {
190:                    group = "Test";
191:                    exampleName = exampleName.substring(0, exampleName.length()
192:                            - "Test".length());
193:                } else if (exampleName.endsWith("Experiment")) {
194:                    group = "Experiment";
195:                    exampleName = exampleName.substring(0, exampleName.length()
196:                            - "Experiment".length());
197:                }
198:            }
199:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.