Source Code Cross Referenced for DisplayManager.java in  » Content-Management-System » harmonise » org » openharmonise » him » window » 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 
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;
020:
021:        import java.awt.*;
022:        import java.awt.event.*;
023:
024:        import javax.swing.*;
025:
026:        import org.openharmonise.him.configuration.*;
027:        import org.openharmonise.him.context.StateHandler;
028:        import org.openharmonise.him.displaycomponents.table.*;
029:        import org.openharmonise.him.displaycomponents.table.title.*;
030:        import org.openharmonise.him.metadata.swing.*;
031:        import org.openharmonise.him.window.menus.MenuBar;
032:        import org.openharmonise.him.window.outlookbar.*;
033:        import org.openharmonise.him.window.swing.ExtendedSplitPane;
034:        import org.openharmonise.him.window.swing.SimulacraLnF;
035:        import org.openharmonise.him.window.toolbars.*;
036:        import org.openharmonise.vfs.context.*;
037:        import org.openharmonise.vfs.gui.*;
038:
039:        /**
040:         * @author Matthew Large
041:         *
042:         */
043:        public class DisplayManager implements  Runnable, WindowFocusListener,
044:                ContextListener {
045:
046:            private static DisplayManager m_instance = null;
047:
048:            private ExtendedSplitPane m_splitVertBarLeft = null;
049:            private TitleBarSplitPane m_splitHoriTitleBarTop = null;
050:            private ExtendedSplitPane m_splitVertTableLeft = null;
051:            private ExtendedSplitPane m_splitHoriMetaTopConsoleBottom = null;
052:
053:            private TitleBar m_titleBar = null;
054:
055:            private TableView m_table = null;
056:
057:            private JFrame m_mainFrame = null;
058:
059:            private int m_nFrameX;
060:            private int m_nFrameY;
061:            private int m_nFramePosX;
062:            private int m_nFramePosY;
063:
064:            private FloatingBarPane m_outlookbar = null;
065:            private InformationBar m_informationbar = null;
066:
067:            private JScrollPane m_tableScroller = null;
068:
069:            private MetadataPanel m_metadataPanel = null;
070:
071:            private DisplayManager() {
072:                super ();
073:                ContextHandler.getInstance().addListener(
074:                        ContextType.CONTEXT_SHUTDOWN, this );
075:            }
076:
077:            public static DisplayManager getInstance() {
078:                if (m_instance == null) {
079:                    m_instance = new DisplayManager();
080:                }
081:
082:                return m_instance;
083:            }
084:
085:            private void setLookandFeel() {
086:                SimulacraLnF.setLookAndFeel();
087:            }
088:
089:            public JFrame getMainWindow() {
090:                return this .m_mainFrame;
091:            }
092:
093:            public void clearMetadataPanel() {
094:                this .m_metadataPanel.clearMetadataPanel();
095:            }
096:
097:            public void showMainWindow() {
098:                this .setLookandFeel();
099:
100:                this .m_mainFrame = new JFrame();
101:                this .m_mainFrame
102:                        .setTitle("Simulacra - Harmonise Information Manager");
103:
104:                StateHandler.getInstance().setApplicationWindow(m_mainFrame);
105:
106:                this .m_mainFrame.setJMenuBar(new MenuBar());
107:
108:                this .m_mainFrame.addWindowFocusListener(this );
109:
110:                this .m_mainFrame.setIconImage(((ImageIcon) IconManager
111:                        .getInstance().getIcon("32-sim-logo.gif")).getImage());
112:
113:                DividerListener l = new DividerListener();
114:                this .m_mainFrame.addComponentListener(l);
115:
116:                this .m_mainFrame.setResizable(true);
117:
118:                String sX = ConfigStore.getInstance().getPropertyValue(
119:                        "mainFrameX");
120:                int nX;
121:                if (sX != null) {
122:                    nX = Integer.parseInt(sX);
123:                } else {
124:                    nX = 400;
125:                }
126:                String sY = ConfigStore.getInstance().getPropertyValue(
127:                        "mainFrameY");
128:                int nY;
129:                if (sY != null) {
130:                    nY = Integer.parseInt(sY);
131:                } else {
132:                    nY = 400;
133:                }
134:                this .m_mainFrame.setSize(nX, nY);
135:                sX = ConfigStore.getInstance()
136:                        .getPropertyValue("mainFramePosX");
137:                if (sX != null) {
138:                    nX = Integer.parseInt(sX);
139:                } else {
140:                    nX = 0;
141:                }
142:                sY = ConfigStore.getInstance()
143:                        .getPropertyValue("mainFramePosY");
144:                if (sY != null) {
145:                    nY = Integer.parseInt(sY);
146:                } else {
147:                    nY = 0;
148:                }
149:                this .m_mainFrame.setLocation(nX, nY);
150:                m_mainFrame
151:                        .setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
152:                m_mainFrame.addWindowListener(new WindowAdapter() {
153:                    public void windowClosing(WindowEvent woo) {
154:                        ContextEvent ce = new ContextEvent(
155:                                ContextType.CONTEXT_SYNC_ALL_FILES_AND_SHUTDOWN);
156:                        ContextHandler.getInstance().fireContextEvent(ce);
157:                    }
158:                });
159:
160:                JPanel panel1 = new JPanel();
161:                panel1.setBackground(Color.WHITE);
162:
163:                m_metadataPanel = new MetadataPanel();
164:                JScrollPane metadataScroller = new JScrollPane(m_metadataPanel,
165:                        JScrollPane.VERTICAL_SCROLLBAR_NEVER,
166:                        JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
167:                metadataScroller.setMinimumSize(new Dimension(350, 55));
168:
169:                m_metadataPanel.addComponentListener(m_metadataPanel);
170:                metadataScroller.addComponentListener(m_metadataPanel);
171:
172:                this .m_splitVertTableLeft = new ExtendedSplitPane(
173:                        ExtendedSplitPane.HORIZONTAL_SPLIT, panel1,
174:                        metadataScroller);
175:                m_splitVertTableLeft.addComponentListener(m_metadataPanel);
176:
177:                m_titleBar = new TitleBar();
178:
179:                this .m_splitHoriTitleBarTop = new TitleBarSplitPane(
180:                        TitleBarSplitPane.VERTICAL_SPLIT, m_titleBar,
181:                        m_splitVertTableLeft);
182:
183:                m_informationbar = new InformationBar();
184:                this .m_splitHoriMetaTopConsoleBottom = new ExtendedSplitPane(
185:                        ExtendedSplitPane.VERTICAL_SPLIT,
186:                        m_splitHoriTitleBarTop, m_informationbar);
187:
188:                FlowLayout fl = new FlowLayout(FlowLayout.LEFT);
189:                fl.setHgap(0);
190:                fl.setVgap(0);
191:                panel1 = new JPanel(fl, true);
192:                panel1.setBackground(Color.LIGHT_GRAY);
193:
194:                this .m_outlookbar = new FloatingBarPane(panel1);
195:
196:                panel1.add(this .m_outlookbar);
197:                this .m_splitVertBarLeft = new ExtendedSplitPane(
198:                        ExtendedSplitPane.HORIZONTAL_SPLIT, panel1,
199:                        this .m_splitHoriMetaTopConsoleBottom);
200:
201:                ToolBar bar = new ToolBar();
202:                bar.setFloatable(false);
203:                this .m_mainFrame.getContentPane().add(bar,
204:                        BorderLayout.PAGE_START);
205:                this .m_mainFrame.getContentPane().add(StatusBar.getInstance(),
206:                        BorderLayout.PAGE_END);
207:
208:                this .m_mainFrame.getContentPane().add(this .m_splitVertBarLeft,
209:                        BorderLayout.CENTER);
210:
211:            }
212:
213:            public void setVisible(boolean bVisible) {
214:                this .m_mainFrame.setVisible(bVisible);
215:                SwingUtilities.invokeLater(this );
216:            }
217:
218:            public void addOutlookBar(String sTitle, Component component) {
219:                this .m_outlookbar.add(sTitle, component);
220:                this .m_outlookbar.repaint();
221:            }
222:
223:            public void addOutlookBar(String sTitle, Icon icon,
224:                    Component component) {
225:                this .m_outlookbar.add(sTitle, icon, component);
226:                this .m_outlookbar.repaint();
227:            }
228:
229:            public Component getOutlookBar(String sTitle) {
230:                return this .m_outlookbar.getComponent(sTitle);
231:            }
232:
233:            public void setSelectedOutlookBar(String sTitle) {
234:                Component component = this .getOutlookBar(sTitle);
235:                if (component != null) {
236:                    this .m_outlookbar.setSelectedComponent(component);
237:                }
238:            }
239:
240:            public void setTable(Component table) {
241:                this .m_table = (TableView) table;
242:
243:                m_titleBar.setTable((TableView) table);
244:
245:                m_tableScroller = new JScrollPane(table,
246:                        JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
247:                        JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
248:
249:                this .m_splitVertTableLeft.setLeftComponent(m_tableScroller);
250:                Dimension dim = this .m_splitVertTableLeft.getSize();
251:                dim.width = dim.width
252:                        - this .m_splitVertTableLeft.getDividerLocation();
253:                m_tableScroller.getViewport().setSize(dim);
254:                JScrollBar hBar = new JScrollBar(JScrollBar.HORIZONTAL);
255:                hBar.setUnitIncrement(20);
256:                m_tableScroller.setHorizontalScrollBar(hBar);
257:                JScrollBar vBar = new JScrollBar(JScrollBar.VERTICAL);
258:                vBar.setUnitIncrement(20);
259:                m_tableScroller.setVerticalScrollBar(vBar);
260:            }
261:
262:            public TableView getTable() {
263:                return this .m_table;
264:            }
265:
266:            public void shutdown() {
267:                ConfigStore.getInstance().setProperty(
268:                        "splitVertBarLeft",
269:                        Double.toString(m_splitVertBarLeft
270:                                .getProportionalDividerLocation()));
271:                ConfigStore.getInstance().setProperty(
272:                        "splitVertTableLeft",
273:                        Double.toString(m_splitVertTableLeft
274:                                .getProportionalDividerLocation()));
275:                ConfigStore.getInstance().setProperty(
276:                        "splitHoriMetaTopConsoleBottom",
277:                        Double.toString(m_splitHoriMetaTopConsoleBottom
278:                                .getProportionalDividerLocation()));
279:                ConfigStore.getInstance().setProperty("mainFrameX",
280:                        Integer.toString(this .m_nFrameX));
281:                ConfigStore.getInstance().setProperty("mainFrameY",
282:                        Integer.toString(this .m_nFrameY));
283:                ConfigStore.getInstance().setProperty("mainFramePosX",
284:                        Integer.toString(this .m_nFramePosX));
285:                ConfigStore.getInstance().setProperty("mainFramePosY",
286:                        Integer.toString(this .m_nFramePosY));
287:                ConfigStore.getInstance().save();
288:            }
289:
290:            public class DividerListener extends ComponentAdapter {
291:
292:                public void componentResized(ComponentEvent event) {
293:                    m_nFrameX = m_mainFrame.getWidth();
294:                    m_nFrameY = m_mainFrame.getHeight();
295:                }
296:
297:                public void componentMoved(ComponentEvent e) {
298:                    m_nFramePosX = m_mainFrame.getX();
299:                    m_nFramePosY = m_mainFrame.getY();
300:                }
301:            }
302:
303:            /**
304:             * @return
305:             */
306:            public FloatingBarPane getOutlookbar() {
307:                return m_outlookbar;
308:            }
309:
310:            public void hideMetadata() {
311:                String sValue = ConfigStore.getInstance().getPropertyValue(
312:                        "AUTO_METADATA_POSITION");
313:                if (sValue != null && sValue.equals("Yes")) {
314:                    ((ExtendedSplitPane) this .m_splitVertTableLeft)
315:                            .setExtDividerLocation(this .m_splitVertTableLeft
316:                                    .getWidth());
317:                }
318:                ContextEvent ce = new ContextEvent(
319:                        ContextType.CONTEXT_CLEAR_METADATA);
320:                ContextHandler.getInstance().fireContextEvent(ce);
321:            }
322:
323:            public synchronized void openMetadata() {
324:                String sValue = ConfigStore.getInstance().getPropertyValue(
325:                        "AUTO_METADATA_POSITION");
326:                if (sValue != null && sValue.equals("Yes")) {
327:                    this .m_splitVertTableLeft.setExtDividerLocation(200);
328:                }
329:                this .m_splitVertTableLeft.validate();
330:            }
331:
332:            public void scrollTableTo(int nPosition) {
333:                String sValue = ConfigStore.getInstance().getPropertyValue(
334:                        "AUTO_METADATA_POSITION");
335:                if (sValue != null && sValue.equals("Yes")) {
336:                    this .m_tableScroller.getHorizontalScrollBar().setValue(
337:                            nPosition);
338:                }
339:            }
340:
341:            /* (non-Javadoc)
342:             * @see java.lang.Runnable#run()
343:             */
344:            public void run() {
345:
346:                String sSplit = ConfigStore.getInstance().getPropertyValue(
347:                        "splitVertBarLeft");
348:                if (sSplit != null) {
349:                    double split = Double.parseDouble(sSplit);
350:                    m_splitVertBarLeft.setDividerLocation(split);
351:                } else {
352:                    double split = 0.5;
353:                    m_splitVertBarLeft.setDividerLocation(split);
354:                }
355:
356:                sSplit = ConfigStore.getInstance().getPropertyValue(
357:                        "splitHoriMetaTopConsoleBottom");
358:                if (sSplit != null) {
359:                    double split = Double.parseDouble(sSplit);
360:                    m_splitHoriMetaTopConsoleBottom.setDividerLocation(split);
361:                } else {
362:                    double split = 0.5;
363:                    m_splitHoriMetaTopConsoleBottom.setDividerLocation(split);
364:                }
365:                m_splitVertTableLeft.setExtDividerLocation(500);
366:                this .m_splitVertTableLeft.validate();
367:            }
368:
369:            /* (non-Javadoc)
370:             * @see java.awt.event.WindowFocusListener#windowGainedFocus(java.awt.event.WindowEvent)
371:             */
372:            public void windowGainedFocus(WindowEvent arg0) {
373:
374:                ContextEvent ce = new ContextEvent(
375:                        ContextType.CONTEXT_APP_FOCUS);
376:                ContextHandler.getInstance().fireContextEvent(ce);
377:            }
378:
379:            /* (non-Javadoc)
380:             * @see java.awt.event.WindowFocusListener#windowLostFocus(java.awt.event.WindowEvent)
381:             */
382:            public void windowLostFocus(WindowEvent arg0) {
383:            }
384:
385:            /* (non-Javadoc)
386:             * @see com.simulacramedia.contentmanager.context.ContextListener#contextMessage(com.simulacramedia.contentmanager.context.ContextEvent)
387:             */
388:            public void contextMessage(ContextEvent ce) {
389:                if (ce.CONTEXT_TYPE == ContextType.CONTEXT_SHUTDOWN) {
390:                    this.shutdown();
391:                }
392:            }
393:
394:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.