public String getDisplayName () { if (format == null) { format = new MessageFormat (NbBundle.getBundle (DataShadow.class).getString ("FMT_shadowName")); } String n = format.format (createArguments ()); try { obj.getPrimaryFile().getFileSystem().getStatus().annotateName(n, obj.files()); } catch (FileStateInvalidException fsie) { // ignore } return n; }
public void setName (String name) { try { if (!name.equals (obj.getName ())) { obj.rename (name); if (obj.original.getPrimaryFile ().isRoot ()) { obj.getPrimaryFile ().setAttribute (ATTR_USEOWNNAME, Boolean.TRUE); } fireDisplayNameChange (null, null); fireNameChange (null, null); } } catch (IOException ex) { throw new IllegalArgumentException (ex.getMessage ()); } }
/** Clones the property sheet of original node. */ private Sheet cloneSheet () { PropertySet[] sets = this.getOriginal ().getPropertySets (); Sheet s = new Sheet (); for (int i = 0; i < sets.length; i++) { Sheet.Set ss = new Sheet.Set (); ss.put (sets[i].getProperties ()); ss.setName (sets[i].getName ()); ss.setDisplayName (sets[i].getDisplayName ()); ss.setShortDescription (sets[i].getShortDescription ()); // modifies the set if it contains name of object property modifySheetSet (ss); s.put (ss); } return s; }
public Node cloneNode () { ShadowNode sn = new ShadowNode (obj); return sn; }
protected Node createNodeDelegate () { return new ShadowNode (this); }
/** Returns modified properties of the original node. * @return property sets */ public PropertySet[] getPropertySets () { Sheet s = sheet; if (s == null) { s = sheet = cloneSheet (); } return s.toArray (); }
private void originalChanged () { DataObject ori = obj.getOriginal(); if (ori.isValid()) { changeOriginal (ori.getNodeDelegate(), true); } else { updateShadowOriginal(obj); } }
public Image getOpenedIcon(int type) { Image i = rootIcon(type); if (i != null) { return i; } else { return super.getOpenedIcon(type); } } private Image rootIcon(int type) {
public String getShortDescription () { if (descriptionFormat == null) { descriptionFormat = new MessageFormat ( NbBundle.getBundle (DataShadow.class).getString ("FMT_shadowHint") ); } return descriptionFormat.format (createArguments ()); }
/** * This implementation only calls clipboardCopy supposing that * copy to clipboard and copy by d'n'd are similar. * * @return transferable to represent this node during a drag * @exception IOException when the * cut cannot be performed */ public Transferable drag () throws IOException { return clipboardCopy (); }
public Image getIcon(int type) { Image i = rootIcon(type); if (i != null) { return i; } else { return super.getIcon(type); } } public Image getOpenedIcon(int type) {