public SyncWindows(String s) { super(s); ijInstance = IJ.getInstance(); if (instance!=null) { WindowManager.toFront(instance); return; } instance = this; panel = controlPanel(); add(panel); pack(); setResizable(false); IJ.register(this.getClass()); if (location==null) location = getLocation(); else setLocation(location); updateWindowList(); WindowManager.addWindow(this); ImagePlus.addImageListener(this); Executer.addCommandListener(this); show(); }
/** Implementation of ActionListener interface. */ public void actionPerformed(ActionEvent e) { // Determine which button was pressed. Object source = e.getSource(); if (source instanceof Button) { Button bpressed = (Button)source; if(bpressed==bSyncAll) { if (wList == null) return; // Select all items on list. Vector v = new Vector(); Integer I; for(int i=0; i<wList.getItemCount();++i) { wList.select(i); I = (Integer)vListMap.elementAt(i); v.addElement(I); } addWindows(v); } else if(bpressed==bUnsyncAll) { removeAllWindows(); } } else if (wList != null && source == wList) { // Doubleclick on entry in wList addSelections(); } }
protected void updateWindowList() { // Don't build a new window list, while the old one is removed. // When an StackWindow is replaced by an OpenStackWindow, updateWindowList // is called again and the other components in the panel are removed, also. Component newWindowList = buildWindowList(); panel.remove(0); panel.add(newWindowList,BorderLayout.NORTH,0); pack(); }
public static void setZ(ImageWindow source, int slice) { SyncWindows syncWindows = instance; if (syncWindows==null || !syncWindows.synced(source)) return; DisplayChangeEvent event=new DisplayChangeEvent(source, DisplayChangeEvent.Z, slice); syncWindows.displayChanged(event); }
return; imp = getImageFromVector(n); if (imp != null) { iw = imp.getWindow(); p = getMatchingCoords(ic, icc, x, y); else { p.x = x; setCursor(imp, null); if (iw != iwc) ic.mouseExited(adaptEvent(e, ic, p)); storeCanvasState(icc);
/** Build window list display and button controls. * Create Hashtable that connects list entries to window IDs.*/ protected Panel controlPanel() { Panel p = new Panel(); BorderLayout layout = new BorderLayout(); layout.setVgap(3); p.setLayout(layout); p.add(buildWindowList(), BorderLayout.NORTH,0); p.add(buildControlPanel(), BorderLayout.CENTER,1); return p; }
/** Override parent windowClosing method to clean up synchronized resources on exit. */ public void windowClosing(WindowEvent e) { if(e.getSource() == this) { removeAllWindows(); ImagePlus.removeImageListener(this); Executer.removeCommandListener(this); close(); } }
/** Item Listener method */ public void itemStateChanged(ItemEvent e) { // safest way to get matching of selected windows in list and in plugin: // deselect all windows in plugin and then select all in list // A List often does not do what you expect. if (wList != null && e.getSource() == wList) { if(vwins != null) { // unsynchronize all windows and remove from window list Integer I; for(int n = 0; n<vwins.size();++n) { I = (Integer)vwins.elementAt(n); removeWindow(I); } vwins.removeAllElements(); } addSelections(); } if (cCoords != null && e.getSource() == cCoords) { if (cScaling != null && e.getStateChange() == ItemEvent.DESELECTED) cScaling.setState(false); } if (cScaling != null && e.getSource() == cScaling) { if (cCoords != null && e.getStateChange() == ItemEvent.SELECTED) cCoords.setState(true); } }
private void addSelections() { if(wList == null) return; // nothing to select int[] listIndexes = wList.getSelectedIndexes(); Integer I; Vector v = new Vector(); for(int n=0; n<listIndexes.length;++n) { I = (Integer)vListMap.elementAt(listIndexes[n]); v.addElement(I); } addWindows(v); }
return; imp = getImageFromVector(n); if (imp != null) { iw = imp.getWindow(); p = getMatchingCoords(ic, icc, x, y); else { p.x = x; setCursor(imp, null); if (iw != iwc) ic.mouseExited(adaptEvent(e, ic, p)); storeCanvasState(icc);
public static void setC(ImageWindow source, int channel) { SyncWindows syncWindows = instance; if (syncWindows==null || !syncWindows.synced(source)) return; DisplayChangeEvent event=new DisplayChangeEvent(source, DisplayChangeEvent.CHANNEL, channel); syncWindows.displayChanged(event); }
/** Build window list display and button controls. * Create Hashtable that connects list entries to window IDs.*/ protected Panel controlPanel() { Panel p = new Panel(); BorderLayout layout = new BorderLayout(); layout.setVgap(3); p.setLayout(layout); p.add(buildWindowList(), BorderLayout.NORTH,0); p.add(buildControlPanel(), BorderLayout.CENTER,1); return p; }
/** Override parent windowClosing method to clean up synchronized resources on exit. */ public void windowClosing(WindowEvent e) { if(e.getSource() == this) { removeAllWindows(); ImagePlus.removeImageListener(this); Executer.removeCommandListener(this); close(); } }
/** Item Listener method */ public void itemStateChanged(ItemEvent e) { // safest way to get matching of selected windows in list and in plugin: // deselect all windows in plugin and then select all in list // A List often does not do what you expect. if (wList != null && e.getSource() == wList) { if(vwins != null) { // unsynchronize all windows and remove from window list Integer I; for(int n = 0; n<vwins.size();++n) { I = (Integer)vwins.elementAt(n); removeWindow(I); } vwins.removeAllElements(); } addSelections(); } if (cCoords != null && e.getSource() == cCoords) { if (cScaling != null && e.getStateChange() == ItemEvent.DESELECTED) cScaling.setState(false); } if (cScaling != null && e.getSource() == cScaling) { if (cCoords != null && e.getStateChange() == ItemEvent.SELECTED) cCoords.setState(true); } }
private void addSelections() { if(wList == null) return; // nothing to select int[] listIndexes = wList.getSelectedIndexes(); Integer I; Vector v = new Vector(); for(int n=0; n<listIndexes.length;++n) { I = (Integer)vListMap.elementAt(listIndexes[n]); v.addElement(I); } addWindows(v); }
return; imp = getImageFromVector(n); if (imp != null) { iw = imp.getWindow(); p = getMatchingCoords(ic, icc, x, y); ic.mouseEntered(adaptEvent(e, ic, p)); storeCanvasState(icc);
public SyncWindows(String s) { super(s); ijInstance = IJ.getInstance(); if (instance!=null) { WindowManager.toFront(instance); return; } instance = this; panel = controlPanel(); add(panel); pack(); setResizable(false); IJ.register(this.getClass()); if (location==null) location = getLocation(); else setLocation(location); updateWindowList(); WindowManager.addWindow(this); ImagePlus.addImageListener(this); Executer.addCommandListener(this); show(); }
public static void setT(ImageWindow source, int frame) { SyncWindows syncWindows = instance; if (syncWindows==null || !syncWindows.synced(source)) return; DisplayChangeEvent event = new DisplayChangeEvent(source, DisplayChangeEvent.T, frame); syncWindows.displayChanged(event); }
/** Implementation of ActionListener interface. */ public void actionPerformed(ActionEvent e) { // Determine which button was pressed. Object source = e.getSource(); if (source instanceof Button) { Button bpressed = (Button)source; if(bpressed==bSyncAll) { if (wList == null) return; // Select all items on list. Vector v = new Vector(); Integer I; for(int i=0; i<wList.getItemCount();++i) { wList.select(i); I = (Integer)vListMap.elementAt(i); v.addElement(I); } addWindows(v); } else if(bpressed==bUnsyncAll) { removeAllWindows(); } } else if (wList != null && source == wList) { // Doubleclick on entry in wList addSelections(); } }
protected void updateWindowList() { // Don't build a new window list, while the old one is removed. // When an StackWindow is replaced by an OpenStackWindow, updateWindowList // is called again and the other components in the panel are removed, also. Component newWindowList = buildWindowList(); panel.remove(0); panel.add(newWindowList,BorderLayout.NORTH,0); pack(); }