Changeset 5546 for branches/OmeroEditor/src/fields/FieldPanel.java
- Timestamp:
- 07/23/08 15:32:07 (4 months ago)
- Files:
-
- 1 modified
-
branches/OmeroEditor/src/fields/FieldPanel.java (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/OmeroEditor/src/fields/FieldPanel.java
r5543 r5546 204 204 Border imageBorderHighlight; 205 205 206 /**207 * A flag used to toggle the display of the description.208 */209 boolean showDescription = false;210 211 206 212 207 /** … … 259 254 descriptionButton.addActionListener(new ActionListener(){ 260 255 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 263 259 } 264 260 }); … … 326 322 horizontalBox.add(defaultButton); 327 323 horizontalBox.add(requiredFieldButton); 324 horizontalBox.add(descriptionLabel); 328 325 horizontalBox.add(Box.createHorizontalStrut(10)); 329 326 … … 337 334 contentsPanel.add(nameLabel, BorderLayout.WEST); 338 335 contentsPanel.add(horizontalBox, BorderLayout.CENTER); 339 contentsPanel.add(descriptionLabel, BorderLayout.SOUTH);336 //contentsPanel.add(descriptionLabel, BorderLayout.SOUTH); 340 337 341 338 contentsPanel.setBorder(imageBorder); … … 349 346 */ 350 347 setNameText(addHtmlTagsForNameLabel( 351 dataField.getAttribute( DataFieldConstants.ELEMENT_NAME)));348 dataField.getAttribute(Field.FIELD_NAME))); 352 349 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)); 355 352 356 353 refreshBackgroundColour(); … … 358 355 refreshDefaultValue(); 359 356 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 367 375 } 368 376 … … 440 448 } 441 449 450 451 442 452 public void setDescriptionText(String description) { 443 453 if ((description != null) && (description.trim().length() > 0)) { … … 445 455 descriptionButton.setToolTipText(htmlDescription); 446 456 descriptionButton.setVisible(true); 447 descriptionLabel.setVisible(showDescription); 457 // TODO setVisibility of label based on dataField attribute 458 //descriptionLabel.setVisible(showDescription); 448 459 descriptionLabel.setFont(XMLView.FONT_TINY); 449 460 descriptionLabel.setText(htmlDescription); … … 552 563 553 564 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 */ 554 570 public void propertyChange(PropertyChangeEvent evt) { 555 571 556 572 if (SIZE_CHANGED_PROPERTY.equals(evt.getPropertyName())) { 557 573 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 } 567 594 568 595
