• Views
  • Iteration Report
  • My Iteration Report
  •  
OMERO.clients
  • Login
  • Help/Guide
  • About Trac
  • Preferences
  • Wiki
  • Timeline
  • Roadmap
  • Browse Source
  • View Tickets
  • Search

Context Navigation

  • ← Previous Changeset
  • Next Changeset →

Changeset 5519

Show
Ignore:
Timestamp:
06/23/08 15:24:06 (5 months ago)
Author:
jburel
Message:

First implementation of delete of Project and dataset.
Fixed bug when adding new server to the list.

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  
    246246                if (selected.length > 1) setEnabled(false); 
    247247                else { 
    248                         setEnabled(model.isObjectWritable(ho)  
    249                                         && selectedDisplay.getNumberOfItems() == 0); 
     248                        setEnabled(model.isObjectWritable(ho)); 
    250249                } 
    251250        } 
  • trunk/SRC/org/openmicroscopy/shoola/agents/treeviewer/view/DeleteDialog.java

    r5514 r5519  
    2626//Java imports 
    2727import java.awt.BorderLayout; 
    28 import java.awt.Color; 
    2928import java.awt.Container; 
    3029import java.awt.Dimension; 
    3130import java.awt.event.ActionEvent; 
    3231import java.awt.event.ActionListener; 
    33  
    34 import javax.swing.BorderFactory; 
    3532import javax.swing.Box; 
    3633import javax.swing.BoxLayout; 
    … …  
    3835import javax.swing.Icon; 
    3936import javax.swing.JButton; 
    40 import javax.swing.JComponent; 
    4137import javax.swing.JDialog; 
    4238import javax.swing.JFrame; 
    … …  
    4440import javax.swing.JPanel; 
    4541import javax.swing.JRadioButton; 
    46  
     42import javax.swing.JTextField; 
     43 
     44 
     45 
     46//Third-party libraries 
    4747import layout.TableLayout; 
    4848 
     49//Application-internal dependencies 
    4950import org.openmicroscopy.shoola.agents.treeviewer.IconManager; 
    5051import org.openmicroscopy.shoola.util.ui.UIUtilities; 
    5152 
    52 //Third-party libraries 
    53  
    54 //Application-internal dependencies 
    55  
    5653/**  
    57  *  
     54 * A modal dialog asking what the user wants to delete. 
    5855 * 
    5956 * @author  Jean-Marie Burel      
    … …  
    9087        public final static int                 NO_OPTION = 0; 
    9188         
     89        /** Indicates to delete the elements in the container. */ 
    9290        public final static int                 WITH_CONTENT = 0; 
    9391         
     92        /** Indicates not to delete the elements in the container. */ 
    9493        public final static int                 WITHOUT_CONTENT = 1; 
    9594         
    … …  
    106105        private JRadioButton    withoutContent; 
    107106         
     107        /** Either {@link #YES_OPTION} or {@link #NO_OPTION}. */ 
    108108        private int                             option; 
    109109         
    … …  
    166166        } 
    167167         
     168        /**  
     169         * Returns the component hosting the various choices. 
     170         *  
     171         * @return See above. 
     172         */ 
    168173        private JPanel buildMainPane() 
    169174        { 
    … …  
    184189                return p; 
    185190        } 
     191         
    186192        /** Builds and lays out the UI. */ 
    187193        private void buildGUI() 
    … …  
    189195                Container c = getContentPane(); 
    190196                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); 
    193207        } 
    194208         
    … …  
    204218                setProperties(); 
    205219                buildGUI(); 
     220                pack(); 
    206221        } 
    207222         
  • trunk/SRC/org/openmicroscopy/shoola/agents/treeviewer/view/TreeViewerComponent.java

    r5514 r5519  
    509509                 */ 
    510510                if (nodes == null) return; 
    511                 boolean askQuestion = false; 
     511                boolean askQuestion = true; 
    512512                Iterator i = nodes.iterator(); 
    513513                TreeImageDisplay node; 
    … …  
    516516                        if (node.getNumberOfItems() > 0) askQuestion = true; 
    517517                } 
    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                 
    520529        } 
    521530 
  • trunk/SRC/org/openmicroscopy/shoola/agents/treeviewer/view/TreeViewerFactory.java

    r5285 r5519  
    4242//Application-internal dependencies 
    4343import org.openmicroscopy.shoola.agents.events.SaveData; 
    44 import org.openmicroscopy.shoola.agents.hiviewer.HiViewerAgent; 
    4544import org.openmicroscopy.shoola.agents.treeviewer.TreeViewerAgent; 
    4645import org.openmicroscopy.shoola.env.Agent; 
    … …  
    9695        { 
    9796                if (isWindowMenuAttachedToTaskBar()) return; 
    98                 TaskBar tb = HiViewerAgent.getRegistry().getTaskBar(); 
     97                TaskBar tb = TreeViewerAgent.getRegistry().getTaskBar(); 
    9998                tb.addToMenu(TaskBar.WINDOW_MENU, singleton.windowMenu); 
    10099                singleton.isAttached = true; 
  • trunk/SRC/org/openmicroscopy/shoola/env/data/OMEROGateway.java

    r5514 r5519  
    5353import org.openmicroscopy.shoola.env.rnd.RenderingServiceException; 
    5454import ome.api.IAdmin; 
     55import ome.api.IDelete; 
    5556import ome.api.IPixels; 
    5657import ome.api.IPojos; 
    … …  
    440441         
    441442        /** 
     443         * Returns the {@link IDelete} service. 
     444         *  
     445         * @return See above. 
     446         */ 
     447        private IDelete getDeleteService() { return entry.getDeleteService(); } 
     448         
     449        /** 
    442450         * Returns the {@link ThumbnailStore} service. 
    443451         *   
    … …  
    37263734                         
    37273735                } catch (Exception e) { 
    3728                         e.printStackTrace(); 
    37293736                        handleException(e, "Cannot remove the tag description."); 
    37303737                } 
    … …  
    37323739        } 
    37333740         
     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         
    37343778} 
  • trunk/SRC/org/openmicroscopy/shoola/env/data/OmeroDataServiceImpl.java

    r5514 r5519  
    12431243                throws DSOutOfServiceException, DSAccessException 
    12441244        { 
     1245                List result = new ArrayList(); 
    12451246                if (child == null) return; 
    12461247                IObject object = gateway.findIObject(child.asIObject()); 
    … …  
    12561257                List children; 
    12571258                ILink link; 
     1259                Set<Long> ids = new HashSet<Long>(1); 
     1260                Long id; 
    12581261                if (child instanceof DatasetData) { 
    12591262                        //Find all dataset-image links. 
    1260                          
    12611263                        l = gateway.findLinks(child.asIObject(), null); 
    12621264                        if (l != null && l.size() > 0) { 
    … …  
    12681270                                        link = (ILink) i.next(); 
    12691271                                        remove[j] = link; 
    1270                                         children.add(link.getChild()); 
     1272                                        children.add(link.getChild().getId()); 
    12711273                                        j++; 
    12721274                                } 
    … …  
    12741276                                gateway.deleteObjects(remove); 
    12751277                                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                                        } 
    12771284                                } 
    12781285                        } 
    1279                         Set<Long> ids = new HashSet<Long>(1); 
    12801286                        ids.add(child.getId()); 
    12811287                        l = gateway.findLinks(ProjectData.class, ids, -1); 
  • trunk/SRC/org/openmicroscopy/shoola/env/data/OmeroMetadataServiceImpl.java

    r5514 r5519  
    6464import pojos.FileAnnotationData; 
    6565import pojos.ImageData; 
    66 import pojos.ProjectData; 
    6766import pojos.RatingAnnotationData; 
    6867import pojos.TagAnnotationData; 
  • trunk/SRC/org/openmicroscopy/shoola/util/ui/login/ServerDialog.java

    r5514 r5519  
    157157         
    158158        /** Fires a property indicating that a new server is selected. */ 
    159         private void apply() 
     159        void apply() 
    160160        { 
    161161                editor.stopEdition(); 
    … …  
    369369                }  else if (ServerEditor.REMOVE_MESSAGE_PROPERTY.equals(name)) { 
    370370                        showMessagePanel(false, (JComponent) evt.getNewValue()); 
    371                 }  
     371                } else if (ServerEditor.APPLY_SERVER_PROPERTY.equals(name)) { 
     372                        apply(); 
     373                } 
    372374        } 
    373375         
  • trunk/SRC/org/openmicroscopy/shoola/util/ui/login/ServerEditor.java

    r5514 r5519  
    9393        static final String             ADD_PROPERTY = "add"; 
    9494         
     95        /** Bound property indicating to apply the selection. */ 
     96        static final String             APPLY_SERVER_PROPERTY = "applyServer"; 
     97         
    9598    /** The message displayed when the entered server address already exists. */ 
    9699    private static final String EMPTY_MSG = "Server address already " + 
    … …  
    165168                editor = table.getCellEditor(); 
    166169                 
    167                 if (editor != null) { 
    168                         editor.stopCellEditing(); 
    169                 } 
     170                if (editor != null) editor.stopCellEditing(); 
     171                 
    170172                if (model.getRowCount() == 0) setEditing(false); 
    171173                handleServers(activeServer); 
    … …  
    417419        } else { 
    418420                if (emptyMessagePanel == null) return; 
    419                 firePropertyChange(REMOVE_MESSAGE_PROPERTY, null, emptyMessagePanel); 
     421                firePropertyChange(REMOVE_MESSAGE_PROPERTY, null,  
     422                                emptyMessagePanel); 
    420423            emptyMessagePanel = null; 
    421424        } 
    … …  
    538541         
    539542        /** Creates a new instance. */ 
    540         public ServerEditor() 
     543        ServerEditor() 
    541544        { 
    542545                this(null); 
    … …  
    548551         * @param activeServer The server the user is currently connected to. 
    549552         */ 
    550         public ServerEditor(String activeServer) 
     553        ServerEditor(String activeServer) 
    551554        { 
    552555                icons = IconManager.getInstance(); 
    … …  
    561564         
    562565        /** Requests focus if no server address at init time. */ 
    563         public void initFocus() 
     566        void initFocus() 
    564567        { 
    565568                int n = 0; 
    … …  
    570573                } 
    571574        } 
    572          
     575 
    573576} 
  • trunk/SRC/org/openmicroscopy/shoola/util/ui/login/ServerListEditor.java

    r4773 r5519  
    2828import java.awt.event.ActionEvent; 
    2929import java.awt.event.ActionListener; 
     30import java.awt.event.KeyAdapter; 
     31import java.awt.event.KeyEvent; 
     32 
    3033import javax.swing.AbstractCellEditor; 
    3134import javax.swing.JTable; 
    … …  
    7881         
    7982        /**  
     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        /**  
    8089         * Creates a new instance.  
    8190         *  
    … …  
    9099                component.addActionListener(this); 
    91100                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                }); 
    92107        } 
    93108         
    … …  
    110125    } 
    111126 
    112      
    113127    /** 
    114128     * Returns the edited text. This method is invoked when the editing is 
  • trunk/SRC/org/openmicroscopy/shoola/util/ui/login/ServerTable.java

    r4773 r5519  
    154154        } 
    155155         
     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         
    156166        /** 
    157167         * Handles the text modification in the edited cell. 

Download in other formats:

  • Unified Diff
  • Zip Archive

Trac Powered

Powered by Trac 0.11
By Edgewall Software.

Visit the Trac open source project at
http://trac.edgewall.org/