Changeset 5519
- Timestamp:
- 06/23/08 15:24:06 (5 months ago)
- Location:
- trunk/SRC/org/openmicroscopy/shoola
- Files:
-
- 11 modified
-
agents/treeviewer/actions/DeleteAction.java (modified) (1 diff)
-
agents/treeviewer/view/DeleteDialog.java (modified) (9 diffs)
-
agents/treeviewer/view/TreeViewerComponent.java (modified) (2 diffs)
-
agents/treeviewer/view/TreeViewerFactory.java (modified) (2 diffs)
-
env/data/OMEROGateway.java (modified) (4 diffs)
-
env/data/OmeroDataServiceImpl.java (modified) (4 diffs)
-
env/data/OmeroMetadataServiceImpl.java (modified) (1 diff)
-
util/ui/login/ServerDialog.java (modified) (2 diffs)
-
util/ui/login/ServerEditor.java (modified) (7 diffs)
-
util/ui/login/ServerListEditor.java (modified) (4 diffs)
-
util/ui/login/ServerTable.java (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/SRC/org/openmicroscopy/shoola/agents/treeviewer/actions/DeleteAction.java
r5514 r5519 246 246 if (selected.length > 1) setEnabled(false); 247 247 else { 248 setEnabled(model.isObjectWritable(ho) 249 && selectedDisplay.getNumberOfItems() == 0); 248 setEnabled(model.isObjectWritable(ho)); 250 249 } 251 250 } -
trunk/SRC/org/openmicroscopy/shoola/agents/treeviewer/view/DeleteDialog.java
r5514 r5519 26 26 //Java imports 27 27 import java.awt.BorderLayout; 28 import java.awt.Color;29 28 import java.awt.Container; 30 29 import java.awt.Dimension; 31 30 import java.awt.event.ActionEvent; 32 31 import java.awt.event.ActionListener; 33 34 import javax.swing.BorderFactory;35 32 import javax.swing.Box; 36 33 import javax.swing.BoxLayout; … … 38 35 import javax.swing.Icon; 39 36 import javax.swing.JButton; 40 import javax.swing.JComponent;41 37 import javax.swing.JDialog; 42 38 import javax.swing.JFrame; … … 44 40 import javax.swing.JPanel; 45 41 import javax.swing.JRadioButton; 46 42 import javax.swing.JTextField; 43 44 45 46 //Third-party libraries 47 47 import layout.TableLayout; 48 48 49 //Application-internal dependencies 49 50 import org.openmicroscopy.shoola.agents.treeviewer.IconManager; 50 51 import org.openmicroscopy.shoola.util.ui.UIUtilities; 51 52 52 //Third-party libraries53 54 //Application-internal dependencies55 56 53 /** 57 * 54 * A modal dialog asking what the user wants to delete. 58 55 * 59 56 * @author Jean-Marie Burel … … 90 87 public final static int NO_OPTION = 0; 91 88 89 /** Indicates to delete the elements in the container. */ 92 90 public final static int WITH_CONTENT = 0; 93 91 92 /** Indicates not to delete the elements in the container. */ 94 93 public final static int WITHOUT_CONTENT = 1; 95 94 … … 106 105 private JRadioButton withoutContent; 107 106 107 /** Either {@link #YES_OPTION} or {@link #NO_OPTION}. */ 108 108 private int option; 109 109 … … 166 166 } 167 167 168 /** 169 * Returns the component hosting the various choices. 170 * 171 * @return See above. 172 */ 168 173 private JPanel buildMainPane() 169 174 { … … 184 189 return p; 185 190 } 191 186 192 /** Builds and lays out the UI. */ 187 193 private void buildGUI() … … 189 195 Container c = getContentPane(); 190 196 c.setLayout(new BorderLayout(0, 0)); 191 c.add(buildMainPane()); 192 c.add(buildControlPanel()); 197 JPanel body = new JPanel(); 198 body.setLayout(new BoxLayout(body, BoxLayout.Y_AXIS)); 199 //c.add(buildMainPane()); 200 //Tmp 201 JLabel l = new JLabel(); 202 l.setText("<html><body>Limitation: Only the selected container will be <br>" + 203 "deleted not the elements contained in it</body></html>"); 204 body.add(UIUtilities.buildComponentPanel(l)); 205 body.add(buildControlPanel()); 206 add(body); 193 207 } 194 208 … … 204 218 setProperties(); 205 219 buildGUI(); 220 pack(); 206 221 } 207 222 -
trunk/SRC/org/openmicroscopy/shoola/agents/treeviewer/view/TreeViewerComponent.java
r5514 r5519 509 509 */ 510 510 if (nodes == null) return; 511 boolean askQuestion = false;511 boolean askQuestion = true; 512 512 Iterator i = nodes.iterator(); 513 513 TreeImageDisplay node; … … 516 516 if (node.getNumberOfItems() > 0) askQuestion = true; 517 517 } 518 model.fireDataObjectsDeletion(nodes); 519 fireStateChange(); 518 if (askQuestion) { 519 DeleteDialog dialog = new DeleteDialog(view); 520 if (dialog.centerMsgBox() == DeleteDialog.YES_OPTION) { 521 model.fireDataObjectsDeletion(nodes); 522 fireStateChange(); 523 } 524 } else { 525 model.fireDataObjectsDeletion(nodes); 526 fireStateChange(); 527 } 528 520 529 } 521 530 -
trunk/SRC/org/openmicroscopy/shoola/agents/treeviewer/view/TreeViewerFactory.java
r5285 r5519 42 42 //Application-internal dependencies 43 43 import org.openmicroscopy.shoola.agents.events.SaveData; 44 import org.openmicroscopy.shoola.agents.hiviewer.HiViewerAgent;45 44 import org.openmicroscopy.shoola.agents.treeviewer.TreeViewerAgent; 46 45 import org.openmicroscopy.shoola.env.Agent; … … 96 95 { 97 96 if (isWindowMenuAttachedToTaskBar()) return; 98 TaskBar tb = HiViewerAgent.getRegistry().getTaskBar();97 TaskBar tb = TreeViewerAgent.getRegistry().getTaskBar(); 99 98 tb.addToMenu(TaskBar.WINDOW_MENU, singleton.windowMenu); 100 99 singleton.isAttached = true; -
trunk/SRC/org/openmicroscopy/shoola/env/data/OMEROGateway.java
r5514 r5519 53 53 import org.openmicroscopy.shoola.env.rnd.RenderingServiceException; 54 54 import ome.api.IAdmin; 55 import ome.api.IDelete; 55 56 import ome.api.IPixels; 56 57 import ome.api.IPojos; … … 440 441 441 442 /** 443 * Returns the {@link IDelete} service. 444 * 445 * @return See above. 446 */ 447 private IDelete getDeleteService() { return entry.getDeleteService(); } 448 449 /** 442 450 * Returns the {@link ThumbnailStore} service. 443 451 * … … 3726 3734 3727 3735 } catch (Exception e) { 3728 e.printStackTrace();3729 3736 handleException(e, "Cannot remove the tag description."); 3730 3737 } … … 3732 3739 } 3733 3740 3741 /** 3742 * Deletes the passed object using the {@link IDelete} service. 3743 * Returns an emtpy list of nothing prevent the delete to happen, 3744 * otherwise returns a list of objects preventing the delete to happen. 3745 * 3746 * @param objectType The type of object to delete. 3747 * @param objectID The id of the object to delete. 3748 * @return See above. 3749 * @throws DSOutOfServiceException If the connection is broken, or logged 3750 * in. 3751 * @throws DSAccessException If an error occured while trying to 3752 * retrieve data from OMEDS service. 3753 */ 3754 List<IObject> removeObject(Class objectType, Long objectID) 3755 throws DSOutOfServiceException, DSAccessException 3756 { 3757 3758 isSessionAlive(); 3759 try { 3760 IDelete service = getDeleteService(); 3761 if (ImageData.class.equals(objectType)) { 3762 List r = service.checkImageDelete(objectID, false); 3763 if (r == null || r.size() == 0) { 3764 service.deleteImage(objectID, true); 3765 return r; 3766 } 3767 return r; 3768 } 3769 3770 3771 3772 } catch (Exception e) { 3773 handleException(e, "Cannot delete: "+objectType+" "+objectID); 3774 } 3775 return new ArrayList<IObject>(); 3776 } 3777 3734 3778 } -
trunk/SRC/org/openmicroscopy/shoola/env/data/OmeroDataServiceImpl.java
r5514 r5519 1243 1243 throws DSOutOfServiceException, DSAccessException 1244 1244 { 1245 List result = new ArrayList(); 1245 1246 if (child == null) return; 1246 1247 IObject object = gateway.findIObject(child.asIObject()); … … 1256 1257 List children; 1257 1258 ILink link; 1259 Set<Long> ids = new HashSet<Long>(1); 1260 Long id; 1258 1261 if (child instanceof DatasetData) { 1259 1262 //Find all dataset-image links. 1260 1261 1263 l = gateway.findLinks(child.asIObject(), null); 1262 1264 if (l != null && l.size() > 0) { … … 1268 1270 link = (ILink) i.next(); 1269 1271 remove[j] = link; 1270 children.add(link.getChild() );1272 children.add(link.getChild().getId()); 1271 1273 j++; 1272 1274 } … … 1274 1276 gateway.deleteObjects(remove); 1275 1277 if (content) { 1276 1278 //remove images. 1279 i = children.iterator(); 1280 while (i.hasNext()) { 1281 id = (Long) i.next(); 1282 //gateway.removeObject(Image, objectID) 1283 } 1277 1284 } 1278 1285 } 1279 Set<Long> ids = new HashSet<Long>(1);1280 1286 ids.add(child.getId()); 1281 1287 l = gateway.findLinks(ProjectData.class, ids, -1); -
trunk/SRC/org/openmicroscopy/shoola/env/data/OmeroMetadataServiceImpl.java
r5514 r5519 64 64 import pojos.FileAnnotationData; 65 65 import pojos.ImageData; 66 import pojos.ProjectData;67 66 import pojos.RatingAnnotationData; 68 67 import pojos.TagAnnotationData; -
trunk/SRC/org/openmicroscopy/shoola/util/ui/login/ServerDialog.java
r5514 r5519 157 157 158 158 /** Fires a property indicating that a new server is selected. */ 159 privatevoid apply()159 void apply() 160 160 { 161 161 editor.stopEdition(); … … 369 369 } else if (ServerEditor.REMOVE_MESSAGE_PROPERTY.equals(name)) { 370 370 showMessagePanel(false, (JComponent) evt.getNewValue()); 371 } 371 } else if (ServerEditor.APPLY_SERVER_PROPERTY.equals(name)) { 372 apply(); 373 } 372 374 } 373 375 -
trunk/SRC/org/openmicroscopy/shoola/util/ui/login/ServerEditor.java
r5514 r5519 93 93 static final String ADD_PROPERTY = "add"; 94 94 95 /** Bound property indicating to apply the selection. */ 96 static final String APPLY_SERVER_PROPERTY = "applyServer"; 97 95 98 /** The message displayed when the entered server address already exists. */ 96 99 private static final String EMPTY_MSG = "Server address already " + … … 165 168 editor = table.getCellEditor(); 166 169 167 if (editor != null) { 168 editor.stopCellEditing(); 169 } 170 if (editor != null) editor.stopCellEditing(); 171 170 172 if (model.getRowCount() == 0) setEditing(false); 171 173 handleServers(activeServer); … … 417 419 } else { 418 420 if (emptyMessagePanel == null) return; 419 firePropertyChange(REMOVE_MESSAGE_PROPERTY, null, emptyMessagePanel); 421 firePropertyChange(REMOVE_MESSAGE_PROPERTY, null, 422 emptyMessagePanel); 420 423 emptyMessagePanel = null; 421 424 } … … 538 541 539 542 /** Creates a new instance. */ 540 publicServerEditor()543 ServerEditor() 541 544 { 542 545 this(null); … … 548 551 * @param activeServer The server the user is currently connected to. 549 552 */ 550 publicServerEditor(String activeServer)553 ServerEditor(String activeServer) 551 554 { 552 555 icons = IconManager.getInstance(); … … 561 564 562 565 /** Requests focus if no server address at init time. */ 563 publicvoid initFocus()566 void initFocus() 564 567 { 565 568 int n = 0; … … 570 573 } 571 574 } 572 575 573 576 } -
trunk/SRC/org/openmicroscopy/shoola/util/ui/login/ServerListEditor.java
r4773 r5519 28 28 import java.awt.event.ActionEvent; 29 29 import java.awt.event.ActionListener; 30 import java.awt.event.KeyAdapter; 31 import java.awt.event.KeyEvent; 32 30 33 import javax.swing.AbstractCellEditor; 31 34 import javax.swing.JTable; … … 78 81 79 82 /** 83 * Invokes when a new server name is entered or 84 * an existing one is edited. 85 */ 86 private void handleKeyEnter() { table.handleKeyEnter(); } 87 88 /** 80 89 * Creates a new instance. 81 90 * … … 90 99 component.addActionListener(this); 91 100 component.getDocument().addDocumentListener(this); 101 component.addKeyListener(new KeyAdapter() { 102 public void keyPressed(KeyEvent e) { 103 if (e.getKeyCode() == KeyEvent.VK_ENTER) 104 handleKeyEnter(); 105 } 106 }); 92 107 } 93 108 … … 110 125 } 111 126 112 113 127 /** 114 128 * Returns the edited text. This method is invoked when the editing is -
trunk/SRC/org/openmicroscopy/shoola/util/ui/login/ServerTable.java
r4773 r5519 154 154 } 155 155 156 /** 157 * Invokes when a new server name is entered or 158 * an existing one is edited. 159 */ 160 void handleKeyEnter() 161 { 162 parent.firePropertyChange(ServerEditor.APPLY_SERVER_PROPERTY, 163 Boolean.FALSE, Boolean.TRUE); 164 } 165 156 166 /** 157 167 * Handles the text modification in the edited cell.
