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

Show
Ignore:
Timestamp:
09/15/08 14:23:49 (2 months ago)
Author:
will
Message:

Template-Editing UI components for Table, Timer, DateTime?

Location:
trunk/SRC/org/openmicroscopy/shoola/agents/editor
Files:
4 added
14 modified
1 moved

  • EditorAgent.java (modified) (1 diff)
  • browser/BrowserControl.java (modified) (2 diffs)
  • browser/BrowserUI.java (modified) (1 diff)
  • browser/FieldEditorDisplay.java (modified) (1 diff)
  • browser/paramUIs/editTemplate/AttributeEditArea.java (modified) (1 diff)
  • browser/paramUIs/editTemplate/BooleanTemplate.java (modified) (2 diffs)
  • browser/paramUIs/editTemplate/DateTimeTemplate.java (added)
  • browser/paramUIs/editTemplate/EnumTemplate.java (modified) (1 diff)
  • browser/paramUIs/editTemplate/FieldEditorPanel.java (modified) (1 diff)
  • browser/paramUIs/editTemplate/ParamTemplateUIFactory.java (modified) (2 diffs)
  • browser/paramUIs/editTemplate/TableTemplate.java (added)
  • browser/paramUIs/editTemplate/TimerTemplate.java (added)
  • graphx/eclipse_addTextLine16.png (moved) (moved from trunk/SRC/org/openmicroscopy/shoola/agents/editor/graphx/nuvola_addTextLine16.png)
  • model/params/MutableTableModel.java (modified) (2 diffs)
  • model/undoableEdits/AttributeEdit.java (modified) (1 diff)
  • model/undoableEdits/ChangeParamEdit.java (added)
  • model/undoableEdits/DeleteFieldsEdit.java (modified) (2 diffs)
  • view/EditorComponent.java (modified) (1 diff)
  • view/EditorFactory.java (modified) (1 diff)

