1 19 package org.netbeans.modules.web.jsf.navigation.vwmodel; 20 21 import org.netbeans.modules.web.jsf.navigation.vwmodel.PageSelector; 22 import org.netbeans.modules.web.jsf.navigation.vwmodel.Link; 23 import org.netbeans.modules.web.jsf.navigation.*; 24 import java.awt.datatransfer.Transferable ; 25 import java.util.List ; 26 import org.openide.ErrorManager; 27 import org.openide.nodes.Children; 28 import org.openide.loaders.DataObject; 29 import org.openide.nodes.AbstractNode; 30 import org.openide.nodes.Node; 31 import org.openide.nodes.PropertySupport; 32 import org.openide.nodes.Sheet; 33 import org.openide.nodes.PropertySupport.Reflection; 34 import org.openide.nodes.Sheet.Set; 35 import org.openide.util.NbBundle; 36 37 42 public class LinkNode extends AbstractNode { 43 private Link link; 44 private DataObject dobj; 45 private NavigationModel document; 46 47 public LinkNode(DataObject dobj, NavigationModel document, Link link) { 48 super(Children.LEAF); 49 this.document = document; 50 this.link = link; 51 this.dobj = dobj; 52 } 53 54 61 62 protected Sheet createSheet() { 63 Sheet s = Sheet.createDefault(); 64 Set ss = s.get("general"); if (ss == null) { 66 ss = new Sheet.Set(); 67 ss.setName("general"); ss.setDisplayName(NbBundle.getMessage(LinkNode.class, "General")); ss.setShortDescription(NbBundle.getMessage(LinkNode.class, "GeneralHint")); s.put(ss); 71 } 72 Set gs = ss; 73 74 try { 75 PropertySupport.Reflection p; 76 77 p = new Reflection(link, String .class, "getFromOutcome", "setFromOutcome"); p.setName("fromOutcome"); p.setDisplayName(NbBundle.getMessage(LinkNode.class, "Outcome")); p.setShortDescription(NbBundle.getMessage(LinkNode.class, "OutcomeHint")); ss.put(p); 82 83 p = new Reflection(link, String .class, "getFromView", "setFromView"); p.setName("fromView"); p.setDisplayName(NbBundle.getMessage(LinkNode.class, "FromView")); p.setShortDescription(NbBundle.getMessage(LinkNode.class, "FromViewHint")); p.setValue(PageSelector.PROPERTY_NAVDOC, document); 88 p.setPropertyEditorClass(PageSelector.class); 89 ss.put(p); 90 91 p = new Reflection(link, String .class, "getToView", "setToView"); p.setName("toView"); p.setDisplayName(NbBundle.getMessage(LinkNode.class, "ToView")); p.setShortDescription(NbBundle.getMessage(LinkNode.class, "ToViewHint")); p.setValue(PageSelector.PROPERTY_NAVDOC, document); 96 p.setPropertyEditorClass(PageSelector.class); 97 ss.put(p); 98 99 } catch (NoSuchMethodException nsme) { 100 ErrorManager.getDefault().notify(nsme); 101 } 102 103 return s; 104 } 105 106 115 118 public Node.Cookie getCookie(Class cl) { 119 Node.Cookie c = super.getCookie(cl); 120 if (c != null) { 121 return c; 122 } 123 if (dobj != null) { 124 return dobj.getCookie(cl); 125 } 126 return null; 127 } 128 129 public boolean canRename() { 130 return false; 131 } 132 133 public boolean canDestroy() { 134 return false; 136 } 137 138 143 public boolean canCopy() { 144 return false; 145 } 146 147 152 public boolean canCut() { 153 return false; 155 } 156 157 158 protected void createPasteTypes(Transferable t, List s) { 159 } 160 161 172 173 public final String getDisplayName() { 174 return link.getNavcase().getFromOutcome(); 175 } 176 177 } 178 | Popular Tags |