Source Code Cross Referenced for NavigationCaseEdge.java in  » IDE-Netbeans » web.core » org » netbeans » modules » web » jsf » navigation » 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 » web.core » org.netbeans.modules.web.jsf.navigation 
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-2006 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:         * NavigationCaseNode.java
042:         *
043:         * Created on March 17, 2007, 9:56 AM
044:         *
045:         * To change this template, choose Tools | Template Manager
046:         * and open the template in the editor.
047:         */
048:
049:        package org.netbeans.modules.web.jsf.navigation;
050:
051:        import java.awt.Image;
052:        import java.io.IOException;
053:        import java.lang.reflect.InvocationTargetException;
054:        import javax.swing.JOptionPane;
055:        import org.netbeans.modules.web.jsf.api.facesmodel.JSFConfigModel;
056:        import org.netbeans.modules.web.jsf.api.facesmodel.NavigationCase;
057:        import org.netbeans.modules.web.jsf.api.facesmodel.NavigationRule;
058:        import org.netbeans.modules.web.jsf.navigation.graph.PageFlowSceneElement;
059:        import org.openide.ErrorManager;
060:        import org.openide.cookies.OpenCookie;
061:        import org.openide.cookies.SaveCookie;
062:        import org.openide.nodes.AbstractNode;
063:        import org.openide.nodes.Children;
064:        import org.openide.nodes.Node;
065:        import org.openide.nodes.Node.Cookie;
066:        import org.openide.nodes.PropertySupport;
067:        import org.openide.nodes.Sheet;
068:        import org.openide.nodes.Sheet.Set;
069:        import org.openide.util.Exceptions;
070:        import org.openide.util.HelpCtx;
071:        import org.openide.util.NbBundle;
072:
073:        /**
074:         *
075:         * @author joelle
076:         */
077:        public final class NavigationCaseEdge extends PageFlowSceneElement {
078:            private final NavigationCase navCase;
079:            private final String toViewID;
080:            private final PageFlowController pc;
081:
082:            public NavigationCaseEdge(PageFlowController pc,
083:                    NavigationCase navCase) {
084:                super ();
085:                this .navCase = navCase;
086:                //        toViewID = navCase.getToViewId();
087:                toViewID = FacesModelUtility.getToViewIdFiltered(navCase);
088:                this .pc = pc;
089:
090:                //            createProperties(navCase, new NavigationCaseBeanInfo());
091:            }
092:
093:            @Override
094:            public String toString() {
095:                return new String("NavigationCaseEdge[FromOutcome="
096:                        + getFromOuctome() + " ToViewId=" + getToViewId()
097:                        + " FromViewId=" + getFromViewId() + "] ");
098:            }
099:
100:            public String getToViewId() {
101:                //        assert  navCase.getToViewId().equals(toViewID);
102:                return toViewID;
103:            }
104:
105:            public String getFromOuctome() {
106:                if (navCase != null && navCase.getModel() != null) {
107:                    return navCase.getFromOutcome();
108:                }
109:                return null;
110:            }
111:
112:            public String getFromAction() {
113:                if (navCase != null && navCase.getModel() != null) {
114:                    return navCase.getFromAction();
115:                }
116:                return null;
117:            }
118:
119:            public boolean isRedirected() {
120:                return navCase.isRedirected();
121:            }
122:
123:            public String getFromViewId() {
124:                if (navCase != null && navCase.getModel() != null) {
125:                    NavigationRule navRule = (NavigationRule) (navCase
126:                            .getParent());
127:                    if (navRule != null) {
128:                        //                return navRule.getFromViewId();
129:                        return FacesModelUtility.getFromViewIdFiltered(navRule);
130:                    }
131:                }
132:                return null;
133:            }
134:
135:            public boolean canRename() {
136:                return true;
137:            }
138:
139:            public void setName(String newName) {
140:                Pin pin = pc.getView().getEdgeSourcePin(this );
141:                if (pin != null && !pin.isDefault()) {
142:                    pin.setFromOutcome(newName);
143:                }
144:                pc.setModelNavigationCaseName(navCase, newName);
145:                super .setName(newName);
146:            }
147:
148:            private static final String MSG_FacesConfigIllegalStateWarning = NbBundle
149:                    .getMessage(NavigationCaseEdge.class,
150:                            "MSG_FacesConfigIllegalStateWarning");
151:            private static final String TLE_FacesConfigIllegalStateWarning = NbBundle
152:                    .getMessage(NavigationCaseEdge.class,
153:                            "TLE_FacesConfigIllegalStateWarning");
154:
155:            @Override
156:            public String getName() {
157:                String name = "";
158:                if (navCase.getModel() != null) {
159:                    try {
160:                        name = navCase.getFromOutcome() != null ? navCase
161:                                .getFromOutcome() : navCase.getFromAction();
162:                    } catch (IllegalStateException ise) {
163:                        JOptionPane.showMessageDialog(null,
164:                                MSG_FacesConfigIllegalStateWarning,
165:                                TLE_FacesConfigIllegalStateWarning,
166:                                JOptionPane.WARNING_MESSAGE);
167:                    }
168:                }
169:                return name;
170:            }
171:
172:            public boolean canDestroy() {
173:                return true;
174:            }
175:
176:            public void destroy() throws IOException {
177:                boolean deleteRuleTo = false;
178:                pc.removeModelNavigationCase(navCase);
179:                if (navNode != null) {
180:                    navNode.destroy();
181:                }
182:            }
183:
184:            public HelpCtx getHelpCtx() {
185:                throw new UnsupportedOperationException("Not supported yet.");
186:            }
187:
188:            public Image getIcon(int type) {
189:                return null;
190:            }
191:
192:            public Node getNode() {
193:                if (navNode == null) {
194:                    navNode = new NavNode(this );
195:                }
196:                return navNode;
197:            }
198:
199:            private Node navNode;
200:
201:            private class NavNode extends AbstractNode {
202:                private final NavigationCaseEdge edge;
203:
204:                public NavNode(NavigationCaseEdge edge) {
205:                    super (Children.LEAF);
206:                    this .edge = edge;
207:                }
208:
209:                @Override
210:                protected Sheet createSheet() {
211:                    Sheet s = Sheet.createDefault();
212:                    Set ss = s.get("general"); // NOI18N
213:                    if (ss == null) {
214:                        ss = new Sheet.Set();
215:                        ss.setName("general"); // NOI18N
216:                        ss.setDisplayName(NbBundle.getMessage(
217:                                NavigationCaseEdge.class, "General")); // NOI18N
218:                        ss.setShortDescription(NbBundle.getMessage(
219:                                NavigationCaseEdge.class, "GeneralHint")); // NOI18N
220:                        s.put(ss);
221:                    }
222:                    Set gs = ss;
223:
224:                    try {
225:                        PropertySupport.Reflection<String> p;
226:
227:                        p = new ModelProperty(navCase, String.class,
228:                                "getFromOutcome", "setFromOutcome"); // NOI18N
229:                        p.setName("fromOutcome"); // NOI18N
230:                        p.setDisplayName(NbBundle.getMessage(
231:                                NavigationCaseEdge.class, "Outcome")); // NOI18N
232:                        p.setShortDescription(NbBundle.getMessage(
233:                                NavigationCaseEdge.class, "OutcomeHint")); // NOI18N
234:                        ss.put(p);
235:
236:                        p = new ModelProperty(navCase, String.class,
237:                                "getFromAction", "setFromAction"); // NOI18N
238:                        p.setName("fromView"); // NOI18N
239:                        p.setDisplayName(NbBundle.getMessage(
240:                                NavigationCaseEdge.class, "FromAction")); // NOI18N
241:                        p.setShortDescription(NbBundle.getMessage(
242:                                NavigationCaseEdge.class, "FromActionHint")); // NOI18N
243:                        //                p.setValue(PageSelector.PROPERTY_NAVDOC, document);
244:                        //                p.setPropertyEditorClass(PageSelector.class);
245:                        ss.put(p);
246:
247:                        p = new ModelProperty(navCase, String.class,
248:                                "getToViewId", "setToViewId"); // NOI18N
249:                        p.setName("toViewId"); // NOI18N
250:                        p.setDisplayName(NbBundle.getMessage(
251:                                NavigationCaseEdge.class, "ToViewId")); // NOI18N
252:                        p.setShortDescription(NbBundle.getMessage(
253:                                NavigationCaseEdge.class, "ToViewHint")); // NOI18N
254:                        //                p.setValue(PageSelector.PROPERTY_NAVDOC, document);
255:                        //                p.setPropertyEditorClass(PageSelector.class);
256:                        ss.put(p);
257:
258:                    } catch (NoSuchMethodException nsme) {
259:                        ErrorManager.getDefault().notify(nsme);
260:                    }
261:
262:                    return s;
263:                }
264:
265:                //        public void save() throws IOException {
266:                //            //            pc.getConfigDataObject().getEditorSupport().saveDocument();
267:                //            getCookie(SaveCookie.class).save();
268:                //            
269:                //            pc.serializeNodeLocations();
270:                //        }
271:
272:                @SuppressWarnings("unchecked")
273:                public <T extends Cookie> T getCookie(Class<T> type) {
274:                    if (type.equals(SaveCookie.class)) {
275:                        pc.serializeNodeLocations();
276:                        return pc.getConfigDataObject().getCookie(type);
277:                    } else if (type.equals(OpenCookie.class)) {
278:                        return (T) new OpenCookie() {
279:                            public void open() {
280:                                pc.openNavigationCase(edge);
281:                            }
282:                        };
283:                    }
284:                    return null;
285:                }
286:
287:                @Override
288:                public boolean canRename() {
289:                    return isModifiable();
290:                }
291:
292:                @Override
293:                public String getName() {
294:                    return edge.getName();
295:                }
296:
297:                @Override
298:                public void setName(String s) {
299:                    super .setName(s);
300:                    edge.setName(s);
301:                }
302:
303:            }
304:
305:            public class ModelProperty extends
306:                    PropertySupport.Reflection<String> {
307:
308:                public ModelProperty(Object instance, Class<String> valueType,
309:                        String getter, String setter)
310:                        throws NoSuchMethodException {
311:                    super (instance, valueType, getter, setter);
312:                }
313:
314:                @Override
315:                public void setValue(String val) throws IllegalAccessException,
316:                        IllegalArgumentException, InvocationTargetException {
317:
318:                    JSFConfigModel model = navCase.getModel();
319:                    model.startTransaction();
320:                    super .setValue(val);
321:                    model.endTransaction();
322:                    try {
323:                        model.sync();
324:                    } catch (IOException ex) {
325:                        Exceptions.printStackTrace(ex);
326:                    }
327:
328:                }
329:
330:            }
331:
332:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.