com.threerings.admin.client
Class TabbedDSetEditor<E extends DSet.Entry>

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by com.threerings.admin.client.TabbedDSetEditor<E>
All Implemented Interfaces:
AttributeChangeListener, ChangeListener, SetListener<E>, ImageObserver, MenuContainer, Serializable, Accessible

public class TabbedDSetEditor<E extends DSet.Entry>
extends JPanel
implements AttributeChangeListener, SetListener<E>

Allows simple editing of DSets within a distributed object and easily groups entries into tabs based on the content of some field.

See Also:
Serialized Form

Nested Class Summary
static interface TabbedDSetEditor.AccessorFactory
          Defines how DSetEditor data-access plugins should be created.
static class TabbedDSetEditor.EntryGrouper<E extends DSet.Entry>
          Used to divide various entires into different groups.
static class TabbedDSetEditor.FieldGrouper<E extends DSet.Entry>
           
 
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
protected  TabbedDSetEditor.AccessorFactory _accessorFactory
           
protected  String[] _editableFields
           
protected  HashMap<String,DSetEditor<E>> _editors
           
protected  Class<?> _entryClass
           
protected  TabbedDSetEditor.EntryGrouper<E> _grouper
           
protected  ObjectEditorTable.FieldInterpreter _interp
           
protected  String _setName
           
protected  DObject _setter
           
protected  JTabbedPane _tabs
           
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
TabbedDSetEditor(DObject setter, String setName, Class<?> entryClass, String[] editableFields, ObjectEditorTable.FieldInterpreter interp, String groupField)
          Convenience function to make an edittor that groups based on the values of a given field.
TabbedDSetEditor(DObject setter, String setName, Class<?> entryClass, String[] editableFields, ObjectEditorTable.FieldInterpreter interp, TabbedDSetEditor.EntryGrouper<E> grouper)
          A set of tabs containing DSetEditors grouping entries by the String value stored in a given field of the Entry.
 
Method Summary
 void addNotify()
           
 void attributeChanged(AttributeChangedEvent event)
          Called when an attribute changed event has been dispatched on an object.
protected  void computeTabs()
           
protected  DSetEditor<E> createEditor(DObject setter, String setName, Class<?> entryClass, String[] editableFields, ObjectEditorTable.FieldInterpreter interp, TabbedDSetEditor.EntryGrouper<E> grouper, String group)
          Creates a DSetEditor for displaying the given group.
 void entryAdded(EntryAddedEvent<E> event)
          Called when an entry added event has been dispatched on an object.
 void entryRemoved(EntryRemovedEvent<E> event)
          Called when an entry removed event has been dispatched on an object.
 void entryUpdated(EntryUpdatedEvent<E> event)
          Called when an entry updated event has been dispatched on an object.
protected  String[] getDisplayFields(String group)
          Choose which fields to display for the given group.
 void removeNotify()
           
 void setAccessorFactory(TabbedDSetEditor.AccessorFactory accessorFactory)
          Assigns the factory that creates data-access plugins for our set our DSetEditors.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_setter

protected final DObject _setter

_setName

protected final String _setName

_entryClass

protected final Class<?> _entryClass

_editableFields

protected final String[] _editableFields

_interp

protected final ObjectEditorTable.FieldInterpreter _interp

_grouper

protected final TabbedDSetEditor.EntryGrouper<E extends DSet.Entry> _grouper

_accessorFactory

protected TabbedDSetEditor.AccessorFactory _accessorFactory

_tabs

protected JTabbedPane _tabs

_editors

protected HashMap<String,DSetEditor<E extends DSet.Entry>> _editors
Constructor Detail

TabbedDSetEditor

public TabbedDSetEditor(DObject setter,
                        String setName,
                        Class<?> entryClass,
                        String[] editableFields,
                        ObjectEditorTable.FieldInterpreter interp,
                        String groupField)
Convenience function to make an edittor that groups based on the values of a given field.


TabbedDSetEditor

public TabbedDSetEditor(DObject setter,
                        String setName,
                        Class<?> entryClass,
                        String[] editableFields,
                        ObjectEditorTable.FieldInterpreter interp,
                        TabbedDSetEditor.EntryGrouper<E> grouper)
A set of tabs containing DSetEditors grouping entries by the String value stored in a given field of the Entry.

Method Detail

setAccessorFactory

public void setAccessorFactory(TabbedDSetEditor.AccessorFactory accessorFactory)
Assigns the factory that creates data-access plugins for our set our DSetEditors.


computeTabs

protected void computeTabs()

createEditor

protected DSetEditor<E> createEditor(DObject setter,
                                     String setName,
                                     Class<?> entryClass,
                                     String[] editableFields,
                                     ObjectEditorTable.FieldInterpreter interp,
                                     TabbedDSetEditor.EntryGrouper<E> grouper,
                                     String group)
Creates a DSetEditor for displaying the given group.


getDisplayFields

protected String[] getDisplayFields(String group)
Choose which fields to display for the given group.


addNotify

public void addNotify()
Overrides:
addNotify in class JComponent

removeNotify

public void removeNotify()
Overrides:
removeNotify in class JComponent

attributeChanged

public void attributeChanged(AttributeChangedEvent event)
Description copied from interface: AttributeChangeListener
Called when an attribute changed event has been dispatched on an object. This will be called after the event has been applied to the object. So fetching the attribute during this call will provide the new value for the attribute.

Specified by:
attributeChanged in interface AttributeChangeListener
Parameters:
event - The event that was dispatched on the object.

entryAdded

public void entryAdded(EntryAddedEvent<E> event)
Description copied from interface: SetListener
Called when an entry added event has been dispatched on an object. This will be called after the event has been applied to the object.

Specified by:
entryAdded in interface SetListener<E extends DSet.Entry>
Parameters:
event - The event that was dispatched on the object.

entryRemoved

public void entryRemoved(EntryRemovedEvent<E> event)
Description copied from interface: SetListener
Called when an entry removed event has been dispatched on an object. This will be called after the event has been applied to the object.

Specified by:
entryRemoved in interface SetListener<E extends DSet.Entry>
Parameters:
event - The event that was dispatched on the object.

entryUpdated

public void entryUpdated(EntryUpdatedEvent<E> event)
Description copied from interface: SetListener
Called when an entry updated event has been dispatched on an object. This will be called after the event has been applied to the object.

Specified by:
entryUpdated in interface SetListener<E extends DSet.Entry>
Parameters:
event - The event that was dispatched on the object.