com.jstatcom.ts
Class TSSel

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.jstatcom.model.ModelPanel
                      extended by com.jstatcom.ts.TSSel
All Implemented Interfaces:
Card, SymbolScope, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible

public final class TSSel
extends ModelPanel

Configurable selection tool for time series. It manages the selection of endogenous, exogenous and deterministic variables and builds the corresponding data objects to be reused by other components via the symboltable. Selection is only allowed for series with the same periodicity and at least 2 observations time overlap.

If the underlying symbols are referenced, JSCTypeDef objects with the correct types should be specified for the corresponding data:

  1. dRange -JSCTypes.DRANGE
  2. endogenous names -JSCTypes.SARRAY
  3. exogenous names -JSCTypes.SARRAY
  4. deterministic names - JSCTypes.SARRAY
  5. all names - JSCTypes.SARRAY
  6. endogenous data - JSCTypes.NARRAY
  7. exogenous data - JSCTypes.NARRAY
  8. deterministic data - JSCTypes.NARRAY
  9. all data - JSCTypes.NARRAY

It can be configured by specifying several selection options as well as the names of the various data objects.

Data objects are only created if the respective name has been specified. The selected data is automatically truncated if there are missings at the beginning or the end. The objects are created and stored in the following order:

  1. dRange
  2. endogenous names
  3. exogenous names
  4. deterministic names
  5. all names
  6. endogenous data
  7. exogenous data
  8. deterministic data
  9. all data

The ordering might be important when installing symbol listeners. If the listener reacts to a change in a variable, then it should only reference variables that have been created before, e.g. a listener to "all data" can reference "all names" in its action method, but not vice versa. When "all names" changes, "all data" is still empty.

A save way around this problem is to install a listener to the selectionChanged property of the TSSel. A PropertyChangeEvent for "selectionChanged" is fired only after all data objects have been created.

Author:
Markus Kraetzig
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.BaselineResizeBehavior
 
Field Summary
 
Fields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, 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
TSSel()
          Default constructor.
 
Method Summary
 java.lang.String getAllDataName()
          Gets the allDataName property (String) value.
 java.lang.String getAllStringsName()
          Gets the allStringsName property (String) value.
 java.lang.String getDateRangeName()
          Gets the dateRangeName property (String) value.
 boolean getDatesEditable()
           
 java.lang.String getDeterministicDataName()
          Gets the deterministicDataName property (String) value.
 boolean getDeterministicEnabled()
          Gets whether deterministic series can be selected.
 java.lang.String getDeterministicStringsName()
          Gets the deterministicStringsName property (String) value.
 java.lang.String getEndogenousDataName()
          Gets the endogenousDataName property (String) value.
 java.lang.String getEndogenousStringsName()
          Gets the endogenousStringsName property (String) value.
 java.lang.String getExogenousDataName()
          Gets the exogenousDataName property (String) value.
 boolean getExogenousEnabled()
          Gets whether exogenous series can be selected.
 java.lang.String getExogenousStringsName()
          Gets the exogenousStringsName property (String) value.
 Selection getSelection()
          Gets the current selection set by this component.
 int getSelectionMode()
          Gets the current selection mode.
 boolean isCheckNaN()
          Gets whether it is checked whether missing values are in the selection.
 boolean isOneEndogenousOnly()
           
 boolean isUpperScope()
          Gets whether Scope.UPPER or Scope.GLOBAL is used.
 void setAllDataName(java.lang.String allDataName)
          Sets the name of the object holding the data array for all series.
 void setAllStringsName(java.lang.String allStringsName)
          Sets the name of dataobject that holds the string array of all names.
 void setCheckNaN(boolean checkNaN)
          Sets whether it is checked whether missing values are in the selection.
 void setDateRangeName(java.lang.String dateRangeName)
          Sets the name of dataobject that holds the date range of the selected series.
 void setDatesEditable(boolean newDatesEditable)
          Enables/disables editing of date range.
 void setDeterministicDataName(java.lang.String deterministicDataName)
          Sets the name of the object holding the deterministic data array.
 void setDeterministicEnabled(boolean arg1)
          Enables/disables the selection of deterministic variables.
 void setDeterministicStringsName(java.lang.String deterministicStringsName)
          Sets the name of dataobject that holds the string array of deterministic names.
 void setEnabled(boolean enabled)
          Enables/disables the component.
 void setEndogenousDataName(java.lang.String endogenousDataName)
          Sets the name of the object holding the endogenous data array.
 void setEndogenousStringsName(java.lang.String endogenousStringsName)
          Sets the name of dataobject that holds the string array of endogenous names.
 void setExogenousDataName(java.lang.String exogenousDataName)
          Sets the name of the object holding the exogenous data array.
 void setExogenousEnabled(boolean arg1)
          Enables/disables selection of exogenous variables.
 void setExogenousStringsName(java.lang.String exogenousStringsName)
          Sets the name of dataobject that holds the string array of exogenous names.
 void setOneEndogenousOnly(boolean newOneEndogenousOnly)
          Sets whether only one endogenous variable should be selectable or more.
 void setSelection(Selection sel)
          Sets the selection of this component according to sel.
 void setSelectionChanged()
          Sets the selection changed property and fires PropertyChangeEvent if the value changed.
 void setSelectionMode(int selectionMode)
          Sets the selection mode to be a valid mode for JList.
 void setUpperScope(boolean isUpper)
          Sets whether UPPER or default GLOBAL scope should be used.
 
