Source Code Cross Referenced for NewStandardXPDLElementEditor.java in  » Workflow-Engines » JaWE » org » enhydra » jawe » base » editor » 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 » Workflow Engines » JaWE » org.enhydra.jawe.base.editor 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.enhydra.jawe.base.editor;
002:
003:        import java.awt.Container;
004:        import java.awt.Window;
005:        import java.awt.event.ActionEvent;
006:        import java.awt.event.ActionListener;
007:        import java.awt.event.KeyEvent;
008:        import java.awt.event.WindowAdapter;
009:        import java.awt.event.WindowEvent;
010:        import java.awt.event.WindowListener;
011:        import java.util.List;
012:        import java.util.Observable;
013:        import java.util.Observer;
014:
015:        import javax.swing.AbstractAction;
016:        import javax.swing.BoxLayout;
017:        import javax.swing.JComponent;
018:        import javax.swing.JDialog;
019:        import javax.swing.JOptionPane;
020:        import javax.swing.KeyStroke;
021:        import javax.swing.WindowConstants;
022:
023:        import org.enhydra.jawe.JaWEComponent;
024:        import org.enhydra.jawe.JaWEComponentView;
025:        import org.enhydra.jawe.JaWEManager;
026:        import org.enhydra.jawe.JaWEComponentSettings;
027:        import org.enhydra.jawe.base.panel.InlinePanel;
028:        import org.enhydra.jawe.base.panel.PanelSettings;
029:        import org.enhydra.jawe.base.panel.panels.XMLPanel;
030:        import org.enhydra.shark.xpdl.XMLCollection;
031:        import org.enhydra.shark.xpdl.XMLElement;
032:        import org.enhydra.shark.xpdl.elements.Package;
033:
034:        /**
035:         *  
036:         */
037:        public class NewStandardXPDLElementEditor extends JDialog implements 
038:                JaWEComponent, Observer, XPDLElementEditor {
039:
040:            protected String type = JaWEComponent.OTHER_COMPONENT;
041:
042:            public final static int STATUS_OK = 0;
043:            public final static int STATUS_CANCEL = 1;
044:
045:            protected int status = STATUS_OK;
046:
047:            protected InlinePanel inlinePanel;
048:            protected PanelSettings settings;
049:
050:            public JaWEComponentSettings getSettings() {
051:                return settings;
052:            }
053:
054:            public NewStandardXPDLElementEditor(JaWEComponentSettings settings) {
055:                super (JaWEManager.getInstance().getJaWEController()
056:                        .getJaWEFrame());
057:                this .settings = (PanelSettings) settings;
058:                init();
059:            }
060:
061:            public void update(Observable o, Object arg) {
062:                return;
063:            }
064:
065:            public JaWEComponentView getView() {
066:                return inlinePanel;
067:            }
068:
069:            public String getType() {
070:                return type;
071:            }
072:
073:            public void setType(String type) {
074:                this .type = type;
075:            }
076:
077:            public String getName() {
078:                return "STANDARD_XPDL_EDITOR";
079:            }
080:
081:            public boolean adjustXPDL(Package pkg) {
082:                return false;
083:            }
084:
085:            public List checkValidity(XMLElement el, boolean fullCheck) {
086:                return null;
087:            }
088:
089:            public boolean canCreateElement(XMLCollection col) {
090:                return true;
091:            }
092:
093:            public boolean canInsertElement(XMLCollection col, XMLElement el) {
094:                return true;
095:            }
096:
097:            public boolean canModifyElement(XMLCollection col, XMLElement el) {
098:                return true;
099:            }
100:
101:            public boolean canModifyElement(XMLElement col) {
102:                return true;
103:            }
104:
105:            public boolean canRemoveElement(XMLCollection col, XMLElement el) {
106:                return true;
107:            }
108:
109:            public boolean canDuplicateElement(XMLCollection col, XMLElement el) {
110:                return true;
111:            }
112:
113:            public boolean canRepositionElement(XMLCollection col, XMLElement el) {
114:                return true;
115:            }
116:
117:            public void configure() {
118:            }
119:
120:            protected void init() {
121:                try {
122:                    ClassLoader cl = getClass().getClassLoader();
123:                    inlinePanel = (InlinePanel) cl
124:                            .loadClass(
125:                                    JaWEManager.getInstance()
126:                                            .getInlinePanelClassName())
127:                            .newInstance();
128:                } catch (Exception ex) {
129:                    String msg = "NewStandardXPDLElementEditor --> Problems while instantiating InlinePanel class '"
130:                            + JaWEManager.getInstance()
131:                                    .getInlinePanelClassName()
132:                            + "' - using default implementation!";
133:                    JaWEManager.getInstance().getLoggingManager()
134:                            .error(msg, ex);
135:                    inlinePanel = new InlinePanel();
136:                }
137:
138:                try {
139:                    inlinePanel.setJaWEComponent(this );
140:                    // settings must be initialized after creation of InlinePanel
141:                    this .settings.init(this );
142:                    inlinePanel.init();
143:
144:                    JaWEManager.getInstance().getJaWEController().addObserver(
145:                            this );
146:
147:                    initDialog();
148:
149:                } catch (Exception e) {
150:                    e.printStackTrace();
151:                }
152:            }
153:
154:            /** Returns the panel that is currently beeing edited. */
155:            public XMLPanel getEditingPanel() {
156:                return inlinePanel.getViewPanel();
157:            }
158:
159:            public XMLElement getEditingElement() {
160:                return inlinePanel.getActiveElement();
161:            }
162:
163:            public void editXPDLElement(XMLElement el) {
164:                inlinePanel.setActiveElement(el);
165:                if (el != null) {
166:                    setTitle(JaWEManager.getInstance().getLabelGenerator()
167:                            .getLabel(el));
168:                }
169:
170:                setDialogVisible();
171:            }
172:
173:            public void editXPDLElement() {
174:                editXPDLElement(JaWEManager.getInstance().getJaWEController()
175:                        .getSelectionManager().getSelectedElement());
176:            }
177:
178:            protected void setDialogVisible() {
179:                setSize(this .inlinePanel.getDisplay().getSize());
180:                pack();
181:                if (!isVisible()) {
182:                    setLocationRelativeTo(getParentWindow());
183:                    setVisible(true);
184:                }
185:                JaWEManager.getInstance().getJaWEController().adjustActions();
186:            }
187:
188:            public boolean canApplyChanges() {
189:                return true;
190:            }
191:
192:            public void requestFocus() {
193:                try {
194:                    inlinePanel.getDisplay().requestFocus();
195:                } catch (Exception ex) {
196:                    //         dialog.requestFocus();
197:                }
198:            }
199:
200:            public int getStatus() {
201:                return status;
202:            }
203:
204:            public Window getWindow() {
205:                return this ;
206:            }
207:
208:            public Window getParentWindow() {
209:                return JaWEManager.getInstance().getJaWEController()
210:                        .getJaWEFrame();
211:            }
212:
213:            protected void initDialog() {
214:                try {
215:                    Container cp = getContentPane();
216:                    cp.setLayout(new BoxLayout(cp, BoxLayout.Y_AXIS));
217:
218:                    cp.add(inlinePanel.getDisplay());
219:                    getRootPane()
220:                            .getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW)
221:                            .put(
222:                                    KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE,
223:                                            0, false), "Cancel");
224:                    getRootPane().getInputMap(JComponent.WHEN_FOCUSED)
225:                            .put(
226:                                    KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE,
227:                                            0, false), "Cancel");
228:                    getRootPane().getActionMap().put("Cancel",
229:                            new AbstractAction() {
230:                                public void actionPerformed(ActionEvent e) {
231:                                    al.actionPerformed(e);
232:                                }
233:                            });
234:                    addWindowListener(wl);
235:
236:                } catch (Exception e) {
237:                    e.printStackTrace();
238:                }
239:                setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
240:                setResizable(true);
241:                setModal(true);
242:            }
243:
244:            protected WindowListener wl = new WindowAdapter() {
245:                public void windowClosing(WindowEvent e) {
246:                    close();
247:                }
248:            };
249:
250:            protected ActionListener al = new ActionListener() {
251:                public void actionPerformed(ActionEvent ae) {
252:                    close();
253:                }
254:            };
255:
256:            public InlinePanel getInlinePanel() {
257:                return this .inlinePanel;
258:            }
259:
260:            public void close() {
261:                status = STATUS_CANCEL;
262:                if (inlinePanel.isModified()) {
263:                    int sw = inlinePanel.showModifiedWarning();
264:                    if (sw == JOptionPane.CANCEL_OPTION
265:                            || (sw == JOptionPane.YES_OPTION && inlinePanel
266:                                    .isModified()))
267:                        return;
268:                }
269:                setVisible(false);
270:                inlinePanel.setActiveElement(null);
271:                JaWEManager.getInstance().getJaWEController().adjustActions();
272:                getInlinePanel().cleanup();
273:                dispose();
274:            }
275:
276:            public XPDLElementEditor getParentEditor() {
277:                return null;
278:            }
279:
280:            public void setModified(boolean modif) {
281:
282:            }
283:
284:            public void setUpdateInProgress(boolean inProgress) {
285:            }
286:
287:            public boolean isUpdateInProgress() {
288:                return false;
289:            }
290:
291:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.