Source Code Cross Referenced for TemplateNodePropertyPanel.java in  » J2EE » enhydra-IDE-plugin » org » enhydra » kelp » common » properties » 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 » J2EE » enhydra IDE plugin » org.enhydra.kelp.common.properties 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Enhydra Java Application Server Project
003:         *
004:         * The contents of this file are subject to the Enhydra Public License
005:         * Version 1.1 (the "License"); you may not use this file except in
006:         * compliance with the License. You may obtain a copy of the License on
007:         * the Enhydra web site ( http://www.enhydra.org/ ).
008:         *
009:         * Software distributed under the License is distributed on an "AS IS"
010:         * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
011:         * the License for the specific terms governing rights and limitations
012:         * under the License.
013:         *
014:         * The Initial Developer of the Enhydra Application Server is Lutris
015:         * Technologies, Inc. The Enhydra Application Server and portions created
016:         * by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
017:         * All Rights Reserved.
018:         *
019:         * Contributor(s):
020:         * Paul Mahar
021:         *
022:         */
023:        package org.enhydra.kelp.common.properties;
024:
025:        // ToolBox
026:        import org.enhydra.tool.ToolBoxInfo;
027:        import org.enhydra.tool.common.DataValidationException;
028:        import org.enhydra.tool.common.IconSet;
029:        import org.enhydra.tool.common.PathHandle;
030:        import org.enhydra.tool.common.ToolException;
031:        import org.enhydra.tool.configure.ConfigTool;
032:
033:        // AddinCore
034:        import org.enhydra.kelp.common.Backward;
035:        import org.enhydra.kelp.common.PathUtil;
036:        import org.enhydra.kelp.common.node.OtterTemplateNode;
037:        import org.enhydra.kelp.common.node.OtterNode;
038:        import org.enhydra.kelp.common.node.OtterProject;
039:        import org.enhydra.kelp.common.event.SwingTableSelectionEvent;
040:        import org.enhydra.kelp.common.event.SwingTableSelectionListener;
041:        import org.enhydra.kelp.common.deployer.ReplacementTablePanel;
042:        import org.enhydra.kelp.common.swing.AddinInnerPanel;
043:
044:        // JDK
045:        import java.awt.*;
046:        import java.awt.event.ActionEvent;
047:        import java.awt.event.ActionListener;
048:        import java.awt.event.ItemEvent;
049:        import java.awt.event.ItemListener;
050:        import java.beans.*;
051:        import java.io.File;
052:        import java.util.ResourceBundle;
053:        import javax.swing.*;
054:        import javax.swing.border.TitledBorder;
055:
056:        //
057:        public class TemplateNodePropertyPanel extends AddinInnerPanel {
058:            static ResourceBundle res = ResourceBundle
059:                    .getBundle("org.enhydra.kelp.common.Res"); // nores
060:            private LocalRadioListener radioListener = null;
061:            private GridBagLayout layoutMain;
062:            private JCheckBox checkOutput;
063:            private JCheckBox checkOverwrite;
064:            private ReplacementTablePanel table;
065:            private JCheckBox checkBootstrap;
066:            private JPanel panelDeploy;
067:            private JRadioButton radioFilter;
068:            private JRadioButton radioAll;
069:            private GridBagLayout layoutDeploy;
070:
071:            public TemplateNodePropertyPanel() {
072:                try {
073:                    jbInit();
074:                    pmInit();
075:                } catch (Exception e) {
076:                    e.printStackTrace();
077:                }
078:            }
079:
080:            public synchronized void addSwingTableSelectionListener(
081:                    SwingTableSelectionListener l) {
082:                table.addSwingTableSelectionListener(l);
083:            }
084:
085:            public synchronized void removeSwingTableSelectionListener(
086:                    SwingTableSelectionListener l) {
087:                table.removeSwingTableSelectionListener(l);
088:            }
089:
090:            public void setIconView(boolean b) {
091:                table.setIconView(b);
092:            }
093:
094:            public boolean isIconView() {
095:                return table.isIconView();
096:            }
097:
098:            // override AddinCoreNode
099:            public void read(OtterNode node) {
100:                super .read(node);
101:                String stringIn = null;
102:                File fileIn = null;
103:                PathHandle phBoot = null;
104:                OtterProject project = null;
105:
106:                table.setNode(node);
107:                project = getProject();
108:                phBoot = PathHandle.createPathHandle(project
109:                        .getDeployBootstrapPath());
110:                if (node instanceof  OtterTemplateNode) {
111:                    OtterTemplateNode template = (OtterTemplateNode) node;
112:
113:                    panelDeploy.setVisible(false);
114:                    checkOutput.setSelected(template.isSelected());
115:                    if (phBoot.equals(template.getOutputPath())) {
116:                        checkBootstrap.setSelected(true);
117:                    } else {
118:                        checkBootstrap.setSelected(false);
119:                    }
120:                    remove(panelDeploy);
121:                    enableUI(checkOutput.isSelected());
122:                } else {
123:                    panelDeploy.setVisible(true);
124:                    checkOutput.setVisible(false);
125:                    checkBootstrap.setVisible(false);
126:                    remove(checkOutput);
127:                    remove(checkBootstrap);
128:                    readFilter();
129:                    enableUI(true);
130:                }
131:                checkOverwrite.setSelected(project.isDeployOverwrite());
132:                table.readProperties();
133:                invalidate();
134:            }
135:
136:            // override AddinCoreNode
137:            public void write(OtterNode node) throws DataValidationException {
138:                super .write(node);
139:                OtterProject project = getProject();
140:
141:                if (node instanceof  OtterTemplateNode) {
142:                    OtterTemplateNode template = (OtterTemplateNode) node;
143:
144:                    template.setSelected(checkOutput.isSelected());
145:                    if (checkBootstrap.isSelected()) {
146:                        project
147:                                .setDeployBootstrapPath(template
148:                                        .getOutputPath());
149:                    }
150:                } else {
151:                    if (radioFilter.isEnabled()) {
152:                        project.setDeployInputFilter(radioFilter.isSelected());
153:                    }
154:                }
155:                project.setDeployOverwrite(checkOverwrite.isSelected());
156:                table.writeProperties();
157:            }
158:
159:            // override AddinInnerPanel
160:            public Component[] getFirstFocusComponents() {
161:                Component[] comps = new Component[7];
162:
163:                comps[0] = checkOutput;
164:                comps[1] = checkOverwrite;
165:                comps[2] = table;
166:                comps[3] = checkBootstrap;
167:                comps[4] = panelDeploy;
168:                comps[5] = radioFilter;
169:                comps[6] = radioAll;
170:                return comps;
171:            }
172:
173:            //
174:            //
175:            protected void readFilter() {
176:                boolean inFilter = false;
177:
178:                inFilter = PathUtil.isInputInSource(getProject());
179:                if (inFilter) {
180:                    radioAll.setEnabled(false);
181:                    radioFilter.setEnabled(false);
182:                } else {
183:                    radioAll.setEnabled(true);
184:                    radioFilter.setEnabled(true);
185:                    inFilter = getProject().isDeployInputFilter();
186:                }
187:                if (inFilter) {
188:                    radioAll.setSelected(false);
189:                    radioFilter.setSelected(true);
190:                } else {
191:                    radioAll.setSelected(true);
192:                    radioFilter.setSelected(false);
193:                }
194:                updateUI();
195:            }
196:
197:            //
198:            //
199:            private void refreshSelections() {
200:                getProject().setDeployInputFilter(radioFilter.isSelected());
201:            }
202:
203:            private void enableUI(boolean enable) {
204:                checkOverwrite.setEnabled(enable);
205:                checkBootstrap.setEnabled(enable);
206:                table.enableUI(enable);
207:            }
208:
209:            private void pmInit() throws Exception {
210:                ButtonGroup group = null;
211:
212:                group = new ButtonGroup();
213:                group.add(radioAll);
214:                group.add(radioFilter);
215:                radioListener = new LocalRadioListener();
216:                radioAll.addItemListener(radioListener);
217:                radioFilter.addItemListener(radioListener);
218:                setIconView(false);
219:            }
220:
221:            private void jbInit() throws Exception {
222:                checkOutput = (JCheckBox) Beans.instantiate(getClass()
223:                        .getClassLoader(), JCheckBox.class.getName());
224:                checkOverwrite = (JCheckBox) Beans.instantiate(getClass()
225:                        .getClassLoader(), JCheckBox.class.getName());
226:                checkBootstrap = (JCheckBox) Beans.instantiate(getClass()
227:                        .getClassLoader(), JCheckBox.class.getName());
228:                layoutMain = (GridBagLayout) Beans.instantiate(getClass()
229:                        .getClassLoader(), GridBagLayout.class.getName());
230:                table = (ReplacementTablePanel) Beans.instantiate(getClass()
231:                        .getClassLoader(), ReplacementTablePanel.class
232:                        .getName());
233:                panelDeploy = (JPanel) Beans.instantiate(getClass()
234:                        .getClassLoader(), JPanel.class.getName());
235:                radioFilter = (JRadioButton) Beans.instantiate(getClass()
236:                        .getClassLoader(), JRadioButton.class.getName());
237:                radioAll = (JRadioButton) Beans.instantiate(getClass()
238:                        .getClassLoader(), JRadioButton.class.getName());
239:                layoutDeploy = (GridBagLayout) Beans.instantiate(getClass()
240:                        .getClassLoader(), GridBagLayout.class.getName());
241:                checkOutput.setText(res.getString("Deploy"));
242:                checkOutput
243:                        .addActionListener(new java.awt.event.ActionListener() {
244:                            public void actionPerformed(ActionEvent e) {
245:                                enableUI(checkOutput.isSelected());
246:                            }
247:
248:                        });
249:                checkOverwrite.setText(res.getString("checkOverwrite_Text"));
250:                checkBootstrap.setText(res.getString("checkBootstrap_Text"));
251:                radioFilter.setText(res.getString("radioFilter_Text"));
252:                radioAll.setSelected(true);
253:                radioAll.setText(res.getString("radioAll_Text"));
254:
255:                //
256:                //
257:                panelDeploy.setBorder(BorderFactory.createTitledBorder(res
258:                        .getString("panelDeploy_Border")));
259:                panelDeploy.setLayout(layoutDeploy);
260:                panelDeploy.add(radioFilter, new GridBagConstraints(1, 0, 1, 1,
261:                        0.1, 0.0, GridBagConstraints.CENTER,
262:                        GridBagConstraints.HORIZONTAL, new Insets(1, 5, 1, 10),
263:                        10, 0));
264:                panelDeploy.add(radioAll, new GridBagConstraints(0, 0, 1, 1,
265:                        0.1, 0.0, GridBagConstraints.CENTER,
266:                        GridBagConstraints.HORIZONTAL, new Insets(1, 10, 1, 5),
267:                        10, 0));
268:                table.setBorder(BorderFactory
269:                        .createTitledBorder("Template Replacements"));
270:
271:                //
272:                this .setLayout(layoutMain);
273:                this .add(checkOutput, new GridBagConstraints(0, 0, 1, 1, 0.1,
274:                        0.1, GridBagConstraints.WEST,
275:                        GridBagConstraints.HORIZONTAL, new Insets(10, 5, 5, 5),
276:                        0, 0));
277:                this .add(checkOverwrite, new GridBagConstraints(0, 1, 1, 1,
278:                        0.1, 0.1, GridBagConstraints.WEST,
279:                        GridBagConstraints.HORIZONTAL, new Insets(3, 20, 2, 5),
280:                        0, 0));
281:                this 
282:                        .add(panelDeploy, new GridBagConstraints(0, 2, 1, 1,
283:                                0.1, 0.1, GridBagConstraints.CENTER,
284:                                GridBagConstraints.BOTH,
285:                                new Insets(4, 15, 4, 5), 0, 1));
286:                this .add(checkBootstrap, new GridBagConstraints(0, 3, 1, 1,
287:                        0.1, 0.1, GridBagConstraints.WEST,
288:                        GridBagConstraints.HORIZONTAL, new Insets(2, 20, 3, 5),
289:                        0, 0));
290:                this .add(table, new GridBagConstraints(0, 4, 1, 1, 0.4, 0.1,
291:                        GridBagConstraints.CENTER, GridBagConstraints.BOTH,
292:                        new Insets(3, 15, 3, 5), 10, 20));
293:            }
294:
295:            //
296:            private class LocalRadioListener implements  ItemListener {
297:                public void itemStateChanged(ItemEvent e) {
298:                    if (e.getStateChange() == ItemEvent.SELECTED) {
299:                        refreshSelections();
300:                    }
301:                }
302:
303:            }
304:
305:            //
306:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.