Methods inherited from class com.jstatcom.model.ModelPanel
addNotify, findParentScope, global, local, shown, upper
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, 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, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, 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, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, 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, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, 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, 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
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TSSel

public TSSel()
Default constructor.

Method Detail

getAllDataName

public java.lang.String getAllDataName()
Gets the allDataName property (String) value.

Returns:
the allDataName property value.
See Also:
setAllDataName(java.lang.String)

getAllStringsName

public java.lang.String getAllStringsName()
Gets the allStringsName property (String) value.

Returns:
the allStringsName property value.
See Also:
setAllStringsName(java.lang.String)

getDatesEditable

public boolean getDatesEditable()
Returns:
boolean editable/not editable
See Also:
setDatesEditable(boolean)

getDeterministicDataName

public java.lang.String getDeterministicDataName()
Gets the deterministicDataName property (String) value.

Returns:
The deterministicDataName property value.
See Also:
setDeterministicDataName(java.lang.String)

getDeterministicEnabled

public boolean getDeterministicEnabled()
Gets whether deterministic series can be selected.

Returns:
boolean
See Also:
setDeterministicEnabled(boolean)

getDeterministicStringsName

public java.lang.String getDeterministicStringsName()
Gets the deterministicStringsName property (String) value.

Returns:
The deterministicStringsName property value.
See Also:
setDeterministicStringsName(java.lang.String)

getEndogenousDataName

public java.lang.String getEndogenousDataName()
Gets the endogenousDataName property (String) value.

Returns:
The endogenousDataName property value.
See Also:
setEndogenousDataName(java.lang.String)

getEndogenousStringsName

public java.lang.String getEndogenousStringsName()
Gets the endogenousStringsName property (String) value.

Returns:
The endogenousStringsName property value.
See Also:
setEndogenousStringsName(java.lang.String)

getExogenousDataName

public java.lang.String getExogenousDataName()
Gets the exogenousDataName property (String) value.

Returns:
The exogenousDataName property value.
See Also:
setExogenousDataName(java.lang.String)

getDateRangeName

public java.lang.String getDateRangeName()
Gets the dateRangeName property (String) value.

Returns:
The dateRangeName property value.
See Also:
setDateRangeName(java.lang.String)

getExogenousEnabled

public boolean getExogenousEnabled()
Gets whether exogenous series can be selected.

Returns:
boolean
See Also:
setExogenousEnabled(boolean)

getExogenousStringsName

public java.lang.String getExogenousStringsName()
Gets the exogenousStringsName property (String) value.

Returns:
The exogenousStringsName property value.
See Also:
setExogenousStringsName(java.lang.String)

getSelectionMode

public int getSelectionMode()
Gets the current selection mode.

Returns:
int a valid JList selection mode

isOneEndogenousOnly

public boolean isOneEndogenousOnly()
Returns:
boolean
See Also:
setOneEndogenousOnly(boolean)

setAllDataName

public void setAllDataName(java.lang.String allDataName)
Sets the name of the object holding the data array for all series.

Parameters:
allDataName - The new value for the property.
Throws:
java.lang.IllegalArgumentException - if argument is not a valid symbolname
See Also:
getAllDataName()

setAllStringsName

public void setAllStringsName(java.lang.String allStringsName)
Sets the name of dataobject that holds the string array of all names.

Parameters:
allStringsName - The new value for the property.
Throws:
java.lang.IllegalArgumentException - if argument is not a valid symbolname
See Also:
getAllStringsName()

setDatesEditable

public void setDatesEditable(boolean newDatesEditable)
Enables/disables editing of date range.

Parameters:
newDatesEditable - true to enable range editing

setDeterministicDataName

public void setDeterministicDataName(java.lang.String deterministicDataName)
Sets the name of the object holding the deterministic data array.

Parameters:
deterministicDataName - The new value for the property.
Throws:
java.lang.IllegalArgumentException - if argument is not a valid symbolname
See Also:
getDeterministicDataName()

