Class AbstractScale
java.lang.Object
org.eclipse.draw2d.Figure
org.eclipse.nebula.visualization.xygraph.linearscale.AbstractScale
- All Implemented Interfaces:
org.eclipse.draw2d.IFigure
- 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 classAbstractScale.LabelSideticks label's position relative to tick marks -
Field Summary
Fields Modifier and Type Field Description protected static java.lang.StringDEFAULT_DATE_FORMATprotected java.lang.Stringdefault_decimal_formatthe default label formatstatic java.lang.StringDEFAULT_ENGINEERING_FORMATstatic doubleDEFAULT_LOG_SCALE_MAXthe default maximum value of log scale rangestatic doubleDEFAULT_MAXstatic doubleDEFAULT_MINprotected booleandirtyWhenever any parameter has been changed, the scale should be marked as dirty, so all the inner parameters could be recalculated before the next paintprotected static intENGINEERING_LIMITthe digits limit to be displayed in engineering formatprotected doublemaxThe maximum value of the scaleprotected doubleminThe minimum value of the scale -
Constructor Summary
Constructors Constructor Description AbstractScale() -
Method Summary
Modifier and Type Method Description (package private) static java.lang.StringcreateDefaultDecimalFormat(double min, double max)java.lang.Stringformat(java.lang.Object obj)Formats the given object as a DateFormat if Date is enabled or as a DecimalFormat.java.lang.Stringformat(java.lang.Object obj, boolean minOrMaxDate)Formats the given object as a DateFormat if Date is enabled or as a DecimalFormat.java.lang.StringgetFormatPattern()doublegetMajorGridStep()intgetMajorTickMarkStepHint()intgetMinorTickMarkStepHint()RangegetRange()get the scale rangeAbstractScale.LabelSidegetTickLabelSide()AbstractScale.LabelSidegetTickLablesSide()Deprecated.use correctly spelled#getTickLabelSide(LabelSide)intgetTimeUnit()protected voidinternalSetAutoFormat(boolean autoFormat)Sets ONLY the autoFormat valueprotected voidinternalSetFormatPattern(java.lang.String formatPattern)protected voidinternalSetLogScaleEnabled(boolean logScaleEnabled)protected voidinternalSetRange(Range range)booleanisAutoFormat()booleanisDateEnabled()booleanisDirty()booleanisLogScaleEnabled()Gets the state indicating if log scale is enabled.booleanisMinorTicksVisible()booleanisScaleLineVisible()voidsetAutoFormat(boolean autoFormat)voidsetDateEnabled(boolean dateEnabled)protected voidsetDirty(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 paintvoidsetFont(org.eclipse.swt.graphics.Font f)voidsetFormatPattern(java.lang.String formatPattern)Sets the format pattern for axis tick label. seeFormatvoidsetLogScale(boolean enabled)voidsetMajorGridStep(double majorGridStep)voidsetMajorTickMarkStepHint(int majorTickMarkStepHint)voidsetMinorTickMarkStepHint(int minorTickMarkStepHint)voidsetMinorTicksVisible(boolean minorTicksVisible)voidsetRange(double lower, double upper)set the scale rangevoidsetRange(double t1, double t2, boolean honorOriginDirection)Set the range with option to honor its original direction.voidsetRange(Range range)set the scale rangevoidsetScaleLineVisible(boolean scaleLineVisible)voidsetTickLabelSide(AbstractScale.LabelSide tickLabelSide)voidsetTickLableSide(AbstractScale.LabelSide tickLabelSide)Deprecated.use correctly spelledsetTickLabelSide(LabelSide)voidsetTimeUnit(int timeUnit)Set the time unit for a date enabled scale.abstract voidupdateTick()Updates the tick, recalculate all inner parametersMethods 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
-
Field Details
-
DEFAULT_MAX
public static final double DEFAULT_MAX- See Also:
- Constant Field Values
-
DEFAULT_MIN
public static final double DEFAULT_MIN- See Also:
- Constant Field Values
-
DEFAULT_ENGINEERING_FORMAT
public static final java.lang.String DEFAULT_ENGINEERING_FORMAT- See Also:
- Constant Field Values
-
ENGINEERING_LIMIT
protected static final int ENGINEERING_LIMITthe digits limit to be displayed in engineering format- See Also:
- Constant Field Values
-
DEFAULT_DATE_FORMAT
protected static final java.lang.String DEFAULT_DATE_FORMAT- See Also:
- Constant Field Values
-
DEFAULT_LOG_SCALE_MAX
public static final double DEFAULT_LOG_SCALE_MAXthe default maximum value of log scale range- See Also:
- Constant Field Values
-
default_decimal_format
protected java.lang.String default_decimal_formatthe default label format -
min
protected double minThe minimum value of the scale -
max
protected double maxThe maximum value of the scale -
dirty
protected boolean dirtyWhenever any parameter has been changed, the scale should be marked as dirty, so all the inner parameters could be recalculated before the next paint
-
-
Constructor Details
-
AbstractScale
public AbstractScale()
-
-
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.- Parameters:
obj- the object- Returns:
- 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.- Parameters:
obj- the objectminOrMaxDate- true if it is the min or max date on the scale.- Returns:
- the formatted string
-
getMajorTickMarkStepHint
public int getMajorTickMarkStepHint()- Returns:
- the majorTickMarkStepHint
-
getRange
get the scale range -
getTickLablesSide
Deprecated.use correctly spelled#getTickLabelSide(LabelSide) -
getTickLabelSide
- Returns:
- the side of the tick label relative to the tick marks
-
getTimeUnit
public int getTimeUnit()- Returns:
- the timeUnit
-
isDateEnabled
public boolean isDateEnabled()- Returns:
- the dateEnabled
-
isDirty
public boolean isDirty()- Returns:
- the dirty
-
isLogScaleEnabled
public boolean isLogScaleEnabled()Gets the state indicating if log scale is enabled.- Returns:
- true if log scale is enabled
-
isMinorTicksVisible
public boolean isMinorTicksVisible()- Returns:
- the minorTicksVisible
-
isScaleLineVisible
public boolean isScaleLineVisible()- Returns:
- the scaleLineVisible
-
setDateEnabled
public void setDateEnabled(boolean dateEnabled)- Parameters:
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- Parameters:
dirty- the dirty to set
-
setFormatPattern
public void setFormatPattern(java.lang.String formatPattern)Sets the format pattern for axis tick label. seeFormatIf null is set, default format will be used.
- Parameters:
format- the format- Throws:
java.lang.NullPointerException- ifpatternis nulljava.lang.IllegalArgumentException- if the given pattern is invalid.
-
internalSetFormatPattern
protected void internalSetFormatPattern(java.lang.String formatPattern) -
getFormatPattern
public java.lang.String getFormatPattern()- Returns:
- the formatPattern
-
setFont
public void setFont(org.eclipse.swt.graphics.Font f)- Specified by:
setFontin interfaceorg.eclipse.draw2d.IFigure- Overrides:
setFontin classorg.eclipse.draw2d.Figure
-
setLogScale
public void setLogScale(boolean enabled) throws java.lang.IllegalStateException- Parameters:
enabled- true if enabling log scales- Throws:
java.lang.IllegalStateException
-
internalSetLogScaleEnabled
protected void internalSetLogScaleEnabled(boolean logScaleEnabled) -
setMajorTickMarkStepHint
public void setMajorTickMarkStepHint(int majorTickMarkStepHint)- Parameters:
majorTickMarkStepHint- the majorTickMarkStepHint to set, should be less than 1000.
-
setMinorTicksVisible
public void setMinorTicksVisible(boolean minorTicksVisible)- Parameters:
minorTicksVisible- the minorTicksVisible to set
-
setRange
set the scale range -
setRange
public void setRange(double t1, double t2, boolean honorOriginDirection)Set the range with option to honor its original direction.- Parameters:
t1- value 1 of the ranget2- value 2 of the rangehonorOriginDirection- 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- Parameters:
lower- the lower limitupper- the upper limit- Throws:
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
-
setScaleLineVisible
public void setScaleLineVisible(boolean scaleLineVisible)- Parameters:
scaleLineVisible- the scaleLineVisible to set
-
setTickLabelSide
- Parameters:
tickLabelSide- the side of the tick label relative to tick mark
-
setTickLableSide
Deprecated.use correctly spelledsetTickLabelSide(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.- Parameters:
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:
Calendar
-
updateTick
public abstract void updateTick()Updates the tick, recalculate all inner parameters -
setMajorGridStep
public void setMajorGridStep(double majorGridStep)- Parameters:
majorGridStep- the majorGridStep to set
-
getMajorGridStep
public double getMajorGridStep()- Returns:
- the majorGridStep
-
setMinorTickMarkStepHint
public void setMinorTickMarkStepHint(int minorTickMarkStepHint)- Parameters:
minorTickMarkStepHint- the minorTickMarkStepHint to set
-
getMinorTickMarkStepHint
public int getMinorTickMarkStepHint()- Returns:
- the minorTickMarkStepHint
-
setAutoFormat
public void setAutoFormat(boolean autoFormat)- Parameters:
autoFormat- the autoFormat to set
-
internalSetAutoFormat
protected void internalSetAutoFormat(boolean autoFormat)Sets ONLY the autoFormat value- Parameters:
autoFormat-
-
isAutoFormat
public boolean isAutoFormat()- Returns:
- the autoFormat
-