Source Code Cross Referenced for MetadataTabPanel.java in  » Content-Management-System » harmonise » org » openharmonise » him » metadata » swing » 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 » Content Management System » harmonise » org.openharmonise.him.metadata.swing 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * The contents of this file are subject to the 
003:         * Mozilla Public License Version 1.1 (the "License"); 
004:         * you may not use this file except in compliance with the License. 
005:         * You may obtain a copy of the License at http://www.mozilla.org/MPL/
006:         *
007:         * Software distributed under the License is distributed on an "AS IS"
008:         * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. 
009:         * See the License for the specific language governing rights and 
010:         * limitations under the License.
011:         *
012:         * The Initial Developer of the Original Code is Simulacra Media Ltd.
013:         * Portions created by Simulacra Media Ltd are Copyright (C) Simulacra Media Ltd, 2004.
014:         *
015:         * All Rights Reserved.
016:         *
017:         * Contributor(s):
018:         */
019:        package org.openharmonise.him.metadata.swing;
020:
021:        import java.awt.*;
022:        import java.util.*;
023:
024:        import javax.swing.*;
025:
026:        import org.openharmonise.him.metadata.range.swing.resourcehandling.*;
027:        import org.openharmonise.vfs.*;
028:        import org.openharmonise.vfs.metadata.*;
029:
030:        /**
031:         * @author Matthew Large
032:         * @version $Revision: 1.1 $
033:         */
034:        public class MetadataTabPanel extends JPanel implements  LayoutManager {
035:
036:            private ResourceRangeDisplay m_relationships = null;
037:
038:            private VirtualFile m_vfPropGroup = null;
039:
040:            private HashMap m_pathOrderMapping = new HashMap();
041:
042:            private SortedSet m_propPanels = new TreeSet();
043:
044:            private int m_nNextOrderVal = 1;
045:
046:            /**
047:             * 
048:             */
049:            public MetadataTabPanel() {
050:                super ();
051:                this .setup();
052:            }
053:
054:            /**
055:             * 
056:             */
057:            public MetadataTabPanel(VirtualFile vfPropGroup) {
058:                super ();
059:                this .m_vfPropGroup = vfPropGroup;
060:                this .setup();
061:            }
062:
063:            private void setup() {
064:                this .setLayout(this );
065:
066:                this .m_pathOrderMapping.put("/webdav/SYSTEM_PROPS/title",
067:                        new Integer(1));
068:                this .m_pathOrderMapping.put("/webdav/SYSTEM_PROPS/description",
069:                        new Integer(2));
070:                int nCount = 3;
071:
072:                if (this .m_vfPropGroup != null) {
073:                    Iterator itor = this .m_vfPropGroup.getChildren().iterator();
074:                    while (itor.hasNext()) {
075:                        String sPath = (String) itor.next();
076:                        this .m_pathOrderMapping.put(sPath, new Integer(nCount));
077:                        nCount++;
078:                    }
079:                }
080:                this .m_nNextOrderVal = nCount;
081:            }
082:
083:            public void addPropertyPanel(PropertyPanel propPanel) {
084:                Property prop = propPanel.getProperty();
085:                if (prop != null
086:                        && this .m_pathOrderMapping.get(prop.getHREF()) != null) {
087:                    int nOrder = ((Integer) this .m_pathOrderMapping.get(prop
088:                            .getHREF())).intValue();
089:                    OrderedProp orderedProp = new OrderedProp(nOrder, propPanel);
090:                    this .m_propPanels.add(orderedProp);
091:                } else {
092:                    OrderedProp orderedProp = new OrderedProp(
093:                            this .m_nNextOrderVal, propPanel);
094:                    this .m_nNextOrderVal++;
095:                    this .m_propPanels.add(orderedProp);
096:                }
097:                this .add(propPanel);
098:            }
099:
100:            protected void clearToDestroy() {
101:                this .m_relationships = null;
102:                this .removeAll();
103:            }
104:
105:            /**
106:             * @param arg0
107:             */
108:            private MetadataTabPanel(boolean arg0) {
109:                super (arg0);
110:            }
111:
112:            /**
113:             * @param arg0
114:             */
115:            private MetadataTabPanel(LayoutManager arg0) {
116:                super (arg0);
117:            }
118:
119:            /**
120:             * @param arg0
121:             * @param arg1
122:             */
123:            private MetadataTabPanel(LayoutManager arg0, boolean arg1) {
124:                super (arg0, arg1);
125:            }
126:
127:            /**
128:             * @return
129:             */
130:            public ResourceRangeDisplay getRelationships() {
131:                return m_relationships;
132:            }
133:
134:            public boolean hasRelationships() {
135:                return (this .m_relationships != null);
136:            }
137:
138:            /* (non-Javadoc)
139:             * @see java.awt.LayoutManager#layoutContainer(java.awt.Container)
140:             */
141:            public void layoutContainer(Container arg0) {
142:                int nHeight = 0;
143:                Iterator itor = this .m_propPanels.iterator();
144:                while (itor.hasNext()) {
145:                    OrderedProp orderedProp = (OrderedProp) itor.next();
146:                    PropertyPanel propPanel = orderedProp.getPropPanel();
147:
148:                    propPanel.setSize(propPanel.getPreferredSize());
149:                    propPanel.setLocation(0, nHeight);
150:                    nHeight = nHeight + propPanel.getSize().height;
151:                }
152:            }
153:
154:            /**
155:             * @param display
156:             */
157:            public void setRelationships(ResourceRangeDisplay display) {
158:                if (this .m_relationships == null) {
159:                    m_relationships = display;
160:                    PropertyPanel propPanel = new PropertyPanel(
161:                            "Relationships", false);
162:                    propPanel.add(m_relationships);
163:                    OrderedProp orderedProp = new OrderedProp(
164:                            this .m_nNextOrderVal, propPanel);
165:                    this .m_nNextOrderVal++;
166:                    this .m_propPanels.add(orderedProp);
167:                    this .add(propPanel);
168:                }
169:            }
170:
171:            public void addRelationship(ResourceRangeDisplay display) {
172:                this .m_relationships.addRelationship(display);
173:            }
174:
175:            /* (non-Javadoc)
176:             * @see java.awt.Component#setEnabled(boolean)
177:             */
178:            public void setEnabled(boolean bEnabled) {
179:                for (int i = 0; i < this .getComponentCount(); i++) {
180:                    Component comp = this .getComponent(i);
181:                    comp.setEnabled(bEnabled);
182:                }
183:                super .setEnabled(bEnabled);
184:            }
185:
186:            public void checkValid() {
187:                boolean bValid = true;
188:                for (int i = 0; i < this .getComponentCount() && bValid == true; i++) {
189:                    Component comp = this .getComponent(i);
190:                    if (comp instanceof  PropertyPanel) {
191:                        if (!((PropertyPanel) comp).getRangeDisplay()
192:                                .isMetadataValid()) {
193:                            bValid = false;
194:                        }
195:                    }
196:                }
197:
198:                MetadataTabs tabs = this .getTabs();
199:                tabs.setValid(bValid, this );
200:            }
201:
202:            private MetadataTabs getTabs() {
203:                Component comp = this ;
204:                while (comp != null && !(comp instanceof  MetadataTabs)) {
205:                    comp = comp.getParent();
206:                }
207:
208:                if (comp != null && comp instanceof  MetadataTabs) {
209:                    return (MetadataTabs) comp;
210:                } else {
211:                    return null;
212:                }
213:            }
214:
215:            /* (non-Javadoc)
216:             * @see java.awt.LayoutManager#removeLayoutComponent(java.awt.Component)
217:             */
218:            public void removeLayoutComponent(Component arg0) {
219:            }
220:
221:            /* (non-Javadoc)
222:             * @see java.awt.LayoutManager#addLayoutComponent(java.lang.String, java.awt.Component)
223:             */
224:            public void addLayoutComponent(String arg0, Component arg1) {
225:            }
226:
227:            /* (non-Javadoc)
228:             * @see java.awt.LayoutManager#minimumLayoutSize(java.awt.Container)
229:             */
230:            public Dimension minimumLayoutSize(Container arg0) {
231:                return this .getPreferredSize();
232:            }
233:
234:            /* (non-Javadoc)
235:             * @see java.awt.LayoutManager#preferredLayoutSize(java.awt.Container)
236:             */
237:            public Dimension preferredLayoutSize(Container arg0) {
238:                return this .getPreferredSize();
239:            }
240:
241:            /* (non-Javadoc)
242:             * @see java.awt.Component#getPreferredSize()
243:             */
244:            public Dimension getPreferredSize() {
245:                int nHeight = 0;
246:                int nCount = this .getComponentCount();
247:                int nWidth = 0;
248:                for (int i = 0; i < nCount; i++) {
249:                    Component comp = this .getComponent(i);
250:                    int nDepth = comp.getLocation().y
251:                            + comp.getPreferredSize().height;
252:                    int nCurrWidth = comp.getLocation().x
253:                            + comp.getPreferredSize().width;
254:                    if (nDepth > nHeight) {
255:                        nHeight = nDepth;
256:                    }
257:                    if (nCurrWidth > nWidth) {
258:                        nWidth = nCurrWidth;
259:                    }
260:                }
261:
262:                return new Dimension(nWidth, nHeight + 5);
263:            }
264:
265:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.