setDeterministicEnabled

public void setDeterministicEnabled(boolean arg1)
Enables/disables the selection of deterministic variables. This property merely sets the list displaying the deterministic variables to enabled or disabled. It has no effect on the data creation, but it should communicate to the user, that deterministic variables are ignored in the respective modeling context.

Parameters:
arg1 - true to enable selection of determinisic variables

setDeterministicStringsName

public void setDeterministicStringsName(java.lang.String deterministicStringsName)
Sets the name of dataobject that holds the string array of deterministic names.

Parameters:
deterministicStringsName - The new value for the property.
Throws:
java.lang.IllegalArgumentException - if argument is not a valid symbolname
See Also:
getDeterministicStringsName()

setEnabled

public void setEnabled(boolean enabled)
Enables/disables the component. If disabled, time series cannot be selected anymore.

Overrides:
setEnabled in class javax.swing.JComponent
Parameters:
enabled - boolean

setEndogenousDataName

public void setEndogenousDataName(java.lang.String endogenousDataName)
Sets the name of the object holding the endogenous data array.

Parameters:
endogenousDataName - The new value for the property.
Throws:
java.lang.IllegalArgumentException - if argument is not a valid symbolname
See Also:
getEndogenousDataName()

setEndogenousStringsName

public void setEndogenousStringsName(java.lang.String endogenousStringsName)
Sets the name of dataobject that holds the string array of endogenous names.

Parameters:
endogenousStringsName - The new value for the property.
Throws:
java.lang.IllegalArgumentException - if argument is not a valid symbolname
See Also:
getEndogenousStringsName()

setExogenousDataName

public void setExogenousDataName(java.lang.String exogenousDataName)
Sets the name of the object holding the exogenous data array.

Parameters:
exogenousDataName - The new value for the property.
Throws:
java.lang.IllegalArgumentException - if argument is not a valid symbolname
See Also:
getExogenousDataName()

setExogenousEnabled

public void setExogenousEnabled(boolean arg1)
Enables/disables selection of exogenous variables. This property merely sets the list displaying the exogenous variables to enabled or disabled. It has no effect on the data creation, but it should communicate to the user, that exogenous variables are ignored in the respective modeling context.

Parameters:
arg1 - true to enable selection of exogenous variables

setExogenousStringsName

public void setExogenousStringsName(java.lang.String exogenousStringsName)
Sets the name of dataobject that holds the string array of exogenous names.

Parameters:
exogenousStringsName - The new value for the property.
Throws:
java.lang.IllegalArgumentException - if argument is not a valid symbolname
See Also:
getExogenousStringsName()

setDateRangeName

public void setDateRangeName(java.lang.String dateRangeName)
Sets the name of dataobject that holds the date range of the selected series.

Parameters:
dateRangeName - The new value for the property.
Throws:
java.lang.IllegalArgumentException - if argument is not a valid symbolname
See Also:
getDateRangeName()

setOneEndogenousOnly

public void setOneEndogenousOnly(boolean newOneEndogenousOnly)
Sets whether only one endogenous variable should be selectable or more. Useful for univariate models with possibly exogenous variables.

Parameters:
newOneEndogenousOnly - true if only one endogenous variable should be selectable

setSelectionChanged

public void setSelectionChanged()
Sets the selection changed property and fires PropertyChangeEvent if the value changed.


setSelectionMode

public void setSelectionMode(int selectionMode)
Sets the selection mode to be a valid mode for JList.

Parameters:
selectionMode - int

setUpperScope

public void setUpperScope(boolean isUpper)
Sets whether UPPER or default GLOBAL scope should be used.

Parameters:
isUpper - if true Scope.UPPER is used, otherwise Scope.GLOBAL

isUpperScope

public boolean isUpperScope()
Gets whether Scope.UPPER or Scope.GLOBAL is used.

Returns:
true true Scope.UPPER is used, otherwise Scope.GLOBAL

isCheckNaN

public boolean isCheckNaN()
Gets whether it is checked whether missing values are in the selection. In this case the selection will not be allowed. The default is true.

Returns:
true if NaN's are not allowed

setCheckNaN

public void setCheckNaN(boolean checkNaN)
Sets whether it is checked whether missing values are in the selection. In this case the selection will not be allowed. The default is true.

Parameters:
checkNaN - true if NaN's are not allowed, false series with missing values can be selected

setSelection

public void setSelection(Selection sel)
Sets the selection of this component according to sel. The method does nothing if (sel == null).

Parameters:
sel - holds the selection

getSelection

public Selection getSelection()
Gets the current selection set by this component.

Returns:
selection instance