/** Provides node that should represent this data object. * <p>The default implementation creates an instance of {@link DataNode}. * Most subclasses will override this method to provide a <code>DataNode</code> * (usually subclassed). * <P> * This method is called only once per data object. * <p>It is strongly recommended that the resulting node will, when asked for * the cookie <samp>DataObject.class</samp>, return this same data object. * <p>It is also recommended that the node: * <ol> * <li>Base its name on {@link #getName}. * <li>Base its display name additionally on {@link DataNode#getShowFileExtensions}. * <li>Tune its display name and icon according to {@link org.openide.filesystems.FileSystem.Status}. * </ol> * @return the node delegate (without parent) for this data object * @see <a href="doc-files/api.html#create-delegate">Datasystems API - Creating a node delegate</a> */ protected Node createNodeDelegate () { return new DataNode (this, Children.LEAF); }
@Override public DataObject getDataObject() { return super.getDataObject(); }
/** * Create the properties sheet for the node */ @Override protected Sheet createSheet() { // Just add properties to default property tab (they used to be in a special 'Building Tab') Sheet defaultSheet = super.createSheet(); CndPropertiesProvider.getDefault().addExtraProperties(this, defaultSheet); return defaultSheet; }
protected Node createNodeDelegate () { DataNode dn = new DataNode (this, org.openide.nodes.Children.LEAF); // netbeans.core.nodes.description dn.setShortDescription (NbBundle.getMessage (DefaultDataObject.class, "HINT_DefaultDataObject")); // NOI18N return dn; }
/** Computes correct node for given XMLDataObject. */ private Node findNode () { Node n = (Node)getIP ().lookupCookie (Node.class); if (n == null) { DataNode d = new DataNode (XMLDataObject.this, Children.LEAF); d.setIconBase ("org/openide/loaders/xmlObject"); // NOI18N d.setDefaultAction (SystemAction.get (OpenAction.class)); return d; } else { return n; } }
DataNode dn = new DataNode(shadow, Children.LEAF); nodeName = dn.getDisplayName(); obj = shadow.getOriginal(); n = obj.getNodeDelegate();
/** * Provides node that should represent this data object. * * @return the node representation * @see DataNode */ @Override protected Node createNodeDelegate () { if (associateLookup() >= 1) { DataNode node = new DataNode(this, Children.LEAF, new ProxyLookup(getLookup(), Lookups.fixed(new SimpleLayer(pf.getName()), getIsobusRaster()))); node.setIconBaseWithExtension("nl/cloudfarming/client/isobus/type/isobus_taskdata_grid.png"); return node; } DataNode dataNode = (DataNode) super.createNodeDelegate (); return dataNode; }
protected Sheet createSheet () { Sheet s = Sheet.createDefault (); Sheet.Set ss = s.get (Sheet.PROPERTIES); Node.Property p; p = createNameProperty (obj); ss.put (p); FileObject fo = getDataObject().getPrimaryFile(); if (couldBeTemplate(fo) && !fo.isReadOnly()) { try { p = new PropertySupport.Reflection(obj, Boolean.TYPE, "isTemplate", "setTemplate"); // NOI18N p.setName(DataObject.PROP_TEMPLATE); p.setDisplayName(DataObject.getString("PROP_template")); p.setShortDescription(DataObject.getString("HINT_template")); ss.put(p); } catch (Exception ex) { throw new InternalError(); } } if (fo.isData()) { ss.put(new AllFilesProperty()); ss.put(new SizeProperty()); ss.put(new LastModifiedProperty()); } return s; }
public Image getIcon( int type) { if ( type == BeanInfo.ICON_COLOR_32x32 || type == BeanInfo.ICON_MONO_32x32) { return getData().getIcon32(); } return super.getIcon(type); }
/** Get default action. In the current implementation the *<code>null</code> is returned in case the underlying data * object is a template. The templates should not have any default * action. * @return no action if the underlying data object is a template. * Otherwise the abstract node's default action is returned, if <code>null</code> then * the first action returned from getActions (false) method is used. */ public Action getPreferredAction () { if (obj.isTemplate ()) { return null; } else { Action action = super.getPreferredAction (); if (action != null) { return action; } Action[] arr = getActions(false); if (arr != null && arr.length > 0) { return arr[0]; } return null; } }
public Transferable clipboardCopy() throws IOException { Transferable t = super.clipboardCopy(); addPaletteFlavor(t); return t; }
/** * Overrides default action from DataNode. * Instantiate a template, if isTemplate() returns true. * Opens otherwise. */ @Override public Action getPreferredAction() { Action result = super.getPreferredAction(); return result == null ? SystemAction.get(OpenAction.class) : result; }
public String getDisplayName() { if (!fileLoaded) loadFile(); if (displayName == null) { displayName = getExplicitDisplayName(); if (displayName == null) { // no explicit name displayName = super.getDisplayName(); } } return displayName; }
DataNode dn = new DataNode(shadow, Children.LEAF); nodeName = dn.getDisplayName(); obj = shadow.getOriginal(); n = obj.getNodeDelegate();
private java.awt.Image getExplicitIcon(int type) { if (type == BeanInfo.ICON_COLOR_32x32 || type == BeanInfo.ICON_MONO_32x32) { if (icon32URL != null) { // explicit icon specified in file try { return java.awt.Toolkit.getDefaultToolkit().getImage( new java.net.URL(icon32URL)); } catch (java.net.MalformedURLException ex) {} // ignore } else if (getPrimaryFile().getAttribute("SystemFileSystem.icon32") != null) // NOI18N return super.getIcon(type); } else { // get small icon in other cases if (icon16URL != null) { // explicit icon specified in file try { return java.awt.Toolkit.getDefaultToolkit().getImage( new java.net.URL(icon16URL)); } catch (java.net.MalformedURLException ex) {} // ignore } else if (getPrimaryFile().getAttribute("SystemFileSystem.icon") != null) // NOI18N return super.getIcon(type); } return null; }
mimeTypeToActions.put (mimeType, actions.toArray (new Action [actions.size ()])); else mimeTypeToActions.put (mimeType, super.getActions (context));
public Transferable clipboardCopy() throws IOException { ExTransferable t = ExTransferable.create( super.clipboardCopy() ); Lookup lookup = getLookup(); ActiveEditorDrop drop = lookup.lookup(ActiveEditorDrop.class); ActiveEditorDropTransferable s = new ActiveEditorDropTransferable(drop); t.put(s); //do not allow external DnD flavors otherwise some items may get interpreted //as an external file dropped into the editor window return new NoExternalDndTransferable( t ); }
/** * Overrides default action from DataNode. * Instantiate a template, if isTemplate() returns true. * Opens otherwise. */ @Override public Action getPreferredAction() { Action result = super.getPreferredAction(); return result == null ? SystemAction.get(OpenAction.class) : result; }
/** Get the display name for the node. * A filesystem may {@link org.openide.filesystems.FileSystem#getStatus specially alter} this. * @return the desired name */ public String getDisplayName () { String name = (String) getDataObject().getPrimaryFile(). getAttribute(InstanceDataObject.EA_NAME); if (name == null) { try { String def = "\b"; // NOI18N FileSystem.Status fsStatus = getDataObject().getPrimaryFile(). getFileSystem().getStatus(); name = fsStatus.annotateName(def, getDataObject().files()); if (name.indexOf(def) < 0) { return name; } else { name = getNameForBean(); if (name != null) { name = fsStatus.annotateName (name, getDataObject().files()); } else { name = super.getDisplayName(); } } } catch (FileStateInvalidException e) { // no fs, do nothing } } return name; }
/******************************************************************************************************************* * * ******************************************************************************************************************/ @Override public Transferable paste() throws IOException { pasteAction.paste(node.getDataObject()); return null; } }