/** This method was added to achieve firing events that attributes * were changed after setDelegates. Events are not fired reliable but this solution was * choosed because of performance reasons. Attributes name is set to null - what means * that one of attributes was probably changed. */ void updateAllAfterSetDelegates(FileSystem[] oldFileSystems) { try { getMultiFileSystem().beginAtomicAction(); FileSystem[] fileSystems = getMultiFileSystem().getDelegates(); Enumeration<AbstractFolder> en = existingSubFiles(true); while (en.hasMoreElements()) { MultiFileObject mfo = (MultiFileObject) en.nextElement(); if (mfo.isFolder() && !mfo.isInitialized()) { continue; } if (mfo.hasListeners()) { String path = mfo.getPath(); FileObject oldLeader = findLeader(oldFileSystems, path); FileObject newLeader = findLeader(fileSystems, path); if ((oldLeader != null) && (newLeader != null) && !oldLeader.equals(newLeader)) { mfo.fileAttributeChanged0(new FileAttributeEvent(mfo, null, null, null)); } } mfo.freeAttribCache(); mfo.refresh(true); } } finally { getMultiFileSystem().finishAtomicAction(); } }
try { ev.inheritPostNotify(fe); fileAttributeChanged0(ev); } finally { ev.setPostNotify(null);
fileAttributeChanged0(new FileAttributeEvent(this, attrName, oldValue, value));
/** Fired when a file attribute is changed. * @param fe the event describing context where action has taken place, * the name of attribute and the old and new values. */ public void fileAttributeChanged(FileAttributeEvent fe) { // [PENDING] this is not at all sufficient to notify every change in attributes. // One, parent dirs of front filesystems can now hold attributes for missing // files. Two, non-leader files can have attributes too which are merged in. // In principle all files/folders whose path is a prefix of this path on all // contained filesystems should be listened to for attribute change events. if (!hasAtLeastOneListeners () || leader == null) return; /** If change is not fired from leader then leader may mask this attribute * and then event should not be fired */ if (!fe.getFile().equals(leader) && fe.getName() != null && leader.getAttribute (fe.getName()) != null) return; /** If change is not fired from leader then another delegate may mask this attribute * and then event should not be fired. */ if (!fe.getFile().equals(leader) && fe.getNewValue() != null && fe.getName() != null && !fe.getNewValue().equals (getAttribute (fe.getName()))) return; fileAttributeChanged0 (new FileAttributeEvent ( this, fe.getName(), fe.getOldValue(), fe.getNewValue())); }
/** Fired when a file attribute is changed. * @param fe the event describing context where action has taken place, * the name of attribute and the old and new values. */ public void fileAttributeChanged(FileAttributeEvent fe) { // [PENDING] this is not at all sufficient to notify every change in attributes. // One, parent dirs of front filesystems can now hold attributes for missing // files. Two, non-leader files can have attributes too which are merged in. // In principle all files/folders whose path is a prefix of this path on all // contained filesystems should be listened to for attribute change events. if (!hasAtLeastOneListeners () || leader == null) return; /** If change is not fired from leader then leader may mask this attribute * and then event should not be fired */ if (!fe.getFile().equals(leader) && fe.getName() != null && leader.getAttribute (fe.getName()) != null) return; /** If change is not fired from leader then another delegate may mask this attribute * and then event should not be fired. */ if (!fe.getFile().equals(leader) && fe.getNewValue() != null && fe.getName() != null && !fe.getNewValue().equals (getAttribute (fe.getName()))) return; fileAttributeChanged0 (new FileAttributeEvent ( this, fe.getName(), fe.getOldValue(), fe.getNewValue())); }
mfo.fileAttributeChanged0(new FileAttributeEvent(mfo,null,null,null));
mfo.fileAttributeChanged0(new FileAttributeEvent(mfo,null,null,null));
fileAttributeChanged0 (new FileAttributeEvent (this,attrName,oldValue,value));
fileAttributeChanged0 (new FileAttributeEvent (this,attrName,oldValue,value));