Source Code Cross Referenced for HugeTestPortletWingSEdit.java in  » Swing-Library » wings3 » hugetestportlet » 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 » Swing Library » wings3 » hugetestportlet 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package hugetestportlet;
002:
003:        import hugetestportlet.data.NavigationTreeModel;
004:        import hugetestportlet.data.PersonBean;
005:        import hugetestportlet.data.PersonTableModel;
006:
007:        import java.awt.event.ActionEvent;
008:        import java.awt.event.ActionListener;
009:        import java.io.File;
010:        import java.io.FileNotFoundException;
011:        import java.util.Arrays;
012:        import java.util.HashMap;
013:        import java.util.Iterator;
014:        import java.util.Map;
015:        import java.util.Set;
016:
017:        import javax.swing.event.ListSelectionEvent;
018:        import javax.swing.event.ListSelectionListener;
019:        import javax.swing.event.TreeSelectionEvent;
020:        import javax.swing.event.TreeSelectionListener;
021:        import javax.swing.tree.DefaultTreeModel;
022:        import javax.swing.tree.TreePath;
023:
024:        import org.wings.SButton;
025:        import org.wings.SButtonGroup;
026:
027:        import org.wings.SAnchor;
028:        import org.wings.SBorderLayout;
029:        import org.wings.SCheckBox;
030:        import org.wings.SFileIcon;
031:        import org.wings.SForm;
032:        import org.wings.SFrame;
033:        import org.wings.SGridLayout;
034:        import org.wings.SLabel;
035:        import org.wings.SPanel;
036:        import org.wings.SPortletAnchor;
037:        import org.wings.SRadioButton;
038:        import org.wings.SResourceIcon;
039:        import org.wings.SScrollPane;
040:        import org.wings.STabbedPane;
041:        import org.wings.STable;
042:        import org.wings.STextField;
043:        import org.wings.STree;
044:        import org.wings.SURLIcon;
045:        import org.wings.event.SRenderEvent;
046:        import org.wings.event.SRenderListener;
047:        import org.wings.portlet.PortletParameterEvent;
048:        import org.wings.portlet.PortletParameterListener;
049:        import org.wings.portlet.PortletParameterProvider;
050:        import org.wings.portlet.WindowStateEvent;
051:        import org.wings.portlet.WindowStateListener;
052:        import org.wings.portlet.WindowStateProvider;
053:
054:        public class HugeTestPortletWingSEdit {
055:
056:            // private List<PersonBean> personList = new LinkedList<PersonBean>();
057:
058:            public HugeTestPortletWingSEdit() {
059:
060:                // TabbedPane for table and table input
061:                final STabbedPane tabbedPane = getTableTabbedPane();
062:
063:                // Image panel
064:                final SPanel imagePanel = getImagePanel();
065:
066:                // Links panel
067:                final SPanel linksPanel = getLinksPanel();
068:
069:                // Links with parameters panel
070:                final SPanel linksWithParametersPanel = getLinksWithParametersPanel();
071:
072:                // Links with mode and param
073:                final SPanel linksWithParametersAndModesPanel = getLinksWithParametersAndModesPanel();
074:
075:                // Links with window states
076:                final SPanel linksWithWindowState = getLinksWithWindowStates();
077:
078:                // Navigation Tree panel
079:                STree tree = new STree(new DefaultTreeModel(
080:                        NavigationTreeModel.ROOT_NODE));
081:                tree.getSelectionModel().setSelectionMode(
082:                        STree.SINGLE_TREE_SELECTION);
083:
084:                SGridLayout treePanelLayout = new SGridLayout(1);
085:                treePanelLayout.setVgap(2);
086:                treePanelLayout.setHgap(2);
087:                SPanel treePanel = new SPanel(treePanelLayout);
088:                treePanel.setVerticalAlignment(SGridLayout.TOP);
089:
090:                treePanel.add(tree);
091:
092:                // Root Form
093:                SBorderLayout rootFormLayout = new SBorderLayout();
094:                rootFormLayout.setVgap(2);
095:                rootFormLayout.setHgap(30);
096:                final SForm rootForm = new SForm(rootFormLayout);
097:
098:                rootForm.add(treePanel, SBorderLayout.WEST);
099:
100:                tree.addTreeSelectionListener(new TreeSelectionListener() {
101:                    public void valueChanged(
102:                            TreeSelectionEvent treeSelectionEvent) {
103:                        TreePath path = treeSelectionEvent
104:                                .getNewLeadSelectionPath();
105:                        if (path != null) {
106:                            String choose = path.getLastPathComponent()
107:                                    .toString();
108:                            if (choose.equals("Table")) {
109:                                rootForm.remove(imagePanel);
110:                                rootForm.remove(linksPanel);
111:                                rootForm.remove(linksWithParametersPanel);
112:                                rootForm
113:                                        .remove(linksWithParametersAndModesPanel);
114:                                rootForm.remove(linksWithWindowState);
115:                                rootForm.add(tabbedPane, SBorderLayout.CENTER);
116:                            } else if (choose.equals("Pictures")) {
117:                                rootForm.remove(tabbedPane);
118:                                rootForm.remove(linksPanel);
119:                                rootForm.remove(linksWithParametersPanel);
120:                                rootForm
121:                                        .remove(linksWithParametersAndModesPanel);
122:                                rootForm.remove(linksWithWindowState);
123:                                rootForm.add(imagePanel, SBorderLayout.CENTER);
124:                            } else if (choose.equals("Links")) {
125:                                rootForm.remove(tabbedPane);
126:                                rootForm.remove(imagePanel);
127:                                rootForm
128:                                        .remove(linksWithParametersAndModesPanel);
129:                                rootForm.remove(linksWithParametersPanel);
130:                                rootForm.remove(linksWithWindowState);
131:                                rootForm.add(linksPanel, SBorderLayout.CENTER);
132:                            } else if (choose.equals("Params")) {
133:                                rootForm.remove(tabbedPane);
134:                                rootForm.remove(imagePanel);
135:                                rootForm.remove(linksPanel);
136:                                rootForm
137:                                        .remove(linksWithParametersAndModesPanel);
138:                                rootForm.remove(linksWithWindowState);
139:                                rootForm.add(linksWithParametersPanel,
140:                                        SBorderLayout.CENTER);
141:                            } else if (choose.equals("ParamsMode")) {
142:                                rootForm.remove(tabbedPane);
143:                                rootForm.remove(imagePanel);
144:                                rootForm.remove(linksPanel);
145:                                rootForm.remove(linksWithParametersPanel);
146:                                rootForm.remove(linksWithWindowState);
147:                                rootForm.add(linksWithParametersAndModesPanel,
148:                                        SBorderLayout.CENTER);
149:                            } else if (choose.equals("ParamsWS")) {
150:                                rootForm.remove(tabbedPane);
151:                                rootForm.remove(imagePanel);
152:                                rootForm.remove(linksPanel);
153:                                rootForm.remove(linksWithParametersPanel);
154:                                rootForm
155:                                        .remove(linksWithParametersAndModesPanel);
156:                                rootForm.add(linksWithWindowState,
157:                                        SBorderLayout.CENTER);
158:                            } else {
159:                                rootForm.remove(imagePanel);
160:                                rootForm.remove(tabbedPane);
161:                                rootForm.remove(linksPanel);
162:                                rootForm.remove(linksWithParametersPanel);
163:                                rootForm
164:                                        .remove(linksWithParametersAndModesPanel);
165:                                rootForm.remove(linksWithWindowState);
166:                            }
167:                        } else {
168:                            rootForm.remove(imagePanel);
169:                            rootForm.remove(tabbedPane);
170:                            rootForm.remove(linksPanel);
171:                            rootForm.remove(linksWithParametersPanel);
172:                            rootForm.remove(linksWithParametersAndModesPanel);
173:                            rootForm.remove(linksWithWindowState);
174:                        }
175:
176:                    }
177:                });
178:
179:                // test window state
180:                final SLabel max = new SLabel();
181:
182:                WindowStateProvider pwsp = WindowStateProvider.getInstance();
183:                pwsp.addWindowStateChangeListener(new WindowStateListener() {
184:
185:                    public void windowStateChanged(WindowStateEvent e) {
186:                        if (e.getWindowState().equals(
187:                                WindowStateProvider.MAXIMIZED_WS)) {
188:
189:                            String maxString = "Currently in Maximized_WS, Currently "
190:                                    + "in Maximized_WS, ";
191:                            for (int i = 0; i < 40; i++) {
192:                                maxString += "Currently in Maximized_WS, ";
193:                                if (i % 4 == 0)
194:                                    maxString += "\n";
195:                            }
196:                            maxString += "Currently in Maximized_WS, Currently in Maximized_WS.";
197:                            max.setText(maxString);
198:                        } else {
199:                            max.setText("");
200:                        }
201:
202:                    }
203:
204:                });
205:
206:                rootForm.add(max, SBorderLayout.NORTH);
207:
208:                // Frame
209:                SFrame rootFrame = new SFrame();
210:                rootFrame.getContentPane().add(rootForm);
211:                rootFrame.setVisible(true);
212:
213:            }
214:
215:            private STabbedPane getTableTabbedPane() {
216:
217:                // DATA PANEL
218:
219:                // male/female Radio Buttons in Group
220:                final SButtonGroup genderGroup = new SButtonGroup();
221:                final SRadioButton male = new SRadioButton("Mr", true);
222:                final SRadioButton female = new SRadioButton("Mrs");
223:                genderGroup.add(male);
224:                genderGroup.add(female);
225:
226:                // prof and dr check Boxes
227:                final SCheckBox prof = new SCheckBox("Prof.");
228:                final SCheckBox dr = new SCheckBox("Dr.");
229:
230:                // name and givenName fields
231:                final SLabel nameLabel = new SLabel("Name: ");
232:                final STextField name = new STextField();
233:                final SLabel givenNameLabel = new SLabel("given name: ");
234:                final STextField givenName = new STextField();
235:
236:                SGridLayout dataPanelLayout = new SGridLayout(2);
237:                dataPanelLayout.setVgap(10);
238:                dataPanelLayout.setHgap(5);
239:                SPanel dataPanel = new SPanel(dataPanelLayout);
240:
241:                dataPanel.add(male);
242:                dataPanel.add(female);
243:                dataPanel.add(prof);
244:                dataPanel.add(dr);
245:                dataPanel.add(nameLabel);
246:                dataPanel.add(name);
247:                dataPanel.add(givenNameLabel);
248:                dataPanel.add(givenName);
249:
250:                // SUBMIT PANEL
251:
252:                SButton submitButton = new SButton("Submit");
253:
254:                SGridLayout submitPanelLayout = new SGridLayout(1);
255:                submitPanelLayout.setVgap(2);
256:                submitPanelLayout.setHgap(2);
257:                SPanel submitPanel = new SPanel(submitPanelLayout);
258:
259:                submitPanel.add(submitButton);
260:
261:                // INPUT PANEL
262:
263:                SGridLayout inputLayout = new SGridLayout(1);
264:                inputLayout.setVgap(15);
265:                inputLayout.setBorder(1);
266:                SPanel inputPanel = new SPanel(inputLayout);
267:
268:                inputPanel.add(dataPanel);
269:                inputPanel.add(submitPanel);
270:
271:                // ---------------------------------------------
272:
273:                // TABLE PANEL
274:
275:                final SLabel tableStatusLabel = new SLabel();
276:
277:                final PersonTableModel ptm = new PersonTableModel();
278:                ptm
279:                        .addPerson(new PersonBean("Mr", true, true, "wurst",
280:                                "hans1"));
281:                ptm
282:                        .addPerson(new PersonBean("Mr", true, true, "wurst",
283:                                "hans2"));
284:                ptm
285:                        .addPerson(new PersonBean("Mr", true, true, "wurst",
286:                                "hans3"));
287:                ptm
288:                        .addPerson(new PersonBean("Mr", true, true, "wurst",
289:                                "hans4"));
290:                ptm
291:                        .addPerson(new PersonBean("Mr", true, true, "wurst",
292:                                "hans5"));
293:                ptm
294:                        .addPerson(new PersonBean("Mr", true, true, "wurst",
295:                                "hans6"));
296:                ptm
297:                        .addPerson(new PersonBean("Mr", true, true, "wurst",
298:                                "hans7"));
299:                ptm
300:                        .addPerson(new PersonBean("Mr", true, true, "wurst",
301:                                "hans8"));
302:                ptm
303:                        .addPerson(new PersonBean("Mr", true, true, "wurst",
304:                                "hans9"));
305:                ptm.addPerson(new PersonBean("Mr", true, true, "wurst",
306:                        "hans10"));
307:                ptm.addPerson(new PersonBean("Mr", true, true, "wurst",
308:                        "hans11"));
309:                ptm.addPerson(new PersonBean("Mr", true, true, "wurst",
310:                        "hans12"));
311:                ptm.addPerson(new PersonBean("Mr", true, true, "wurst",
312:                        "hans13"));
313:                ptm.addPerson(new PersonBean("Mr", true, true, "wurst",
314:                        "hans14"));
315:                final STable table = new STable(ptm);
316:                table.setSelectionMode(STable.SINGLE_SELECTION);
317:
318:                final SButton deleteButton = new SButton("Delete selected row");
319:
320:                SGridLayout tablePanelLayout = new SGridLayout(1);
321:                tablePanelLayout.setVgap(5);
322:                tablePanelLayout.setHgap(5);
323:                SPanel tablePanel = new SPanel(tablePanelLayout);
324:
325:                SScrollPane scrollPane = new SScrollPane(table);
326:                tablePanel.add(scrollPane);
327:                tablePanel.add(tableStatusLabel);
328:                tablePanel.add(deleteButton);
329:
330:                // ---------------------------------------------
331:
332:                // TABBEDPANEL
333:
334:                STabbedPane tappedPane = new STabbedPane();
335:                tappedPane.add("NewEntry", inputPanel);
336:                tappedPane.add("Table", tablePanel);
337:
338:                // ---------------------------------------------
339:
340:                // LISTENER
341:
342:                // listner for submit button
343:                submitButton.addActionListener(new ActionListener() {
344:                    public void actionPerformed(ActionEvent e) {
345:                        PersonBean person = new PersonBean();
346:                        if (genderGroup.getSelection().equals(male)) {
347:                            person.setGender("Mr");
348:                        } else {
349:                            person.setGender("Mrs");
350:                        }
351:                        person.setDr(dr.isSelected());
352:                        person.setProf(prof.isSelected());
353:                        person.setName(name.getText());
354:                        person.setGivenName(givenName.getText());
355:
356:                        ptm.addPerson(person);
357:
358:                    }
359:                });
360:
361:                // listner for table selection
362:                table.addSelectionListener(new ListSelectionListener() {
363:                    public void valueChanged(
364:                            ListSelectionEvent listSelectionEvent) {
365:                        tableStatusLabel.setText("Selection changed to: "
366:                                + table.getSelectedRow());
367:                    }
368:                });
369:
370:                // listner for delete button
371:                deleteButton.addActionListener(new ActionListener() {
372:                    public void actionPerformed(ActionEvent actionEvent) {
373:                        if (table.getSelectedRow() != -1) {
374:                            ptm.removePerson(table.getSelectedRow());
375:                        }
376:                    }
377:                });
378:
379:                return tappedPane;
380:
381:            }
382:
383:            private SPanel getImagePanel() {
384:
385:                // image contained in the class path
386:                SResourceIcon classPathImg = new SResourceIcon(
387:                        "org/wings/icons/JavaCup.gif");
388:                SLabel classPathImgL = new SLabel(classPathImg);
389:
390:                // image deployed in a icons directory of you application
391:                SURLIcon directoryImg = new SURLIcon("/testportlet/img/tux.gif");
392:                SLabel directoryImgL = new SLabel(directoryImg);
393:
394:                SGridLayout imagesPanelLayout = new SGridLayout(1);
395:                imagesPanelLayout.setBorder(1);
396:                imagesPanelLayout.setVgap(2);
397:                imagesPanelLayout.setHgap(2);
398:                final SPanel imagePanel = new SPanel(imagesPanelLayout);
399:
400:                imagePanel.add(new SLabel("Class Path Image:"));
401:                imagePanel.add(classPathImgL);
402:                imagePanel.add(new SLabel("Directory Path Image:"));
403:                imagePanel.add(directoryImgL);
404:
405:                return imagePanel;
406:
407:            }
408:
409:            private SPanel getLinksPanel() {
410:
411:                SLabel googleLink = new SLabel("Google");
412:                SAnchor googleAnchor = new SAnchor("http://www.google.de",
413:                        "_blank");
414:                googleAnchor.add(googleLink);
415:
416:                SLabel actionLink = new SLabel("Action");
417:                SPortletAnchor actionAnchor = new SPortletAnchor(
418:                        SPortletAnchor.ACTION_URL);
419:                actionAnchor.add(actionLink);
420:
421:                SLabel renderLink = new SLabel("Render");
422:                SPortletAnchor renderAnchor = new SPortletAnchor(
423:                        SPortletAnchor.RENDER_URL);
424:                renderAnchor.add(renderLink);
425:
426:                SLabel viewMode = new SLabel("go to view mode with action url");
427:                SPortletAnchor viewModeActionAnchor = new SPortletAnchor(
428:                        SPortletAnchor.ACTION_URL, SPortletAnchor.VIEW_MODE);
429:                viewModeActionAnchor.add(viewMode);
430:
431:                SLabel viewRenderMode = new SLabel(
432:                        "go to view mode with render url");
433:                SPortletAnchor viewRenderModeActionAnchor = new SPortletAnchor(
434:                        SPortletAnchor.RENDER_URL, SPortletAnchor.VIEW_MODE);
435:                viewRenderModeActionAnchor.add(viewRenderMode);
436:
437:                SLabel actionLink2 = new SLabel("Action2");
438:                SPortletAnchor actionAnchor2 = new SPortletAnchor(
439:                        SPortletAnchor.ACTION_URL);
440:                actionAnchor2.add(actionLink2);
441:
442:                SGridLayout linksPanelLayout = new SGridLayout(1);
443:                linksPanelLayout.setBorder(1);
444:                linksPanelLayout.setVgap(2);
445:                linksPanelLayout.setHgap(2);
446:                final SPanel linksPanel = new SPanel(linksPanelLayout);
447:
448:                linksPanel.add(googleAnchor);
449:                linksPanel.add(actionAnchor);
450:                linksPanel.add(renderAnchor);
451:                linksPanel.add(viewModeActionAnchor);
452:                linksPanel.add(viewRenderModeActionAnchor);
453:                linksPanel.add(actionAnchor2);
454:
455:                return linksPanel;
456:
457:            }
458:
459:            private SPanel getLinksWithParametersPanel() {
460:
461:                Map<String, String[]> actionParams = new HashMap<String, String[]>();
462:                actionParams
463:                        .put("testprop", new String[] { "action", "array" });
464:
465:                Map<String, String[]> renderParams = new HashMap<String, String[]>();
466:                renderParams.put("testprop", new String[] { "render" });
467:
468:                Map<String, String[]> actionParams2 = new HashMap<String, String[]>();
469:                actionParams2.put("testprop", new String[] { "action2" });
470:
471:                SLabel actionLink = new SLabel("Action");
472:                SPortletAnchor actionAnchor = new SPortletAnchor(
473:                        SPortletAnchor.ACTION_URL, null, null, actionParams);
474:                actionAnchor.add(actionLink);
475:
476:                SLabel actionExtraParamLink = new SLabel("Action extra Param");
477:                SPortletAnchor actionExtraParamAnchor = new SPortletAnchor(
478:                        SPortletAnchor.ACTION_URL, null, null, actionParams);
479:                actionExtraParamAnchor.add(actionExtraParamLink);
480:                actionExtraParamAnchor.setParameter("extraParam",
481:                        "actionExtraParam");
482:                actionExtraParamAnchor.setParameters("extraParamArray",
483:                        new String[] { "epa1", "epa2" });
484:
485:                SLabel actionLink2 = new SLabel("Action2");
486:                SPortletAnchor actionAnchor2 = new SPortletAnchor(
487:                        SPortletAnchor.ACTION_URL, null, null, actionParams2);
488:                actionAnchor2.add(actionLink2);
489:
490:                SLabel actionLinkO = new SLabel("Action without param");
491:                SPortletAnchor actionAnchorO = new SPortletAnchor(
492:                        SPortletAnchor.ACTION_URL, null);
493:                actionAnchorO.add(actionLinkO);
494:
495:                SLabel renderLink = new SLabel("Render");
496:                SPortletAnchor renderAnchor = new SPortletAnchor(
497:                        SPortletAnchor.RENDER_URL, null, null, renderParams);
498:                renderAnchor.add(renderLink);
499:
500:                SLabel viewMode = new SLabel(
501:                        "view mode action url without param ");
502:                SPortletAnchor viewModeActionAnchor = new SPortletAnchor(
503:                        SPortletAnchor.ACTION_URL, SPortletAnchor.VIEW_MODE);
504:                viewModeActionAnchor.add(viewMode);
505:
506:                SLabel viewRenderMode = new SLabel(
507:                        "view mode render url without param");
508:                SPortletAnchor viewRenderModeActionAnchor = new SPortletAnchor(
509:                        SPortletAnchor.RENDER_URL, SPortletAnchor.VIEW_MODE);
510:                viewRenderModeActionAnchor.add(viewRenderMode);
511:
512:                SLabel actionLinkO2 = new SLabel("Action without param 2");
513:                SPortletAnchor actionAnchorO2 = new SPortletAnchor(
514:                        SPortletAnchor.ACTION_URL, null, null);
515:                actionAnchorO2.add(actionLinkO2);
516:
517:                SGridLayout linksPanelLayout = new SGridLayout(1);
518:                linksPanelLayout.setBorder(1);
519:                linksPanelLayout.setVgap(2);
520:                linksPanelLayout.setHgap(2);
521:                final SPanel linksPanel = new SPanel(linksPanelLayout);
522:
523:                linksPanel.add(actionAnchor);
524:                linksPanel.add(actionExtraParamAnchor);
525:                linksPanel.add(actionAnchor2);
526:                linksPanel.add(actionAnchorO);
527:                linksPanel.add(renderAnchor);
528:                linksPanel.add(viewModeActionAnchor);
529:                linksPanel.add(viewRenderModeActionAnchor);
530:                linksPanel.add(actionAnchorO2);
531:
532:                final SLabel paramLabel = new SLabel();
533:
534:                PortletParameterProvider ppp = PortletParameterProvider
535:                        .getInstance();
536:
537:                ppp.addPortletParameterListener(new PortletParameterListener() {
538:
539:                    public void newPortletParameters(PortletParameterEvent e) {
540:                        Map<String, String[]> params = e.getParameterMap();
541:                        String paramList = "Parameter: \n";
542:                        if (params != null) {
543:                            Set<String> paramSet = params.keySet();
544:                            Iterator<String> iter = paramSet.iterator();
545:                            while (iter.hasNext()) {
546:                                String paramName = iter.next();
547:                                String[] value = (String[]) params
548:                                        .get(paramName);
549:                                paramList += paramName + ": "
550:                                        + Arrays.asList(value) + "\n";
551:                            }
552:                        }
553:                        paramLabel.setText(paramList);
554:                    }
555:
556:                });
557:
558:                linksPanel.add(paramLabel);
559:
560:                return linksPanel;
561:
562:            }
563:
564:            private SPanel getLinksWithParametersAndModesPanel() {
565:
566:                Map<String, String[]> actionParams = new HashMap<String, String[]>();
567:                actionParams.put("testprop", new String[] { "action" });
568:
569:                Map<String, String[]> renderParams = new HashMap<String, String[]>();
570:                renderParams.put("testprop", new String[] { "render" });
571:
572:                SLabel viewMode = new SLabel("view mode action url");
573:                SPortletAnchor viewModeActionAnchor = new SPortletAnchor(
574:                        SPortletAnchor.ACTION_URL, SPortletAnchor.VIEW_MODE,
575:                        null, actionParams);
576:                viewModeActionAnchor.add(viewMode);
577:
578:                SLabel viewRenderMode = new SLabel("view mode render url");
579:                SPortletAnchor viewRenderModeActionAnchor = new SPortletAnchor(
580:                        SPortletAnchor.RENDER_URL, SPortletAnchor.VIEW_MODE,
581:                        null, renderParams);
582:                viewRenderModeActionAnchor.add(viewRenderMode);
583:
584:                SGridLayout linksPanelLayout = new SGridLayout(1);
585:                linksPanelLayout.setBorder(1);
586:                linksPanelLayout.setVgap(2);
587:                linksPanelLayout.setHgap(2);
588:                final SPanel linksPanel = new SPanel(linksPanelLayout);
589:
590:                linksPanel.add(viewModeActionAnchor);
591:                linksPanel.add(viewRenderModeActionAnchor);
592:
593:                return linksPanel;
594:            }
595:
596:            private SPanel getLinksWithWindowStates() {
597:
598:                SLabel normalWS = new SLabel("normalWS");
599:                SPortletAnchor normalWSAnchor = new SPortletAnchor(
600:                        SPortletAnchor.RENDER_URL, null,
601:                        SPortletAnchor.NORMAL_WS);
602:                normalWSAnchor.add(normalWS);
603:
604:                SLabel maximizedWS = new SLabel("maximizedWS");
605:                SPortletAnchor maximizedWSAnchor = new SPortletAnchor(
606:                        SPortletAnchor.RENDER_URL, null,
607:                        SPortletAnchor.MAXIMIZED_WS);
608:                maximizedWSAnchor.add(maximizedWS);
609:
610:                SLabel miminizedWS = new SLabel("minimizedWS");
611:                SPortletAnchor miminizedWSAnchor = new SPortletAnchor(
612:                        SPortletAnchor.RENDER_URL, null,
613:                        SPortletAnchor.MINIMIZED_WS);
614:                miminizedWSAnchor.add(miminizedWS);
615:
616:                SGridLayout linksPanelLayout = new SGridLayout(1);
617:                linksPanelLayout.setBorder(1);
618:                linksPanelLayout.setVgap(2);
619:                linksPanelLayout.setHgap(2);
620:                final SPanel linksPanel = new SPanel(linksPanelLayout);
621:
622:                linksPanel.add(normalWSAnchor);
623:                linksPanel.add(maximizedWSAnchor);
624:                linksPanel.add(miminizedWSAnchor);
625:
626:                return linksPanel;
627:            }
628:
629:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.