Source Code Cross Referenced for PanelProxy.java in  » IDE-Netbeans » xml » org » netbeans » modules » xslt » project » wizard » element » 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 » IDE Netbeans » xml » org.netbeans.modules.xslt.project.wizard.element 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003:         *
004:         * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005:         *
006:         * The contents of this file are subject to the terms of either the GNU
007:         * General Public License Version 2 only ("GPL") or the Common
008:         * Development and Distribution License("CDDL") (collectively, the
009:         * "License"). You may not use this file except in compliance with the
010:         * License. You can obtain a copy of the License at
011:         * http://www.netbeans.org/cddl-gplv2.html
012:         * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013:         * specific language governing permissions and limitations under the
014:         * License.  When distributing the software, include this License Header
015:         * Notice in each file and include the License file at
016:         * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
017:         * particular file as subject to the "Classpath" exception as provided
018:         * by Sun in the GPL Version 2 section of the License file that
019:         * accompanied this code. If applicable, add the following below the
020:         * License Header, with the fields enclosed by brackets [] replaced by
021:         * your own identifying information:
022:         * "Portions Copyrighted [year] [name of copyright owner]"
023:         *
024:         * Contributor(s):
025:         *
026:         * The Original Software is NetBeans. The Initial Developer of the Original
027:         * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
028:         * Microsystems, Inc. All Rights Reserved.
029:         *
030:         * If you wish your version of this file to be governed by only the CDDL
031:         * or only the GPL Version 2, indicate your decision by adding
032:         * "[Contributor] elects to include this software in this distribution
033:         * under the [CDDL or GPL Version 2] license." If you do not indicate a
034:         * single choice of license, a recipient has the option to distribute
035:         * your version of this file under either the CDDL, the GPL Version 2 or
036:         * to extend the choice of license to its licensees as provided above.
037:         * However, if you add GPL Version 2 code and therefore, elected the GPL
038:         * Version 2 license, then the option applies only if the new code is
039:         * made subject to such option by the copyright holder.
040:         */
041:        package org.netbeans.modules.xslt.project.wizard.element;
042:
043:        import java.awt.GridBagConstraints;
044:        import java.awt.GridBagLayout;
045:        import java.awt.Insets;
046:        import java.awt.event.ActionEvent;
047:        import java.io.File;
048:
049:        import javax.swing.JButton;
050:        import javax.swing.JCheckBox;
051:        import javax.swing.JFileChooser;
052:        import javax.swing.JLabel;
053:        import javax.swing.JPanel;
054:        import javax.swing.JTextField;
055:
056:        import org.openide.WizardDescriptor;
057:        import org.openide.filesystems.FileObject;
058:
059:        import org.netbeans.api.project.Project;
060:        import org.netbeans.modules.xml.wsdl.model.Operation;
061:        import org.netbeans.modules.xml.wsdl.model.WSDLModel;
062:        import org.openide.filesystems.FileUtil;
063:        import static org.netbeans.modules.soa.ui.util.UI.*;
064:
065:        /**
066:         * @author Vladimir Yaroslavskiy
067:         * @version 2007.02.01
068:         */
069:        final class PanelProxy<T> extends Panel<T> {
070:
071:            PanelProxy(Project project, Panel<T> parent,
072:                    WSDLModel modelImplement, WSDLModel modelCall) {
073:                super (project, parent);
074:                myOperationImplement = new PanelOperation<T>(project, this ,
075:                        modelImplement, null, true, true);
076:
077:                myOperationCall = new PanelOperation<T>(project, this ,
078:                        modelCall, null, true, false);
079:            }
080:
081:            @Override
082:            protected String getComponentName() {
083:                return NAME_XSLT;
084:            }
085:
086:            @Override
087:            protected String getError() {
088:                String name = addExtension(myReplyFile.getText().trim());
089:                if (!PanelUtil.isValidFileName(name)) {
090:                    return i18n("ERR_WrongFileName", name); // NOI18N
091:                }
092:                FileObject file = getFolder().getFileObject(name);
093:
094:                if (file != null) {
095:                    return i18n("ERR_File_Already_Exists", name); // NOI18N
096:                }
097:
098:                name = addExtension(myRequestFile.getText().trim());
099:                if (myReplyBox.isSelected() && !PanelUtil.isValidFileName(name)) {
100:                    return i18n("ERR_WrongFileName", name); // NOI18N
101:                }
102:
103:                file = getFolder().getFileObject(name);
104:
105:                if (file != null) {
106:                    return i18n("ERR_File_Already_Exists", name); // NOI18N
107:                }
108:                return getError(myOperationImplement.getError(),
109:                        myOperationCall.getError());
110:            }
111:
112:            public void storeSettings(Object object) {
113:                WizardDescriptor descriptor = (WizardDescriptor) object;
114:                myOperationImplement.storeSettings(object);
115:                myOperationCall.storeSettings(object);
116:
117:                descriptor.putProperty(INPUT_FILE, addExtension(myRequestFile
118:                        .getText().trim()));
119:
120:                descriptor.putProperty(OUTPUT_FILE, addExtension(myReplyFile
121:                        .getText().trim()));
122:
123:                if (myReplyBox.isSelected()) {
124:                    descriptor.putProperty(CHOICE, CHOICE_FILTER_REQUEST_REPLY);
125:                } else {
126:                    descriptor.putProperty(CHOICE, CHOICE_FILTER_ONE_WAY);
127:                }
128:            }
129:
130:            @Override
131:            protected void createPanel(JPanel mainPanel, GridBagConstraints cc) {
132:                JPanel panel = new JPanel(new GridBagLayout());
133:                GridBagConstraints c = new GridBagConstraints();
134:                c.anchor = GridBagConstraints.WEST;
135:                c.anchor = GridBagConstraints.NORTHWEST;
136:                c.fill = GridBagConstraints.HORIZONTAL;
137:                c.weightx = 1.0;
138:                c.gridx = 0;
139:
140:                // we implement
141:                panel.add(createSeparator(i18n("LBL_We_Implement")), c); // NOI18N
142:                myOperationImplement.createPanel(panel, c);
143:
144:                // we call
145:                panel.add(createSeparator(i18n("LBL_We_Call")), c); // NOI18N
146:                myOperationCall.createPanel(panel, c);
147:
148:                int number1 = getXslFileNumber(1);
149:                int number2 = getXslFileNumber(number1 + 1);
150:
151:                // transform request
152:                panel.add(createTransformRequestPanel(getXslFileName(number1)),
153:                        c);
154:
155:                // transform reply
156:                panel
157:                        .add(
158:                                createTransformReplyPanel(getXslFileName(number2)),
159:                                c);
160:
161:                update();
162:                mainPanel.add(panel, cc);
163:                mainPanel.getAccessibleContext().setAccessibleDescription(
164:                        i18n("ACSD_LBL_NewBridgeService3"));
165:            }
166:
167:            @Override
168:            protected void update() {
169:                if (myRequestBox == null || myReplyBox == null) {
170:                    return;
171:                }
172:                myOperationImplement.setEnabled(myRequestBox.isSelected());
173:                myOperationCall.setEnabled(myReplyBox.isSelected());
174:
175:                myRequestFile.setEnabled(myRequestBox.isSelected());
176:                myRequestFileBrowseButton.setEnabled(myRequestBox.isSelected());
177:
178:                myReplyFile.setEnabled(myReplyBox.isSelected());
179:                myReplyFileBrowseButton.setEnabled(myReplyBox.isSelected());
180:
181:                myOperationImplement.setRequirement(myRequestBox.isSelected(),
182:                        myReplyBox.isSelected());
183:
184:                myOperationCall.setRequirement(myRequestBox.isSelected(),
185:                        myReplyBox.isSelected());
186:
187:                updateText(myRequestText, true,
188:                        (Operation) myOperationImplement.getResult(),
189:                        (Operation) myOperationCall.getResult());
190:
191:                updateText(myReplyText, false, (Operation) myOperationCall
192:                        .getResult(), (Operation) myOperationImplement
193:                        .getResult());
194:            }
195:
196:            private void updateText(JTextField text, boolean isInput,
197:                    Operation operation1, Operation operation2) {
198:                updateText(text, getType(operation1, isInput), getType(
199:                        operation2, isInput));
200:            }
201:
202:            private void updateText(JTextField text, String text1, String text2) {
203:                text.setText(i18n("LBL_From_To", text1, text2)); // NOI18N
204:            }
205:
206:            private String getType(Operation operation, boolean isInput) {
207:                if (operation == null) {
208:                    return EMPTY;
209:                }
210:                if (isInput) {
211:                    return getType(operation.getInput());
212:                } else {
213:                    return getType(operation.getOutput());
214:                }
215:            }
216:
217:            private JPanel createTransformRequestPanel(String fileName) {
218:                myRequestBox = createCheckBox(new ButtonAction(
219:                        i18n("LBL_Transform_Request")) { // NOI18N
220:                    public void actionPerformed(ActionEvent event) {
221:                        update();
222:                    }
223:                });
224:                myRequestBox.setEnabled(false);
225:                myRequestBox.setSelected(true);
226:
227:                myRequestText = new JTextField();
228:                a11y(myRequestText, "ACSN_LBL_Transform_Request",
229:                        "ACSD_LBL_Transform_Request"); // NOI18N
230:                myRequestFile = new JTextField(fileName);
231:                myRequestFileBrowseButton = createBrowseButton(myRequestFile);
232:
233:                return createTransformPanel(myRequestBox, myRequestText,
234:                        myRequestFile, myRequestFileBrowseButton);
235:            }
236:
237:            private JPanel createTransformReplyPanel(String fileName) {
238:                myReplyBox = createCheckBox(new ButtonAction(
239:                        i18n("LBL_Transform_Reply")) { // NOI18N
240:                    public void actionPerformed(ActionEvent event) {
241:                        update();
242:                    }
243:                });
244:                a11y(myReplyBox, "ACSN_LBL_Transform_Reply",
245:                        "ACSD_LBL_Transform_Reply"); // NOI18N
246:                myReplyBox.setEnabled(true);
247:                myReplyBox.setSelected(false);
248:
249:                myReplyText = new JTextField();
250:                a11y(myReplyText, "ACSN_LBL_Transform_Reply",
251:                        "ACSD_LBL_Transform_Reply"); // NOI18N
252:                myReplyFile = new JTextField(fileName);
253:                myReplyFileBrowseButton = createBrowseButton(myReplyFile,
254:                        "LBL_Browse2");
255:
256:                return createTransformPanel(myReplyBox, myReplyText,
257:                        myReplyFile, myReplyFileBrowseButton);
258:            }
259:
260:            private JPanel createTransformPanel(JCheckBox checkBox,
261:                    JTextField text, JTextField file, JButton browseButton) {
262:                JPanel panel = new JPanel(new GridBagLayout());
263:                GridBagConstraints c = new GridBagConstraints();
264:                c.anchor = GridBagConstraints.WEST;
265:
266:                // check
267:                c.gridy++;
268:                c.gridwidth = 2;
269:                c.insets = new Insets(SMALL_INSET, 0, 0, 0);
270:                panel.add(checkBox, c);
271:
272:                // text
273:                c.gridwidth = GridBagConstraints.REMAINDER;
274:                c.insets = new Insets(SMALL_INSET, SMALL_INSET, TINY_INSET, 0);
275:                c.fill = GridBagConstraints.HORIZONTAL;
276:                c.weightx = 1.0;
277:                text.setEnabled(false);
278:                panel.add(text, c);
279:
280:                // label
281:                c.gridy++;
282:                c.gridwidth = 2;
283:                c.anchor = GridBagConstraints.EAST;
284:                c.insets = new Insets(SMALL_INSET, MEDIUM_INSET + SMALL_INSET
285:                        + TINY_INSET + TINY_INSET, TINY_INSET, SMALL_INSET);
286:                c.fill = GridBagConstraints.NONE;
287:                c.weightx = 0.0;
288:                JLabel label = createLabel(i18n(getNextXslFileLabel()));
289:                a11y(label, "ACSN_LBL_XSL_File", "ACSD_LBL_XSL_File"); // NOI18N
290:                label.setLabelFor(file);
291:                panel.add(label, c); // NOI18N
292:
293:                // file
294:                c.gridwidth = 1;
295:                c.fill = GridBagConstraints.HORIZONTAL;
296:                c.weightx = 1.0;
297:                c.anchor = GridBagConstraints.WEST;
298:                c.insets = new Insets(SMALL_INSET, SMALL_INSET, TINY_INSET, 0);
299:                panel.add(file, c);
300:
301:                c.weightx = 0.0;
302:                c.insets = new Insets(TINY_INSET, SMALL_INSET, TINY_INSET, 0);
303:                panel.add(browseButton, c);
304:
305:                return panel;
306:            }
307:
308:            private String getNextXslFileLabel() {
309:                myXslFileUsagesCounter++;
310:                return myXslFileUsagesCounter > 1 ? "LBL_XSL_File3"
311:                        : "LBL_XSL_File"; // NOI18N
312:            }
313:
314:            private int myXslFileUsagesCounter = 0;
315:            private PanelOperation<T> myOperationImplement;
316:            private PanelOperation<T> myOperationCall;
317:            private JCheckBox myRequestBox;
318:            private JCheckBox myReplyBox;
319:            private JTextField myRequestText;
320:            private JTextField myReplyText;
321:            private JButton myReplyFileBrowseButton;
322:            private JTextField myRequestFile;
323:            private JButton myRequestFileBrowseButton;
324:            private JTextField myReplyFile;
325:        }
ww__w.__j___a___va2__s__.co__m_ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.