Source Code Cross Referenced for FActionEditor.java in  » Content-Management-System » contelligent » de » finix » contelligent » client » gui » action » 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 » Content Management System » contelligent » de.finix.contelligent.client.gui.action 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2001-2006 C:1 Financial Services GmbH
003:         *
004:         * This software is free software; you can redistribute it and/or
005:         * modify it under the terms of the GNU Lesser General Public
006:         * License Version 2.1, as published by the Free Software Foundation.
007:         *
008:         * This software is distributed in the hope that it will be useful,
009:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
010:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
011:         * Lesser General Public License for more details.
012:         *
013:         * You should have received a copy of the GNU Lesser General Public
014:         * License along with this library; if not, write to the Free Software
015:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
016:         */
017:
018:        package de.finix.contelligent.client.gui.action;
019:
020:        import java.awt.BorderLayout;
021:        import java.awt.event.ActionEvent;
022:        import java.awt.event.FocusAdapter;
023:        import java.awt.event.FocusEvent;
024:        import java.util.List;
025:        import java.util.logging.Level;
026:        import java.util.logging.Logger;
027:
028:        import javax.swing.AbstractAction;
029:        import javax.swing.Action;
030:        import javax.swing.JLabel;
031:        import javax.swing.JOptionPane;
032:        import javax.swing.JPanel;
033:        import javax.swing.JScrollPane;
034:        import javax.swing.JTabbedPane;
035:
036:        import de.finix.contelligent.client.base.ComponentFactory;
037:        import de.finix.contelligent.client.base.ComponentNotFoundException;
038:        import de.finix.contelligent.client.base.ContelligentComponent;
039:        import de.finix.contelligent.client.event.ContelligentEvent;
040:        import de.finix.contelligent.client.gui.AbstractComponentEditor;
041:        import de.finix.contelligent.client.gui.ComponentRenderer;
042:        import de.finix.contelligent.client.gui.ContelligentAction;
043:        import de.finix.contelligent.client.gui.GUI;
044:        import de.finix.contelligent.client.gui.UnsupportedGUIException;
045:        import de.finix.contelligent.client.gui.composed.TableEditor;
046:        import de.finix.contelligent.client.gui.composed.TableGUI;
047:        import de.finix.contelligent.client.gui.directory.PreviewFolderEditor;
048:        import de.finix.contelligent.client.gui.directory.PreviewFolderGUI;
049:        import de.finix.contelligent.client.i18n.Resources;
050:        import de.finix.contelligent.client.remote.ActionResult;
051:        import de.finix.contelligent.client.remote.Actions;
052:        import de.finix.contelligent.client.remote.RemoteAction;
053:        import de.finix.contelligent.client.remote.RemoteActionException;
054:        import de.finix.contelligent.client.util.ExceptionDialog;
055:
056:        public class FActionEditor extends AbstractComponentEditor {
057:
058:            private static Logger logger = Logger.getLogger(FActionEditor.class
059:                    .getName());
060:
061:            private PerformAction performAction = new PerformAction();
062:
063:            private final static String PARAMETER_FOLDER = "parameter";
064:
065:            private final static String ROUTING_FOLDER = "routing";
066:
067:            private final static String RESULT_FOLDER = "result";
068:
069:            private TableEditor parameterEditor;
070:
071:            private RoutingEditor routingPanel;
072:
073:            private PreviewFolderEditor resultEditor;
074:
075:            private JTabbedPane tabbedPane;
076:
077:            public void init() {
078:                try {
079:                    tabbedPane = new JTabbedPane();
080:
081:                    // First add routingFolder
082:                    RoutingGUI gui = new RoutingGUI();
083:                    try {
084:                        gui.setComponent(ComponentFactory.getInstance()
085:                                .getComponent(
086:                                        getComponent().getPath() + "/"
087:                                                + ROUTING_FOLDER));
088:                        gui.setRootName(getComponent().getName());
089:                        gui.setView(getView());
090:                        gui.init();
091:
092:                        routingPanel = (RoutingEditor) (isEditable() ? gui
093:                                .getEditor(GUI.DEFAULT) : gui
094:                                .getRenderer(GUI.DEFAULT));
095:                        JScrollPane routingScroller = new JScrollPane(
096:                                routingPanel);
097:                        routingScroller.getViewport().setOpaque(false);
098:                        routingScroller.setOpaque(false);
099:                        tabbedPane.addTab(Resources.getLocalString("routings"),
100:                                routingScroller);
101:                    } catch (ComponentNotFoundException cne) {
102:                        JLabel label = new JLabel("Required subfolder '"
103:                                + ROUTING_FOLDER + "' not found.");
104:                        tabbedPane.addTab(Resources.getLocalString("routings"),
105:                                label);
106:                    }
107:                    // then parameter
108:                    try {
109:                        parameterEditor = (TableEditor) getMyEditor(
110:                                new TableGUI(), ComponentFactory.getInstance()
111:                                        .getComponent(
112:                                                getComponent().getPath() + "/"
113:                                                        + PARAMETER_FOLDER));
114:                        JPanel parameterPanel = new JPanel(new BorderLayout());
115:                        parameterPanel.setOpaque(false);
116:                        parameterPanel.add(new JLabel(Resources
117:                                .getLocalString("parameters_requested")
118:                                + ":"), BorderLayout.NORTH);
119:                        parameterPanel
120:                                .add(parameterEditor, BorderLayout.CENTER);
121:                        tabbedPane.addTab(Resources
122:                                .getLocalString("parameters"), parameterPanel);
123:                    } catch (ComponentNotFoundException cne) {
124:                        JLabel label = new JLabel("Required subfolder '"
125:                                + PARAMETER_FOLDER + "' not found.");
126:                        tabbedPane.addTab(Resources
127:                                .getLocalString("parameters"), label);
128:                    }
129:
130:                    // finally result
131:                    try {
132:                        resultEditor = (PreviewFolderEditor) getMyEditor(
133:                                new PreviewFolderGUI(), ComponentFactory
134:                                        .getInstance().getComponent(
135:                                                getComponent().getPath() + "/"
136:                                                        + RESULT_FOLDER));
137:                        tabbedPane.addTab(Resources.getLocalString("results"),
138:                                resultEditor);
139:                    } catch (ComponentNotFoundException cne) {
140:                        JLabel label = new JLabel("Required subfolder '"
141:                                + RESULT_FOLDER + "' not found.");
142:                        tabbedPane.addTab(Resources.getLocalString("results"),
143:                                label);
144:                    }
145:
146:                    add(tabbedPane, BorderLayout.CENTER);
147:
148:                    tabbedPane.addFocusListener(new FocusAdapter() {
149:                        public void focusGained(FocusEvent e) {
150:                            // send the actually available actions to the view
151:                            getView().setActions(
152:                                    FActionEditor.this .getActions());
153:                        }
154:                    });
155:                } catch (UnsupportedGUIException e) {
156:                    logger.log(Level.SEVERE, "Could not init: ", e);
157:                }
158:            }
159:
160:            public ComponentRenderer getMyEditor(GUI gui,
161:                    ContelligentComponent component) {
162:                gui.setComponent(component);
163:                gui.setView(getView());
164:                gui.init();
165:                ComponentRenderer editor = null;
166:                try {
167:                    editor = (isEditable() ? gui.getEditor(GUI.DEFAULT) : gui
168:                            .getRenderer(GUI.DEFAULT));
169:                } catch (UnsupportedGUIException e) {
170:                    logger.log(Level.SEVERE, "Could not get editor: ", e);
171:                }
172:
173:                return editor;
174:            }
175:
176:            public void update() {
177:            }
178:
179:            protected void componentChanged(ContelligentEvent event) {
180:            }
181:
182:            protected void childComponentAdded(ContelligentEvent event) {
183:            }
184:
185:            protected void childComponentRemoved(ContelligentEvent event) {
186:            }
187:
188:            protected void childComponentChanged(ContelligentEvent event) {
189:            }
190:
191:            protected void descendentComponentChanged(ContelligentEvent event) {
192:            }
193:
194:            public void setEditable(boolean editable) {
195:                super .setEditable(editable);
196:                if (parameterEditor != null)
197:                    parameterEditor.setEditable(editable);
198:                if (routingPanel != null)
199:                    routingPanel.setEditable(editable);
200:                if (resultEditor != null)
201:                    resultEditor.setEditable(editable);
202:                if (tabbedPane != null)
203:                    update();
204:            }
205:
206:            public void rollback() {
207:                setEditable(false);
208:                if (parameterEditor != null)
209:                    parameterEditor.rollback();
210:                if (routingPanel != null)
211:                    routingPanel.rollback();
212:                if (resultEditor != null)
213:                    resultEditor.rollback();
214:                super .rollback();
215:            }
216:
217:            public void commit() {
218:                setEditable(false);
219:                if (parameterEditor != null)
220:                    parameterEditor.commit();
221:                if (routingPanel != null)
222:                    routingPanel.commit();
223:                if (resultEditor != null)
224:                    resultEditor.commit();
225:                super .commit();
226:            }
227:
228:            public Action[] getActions() {
229:                return new Action[] { performAction };
230:            }
231:
232:            protected void updateComponent() {
233:            }
234:
235:            public class PerformAction extends AbstractAction implements 
236:                    ContelligentAction {
237:
238:                public PerformAction() {
239:                    super ("perform_action", Resources.performActionIcon);
240:                    this .putValue(ROLLOVER_ICON,
241:                            Resources.performActionIconRollOver);
242:                    this .putValue(TYPE, PUSH_ACTION);
243:                    this .putValue(ACTION_TYPE, EDIT_ACTION);
244:                    this .putValue(MENU_TARGET, MENU);
245:                    this .putValue(BUTTON_TARGET, TOOLBAR);
246:                }
247:
248:                public void actionPerformed(ActionEvent e) {
249:                    try {
250:                        // extract action parameters from subcomponents...
251:                        ContelligentComponent parameterFolder = ComponentFactory
252:                                .getInstance().getComponent(
253:                                        getComponent().getPath() + "/"
254:                                                + PARAMETER_FOLDER);
255:                        List parameterList = parameterFolder.getSubcomponents();
256:
257:                        // construct a dialog that requests the parameters
258:                        ActionOptionPane actionPane = new ActionOptionPane(
259:                                parameterFolder);
260:                        if (actionPane.showPerformActionDialog(Resources
261:                                .getLocalString("perform_action")
262:                                + ": " + getComponent().getName(),
263:                                parameterList) == actionPane.OK_OPTION) {
264:                            String[][] parameter = actionPane.getParameter();
265:                            RemoteAction remoteAction = new RemoteAction(
266:                                    getComponent().getPath() + ".act");
267:                            ActionResult result = Actions
268:                                    .tunnelDirectActionCall(remoteAction,
269:                                            parameter);
270:                            result.showErrors();
271:                            if (result.getState().equals(ActionResult.OK)) {
272:                                JOptionPane
273:                                        .showMessageDialog(
274:                                                null,
275:                                                Resources
276:                                                        .getLocalString("action_performed_successfully"),
277:                                                Resources
278:                                                        .getLocalString("action_successful"),
279:                                                JOptionPane.INFORMATION_MESSAGE);
280:                            } else {
281:                                if (!result.hasError()) {
282:                                    JOptionPane
283:                                            .showMessageDialog(
284:                                                    null,
285:                                                    Resources
286:                                                            .getLocalString("action_failed"),
287:                                                    Resources
288:                                                            .getLocalString("action_failed_title"),
289:                                                    JOptionPane.ERROR_MESSAGE);
290:                                }
291:                            }
292:                        }
293:                    } catch (RemoteActionException rae) {
294:                        ExceptionDialog.show(rae);
295:                    } catch (ComponentNotFoundException cnfe) {
296:                        JOptionPane
297:                                .showMessageDialog(
298:                                        null,
299:                                        Resources
300:                                                .getLocalString("actiongui_noparameterfolder"),
301:                                        Resources
302:                                                .getLocalString("actiongui_noparameterfolder_title"),
303:                                        JOptionPane.ERROR_MESSAGE);
304:                    }
305:                }
306:            }
307:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.