uk.ac.starlink.topcat.plot
Class PointSelector

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 uk.ac.starlink.topcat.plot.PointSelector
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class PointSelector
extends JPanel

Component for choosing a table, a number of columns and a selection of row subsets. The details of the column selection are handled by a consitituent AxesSelector object.

Since:
28 Oct 2005
Author:
Mark Taylor
See Also:
Serialized Form

Nested Class Summary
 
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
static String TABLE_CHANGED
          ActionEvent command string indicating a change of table.
 
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
PointSelector(AxesSelector axesSelector, MutableStyleSet styles)
           
 
Method Summary
 void addActionListener(ActionListener listener)
          Adds an action listener.
 void addSubsetSelectionListener(ListSelectionListener listener)
          Adds a ListSelectionListener which will be notified when the subset selection changes.
 void addTopcatListener(TopcatListener listener)
          Adds a TopcatListener which will be notified when changes occur to the TopcatModel associated with this selector.
 void configureForTable(TopcatModel tcModel)
          Sets this selector to work from a table described by a given TopcatModel.
 AxesSelector getAxesSelector()
          Returns the AxesSelector used by this PointSelector.
 ActionListener getErrorModeListener()
          Returns a listener which should be informed every time the error mode changes.
 String getLabel()
          Returns the label for this selector.
 int[] getOrderedSubsetSelection()
          Returns a list of indices giving the selected subsets.
 uk.ac.starlink.ttools.plot.Style getStyle(int isub)
          Returns the style to use for a given subset index.
 Icon getStyleLegendIcon(uk.ac.starlink.ttools.plot.Style style)
          Returns the icon used to represent a given style in legends for this selector.
 uk.ac.starlink.ttools.plot.StyleSet getStyles()
          Returns the style set used by this selector.
 StyleWindow getStyleWindow()
          Returns this selector's style window.
 String getSubsetDisplayLabel(int isub)
          Returns the subset label to be used for annotating one of the subsets controlled by this selector in a plot legend.
 boolean[] getSubsetSelection()
          Returns an array of flags indicating which of the row subsets have been selected.
 TopcatModel getTable()
          Returns the currently selected table.
 boolean isReady()
          Indicates whether this selector has enough state filled in to be able to specify some point data.
 void removeActionListener(ActionListener listener)
          Removes an action listener which was previously added.
 void removeSubsetSelectionListener(ListSelectionListener listner)
          Removes a ListSelectionListener which was previously added.
 void removeTopcatListener(TopcatListener listener)
          Removes a TopcatListener which was previously added.
 void setHorizontalEntryScrolling(boolean isScroll)
          Determines whether the component containing the column selectors will scroll horizontally if required or not.
 void setLabel(String label)
          Sets a label for this selector.
 void setStyles(MutableStyleSet styles)
          Resets the style set to be used by this selector.
 void setStyleWindow(StyleWindow styler)
          Sets the style window associated with this selector.
 void setSubsetSelection(boolean[] selected)
          Sets the current selection pattern for row subsets.
 void setTable(TopcatModel tcModel, boolean init)
          Sets the table to which this selector currently applies.
 void setVerticalEntryScrolling(boolean isScroll)
          Determines whether the component containing the column selectors will scroll vertically if required or not.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
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, 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, removeNotify, 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

TABLE_CHANGED

public static final String TABLE_CHANGED
ActionEvent command string indicating a change of table.

See Also:
Constant Field Values
Constructor Detail

PointSelector

public PointSelector(AxesSelector axesSelector,
                     MutableStyleSet styles)
Method Detail

getAxesSelector

public AxesSelector getAxesSelector()
Returns the AxesSelector used by this PointSelector.

Returns:
axes selector

isReady

public boolean isReady()
Indicates whether this selector has enough state filled in to be able to specify some point data.

Returns:
true iff properly filled in

setHorizontalEntryScrolling

public void setHorizontalEntryScrolling(boolean isScroll)
Determines whether the component containing the column selectors will scroll horizontally if required or not.

Parameters:
isScroll - true iff the entry box should scroll horizontally

setVerticalEntryScrolling

public void setVerticalEntryScrolling(boolean isScroll)
Determines whether the component containing the column selectors will scroll vertically if required or not.

