From 6ef2cc9eceb80a6b2fdc6e1ebfaa0642c01c9c51 Mon Sep 17 00:00:00 2001 From: Jean-Marie Burel Date: Thu, 28 May 2015 14:56:05 +0100 Subject: [PATCH 001/131] Set the OMERO image Id after saving it. --- .../agents/fsimporter/util/FileImportComponent.java | 8 +++++++- .../shoola/env/data/model/FileObject.java | 12 ++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/components/insight/SRC/org/openmicroscopy/shoola/agents/fsimporter/util/FileImportComponent.java b/components/insight/SRC/org/openmicroscopy/shoola/agents/fsimporter/util/FileImportComponent.java index 7c72bf72622..ccba70df906 100644 --- a/components/insight/SRC/org/openmicroscopy/shoola/agents/fsimporter/util/FileImportComponent.java +++ b/components/insight/SRC/org/openmicroscopy/shoola/agents/fsimporter/util/FileImportComponent.java @@ -928,7 +928,13 @@ public void setStatus(Object image) } else if (image instanceof List) { List list = new ArrayList((List) image); int m = list.size(); - imageLabel.setData(list.get(0)); + ThumbnailData data = list.get(0); + long iid = data.getImageID(); + if (data.getImage() != null) { + iid = data.getImage().getId(); + } + getFile().setImageID(iid); + imageLabel.setData(data); list.remove(0); if (list.size() > 0) { ThumbnailLabel label = imageLabels.get(0); diff --git a/components/insight/SRC/org/openmicroscopy/shoola/env/data/model/FileObject.java b/components/insight/SRC/org/openmicroscopy/shoola/env/data/model/FileObject.java index 33ecfe2d5bc..a905a7e879a 100644 --- a/components/insight/SRC/org/openmicroscopy/shoola/env/data/model/FileObject.java +++ b/components/insight/SRC/org/openmicroscopy/shoola/env/data/model/FileObject.java @@ -82,6 +82,18 @@ public FileObject(Object file) this.file = file; } + /** + * Sets the omero image Id after saving the image. + * + * @param id The value to set. + */ + public void setImageID(long id) + { + if (!isImagePlus()) return; + ImagePlus image = (ImagePlus) file; + image.setProperty(OMERO_GROUP, id); + } + /** * Add the associated file if any. * From 83fb21d063d7fb5f1ec3ef9e156b52f7567788ba Mon Sep 17 00:00:00 2001 From: Jean-Marie Burel Date: Thu, 28 May 2015 15:27:53 +0100 Subject: [PATCH 002/131] Set the omero id post import --- .../org/openmicroscopy/shoola/env/data/model/FileObject.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/insight/SRC/org/openmicroscopy/shoola/env/data/model/FileObject.java b/components/insight/SRC/org/openmicroscopy/shoola/env/data/model/FileObject.java index a905a7e879a..04df31ebf84 100644 --- a/components/insight/SRC/org/openmicroscopy/shoola/env/data/model/FileObject.java +++ b/components/insight/SRC/org/openmicroscopy/shoola/env/data/model/FileObject.java @@ -91,7 +91,7 @@ public void setImageID(long id) { if (!isImagePlus()) return; ImagePlus image = (ImagePlus) file; - image.setProperty(OMERO_GROUP, id); + image.setProperty(OMERO_ID, id); } /** From bad705fcd912d28966a114157bcc40c8023477b8 Mon Sep 17 00:00:00 2001 From: Jean-Marie Burel Date: Fri, 29 May 2015 22:37:33 +0100 Subject: [PATCH 003/131] Fix group ctx issue. --- .../shoola/env/data/views/calls/ResultsSaver.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/components/insight/SRC/org/openmicroscopy/shoola/env/data/views/calls/ResultsSaver.java b/components/insight/SRC/org/openmicroscopy/shoola/env/data/views/calls/ResultsSaver.java index 32d212f094f..6ac870ccdfe 100644 --- a/components/insight/SRC/org/openmicroscopy/shoola/env/data/views/calls/ResultsSaver.java +++ b/components/insight/SRC/org/openmicroscopy/shoola/env/data/views/calls/ResultsSaver.java @@ -20,6 +20,7 @@ */ package org.openmicroscopy.shoola.env.data.views.calls; +import ij.IJ; import ij.ImagePlus; import java.io.File; @@ -121,7 +122,9 @@ private void saveROIandTableResults() file = (FileObject) o; id = file.getOMEROID(); if (id >= 0) { - ctx = new SecurityContext(file.getGroupID()); + if (file.getGroupID() > 0) { + ctx = new SecurityContext(file.getGroupID()); + } ImagePlus img = (ImagePlus) file.getFile(); rois = reader.readImageJROIFromSources(id, img); //create a tmp file. @@ -145,6 +148,7 @@ public void doCall() { imageID, fa); } } catch (Exception e) { + IJ.log("error:"+e.toString()); context.getLogger().error(this, "Cannot Save the ROIs results: " +e.getMessage()); @@ -172,7 +176,9 @@ private void saveTableResults() file = (FileObject) o; id = file.getOMEROID(); if (id >= 0) { - ctx = new SecurityContext(file.getGroupID()); + if (file.getGroupID() > 0) { + ctx = new SecurityContext(file.getGroupID()); + } ImagePlus img = (ImagePlus) file.getFile(); //create a tmp file. File f = createFile(img); @@ -221,7 +227,9 @@ private void saveROI() file = (FileObject) o; id = file.getOMEROID(); if (id >= 0) { - ctx = new SecurityContext(file.getGroupID()); + if (file.getGroupID() > 0) { + ctx = new SecurityContext(file.getGroupID()); + } ImagePlus img = (ImagePlus) file.getFile(); rois = reader.readImageJROIFromSources(id, img); if (CollectionUtils.isNotEmpty(rois)) { From 119a0c137a61c10cd86590f939e35c369bfab857 Mon Sep 17 00:00:00 2001 From: Jean-Marie Burel Date: Fri, 5 Jun 2015 09:43:08 +0200 Subject: [PATCH 004/131] Add ability to run script from viewer. --- .../agents/events/iviewer/ScriptDisplay.java | 70 ++++++++++++++++++ .../shoola/agents/imviewer/IconManager.java | 10 ++- .../imviewer/graphx/nuvola_script_run16.png | Bin 0 -> 3642 bytes .../shoola/agents/imviewer/view/ToolBar.java | 52 ++++++------- .../agents/treeviewer/TreeViewerAgent.java | 21 ++++++ 5 files changed, 121 insertions(+), 32 deletions(-) create mode 100644 components/insight/SRC/org/openmicroscopy/shoola/agents/events/iviewer/ScriptDisplay.java create mode 100644 components/insight/SRC/org/openmicroscopy/shoola/agents/imviewer/graphx/nuvola_script_run16.png diff --git a/components/insight/SRC/org/openmicroscopy/shoola/agents/events/iviewer/ScriptDisplay.java b/components/insight/SRC/org/openmicroscopy/shoola/agents/events/iviewer/ScriptDisplay.java new file mode 100644 index 00000000000..bab06023b97 --- /dev/null +++ b/components/insight/SRC/org/openmicroscopy/shoola/agents/events/iviewer/ScriptDisplay.java @@ -0,0 +1,70 @@ +/* + *------------------------------------------------------------------------------ + * Copyright (C) 2015 University of Dundee. All rights reserved. + * + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + *------------------------------------------------------------------------------ + */ +package org.openmicroscopy.shoola.agents.events.iviewer; + +import java.awt.Component; +import java.awt.Point; + +import org.openmicroscopy.shoola.env.event.RequestEvent; + + +/** + * Event posted to load the script to run. + * @author Jean-Marie Burel      + * j.burel@dundee.ac.uk + * @since 5.1 + */ +public class ScriptDisplay + extends RequestEvent +{ + + /** The component triggering the event.*/ + private Component source; + + /** The location of the mouse pressed.*/ + private Point location; + + /** + * Creates a new instance. + * + * @param source The invoker. + */ + public ScriptDisplay(Component source) + { + this.source = source; + location = new Point(0, 0); + } + + /** + * Returns the component invoking the event. + * + * @return See above. + */ + public Component getSource() { return source; } + + /** + * Returns the location of the mouse pressed. + * + * @return See above. + */ + public Point getLocation() { return location; } + +} diff --git a/components/insight/SRC/org/openmicroscopy/shoola/agents/imviewer/IconManager.java b/components/insight/SRC/org/openmicroscopy/shoola/agents/imviewer/IconManager.java index 8e183486f88..a1fe37e87bd 100644 --- a/components/insight/SRC/org/openmicroscopy/shoola/agents/imviewer/IconManager.java +++ b/components/insight/SRC/org/openmicroscopy/shoola/agents/imviewer/IconManager.java @@ -292,13 +292,16 @@ public class IconManager /** The Read Write Group icon. */ public static final int READ_WRITE_GROUP = 79; - + + /** The Analysis icon. */ + public static final int ANALYSIS_RUN = 80; + /** * The maximum ID used for the icon IDs. * Allows to correctly build arrays for direct indexing. */ - private static final int MAX_ID = 79; - + private static final int MAX_ID = 80; + /** Paths of the icon files. */ private static String[] relPaths = new String[MAX_ID+1]; @@ -382,6 +385,7 @@ public class IconManager relPaths[READ_LINK_GROUP] = "group_read_annotate16.png"; relPaths[PUBLIC_GROUP] = "group_public_read16.png"; relPaths[READ_WRITE_GROUP] = "group_read_write16.png"; + relPaths[ANALYSIS_RUN] = "nuvola_script_run16.png"; } /** The sole instance. */ diff --git a/components/insight/SRC/org/openmicroscopy/shoola/agents/imviewer/graphx/nuvola_script_run16.png b/components/insight/SRC/org/openmicroscopy/shoola/agents/imviewer/graphx/nuvola_script_run16.png new file mode 100644 index 0000000000000000000000000000000000000000..246f48cff286ae04c64d624a0748fdd7ba13fe8c GIT binary patch literal 3642 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 M07*qoM6N<$g1MyA2><{9 literal 0 HcmV?d00001 diff --git a/components/insight/SRC/org/openmicroscopy/shoola/agents/imviewer/view/ToolBar.java b/components/insight/SRC/org/openmicroscopy/shoola/agents/imviewer/view/ToolBar.java index 38a0c038bbd..4fb9eb325a5 100644 --- a/components/insight/SRC/org/openmicroscopy/shoola/agents/imviewer/view/ToolBar.java +++ b/components/insight/SRC/org/openmicroscopy/shoola/agents/imviewer/view/ToolBar.java @@ -25,10 +25,12 @@ //Java imports +import java.awt.Component; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; + import javax.swing.Action; import javax.swing.Box; import javax.swing.BoxLayout; @@ -42,9 +44,11 @@ import javax.swing.JToggleButton; import javax.swing.JToolBar; + + //Third-party libraries import org.jdesktop.swingx.JXBusyLabel; - +import org.openmicroscopy.shoola.agents.events.iviewer.ScriptDisplay; //Application-internal dependencies import org.openmicroscopy.shoola.agents.imviewer.IconManager; import org.openmicroscopy.shoola.agents.imviewer.ImViewerAgent; @@ -162,6 +166,9 @@ class ToolBar /** The index of the Metadata component. */ private static final int METADATA_INDEX = 1; + /** Button to bring available script.*/ + private JButton script; + /** * Returns the icon corresponding to the permissions of the group. * @@ -244,33 +251,7 @@ private void createControlsBar() bar.add(b); bar.add(pasteButton); - /* - b = new JButton( - controller.getAction(ImViewerControl.UNDO_RND_SETTINGS)); - UIUtilities.unifiedButtonLookAndFeel(b); - bar.add(b); - - b = new JButton( - controller.getAction(ImViewerControl.RESET_RND_SETTINGS)); - UIUtilities.unifiedButtonLookAndFeel(b); - bar.add(b); - b = new JButton(controller.getAction( - ImViewerControl.SET_RND_SETTINGS_MIN_MAX)); - UIUtilities.unifiedButtonLookAndFeel(b); - bar.add(b); - - b = new JButton(controller.getAction( - ImViewerControl.SET_OWNER_RND_SETTINGS)); - UIUtilities.unifiedButtonLookAndFeel(b); - bar.add(b); - */ - /* - Action a = controller.getAction(ImViewerControl.USER); - b = new JButton(a); - b.addMouseListener((UserAction) a); - UIUtilities.unifiedButtonLookAndFeel(b); - bar.add(b); - */ + b = new JButton( controller.getAction(ImViewerControl.SAVE_RND_SETTINGS)); UIUtilities.unifiedButtonLookAndFeel(b); @@ -301,11 +282,12 @@ private void createControlsBar() b = new JButton(controller.getAction(ImViewerControl.SAVE)); UIUtilities.unifiedButtonLookAndFeel(b); bar.add(b); + bar.add(script); a = controller.getAction(ImViewerControl.ACTIVITY); b = new JButton(a); b.addMouseListener((ActivityImageAction) a); UIUtilities.unifiedButtonLookAndFeel(b); - //bar.add(b); + //bar.add(b); Dimension d = new Dimension(w, h); busyLabel = new JXBusyLabel(d); busyLabel.setEnabled(true); @@ -326,6 +308,18 @@ private void initComponents() interpolation = new JCheckBox(); interpolation.setBackground(getBackground()); interpolation.setToolTipText("Enables/Disables interpolation when images are scaled up"); + script = new JButton(); + IconManager im = IconManager.getInstance(); + script.setIcon(im.getIcon(IconManager.ANALYSIS_RUN)); + UIUtilities.unifiedButtonLookAndFeel(script); + script.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + ScriptDisplay evt = new ScriptDisplay((Component) e.getSource()); + ImViewerAgent.getRegistry().getEventBus().post(evt); + } + }); createControlsBar(); } diff --git a/components/insight/SRC/org/openmicroscopy/shoola/agents/treeviewer/TreeViewerAgent.java b/components/insight/SRC/org/openmicroscopy/shoola/agents/treeviewer/TreeViewerAgent.java index c2785201f38..b5414c515cf 100644 --- a/components/insight/SRC/org/openmicroscopy/shoola/agents/treeviewer/TreeViewerAgent.java +++ b/components/insight/SRC/org/openmicroscopy/shoola/agents/treeviewer/TreeViewerAgent.java @@ -46,6 +46,7 @@ + import org.openmicroscopy.shoola.agents.events.hiviewer.DownloadEvent; //Application-internal dependencies import org.openmicroscopy.shoola.agents.events.importer.BrowseContainer; @@ -53,6 +54,7 @@ import org.openmicroscopy.shoola.agents.events.importer.LoadImporter; import org.openmicroscopy.shoola.agents.events.iviewer.CopyRndSettings; import org.openmicroscopy.shoola.agents.events.iviewer.RndSettingsCopied; +import org.openmicroscopy.shoola.agents.events.iviewer.ScriptDisplay; import org.openmicroscopy.shoola.agents.events.iviewer.ViewerCreated; import org.openmicroscopy.shoola.agents.events.metadata.AnnotatedEvent; import org.openmicroscopy.shoola.agents.events.treeviewer.BrowserSelectionEvent; @@ -524,6 +526,21 @@ private void handleDownloadEvent(DownloadEvent evt) viewer.download(evt.getFolder(), evt.isOverride()); } + /** + * Updates the view when the mode is changed. + * + * @param evt The event to handle. + */ + private void handleScriptDisplay(ScriptDisplay evt) + { + if (evt == null) return; + ExperimenterData exp = (ExperimenterData) registry.lookup( + LookupNames.CURRENT_USER_DETAILS); + if (exp == null) return; + TreeViewer viewer = TreeViewerFactory.getTreeViewer(exp); + viewer.showMenu(TreeViewer.AVAILABLE_SCRIPTS_MENU, evt.getSource(), + evt.getLocation()); + } /** * Implemented as specified by {@link Agent}. * @see Agent#activate(boolean) @@ -592,6 +609,7 @@ public void setContext(Registry ctx) bus.register(this, SearchSelectionEvent.class); bus.register(this, SaveEvent.class); bus.register(this, DownloadEvent.class); + bus.register(this, ScriptDisplay.class); } /** @@ -658,6 +676,9 @@ else if (e instanceof SaveEvent) handleSaveEvent((SaveEvent) e); else if (e instanceof DownloadEvent) handleDownloadEvent((DownloadEvent) e); + else if (e instanceof ScriptDisplay) { + handleScriptDisplay((ScriptDisplay) e); + } } } From 90f6c01306f96d3434f3ff02e9ebda0992a9e022 Mon Sep 17 00:00:00 2001 From: Jean-Marie Burel Date: Fri, 5 Jun 2015 10:25:28 +0200 Subject: [PATCH 005/131] Display script menu next to invoker. --- .../agents/events/iviewer/ScriptDisplay.java | 13 +++++++++++- .../agents/treeviewer/ScriptsLoader.java | 21 +++++++++++++++++-- .../agents/treeviewer/view/ToolBar.java | 5 ++++- .../treeviewer/view/TreeViewerComponent.java | 2 +- .../treeviewer/view/TreeViewerModel.java | 8 +++++-- 5 files changed, 42 insertions(+), 7 deletions(-) diff --git a/components/insight/SRC/org/openmicroscopy/shoola/agents/events/iviewer/ScriptDisplay.java b/components/insight/SRC/org/openmicroscopy/shoola/agents/events/iviewer/ScriptDisplay.java index bab06023b97..35061778a4e 100644 --- a/components/insight/SRC/org/openmicroscopy/shoola/agents/events/iviewer/ScriptDisplay.java +++ b/components/insight/SRC/org/openmicroscopy/shoola/agents/events/iviewer/ScriptDisplay.java @@ -50,7 +50,18 @@ public class ScriptDisplay public ScriptDisplay(Component source) { this.source = source; - location = new Point(0, 0); + } + + /** + * Creates a new instance. + * + * @param source The invoker. + * @param location The location of the mouse pressed. + */ + public ScriptDisplay(Component source, Point location) + { + this.source = source; + this.location = location; } /** diff --git a/components/insight/SRC/org/openmicroscopy/shoola/agents/treeviewer/ScriptsLoader.java b/components/insight/SRC/org/openmicroscopy/shoola/agents/treeviewer/ScriptsLoader.java index 0d87a8167e9..0502411412e 100644 --- a/components/insight/SRC/org/openmicroscopy/shoola/agents/treeviewer/ScriptsLoader.java +++ b/components/insight/SRC/org/openmicroscopy/shoola/agents/treeviewer/ScriptsLoader.java @@ -26,11 +26,19 @@ //Java imports +import java.awt.Component; import java.awt.Point; import java.util.List; //Third-party libraries + + + +import javax.swing.JButton; + + +import org.openmicroscopy.shoola.agents.events.iviewer.ScriptDisplay; //Application-internal dependencies import org.openmicroscopy.shoola.agents.treeviewer.browser.Browser; import org.openmicroscopy.shoola.agents.treeviewer.view.TreeViewer; @@ -64,7 +72,10 @@ public class ScriptsLoader /** Flag indicating to load the scripts with a given UI.*/ private boolean ui; - + + /** The invoker.*/ + private Component source; + /** * Creates a new instance. * @@ -73,13 +84,15 @@ public class ScriptsLoader * @param all Pass true to retrieve all the scripts uploaded * ones and the default ones, false. * @param location The location of the mouse click. + * @param source The invoker */ public ScriptsLoader(TreeViewer viewer, SecurityContext ctx, boolean all, - Point location) + Point location, Component source) { super(viewer, ctx); this.all = all; this.location = location; + this.source = source; } /** @@ -113,6 +126,10 @@ public void handleResult(Object result) { if (viewer.getState() == Browser.DISCARDED) return; viewer.setAvailableScripts((List) result, location); + if (location == null && source instanceof JButton) { + ScriptDisplay evt = new ScriptDisplay(source, new Point(0, 0)); + TreeViewerAgent.getRegistry().getEventBus().post(evt); + } } /** diff --git a/components/insight/SRC/org/openmicroscopy/shoola/agents/treeviewer/view/ToolBar.java b/components/insight/SRC/org/openmicroscopy/shoola/agents/treeviewer/view/ToolBar.java index d3304d5ab65..bf204669490 100644 --- a/components/insight/SRC/org/openmicroscopy/shoola/agents/treeviewer/view/ToolBar.java +++ b/components/insight/SRC/org/openmicroscopy/shoola/agents/treeviewer/view/ToolBar.java @@ -952,9 +952,12 @@ private List createMenuItem(boolean add) */ void showAvailableScriptsMenu(Component c, Point p) { - if (p == null) return; + if (p == null) { + p = new Point(0, 0); + }; if (c == null) { c = scriptButton; + repaint(); } IconManager icons = IconManager.getInstance(); Collection scripts = model.getAvailableScripts(); diff --git a/components/insight/SRC/org/openmicroscopy/shoola/agents/treeviewer/view/TreeViewerComponent.java b/components/insight/SRC/org/openmicroscopy/shoola/agents/treeviewer/view/TreeViewerComponent.java index 828bc488c08..c0b007ffe41 100644 --- a/components/insight/SRC/org/openmicroscopy/shoola/agents/treeviewer/view/TreeViewerComponent.java +++ b/components/insight/SRC/org/openmicroscopy/shoola/agents/treeviewer/view/TreeViewerComponent.java @@ -2206,7 +2206,7 @@ public void showMenu(int menuID, Component c, Point p) break; case AVAILABLE_SCRIPTS_MENU: if (model.getAvailableScripts() == null) { - model.loadScripts(p); + model.loadScripts(p, c); firePropertyChange(SCRIPTS_LOADING_PROPERTY, Boolean.valueOf(false), Boolean.valueOf(true)); return; diff --git a/components/insight/SRC/org/openmicroscopy/shoola/agents/treeviewer/view/TreeViewerModel.java b/components/insight/SRC/org/openmicroscopy/shoola/agents/treeviewer/view/TreeViewerModel.java index a83b1588a43..a13f69f00ca 100644 --- a/components/insight/SRC/org/openmicroscopy/shoola/agents/treeviewer/view/TreeViewerModel.java +++ b/components/insight/SRC/org/openmicroscopy/shoola/agents/treeviewer/view/TreeViewerModel.java @@ -25,6 +25,7 @@ //Java imports +import java.awt.Component; import java.awt.Point; import java.io.File; import java.util.ArrayList; @@ -39,6 +40,7 @@ import javax.activation.FileDataSource; + //Third-party libraries import org.apache.commons.collections.CollectionUtils; @@ -89,6 +91,7 @@ import org.openmicroscopy.shoola.env.rnd.RndProxyDef; import org.openmicroscopy.shoola.util.file.ImportErrorObject; import org.openmicroscopy.shoola.util.ui.UIUtilities; + import pojos.DataObject; import pojos.DatasetData; import pojos.ExperimenterData; @@ -1280,11 +1283,12 @@ ScriptObject getScript(long scriptID) * Loads the scripts. * * @param location The location of the mouse. + * @param invoker The invoker. */ - void loadScripts(Point location) + void loadScripts(Point location, Component invoker) { ScriptsLoader loader = new ScriptsLoader(component, - getSecurityContext(null), false, location); + getSecurityContext(null), false, location, invoker); loader.load(); } From 6a3641015c4aa34364fb4fcaf494ff749e7c4711 Mon Sep 17 00:00:00 2001 From: Jean-Marie Burel Date: Fri, 5 Jun 2015 10:39:29 +0200 Subject: [PATCH 006/131] Review refresh script --- .../shoola/agents/treeviewer/view/ToolBar.java | 7 ++++++- .../shoola/agents/treeviewer/view/TreeViewerControl.java | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/components/insight/SRC/org/openmicroscopy/shoola/agents/treeviewer/view/ToolBar.java b/components/insight/SRC/org/openmicroscopy/shoola/agents/treeviewer/view/ToolBar.java index bf204669490..b7cf727c6fd 100644 --- a/components/insight/SRC/org/openmicroscopy/shoola/agents/treeviewer/view/ToolBar.java +++ b/components/insight/SRC/org/openmicroscopy/shoola/agents/treeviewer/view/ToolBar.java @@ -978,7 +978,12 @@ public void mouseReleased(MouseEvent e) { model.setAvailableScripts(null); scriptsMenu = null; - controller.reloadAvailableScripts(e.getPoint()); + Point p = e.getPoint(); + if (e.getSource() != scriptButton) { + p = null; + } + controller.reloadAvailableScripts(p, + (Component) e.getSource()); } }); scriptsMenu.add(refresh); diff --git a/components/insight/SRC/org/openmicroscopy/shoola/agents/treeviewer/view/TreeViewerControl.java b/components/insight/SRC/org/openmicroscopy/shoola/agents/treeviewer/view/TreeViewerControl.java index b528947e134..c7af2d8707f 100644 --- a/components/insight/SRC/org/openmicroscopy/shoola/agents/treeviewer/view/TreeViewerControl.java +++ b/components/insight/SRC/org/openmicroscopy/shoola/agents/treeviewer/view/TreeViewerControl.java @@ -996,9 +996,9 @@ void activateUser() * * @param location The location of the mouse click. */ - void reloadAvailableScripts(Point location) + void reloadAvailableScripts(Point location, Component source) { - model.showMenu(TreeViewer.AVAILABLE_SCRIPTS_MENU, null, location); + model.showMenu(TreeViewer.AVAILABLE_SCRIPTS_MENU, source, location); } /** From c9c3a93d0e495af1567b1f3773bec76963c4926a Mon Sep 17 00:00:00 2001 From: Jean-Marie Burel Date: Fri, 5 Jun 2015 10:45:49 +0200 Subject: [PATCH 007/131] Fix possible NPE when updating a tag. --- .../shoola/agents/metadata/view/MetadataViewerComponent.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/insight/SRC/org/openmicroscopy/shoola/agents/metadata/view/MetadataViewerComponent.java b/components/insight/SRC/org/openmicroscopy/shoola/agents/metadata/view/MetadataViewerComponent.java index 9740f11c0f5..e3bf6e13680 100644 --- a/components/insight/SRC/org/openmicroscopy/shoola/agents/metadata/view/MetadataViewerComponent.java +++ b/components/insight/SRC/org/openmicroscopy/shoola/agents/metadata/view/MetadataViewerComponent.java @@ -561,7 +561,7 @@ public void saveData(DataToSave object, List toDelete, } } else if (refObject instanceof TagAnnotationData) { //Only update properties. - if ((toAdd.size() == 0 && toRemove.size() == 0)) { + if (CollectionUtils.isEmpty(toAdd) && CollectionUtils.isEmpty(toRemove)) { model.fireSaving(object, metadata, toSave, asynch); b = false; } From 62902c3a3b20bece5b08c5a67b3d2d918d95a38e Mon Sep 17 00:00:00 2001 From: Jean-Marie Burel Date: Mon, 8 Jun 2015 11:26:40 +0100 Subject: [PATCH 008/131] Clean up doc when listing import. --- .../shoola/agents/imviewer/view/ToolBar.java | 9 ++------- .../shoola/agents/treeviewer/ScriptsLoader.java | 12 +----------- 2 files changed, 3 insertions(+), 18 deletions(-) diff --git a/components/insight/SRC/org/openmicroscopy/shoola/agents/imviewer/view/ToolBar.java b/components/insight/SRC/org/openmicroscopy/shoola/agents/imviewer/view/ToolBar.java index 4fb9eb325a5..90f4e94090f 100644 --- a/components/insight/SRC/org/openmicroscopy/shoola/agents/imviewer/view/ToolBar.java +++ b/components/insight/SRC/org/openmicroscopy/shoola/agents/imviewer/view/ToolBar.java @@ -2,7 +2,7 @@ * org.openmicroscopy.shoola.agents.imviewer.view.ToolBar * *------------------------------------------------------------------------------ - * Copyright (C) 2006-2014 University of Dundee. All rights reserved. + * Copyright (C) 2006-2015 University of Dundee. All rights reserved. * * * This program is free software; you can redistribute it and/or modify @@ -23,8 +23,6 @@ package org.openmicroscopy.shoola.agents.imviewer.view; - -//Java imports import java.awt.Component; import java.awt.Dimension; import java.awt.FlowLayout; @@ -44,12 +42,9 @@ import javax.swing.JToggleButton; import javax.swing.JToolBar; - - -//Third-party libraries import org.jdesktop.swingx.JXBusyLabel; import org.openmicroscopy.shoola.agents.events.iviewer.ScriptDisplay; -//Application-internal dependencies + import org.openmicroscopy.shoola.agents.imviewer.IconManager; import org.openmicroscopy.shoola.agents.imviewer.ImViewerAgent; import org.openmicroscopy.shoola.agents.imviewer.actions.ActivityImageAction; diff --git a/components/insight/SRC/org/openmicroscopy/shoola/agents/treeviewer/ScriptsLoader.java b/components/insight/SRC/org/openmicroscopy/shoola/agents/treeviewer/ScriptsLoader.java index 0502411412e..ce999b029b8 100644 --- a/components/insight/SRC/org/openmicroscopy/shoola/agents/treeviewer/ScriptsLoader.java +++ b/components/insight/SRC/org/openmicroscopy/shoola/agents/treeviewer/ScriptsLoader.java @@ -2,7 +2,7 @@ * org.openmicroscopy.shoola.agents.treeviewer.ScriptsLoader * *------------------------------------------------------------------------------ - * Copyright (C) 2006-2011 University of Dundee & Open Microscopy Environment. + * Copyright (C) 2006-2015 University of Dundee & Open Microscopy Environment. * All rights reserved. * * @@ -24,22 +24,12 @@ package org.openmicroscopy.shoola.agents.treeviewer; - -//Java imports import java.awt.Component; import java.awt.Point; import java.util.List; - -//Third-party libraries - - - - import javax.swing.JButton; - import org.openmicroscopy.shoola.agents.events.iviewer.ScriptDisplay; -//Application-internal dependencies import org.openmicroscopy.shoola.agents.treeviewer.browser.Browser; import org.openmicroscopy.shoola.agents.treeviewer.view.TreeViewer; import org.openmicroscopy.shoola.env.data.events.DSCallAdapter; From eef24de743edfb32caffb3f31ed189a592280816 Mon Sep 17 00:00:00 2001 From: Dominik Lindner Date: Mon, 25 May 2015 11:58:00 +0100 Subject: [PATCH 009/131] Enable save button in preview pane --- .../shoola/agents/metadata/rnd/RendererModel.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/insight/SRC/org/openmicroscopy/shoola/agents/metadata/rnd/RendererModel.java b/components/insight/SRC/org/openmicroscopy/shoola/agents/metadata/rnd/RendererModel.java index 7084bce3f6a..65a45e452cd 100644 --- a/components/insight/SRC/org/openmicroscopy/shoola/agents/metadata/rnd/RendererModel.java +++ b/components/insight/SRC/org/openmicroscopy/shoola/agents/metadata/rnd/RendererModel.java @@ -1401,7 +1401,7 @@ boolean isSameSettings(RndProxyDef def, boolean checkPlane) */ boolean isModified() { if(rndControl!=null) { - return !rndControl.isSameSettings(rndDef, false); + return !rndControl.isSameSettings(rndDef, true); } return false; } From 1e5f7742b0d7b41cc425cb000f071bfcdcbb1785 Mon Sep 17 00:00:00 2001 From: Dominik Lindner Date: Mon, 25 May 2015 13:31:23 +0100 Subject: [PATCH 010/131] Don't save z/t on close --- .../shoola/agents/imviewer/view/ImViewerComponent.java | 1 - 1 file changed, 1 deletion(-) diff --git a/components/insight/SRC/org/openmicroscopy/shoola/agents/imviewer/view/ImViewerComponent.java b/components/insight/SRC/org/openmicroscopy/shoola/agents/imviewer/view/ImViewerComponent.java index b8edad9987c..ff54959c9eb 100644 --- a/components/insight/SRC/org/openmicroscopy/shoola/agents/imviewer/view/ImViewerComponent.java +++ b/components/insight/SRC/org/openmicroscopy/shoola/agents/imviewer/view/ImViewerComponent.java @@ -343,7 +343,6 @@ private boolean saveOnClose(boolean notifyUser) ImViewerAgent.getRegistry().getLogger().error(this, logMsg); } } - savePlane(); return true; } MessageBox msg = new MessageBox(view, "Save Data", From bc1cb3581e5d65d7461a6f070815f140a148d6fd Mon Sep 17 00:00:00 2001 From: Dominik Lindner Date: Mon, 25 May 2015 13:31:41 +0100 Subject: [PATCH 011/131] Enable save button on z/t change in full viewer --- .../shoola/agents/imviewer/view/ImViewerControl.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/components/insight/SRC/org/openmicroscopy/shoola/agents/imviewer/view/ImViewerControl.java b/components/insight/SRC/org/openmicroscopy/shoola/agents/imviewer/view/ImViewerControl.java index 24c27985627..e56b33031d9 100644 --- a/components/insight/SRC/org/openmicroscopy/shoola/agents/imviewer/view/ImViewerControl.java +++ b/components/insight/SRC/org/openmicroscopy/shoola/agents/imviewer/view/ImViewerControl.java @@ -2,7 +2,7 @@ * org.openmicroscopy.shoola.agents.iviewer.view.ImViewerControl * *------------------------------------------------------------------------------ - * Copyright (C) 2006-2014 University of Dundee. All rights reserved. + * Copyright (C) 2006-2015 University of Dundee. All rights reserved. * * * This program is free software; you can redistribute it and/or modify @@ -708,7 +708,11 @@ ViewerAction getZoomActionFromLevels(int levels) */ void setSelectedXYPlane(int z, int t, int bin) { - model.setSelectedXYPlane(z, t, bin); + boolean enableSave = z != model.getDefaultZ() + || t != model.getDefaultT(); + model.setSelectedXYPlane(z, t, bin); + if (enableSave) + actionsMap.get(SAVE_RND_SETTINGS).setEnabled(true); } /** From 7398931b3619bfab5e0c4c0ba816be5d9c0bd0e0 Mon Sep 17 00:00:00 2001 From: Dominik Lindner Date: Tue, 9 Jun 2015 09:07:23 +0100 Subject: [PATCH 012/131] Enable save also on z/t change via movie player --- .../shoola/agents/imviewer/view/ImViewerComponent.java | 10 ++++++++-- .../shoola/agents/imviewer/view/ImViewerModel.java | 7 ++++--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/components/insight/SRC/org/openmicroscopy/shoola/agents/imviewer/view/ImViewerComponent.java b/components/insight/SRC/org/openmicroscopy/shoola/agents/imviewer/view/ImViewerComponent.java index ff54959c9eb..81f9f5f6b9b 100644 --- a/components/insight/SRC/org/openmicroscopy/shoola/agents/imviewer/view/ImViewerComponent.java +++ b/components/insight/SRC/org/openmicroscopy/shoola/agents/imviewer/view/ImViewerComponent.java @@ -301,7 +301,7 @@ private boolean saveOnClose(boolean notifyUser) JPanel p = new JPanel(); p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS)); JCheckBox rndBox = null; - if (!model.isOriginalSettings()) { + if (!model.isOriginalSettings(false)) { rndBox = new JCheckBox(RND); rndBox.setSelected(true); p.add(rndBox); @@ -805,6 +805,9 @@ public void setColorModel(int key) */ public void setSelectedXYPlane(int z, int t, int bin) { + boolean enableSave = z != model.getDefaultZ() + || t != model.getDefaultT(); + if (z < 0) z = model.getDefaultZ(); if (t < 0) t = model.getRealSelectedT(); switch (model.getState()) { @@ -839,6 +842,9 @@ public void setSelectedXYPlane(int z, int t, int bin) newPlane = true; } model.setSelectedXYPlane(z, t, bin); + + if (enableSave) + controller.getAction(ImViewerControl.SAVE_RND_SETTINGS).setEnabled(true); } /** @@ -2741,7 +2747,7 @@ public boolean isOriginalSettings() throw new IllegalArgumentException("This method cannot be " + "invoked in the DISCARDED state."); } - return model.isOriginalSettings(); + return model.isOriginalSettings(true); } /** diff --git a/components/insight/SRC/org/openmicroscopy/shoola/agents/imviewer/view/ImViewerModel.java b/components/insight/SRC/org/openmicroscopy/shoola/agents/imviewer/view/ImViewerModel.java index 16927cac4dc..45875f9b234 100644 --- a/components/insight/SRC/org/openmicroscopy/shoola/agents/imviewer/view/ImViewerModel.java +++ b/components/insight/SRC/org/openmicroscopy/shoola/agents/imviewer/view/ImViewerModel.java @@ -2212,16 +2212,17 @@ void setImageData(ImageData image) /** * Returns true if the rendering settings are original, * false otherwise. - * + * @param checkPlane Pass true to take z/t changes into account, + * false to ignore them * @return See above. */ - boolean isOriginalSettings() + boolean isOriginalSettings(boolean checkPlane) { if (originalDef == null) return true; if (metadataViewer == null) return true; Renderer rnd = metadataViewer.getRenderer(); if (rnd == null) return true; - return isSameSettings(originalDef, false); + return isSameSettings(originalDef, checkPlane); } /** From e219a59850e5d37ff5bfc146ac6a4f09f640d38e Mon Sep 17 00:00:00 2001 From: Jean-Marie Burel Date: Tue, 9 Jun 2015 11:03:05 +0100 Subject: [PATCH 013/131] Clean up. --- .../shoola/agents/treeviewer/TreeViewerAgent.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/components/insight/SRC/org/openmicroscopy/shoola/agents/treeviewer/TreeViewerAgent.java b/components/insight/SRC/org/openmicroscopy/shoola/agents/treeviewer/TreeViewerAgent.java index c2785201f38..b1bbd7532a4 100644 --- a/components/insight/SRC/org/openmicroscopy/shoola/agents/treeviewer/TreeViewerAgent.java +++ b/components/insight/SRC/org/openmicroscopy/shoola/agents/treeviewer/TreeViewerAgent.java @@ -498,11 +498,9 @@ private void handleSearchSelectionEvent(SearchSelectionEvent evt) { /** Display the save dialog when used in plugin mode.*/ private void handleSaveEvent(SaveEvent evt) { - if (evt == null) return; ExperimenterData exp = (ExperimenterData) registry.lookup( LookupNames.CURRENT_USER_DETAILS); - if (exp == null) - return; + if (evt == null || exp == null) return; TreeViewer viewer = TreeViewerFactory.getTreeViewer(exp); SaveResultsAction a = new SaveResultsAction(viewer, LookupNames.IMAGE_J); a.actionPerformed( From 68b0e6df4d76bffc3f0d5f42de498fbc0fd71e1f Mon Sep 17 00:00:00 2001 From: Aleksandra Tarkowska Date: Tue, 9 Jun 2015 11:04:32 +0100 Subject: [PATCH 014/131] removing -locked suffix from the data manager --- .../webclient/data/container_subtree.html | 6 +- .../templates/webclient/data/containers.html | 107 +++++------------- .../webclient/data/containers_icon.html | 2 +- .../webclient/data/containers_tree.html | 26 ++--- 4 files changed, 46 insertions(+), 95 deletions(-) diff --git a/components/tools/OmeroWeb/omeroweb/webclient/templates/webclient/data/container_subtree.html b/components/tools/OmeroWeb/omeroweb/webclient/templates/webclient/data/container_subtree.html index 85cdfa26a48..bffc1c91fb2 100755 --- a/components/tools/OmeroWeb/omeroweb/webclient/templates/webclient/data/container_subtree.html +++ b/components/tools/OmeroWeb/omeroweb/webclient/templates/webclient/data/container_subtree.html @@ -24,7 +24,7 @@ {% if manager.containers.orphaned %} {% if manager.containers.images %} {% for d in manager.containers.images %} -
  • +
  • {{ d.name|default:"Image"|escape }} @@ -34,7 +34,7 @@ {% else %} {% if manager.containers.images %} {% for d in manager.containers.images %} -
  • +
  • {% if d.loaded %} {{ d.name|default:"Image"|escape }} @@ -48,7 +48,7 @@ {% if manager.plate %} {% if manager.plate.countPlateAcquisitions %} {% for e in manager.plate.listPlateAcquisitions %} -
  • +
  • {{ e.name|default:"Run"|escape|truncatebefor:"35" }}
  • {% endfor %} diff --git a/components/tools/OmeroWeb/omeroweb/webclient/templates/webclient/data/containers.html b/components/tools/OmeroWeb/omeroweb/webclient/templates/webclient/data/containers.html index 93d9390f245..7dbcc66d15d 100644 --- a/components/tools/OmeroWeb/omeroweb/webclient/templates/webclient/data/containers.html +++ b/components/tools/OmeroWeb/omeroweb/webclient/templates/webclient/data/containers.html @@ -89,7 +89,7 @@ var c = tree._get_children('#experimenter-0'); c.each(function(){ var $node = $(this), - rel = $node.attr('rel').replace("-locked",""), + rel = $node.attr('rel'), nodeTxt = OME.jsTreeNodeText($node); if (topNodes.hasOwnProperty(rel)) { topNodes[rel].push(nodeTxt.toLowerCase()); @@ -140,7 +140,7 @@ var pasteRenderingSettings = function(selected, owner, reset) { var ids = [], rdef_url = copy_paste_rdef_url, - rel = selected.attr('rel').replace('-locked',''); + rel = selected.attr('rel'); if (owner) { rdef_url = apply_owners_rdef_url; } else if (reset) { @@ -314,13 +314,13 @@ if (to_paste && to_paste[0].id.indexOf("image")>=0) { toolbar_config['paste'] = true; } - if (selected.parent().parent().length > 0 && selected.parent().parent().attr('rel').replace("-locked", "").indexOf("experimenter") < 0) { + if (selected.parent().parent().length > 0 && selected.parent().parent().attr('rel').indexOf("experimenter") < 0) { toolbar_config["copy"] = true; } } else if(selected.attr("id").indexOf("image")>=0) { toolbar_config['basket'] = true; toolbar_config['cut'] = true; - if (selected.parent().parent().length > 0 && selected.parent().parent().attr('rel').replace("-locked", "").indexOf("orphaned") < 0) { + if (selected.parent().parent().length > 0 && selected.parent().parent().attr('rel').indexOf("orphaned") < 0) { toolbar_config["copy"] = true; } } else if(selected.attr("id").indexOf("screen")>=0) { @@ -329,11 +329,11 @@ } } else if(selected.attr("id").indexOf("plate")>=0) { toolbar_config['copy'] = true; - if (selected.parent().parent().length > 0 && selected.parent().parent().attr('rel').replace("-locked", "").indexOf("experimenter") < 0) { + if (selected.parent().parent().length > 0 && selected.parent().parent().attr('rel').indexOf("experimenter") < 0) { toolbar_config["cut"] = true; } } - if ((inst.data.crrm.cp_nodes || inst.data.crrm.ct_nodes) && ($.inArray(selected.attr('rel').replace("-locked", ""), ["project", "dataset", "screen"]) > -1)) { + if ((inst.data.crrm.cp_nodes || inst.data.crrm.ct_nodes) && ($.inArray(selected.attr('rel'), ["project", "dataset", "screen"]) > -1)) { toolbar_config['paste'] = true; } } @@ -393,10 +393,10 @@ var url; if (n.attr) { var parent = this._get_parent(n); - if ($.inArray($(parent).attr("rel").replace("-locked", ""), ["project", "screen"]) > -1) { - url = "{% url 'load_data' %}"+$(parent).attr("rel").replace("-locked", "")+"/"+$(parent).attr("id").split("-")[1]+"/"+n.attr("rel").replace("-locked", "")+"/"+n.attr("id").split("-")[1]+"/"; + if ($.inArray($(parent).attr("rel"), ["project", "screen"]) > -1) { + url = "{% url 'load_data' %}"+$(parent).attr("rel")+"/"+$(parent).attr("id").split("-")[1]+"/"+n.attr("rel")+"/"+n.attr("id").split("-")[1]+"/"; } else { - url = "{% url 'load_data' %}"+n.attr("rel").replace("-locked", "")+"/"+n.attr("id").split("-")[1]+"/"; + url = "{% url 'load_data' %}"+n.attr("rel")+"/"+n.attr("id").split("-")[1]+"/"; } } else { url = "{% url 'load_data' %}"; @@ -407,7 +407,7 @@ // the parameter is the node being loaded (may be -1, 0, or undefined when loading the root nodes) "data" : function (n) { var r = { "view" : "tree" }; - if (n.attr && $.inArray(n.attr("rel").replace("-locked", ""), ["dataset", "orphaned"]) > -1) { + if (n.attr && $.inArray(n.attr("rel"), ["dataset", "orphaned"]) > -1) { // pagination supported for 'dataset' and 'orphaned'... var page = n.data("page") || null; // this data is added by OME.doPagination() if (page) r["page"] = page; @@ -423,10 +423,10 @@ // This will prevent moving or creating any other type as a root node "max_depth" : -1, "max_children" : -1, - "valid_children" : [ "experimenter", "experimenter-locked" ], + "valid_children" : [ "experimenter" ], "types" : { "experimenter" : { - "valid_children" : [ "project", "project-locked", "dataset", "dataset-locked", "screen", "screen-locked", "plate", "plate-locked" ], + "valid_children" : [ "project", "dataset", "screen", "plate" ], "icon" : { "image" : '{% static "webclient/image/icon_user.png" %}' }, @@ -436,36 +436,15 @@ "delete_node" : false, "remove" : false }, - "experimenter-locked" : { - "valid_children" : [ "project", "project-locked", "dataset", "dataset-locked", "screen", "screen-locked", "plate", "plate-locked" ], - "icon" : { - "image" : '{% static "webclient/image/icon_user.png" %}' - }, - "start_drag" : false - }, "project" : { - "valid_children" : [ "dataset", "dataset-locked" ], - "icon" : { - "image" : '{% static "webclient/image/folder16.png" %}' - }, - "start_drag" : false - }, - "project-locked" : { - "valid_children" : [ "dataset", "dataset-locked" ], + "valid_children" : [ "dataset" ], "icon" : { "image" : '{% static "webclient/image/folder16.png" %}' }, "start_drag" : false }, "dataset" : { - "valid_children" : [ "image", "image-locked" ], - "icon" : { - "image" : '{% static "webclient/image/folder_image16.png" %}' - }, - "start_drag" : function(obj){return obj.hasClass('canLink');} - }, - "dataset-locked" : { - "valid_children" : [ "image", "image-locked" ], + "valid_children" : [ "image" ], "icon" : { "image" : '{% static "webclient/image/folder_image16.png" %}' }, @@ -478,22 +457,8 @@ }, "start_drag" : function(obj){return obj.hasClass('canLink');} }, - "image-locked" : { - "valid_children" : "none", - "icon" : { - "image" : '{% static "webclient/image/image16.png" %}' - }, - "start_drag" : function(obj){return obj.hasClass('canLink');} - }, "screen" : { - "valid_children" : [ "plate", "plate-locked" ], - "icon" : { - "image" : '{% static "webclient/image/folder_screen16.png" %}' - }, - "start_drag" : false - }, - "screen-locked" : { - "valid_children" : [ "plate", "plate-locked" ], + "valid_children" : [ "plate" ], "icon" : { "image" : '{% static "webclient/image/folder_screen16.png" %}' }, @@ -506,13 +471,6 @@ }, "start_drag" : function(obj){return obj.hasClass('canLink');} }, - "plate-locked" : { - "valid_children" : "acquisition", - "icon" : { - "image" : '{% static "webclient/image/folder_plate16.png" %}' - }, - "start_drag" : function(obj){return obj.hasClass('canLink');} - }, "acquisition" : { "valid_children" : "none", "icon" : { @@ -520,13 +478,6 @@ }, "create_node" : false }, - "acquisition-locked" : { - "valid_children" : "none", - "icon" : { - "image" : '{% static "webclient/image/image16.png" %}' - }, - "start_drag" : false - }, "orphaned" : { "valid_children" : [ "image", "image_locked" ], "icon" : { @@ -542,9 +493,9 @@ var p = this._get_parent(m.r); if(!p) return false; if (p == -1) return true; - if ($.inArray(m.r.attr("rel").replace("-locked", ""), ["orphaned"]) > -1) + if ($.inArray(m.r.attr("rel"), ["orphaned"]) > -1) return false; - if ($.inArray(p.attr("rel").replace("-locked", ""), ["orphaned"]) > -1) + if ($.inArray(p.attr("rel"), ["orphaned"]) > -1) return false; if (!m.cr.hasClass("canLink")) return false; @@ -643,7 +594,7 @@ config["basket"] = { "label" : "Add to Basket", - "icon" : '{% static "webclient/image/icon_basic_basket_16.png" %}', + "icon" : '{% static "webclient/image/icon_basic_basket_16.png" %}', "action": function(){ OME.addToBasket(this.get_selected(), '{% url 'update_basket' %}'); } @@ -778,7 +729,7 @@ config["renderingsettings"]["_disabled"] = false; config["renderingsettings"]["submenu"]["copy_rdef"]["_disabled"] = false; } - if($.inArray(obj.attr("rel").replace('-locked',''), ["image", "dataset", "plate", "acquisition"])>=0) { + if($.inArray(obj.attr("rel"), ["image", "dataset", "plate", "acquisition"])>=0) { // if 'canAnnotate' then we can paste settings to image/dataset/plate if(obj.hasClass('canAnnotate')) { config["renderingsettings"]["_disabled"] = false; @@ -808,7 +759,7 @@ obj_rel = $this.parent().attr('rel'), ob_id = $this.parent().attr('id'), iid; - if ((obj_rel=='image') || (obj_rel=='image-locked')) { + if (obj_rel=='image') { iid = ob_id.split("-")[1]; OME.openPopup("{% url 'web_image_viewer' 0 %}".replace('/0/', "/" + iid + "/")); } @@ -829,28 +780,28 @@ var remove = false; var url; if (data.inst.data.crrm.cp_nodes) { - url = '{% url 'manage_action_containers' "paste" %}'+$(this).attr("rel").replace("-locked","")+'/'+$(this).attr("id").split("-")[1]+'/' + url = '{% url 'manage_action_containers' "paste" %}'+$(this).attr("rel")+'/'+$(this).attr("id").split("-")[1]+'/' d = { - "destination" : data.rslt.np.attr("rel").replace("-locked","") +'-'+data.rslt.np.attr("id").split("-")[1] + "destination" : data.rslt.np.attr("rel") +'-'+data.rslt.np.attr("id").split("-")[1] } } else { // 'cr' is destination, 'op' is current parent if (data.rslt.cr.attr('rel')!="orphaned") { - url = '{% url 'manage_action_containers' "move" %}'+$(this).attr("rel").replace("-locked","")+'/'+$(this).attr("id").split("-")[1]+'/'; + url = '{% url 'manage_action_containers' "move" %}'+$(this).attr("rel")+'/'+$(this).attr("id").split("-")[1]+'/'; var p = "orphaned-0"; // ...but parent may be project if we are orphaning a dataset or drag'n'drop image if (data.rslt.op.attr("rel")) { - p = data.rslt.op.attr("rel").replace("-locked","")+'-'+data.rslt.op.attr("id").split("-")[1]; + p = data.rslt.op.attr("rel")+'-'+data.rslt.op.attr("id").split("-")[1]; } var d = { "parent" : p, - "destination" : data.rslt.np.attr("rel").replace("-locked","") +'-'+data.rslt.np.attr("id").split("-")[1] + "destination" : data.rslt.np.attr("rel") +'-'+data.rslt.np.attr("id").split("-")[1] }; if (data.inst.get_container().find('#'+this.id).length > 1 ) data.inst.delete_node(this); } else { - url = '{% url 'manage_action_containers' "remove" %}'+$(this).attr("rel").replace("-locked","")+'/'+$(this).attr("id").split("-")[1]+'/' + url = '{% url 'manage_action_containers' "remove" %}'+$(this).attr("rel")+'/'+$(this).attr("id").split("-")[1]+'/' d = { - "parent" : data.rslt.op.attr("rel").replace("-locked","")+'-'+data.rslt.op.attr("id").split("-")[1] + "parent" : data.rslt.op.attr("rel")+'-'+data.rslt.op.attr("id").split("-")[1] }; } } @@ -888,11 +839,11 @@ data.inst.refresh(data.inst._get_node('#orphaned-0')); } //refresh destination (will already be expanded, even if orphaned) - if (!data.inst.is_leaf(data.rslt.cr) && $.inArray(data.rslt.cr.attr("rel").replace("-locked", ""), ["dataset", "orphaned"]) > -1) { + if (!data.inst.is_leaf(data.rslt.cr) && $.inArray(data.rslt.cr.attr("rel"), ["dataset", "orphaned"]) > -1) { data.inst.refresh(data.inst._get_node('#'+data.rslt.cr.attr('id'))); } // select the destination (select source if destination is orphaned) - if (data.rslt.cr.attr("rel").replace("-locked", "") === "orphaned") { + if (data.rslt.cr.attr("rel") === "orphaned") { data.inst.select_node(data.rslt.op); } else { data.inst.select_node(data.rslt.cr); diff --git a/components/tools/OmeroWeb/omeroweb/webclient/templates/webclient/data/containers_icon.html b/components/tools/OmeroWeb/omeroweb/webclient/templates/webclient/data/containers_icon.html index a76c56142ba..46d33bbc75b 100644 --- a/components/tools/OmeroWeb/omeroweb/webclient/templates/webclient/data/containers_icon.html +++ b/components/tools/OmeroWeb/omeroweb/webclient/templates/webclient/data/containers_icon.html @@ -205,7 +205,7 @@ var sel_obj, imgId; for (var _s=0; _s -
  • +
  • {% if manager.experimenter %}{{ manager.experimenter.getFullName }}{% else %}{{ ui.dropdown_menu.everyone }}{% endif %}