Source Code Cross Referenced for SRAManage.java in  » Portal » Open-Portal » com » sun » portal » instance » sra » panel » 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 » Portal » Open Portal » com.sun.portal.instance.sra.panel 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
003:         * PROPRIETARY/CONFIDENTIAL.  Use of this product is subject to license terms.
004:         */
005:
006:        package com.sun.portal.instance.sra.panel;
007:
008:        //
009:
010:        import com.sun.portal.config.context.DebugContext;
011:        import com.sun.portal.config.context.IdentityPropertyContext;
012:        import com.sun.portal.config.context.SRAFileContext;
013:        import com.sun.portal.config.context.SRAPropertyContext;
014:        import com.sun.portal.instance.common.listener.ButtonClickHandler;
015:        import com.sun.portal.instance.common.listener.ButtonListener;
016:        import com.sun.portal.instance.common.listener.ChoiceListener;
017:        import com.sun.portal.instance.common.listener.TextFieldListener;
018:        import com.sun.portal.instance.common.ui.HeaderPanel;
019:        import com.sun.portal.instance.sra.common.SRAWSWHelper;
020:        import com.sun.setup.util.wbResource;
021:        import com.sun.wizards.core.Route;
022:        import com.sun.wizards.core.WizardState;
023:        import com.sun.wizards.core.WizardTreeManager;
024:
025:        import java.awt.*;
026:        import java.io.DataInput;
027:        import java.io.DataOutput;
028:        import java.util.Vector;
029:
030:        //
031:
032:        public class SRAManage extends Base implements  ButtonClickHandler {
033:            //
034:            //
035:            //
036:            private transient ButtonListener listenerButton = new ButtonListener(
037:                    this );
038:            private transient ChoiceListener listenerChoice = null;
039:            private transient TextFieldListener listenerTextField = null;
040:
041:            private static final String GUI_MANAGE_INSTANCE_TITLE = DASH_GUI
042:                    + "-ManageInstance-Title";
043:            private static final String GUI_MANAGE_INSTANCE_PROMPT = DASH_GUI
044:                    + "-ManageInstance-Prompt";
045:            private static final String GUI_BUTTON_PROPERTIES = DASH_GUI
046:                    + "-ManageInstance-Button-Properties";
047:            private static final String GUI_BUTTON_MODIFY = DASH_GUI
048:                    + "-ManageInstance-Button-Modify";
049:            private static final String GUI_BUTTON_DELETE = DASH_GUI
050:                    + "-ManageInstance-Button-Delete";
051:
052:            private static final String GUI_CREATE_INSTANCE_TITLE = DASH_GUI
053:                    + "-CreateInstance-Title";
054:            private static final String GUI_CREATE_INSTANCE_PROMPT = DASH_GUI
055:                    + "-CreateInstance-Prompt";
056:            private static final String GUI_BUTTON_CREATE = DASH_GUI
057:                    + "-CreateInstance-Button-Create";
058:
059:            private static final String GUI_ERROR_DIALOG_TITLE = DASH_GUI
060:                    + "-Error-Dialog-Title";
061:            private static final String GUI_ERROR_INSTANCE_NAME_EMPTY = DASH_GUI
062:                    + "-Error-Instance-Name-Empty";
063:            private static final String GUI_ERROR_INSTANCE_NAME_DUPLICATE = DASH_GUI
064:                    + "-Error-Instance-Name-Duplicate";
065:
066:            //
067:            //
068:            //
069:            public SRAManage() {
070:            }
071:
072:            public SRAManage(WizardState wizardState, String name) {
073:                super (wizardState, name);
074:            }
075:
076:            public SRAManage(String name, Route route,
077:                    WizardTreeManager wizardManager) {
078:                super (name, route, wizardManager);
079:            }
080:
081:            //
082:            //
083:            //
084:            private Choice makeupManageInstancesChoice(String[] instances) {
085:                Choice choice = new Choice();
086:                for (int i = 0; i < instances.length; i++)
087:                    choice.add(instances[i]);
088:
089:                if (instances.length > 0) {
090:                    String defaultChoice = null;
091:
092:                    if (SRAWSWHelper.getWSWInstanceName(getWizardState()) == null) {
093:                        defaultChoice = instances[0];
094:                    } else {
095:                        defaultChoice = SRAWSWHelper
096:                                .getWSWInstanceName(getWizardState());
097:                    }
098:
099:                    DebugContext.message(getName() + ": Setting <"
100:                            + defaultChoice + "> as default Choice");
101:                    if (defaultChoice != null)
102:                        choice.select(defaultChoice);
103:                    listenerChoice = new ChoiceListener(defaultChoice);
104:                    choice.addItemListener(listenerChoice);
105:                }
106:
107:                return choice;
108:            }
109:
110:            private void makeup(Panel p, String[] instances) {
111:                //
112:                GridBagConstraints gbc = new GridBagConstraints();
113:                gbc.insets = getDefaultInsets();
114:
115:                // row
116:                HeaderPanel header = new HeaderPanel();
117:                header.add(makeLabel(getName() + GUI_MANAGE_INSTANCE_TITLE));
118:
119:                gbc.fill = GridBagConstraints.HORIZONTAL;
120:                gbc.gridwidth = GridBagConstraints.REMAINDER;
121:                p.add(header, gbc);
122:
123:                // row
124:                gbc.anchor = GridBagConstraints.NORTHEAST;
125:                gbc.fill = GridBagConstraints.NONE; // reset
126:                gbc.gridheight = 2;
127:                gbc.gridwidth = 1; // reset
128:                p.add(makeLabel(getName() + GUI_MANAGE_INSTANCE_PROMPT), gbc);
129:
130:                Choice whichInstance = makeupManageInstancesChoice(instances);
131:                gbc.anchor = GridBagConstraints.WEST;
132:                gbc.gridheight = 1; // reset
133:                gbc.gridwidth = GridBagConstraints.REMAINDER;
134:                p.add(whichInstance, gbc);
135:
136:                Button properties = new Button(wbResource.getString(getName()
137:                        + GUI_BUTTON_PROPERTIES));
138:                properties.addActionListener(listenerButton);
139:                Button modify = new Button(wbResource.getString(getName()
140:                        + GUI_BUTTON_MODIFY));
141:                modify.addActionListener(listenerButton);
142:                Button delete = new Button(wbResource.getString(getName()
143:                        + GUI_BUTTON_DELETE));
144:                delete.addActionListener(listenerButton);
145:
146:                gbc.anchor = GridBagConstraints.NORTH;
147:                gbc.gridwidth = 1; // reset
148:                p.add(properties, gbc);
149:                p.add(modify, gbc);
150:
151:                gbc.anchor = GridBagConstraints.WEST;
152:                gbc.gridwidth = GridBagConstraints.REMAINDER;
153:                p.add(delete, gbc);
154:
155:                // row
156:                header = new HeaderPanel();
157:                header.add(makeLabel(getName() + GUI_CREATE_INSTANCE_TITLE));
158:
159:                gbc.fill = GridBagConstraints.HORIZONTAL;
160:                gbc.gridwidth = GridBagConstraints.REMAINDER;
161:                gbc.insets = new Insets(30 * DEFAULT_INSETS_TOP,
162:                        DEFAULT_INSETS_LEFT, DEFAULT_INSETS_BOTTOM,
163:                        DEFAULT_INSETS_RIGHT);
164:                p.add(header, gbc);
165:
166:                // row
167:                gbc.anchor = GridBagConstraints.EAST;
168:                gbc.fill = GridBagConstraints.NONE; // reset
169:                gbc.gridwidth = 1; // reset
170:                gbc.insets = getDefaultInsets(); // reset
171:                p.add(makeLabel(getName() + GUI_CREATE_INSTANCE_PROMPT), gbc);
172:
173:                TextField tf = new TextField(DEFAULT_EDIT_COLUMNS);
174:                listenerTextField = new TextFieldListener(EMPTY_STRING);
175:                tf.addActionListener(listenerTextField);
176:                tf.addFocusListener(listenerTextField);
177:                tf.addTextListener(listenerTextField);
178:
179:                gbc.anchor = GridBagConstraints.WEST;
180:                gbc.gridwidth = GridBagConstraints.REMAINDER;
181:                p.add(tf, gbc);
182:
183:                // row
184:                Button create = new Button(wbResource.getString(getName()
185:                        + GUI_BUTTON_CREATE));
186:                create.addActionListener(listenerButton);
187:
188:                gbc.anchor = GridBagConstraints.EAST;
189:                p.add(create, gbc);
190:            }
191:
192:            private void makeup(Panel p) {
193:                p.setLayout(new GridBagLayout());
194:
195:                if (getInstallLocation() == null) {
196:                    makeupError(p, GUI_ERROR, GUI_ERROR_INSTALL_LOCATION);
197:                } else {
198:                    String[] instanceNames = getInstanceNames();
199:                    if (instanceNames == null) {
200:                        makeupError(p, GUI_ERROR, GUI_ERROR_NOT_INSTALLED);
201:                    } else {
202:                        SRAWSWHelper.setWSWCanBeConfigured(getWizardState(),
203:                                Boolean.TRUE);
204:                        makeup(p, instanceNames);
205:                    }
206:                }
207:            }
208:
209:            protected void cleanup() {
210:                super .cleanup();
211:                wswCleanup();
212:            }
213:
214:            //
215:            //
216:            //
217:            public void createUI() {
218:                DebugContext.message(getName() + ": createUI: Entry");
219:                super .createUI();
220:
221:                main = new Panel(new FlowLayout(FlowLayout.CENTER,
222:                        DEFAULT_HORIZONTAL_GAP, DEFAULT_VERTICAL_GAP));
223:                child = new Panel();
224:                DebugContext.message(getName() + ": createUI: Exit");
225:            }
226:
227:            public void beginDisplay() {
228:                DebugContext.message(getName() + ": beginDisplay: Entry");
229:                super .beginDisplay();
230:
231:                if (getTreeManager().hasGUI()) {
232:                    cleanup();
233:
234:                    makeup(child);
235:                    main.add(child);
236:
237:                    add(main);
238:                }
239:
240:                DebugContext.message(getName() + ": beginDisplay: Exit");
241:            }
242:
243:            public boolean isDisplayComplete() {
244:                DebugContext.message(getName() + ": isDisplayComplete: Entry");
245:                boolean isDisplayComplete = doGoAhead();
246:
247:                //
248:                if (isDisplayComplete)
249:                    isDisplayComplete = doAllowNextPress();
250:
251:                //
252:                if (isDisplayComplete) {
253:                    setDefaultActionIfRequired();
254:                    setInstanceNameIfRequired();
255:                }
256:
257:                //
258:                if (isDisplayComplete) {
259:                    // Set working copies of configuration properties.
260:                    IdentityPropertyContext ipc = getIdentityPropertyContext();
261:                    SRAPropertyContext spc = getSRAPropertyContext();
262:                    SRAFileContext sfc = getSRAFileContext();
263:
264:                    spc.setInstanceName(SRAWSWHelper
265:                            .getWSWInstanceName(getWizardState()));
266:                    SRAWSWHelper.setWSWIdentityPropertyContext(
267:                            getWizardState(), ipc);
268:                    SRAWSWHelper
269:                            .setWSWSRAPropertyContext(getWizardState(), spc);
270:                    SRAWSWHelper.setWSWSRAFileContext(getWizardState(), sfc);
271:                }
272:
273:                DebugContext.message(getName()
274:                        + ": isDisplayComplete: Exit; returning <"
275:                        + isDisplayComplete + ">");
276:                return isDisplayComplete;
277:            }
278:
279:            public boolean skip() {
280:                DebugContext.message(getName() + ": skip: Entry");
281:                boolean skip = super .skip();
282:                super .initializeRuntime();
283:
284:                DebugContext.message(getName() + ": skip: Exit; returning <"
285:                        + skip + ">");
286:                return skip;
287:            }
288:
289:            public void consoleInteraction() {
290:            }
291:
292:            //
293:            //
294:            //
295:            public String getHelp(Object context) {
296:                Object[] msgArgs = { getProductName() };
297:                return wbResource.getString(getName() + "-Gui-OnlineHelp",
298:                        msgArgs);
299:            }
300:
301:            public void serialize(DataOutput out) {
302:                super .serialize(out);
303:            }
304:
305:            public void deserialize(DataInput in) {
306:                super .deserialize(in);
307:            }
308:
309:            public void addRuntimeResources(Vector v) {
310:                super .addRuntimeResources(v);
311:
312:                v.addElement("com.sun.portal.instance.sra.panel.SRAManage");
313:            }
314:
315:            //
316:            //
317:            //
318:            private boolean doGoAhead() {
319:                return canProceedToManage();
320:            }
321:
322:            private String getSelectedInstance() {
323:                return listenerChoice.getSelectedItem();
324:            }
325:
326:            private boolean isInstanceSpecified() {
327:                return (listenerTextField.getTextFieldText().trim().length() == 0) ? false
328:                        : true;
329:            }
330:
331:            private String getSpecifiedInstance() {
332:                return listenerTextField.getTextFieldText();
333:            }
334:
335:            private boolean isInstanceSpecifiedDuplicate() {
336:                SRAFileContext fc = getSRAFileContext();
337:                Boolean result = existsInstance(fc, getSpecifiedInstance());
338:
339:                if (result.booleanValue()) {
340:                    showErrorDialog(getName() + GUI_ERROR_DIALOG_TITLE,
341:                            getName() + GUI_ERROR_INSTANCE_NAME_DUPLICATE,
342:                            null, null);
343:                }
344:
345:                return result.booleanValue();
346:            }
347:
348:            private boolean validateInstanceSpecified() {
349:                boolean result = isInstanceSpecified();
350:
351:                if (!result) {
352:                    showErrorDialog(getName() + GUI_ERROR_DIALOG_TITLE,
353:                            getName() + GUI_ERROR_INSTANCE_NAME_EMPTY, null,
354:                            null);
355:                }
356:
357:                return result;
358:            }
359:
360:            private boolean doAllowNextPress() {
361:                boolean result = true;
362:
363:                if ((result) && (isInstanceSpecified())) {
364:                    if (isInstanceSpecifiedDuplicate()) {
365:                        result = false;
366:                    }
367:                }
368:
369:                return result;
370:            }
371:
372:            private void setDefaultActionIfRequired() {
373:                if (SRAWSWHelper.getWSWAction(getWizardState()) == null) {
374:                    if (isInstanceSpecified()) {
375:                        SRAWSWHelper.setWSWAction(getWizardState(),
376:                                GUI_ACTION_CREATE);
377:                    } else {
378:                        SRAWSWHelper.setWSWAction(getWizardState(),
379:                                GUI_ACTION_PROPERTIES);
380:                    }
381:                }
382:            }
383:
384:            private String getInstanceNameForAction() {
385:                String instanceNameForAction = null;
386:                String action = SRAWSWHelper.getWSWAction(getWizardState());
387:                if (action.equals(GUI_ACTION_CREATE)) {
388:                    instanceNameForAction = getSpecifiedInstance();
389:                } else {
390:                    instanceNameForAction = getSelectedInstance();
391:                }
392:
393:                return instanceNameForAction;
394:            }
395:
396:            private void setInstanceNameIfRequired() {
397:                String preferredInstanceName = getInstanceNameForAction();
398:                String wswInstanceName = SRAWSWHelper
399:                        .getWSWInstanceName(getWizardState());
400:                if (wswInstanceName == null) {
401:                    if (isInstanceSpecified()) {
402:                        SRAWSWHelper.setWSWInstanceName(getWizardState(),
403:                                getSpecifiedInstance());
404:                    } else {
405:                        SRAWSWHelper.setWSWInstanceName(getWizardState(),
406:                                getSelectedInstance());
407:                    }
408:                } else {
409:                    SRAWSWHelper.setWSWInstanceName(getWizardState(),
410:                            preferredInstanceName);
411:                }
412:            }
413:
414:            //
415:            //
416:            //
417:            public boolean handleClickButtonProperties() {
418:                SRAWSWHelper.setWSWAction(getWizardState(),
419:                        GUI_ACTION_PROPERTIES);
420:                SRAWSWHelper.setWSWInstanceName(getWizardState(),
421:                        getSelectedInstance());
422:                return true;
423:            }
424:
425:            public boolean handleClickButtonModify() {
426:                SRAWSWHelper.setWSWAction(getWizardState(), GUI_ACTION_MODIFY);
427:                SRAWSWHelper.setWSWInstanceName(getWizardState(),
428:                        getSelectedInstance());
429:                return true;
430:            }
431:
432:            public boolean handleClickButtonDelete() {
433:                SRAWSWHelper.setWSWAction(getWizardState(), GUI_ACTION_DELETE);
434:                SRAWSWHelper.setWSWInstanceName(getWizardState(),
435:                        getSelectedInstance());
436:                return true;
437:            }
438:
439:            public boolean handleClickButtonCreate() {
440:                boolean result = validateInstanceSpecified();
441:
442:                if (result) {
443:                    SRAWSWHelper.setWSWAction(getWizardState(),
444:                            GUI_ACTION_CREATE);
445:                    SRAWSWHelper.setWSWInstanceName(getWizardState(),
446:                            getSpecifiedInstance());
447:                }
448:
449:                return result;
450:            }
451:
452:            public void handleButtonClick(String action) {
453:                boolean allWell = true;
454:
455:                if (action.equals(wbResource.getString(getName()
456:                        + GUI_BUTTON_PROPERTIES)))
457:                    allWell = handleClickButtonProperties();
458:                else if (action.equals(wbResource.getString(getName()
459:                        + GUI_BUTTON_MODIFY)))
460:                    allWell = handleClickButtonModify();
461:                else if (action.equals(wbResource.getString(getName()
462:                        + GUI_BUTTON_DELETE)))
463:                    allWell = handleClickButtonDelete();
464:                else if (action.equals(wbResource.getString(getName()
465:                        + GUI_BUTTON_CREATE)))
466:                    allWell = handleClickButtonCreate();
467:
468:                if (allWell) {
469:                    getTreeManager().nextButtonPressed();
470:                }
471:            }
472:
473:            //
474:            //
475:            //
476:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.