Source Code Cross Referenced for ResourceRangeDisplay.java in  » Content-Management-System » harmonise » org » openharmonise » him » metadata » range » swing » resourcehandling » 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.range.swing.resourcehandling 
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.range.swing.resourcehandling;
020:
021:        import java.awt.*;
022:        import java.awt.event.*;
023:        import java.util.*;
024:
025:        import javax.swing.*;
026:
027:        import org.openharmonise.him.*;
028:        import org.openharmonise.him.metadata.range.swing.*;
029:        import org.openharmonise.him.swing.resourcetree.*;
030:        import org.openharmonise.vfs.*;
031:        import org.openharmonise.vfs.gui.*;
032:        import org.openharmonise.vfs.metadata.*;
033:        import org.openharmonise.vfs.servers.*;
034:
035:        /**
036:
037:         * @author Matthew Large
038:         * @version $Revision: 1.1 $
039:         */
040:        public class ResourceRangeDisplay extends AbstractRangeDisplay
041:                implements  RangeDisplay, LayoutManager, ActionListener {
042:
043:            private ArrayList m_aPropertyInstances = new ArrayList();
044:
045:            private ResourceTree m_tree = null;
046:
047:            private JButton m_addButton = null;
048:            private JButton m_removeButton = null;
049:
050:            private ResourceSelectionList m_selectionList = null;
051:
052:            private JLabel m_warningHeader = null;
053:            private ArrayList m_aWarnings = new ArrayList();
054:            private ArrayList m_aReasons = new ArrayList();
055:
056:            /**
057:             * @param propInstance
058:             */
059:            public ResourceRangeDisplay(PropertyInstance propInstance) {
060:                super (propInstance);
061:                this .setup();
062:                this .addRelationship(propInstance);
063:            }
064:
065:            public void setup() {
066:                this .setLayout(this );
067:                m_tree = new ResourceTree();
068:                m_tree.setShowLeafNodes(true);
069:                m_tree.setShowApprovedOnly(true);
070:                m_tree.setBorder(BorderFactory.createEtchedBorder());
071:
072:                this .m_addButton = new JButton();
073:                this .m_addButton.setIcon(IconManager.getInstance().getIcon(
074:                        "16-command-value-plus.gif"));
075:                this .m_addButton.setActionCommand("ADD");
076:                this .m_addButton.setToolTipText("Add");
077:                this .m_addButton.addActionListener(this );
078:                this .add(this .m_addButton);
079:                this .m_removeButton = new JButton();
080:                this .m_removeButton.setIcon(IconManager.getInstance().getIcon(
081:                        "16-command-value-minus.gif"));
082:                this .m_removeButton.setActionCommand("REMOVE");
083:                this .m_removeButton.setToolTipText("Remove");
084:                this .m_removeButton.addActionListener(this );
085:                this .add(this .m_removeButton);
086:
087:                String[] data = new String[0];
088:
089:                this .m_selectionList = new ResourceSelectionList(this );
090:                m_selectionList.setBorder(BorderFactory.createEtchedBorder());
091:                this .add(this .m_selectionList);
092:
093:                this .add(m_tree);
094:            }
095:
096:            /* (non-Javadoc)
097:             * @see com.simulacramedia.contentmanager.metadata.range.swing.RangeDisplay#getPanel()
098:             */
099:            public JPanel getPanel() {
100:
101:                return this ;
102:            }
103:
104:            /**
105:             * @param display
106:             */
107:            public void addRelationship(PropertyInstance propInstance) {
108:                Reason reason = new Reason(propInstance, this );
109:
110:                Iterator itor = reason.getHREFs().iterator();
111:                while (itor.hasNext()) {
112:                    //URI uri;
113:                    String sPath = (String) itor.next();
114:                    if (sPath.trim().equals(".")) {
115:                        Server server = ServerList.getInstance()
116:                                .getHarmoniseServer();
117:
118:                        VersionedVirtualFile vfLogicalFile = (VersionedVirtualFile) propInstance
119:                                .getVirtualFile();
120:                        if (vfLogicalFile.getState() == VirtualFile.STATE_PENDING
121:                                && vfLogicalFile.getLiveVersionPath() != null) {
122:                            vfLogicalFile = (VersionedVirtualFile) vfLogicalFile
123:                                    .getVFS().getVirtualFile(
124:                                            vfLogicalFile.getLiveVersionPath())
125:                                    .getResource();
126:                        }
127:
128:                        VirtualFile vfFile = server.getVFS().getVirtualFile(
129:                                vfLogicalFile.getFilePath()).getResource();
130:
131:                        this .m_tree.addCollection(vfFile);
132:                    } else {
133:                        Server server = ServerList.getInstance()
134:                                .getHarmoniseServer();
135:
136:                        VirtualFile vfFile = server.getVFS().getVirtualFile(
137:                                sPath).getResource();
138:
139:                        this .m_tree.addCollection(vfFile);
140:                    }
141:                }
142:
143:                WarningsLabel warning = reason.buildWarning();
144:                this .m_aWarnings.add(warning);
145:                this .add(warning);
146:                this .m_selectionList.addReason(reason);
147:            }
148:
149:            /**
150:             * @param display
151:             */
152:            public void addRelationship(ResourceRangeDisplay display) {
153:                this .addRelationship(display.getPropertyInstance());
154:            }
155:
156:            /* (non-Javadoc)
157:             * @see java.awt.LayoutManager#removeLayoutComponent(java.awt.Component)
158:             */
159:            public void removeLayoutComponent(Component arg0) {
160:            }
161:
162:            /* (non-Javadoc)
163:             * @see java.awt.LayoutManager#layoutContainer(java.awt.Container)
164:             */
165:            public void layoutContainer(Container arg0) {
166:                int nHeight = 0;
167:
168:                this .m_tree.setSize(200, 300);
169:                this .m_tree.setLocation(20, nHeight);
170:
171:                this .m_addButton.setSize(this .m_addButton.getPreferredSize());
172:                this .m_addButton.setLocation(240, nHeight + 120);
173:                this .m_removeButton
174:                        .setSize(this .m_addButton.getPreferredSize());
175:                this .m_removeButton.setLocation(240, nHeight + 150);
176:
177:                this .m_selectionList.setSize(290, 300);
178:                this .m_selectionList.setLocation(300, nHeight);
179:            }
180:
181:            /* (non-Javadoc)
182:             * @see java.awt.LayoutManager#addLayoutComponent(java.lang.String, java.awt.Component)
183:             */
184:            public void addLayoutComponent(String arg0, Component arg1) {
185:            }
186:
187:            /* (non-Javadoc)
188:             * @see java.awt.LayoutManager#minimumLayoutSize(java.awt.Container)
189:             */
190:            public Dimension minimumLayoutSize(Container arg0) {
191:                return this .getPreferredSize();
192:            }
193:
194:            /* (non-Javadoc)
195:             * @see java.awt.LayoutManager#preferredLayoutSize(java.awt.Container)
196:             */
197:            public Dimension preferredLayoutSize(Container arg0) {
198:                return this .getPreferredSize();
199:            }
200:
201:            /* (non-Javadoc)
202:             * @see java.awt.Component#getPreferredSize()
203:             */
204:            public Dimension getPreferredSize() {
205:                return new Dimension(600, 330);
206:            }
207:
208:            /* (non-Javadoc)
209:             * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
210:             */
211:            public void actionPerformed(ActionEvent ae) {
212:                if (ae.getActionCommand().equals("ADD")) {
213:                    VirtualFile vfFile = this .m_tree.getSelectedResource();
214:                    this .m_selectionList.addResource(vfFile);
215:                } else if (ae.getActionCommand().equals("REMOVE")) {
216:                    this .m_selectionList.removeSelectedCell();
217:                }
218:                this .validateTree();
219:                super .validateTab();
220:            }
221:
222:            /* (non-Javadoc)
223:             * @see com.simulacramedia.contentmanager.metadata.range.swing.AbstractRangeDisplay#isValid()
224:             */
225:            public boolean isMetadataValid() {
226:                return this .m_selectionList.isValid();
227:            }
228:
229:            public void validateTab() {
230:                super .validateTab();
231:            }
232:
233:            /* (non-Javadoc)
234:             * @see com.simulacramedia.contentmanager.metadata.range.swing.AbstractRangeDisplay#isWidthResizable()
235:             */
236:            public boolean isResizeWidthEnabled() {
237:                return false;
238:            }
239:
240:        }
w___ww.___j___a_va__2s_._c__om_ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.