Changeset 5526 for branches/OmeroEditor/src/ui/formFields/FormField.java
- Timestamp:
- 07/04/08 11:49:37 (5 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
branches/OmeroEditor/src/ui/formFields/FormField.java
r5483 r5526 69 69 // Subclasses have eg TextFields etc 70 70 71 public abstract class FormField extends JPanel implements DataFieldObserver{ 71 public abstract class FormField 72 extends JPanel 73 implements DataFieldObserver{ 72 74 73 75 IDataFieldObservable dataFieldObs; … … 84 86 public static final String HAS_FOCUS = "hasFocus"; 85 87 86 boolean textChanged = false; 87 TextChangedListener textChangedListener = new TextChangedListener(); 88 FocusListener focusChangedListener = new FocusChangedListener(); 88 /** 89 * Add this listener to various buttons etc, so that if they are clicked. 90 * this field will become selected. 91 */ 89 92 FocusListener componentFocusListener = new FormFieldComponentFocusListener(); 90 93 … … 128 131 Icon spacerIcon; // A blank icon to replace collapsedIcon if there are no children. 129 132 130 // used in Diff (comparing two trees), to get a ref to all components, to colour red if different!131 ArrayList<JComponent> visibleAttributes = new ArrayList<JComponent>();132 133 133 134 boolean showDescription = false; // not saved, just used to toggle … … 205 206 descriptionLabel = new JLabel(); 206 207 descriptionLabel.setBackground(null); 207 visibleAttributes.add(descriptionLabel);208 208 209 infoIcon = ImageFactory.getInstance().getIcon(ImageFactory.INFO_ICON); 209 210 descriptionButton = new JButton(infoIcon); … … 559 560 if(evt.getPropertyName().equals(FormField.HAS_FOCUS)) { 560 561 panelClicked(true); 562 System.out.println("FormField. FocusGainedPropertyChangedListener"); 561 563 } 562 564 } … … 761 763 } 762 764 763 public ArrayList<JComponent> getVisibleAttributes() {764 return visibleAttributes;765 }766 765 767 766 private String addHtmlTagsForNameLabel(String text) { … … 770 769 } 771 770 772 773 public class TextChangedListener implements KeyListener {774 775 public void keyTyped(KeyEvent event) {776 textChanged = true; // some character was typed, so set this flag777 }778 public void keyPressed(KeyEvent event) {}779 public void keyReleased(KeyEvent event) {}780 781 }782 783 public class FocusChangedListener implements FocusListener {784 785 public void focusLost(FocusEvent event) {786 if (textChanged) {787 JTextComponent source = (JTextComponent)event.getSource();788 789 setDataFieldAttribute(source.getName(), source.getText(), true);790 791 textChanged = false;792 }793 }794 public void focusGained(FocusEvent event) {}795 }796 797 798 771 // called to update dataField with attribute 799 772 protected void setDataFieldAttribute(String attributeName, String value, boolean notifyUndoRedo) {
