Source Code Cross Referenced for ProductStepShortcutsPanel.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: ProductStepShortcutsPanel.java,v $
003:         * @modification $Date: 2001/09/28 19:35:30 $
004:         * @version      $Id: ProductStepShortcutsPanel.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.*;
012:
013:        import java.awt.*;
014:        import java.awt.event.*;
015:
016:        import java.io.File;
017:
018:        import javax.swing.*;
019:        import javax.swing.border.*;
020:
021:        /**
022:         * This panel is shown in the product dialog
023:         *
024:         * This is not just a view panel because it has a reference to the
025:         * VAIProductModel.
026:         * 
027:         *
028:         * @see com.memoire.vainstall.builder.gui.VAIProductInternalFrame
029:         * @see javax.swing.JPanel
030:         *
031:         * @author Henrik Falk
032:         * @version $Id: ProductStepShortcutsPanel.java,v 1.1 2001/09/28 19:35:30 hfalk Exp $
033:         */
034:        public class ProductStepShortcutsPanel extends JPanel implements 
035:                FocusListener, ActionListener {
036:
037:            private VAIProductModel model;
038:
039:            private final static Border loweredBorder = new SoftBevelBorder(
040:                    BevelBorder.LOWERED);
041:
042:            JTextField submenuField;
043:            JTextField submenuIconField;
044:            JButton submenuIconButton;
045:
046:            JTextField nameField;
047:            JTextField nameIconField;
048:            JButton nameIconButton;
049:
050:            public ProductStepShortcutsPanel() {
051:
052:                setBorder(loweredBorder);
053:
054:                GridBagLayout layout = new GridBagLayout();
055:                setLayout(layout);
056:
057:                GridBagConstraints contraint = new GridBagConstraints();
058:
059:                /*
060:                 # Link section (sub-menu) name (default="Applications")
061:                 vainstall.destination.linkSectionName=Utilities
062:
063:                 # Link section (sub-menu) icon (default=none)
064:                 vainstall.destination.linkSectionIcon=
065:
066:                 # Link entry (shortcut) name (default=appName)
067:                 vainstall.destination.linkEntryName=
068:
069:                 # Link entry (shortcut) icon (default=none)
070:                 vainstall.destination.linkEntryIcon=
071:                 */
072:                // Description
073:                JLabel decriptionLabel = new JLabel();
074:                decriptionLabel.setBorder(BorderFactory
075:                        .createTitledBorder("Description"));
076:                decriptionLabel
077:                        .setText("This step creates shortcuts for the product.");
078:                contraint.fill = GridBagConstraints.BOTH;
079:                contraint.insets = new Insets(16, 16, 0, 16);
080:                contraint.anchor = GridBagConstraints.WEST;
081:                contraint.gridx = 0;
082:                contraint.gridy = 0;
083:                contraint.gridwidth = 3;
084:                contraint.gridheight = 1;
085:                contraint.weightx = 0;
086:                contraint.weighty = 0;
087:                layout.setConstraints(decriptionLabel, contraint);
088:                add(decriptionLabel);
089:
090:                // Sub-menu Name
091:                JLabel submenuLabel = new JLabel();
092:                submenuLabel.setText("Sub-menu Name:");
093:                contraint.fill = GridBagConstraints.HORIZONTAL;
094:                contraint.insets = new Insets(16, 16, 0, 16);
095:                contraint.anchor = GridBagConstraints.WEST;
096:                contraint.gridx = 0;
097:                contraint.gridy = 1;
098:                contraint.gridwidth = 1;
099:                contraint.gridheight = 1;
100:                contraint.weightx = 0;
101:                contraint.weighty = 0;
102:                layout.setConstraints(submenuLabel, contraint);
103:                add(submenuLabel);
104:
105:                submenuField = new JTextField();
106:                submenuField.setEditable(false);
107:                contraint.fill = GridBagConstraints.HORIZONTAL;
108:                contraint.insets = new Insets(4, 16, 0, 16);
109:                contraint.anchor = GridBagConstraints.WEST;
110:                contraint.gridx = 0;
111:                contraint.gridy = 2;
112:                contraint.gridwidth = 1;
113:                contraint.gridheight = 1;
114:                contraint.weightx = 0;
115:                contraint.weighty = 0;
116:                layout.setConstraints(submenuField, contraint);
117:                add(submenuField);
118:
119:                // Sub-menu Icon
120:                JLabel submenuIconLabel = new JLabel();
121:                submenuIconLabel.setText("Sub-menu Icon:");
122:                contraint.fill = GridBagConstraints.HORIZONTAL;
123:                contraint.insets = new Insets(16, 16, 0, 16);
124:                contraint.anchor = GridBagConstraints.WEST;
125:                contraint.gridx = 0;
126:                contraint.gridy = 3;
127:                contraint.gridwidth = 1;
128:                contraint.gridheight = 1;
129:                contraint.weightx = 0;
130:                contraint.weighty = 0;
131:                layout.setConstraints(submenuIconLabel, contraint);
132:                add(submenuIconLabel);
133:
134:                submenuIconField = new JTextField();
135:                submenuIconField.setEditable(false);
136:                contraint.fill = GridBagConstraints.HORIZONTAL;
137:                contraint.insets = new Insets(4, 16, 0, 16);
138:                contraint.anchor = GridBagConstraints.WEST;
139:                contraint.gridx = 0;
140:                contraint.gridy = 4;
141:                contraint.gridwidth = 2;
142:                contraint.gridheight = 1;
143:                contraint.weightx = 1;
144:                contraint.weighty = 0;
145:                layout.setConstraints(submenuIconField, contraint);
146:                add(submenuIconField);
147:
148:                submenuIconButton = new JButton();
149:                submenuIconButton.setText("Change");
150:                submenuIconButton.setMnemonic('C');
151:                contraint.fill = GridBagConstraints.NONE;
152:                contraint.insets = new Insets(4, 16, 0, 16);
153:                contraint.anchor = GridBagConstraints.WEST;
154:                contraint.gridx = 2;
155:                contraint.gridy = 4;
156:                contraint.gridwidth = 1;
157:                contraint.gridheight = 1;
158:                contraint.weightx = 0;
159:                contraint.weighty = 0;
160:                layout.setConstraints(submenuIconButton, contraint);
161:                add(submenuIconButton);
162:
163:                // Program Name
164:                JLabel nameLabel = new JLabel();
165:                nameLabel.setText("Program Shortcut Name:");
166:                contraint.fill = GridBagConstraints.HORIZONTAL;
167:                contraint.insets = new Insets(16, 16, 0, 16);
168:                contraint.anchor = GridBagConstraints.WEST;
169:                contraint.gridx = 0;
170:                contraint.gridy = 5;
171:                contraint.gridwidth = 1;
172:                contraint.gridheight = 1;
173:                contraint.weightx = 0;
174:                contraint.weighty = 0;
175:                layout.setConstraints(nameLabel, contraint);
176:                add(nameLabel);
177:
178:                nameField = new JTextField();
179:                nameField.setEditable(false);
180:                contraint.fill = GridBagConstraints.HORIZONTAL;
181:                contraint.insets = new Insets(4, 16, 0, 16);
182:                contraint.anchor = GridBagConstraints.WEST;
183:                contraint.gridx = 0;
184:                contraint.gridy = 6;
185:                contraint.gridwidth = 1;
186:                contraint.gridheight = 1;
187:                contraint.weightx = 0;
188:                contraint.weighty = 0;
189:                layout.setConstraints(nameField, contraint);
190:                add(nameField);
191:
192:                // Program Icon
193:                JLabel nameIconLabel = new JLabel();
194:                nameIconLabel.setText("Program Icon:");
195:                contraint.fill = GridBagConstraints.HORIZONTAL;
196:                contraint.insets = new Insets(16, 16, 0, 16);
197:                contraint.anchor = GridBagConstraints.WEST;
198:                contraint.gridx = 0;
199:                contraint.gridy = 7;
200:                contraint.gridwidth = 1;
201:                contraint.gridheight = 1;
202:                contraint.weightx = 0;
203:                contraint.weighty = 0;
204:                layout.setConstraints(nameIconLabel, contraint);
205:                add(nameIconLabel);
206:
207:                nameIconField = new JTextField();
208:                nameIconField.setEditable(false);
209:                contraint.fill = GridBagConstraints.HORIZONTAL;
210:                contraint.insets = new Insets(4, 16, 0, 16);
211:                contraint.anchor = GridBagConstraints.WEST;
212:                contraint.gridx = 0;
213:                contraint.gridy = 8;
214:                contraint.gridwidth = 2;
215:                contraint.gridheight = 1;
216:                contraint.weightx = 0;
217:                contraint.weighty = 0;
218:                layout.setConstraints(nameIconField, contraint);
219:                add(nameIconField);
220:
221:                nameIconButton = new JButton();
222:                nameIconButton.setText("Change");
223:                nameIconButton.setMnemonic('C');
224:                contraint.fill = GridBagConstraints.NONE;
225:                contraint.insets = new Insets(4, 16, 0, 16);
226:                contraint.anchor = GridBagConstraints.WEST;
227:                contraint.gridx = 2;
228:                contraint.gridy = 8;
229:                contraint.gridwidth = 1;
230:                contraint.gridheight = 1;
231:                contraint.weightx = 0;
232:                contraint.weighty = 0;
233:                layout.setConstraints(nameIconButton, contraint);
234:                add(nameIconButton);
235:
236:                JPanel fillPanel = new JPanel();
237:                contraint.fill = GridBagConstraints.BOTH;
238:                contraint.insets = new Insets(4, 4, 4, 4);
239:                contraint.anchor = GridBagConstraints.CENTER;
240:                contraint.gridx = 0;
241:                contraint.gridy = 9;
242:                contraint.gridwidth = 1;
243:                contraint.gridheight = 1;
244:                contraint.weightx = 0;
245:                contraint.weighty = 1;
246:                layout.setConstraints(fillPanel, contraint);
247:                add(fillPanel);
248:
249:            }
250:
251:            /**
252:             * save
253:             */
254:            public void save() {
255:            }
256:
257:            /**
258:             * initialize the panel
259:             */
260:            public void initialize(VAIProductModel model) {
261:                this .model = model;
262:
263:                if (model.getProperty("vainstall.installer.link.section.name") != null) {
264:                    submenuField
265:                            .setText(model
266:                                    .getProperty("vainstall.installer.link.section.name"));
267:                }
268:                submenuField.setEditable(true);
269:                submenuField.addFocusListener(this );
270:
271:                if (model.getProperty("vainstall.installer.link.entry.name") != null) {
272:                    nameField
273:                            .setText(model
274:                                    .getProperty("vainstall.installer.link.entry.name"));
275:                }
276:                nameField.setEditable(true);
277:                nameField.addFocusListener(this );
278:
279:                submenuIconButton.addActionListener(this );
280:                if (model.getProperty("vainstall.installer.link.section.icon") != null) {
281:                    submenuIconField
282:                            .setText(model
283:                                    .getProperty("vainstall.installer.link.section.icon"));
284:                }
285:
286:                nameIconButton.addActionListener(this );
287:                if (model.getProperty("vainstall.installer.link.entry.icon") != null) {
288:                    nameIconField
289:                            .setText(model
290:                                    .getProperty("vainstall.installer.link.entry.icon"));
291:                }
292:
293:            }
294:
295:            /**
296:             * stop
297:             */
298:            public void stop() {
299:            }
300:
301:            public void focusGained(FocusEvent evt) {
302:            }
303:
304:            public void focusLost(FocusEvent evt) {
305:
306:                if (evt.getSource() == submenuField) {
307:                    model.putProperty("vainstall.installer.link.section.name",
308:                            submenuField.getText());
309:                }
310:
311:                if (evt.getSource() == nameField) {
312:                    model.putProperty("vainstall.installer.link.entry.name",
313:                            nameField.getText());
314:                }
315:
316:            }
317:
318:            public void actionPerformed(ActionEvent evt) {
319:
320:                if (evt.getSource() == submenuIconButton) {
321:
322:                    JFileChooser jfc = new JFileChooser();
323:                    jfc.setDialogType(JFileChooser.OPEN_DIALOG);
324:                    jfc.setFileSelectionMode(JFileChooser.FILES_ONLY);
325:
326:                    String rootDirectory = (String) model.getPropertyList()
327:                            .get("vainstall.user.dir");
328:                    if (rootDirectory == null) {
329:                        rootDirectory = System.getProperty("user.dir");
330:                    }
331:
332:                    jfc.setCurrentDirectory(new File(rootDirectory));
333:
334:                    // we allow all files to be valid
335:                    //            jfc.setAcceptAllFileFilterUsed(false);
336:                    //            VAIImageFileFilter filter = new VAIImageFileFilter();
337:                    //            jfc.addChoosableFileFilter(filter);
338:
339:                    int result = jfc.showDialog(null, "Select Image");
340:                    if (result == JFileChooser.APPROVE_OPTION) {
341:                        submenuIconField.setText(jfc.getSelectedFile()
342:                                .getAbsolutePath());
343:
344:                        model.putProperty(
345:                                "vainstall.installer.link.section.icon", jfc
346:                                        .getSelectedFile().getAbsolutePath());
347:
348:                        // use internal method instead of model.putProperty()
349:                        model.getPropertyList().put("vainstall.user.dir",
350:                                jfc.getCurrentDirectory().getAbsolutePath());
351:                    }
352:                }
353:
354:                if (evt.getSource() == nameIconButton) {
355:
356:                    JFileChooser jfc = new JFileChooser();
357:                    jfc.setDialogType(JFileChooser.OPEN_DIALOG);
358:                    jfc.setFileSelectionMode(JFileChooser.FILES_ONLY);
359:
360:                    String rootDirectory = (String) model.getPropertyList()
361:                            .get("vainstall.user.dir");
362:                    if (rootDirectory == null) {
363:                        rootDirectory = System.getProperty("user.dir");
364:                    }
365:
366:                    jfc.setCurrentDirectory(new File(rootDirectory));
367:
368:                    // we allow all files to be valid
369:                    //            jfc.setAcceptAllFileFilterUsed(false);
370:                    //            VAIImageFileFilter filter = new VAIImageFileFilter();
371:                    //            jfc.addChoosableFileFilter(filter);
372:
373:                    int result = jfc.showDialog(null, "Select Image");
374:                    if (result == JFileChooser.APPROVE_OPTION) {
375:                        nameIconField.setText(jfc.getSelectedFile()
376:                                .getAbsolutePath());
377:
378:                        model.putProperty(
379:                                "vainstall.installer.link.entry.icon", jfc
380:                                        .getSelectedFile().getAbsolutePath());
381:
382:                        // use internal method instead of model.putProperty()
383:                        model.getPropertyList().put("vainstall.user.dir",
384:                                jfc.getCurrentDirectory().getAbsolutePath());
385:                    }
386:                }
387:
388:            }
389:
390:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.