Class AbstractScale

All Implemented Interfaces:
Direct Known Subclasses:
LinearScale, RoundScale

public abstract class AbstractScale
extends org.eclipse.draw2d.Figure
The abstract scale has the common properties for linear(straight) scale and round scale.
  • Nested Class Summary

    Nested Classes 
    Modifier and Type Class Description
    static class  AbstractScale.LabelSide
    ticks label's position relative to tick marks

    Nested classes/interfaces inherited from class org.eclipse.draw2d.Figure

    org.eclipse.draw2d.Figure.FigureIterator, org.eclipse.draw2d.Figure.IdentitySearch

    Nested classes/interfaces inherited from interface org.eclipse.draw2d.IFigure

  • Field Summary

    Modifier and Type Field Description
    protected static java.lang.String DEFAULT_DATE_FORMAT  
    protected java.lang.String default_decimal_format
    the default label format
    static java.lang.String DEFAULT_ENGINEERING_FORMAT  
    static double DEFAULT_LOG_SCALE_MAX
    the default maximum value of log scale range
    static double DEFAULT_MAX  
    static double DEFAULT_MIN  
    protected boolean dirty
    Whenever any parameter has been changed, the scale should be marked as dirty, so all the inner parameters could be recalculated before the next paint
    protected static int ENGINEERING_LIMIT
    the digits limit to be displayed in engineering format
    protected double max
    The maximum value of the scale
    protected double min
    The minimum value of the scale

    Fields inherited from class org.eclipse.draw2d.Figure

    bgColor, border, bounds, fgColor, flags, font, MAX_FLAG, maxSize, minSize, NO_MANAGER, prefSize, toolTip

    Fields inherited from interface org.eclipse.draw2d.IFigure

  • Constructor Summary

    Constructor Description
  • Method Summary

    Modifier and Type Method Description
    (package private) static java.lang.String createDefaultDecimalFormat​(double min, double max)  
    java.lang.String format​(java.lang.Object obj)
    Formats the given object as a DateFormat if Date is enabled or as a DecimalFormat.
    java.lang.String format​(java.lang.Object obj, boolean minOrMaxDate)
    Formats the given object as a DateFormat if Date is enabled or as a DecimalFormat.
    java.lang.String getFormatPattern()  
    double getMajorGridStep()  
    int getMajorTickMarkStepHint()  
    int getMinorTickMarkStepHint()  
    Range getRange()
    get the scale range
    AbstractScale.LabelSide getTickLabelSide()  
    AbstractScale.LabelSide getTickLablesSide()
    use correctly spelled #getTickLabelSide(LabelSide)
    int getTimeUnit()  
    protected void internalSetAutoFormat​(boolean autoFormat)
    Sets ONLY the autoFormat value
    protected void internalSetFormatPattern​(java.lang.String formatPattern)  
    protected void internalSetLogScaleEnabled​(boolean logScaleEnabled)  
    protected void internalSetRange​(Range range)  
    boolean isAutoFormat()  
    boolean isDateEnabled()  
    boolean isDirty()  
    boolean isLogScaleEnabled()
    Gets the state indicating if log scale is enabled.
    boolean isMinorTicksVisible()  
    boolean isScaleLineVisible()  
    void setAutoFormat​(boolean autoFormat)  
    void setDateEnabled​(boolean dateEnabled)  
    protected void setDirty​(boolean dirty)
    Whenever any parameter has been changed, the scale should be marked as dirty, so all the inner parameters could be recalculated before the next paint
    void setFont​( f)  
    void setFormatPattern​(java.lang.String formatPattern)
    Sets the format pattern for axis tick label. see Format
    void setLogScale​(boolean enabled)  
    void setMajorGridStep​(double majorGridStep)  
    void setMajorTickMarkStepHint​(int majorTickMarkStepHint)  
    void setMinorTickMarkStepHint​(int minorTickMarkStepHint)  
    void setMinorTicksVisible​(boolean minorTicksVisible)  
    void setRange​(double lower, double upper)
    set the scale range
    void setRange​(double t1, double t2, boolean honorOriginDirection)
    Set the range with option to honor its original direction.
    void setRange​(Range range)
    set the scale range
    void setScaleLineVisible​(boolean scaleLineVisible)  
    void setTickLabelSide​(AbstractScale.LabelSide tickLabelSide)  
    void setTickLableSide​(AbstractScale.LabelSide tickLabelSide)
    use correctly spelled setTickLabelSide(LabelSide)
    void setTimeUnit​(int timeUnit)
    Set the time unit for a date enabled scale.
    abstract void updateTick()
    Updates the tick, recalculate all inner parameters

    Methods inherited from class org.eclipse.draw2d.Figure

    add, add, add, add, addAncestorListener, addCoordinateListener, addFigureListener, addFocusListener, addKeyListener, addLayoutListener, addListener, addMouseListener, addMouseMotionListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, containsPoint, containsPoint, erase, findDescendantAtExcluding, findFigureAt, findFigureAt, findFigureAt, findFigureAtExcluding, findMouseEventTargetAt, findMouseEventTargetInDescendantsAt, fireCoordinateSystemChanged, fireFigureMoved, fireMoved, firePropertyChange, firePropertyChange, firePropertyChange, getBackgroundColor, getBorder, getBounds, getChildren, getClientArea, getClientArea, getClippingStrategy, getCursor, getFlag, getFont, getForegroundColor, getInsets, getLayoutManager, getListeners, getLocalBackgroundColor, getLocalFont, getLocalForegroundColor, getLocation, getMaximumSize, getMinimumSize, getMinimumSize, getParent, getPreferredSize, getPreferredSize, getSize, getToolTip, getUpdateManager, handleFocusGained, handleFocusLost, handleKeyPressed, handleKeyReleased, handleMouseDoubleClicked, handleMouseDragged, handleMouseEntered, handleMouseExited, handleMouseHover, handleMouseMoved, handleMousePressed, handleMouseReleased, hasFocus, internalGetEventDispatcher, intersects, invalidate, invalidateTree, isCoordinateSystem, isEnabled, isFocusTraversable, isMirrored, isMouseEventTarget, isOpaque, isRequestFocusEnabled, isShowing, isValid, isValidationRoot, isVisible, layout, paint, paintBorder, paintChildren, paintClientArea, paintFigure, primTranslate, remove, removeAll, removeAncestorListener, removeCoordinateListener, removeFigureListener, removeFocusListener, removeKeyListener, removeLayoutListener, removeListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, revalidate, setBackgroundColor, setBorder, setBounds, setChildrenDirection, setChildrenEnabled, setChildrenOrientation, setClippingStrategy, setConstraint, setCursor, setEnabled, setFlag, setFocusTraversable, setForegroundColor, setLayoutManager, setLocation, setMaximumSize, setMinimumSize, setOpaque, setParent, setPreferredSize, setPreferredSize, setRequestFocusEnabled, setSize, setSize, setToolTip, setValid, setVisible, translate, translateFromParent, translateToAbsolute, translateToParent, translateToRelative, useLocalCoordinates, validate

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

  • Method Details

    • format

      public java.lang.String format​(java.lang.Object obj)
      Formats the given object as a DateFormat if Date is enabled or as a DecimalFormat. This is based on an internal format pattern given the object in parameter.
      obj - the object
      the formatted string
    • format

      public java.lang.String format​(java.lang.Object obj, boolean minOrMaxDate)
      Formats the given object as a DateFormat if Date is enabled or as a DecimalFormat. This is based on an internal format pattern given the object in parameter. When formatting a date, if minOrMaxDate is true as well as autoFormat, then the SimpleDateFormat us used to format the object.
      obj - the object
      minOrMaxDate - true if it is the min or max date on the scale.
      the formatted string
    • getMajorTickMarkStepHint

      public int getMajorTickMarkStepHint()
      the majorTickMarkStepHint
    • getRange

      public Range getRange()
      get the scale range
    • getTickLablesSide

      @Deprecated public AbstractScale.LabelSide getTickLablesSide()
      use correctly spelled #getTickLabelSide(LabelSide)
    • getTickLabelSide

      public AbstractScale.LabelSide getTickLabelSide()
      the side of the tick label relative to the tick marks
    • getTimeUnit

      public int getTimeUnit()
      the timeUnit
    • isDateEnabled

      public boolean isDateEnabled()
      the dateEnabled
    • isDirty

      public boolean isDirty()
      the dirty
    • isLogScaleEnabled

      public boolean isLogScaleEnabled()
      Gets the state indicating if log scale is enabled.
      true if log scale is enabled
    • isMinorTicksVisible

      public boolean isMinorTicksVisible()
      the minorTicksVisible
    • isScaleLineVisible

      public boolean isScaleLineVisible()
      the scaleLineVisible
    • setDateEnabled

      public void setDateEnabled​(boolean dateEnabled)
      dateEnabled - the dateEnabled to set
    • setDirty

      protected void setDirty​(boolean dirty)
      Whenever any parameter has been changed, the scale should be marked as dirty, so all the inner parameters could be recalculated before the next paint
      dirty - the dirty to set
    • setFormatPattern

      public void setFormatPattern​(java.lang.String formatPattern)
      Sets the format pattern for axis tick label. see Format

      If null is set, default format will be used.

      format - the format
      java.lang.NullPointerException - if pattern is null
      java.lang.IllegalArgumentException - if the given pattern is invalid.
    • internalSetFormatPattern

      protected void internalSetFormatPattern​(java.lang.String formatPattern)
    • getFormatPattern

      public java.lang.String getFormatPattern()
      the formatPattern
    • setFont

      public void setFont​( f)
      Specified by:
      setFont in interface org.eclipse.draw2d.IFigure
      setFont in class org.eclipse.draw2d.Figure
    • setLogScale

      public void setLogScale​(boolean enabled) throws java.lang.IllegalStateException
      enabled - true if enabling log scales
    • internalSetLogScaleEnabled

      protected void internalSetLogScaleEnabled​(boolean logScaleEnabled)
    • setMajorTickMarkStepHint

      public void setMajorTickMarkStepHint​(int majorTickMarkStepHint)
      majorTickMarkStepHint - the majorTickMarkStepHint to set, should be less than 1000.
    • setMinorTicksVisible

      public void setMinorTicksVisible​(boolean minorTicksVisible)
      minorTicksVisible - the minorTicksVisible to set
    • setRange

      public void setRange​(Range range)
      set the scale range
    • setRange

      public void setRange​(double t1, double t2, boolean honorOriginDirection)
      Set the range with option to honor its original direction.
      t1 - value 1 of the range
      t2 - value 2 of the range
      honorOriginDirection - if true, the start and end value of the range will set according to its original direction.
    • setRange

      public void setRange​(double lower, double upper)
      set the scale range
      lower - the lower limit
      upper - the upper limit
      java.lang.IllegalArgumentException - if lower or upper is Nan of Infinite, or lower >= upper or (upper - lower) is Infinite
    • createDefaultDecimalFormat

      static java.lang.String createDefaultDecimalFormat​(double min, double max)
    • internalSetRange

      protected void internalSetRange​(Range range)
    • setScaleLineVisible

      public void setScaleLineVisible​(boolean scaleLineVisible)
      scaleLineVisible - the scaleLineVisible to set
    • setTickLabelSide

      public void setTickLabelSide​(AbstractScale.LabelSide tickLabelSide)
      tickLabelSide - the side of the tick label relative to tick mark
    • setTickLableSide

      @Deprecated public void setTickLableSide​(AbstractScale.LabelSide tickLabelSide)
      use correctly spelled setTickLabelSide(LabelSide)
    • setTimeUnit

      public void setTimeUnit​(int timeUnit)
      Set the time unit for a date enabled scale. The format of the time would be determined by it.
      timeUnit - the timeUnit to set. It should be one of: Calendar.MILLISECOND, Calendar.SECOND, Calendar.MINUTE, Calendar.HOUR_OF_DAY, Calendar.DATE, Calendar.MONTH, Calendar.YEAR.
      See Also:
    • updateTick

      public abstract void updateTick()
      Updates the tick, recalculate all inner parameters
    • setMajorGridStep

      public void setMajorGridStep​(double majorGridStep)
      majorGridStep - the majorGridStep to set
    • getMajorGridStep

      public double getMajorGridStep()
      the majorGridStep
    • setMinorTickMarkStepHint

      public void setMinorTickMarkStepHint​(int minorTickMarkStepHint)
      minorTickMarkStepHint - the minorTickMarkStepHint to set
    • getMinorTickMarkStepHint

      public int getMinorTickMarkStepHint()
      the minorTickMarkStepHint
    • setAutoFormat

      public void setAutoFormat​(boolean autoFormat)
      autoFormat - the autoFormat to set
    • internalSetAutoFormat

      protected void internalSetAutoFormat​(boolean autoFormat)
      Sets ONLY the autoFormat value
      autoFormat -
    • isAutoFormat

      public boolean isAutoFormat()
      the autoFormat