Documentation of 'com.jstatcom.ts.TSDateSelector' Java class
TSDateSelector
com.jstatcom.ts

Class TSDateSelector

  • All Implemented Interfaces:
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.Scrollable, javax.swing.SwingConstants


    public final class TSDateSelector
    extends IValTextField
    Component for display and selection of a single TSDate. It takes an input string and validates it against a parser and a defined range. This component can be costumized by setting an overall range that must enclose the date that is selected. This is ensured by the validation mechanism.

    This class fires a "TSDate" property change, if a new date was set.

    See Also:
    TSDate, TSDateParser, Serialized Form
    • Nested Class Summary

      • Nested classes/interfaces inherited from class javax.swing.text.JTextComponent

        javax.swing.text.JTextComponent.AccessibleJTextComponent, javax.swing.text.JTextComponent.DropLocation, javax.swing.text.JTextComponent.KeyBinding
      • 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.JTextField

        notifyAction
      • Fields inherited from class javax.swing.text.JTextComponent

        DEFAULT_KEYMAP, FOCUS_ACCELERATOR_KEY
      • 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 javax.swing.SwingConstants

        BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
      • Fields inherited from interface java.awt.image.ImageObserver

        ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
    • Constructor Summary

      Constructors 
      Constructor and Description
      TSDateSelector()
      TSDateSelector default constructor sets range to [1960 q1,1982 q4] and displayed date to 1960 q1.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      int getDateAsIndex()
      Returns the currently displayed date as an index relative to the lower bound of the defined range, starting from 0.
      TSDateRange getRange()
      Gets the range that the selected date must be in with.
      TSDate getTSDate()
      Gets the currently displayed date.
      void handleError(java.lang.String msg)
      Error handling routine if validation failed.
      void setEnclosingRange(TSDate newStart, int numberOfPeriods)
      Sets the range that the selected date must be in with by setting an initial date and the desired number of available periods within the range.
      void setEnclosingRange(TSDateRange newOverallRange)
      Sets the range that the selected date must be in with.
      void setTSDate(TSDate newTSDate)
      Sets the currently displayed date if it conforms to the specified range.
      java.lang.String validateInput()
      Validates input against the TSDateParser and the specified TSDateRange.
      • Methods inherited from class javax.swing.JTextField

        addActionListener, getAccessibleContext, getAction, getActionListeners, getActions, getColumns, getHorizontalAlignment, getHorizontalVisibility, getPreferredSize, getScrollOffset, getUIClassID, isValidateRoot, postActionEvent, removeActionListener, scrollRectToVisible, setAction, setActionCommand, setColumns, setDocument, setFont, setHorizontalAlignment, setScrollOffset
      • Methods inherited from class javax.swing.text.JTextComponent

        addCaretListener, addInputMethodListener, addKeymap, copy, cut, getCaret, getCaretColor, getCaretListeners, getCaretPosition, getDisabledTextColor, getDocument, getDragEnabled, getDropLocation, getDropMode, getFocusAccelerator, getHighlighter, getInputMethodRequests, getKeymap, getKeymap, getMargin, getNavigationFilter, getPreferredScrollableViewportSize, getPrintable, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getSelectedText, getSelectedTextColor, getSelectionColor, getSelectionEnd, getSelectionStart, getText, getText, getToolTipText, getUI, isEditable, loadKeymap, modelToView, moveCaretPosition, paste, print, print, print, read, removeCaretListener, removeKeymap, removeNotify, replaceSelection, select, selectAll, setCaret, setCaretColor, setCaretPosition, setComponentOrientation, setDisabledTextColor, setDragEnabled, setDropMode, setEditable, setFocusAccelerator, setHighlighter, setKeymap, setMargin, setNavigationFilter, setSelectedTextColor, setSelectionColor, setSelectionEnd, setSelectionStart, setText, setUI, updateUI, viewToModel, write
      • 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, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, 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, transferFocusDownCycle, validate
      • Methods inherited from class java.awt.Component

        action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, 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, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, 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, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • TSDateSelector

        public TSDateSelector()
        TSDateSelector default constructor sets range to [1960 q1,1982 q4] and displayed date to 1960 q1.
    • Method Detail

      • getDateAsIndex

        public int getDateAsIndex()
        Returns the currently displayed date as an index relative to the lower bound of the defined range, starting from 0.
        Returns:
        index that is >= 0 and < than the number of observations within the allowed range
      • getRange

        public TSDateRange getRange()
        Gets the range that the selected date must be in with.
        Returns:
        the bounding range
      • getTSDate

        public TSDate getTSDate()
        Gets the currently displayed date.
        Returns:
        the selected date
      • handleError

        public void handleError(java.lang.String msg)
        Error handling routine if validation failed. Displays error message and sets back date value to the last valid one..
        Overrides:
        handleError in class IValTextField
        Parameters:
        msg - an error message
      • setEnclosingRange

        public void setEnclosingRange(TSDate newStart,
                                      int numberOfPeriods)
        Sets the range that the selected date must be in with by setting an initial date and the desired number of available periods within the range.
        Parameters:
        newStart - the new start for the bounding range
        numberOfPeriods - > 0 to define the end of the bounding range
      • setEnclosingRange

        public void setEnclosingRange(TSDateRange newOverallRange)
        Sets the range that the selected date must be in with. The selected date is not changed unless it violates the new range setting. In that case it is set to the start date of the new range.
        Parameters:
        newOverallRange - the new bounding range that the date has to be in with
        Throws:
        java.lang.IllegalArgumentException - if (newOverallRange == null)
      • setTSDate

        public void setTSDate(TSDate newTSDate)
        Sets the currently displayed date if it conforms to the specified range. This method fires a "TSDate" property change with the old value and the changed value if a new date was set.
        Parameters:
        newTSDate - the date to be displayed
        Throws:
        java.lang.IllegalArgumentException - if newTSDate is not enclosed in range
      • validateInput

        public java.lang.String validateInput()
        Validates input against the TSDateParser and the specified TSDateRange.
        Specified by:
        validateInput in class IValTextField
        Returns:
        error message if failure, null if ok

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.