Source Code Cross Referenced for TabbedEditorPane.java in  » Mail-Clients » pooka » net » suberic » util » gui » propedit » 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 » Mail Clients » pooka » net.suberic.util.gui.propedit 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package net.suberic.util.gui.propedit;
002:
003:        import javax.swing.*;
004:        import java.util.Vector;
005:        import java.util.List;
006:        import java.util.ArrayList;
007:
008:        /**
009:         * This will make an editor for a list of properties.  Each property, in
010:         * turn, should have a list of properties wihch it itself edits.  Each
011:         * top-level property will be a tab, with its values shown on the panel.
012:         *
013:         * So an example of a property definition for this would be:
014:         *
015:         * TabbedList=tabOne:tabTwo:tabThree
016:         * TabbedList.tabOne=prop1:prop2:prop3:prop4
017:         * TabbedList.tabTwo=prop5:prop6
018:         * TabbedList.tabThree=prop7:prop8:prop9
019:         *
020:         * Options:
021:         * TabbedList.templateScoped - add subproperty to the template.  for instance,
022:         *   if true, the example will edit using the template 
023:         *   TabbedList.tabOne.prop1.  if false, it will use the template prop1.
024:         * TabbedList.propertyScoped - add the subproperty to the property instead
025:         *   of using it as its own property.  if true, this example would edit,
026:         *   for instance, MyProp.prop1 (since it would actually edit MyProp,
027:         *   TabbedList.tabOne, which would in turn probably edit MyProp.prop1,
028:         *   TabbedList.tabOne.prop1).
029:         *
030:         */
031:        public class TabbedEditorPane extends CompositeSwingPropertyEditor {
032:
033:            JTabbedPane tabbedPane;
034:            protected boolean templateScoped = false;
035:            protected boolean propertyScoped = false;
036:
037:            /**
038:             * This configures this editor with the following values.
039:             *
040:             * @param propertyName The property to be edited.  
041:             * @param template The property that will define the layout of the 
042:             *                 editor.
043:             * @param manager The PropertyEditorManager that will manage the
044:             *                   changes.
045:             * @param isEnabled Whether or not this editor is enabled by default. 
046:             */
047:            public void configureEditor(String propertyName, String template,
048:                    PropertyEditorManager newManager, boolean isEnabled) {
049:                property = propertyName;
050:                manager = newManager;
051:                editorTemplate = template;
052:                originalValue = manager.getProperty(property, "");
053:
054:                debug = manager.getProperty("editors.debug", "false")
055:                        .equalsIgnoreCase("true");
056:
057:                if (debug) {
058:                    System.out.println("configuring editor with property "
059:                            + propertyName + ", editorTemplate "
060:                            + editorTemplate);
061:                }
062:
063:                enabled = isEnabled;
064:
065:                templateScoped = manager.getProperty(
066:                        editorTemplate + ".templateScoped", "false")
067:                        .equalsIgnoreCase("true");
068:                propertyScoped = manager.getProperty(
069:                        editorTemplate + ".propertyScoped", "false")
070:                        .equalsIgnoreCase("true");
071:
072:                tabbedPane = new JTabbedPane();
073:
074:                // first, get the strings that we're going to edit.
075:
076:                if (debug) {
077:                    System.out.println("creating prop from " + template + "="
078:                            + manager.getProperty(template, ""));
079:                }
080:
081:                List propsToEdit = manager.getPropertyAsList(template, "");
082:
083:                editors = createEditors(property, propsToEdit);
084:
085:                labelComponent = tabbedPane;
086:
087:                if (debug) {
088:                    System.out.println("minimumSize for tabbedPane = "
089:                            + tabbedPane.getMinimumSize());
090:                    System.out.println("preferredSize for tabbedPane = "
091:                            + tabbedPane.getPreferredSize());
092:                    System.out.println("size for tabbedPane = "
093:                            + tabbedPane.getSize());
094:                }
095:
096:                this .add(tabbedPane);
097:
098:                manager.registerPropertyEditor(property, this );
099:            }
100:
101:            /**
102:             * Creates the appropriate editors for the given properties.
103:             */
104:            public List createEditors(String property, List propsToEdit) {
105:
106:                List editorList = new ArrayList();
107:                SwingPropertyEditor currentEditor;
108:
109:                for (int i = 0; i < propsToEdit.size(); i++) {
110:                    String currentTemplate = (String) propsToEdit.get(i);
111:                    if (templateScoped)
112:                        currentTemplate = editorTemplate + "."
113:                                + currentTemplate;
114:
115:                    if (debug) {
116:                        System.out.println("getting editor using template "
117:                                + currentTemplate);
118:                    }
119:
120:                    if (propertyScoped) {
121:                        if (debug) {
122:                            System.out
123:                                    .println("TEP:  scoped.  getting editor for "
124:                                            + property + ", " + currentTemplate);
125:                        }
126:                        currentEditor = createEditorPane(property,
127:                                currentTemplate);
128:                    } else {
129:                        if (debug) {
130:                            System.out
131:                                    .println("TEP:  notPropScoped; getting editor for "
132:                                            + currentTemplate
133:                                            + ", "
134:                                            + currentTemplate);
135:                        }
136:                        currentEditor = createEditorPane(currentTemplate,
137:                                currentTemplate);
138:                    }
139:
140:                    if (debug) {
141:                        System.out.println("adding " + currentEditor);
142:                        System.out.println("currentEditor.getMinimumSize() = "
143:                                + currentEditor.getMinimumSize());
144:                    }
145:                    editorList.add(currentEditor);
146:                    tabbedPane.add(manager.getProperty(currentTemplate
147:                            + ".label", currentTemplate), currentEditor);
148:                }
149:
150:                return editorList;
151:            }
152:
153:            /**
154:             * Creates an editor pane for a group of values.
155:             */
156:            private SwingPropertyEditor createEditorPane(String subProperty,
157:                    String subTemplate) {
158:                return (SwingPropertyEditor) manager.getFactory().createEditor(
159:                        subProperty, subTemplate, "Composite", manager, true);
160:
161:            }
162:
163:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.