• 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 5613

Show
Ignore:
Timestamp:
09/16/08 10:01:41 (2 months ago)
Author:
will
Message:

Open a local file.

Location:
trunk/SRC/org/openmicroscopy/shoola/agents
Files:
3 added
9 modified

  • editor/EditorAgent.java (modified) (4 diffs)
  • editor/IconManager.java (modified) (2 diffs)
  • editor/actions/OpenLocalFileAction.java (added)
  • editor/browser/BrowserUI.java (modified) (1 diff)
  • editor/graphx/nuvola_folder_open16.png (added)
  • editor/view/Editor.java (modified) (1 diff)
  • editor/view/EditorComponent.java (modified) (3 diffs)
  • editor/view/EditorControl.java (modified) (3 diffs)
  • editor/view/EditorFactory.java (modified) (1 diff)
  • editor/view/EditorToolBar.java (modified) (1 diff)
  • editor/view/EditorUI.java (modified) (2 diffs)
  • events/editor/ShowEditorEvent.java (added)

Legend:

Unmodified
Added
Removed
  • trunk/SRC/org/openmicroscopy/shoola/agents/editor/EditorAgent.java

    r5610 r5613  
    3535import org.openmicroscopy.shoola.agents.editor.view.EditorFactory; 
    3636import org.openmicroscopy.shoola.agents.events.editor.EditFileEvent; 
     37import org.openmicroscopy.shoola.agents.events.editor.ShowEditorEvent; 
    3738import org.openmicroscopy.shoola.env.Agent; 
    3839import org.openmicroscopy.shoola.env.LookupNames; 
    … …  
    9899        } 
    99100         
     101        /** 
     102         * Creates or recycles an editor. 
     103         * @param event The event to handle. 
     104         */ 
     105        private void handleShowEditor(ShowEditorEvent event) 
     106        { 
     107        } 
     108         
    100109         /** Creates a new instance. */ 
    101110    public EditorAgent() {} 
    … …  
    122131        EventBus bus = registry.getEventBus(); 
    123132        bus.register(this, EditFileEvent.class); 
     133        bus.register(this, ShowEditorEvent.class); 
    124134    } 
    125135 
    … …  
    154164       if (e instanceof EditFileEvent) 
    155165           handleFileEdition((EditFileEvent) e); 
     166        
     167       if (e instanceof ShowEditorEvent) 
     168           handleShowEditor((ShowEditorEvent) e); 
    156169    } 
    157170     
  • trunk/SRC/org/openmicroscopy/shoola/agents/editor/IconManager.java

    r5596 r5613  
    222222    public  static int                  CONFIGURE_ICON = 51; 
    223223     
     224    /** The <code>Open Folder</code> icon. */ 
     225    public  static int                  OPEN_FOLDER = 52; 
     226     
    224227    /**  
    225228     * The maximum ID used for the icon IDs. 
    226229     * Allows to correctly build arrays for direct indexing.  
    227230     */ 
    228     private static int          MAX_ID = 51; 
     231    private static int          MAX_ID = 52; 
    229232     
    230233    /** Paths of the icon files. */ 
    … …  
    290293        relPaths[DELETE_ICON] = "nuvola_cancel16.png"; 
    291294        relPaths[CONFIGURE_ICON] = "nuvola_package_utilities16.png"; 
     295        relPaths[OPEN_FOLDER] = "nuvola_folder_open16.png"; 
    292296    } 
    293297     
  • trunk/SRC/org/openmicroscopy/shoola/agents/editor/browser/BrowserUI.java

    r5610 r5613  
    130130        add(leftSplitPane, BorderLayout.CENTER); 
    131131         
    132         add(new ToolBar(controller, treeDisplay), BorderLayout.NORTH); 
     132        // add(new ToolBar(controller, treeDisplay), BorderLayout.NORTH); 
    133133    } 
    134134     
  • trunk/SRC/org/openmicroscopy/shoola/agents/editor/view/Editor.java

    r5588 r5613  
    119119         */ 
    120120        public Browser getBrowser(); 
     121         
     122        /** 
     123         * Opens a file that exists on the local machine. 
     124         * (The file is "in hand", not on the server) 
     125         *  
     126         * @param file          The file to open in a new Editor window.  
     127         */ 
     128        public void openLocalFile(File file); 
    121129} 
  • trunk/SRC/org/openmicroscopy/shoola/agents/editor/view/EditorComponent.java

    r5610 r5613  
    3030//Application-internal dependencies 
    3131import org.openmicroscopy.shoola.agents.editor.browser.Browser; 
    32 import org.openmicroscopy.shoola.util.ui.UIUtilities; 
    3332import org.openmicroscopy.shoola.util.ui.component.AbstractComponent; 
    3433 
    … …  
    110109                                model.fireFileLoading(); 
    111110                                fireStateChange(); 
    112                                 //UIUtilities.centerAndShow(view); 
    113                                 view.setOnScreen(); 
     111                                //view.setOnScreen();   // called by EditorUI initialize() 
    114112                                break; 
    115113                        case DISCARDED: 
    … …  
    196194                return model.getBrowser(); 
    197195        } 
     196 
     197        /**  
     198         * Implemented as specified by the {@link Editor} interface. 
     199         * @see Editor#openLocalFile(File file) 
     200         */ 
     201        public void openLocalFile(File file) { 
     202                 
     203                Editor editor = EditorFactory.getEditor(file); 
     204         
     205                if (editor != null) { 
     206                        if (editor.getState() == Editor.NEW) 
     207                                editor.setFileToEdit(file); 
     208                         
     209                        editor.activate(); 
     210                } 
     211        } 
    198212} 
  • trunk/SRC/org/openmicroscopy/shoola/agents/editor/view/EditorControl.java

    r5596 r5613  
    4646import org.openmicroscopy.shoola.agents.editor.actions.CloseEditorAction; 
    4747import org.openmicroscopy.shoola.agents.editor.actions.EditorAction; 
     48import org.openmicroscopy.shoola.agents.editor.actions.OpenLocalFileAction; 
    4849import org.openmicroscopy.shoola.agents.editor.browser.Browser; 
    4950 
    … …  
    6869        static final Integer    CLOSE_EDITOR = new Integer(1); 
    6970         
     71        /** Identifies the <code>Open Local File</code> Action. */ 
     72        static final Integer    OPEN_LOCAL_FILE = new Integer(2); 
     73         
    7074        /**  
    7175         * Reference to the {@link Editor} component, which, in this context, 
    … …  
    8488        { 
    8589                actionsMap.put(CLOSE_EDITOR, new CloseEditorAction(model)); 
     90                actionsMap.put(OPEN_LOCAL_FILE, new OpenLocalFileAction(model)); 
    8691        } 
    8792         
  • trunk/SRC/org/openmicroscopy/shoola/agents/editor/view/EditorFactory.java

    r5610 r5613  
    155155                while (v.hasNext()) { 
    156156                        comp = (EditorComponent) v.next(); 
    157                         if (comp.getModel().getFileID() == model.getFileID())   
     157                        if ((comp.getModel().getFileID() == model.getFileID()) &&  
     158                                        (comp.getModel().getFileName().equals(model.getFileName()))) 
    158159                                return comp; 
    159160                } 
    160                 comp = new EditorComponent(model); 
    161                 comp.initialize(); 
     161                comp = new EditorComponent(model);      // creates View and Controller 
     162                comp.initialize();              // initialises MVC 
    162163                comp.addChangeListener(this); 
    163164                editors.add(comp); 
  • trunk/SRC/org/openmicroscopy/shoola/agents/editor/view/EditorToolBar.java

    r5588 r5613  
    6363                bar.setBorder(null); 
    6464                JButton b = new CustomButton(controller.getAction( 
    65                                 EditorControl.CLOSE_EDITOR)); 
     65                                EditorControl.OPEN_LOCAL_FILE)); 
    6666                b.setText(""); 
    6767                bar.add(b); 
  • trunk/SRC/org/openmicroscopy/shoola/agents/editor/view/EditorUI.java

    r5600 r5613  
    136136                setJMenuBar(createMenuBar()); 
    137137                buildGUI(); 
     138                setOnScreen(); 
    138139        } 
    139140     
    … …  
    174175         
    175176                setVisible(true); 
    176          
    177177    } 
    178178     

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/