• 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 Change
  • Next Change →

Changeset 5546 for branches/OmeroEditor/src/fields/FieldPanel.java

Show
Ignore:
Timestamp:
07/23/08 15:32:07 (4 months ago)
Author:
will
Message:

Actions and UndoableEdit? framework setup.
Can open Beta 3.0 XML files (not all fields rendered yet)

Files:
1 modified

  • branches/OmeroEditor/src/fields/FieldPanel.java (modified) (9 diffs)

Legend:

Unmodified
Added
Removed
  • branches/OmeroEditor/src/fields/FieldPanel.java

    r5543 r5546  
    204204        Border imageBorderHighlight; 
    205205         
    206         /** 
    207          * A flag used to toggle the display of the description.  
    208          */ 
    209         boolean showDescription = false; 
    210          
    211206         
    212207        /** 
    … …  
    259254                descriptionButton.addActionListener(new ActionListener(){ 
    260255                        public void actionPerformed(ActionEvent event) { 
    261                                 showDescription = !showDescription; 
    262                                 descriptionLabel.setVisible(showDescription); 
     256                                // TODO 
     257                                // Need to set an attribute in the dataField such as  
     258                                // descriptionVisible = true / false 
    263259                        } 
    264260                }); 
    … …  
    326322                horizontalBox.add(defaultButton); 
    327323                horizontalBox.add(requiredFieldButton); 
     324                horizontalBox.add(descriptionLabel); 
    328325                horizontalBox.add(Box.createHorizontalStrut(10)); 
    329326                 
    … …  
    337334                contentsPanel.add(nameLabel, BorderLayout.WEST); 
    338335                contentsPanel.add(horizontalBox, BorderLayout.CENTER); 
    339                 contentsPanel.add(descriptionLabel, BorderLayout.SOUTH); 
     336                //contentsPanel.add(descriptionLabel, BorderLayout.SOUTH); 
    340337                 
    341338                contentsPanel.setBorder(imageBorder); 
    … …  
    349346                 */ 
    350347                setNameText(addHtmlTagsForNameLabel( 
    351                                 dataField.getAttribute(DataFieldConstants.ELEMENT_NAME))); 
     348                                dataField.getAttribute(Field.FIELD_NAME))); 
    352349                setDescriptionText( 
    353                                 dataField.getAttribute(DataFieldConstants.DESCRIPTION)); 
    354                 setURL(dataField.getAttribute(DataFieldConstants.URL)); 
     350                                dataField.getAttribute(Field.FIELD_DESCRIPTION)); 
     351                setURL(dataField.getAttribute(Field.FIELD_URL)); 
    355352                 
    356353                refreshBackgroundColour(); 
    … …  
    358355                refreshDefaultValue(); 
    359356                 
    360                 /* 
    361                  * Add additional UI components for editing the value of this field. 
    362                  * Use a Factory to create the UI components, depending on the value type 
    363                  */ 
    364                 IFieldValue valueObject = ((Field)field).getValueObject(); 
    365                 JComponent edit = EditingComponentFactory.getEditingComponent(valueObject); 
    366                 addFieldComponent(edit); 
     357                buildParamComponents(); 
     358        } 
     359         
     360        /** 
     361         * Add additional UI components for editing the value of this field. 
     362         * Use a Factory to create the UI components, depending on the value type 
     363         */ 
     364        public void buildParamComponents() { 
     365 
     366                int paramCount = dataField.getParamCount(); 
     367                 
     368                for (int i=0; i<paramCount; i++) { 
     369                        IParam param = dataField.getParamAt(i); 
     370                        JComponent edit = EditingComponentFactory.getEditingComponent(param); 
     371                        if (edit != null) 
     372                                addFieldComponent(edit); 
     373                } 
     374                 
    367375        } 
    368376         
    … …  
    440448        } 
    441449         
     450 
     451         
    442452        public void setDescriptionText(String description) { 
    443453                if ((description != null) && (description.trim().length() > 0)) { 
    … …  
    445455                        descriptionButton.setToolTipText(htmlDescription); 
    446456                        descriptionButton.setVisible(true); 
    447                         descriptionLabel.setVisible(showDescription); 
     457                        // TODO setVisibility of label based on dataField attribute  
     458                        //descriptionLabel.setVisible(showDescription); 
    448459                        descriptionLabel.setFont(XMLView.FONT_TINY); 
    449460                        descriptionLabel.setText(htmlDescription); 
    … …  
    552563 
    553564 
     565        /** 
     566         * If the size of a sub-component of this panel changes,  
     567         * the JTree in which it is contained must be required to  
     568         * re-draw the panel.  
     569         */ 
    554570        public void propertyChange(PropertyChangeEvent evt) { 
    555571                 
    556572                if (SIZE_CHANGED_PROPERTY.equals(evt.getPropertyName())) { 
    557573                 
    558                         if ((tree != null) && (treeNode !=null)) { 
    559                                  
    560                                 TreePath path = new TreePath(treeNode.getPath()); 
    561                                  
    562                                 tree.getUI().startEditingAtPath(tree, path); 
    563                         } 
    564                 } 
    565         } 
    566  
     574                        refreshSizeOfPanel(); 
     575                } 
     576        } 
     577 
     578         
     579        /** 
     580         * This method is used to refresh the size of this panel in the JTree. 
     581         * It must also remain in the editing mode, otherwise the user who 
     582         * is currently editing it will be required to click again to  
     583         * continue editing. 
     584         * This can be achieved by calling startEditingAtPath(tree, path) 
     585         */ 
     586        public void refreshSizeOfPanel() { 
     587                if ((tree != null) && (treeNode !=null)) { 
     588                         
     589                        TreePath path = new TreePath(treeNode.getPath()); 
     590                         
     591                        tree.getUI().startEditingAtPath(tree, path); 
     592                } 
     593        } 
    567594         
    568595 

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/