qflib 0.98.1

de.qfs.lib.option
Class TableOptionEdit

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.JPanel
                          |
                          +--de.qfs.lib.option.OptionEdit
                                |
                                +--de.qfs.lib.option.TableOptionEdit
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class TableOptionEdit
extends OptionEdit

JTable based Edit for a TableOption. It uses the following resources:

Resource name Usage
option.name.label The label for the Option (optional, default empty).
option.name.mnemonic Keyboard accelerator (optional, default none).
option.name.disabled If true, the edit will be disabled and remain so even if setEnabled(true) is called (optional, default false).
option.name.width Preferred width of the edit (optional, no default).
option.name.height Preferred height of the edit (optional, no default).
option.name.weight The weight (a double) to use for the edit when placed in the Grid of an OptionGroup (optional, default 1.0).
option.name.configure Whether a ConfigWrapper should be created for the table and registered with the Configuration under the name name.table (optional, default false).
option.name.canedit Whether the cell values can be edited (optional, default true).
option.name.caninsert Whether new rows can be added (optional, default true).
option.name.canremove Whether rows can be deleted (optional, default true).
option.name.canmove Whether rows can be moved up or down (optional, default true).
option.name.directinsert Whether new rows are inserted directly (true) or created via an OptionDialog (false) (optional, default (!canedit)).
option.name.directedit Whether typing a key starts editing the focused cell. This is the default value for the whole table and can be overridden for each column separately (optional, default true).
option.name.columns Whitespace separated list of column identifiers (required).
option.name.column.id.name The name of the column to display in the table's header (optional, default id).
option.name.column.id.type The type of the column. Currently supported are string, taxt, booleanand int (optional, default string).
option.name.column.id.nullok Whether empty values are legal in this column (optional, default false).
option.name.column.id.negativeok Whether negative values are legal in this column (optional, default false, only for columns of type int).
option.name.column.id.default Default value for new rows (optional, default null).
option.name.column.id.disabled If true, values in this column cannot be edited (optional, default false).
option.name.column.id.directedit Whether typing a key starts editing the focused cell (optional, default taken from the value for the whole table).

To edit a row's values in a dialog, an OptionDialog with the same name as the edit's option is used. You can customize this dialog in the usual way. The OptionGroup for this dialog also has the same name. If the resource option.group.name.type is not defined, default values are set to create a plain group with an edit for each column. The labels of these edits are copied from the table hader. If you define the resource option.group.name.type you take full responsibility for all of the groups resources.

Since:
0.98.1
Version:
$Revision: 1.7 $
Author:
Gregor Schmid
See Also:
Serialized Form

Inner Class Summary
protected  class TableOptionEdit.BooleanEditor
          Editor for Boolean table cell.
protected  class TableOptionEdit.Column
          Structure that holds column data.
protected  class TableOptionEdit.Editor
          Baseclass for the cell editors.
protected  class TableOptionEdit.Model
          The table model used by the edit.
 class TableOptionEdit.NumberEditor
          Editor for Number table cell.
 class TableOptionEdit.StringEditor
          Editor for String table cell.
protected  class TableOptionEdit.Table
           
 
Inner classes inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Inner classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Inner classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent
 
Field Summary
protected  boolean canedit
          Whether editing via dialog is allowed.
protected  boolean caninsert
          Whether adding rows is allowed.
protected  boolean canmove
          Whether moving rows is allowed.
protected  boolean canremove
          Whether removing rows is allowed.
protected  TableOptionEdit.Column[] columns
          The columns of the table.
protected  boolean directedit
          Whether to start editing immediately on a keypress.
protected  boolean directinsert
          Whether to insert new rows directly.
protected  boolean enabled
          Whether the edit is currently enabled.
protected  javax.swing.JLabel label
          The label of the edit.
protected  TableOptionEdit.Table table
          The table of the edit.
protected  double weight
          The y-weight of the table.
protected  ConfigWrapper wrapper
          The config wrapper for the table.
 
Fields inherited from class de.qfs.lib.option.OptionEdit
disabled, group, option
 
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
TableOptionEdit()
          Create a new TableOptionEdit.
 
Method Summary
 boolean checkValue()
          Check the currently entered value of the ValueEdit.
 double getWeight()
          Get the y-weight for the TableOptionEdit.
protected  void init()
          Initialize the Edit.
 boolean isEnabled()
          See if the ValueEdit is enabled.
 void readValue()
          Read the current value of the table.
 void requestFocus()
          Request the focus for the ValueEdit.
 void setEnabled(boolean enabled)
          Set the enabled flag.
 void setValue(java.lang.Object value)
          Set the Edit's value.
 void update(Option option)
          Update the display for a possibly new Option.
 
Methods inherited from class de.qfs.lib.option.OptionEdit
addPackage, getBoolean, getInt, getOption, getOptionGroup, getString, isDisabled, makeEdit, setDisabled, setOptionGroup, update
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUIClassID, paramString, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getVerifyInputWhenFocusTarget, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, hide, isDoubleBuffered, isFocusCycleRoot, isFocusTraversable, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processFocusEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getLayout, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setLayout, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, imageUpdate, inside, isDisplayable, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

label

protected javax.swing.JLabel label
The label of the edit.

table

protected TableOptionEdit.Table table
The table of the edit.

wrapper

protected ConfigWrapper wrapper
The config wrapper for the table.

columns

protected TableOptionEdit.Column[] columns
The columns of the table.

enabled

protected boolean enabled
Whether the edit is currently enabled.

canedit

protected boolean canedit
Whether editing via dialog is allowed.

caninsert

protected boolean caninsert
Whether adding rows is allowed.

canremove

protected boolean canremove
Whether removing rows is allowed.

canmove

protected boolean canmove
Whether moving rows is allowed.

directinsert

protected boolean directinsert
Whether to insert new rows directly.

directedit

protected boolean directedit
Whether to start editing immediately on a keypress.

weight

protected double weight
The y-weight of the table.
Constructor Detail

TableOptionEdit

public TableOptionEdit()
Create a new TableOptionEdit.
Method Detail

init

protected void init()
Initialize the Edit.
Overrides:
init in class OptionEdit

update

public void update(Option option)
Update the display for a possibly new Option.
Overrides:
update in class OptionEdit
Parameters:
option - The new option.

checkValue

public boolean checkValue()
Check the currently entered value of the ValueEdit. If the value is not valid, request the focus and bring up a dialog box explaining why.
Overrides:
checkValue in class OptionEdit
Returns:
True if the value is valid, false otherwise.

readValue

public void readValue()
Read the current value of the table.
Overrides:
readValue in class OptionEdit

getWeight

public double getWeight()
Get the y-weight for the TableOptionEdit.
Overrides:
getWeight in class OptionEdit
Returns:
1.0

setEnabled

public void setEnabled(boolean enabled)
Set the enabled flag.
Overrides:
setEnabled in class javax.swing.JComponent
Parameters:
enabled - The flag to set.

isEnabled

public boolean isEnabled()
See if the ValueEdit is enabled.
Overrides:
isEnabled in class java.awt.Component
Returns:
True if it is enabled.

requestFocus

public void requestFocus()
Request the focus for the ValueEdit.
Overrides:
requestFocus in class javax.swing.JComponent

setValue

public void setValue(java.lang.Object value)
Set the Edit's value. Same format as the data parameter in the constructor.
Parameters:
value - The value of the Edit.

qflib 0.98.1