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

Show
Ignore:
Timestamp:
09/24/08 16:36:58 (2 months ago)
Author:
will
Message:

Lock, currently for display only (doesn't prevent editing)

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

  • IconManager.java (modified) (3 diffs)
  • browser/FieldPanel.java (modified) (7 diffs)
  • browser/FieldRenderer.java (modified) (1 diff)
  • browser/TreeOutlineCellRenderer.java (modified) (1 diff)
  • graphx/nuvola_encrypted16.png (added)
  • graphx/nuvola_encrypted_red16.png (added)
  • model/Field.java (modified) (3 diffs)
  • model/FieldNode.java (modified) (2 diffs)
  • model/IField.java (modified) (1 diff)
  • model/Lock.java (added)
  • model/TreeModelFactory.java (modified) (2 diffs)

Legend:

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

    r5625 r5626  
    231231    public  static int                  INDENT_LEFT = 54; 
    232232     
     233    /** The <code>Template locked</code> icon. */ 
     234    public  static int                  TEMPLATE_LOCK = 55; 
     235     
     236    /** The <code>Fully locked</code> icon. */ 
     237    public  static int                  FULL_LOCK = 56; 
     238     
    233239     
    234240    /**  
    … …  
    236242     * Allows to correctly build arrays for direct indexing.  
    237243     */ 
    238     private static int          MAX_ID = 54; 
     244    private static int          MAX_ID = 56; 
    239245     
    240246    /** Paths of the icon files. */ 
    … …  
    303309        relPaths[INDENT_RIGHT] = "nuvola_indent_right16.png"; 
    304310        relPaths[INDENT_LEFT] = "nuvola_indent_left16.png"; 
     311        relPaths[TEMPLATE_LOCK] = "nuvola_encrypted16.png"; 
     312        relPaths[FULL_LOCK] = "nuvola_encrypted_red16.png"; 
    305313    } 
    306314     
  • trunk/SRC/org/openmicroscopy/shoola/agents/editor/browser/FieldPanel.java

    r5596 r5626  
    5959import org.openmicroscopy.shoola.agents.editor.browser.paramUIs.TableEditor; 
    6060import org.openmicroscopy.shoola.agents.editor.model.Field; 
     61import org.openmicroscopy.shoola.agents.editor.model.FieldNode; 
    6162import org.openmicroscopy.shoola.agents.editor.model.IAttributes; 
    6263import org.openmicroscopy.shoola.agents.editor.model.IField; 
     64import org.openmicroscopy.shoola.agents.editor.model.Lock; 
    6365import org.openmicroscopy.shoola.agents.editor.model.params.IParam; 
    6466import org.openmicroscopy.shoola.agents.editor.uiComponents.CustomButton; 
    … …  
    144146         * Used eg. to set the selected field to this node with undo/redo 
    145147         */ 
    146         private DefaultMutableTreeNode  treeNode; 
     148        private FieldNode                               treeNode; 
    147149         
    148150         
    … …  
    233235                nameLabel.setBackground(null); 
    234236                nameLabel.setOpaque(false); 
     237                 
     238                if (field.isFieldLocked()) { 
     239                        Icon lockIcon = null; 
     240                        Lock lock = field.getLock(); 
     241                        switch (lock.getLockLevel()) { 
     242                        case Lock.FULLY_LOCKED: 
     243                                lockIcon = iconManager.getIcon(IconManager.FULL_LOCK); 
     244                                break; 
     245                        case Lock.TEMPLATE_LOCKED: 
     246                                lockIcon = iconManager.getIcon(IconManager.TEMPLATE_LOCK); 
     247                                break; 
     248                        } 
     249                        nameLabel.setIcon(lockIcon); 
     250                        nameLabel.setToolTipText(lock.toString()); 
     251                } 
    235252                 
    236253                // A description label displays description below the field. 
    … …  
    438455                String description = field.getAttribute( 
    439456                                Field.FIELD_DESCRIPTION); 
    440                 boolean showDescription =  
    441                         "true".equals(field.getDisplayAttribute("descVisible")); 
     457                boolean showDescription = treeNode.getDescriptionVisisibility(); 
    442458                 
    443459                if ((description != null) && (description.trim().length() > 0)) { 
    … …  
    573589                this.field = field; 
    574590                this.tree = tree; 
    575                 this.treeNode = treeNode; 
     591                this.treeNode = (FieldNode)treeNode; 
    576592                this.controller = controller; 
    577593                 
    … …  
    674690        } 
    675691         
     692        /** 
     693         * Handles the actions of several buttons that could appear in  
     694         * this panel.  
     695         *  
     696         * @see ActionListener#actionPerformed(ActionEvent) 
     697         */ 
    676698        public void actionPerformed(ActionEvent e) { 
    677699                 
    … …  
    682704                 
    683705                else if (TOGGLE_DESCRIPTION_CMD.equals(cmd)) { 
    684                         boolean visible =  
    685                                 "true".equals(field.getDisplayAttribute("descVisible")); 
    686                         visible = ! visible; 
    687                         field.setDisplayAttribute("descVisible", visible + ""); 
     706                        treeNode.toggleDescriptionVisibility(); 
    688707                        refreshEditingOfPanel(); 
    689708                } 
  • trunk/SRC/org/openmicroscopy/shoola/agents/editor/browser/FieldRenderer.java

    r5590 r5626  
    101101                                IField field = (IField)object; 
    102102                                 
    103                                 toolTipText = field.getDisplayAttribute(Field.TOOL_TIP_TEXT); 
     103                                toolTipText = field.getToolTipText(); 
    104104                                 
    105105                                FieldPanel fieldPanel = new FieldPanel(field, tree,  
  • trunk/SRC/org/openmicroscopy/shoola/agents/editor/browser/TreeOutlineCellRenderer.java

    r5596 r5626  
    8383                        if (object instanceof IField) { 
    8484                                IField field = (IField)object; 
    85                                 toolTipText = field.getDisplayAttribute(Field.TOOL_TIP_TEXT); 
     85                                toolTipText = field.getToolTipText(); 
    8686                                 
    8787                                if (field.getParamCount() < 1) { 
  • trunk/SRC/org/openmicroscopy/shoola/agents/editor/model/Field.java

    r5594 r5626  
    8989         */ 
    9090        private List<IParam>                    fieldParams; 
     91         
     92        /** 
     93         * A reference to a lock that may be applied to this field to prevent 
     94         * editing of some attributes or parameters.  
     95         */ 
     96        private Lock                                    fieldLock; 
    9197 
    9298        /** 
    … …  
    292298         * @return              see above. 
    293299         */ 
    294         private String getToolTipText()  
     300        public String getToolTipText()  
    295301        { 
    296302                String desc = getAttribute(FIELD_DESCRIPTION); 
    … …  
    313319                return toolTipText; 
    314320        } 
     321         
     322        /** 
     323         * Sets a lock on this field to prevent editing.  
     324         * @see #fieldLock 
     325         *  
     326         * @param lock 
     327         */ 
     328        public void setLock(Lock lock) 
     329        { 
     330                fieldLock = lock; 
     331        } 
     332         
     333        /** 
     334         * Returns this field's lock (or null if no lock). 
     335         *  
     336         * @return              see above 
     337         */ 
     338        public Lock getLock() { return fieldLock; } 
     339 
     340        /** 
     341         * Implemented as specified by the {@link IField} interface. 
     342         *  
     343         * @see IField#isFieldLocked() 
     344         */ 
     345        public boolean isFieldLocked() { 
     346                if (fieldLock == null)  return false; 
     347         
     348                return (! (fieldLock.getLockLevel() == Lock.NOT_LOCKED)); 
     349        } 
    315350} 
  • trunk/SRC/org/openmicroscopy/shoola/agents/editor/model/FieldNode.java

    r5594 r5626  
    4646 */ 
    4747public class FieldNode  
    48         extends DefaultMutableTreeNode { 
     48        extends DefaultMutableTreeNode  
     49{ 
    4950 
    50         private boolean nodeExpanded; 
     51        private boolean                 descriptionVisible; 
    5152         
    5253        public FieldNode(IField newField) { 
    … …  
    5455        } 
    5556 
    56         public void setExpanded(boolean expanded) { 
    57                 nodeExpanded = expanded; 
     57        /** 
     58         * Sets the visibility of the the description.  
     59         *  
     60         * @param visible 
     61         */ 
     62        public void setDescriptionVisible(boolean visible) 
     63        { 
     64                descriptionVisible = visible; 
    5865        } 
    5966         
     67        /** 
     68         * Toggles the boolean {@link #descriptionVisible} and returns 
     69         * the new value. 
     70         *       
     71         * @return              The new (toggled) value of {@link #descriptionVisible} 
     72         */ 
     73        public boolean toggleDescriptionVisibility()  
     74        { 
     75                descriptionVisible = !descriptionVisible; 
     76                 
     77                return descriptionVisible; 
     78        } 
     79         
     80        /** 
     81         * Gets the boolean {@link #descriptionVisible} 
     82         *       
     83         * @return              The value of {@link #descriptionVisible} 
     84         */ 
     85        public boolean getDescriptionVisisibility() 
     86        { 
     87                return descriptionVisible; 
     88        } 
    6089} 
  • trunk/SRC/org/openmicroscopy/shoola/agents/editor/model/IField.java

    r5594 r5626  
    9595         */ 
    9696        public boolean isFieldFilled(); 
    97  
    98         /** 
    99          * UI classes may want to set display attributes that do not affect 
    100          * the data (eg collapsed state, description visible).  
    101          *  
    102          * @param name  The name of the display attribute.  
    103          * @param value         The new value of the attribute 
    104          */ 
    105         public void setDisplayAttribute(String name, String value); 
    106          
    10797         
    10898        /** 
    109          * UI classes may want to get display attributes that do not affect 
    110          * the data (eg collapsed state, description visible).  
     99         * Returns a String containing the field description, plus the  
     100         * tool-tip-text from it's parameters.  
    111101         *  
    112          * @param name          The named attribute 
    113          * @return                      The value of the attribute 
     102         * @return              see above. 
    114103         */ 
    115         public String getDisplayAttribute(String name); 
     104        public String getToolTipText(); 
    116105         
     106        /** 
     107         * Returns true if the is a lock on this field. 
     108         *  
     109         * @return              see above 
     110         */ 
     111        public boolean isFieldLocked(); 
     112         
     113        /** 
     114         * Returns this field's lock (or null if no lock). 
     115         *  
     116         * @return              see above 
     117         */ 
     118        public Lock getLock(); 
    117119} 
  • trunk/SRC/org/openmicroscopy/shoola/agents/editor/model/TreeModelFactory.java

    r5625 r5626  
    206206                  
    207207                 // Create a new field and set it's attributes. 
    208                  IField field = new Field(); 
     208                 Field field = new Field(); 
    209209                  
    210210                 field.setAttribute(Field.FIELD_NAME, fieldName); 
    … …  
    212212                 field.setAttribute(Field.FIELD_URL, url); 
    213213                 field.setAttribute(Field.BACKGROUND_COLOUR, colour); 
     214                  
     215                 // Field lock 
     216                 String lockLevel = allAttributes.get(DataFieldConstants.LOCK_LEVEL); 
     217                 if (lockLevel != null) { 
     218                         String userName = allAttributes.get 
     219                                        (DataFieldConstants.LOCKED_FIELD_USER_NAME); 
     220                         int locking; 
     221                         if (lockLevel.equals(DataFieldConstants.LOCKED_TEMPLATE)) { 
     222                                 locking = Lock.TEMPLATE_LOCKED; 
     223                         } else { 
     224                                 locking = Lock.FULLY_LOCKED; 
     225                         } 
     226                         Lock lock = new Lock(locking, userName); 
     227                          
     228                         String utc = allAttributes.get(DataFieldConstants.LOCKED_FIELD_UTC); 
     229                         lock.setTimeStamp(utc); 
     230                          
     231                         field.setLock(lock); 
     232                 } 
     233                  
    214234                  
    215235                 // Field will have 0 or 1 "parameters", depending on type 

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/