net.wotonomy.ui.swing
Class TableAssociation

java.lang.Object
  extended by net.wotonomy.control.EODelayedObserver
      extended by net.wotonomy.ui.EOAssociation
          extended by net.wotonomy.ui.swing.TableAssociation
All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.event.FocusListener, java.util.EventListener, java.util.Observer, javax.swing.event.ListSelectionListener, net.wotonomy.control.EOObserving

public class TableAssociation
extends net.wotonomy.ui.EOAssociation
implements java.awt.event.ActionListener, javax.swing.event.ListSelectionListener, java.awt.event.FocusListener

TableAssociation binds one or more TableColumnAssociations to a display group. You should not instantiate this class directly; use TableColumnAssociation.setTable() instead. Note that TableAssociation inserts itself as the controlled JTable's TableModel. Bindings are:

Version:
$Revision: 904 $
Author:
michael@mpowers.net, $Author: cgruber $

Field Summary
static java.lang.String COPY
           
 
Fields inherited from class net.wotonomy.ui.EOAssociation
ActionAspect, ArgumentAspect, aspectToGroup, aspectToKey, AttributeAspectSignature, AttributeToManyAspectSignature, AttributeToOneAspectSignature, AttributeToOneToManyAspectSignature, BoldAspect, ChildrenAspect, control, DestinationAspect, EditableAspect, EnabledAspect, IconAspect, IsLeafAspect, ItalicAspect, LabelAspect, NullAspectSignature, ObjectsAspect, ParentAspect, SelectedObjectAspect, SelectedTitleAspect, SourceAspect, TitlesAspect, ToManyAspectSignature, ToOneAspectSignature, ToOneToManyAspectSignature, URLAspect, ValueAspect, VisibleAspect
 
Fields inherited from class net.wotonomy.control.EODelayedObserver
ObserverNumberOfPriorities, ObserverPriorityFifth, ObserverPriorityFirst, ObserverPriorityFourth, ObserverPriorityImmediate, ObserverPriorityLater, ObserverPrioritySecond, ObserverPrioritySixth, ObserverPriorityThird
 
Constructor Summary
TableAssociation(java.lang.Object anObject)
          Constructor specifying the object to be controlled by this association.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent evt)
           
protected  void addAsListener()
           
static net.wotonomy.foundation.NSArray aspects()
          Returns a List that describes the aspects supported by this class.
static net.wotonomy.foundation.NSArray aspectSignatures()
          Returns a List of aspect signatures whose contents correspond with the aspects list.
static net.wotonomy.foundation.NSArray associationClassesSuperseded()
          Returns a List of EOAssociation subclasses that, for the objects that are usable for this association, are less suitable than this association.
 void bindAspect(java.lang.String anAspect, net.wotonomy.ui.EODisplayGroup aDisplayGroup, java.lang.String aKey)
          Binds the specified aspect of this association to the specified key on the specified display group.
 void breakConnection()
          Breaks the connection between this association and its object.
 boolean canBindAspect(java.lang.String anAspect, net.wotonomy.ui.EODisplayGroup aDisplayGroup, java.lang.String aKey)
          Returns whether this association can bind to the specified display group on the specified key for the specified aspect.
 void copyToClipboard()
          Copies the contents of the table to the clipboard as a tab-delimited string.
 boolean endEditing()
          Forces this association to cause the object to stop editing and validate the user's input.
 void establishConnection()
          Establishes a connection between this association and the controlled object.
 void focusGained(java.awt.event.FocusEvent evt)
          Notifies of beginning of edit.
 void focusLost(java.awt.event.FocusEvent evt)
          Updates object on focus lost and notifies of end of edit.
 java.lang.String getTabDelimitedString()
          Converts the contents of the table to a tab-delimited string.
 boolean isSelectionPaintedImmediately()
          Determines whether the selection should be painted immediately after the user clicks and therefore before the children display group is updated.
 boolean isSelectionTracking()
          Determines whether the selection is actively tracking the selection as the user moves the mouse.
static boolean isUsableWithObject(java.lang.Object anObject)
          Returns whether this class can control the specified object.
static net.wotonomy.foundation.NSArray objectKeysTaken()
          Returns a List of properties of the controlled object that are controlled by this class.
static java.lang.String primaryAspect()
          Returns the aspect that is considered primary or default.
protected  void removeAsListener()
           
 void setSelectionPaintedImmediately(boolean isImmediate)
          Sets whether the selection should be painted immediately.
 void setSelectionTracking(boolean isTracking)
          Sets whether the selection is actively tracking the selection as the user moves the mouse.
 void subjectChanged()
          Called when either the selection or the contents of an associated display group have changed.
 void valueChanged(javax.swing.event.ListSelectionEvent e)
           
 
Methods inherited from class net.wotonomy.ui.EOAssociation
associationClassesForObject, copyMatchingBindingsFromAssociation, displayGroupForAspect, displayGroupKeyForAspect, displayName, object, setValueForAspect, setValueForAspectAtIndex, shouldEndEditing, shouldEndEditingAtIndex, valueForAspect, valueForAspectAtIndex
 
