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

Show
Ignore:
Timestamp:
10/09/08 10:36:27 (6 weeks ago)
Author:
will
Message:

Background colour of a Field is inherited from it's nearest coloured ancestor.
Fixed bug in NavTree?.

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

  • browser/FieldPanel.java (modified) (2 diffs)
  • browser/NavTree.java (modified) (2 diffs)
  • model/TreeModelMethods.java (modified) (1 diff)

Legend:

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

    r5626 r5660  
    6363import org.openmicroscopy.shoola.agents.editor.model.IField; 
    6464import org.openmicroscopy.shoola.agents.editor.model.Lock; 
     65import org.openmicroscopy.shoola.agents.editor.model.TreeModelMethods; 
    6566import org.openmicroscopy.shoola.agents.editor.model.params.IParam; 
    6667import org.openmicroscopy.shoola.agents.editor.uiComponents.CustomButton; 
    … …  
    506507                paintedColour = getColorFromString(field.getAttribute( 
    507508                                Field.BACKGROUND_COLOUR)); 
     509         
     510                if (paintedColour == null) { 
     511                        String ancestorColour = TreeModelMethods.getAttributeFromAncestor 
     512                                        (Field.BACKGROUND_COLOUR, treeNode); 
     513                        paintedColour = getColorFromString(ancestorColour); 
     514                } 
    508515                 
    509516                refreshHighlighted(); 
  • trunk/SRC/org/openmicroscopy/shoola/agents/editor/browser/NavTree.java

    r5590 r5660  
    7070        /** 
    7171         * Creates an instance of the Navigation tree, based on the model  
    72          * from mainTree. Also calls initialise() to add treeSelectionListeners and 
     72         * from mainTree. Also calls #initialise() to add treeSelectionListeners and 
    7373         * mouseListeners.  
    7474         *  
    … …  
    115115                        { 
    116116                                TreePath path = navTree.getSelectionPath(); 
     117                                // path could be null if user double-clicks on expand-collapse 
     118                                if (path == null)       return; 
    117119                                 
    118120                                mainTree.expandPath(path.getParentPath()); 
  • trunk/SRC/org/openmicroscopy/shoola/agents/editor/model/TreeModelMethods.java

    r5625 r5660  
    290290        } 
    291291         
     292        /** 
     293         * This method progressively checks the ancestors of the given node, 
     294         * looking for the closest ancestor that has a non-null value for 
     295         * the named attribute.  
     296         * The value of this attribute is returned for the closest ancestor. 
     297         * If the root node is reached (parent == null) then null is returned.  
     298         *  
     299         * @param attributeName         The name of the attribute to query 
     300         * @param node                          The node to start at. 
     301         *  
     302         * @return      String                  The value of the attribute from closest  
     303         *                                              ancestor where this is not null. 
     304         */ 
     305        public static String getAttributeFromAncestor(String attributeName, 
     306                        TreeNode node) 
     307        { 
     308                DefaultMutableTreeNode parent; 
     309                Object userObject; 
     310                IAttributes field; 
     311                String value; 
     312                 
     313                parent = (DefaultMutableTreeNode)node.getParent(); 
     314                while(parent != null) { 
     315                        userObject = parent.getUserObject(); 
     316                        if (userObject instanceof IAttributes) { 
     317                                field = (IAttributes)userObject; 
     318                                value = field.getAttribute(attributeName); 
     319                                if (value != null) { 
     320                                        return value; 
     321                                } 
     322                        } 
     323                        parent = (DefaultMutableTreeNode)parent.getParent(); 
     324                } 
     325                 
     326                return null; 
     327        } 
    292328} 

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/