Source Code Cross Referenced for AboutVAIBuilderFrame.java in  » Installer » VAInstall » com » memoire » vainstall » builder » gui » 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 » Installer » VAInstall » com.memoire.vainstall.builder.gui 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * $RCSfile: AboutVAIBuilderFrame.java,v $
003:         * @modification $Date: 2001/09/28 19:35:30 $
004:         * @version      $Id: AboutVAIBuilderFrame.java,v 1.1 2001/09/28 19:35:30 hfalk Exp $
005:         *
006:         */
007:
008:        package com.memoire.vainstall.builder.gui;
009:
010:        import com.memoire.vainstall.VAGlobals;
011:        import com.memoire.vainstall.builder.util.*;
012:
013:        import javax.swing.*;
014:        import javax.swing.event.*;
015:        import javax.swing.tree.*;
016:
017:        import java.awt.*;
018:        import java.awt.event.*;
019:        import java.util.*;
020:
021:        /**
022:         * This is the About view.
023:         * I have not 'optimized' any gui code. This will be done later.
024:         *
025:         * @see java.awt.ActionListener
026:         * @see java.awt.WindowListener
027:         * @see javax.swing.JFrame
028:         * @see javax.swing.event.TreeSelectionListener
029:         *
030:         * @author Henrik Falk
031:         * @version $Id: AboutVAIBuilderFrame.java,v 1.1 2001/09/28 19:35:30 hfalk Exp $
032:         */
033:        public class AboutVAIBuilderFrame extends JFrame implements 
034:                TreeSelectionListener, ActionListener, WindowListener {
035:
036:            JRootPane rootpane;
037:
038:            JTree tree = new JTree();
039:
040:            DefaultTreeModel treeModel = null;
041:
042:            AbstractVAIBuilderNode rootNode;
043:
044:            JButton okButton;
045:
046:            JPanel propertyNodePanel = null;
047:            JPanel currentPanel = null;
048:            JLabel propertyNodeLabel = null;
049:            JLabel propertyNodeImageLabel = null;
050:
051:            /**
052:             * Default constructor
053:             */
054:            public AboutVAIBuilderFrame() {
055:
056:                super ("");
057:
058:                JPanel allPanel = new JPanel(new GridBagLayout());
059:                GridBagLayout alayout = (GridBagLayout) allPanel.getLayout();
060:
061:                // ******************************************************
062:                JPanel wpanel = new JPanel(new GridBagLayout());
063:                GridBagLayout wlayout = (GridBagLayout) wpanel.getLayout();
064:
065:                JScrollPane pane = new JScrollPane(tree);
066:                pane.setMinimumSize(new Dimension(160, pane.getHeight()));
067:                pane.setPreferredSize(new Dimension(160, pane.getHeight()));
068:                GridBagConstraints wContraint = new GridBagConstraints();
069:                wContraint.fill = GridBagConstraints.BOTH;
070:                wContraint.insets = new Insets(4, 4, 4, 4);
071:                wContraint.anchor = GridBagConstraints.WEST;
072:                wContraint.gridx = 0;
073:                wContraint.gridy = 0;
074:                wContraint.gridwidth = 1;
075:                wContraint.gridheight = 1;
076:                wContraint.weightx = 0;
077:                wContraint.weighty = 1;
078:                wlayout.setConstraints(pane, wContraint);
079:                wpanel.add(pane);
080:
081:                // ******************************************************
082:                JPanel cpanel = new JPanel(new GridBagLayout());
083:                GridBagLayout clayout = (GridBagLayout) cpanel.getLayout();
084:                GridBagConstraints cContraint = new GridBagConstraints();
085:
086:                propertyNodePanel = new JPanel();
087:                propertyNodePanel.setLayout(new BorderLayout());
088:                cContraint.fill = GridBagConstraints.BOTH;
089:                cContraint.insets = new Insets(4, 4, 4, 4);
090:                cContraint.anchor = GridBagConstraints.CENTER;
091:                cContraint.gridx = 0;
092:                cContraint.gridy = 0;
093:                cContraint.gridwidth = 1;
094:                cContraint.gridheight = 1;
095:                cContraint.weightx = 1;
096:                cContraint.weighty = 1;
097:                clayout.setConstraints(propertyNodePanel, cContraint);
098:                cpanel.add(propertyNodePanel);
099:
100:                // *****************************************************
101:                JPanel labelPanel = new JPanel(new GridBagLayout());
102:                labelPanel.setBackground(Color.gray);
103:
104:                propertyNodeLabel = new JLabel(" ");
105:                propertyNodeLabel.setFont(new java.awt.Font("TimesRoman",
106:                        java.awt.Font.BOLD, 16));
107:                propertyNodeLabel.setForeground(Color.black);
108:                GridBagLayout labellayout = (GridBagLayout) labelPanel
109:                        .getLayout();
110:                GridBagConstraints labelContraint = new GridBagConstraints();
111:                labelContraint.fill = GridBagConstraints.BOTH;
112:                labelContraint.insets = new Insets(4, 4, 4, 4);
113:                labelContraint.anchor = GridBagConstraints.WEST;
114:                labelContraint.gridx = 0;
115:                labelContraint.gridy = 0;
116:                labelContraint.gridwidth = 1;
117:                labelContraint.gridheight = 1;
118:                labelContraint.weightx = 1;
119:                labelContraint.weighty = 1;
120:                labellayout.setConstraints(propertyNodeLabel, labelContraint);
121:                labelPanel.add(propertyNodeLabel);
122:
123:                propertyNodeImageLabel = new JLabel();
124:                propertyNodeImageLabel
125:                        .setIcon(new javax.swing.ImageIcon(
126:                                getClass()
127:                                        .getResource(
128:                                                "/com/memoire/vainstall/builder/images/nodedetailstitle.jpg")));
129:                GridBagConstraints labelImageContraint = new GridBagConstraints();
130:                labelImageContraint.fill = GridBagConstraints.NONE;
131:                labelImageContraint.insets = new Insets(0, 0, 0, 0);
132:                labelImageContraint.anchor = GridBagConstraints.EAST;
133:                labelImageContraint.gridx = 1;
134:                labelImageContraint.gridy = 0;
135:                labelImageContraint.gridwidth = 1;
136:                labelImageContraint.gridheight = 1;
137:                labellayout.setConstraints(propertyNodeImageLabel,
138:                        labelImageContraint);
139:                labelPanel.add(propertyNodeImageLabel);
140:
141:                propertyNodePanel.add("North", labelPanel);
142:
143:                // ******************************************************
144:                JPanel spanel = new JPanel(new GridBagLayout());
145:                GridBagLayout slayout = (GridBagLayout) spanel.getLayout();
146:                GridBagConstraints sContraint = new GridBagConstraints();
147:
148:                JPanel sFill = new JPanel();
149:                sFill.setLayout(new FlowLayout());
150:                sContraint.fill = GridBagConstraints.BOTH;
151:                sContraint.insets = new Insets(4, 4, 4, 4);
152:                sContraint.anchor = GridBagConstraints.CENTER;
153:                sContraint.gridx = 0;
154:                sContraint.gridy = 0;
155:                sContraint.gridwidth = 1;
156:                sContraint.gridheight = 1;
157:                sContraint.weightx = 1;
158:                slayout.setConstraints(sFill, sContraint);
159:                spanel.add(sFill);
160:
161:                okButton = new JButton();
162:                okButton.setText(VAGlobals.getResource(
163:                        "com.memoire.vainstall.builder.Language", "Common_OK"));
164:                okButton.addActionListener(this );
165:                sContraint.weightx = 0;
166:                sContraint.gridx = 1;
167:                slayout.setConstraints(okButton, sContraint);
168:                spanel.add(okButton);
169:
170:                // ******************************************************
171:
172:                GridBagConstraints awContraint = new GridBagConstraints();
173:                awContraint.fill = GridBagConstraints.BOTH;
174:                awContraint.insets = new Insets(0, 0, 0, 0);
175:                awContraint.anchor = GridBagConstraints.NORTHWEST;
176:                awContraint.gridx = 0;
177:                awContraint.gridy = 0;
178:                awContraint.gridwidth = 1;
179:                awContraint.gridheight = 1;
180:                awContraint.weightx = 0;
181:                awContraint.weighty = 1;
182:                alayout.setConstraints(wpanel, awContraint);
183:                allPanel.add(wpanel);
184:
185:                GridBagConstraints acContraint = new GridBagConstraints();
186:                acContraint.fill = GridBagConstraints.BOTH;
187:                acContraint.insets = new Insets(0, 0, 0, 0);
188:                acContraint.anchor = GridBagConstraints.CENTER;
189:                acContraint.gridx = 1;
190:                acContraint.gridy = 0;
191:                acContraint.gridwidth = 2;
192:                acContraint.gridheight = 1;
193:                acContraint.weightx = 1;
194:                acContraint.weighty = 1;
195:                alayout.setConstraints(cpanel, acContraint);
196:                allPanel.add(cpanel);
197:
198:                GridBagConstraints asContraint = new GridBagConstraints();
199:                asContraint.fill = GridBagConstraints.BOTH;
200:                asContraint.insets = new Insets(0, 0, 0, 0);
201:                asContraint.anchor = GridBagConstraints.CENTER;
202:                asContraint.gridx = 0;
203:                asContraint.gridy = 1;
204:                asContraint.gridwidth = 3;
205:                asContraint.gridheight = 1;
206:                asContraint.weightx = 1;
207:                asContraint.weighty = 0;
208:                alayout.setConstraints(spanel, asContraint);
209:                allPanel.add(spanel);
210:
211:                // ******************************************************
212:
213:                this .getContentPane().add("Center", allPanel);
214:                this .getRootPane().registerKeyboardAction(this , "VK_ESCAPE",
215:                        KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0, false),
216:                        JComponent.WHEN_IN_FOCUSED_WINDOW);
217:
218:                ToolTipManager.sharedInstance().registerComponent(tree);
219:                tree.setCellRenderer(new NodeTreeCellRenderer());
220:
221:                tree.getSelectionModel().setSelectionMode(
222:                        TreeSelectionModel.SINGLE_TREE_SELECTION);
223:                tree.addTreeSelectionListener(this );
224:                tree.putClientProperty("JTree.lineStyle", "Angled");
225:
226:                // null model
227:                tree.setModel(null);
228:
229:                addWindowListener(this );
230:
231:                setSize(600, 480);
232:                setResizable(false);
233:
234:            }
235:
236:            public void setNode(AbstractVAIBuilderNode root) {
237:
238:        rootNode = root;
239:        treeModel=new DefaultTreeModel(root);
240:        tree.setModel(treeModel);
241:
242:        tree.setSelectionRow(0);
243:
244:        Enumeration enum = rootNode.preorderEnumeration();
245:        while(enum.hasMoreElements() == true) {
246:            AbstractVAIBuilderNode node = (AbstractVAIBuilderNode)enum.nextElement();
247:            node.start();
248:        }
249:    }
250:
251:            public void actionPerformed(ActionEvent evt) {
252:
253:        // extract the control that sends the event
254:        Object source = evt.getSource();
255:        String actionCommand = evt.getActionCommand();
256:
257:        if (actionCommand != null && actionCommand.equals("VK_ESCAPE") == true) {
258:            setVisible(false);
259:        }
260:
261:        if (source == okButton) {
262:            if (rootNode != null) {
263:                Enumeration enum = rootNode.preorderEnumeration();
264:                while (enum.hasMoreElements() == true) {
265:                    AbstractVAIBuilderNode node = (AbstractVAIBuilderNode)enum.nextElement();
266:                    node.stop();
267:                }
268:            }
269:            setVisible(false);
270:        }
271:    }
272:
273:            public void valueChanged(TreeSelectionEvent evt) {
274:
275:                TreePath path = evt.getNewLeadSelectionPath();
276:                if (path == null) {
277:                    return;
278:                }
279:
280:                Object obj = path.getLastPathComponent();
281:
282:                if (obj instanceof  DefaultMutableTreeNode) {
283:                    Object userObject = ((DefaultMutableTreeNode) obj)
284:                            .getUserObject();
285:
286:                    if (userObject instanceof  VAINodeInterface) {
287:                        setTreePanel(((AbstractVAIBuilderNode) userObject)
288:                                .getUI());
289:                        setTreePanelTitle(((AbstractVAIBuilderNode) userObject)
290:                                .getTitle());
291:                    }
292:                }
293:            }
294:
295:            private void setTreePanelTitle(String title) {
296:                propertyNodeLabel.setText(title);
297:            }
298:
299:            private void setTreePanel(JPanel panel) {
300:
301:                if (currentPanel == null) {
302:                    propertyNodePanel.add("Center", panel);
303:                    currentPanel = panel;
304:                } else {
305:                    propertyNodePanel.remove(currentPanel);
306:                    propertyNodePanel.add("Center", panel);
307:                    currentPanel = panel;
308:                }
309:                validate();
310:                repaint();
311:            }
312:
313:            public void center() {
314:                java.awt.Dimension dimScreen = java.awt.Toolkit
315:                        .getDefaultToolkit().getScreenSize();
316:                this .setLocation((dimScreen.width - this .getSize().width) / 2,
317:                        (dimScreen.height - this .getSize().height) / 2);
318:            }
319:
320:            /**
321:             * Method to handle events for the WindowListener interface.
322:             * @param e java.awt.event.WindowEvent
323:             */
324:            public void windowActivated(java.awt.event.WindowEvent e) {
325:            }
326:
327:            /**
328:             * Method to handle events for the WindowListener interface.
329:             * @param e java.awt.event.WindowEvent
330:             */
331:            public void windowClosed(java.awt.event.WindowEvent e) {
332:            }
333:
334:            /**
335:             * Method to handle events for the WindowListener interface.
336:             * @param e java.awt.event.WindowEvent
337:             */
338:            public void windowClosing(java.awt.event.WindowEvent e) {
339:            }
340:
341:            /**
342:             * Method to handle events for the WindowListener interface.
343:             * @param e java.awt.event.WindowEvent
344:             */
345:            public void windowDeactivated(java.awt.event.WindowEvent e) {
346:            }
347:
348:            /**
349:             * Method to handle events for the WindowListener interface.
350:             * @param e java.awt.event.WindowEvent
351:             */
352:            public void windowDeiconified(java.awt.event.WindowEvent e) {
353:            }
354:
355:            /**
356:             * Method to handle events for the WindowListener interface.
357:             * @param e java.awt.event.WindowEvent
358:             */
359:            public void windowIconified(java.awt.event.WindowEvent e) {
360:            }
361:
362:            /**
363:             * Method to handle events for the WindowListener interface.
364:             * @param e java.awt.event.WindowEvent
365:             */
366:            public void windowOpened(java.awt.event.WindowEvent e) {
367:                okButton.requestFocus();
368:            }
369:
370:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.