org.jplot2d.element.impl
Class AxisImpl
- java.lang.Object
-
- org.jplot2d.element.impl.ElementImpl
-
- org.jplot2d.element.impl.ComponentImpl
-
- org.jplot2d.element.impl.AxisImpl
-
- All Implemented Interfaces:
- Axis, Element, AxisEx, ComponentEx, ElementEx, PComponent
public class AxisImpl extends ComponentImpl implements AxisEx
-
-
Constructor Summary
Constructors Constructor and Description AxisImpl()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidcalcThickness()calculate asc and desc of this axis.voidcopyFrom(ElementEx src)Copies all properties from given src to this element.ComponentExcopyStructure(java.util.Map<ElementEx,ElementEx> orig2copyMap)Create a structural copy of this element and put them into orig2copyMap.voiddraw(java.awt.Graphics2D graphics)Draw this component only.doublegetAsc()floatgetAxisLineWidth()Returns the axis line width is pt(1/72 inch)java.awt.geom.Rectangle2DgetBounds()Returns the paper bounds relative to its location.doublegetDesc()always negativejava.lang.StringgetId()Returns the id string of this elementInvokeStepgetInvokeStepFormParent()Return the invoke step to get this object from its parent.java.awt.ColorgetLabelColor()Return the color of the labels of the ticksAxisOrientationgetLabelOrientation()Get the Orientation of the labels.AxisLabelSidegetLabelSide()Return the position of the label of the ticksstatic java.awt.geom.Dimension2D[]getLabelsPaperSize(MathElement[] labels, java.awt.Font labelFont)Returns the labels normal size.doublegetLength()Returns the paper length of this axis.java.awt.geom.Point2DgetLocation()Returns the location of this component.doublegetMinorTickHeight()Return the height of the minor ticks of the axis.java.util.Map<Element,Element>getMooringMap()Returns a map to tell why this component cannot be removed from its container.AxisOrientationgetOrientation()Orientation is a read-only property.PaperTransformgetPaperTransform()Returns the paper transform of this component, which can be used to convert between device coordinate and paper coordinate of this component.PlotExgetParent()Gets the parent of this component.AxisPositiongetPosition()Return the position of the axis: NEGATIVE_SIDE, POSITIVE_SIDE.java.lang.StringgetShortId()Returns the short id of this axis.java.awt.geom.Dimension2DgetSize()Returns the paper size of this component.doublegetThickness()doublegetTickHeight()Returns the height of the major ticks of the axisfloatgetTickLineWidth()Returns the axis line width is pt(1/72 inch)AxisTickManagerExgetTickManager()Returns the tick manager of this axis.AxisTickSidegetTickSide()Return the direction of the ticksAxisTitleExgetTitle()Returns the title of this axis.voidinvalidateThickness()Mark the thickness is invalid.booleanisGridLines()Return if the grid line is displayed or not.booleanisLabelVisible()Returns if the tick labels is shown or notbooleanisMinorGridLines()Return if the minor grid line is displayed or not.booleanisTickVisible()Returns if the tick mark is shown or notvoidsetActualFont(java.awt.Font font)Set shrunk font for displaying by tick manager.voidsetAxisLineWidth(float width)Sets the axis line width is pt(1/72 inch).voidsetGridLines(boolean showGridLines)Sets grid lines of grey lines in corresponding of major ticks of the axis.voidsetLabelColor(java.awt.Color color)Set the color of the labels of the ticksvoidsetLabelOrientation(AxisOrientation orientation)Set the orientation of the labels of the ticksvoidsetLabelSide(AxisLabelSide side)Set the position of the label of the ticks respect of the axisvoidsetLabelVisible(boolean visible)Sets if the tick labels is shown or notvoidsetLength(double length)Set the length for this axis.voidsetLocation(double locX, double locY)Moves this plot component to a new location.voidsetMinorGridLines(boolean showGridLines)Sets grid lines of grey lines in corresponding of minor ticks of the axis.voidsetMinorTickHeight(double height)Set the height of the minor ticks of the axis.voidsetOrientation(AxisOrientation orientation)Called byPlot.addXAxis(Axis)orPlot.addYAxis(Axis)to set the orientation of this axis.voidsetPosition(AxisPosition position)Set the position of the axis: NEGATIVE_SIDE, POSITIVE_SIDE.voidsetTickHeight(double height)Set the height of the major ticks of the axis.voidsetTickLineWidth(float width)Sets the axis line width is pt(1/72 inch).voidsetTickManager(AxisTickManager tickManager)voidsetTickSide(AxisTickSide side)Set the side position of the ticksvoidsetTickVisible(boolean visible)Sets if the tick mark is shown or notvoidsetVisible(boolean visible)Shows or hides this component depending on the value of parameterb.voidthisEffectiveColorChanged()Called when setColor() or parentEffectiveColorChanged() change the effective color of this component.voidthisEffectiveFontChanged()Called when setFontXxx() or parentEffectiveFontChanged() change the effective font of this component.-
Methods inherited from class org.jplot2d.element.impl.ComponentImpl
addPropertyChangeListener, canContribute, getColor, getEffectiveColor, getEffectiveFont, getEffectiveFontName, getEffectiveFontSize, getEffectiveFontStyle, getFontName, getFontScale, getFontSize, getFontStyle, getSelectableBounds, getZOrder, isCacheable, isMovable, isRedrawNeeded, isSelectable, isVisible, parentEffectiveColorChanged, parentEffectiveFontChanged, removePropertyChangeListener, setCacheable, setColor, setFont, setFontName, setFontScale, setFontSize, setFontStyle, setMovable, setRedrawNeeded, setSelectable, setZOrder
-
Methods inherited from class org.jplot2d.element.impl.ElementImpl
getEnvironment, getFullId, notify, setParent, toString
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.jplot2d.element.impl.ComponentEx
canContribute, getEffectiveColor, getEffectiveFontName, getEffectiveFontSize, getEffectiveFontStyle, isMovable, isRedrawNeeded, parentEffectiveColorChanged, parentEffectiveFontChanged, setMovable, setRedrawNeeded
-
Methods inherited from interface org.jplot2d.element.PComponent
getColor, getEffectiveFont, getFontName, getFontScale, getFontSize, getFontStyle, getSelectableBounds, getZOrder, isCacheable, isSelectable, isVisible, setCacheable, setColor, setFont, setFontName, setFontScale, setFontSize, setFontStyle, setSelectable, setZOrder
-
Methods inherited from interface org.jplot2d.element.Element
getEnvironment
-
-
-
-
Method Detail
-
getId
public java.lang.String getId()
Description copied from interface:ElementReturns the id string of this element
-
getShortId
public java.lang.String getShortId()
Description copied from interface:AxisExReturns the short id of this axis. The short id is composed of series of ids concatenated with dots. The 1st id is the id of this element, the 2nd id is the id of the parent of this element, etc, until but not include the root plot.- Specified by:
getShortIdin interfaceAxisEx- Returns:
- the short id of this axis.
-
getInvokeStepFormParent
public InvokeStep getInvokeStepFormParent()
Description copied from interface:ElementExReturn the invoke step to get this object from its parent.- Specified by:
getInvokeStepFormParentin interfaceElementEx- Returns:
- the invoke step
-
getParent
public PlotEx getParent()
Description copied from interface:ElementGets the parent of this component.- Specified by:
getParentin interfaceAxis- Specified by:
getParentin interfaceElement- Specified by:
getParentin interfaceAxisEx- Specified by:
getParentin interfaceComponentEx- Specified by:
getParentin interfaceElementEx- Specified by:
getParentin interfacePComponent- Overrides:
getParentin classComponentImpl- Returns:
- the parent of this component
-
getMooringMap
public java.util.Map<Element,Element> getMooringMap()
Description copied from interface:ComponentExReturns a map to tell why this component cannot be removed from its container. The key is the moored element, required by its value.- Specified by:
getMooringMapin interfaceComponentEx- Overrides:
getMooringMapin classComponentImpl- Returns:
- a map. The key is the element required by its value.
-
thisEffectiveColorChanged
public void thisEffectiveColorChanged()
Description copied from interface:ComponentExCalled when setColor() or parentEffectiveColorChanged() change the effective color of this component.- Specified by:
thisEffectiveColorChangedin interfaceComponentEx
-
thisEffectiveFontChanged
public void thisEffectiveFontChanged()
Description copied from interface:ComponentExCalled when setFontXxx() or parentEffectiveFontChanged() change the effective font of this component.- Specified by:
thisEffectiveFontChangedin interfaceComponentEx
-
getLocation
public java.awt.geom.Point2D getLocation()
Description copied from interface:PComponentReturns the location of this component.- Specified by:
getLocationin interfacePComponent- Returns:
- the base point in its parent's paper coordinate space
-
setLocation
public void setLocation(double locX, double locY)Description copied from interface:AxisExMoves this plot component to a new location. The origin of the new location is specified by pointp. Point2Dpis given in the parent's paper coordinate space.- Specified by:
setLocationin interfaceAxisEx
-
getOrientation
public AxisOrientation getOrientation()
Description copied from interface:AxisOrientation is a read-only property. It just show the orientation of this axis after it has been add as a X/Y axis.- Specified by:
getOrientationin interfaceAxis- Returns:
- orientation of this axis
-
setOrientation
public void setOrientation(AxisOrientation orientation)
Description copied from interface:AxisExCalled byPlot.addXAxis(Axis)orPlot.addYAxis(Axis)to set the orientation of this axis.- Specified by:
setOrientationin interfaceAxisEx- Parameters:
orientation- the orientation
-
getSize
public java.awt.geom.Dimension2D getSize()
Description copied from interface:PComponentReturns the paper size of this component.- Specified by:
getSizein interfacePComponent- Returns:
-
getBounds
public java.awt.geom.Rectangle2D getBounds()
Description copied from interface:PComponentReturns the paper bounds relative to its location. The units of bounds is pt (1/72 inch)- Specified by:
getBoundsin interfacePComponent- Overrides:
getBoundsin classComponentImpl- Returns:
- the paper bounds of this component.
-
getPaperTransform
public PaperTransform getPaperTransform()
Description copied from interface:PComponentReturns the paper transform of this component, which can be used to convert between device coordinate and paper coordinate of this component. The original point of paper coordinate is the location point of this component.Returns
nullif the component is not added to a plot or not laid out- Specified by:
getPaperTransformin interfaceAxisEx- Specified by:
getPaperTransformin interfacePComponent- Overrides:
getPaperTransformin classComponentImpl- Returns:
- the paper transform of this component
-
setVisible
public void setVisible(boolean visible)
Description copied from interface:PComponentShows or hides this component depending on the value of parameterb.- Specified by:
setVisiblein interfacePComponent- Overrides:
setVisiblein classComponentImpl- Parameters:
visible- iftrue, shows this component; otherwise, hides this component- See Also:
PComponent.isVisible()
-
getTickManager
public AxisTickManagerEx getTickManager()
Description copied from interface:AxisReturns the tick manager of this axis.- Specified by:
getTickManagerin interfaceAxis- Specified by:
getTickManagerin interfaceAxisEx- Returns:
- the tick manager of this axis
-
setTickManager
public void setTickManager(AxisTickManager tickManager)
- Specified by:
setTickManagerin interfaceAxis
-
getLength
public double getLength()
Description copied from interface:AxisReturns the paper length of this axis.
-
setLength
public void setLength(double length)
Description copied from interface:AxisExSet the length for this axis.
-
getPosition
public AxisPosition getPosition()
Description copied from interface:AxisReturn the position of the axis: NEGATIVE_SIDE, POSITIVE_SIDE.- Specified by:
getPositionin interfaceAxis- Returns:
- the position of the axis in the plot.
-
setPosition
public void setPosition(AxisPosition position)
Description copied from interface:AxisSet the position of the axis: NEGATIVE_SIDE, POSITIVE_SIDE.- Specified by:
setPositionin interfaceAxis- Parameters:
position- the position of the axis in the plot.
-
getAxisLineWidth
public float getAxisLineWidth()
Description copied from interface:AxisReturns the axis line width is pt(1/72 inch)- Specified by:
getAxisLineWidthin interfaceAxis- Returns:
- the axis line width
-
setAxisLineWidth
public void setAxisLineWidth(float width)
Description copied from interface:AxisSets the axis line width is pt(1/72 inch). The default line width is 1.0 pt.- Specified by:
setAxisLineWidthin interfaceAxis- Parameters:
width- the axis line width
-
isGridLines
public boolean isGridLines()
Description copied from interface:AxisReturn if the grid line is displayed or not.- Specified by:
isGridLinesin interfaceAxis- Returns:
- true if the grid line is displayed
-
setGridLines
public void setGridLines(boolean showGridLines)
Description copied from interface:AxisSets grid lines of grey lines in corresponding of major ticks of the axis.- Specified by:
setGridLinesin interfaceAxis- Parameters:
showGridLines- if true show the grid lines.
-
isMinorGridLines
public boolean isMinorGridLines()
Description copied from interface:AxisReturn if the minor grid line is displayed or not.- Specified by:
isMinorGridLinesin interfaceAxis- Returns:
- true if the minor grid line is displayed
-
setMinorGridLines
public void setMinorGridLines(boolean showGridLines)
Description copied from interface:AxisSets grid lines of grey lines in corresponding of minor ticks of the axis.- Specified by:
setMinorGridLinesin interfaceAxis- Parameters:
showGridLines- if true show the grid lines.
-
isTickVisible
public boolean isTickVisible()
Description copied from interface:AxisReturns if the tick mark is shown or not- Specified by:
isTickVisiblein interfaceAxis- Returns:
- if the tick mark is shown or not
-
setTickVisible
public void setTickVisible(boolean visible)
Description copied from interface:AxisSets if the tick mark is shown or not- Specified by:
setTickVisiblein interfaceAxis
-
getTickSide
public AxisTickSide getTickSide()
Description copied from interface:AxisReturn the direction of the ticks- Specified by:
getTickSidein interfaceAxis
-
setTickSide
public void setTickSide(AxisTickSide side)
Description copied from interface:AxisSet the side position of the ticks- Specified by:
setTickSidein interfaceAxis
-
getTickHeight
public double getTickHeight()
Description copied from interface:AxisReturns the height of the major ticks of the axis- Specified by:
getTickHeightin interfaceAxis- Returns:
- the height of the ticks
-
setTickHeight
public void setTickHeight(double height)
Description copied from interface:AxisSet the height of the major ticks of the axis.- Specified by:
setTickHeightin interfaceAxis- Parameters:
height- the new height of the ticks
-
getMinorTickHeight
public double getMinorTickHeight()
Description copied from interface:AxisReturn the height of the minor ticks of the axis.- Specified by:
getMinorTickHeightin interfaceAxis- Returns:
- the height of the minor ticks.
-
setMinorTickHeight
public void setMinorTickHeight(double height)
Description copied from interface:AxisSet the height of the minor ticks of the axis.- Specified by:
setMinorTickHeightin interfaceAxis- Parameters:
height- the height of the ticks
-
getTickLineWidth
public float getTickLineWidth()
Description copied from interface:AxisReturns the axis line width is pt(1/72 inch)- Specified by:
getTickLineWidthin interfaceAxis- Returns:
- the axis line width
-
setTickLineWidth
public void setTickLineWidth(float width)
Description copied from interface:AxisSets the axis line width is pt(1/72 inch). The default line width is 0.5 pt.- Specified by:
setTickLineWidthin interfaceAxis- Parameters:
width- the axis line width
-
isLabelVisible
public boolean isLabelVisible()
Description copied from interface:AxisReturns if the tick labels is shown or not- Specified by:
isLabelVisiblein interfaceAxis- Returns:
- if the tick mark is shown or not
-
setLabelVisible
public void setLabelVisible(boolean visible)
Description copied from interface:AxisSets if the tick labels is shown or not- Specified by:
setLabelVisiblein interfaceAxis
-
getLabelOrientation
public AxisOrientation getLabelOrientation()
Description copied from interface:AxisGet the Orientation of the labels.- Specified by:
getLabelOrientationin interfaceAxis- Returns:
- label orientation:
0 HORIZONTAL
1 VERTICAL
-
setLabelOrientation
public void setLabelOrientation(AxisOrientation orientation)
Description copied from interface:AxisSet the orientation of the labels of the ticks- Specified by:
setLabelOrientationin interfaceAxis- Parameters:
orientation- HORIZONTAL/VERTICAL
-
getLabelSide
public AxisLabelSide getLabelSide()
Description copied from interface:AxisReturn the position of the label of the ticks- Specified by:
getLabelSidein interfaceAxis
-
setLabelSide
public void setLabelSide(AxisLabelSide side)
Description copied from interface:AxisSet the position of the label of the ticks respect of the axis- Specified by:
setLabelSidein interfaceAxis
-
getLabelColor
public java.awt.Color getLabelColor()
Description copied from interface:AxisReturn the color of the labels of the ticks- Specified by:
getLabelColorin interfaceAxis- Returns:
- the color of the labels
-
setLabelColor
public void setLabelColor(java.awt.Color color)
Description copied from interface:AxisSet the color of the labels of the ticks- Specified by:
setLabelColorin interfaceAxis- Parameters:
color- the color of the labels
-
setActualFont
public void setActualFont(java.awt.Font font)
Description copied from interface:AxisExSet shrunk font for displaying by tick manager.- Specified by:
setActualFontin interfaceAxisEx- Parameters:
font- the shrunk font
-
getTitle
public AxisTitleEx getTitle()
Description copied from interface:AxisReturns the title of this axis.
-
getThickness
public double getThickness()
- Specified by:
getThicknessin interfaceAxisEx
-
invalidateThickness
public void invalidateThickness()
Mark the thickness is invalid. Changing tick height, label strings label font or orientation will call this method- Specified by:
invalidateThicknessin interfaceAxisEx
-
calcThickness
public void calcThickness()
Description copied from interface:AxisExcalculate asc and desc of this axis.- Specified by:
calcThicknessin interfaceAxisEx
-
getLabelsPaperSize
public static java.awt.geom.Dimension2D[] getLabelsPaperSize(MathElement[] labels, java.awt.Font labelFont)
Returns the labels normal size.- Returns:
- the labels normal size.
-
copyStructure
public ComponentEx copyStructure(java.util.Map<ElementEx,ElementEx> orig2copyMap)
Description copied from interface:ElementExCreate a structural copy of this element and put them into orig2copyMap. All properties are not copied. The parent of the copy are not set by this method.- Specified by:
copyStructurein interfaceComponentEx- Specified by:
copyStructurein interfaceElementEx- Overrides:
copyStructurein classComponentImpl- Parameters:
orig2copyMap- original element to copy map- Returns:
- the structural copy of this element
-
copyFrom
public void copyFrom(ElementEx src)
Description copied from interface:ElementExCopies all properties from given src to this element. Notice properties of sub-elements are not copied over.- Specified by:
copyFromin interfaceElementEx- Overrides:
copyFromin classComponentImpl- Parameters:
src- the src
-
draw
public void draw(java.awt.Graphics2D graphics)
Description copied from interface:ComponentExDraw this component only. All its children is not drawn.- Specified by:
drawin interfaceComponentEx- Parameters:
graphics- to the Graphics2D drawing. The transformation of this component is not applied.
-
-
DMelt 3.0 © DataMelt by jWork.ORG