Legend:

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

    r5588 r5610  
    155155           handleFileEdition((EditFileEvent) e); 
    156156    } 
     157     
     158    /** 
     159     * This was an attempted shortcut to directly start OMERO.editor 
     160     * without Insight and a server connection. 
     161     * However, I get a NPE becuase there is no Registry!  
     162     *  
     163     * @param args 
     164     */ 
     165    public static void main(String[] args) { 
     166         
     167        File testFile = new File 
     168                ("/Users/will/xmlProtocols/demoForRelease/AllFields.pro.xml"); 
     169                /* 
     170        Editor editor = EditorFactory.getEditor(testFile); 
     171         
     172        if (editor != null) { 
     173                editor.setFileToEdit(testFile); 
     174        } 
     175        */ 
     176 
     177    } 
    157178} 
  • trunk/SRC/org/openmicroscopy/shoola/agents/editor/browser/BrowserControl.java

    r5608 r5610  
    5151import org.openmicroscopy.shoola.agents.editor.model.IAttributes; 
    5252import org.openmicroscopy.shoola.agents.editor.model.IField; 
     53import org.openmicroscopy.shoola.agents.editor.model.params.IParam; 
    5354import org.openmicroscopy.shoola.agents.editor.model.undoableEdits.AddParamEdit; 
    5455import org.openmicroscopy.shoola.agents.editor.model.undoableEdits.AttributeEdit; 
    5556import org.openmicroscopy.shoola.agents.editor.model.undoableEdits.AttributesEdit; 
     57import org.openmicroscopy.shoola.agents.editor.model.undoableEdits.ChangeParamEdit; 
    5658 
    5759 
    … …  
    257259             } 
    258260          } 
     261         
     262        /** 
     263         * Edits a field by creating and adding a new Parameter. 
     264         *  
     265         * @param field         The field to add a new parameter to. 
     266         * @param paramType             A string defining the type of parameter to add. 
     267         * @param tree                  The JTree to refresh with undo/redo 
     268         * @param node          The node to highlight / refresh with undo/redo.  
     269         */ 
     270        public void changeParam(IField field, IParam param, int index, 
     271                        JTree tree, TreeNode node) { 
     272                 
     273                UndoableEdit edit = new ChangeParamEdit(param, field, index,  
     274                         tree, node); 
     275                undoSupport.postEdit(edit); 
     276        } 
    259277} 
  • trunk/SRC/org/openmicroscopy/shoola/agents/editor/browser/BrowserUI.java

    r5600 r5610  
    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/browser/FieldEditorDisplay.java

    r5601 r5610  
    4848 
    4949/**  
    50  * A container to display a FieldEditorPanel for the currently highlighted  
    51  * field of the JTree.  
     50 * A container to display a {@link FieldEditorPanel} for the currently  
     51 * highlighted field of the JTree.  
    5252 * 
    5353 * @author  William Moore      
  • trunk/SRC/org/openmicroscopy/shoola/agents/editor/browser/paramUIs/editTemplate/AttributeEditArea.java

    r5597 r5610  
    163163        } 
    164164         
     165        /** 
     166         * This allows other classes to manipulate the text box, to set cols or 
     167         * set Text etc.  
     168         *  
     169         * @return              The Text Area used by this UI for editing text 
     170         */ 
     171        public JTextArea getTextArea() { return textBox; } 
    165172         
    166173        /** 
  • trunk/SRC/org/openmicroscopy/shoola/agents/editor/browser/paramUIs/editTemplate/BooleanTemplate.java

    r5608 r5610  
    7474        } 
    7575         
    76          
     76        /** 
     77         * Creates an instance. 
     78         *  
     79         * @param param         The parameter in which to edit the default boolean value 
     80         */ 
    7781        public BooleanTemplate(IAttributes param)  
    7882        { 
    … …  
    8286        } 
    8387         
    84          
     88        /** 
     89         * Implemented as specified by the {@link ITreeEditComp} interface.  
     90         *  
     91         * @see {@link ITreeEditComp#getEditDisplayName() 
     92         */ 
    8593        public String getEditDisplayName() { 
    86                 // TODO Auto-generated method stub 
    87                 return null; 
     94                return "Checkbox default"; 
    8895        } 
    8996 
  • trunk/SRC/org/openmicroscopy/shoola/agents/editor/browser/paramUIs/editTemplate/EnumTemplate.java

    r5608 r5610  
    110110        } 
    111111 
    112         public String getEditDisplayName() { 
    113                 return "Drop-down options"; 
    114         } 
     112        /** 
     113         * Implemented as specified by the {@link ITreeEditComp} interface.  
     114         *  
     115         * @see {@link ITreeEditComp#getEditDisplayName() 
     116         */ 
     117        public String getEditDisplayName() { return "Drop-down options"; } 
    115118 
    116119        /** 
  • trunk/SRC/org/openmicroscopy/shoola/agents/editor/browser/paramUIs/editTemplate/FieldEditorPanel.java

    r5608 r5610  
    297297        private void paramTypeChanged(String newType) { 
    298298                 
    299                 if (field.getParamCount() > 0) { 
    300                         IParam oldParam = field.getParamAt(0); 
    301                         field.removeParam(oldParam); 
    302                 } 
    303                 IParam newParam = FieldParamsFactory.getFieldParam(newType); 
    304                 field.addParam(0, newParam); 
    305                  
    306                 /* refresh this node in the JTree, and rebuild this panel*/ 
    307                 updateEditingOfTreeNode(); 
    308                 rebuildEditorPanel(); 
     299                int paramIndex = 0; 
     300                 
     301                IParam newParam = null; 
     302                if (newType != null)  
     303                        newParam = FieldParamsFactory.getFieldParam(newType); 
     304                 
     305                // if newParam is null, this will simply remove first parameter 
     306                controller.changeParam(field, newParam, paramIndex, 
     307                                 tree, treeNode); 
    309308        } 
    310309 
  • trunk/SRC/org/openmicroscopy/shoola/agents/editor/browser/paramUIs/editTemplate/ParamTemplateUIFactory.java

    r5608 r5610  
    3737import org.openmicroscopy.shoola.agents.editor.model.DataFieldConstants; 
    3838import org.openmicroscopy.shoola.agents.editor.model.params.AbstractParam; 
     39import org.openmicroscopy.shoola.agents.editor.model.params.DateTimeParam; 
    3940import org.openmicroscopy.shoola.agents.editor.model.params.IParam; 
    4041import org.openmicroscopy.shoola.agents.editor.model.params.SingleParam; 
     42import org.openmicroscopy.shoola.agents.editor.model.params.TableParam; 
     43import org.openmicroscopy.shoola.agents.editor.model.params.TimeParam; 
    4144 
    4245/**  
    … …  
    8689                } 
    8790                 
     91                if (inputType.equals(DateTimeParam.DATE_TIME_PARAM)) { 
     92                        return new DateTimeTemplate(paramObject); 
     93                } 
     94                 
     95                if (inputType.equals(TableParam.TABLE_PARAM)) { 
     96                        return new TableTemplate(paramObject); 
     97                } 
     98                 
     99                if (inputType.equals(TimeParam.TIME_PARAM)) { 
     100                        return new TimerTemplate(paramObject); 
     101                } 
     102                 
    88103                if (inputType.equals(SingleParam.NUMBER_PARAM)) { 
    89104                        return new NumberTemplate(paramObject); 
  • trunk/SRC/org/openmicroscopy/shoola/agents/editor/model/params/MutableTableModel.java

    r5594 r5610  
    7575        return columnNames.get(column); 
    7676    } 
     77     
     78    /** 
     79     * Sets the name of the column at the specified index.  
     80     * If the column index is too high (too few columns) then 
     81     * a new column is created.  
     82     * Either way, {@link #fireTableStructureChanged()} is called 
     83     * to notify the Table that the model has changed. 
     84     *  
     85     * @param columnIndex               The index of the column          
     86     * @param name                      The new name for the column 
     87     */ 
     88    public void setColumnName(int columnIndex, String name) 
     89    { 
     90        if (columnIndex >= getColumnCount()) { 
     91                addEmptyColumn(name); 
     92        } else { 
     93                columnNames.remove(columnIndex); 
     94                columnNames.add(columnIndex, name); 
     95        } 
     96    } 
    7797 
    7898    /** 
    … …  
    231251        for (int i=rowIndecies.length-1; i>-1; i--) { 
    232252                int rowToRemove = rowIndecies[i]; 
    233                 System.out.println("InteractiveTableModel Removing row " + rowToRemove); 
    234253                data.remove(rowToRemove); 
    235254                fireTableRowsDeleted(rowToRemove, rowToRemove); 
  • trunk/SRC/org/openmicroscopy/shoola/agents/editor/model/undoableEdits/AttributeEdit.java

    r5601 r5610  
    128128                if ((tree != null) && (node != null)) { 
    129129                         
    130                         DefaultMutableTreeNode dmtNode = (DefaultMutableTreeNode)node; 
    131                          
    132130                        DefaultTreeModel treeModel = (DefaultTreeModel)tree.getModel(); 
    133131                        treeModel.nodeChanged(node); 
  • trunk/SRC/org/openmicroscopy/shoola/agents/editor/model/undoableEdits/DeleteFieldsEdit.java

    r5594 r5610  
    3232import javax.swing.tree.TreePath; 
    3333 
    34 import org.openmicroscopy.shoola.agents.editor.model.TreeModelMethods; 
    35  
    3634//Third-party libraries 
    3735 
    3836//Application-internal dependencies 
     37 
     38import org.openmicroscopy.shoola.agents.editor.model.TreeModelMethods; 
    3939 
    4040/**  
    … …  
    5151 */ 
    5252public class DeleteFieldsEdit  
    53         extends UndoableTreeEdit { 
     53        extends UndoableTreeEdit  
     54{ 
    5455 
    5556        /** 
  • trunk/SRC/org/openmicroscopy/shoola/agents/editor/view/EditorComponent.java

    r5588 r5610  
    166166        public void setFileToEdit(File file) 
    167167        { 
    168                 if (model.getState() != LOADING) 
     168                if ((model.getState() != LOADING) && (model.getState() != NEW)) 
    169169                        throw new IllegalStateException("This method should only be " + 
    170                                         "invoked in the LOADING state."); 
     170                                        "invoked in the LOADING or NEW states."); 
    171171                                         
    172172                model.setFileToEdit(file); 
  • trunk/SRC/org/openmicroscopy/shoola/agents/editor/view/EditorFactory.java

    r5588 r5610  
    7575        { 
    7676                EditorModel model = new EditorModel(fileName, fileID, fileSize); 
     77                return singleton.getEditor(model); 
     78        } 
     79         
     80        /** 
     81         * Returns the {@link Editor}. 
     82         *  
     83         * @param file          The file to open in Editor.  
     84         * @return See above. 
     85         */ 
     86        public static Editor getEditor(File file) 
     87        { 
     88                EditorModel model = new EditorModel(file); 
    7789                return singleton.getEditor(model); 
    7890        } 

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/