Source Code Cross Referenced for ResourceDisplayPanel.java in  » Content-Management-System » harmonise » org » openharmonise » him » editors » pagegui » 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.editors.pagegui 
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.editors.pagegui;
020:
021:        import java.awt.*;
022:        import java.awt.event.*;
023:
024:        import javax.swing.*;
025:
026:        import org.openharmonise.swing.FontManager;
027:        import org.openharmonise.vfs.*;
028:        import org.openharmonise.vfs.gui.*;
029:
030:        /**
031:         * Resource field.
032:         * 
033:         * @author Matthew Large
034:         * @version $Revision: 1.2 $
035:         *
036:         */
037:        public class ResourceDisplayPanel extends JPanel implements 
038:                LayoutManager, MouseListener {
039:
040:            /**
041:             * Full path to resource.
042:             */
043:            private String m_sFilePath = null;
044:
045:            /**
046:             * Virtual file system.
047:             */
048:            private AbstractVirtualFileSystem m_vfs = null;
049:
050:            /**
051:             * Selected highlight colour.
052:             */
053:            private Color m_selectedColor = new Color(173, 169, 143);
054:
055:            /**
056:             * Label.
057:             */
058:            private JLabel m_label = null;
059:
060:            /**
061:             * 
062:             */
063:            public ResourceDisplayPanel() {
064:                super ();
065:                this .setup();
066:            }
067:
068:            /**
069:             * Configures this component.
070:             *
071:             */
072:            private void setup() {
073:                this .setLayout(this );
074:                this .setBorder(BorderFactory.createEtchedBorder());
075:                this .setBackground(Color.WHITE);
076:                this .m_label = new JLabel();
077:                this .m_label.addMouseListener(this );
078:                this .m_label.setIcon(IconManager.getInstance().getIcon(
079:                        "16-blank.gif"));
080:                this .m_label.setFont(FontManager.getInstance().getFont(
081:                        FontManager.FONT_RESOURCE_TITLE));
082:                this .add(m_label);
083:            }
084:
085:            /**
086:             * Sets the resource.
087:             * 
088:             * @param vfFile Virtual file
089:             */
090:            public void setVirtualFile(VirtualFile vfFile) {
091:                if (vfFile != null) {
092:                    this .m_sFilePath = vfFile.getFullPath();
093:                    this .m_vfs = vfFile.getVFS();
094:                    VirtualFileSystemView vfsView = this .m_vfs
095:                            .getVirtualFileSystemView();
096:
097:                    this .m_label.setText(vfsView.getDisplayName(vfFile));
098:                    this .m_label.setIcon(vfsView.getIcon(vfFile));
099:                } else {
100:                    this .m_sFilePath = null;
101:                    this .m_vfs = null;
102:
103:                    this .m_label.setText("");
104:                    this .m_label.setIcon(IconManager.getInstance().getIcon(
105:                            "16-blank.gif"));
106:                }
107:
108:                this .setSelected(false);
109:
110:                this .validateTree();
111:                this .repaint();
112:            }
113:
114:            /**
115:             * Returns the resource.
116:             * 
117:             * @return Virtual file
118:             */
119:            public VirtualFile getVirtualFile() {
120:                if (this .m_vfs != null && this .m_sFilePath != null) {
121:                    return this .m_vfs.getVirtualFile(m_sFilePath).getResource();
122:                } else {
123:                    return null;
124:                }
125:            }
126:
127:            /* (non-Javadoc)
128:             * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
129:             */
130:            public void mouseClicked(MouseEvent ae) {
131:                if (ae.getSource() == this .m_label) {
132:                    if (this .getBackground() == Color.WHITE) {
133:                        this .setSelected(true);
134:                    } else {
135:                        this .setSelected(false);
136:                    }
137:                    this .validateTree();
138:                    this .repaint();
139:                }
140:            }
141:
142:            /**
143:             * Sets whether this field is selected.
144:             * 
145:             * @param bSelected true to set this field as selected
146:             */
147:            private void setSelected(boolean bSelected) {
148:                if (bSelected) {
149:                    this .setBackground(this .m_selectedColor);
150:                    this .m_label.setBackground(this .m_selectedColor);
151:                } else {
152:                    this .setBackground(Color.WHITE);
153:                    this .m_label.setBackground(Color.WHITE);
154:                }
155:            }
156:
157:            /**
158:             * Checks if this field is selected.
159:             * 
160:             * @return true if this field is selected
161:             */
162:            public boolean isSelected() {
163:                return this .getBackground() == this .m_selectedColor;
164:            }
165:
166:            /* (non-Javadoc)
167:             * @see java.awt.LayoutManager#layoutContainer(java.awt.Container)
168:             */
169:            public void layoutContainer(Container arg0) {
170:                this .m_label.setSize(this .getSize());
171:                this .m_label.setLocation(0, 0);
172:            }
173:
174:            /**
175:             * @param arg0
176:             */
177:            private ResourceDisplayPanel(boolean arg0) {
178:                super (arg0);
179:            }
180:
181:            /**
182:             * @param arg0
183:             */
184:            private ResourceDisplayPanel(LayoutManager arg0) {
185:                super (arg0);
186:            }
187:
188:            /**
189:             * @param arg0
190:             * @param arg1
191:             */
192:            private ResourceDisplayPanel(LayoutManager arg0, boolean arg1) {
193:                super (arg0, arg1);
194:            }
195:
196:            /* (non-Javadoc)
197:             * @see java.awt.LayoutManager#addLayoutComponent(java.lang.String, java.awt.Component)
198:             */
199:            public void addLayoutComponent(String arg0, Component arg1) {
200:            }
201:
202:            /* (non-Javadoc)
203:             * @see java.awt.LayoutManager#removeLayoutComponent(java.awt.Component)
204:             */
205:            public void removeLayoutComponent(Component arg0) {
206:            }
207:
208:            /* (non-Javadoc)
209:             * @see java.awt.LayoutManager#minimumLayoutSize(java.awt.Container)
210:             */
211:            public Dimension minimumLayoutSize(Container arg0) {
212:                return this .getPreferredSize();
213:            }
214:
215:            /* (non-Javadoc)
216:             * @see java.awt.LayoutManager#preferredLayoutSize(java.awt.Container)
217:             */
218:            public Dimension preferredLayoutSize(Container arg0) {
219:                return this .getPreferredSize();
220:            }
221:
222:            /* (non-Javadoc)
223:             * @see java.awt.Component#getPreferredSize()
224:             */
225:            public Dimension getPreferredSize() {
226:                return new Dimension(100, 20);
227:            }
228:
229:            /* (non-Javadoc)
230:             * @see java.awt.event.MouseListener#mouseEntered(java.awt.event.MouseEvent)
231:             */
232:            public void mouseEntered(MouseEvent arg0) {
233:            }
234:
235:            /* (non-Javadoc)
236:             * @see java.awt.event.MouseListener#mouseExited(java.awt.event.MouseEvent)
237:             */
238:            public void mouseExited(MouseEvent arg0) {
239:            }
240:
241:            /* (non-Javadoc)
242:             * @see java.awt.event.MouseListener#mousePressed(java.awt.event.MouseEvent)
243:             */
244:            public void mousePressed(MouseEvent arg0) {
245:            }
246:
247:            /* (non-Javadoc)
248:             * @see java.awt.event.MouseListener#mouseReleased(java.awt.event.MouseEvent)
249:             */
250:            public void mouseReleased(MouseEvent arg0) {
251:            }
252:
253:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.