Parameters:
isScroll - true iff the entry box should scroll vertically

setStyleWindow

public void setStyleWindow(StyleWindow styler)
Sets the style window associated with this selector. This should be called soon after construction (before this selector is displayed), and should not be called subsequently.

Parameters:
styler - style window

getStyleWindow

public StyleWindow getStyleWindow()
Returns this selector's style window.

Returns:
style window

setLabel

public void setLabel(String label)
Sets a label for this selector. This should be a short string; it's used to disambiguate subsets from those controlled by other selectors.

Parameters:
label - label string

getLabel

public String getLabel()
Returns the label for this selector.

Returns:
selector label

getTable

public TopcatModel getTable()
Returns the currently selected table.

Returns:
topcat model of the currently selected table

setTable

public void setTable(TopcatModel tcModel,
                     boolean init)
Sets the table to which this selector currently applies.

Parameters:
tcModel - table
init - whether to initialise the columns with sensible starting values

setSubsetSelection

public void setSubsetSelection(boolean[] selected)
Sets the current selection pattern for row subsets.

Parameters:
selected - array of selection flags for subsets

getSubsetSelection

public boolean[] getSubsetSelection()
Returns an array of flags indicating which of the row subsets have been selected.

Returns:
subset selection flags

getOrderedSubsetSelection

public int[] getOrderedSubsetSelection()
Returns a list of indices giving the selected subsets. This contains substantially the same information as in getSubsetSelection(), but in a different form and with the additional information of what order the selections were made in.

Returns:
array of selected subset indices

getStyle

public uk.ac.starlink.ttools.plot.Style getStyle(int isub)
Returns the style to use for a given subset index.

Parameters:
isub - subset index
Returns:
subset style

getStyles

public uk.ac.starlink.ttools.plot.StyleSet getStyles()
Returns the style set used by this selector.

Returns:
style set

setStyles

public void setStyles(MutableStyleSet styles)
Resets the style set to be used by this selector.

Parameters:
styles - new style set

getStyleLegendIcon

public Icon getStyleLegendIcon(uk.ac.starlink.ttools.plot.Style style)
Returns the icon used to represent a given style in legends for this selector.

Parameters:
style - style to represent
Returns:
icon

getErrorModeListener

public ActionListener getErrorModeListener()
Returns a listener which should be informed every time the error mode changes.

Returns:
listener

addActionListener

public void addActionListener(ActionListener listener)
Adds an action listener. It will be notified every time something interesting happens to this selector.

Parameters:
listener - listener to add

removeActionListener

public void removeActionListener(ActionListener listener)
Removes an action listener which was previously added.

Parameters:
listener - listener to remove
See Also:
addActionListener(java.awt.event.ActionListener)

addSubsetSelectionListener

public void addSubsetSelectionListener(ListSelectionListener listener)
Adds a ListSelectionListener which will be notified when the subset selection changes. Note that the source of the ListSelectionEvents which are sent will be this PointSelector.

Parameters:
listener - listener to add

removeSubsetSelectionListener

public void removeSubsetSelectionListener(ListSelectionListener listner)
Removes a ListSelectionListener which was previously added.

Parameters:
listner - listener to remove
See Also:
addSubsetSelectionListener(javax.swing.event.ListSelectionListener)

addTopcatListener

public void addTopcatListener(TopcatListener listener)
Adds a TopcatListener which will be notified when changes occur to the TopcatModel associated with this selector.

Parameters:
listener - listener to add

removeTopcatListener

public void removeTopcatListener(TopcatListener listener)
Removes a TopcatListener which was previously added.

Parameters:
listener - listener to remove
See Also:
addTopcatListener(uk.ac.starlink.topcat.TopcatListener)

configureForTable

public void configureForTable(TopcatModel tcModel)
Sets this selector to work from a table described by a given TopcatModel.

Parameters:
tcModel - table to work with

getSubsetDisplayLabel

public String getSubsetDisplayLabel(int isub)
Returns the subset label to be used for annotating one of the subsets controlled by this selector in a plot legend. If the return value is the empty string then the subset should be excluded from the legend.

Parameters:
isub - subset index
Returns:
label, or null for hidden


Copyright © 2003-2018 CCLRC: Council for the Central Laboratory of the Research Councils. All Rights Reserved.