Package uk.ac.starlink.topcat
Class ColumnSelector
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- uk.ac.starlink.topcat.ColumnSelector
-
- All Implemented Interfaces:
java.awt.image.ImageObserver
,java.awt.MenuContainer
,java.io.Serializable
public class ColumnSelector extends javax.swing.JComponent
Allows selection of a column from a table which represents a requested kind of value. The column may not actually exist in the table, but may be based on one that does, modified by a ColumnConverter.- Since:
- 6 Oct 2004
- Author:
- Mark Taylor (Starlink)
- See Also:
ColumnSelectorModel
, Serialized Form
-
-
Field Summary
-
Fields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
-
-
Constructor Summary
Constructors Constructor Description ColumnSelector(uk.ac.starlink.table.ValueInfo info, boolean showLabel)
Constructs a new selector ready to select columns corresponding to a given ValueInfo.ColumnSelector(ColumnSelectorModel model, boolean showLabel)
Constructs a new selector with a given data model.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addActionListener(java.awt.event.ActionListener listener)
Adds a listener for changes on the state of this component.javax.swing.JComboBox
getColumnComponent()
Returns the component displaying selection of the actual column or expression.uk.ac.starlink.table.ColumnData
getColumnData()
Returns the (effective) column currently selected by the user.javax.swing.JLabel
getLabel()
Returns the label which annotates this selector (though it may or may not be displayed in this component according to how the constructor was called).ColumnSelectorModel
getModel()
Returns the model for this selector.java.lang.String
getStringValue()
Returns the value of the selector as a string.javax.swing.JComboBox
getUnitComponent()
Returns the component displaying selection of the unit, if any.void
removeActionListener(java.awt.event.ActionListener listener)
Removes a listener for changes on the state of this component.void
setColumnData(uk.ac.starlink.table.ColumnData colData)
Sets the currently selected column data value.void
setEnabled(boolean enabled)
void
setModel(ColumnSelectorModel model)
Sets the model for this selector.void
setStringValue(java.lang.String txt)
Sets the value of the selector progrmmatically as a string.void
setTable(TopcatModel tcModel)
Convenience method which sets this selector's model to the one appropriate for its ValueInfo and the given TopcatModel.-
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, 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, getUI, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
-
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, 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, getAccessibleContext, 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, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, 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, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
-
-
Constructor Detail
-
ColumnSelector
public ColumnSelector(uk.ac.starlink.table.ValueInfo info, boolean showLabel)
Constructs a new selector ready to select columns corresponding to a given ValueInfo. It is initialised with no data model.- Parameters:
info
- describes the columns to be selected by this componentshowLabel
- true iff you want the axis label to be displayed with the selectors
-
ColumnSelector
public ColumnSelector(ColumnSelectorModel model, boolean showLabel)
Constructs a new selector with a given data model.- Parameters:
model
- data modelshowLabel
- true iff you want the axis label to be displayed with the selectors
-
-
Method Detail
-
setModel
public void setModel(ColumnSelectorModel model)
Sets the model for this selector. model must have the same ValueInfo as the one this component was set up with.- Parameters:
model
- new data model
-
setTable
public void setTable(TopcatModel tcModel)
Convenience method which sets this selector's model to the one appropriate for its ValueInfo and the given TopcatModel.- Parameters:
tcModel
- table model
-
getColumnData
public uk.ac.starlink.table.ColumnData getColumnData()
Returns the (effective) column currently selected by the user. It takes into account the column and (if any) conversion selected by the user.- Returns:
- ColumnData representing the currently-selected column, or null if none is selected
-
setColumnData
public void setColumnData(uk.ac.starlink.table.ColumnData colData)
Sets the currently selected column data value. Does not have to be to one of the values in the selection model.- Parameters:
colData
- new column data selection
-
setStringValue
public void setStringValue(java.lang.String txt)
Sets the value of the selector progrmmatically as a string. This should be a legal JEL expression in the context of the selector's table.- Parameters:
txt
- text value
-
getStringValue
public java.lang.String getStringValue()
Returns the value of the selector as a string.- Returns:
- text value
-
getModel
public ColumnSelectorModel getModel()
Returns the model for this selector.- Returns:
- data model
-
getLabel
public javax.swing.JLabel getLabel()
Returns the label which annotates this selector (though it may or may not be displayed in this component according to how the constructor was called).- Returns:
- label annotating label
-
getColumnComponent
public javax.swing.JComboBox getColumnComponent()
Returns the component displaying selection of the actual column or expression.- Returns:
- column selection component
-
getUnitComponent
public javax.swing.JComboBox getUnitComponent()
Returns the component displaying selection of the unit, if any.- Returns:
- converter selection component
-
addActionListener
public void addActionListener(java.awt.event.ActionListener listener)
Adds a listener for changes on the state of this component.- Parameters:
listener
- listener to add
-
removeActionListener
public void removeActionListener(java.awt.event.ActionListener listener)
Removes a listener for changes on the state of this component.- Parameters:
listener
- listener to remove
-
setEnabled
public void setEnabled(boolean enabled)
- Overrides:
setEnabled
in classjavax.swing.JComponent
-
-