Source Code Cross Referenced for SessionEntry.java in  » Content-Management-System » harmonise » org » openharmonise » him » window » session » 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.window.session 
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.window.session;
020:
021:        import java.awt.Color;
022:        import java.awt.Component;
023:        import java.awt.Container;
024:        import java.awt.Dimension;
025:        import java.awt.Font;
026:        import java.awt.LayoutManager;
027:        import java.awt.event.MouseEvent;
028:        import java.awt.event.MouseListener;
029:        import java.text.SimpleDateFormat;
030:        import java.util.Date;
031:
032:        import javax.swing.JLabel;
033:        import javax.swing.JPanel;
034:
035:        import org.openharmonise.swing.FontManager;
036:        import org.openharmonise.vfs.*;
037:        import org.openharmonise.vfs.event.*;
038:        import org.openharmonise.vfs.gui.*;
039:
040:        /**
041:         * 
042:         * @author Matthew Large
043:         * @version $Revision: 1.2 $
044:         *
045:         */
046:        public class SessionEntry extends JPanel implements 
047:                VirtualFileListener, LayoutManager, MouseListener {
048:
049:            private AbstractVirtualFileSystem m_vfs = null;
050:            private String m_sPath = null;
051:
052:            private JLabel m_iconNameLabel = null;
053:            private JLabel m_syncIcon = null;
054:
055:            int m_nWidth = 0;
056:
057:            private Color m_selectedColor = new Color(173, 169, 143);
058:            private boolean m_bSelected = false;
059:
060:            private SessionInformation m_parent = null;
061:
062:            private String m_sReason = null;
063:
064:            /**
065:             * 
066:             */
067:            public SessionEntry(SessionInformation parent, VirtualFile vfFile,
068:                    String sReason) {
069:                super ();
070:                this .m_parent = parent;
071:                this .m_sReason = sReason;
072:                this .setup(vfFile);
073:            }
074:
075:            private void setup(VirtualFile vfFile) {
076:                this .setLayout(this );
077:                this .setBackground(Color.WHITE);
078:
079:                String sDisplayName = "";
080:                if (vfFile != null) {
081:                    this .m_vfs = vfFile.getVFS();
082:                    this .m_sPath = vfFile.getFullPath();
083:
084:                    VirtualFile vfDisplay = vfFile.getVFS().getVirtualFile(
085:                            ((VersionedVirtualFile) vfFile).getLogicalPath())
086:                            .getResource();
087:                    sDisplayName = vfDisplay.getVFS()
088:                            .getVirtualFileSystemView().getDisplayName(
089:                                    vfDisplay);
090:                }
091:
092:                //		String fontName = "Dialog";
093:                //		int fontSize = 11;
094:                //		Font font = new Font(fontName, Font.PLAIN, fontSize);
095:
096:                Date dt = new Date();
097:                SimpleDateFormat formatter = new SimpleDateFormat("HH:mm");
098:
099:                this .m_iconNameLabel = new JLabel(sDisplayName + "         - "
100:                        + this .m_sReason + " at " + formatter.format(dt));
101:                this .m_iconNameLabel.setFont(FontManager.getInstance().getFont(
102:                        FontManager.FONT_RESOURCE_TITLE));
103:                if (vfFile != null) {
104:                    this .m_iconNameLabel.setIcon(vfFile.getVFS()
105:                            .getVirtualFileSystemView().getIcon(vfFile));
106:                } else {
107:                    this .m_iconNameLabel.setIcon(IconManager.getInstance()
108:                            .getIcon("16-document.gif"));
109:                }
110:                this .m_iconNameLabel.addMouseListener(this );
111:                this .add(this .m_iconNameLabel);
112:
113:                this .m_syncIcon = new JLabel();
114:                if (vfFile != null && vfFile.isChanged()) {
115:                    this .m_syncIcon.setIcon(IconManager.getInstance().getIcon(
116:                            "16-command-sync-all.gif"));
117:                } else {
118:                    this .m_syncIcon.setIcon(IconManager.getInstance().getIcon(
119:                            "16-blank.gif"));
120:                }
121:                this .m_syncIcon.addMouseListener(this );
122:                this .add(this .m_syncIcon);
123:            }
124:
125:            protected boolean isVirtualFileChanged() {
126:                if (this .m_vfs != null && this .m_sPath != null) {
127:                    if (this .m_vfs.getVirtualFile(this .m_sPath).getResource()
128:                            .isChanged()) {
129:                        return true;
130:                    } else {
131:                        return false;
132:                    }
133:                } else {
134:                    return false;
135:                }
136:            }
137:
138:            /* (non-Javadoc)
139:             * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
140:             */
141:            public void mouseClicked(MouseEvent arg0) {
142:                if (this .m_bSelected) {
143:                    // NO-OP
144:                } else {
145:                    this .selectEntry();
146:                }
147:            }
148:
149:            public AbstractVirtualFileSystem getVFS() {
150:                return this .m_vfs;
151:            }
152:
153:            public String getReason() {
154:                return this .m_sReason;
155:            }
156:
157:            public String getPath() {
158:                return this .m_sPath;
159:            }
160:
161:            public boolean isSelected() {
162:                return this .m_bSelected;
163:            }
164:
165:            protected void selectEntry() {
166:                this .setBackground(this .m_selectedColor);
167:                this .m_bSelected = true;
168:                this .m_parent.entrySelected(this );
169:            }
170:
171:            protected void deselectEntry() {
172:                this .setBackground(Color.WHITE);
173:                this .m_bSelected = false;
174:            }
175:
176:            /* (non-Javadoc)
177:             * @see java.awt.LayoutManager#removeLayoutComponent(java.awt.Component)
178:             */
179:            public void removeLayoutComponent(Component arg0) {
180:                // NO-OP
181:            }
182:
183:            /* (non-Javadoc)
184:             * @see java.awt.LayoutManager#layoutContainer(java.awt.Container)
185:             */
186:            public void layoutContainer(Container arg0) {
187:                m_nWidth = this .getParent().getParent().getParent().getWidth() - 20;
188:                this .m_iconNameLabel.setSize(this .getParent().getParent()
189:                        .getParent().getWidth() - 40, 20);
190:                this .m_iconNameLabel.setLocation(0, 0);
191:
192:                this .m_syncIcon.setSize(20, 20);
193:                this .m_syncIcon.setLocation(this .getParent().getParent()
194:                        .getParent().getWidth() - 40, 0);
195:            }
196:
197:            /* (non-Javadoc)
198:             * @see java.awt.Component#getPreferredSize()
199:             */
200:            public Dimension getPreferredSize() {
201:                return new Dimension(m_nWidth, 20);
202:            }
203:
204:            /* (non-Javadoc)
205:             * @see java.awt.LayoutManager#addLayoutComponent(java.lang.String, java.awt.Component)
206:             */
207:            public void addLayoutComponent(String arg0, Component arg1) {
208:                // NO-OP
209:            }
210:
211:            /* (non-Javadoc)
212:             * @see java.awt.LayoutManager#minimumLayoutSize(java.awt.Container)
213:             */
214:            public Dimension minimumLayoutSize(Container arg0) {
215:                return this .getPreferredSize();
216:            }
217:
218:            /* (non-Javadoc)
219:             * @see java.awt.LayoutManager#preferredLayoutSize(java.awt.Container)
220:             */
221:            public Dimension preferredLayoutSize(Container arg0) {
222:                return new Dimension(m_nWidth, 20);
223:            }
224:
225:            /**
226:             * @param arg0
227:             */
228:            private SessionEntry(boolean arg0) {
229:                super (arg0);
230:            }
231:
232:            /**
233:             * @param arg0
234:             */
235:            private SessionEntry(LayoutManager arg0) {
236:                super (arg0);
237:            }
238:
239:            /**
240:             * @param arg0
241:             * @param arg1
242:             */
243:            private SessionEntry(LayoutManager arg0, boolean arg1) {
244:                super (arg0, arg1);
245:            }
246:
247:            /* (non-Javadoc)
248:             * @see java.awt.event.MouseListener#mouseEntered(java.awt.event.MouseEvent)
249:             */
250:            public void mouseEntered(MouseEvent arg0) {
251:            }
252:
253:            /* (non-Javadoc)
254:             * @see java.awt.event.MouseListener#mouseExited(java.awt.event.MouseEvent)
255:             */
256:            public void mouseExited(MouseEvent arg0) {
257:            }
258:
259:            /* (non-Javadoc)
260:             * @see java.awt.event.MouseListener#mousePressed(java.awt.event.MouseEvent)
261:             */
262:            public void mousePressed(MouseEvent arg0) {
263:            }
264:
265:            /* (non-Javadoc)
266:             * @see java.awt.event.MouseListener#mouseReleased(java.awt.event.MouseEvent)
267:             */
268:            public void mouseReleased(MouseEvent arg0) {
269:            }
270:
271:            /* (non-Javadoc)
272:             * @see com.simulacramedia.vfs.event.VirtualFileListener#virtualFileChanged(com.simulacramedia.vfs.event.VirtualFileEvent)
273:             */
274:            public void virtualFileChanged(VirtualFileEvent vfe) {
275:            }
276:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.