Methods inherited from class net.wotonomy.control.EODelayedObserver
discardPendingNotification, objectWillChange, observerQueue, priority, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COPY

public static final java.lang.String COPY
See Also:
Constant Field Values
Constructor Detail

TableAssociation

public TableAssociation(java.lang.Object anObject)
Constructor specifying the object to be controlled by this association. Throws an exception if the object is not a TableColumn. setTable() must be called before establishing the connection.

Method Detail

aspectSignatures

public static net.wotonomy.foundation.NSArray aspectSignatures()
Returns a List of aspect signatures whose contents correspond with the aspects list. Each element is a string whose characters represent a capability of the corresponding aspect. An empty signature "" means that the aspect can bind without needing a key. This implementation returns "A1M" for each element in the aspects array.


aspects

public static net.wotonomy.foundation.NSArray aspects()
Returns a List that describes the aspects supported by this class. Each element in the list is the string name of the aspect. This implementation returns an empty list.


associationClassesSuperseded

public static net.wotonomy.foundation.NSArray associationClassesSuperseded()
Returns a List of EOAssociation subclasses that, for the objects that are usable for this association, are less suitable than this association.


isUsableWithObject

public static boolean isUsableWithObject(java.lang.Object anObject)
Returns whether this class can control the specified object.


objectKeysTaken

public static net.wotonomy.foundation.NSArray objectKeysTaken()
Returns a List of properties of the controlled object that are controlled by this class. For example, "stringValue", or "selected".


primaryAspect

public static java.lang.String primaryAspect()
Returns the aspect that is considered primary or default. This is typically "value" or somesuch.


canBindAspect

public boolean canBindAspect(java.lang.String anAspect,
                             net.wotonomy.ui.EODisplayGroup aDisplayGroup,
                             java.lang.String aKey)
Returns whether this association can bind to the specified display group on the specified key for the specified aspect.

Overrides:
canBindAspect in class net.wotonomy.ui.EOAssociation

bindAspect

public void bindAspect(java.lang.String anAspect,
                       net.wotonomy.ui.EODisplayGroup aDisplayGroup,
                       java.lang.String aKey)
Binds the specified aspect of this association to the specified key on the specified display group.

Overrides:
bindAspect in class net.wotonomy.ui.EOAssociation

establishConnection

public void establishConnection()
Establishes a connection between this association and the controlled object. Subclasses should begin listening for events from their controlled object here.

Overrides:
establishConnection in class net.wotonomy.ui.EOAssociation

breakConnection

public void breakConnection()
Breaks the connection between this association and its object. Override to stop listening for events from the object.

Overrides:
breakConnection in class net.wotonomy.ui.EOAssociation

addAsListener

protected void addAsListener()

removeAsListener

protected void removeAsListener()

endEditing

public boolean endEditing()
Forces this association to cause the object to stop editing and validate the user's input.

Overrides:
endEditing in class net.wotonomy.ui.EOAssociation
Returns:
false if there were problems validating, or true to continue.

subjectChanged

public void subjectChanged()
Called when either the selection or the contents of an associated display group have changed.

Overrides:
subjectChanged in class net.wotonomy.ui.EOAssociation

valueChanged

public void valueChanged(javax.swing.event.ListSelectionEvent e)
Specified by:
valueChanged in interface javax.swing.event.ListSelectionListener

isSelectionPaintedImmediately

public boolean isSelectionPaintedImmediately()
Determines whether the selection should be painted immediately after the user clicks and therefore before the children display group is updated. When the children group is bound to many associations or is bound to a master-detail association, updating the display group can take a perceptibly long time. This property defaults to false.

See Also:
setSelectionPaintedImmediately(boolean)

setSelectionPaintedImmediately

public void setSelectionPaintedImmediately(boolean isImmediate)
Sets whether the selection should be painted immediately. Setting this property to true will let the table paint first before the display group is updated.


isSelectionTracking

public boolean isSelectionTracking()
Determines whether the selection is actively tracking the selection as the user moves the mouse. If true, selection will not be updated while the list selection event returns true for isValueAdjusting(). This property defaults to false.

See Also:
setSelectionTracking(boolean)

setSelectionTracking

public void setSelectionTracking(boolean isTracking)
Sets whether the selection is actively tracking the selection as the user moves the mouse. Setting this property to true will update the display group with each change to the selection. This means that any tree selection listers will also be notified before the display group is updated and will have to invokeLater if they want to see the updated display group.


copyToClipboard

public void copyToClipboard()
Copies the contents of the table to the clipboard as a tab-delimited string.


getTabDelimitedString

public java.lang.String getTabDelimitedString()
Converts the contents of the table to a tab-delimited string.

Returns:
A String containing the text contents of the table.

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent evt)
Specified by:
actionPerformed in interface java.awt.event.ActionListener

focusGained

public void focusGained(java.awt.event.FocusEvent evt)
Notifies of beginning of edit.

Specified by:
focusGained in interface java.awt.event.FocusListener

focusLost

public void focusLost(java.awt.event.FocusEvent evt)
Updates object on focus lost and notifies of end of edit.

Specified by:
focusLost in interface java.awt.event.FocusListener


Copyright © 2006 null. All Rights Reserved.