Source Code Cross Referenced for IWindow.java in  » Net » hyperpool-0.4.0 » vicazh » hyperpool » 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 » Net » hyperpool 0.4.0 » vicazh.hyperpool 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package vicazh.hyperpool;
002:
003:        import java.awt.*;
004:        import java.awt.event.*;
005:        import java.util.*;
006:        import java.util.logging.*;
007:        import javax.swing.*;
008:        import javax.swing.event.*;
009:        import javax.swing.tree.*;
010:        import org.jdesktop.jdic.tray.*;
011:        import org.jdesktop.jdic.tray.internal.*;
012:
013:        /**
014:         * The windows manager
015:         * 
016:         * @author Victor Zhigunov
017:         * @version 0.4.0
018:         */
019:        public class IWindow implements  ActionListener, TreeSelectionListener {
020:
021:            private Container container;
022:
023:            private String resource;
024:
025:            private Reader reader;
026:
027:            private JMenuItem menu;
028:
029:            private AbstractButton button;
030:
031:            private Map<Object, Window> map;
032:
033:            private JTree tree;
034:
035:            private Component component;
036:
037:            private TrayIcon tray;
038:
039:            private JMenuItem menuTray;
040:
041:            private SystemTray systemTray;
042:
043:            /**
044:             * @param container
045:             *            manager container
046:             * @param resource
047:             *            xml resource
048:             * @param reader
049:             *            xml reader
050:             * @param menu
051:             *            create menu
052:             * @param button
053:             *            create button
054:             * @param map
055:             *            frames map
056:             * @param tree
057:             *            manager tree
058:             * @param component
059:             *            application component
060:             * @param trayIcon
061:             *            tray icon
062:             * @param trayArg
063:             *            tray arg
064:             * @param trayMenu
065:             *            tray menu
066:             * @param status
067:             *            tray status
068:             * @param menuTray
069:             *            tray menu item
070:             */
071:            public IWindow(Container container, String resource, Reader reader,
072:                    JMenuItem menu, AbstractButton button,
073:                    Map<Object, Window> map, JTree tree, Component component,
074:                    Icon trayIcon, String trayArg, JPopupMenu trayMenu,
075:                    boolean status, JMenuItem menuTray) {
076:                this .container = container;
077:                this .resource = resource;
078:                this .reader = reader;
079:                this .menu = menu;
080:                menu.addActionListener(this );
081:                this .button = button;
082:                button.addActionListener(this );
083:                this .map = map;
084:                this .tree = tree;
085:                tree.addTreeSelectionListener(this );
086:                this .component = component;
087:                try {
088:                    systemTray = SystemTray.getDefaultSystemTray();
089:                    tray = new TrayIcon(trayIcon, trayArg, trayMenu);
090:                    tray.addActionListener(this );
091:                    this .menuTray = menuTray;
092:                    menuTray.addActionListener(this );
093:                    tray(status);
094:                } catch (Throwable e) {
095:                    menuTray.setEnabled(false);
096:                    component.setVisible(true);
097:                }
098:                valueChanged(null);
099:            }
100:
101:            public Component get() {
102:                int count = container.getComponentCount();
103:                for (int i = 0; i < count; i++) {
104:                    Component c = container.getComponent(i);
105:                    if (c.isVisible())
106:                        return c;
107:                }
108:                return null;
109:            }
110:
111:            private void tray(boolean b) {
112:                component.setVisible(!b);
113:                if (b)
114:                    systemTray.addTrayIcon(tray);
115:                else
116:                    systemTray.removeTrayIcon(tray);
117:            }
118:
119:            public void actionPerformed(ActionEvent e) {
120:                Object source = e.getSource();
121:                if (source == menu || source == button) {
122:                    valueChanged(null);
123:                    try {
124:                        reader.getObject(resource);
125:                    } catch (Exception ex) {
126:                        Start.logger.log(Level.SEVERE, ex.getMessage(), ex);
127:                    }
128:                } else if (source instanceof  TrayIconService)
129:                    tray(false);
130:                else if (source == menuTray)
131:                    tray(true);
132:                else {
133:                    String command = e.getActionCommand();
134:                    if (command.equals("close"))
135:                        stop();
136:                    else {
137:                        DefaultMutableTreeNode node = (DefaultMutableTreeNode) tree
138:                                .getLastSelectedPathComponent();
139:                        if (node == null)
140:                            return;
141:                        Window window = map.get(String.valueOf(node
142:                                .getUserObject().hashCode()));
143:                        if (window != null)
144:                            window.dispose();
145:                    }
146:                }
147:            }
148:
149:            public void valueChanged(TreeSelectionEvent e) {
150:                if (e != null) {
151:                    DefaultMutableTreeNode node = (DefaultMutableTreeNode) tree
152:                            .getLastSelectedPathComponent();
153:                    if (node != null) {
154:                        Object n = node.getUserObject();
155:                        if (n instanceof  IElement) {
156:                            Component c = map.get(String.valueOf(n.hashCode()));
157:                            if (c == null) {
158:                                menu.setEnabled(true);
159:                                button.setEnabled(true);
160:                                return;
161:                            } else
162:                                c.setVisible(true);
163:                        }
164:                    }
165:                }
166:                menu.setEnabled(false);
167:                button.setEnabled(false);
168:            }
169:
170:            public void stop() {
171:                for (Window e : map.values())
172:                    e.dispose();
173:            }
174:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.