• 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 5543 for branches/OmeroEditor/src/ui/components/AttributeEditorListeners.java

Show
Ignore:
Timestamp:
07/17/08 16:32:21 (4 months ago)
Author:
will
Message:

Basically working JTree, with custom Rendering, Editing and Selection behavior

Files:
1 modified

  • branches/OmeroEditor/src/ui/components/AttributeEditorListeners.java (modified) (4 diffs)

Legend:

Unmodified
Added
Removed
  • branches/OmeroEditor/src/ui/components/AttributeEditorListeners.java

    r5526 r5543  
    3131import javax.swing.text.JTextComponent; 
    3232 
     33import fields.IField; 
     34 
    3335//Third-party libraries 
    3436 
    … …  
    4345 * Then when focus is lost, the focusListener updates the dataField 
    4446 * attribute (if textChanged), by calling  
    45  * setDataFieldAttribute.  
     47 * setDataFieldAttribute. TextChanged is reset to false. 
    4648 * 
    4749 * @author  William Moore      
    … …  
    6062        boolean textChanged; 
    6163         
    62         IAttributeSaver dataField; 
     64        IField dataField; 
    6365         
    6466        String attributeName; 
    6567         
    66         public AttributeEditorListeners(IAttributeSaver dataField,  
     68        public AttributeEditorListeners(IField dataField,  
    6769                        String attributeName) { 
    6870                 
    … …  
    9193        // called to update dataField with attribute 
    9294        protected void setDataFieldAttribute(String value, boolean notifyUndoRedo) { 
    93                 dataField.setAttribute(attributeName, value, notifyUndoRedo); 
     95                dataField.setAttribute(attributeName, value); 
    9496                textChanged = false; 
     97        } 
     98         
     99        /** 
     100         * Convenience method for adding listeners to a text component, such that 
     101         * the text component will then update the IField, using its 
     102         * setAttribute(attributeName, value) method. 
     103         *  
     104         * @param textComp              The text component to add the listeners to 
     105         * @param field                 The IField that will be updated with new text value      
     106         * @param attributeName The name of the attribute to set to the new value 
     107         */ 
     108        public static void addListeners(JTextComponent textComp, IField field,  
     109                        String attributeName) { 
     110                AttributeEditorListeners listeners = new AttributeEditorListeners(field,  
     111                                attributeName); 
     112                textComp.addFocusListener(listeners); 
     113                textComp.addKeyListener(listeners); 
    95114        } 
    96115 

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/