org.jplot2d.element.impl
Class TitleImpl
- java.lang.Object
-
- org.jplot2d.element.impl.ElementImpl
-
- org.jplot2d.element.impl.ComponentImpl
-
- org.jplot2d.element.impl.TitleImpl
-
- All Implemented Interfaces:
- Element, ComponentEx, ElementEx, TitleEx, MovableComponent, PComponent, TextComponent, Title
public class TitleImpl extends ComponentImpl implements TitleEx
-
-
Constructor Summary
Constructors Constructor and Description TitleImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidcalcSize()Called by plot to calculate size of this title.booleancanContribute()Returnstrueif this component can contribute visible parts to plot rendering artifact when this component is visible.voidcopyFrom(ElementEx src)Copies all properties from given src to this element.voiddraw(java.awt.Graphics2D g)Draw this component only.java.awt.geom.Rectangle2DgetBounds()Returns the paper bounds relative to its location.doublegetGapFactor()Returns the ratio of gap to its height.HAligngetHAlign()Get the horizontal alignment.java.lang.StringgetId()Returns the id string of this elementInvokeStepgetInvokeStepFormParent()Return the invoke step to get this object from its parent.java.awt.geom.Point2DgetLocation()Gets the location of this title.PlotExgetParent()Gets the parent of this component.TitlePositiongetPosition()Gets the current position of this title in a layer.java.awt.geom.Dimension2DgetSize()Returns the paper size of this component.java.lang.StringgetText()Returns the text string.MathElementgetTextModel()VAligngetVAlign()Get the vertical alignment.voidsetGapFactor(double factor)Sets the ratio of gap to its height.voidsetHAlign(HAlign hAlign)Set the horizontal alignment.voidsetLocation(double locX, double locY)Moves this component to a new location.voidsetLocation(java.awt.geom.Point2D p)Moves this title to a new location.voidsetPosition(TitlePosition position)Sets the position of this title.voidsetText(java.lang.String text)Defines the single line of text to be displayed.voidsetTextModel(MathElement model)voidsetVAlign(VAlign vAlign)Set the vertical alignment.voidsetVisible(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, copyStructure, getColor, getEffectiveColor, getEffectiveFont, getEffectiveFontName, getEffectiveFontSize, getEffectiveFontStyle, getFontName, getFontScale, getFontSize, getFontStyle, getMooringMap, getPaperTransform, 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.Title
isMovable, setMovable
-
Methods inherited from interface org.jplot2d.element.PComponent
getColor, getEffectiveFont, getFontName, getFontScale, getFontSize, getFontStyle, getPaperTransform, getSelectableBounds, getZOrder, isCacheable, isSelectable, isVisible, setCacheable, setColor, setFont, setFontName, setFontScale, setFontSize, setFontStyle, setSelectable, setZOrder
-
Methods inherited from interface org.jplot2d.element.Element
getEnvironment
-
Methods inherited from interface org.jplot2d.element.impl.ComponentEx
copyStructure, getEffectiveColor, getEffectiveFontName, getEffectiveFontSize, getEffectiveFontStyle, getMooringMap, isMovable, isRedrawNeeded, parentEffectiveColorChanged, parentEffectiveFontChanged, setMovable, setRedrawNeeded
-
-
-
-
Method Detail
-
getId
public java.lang.String getId()
Description copied from interface:ElementReturns the id string of this element
-
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 interfaceElement- Specified by:
getParentin interfaceComponentEx- Specified by:
getParentin interfaceElementEx- Specified by:
getParentin interfaceTitleEx- Specified by:
getParentin interfacePComponent- Overrides:
getParentin classComponentImpl- Returns:
- the parent of this component
-
canContribute
public boolean canContribute()
Description copied from interface:ComponentExReturnstrueif this component can contribute visible parts to plot rendering artifact when this component is visible. Subcomponents are not considered.- Specified by:
canContributein interfaceComponentEx- Overrides:
canContributein classComponentImpl- Returns:
- the indicator
-
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()
-
getLocation
public java.awt.geom.Point2D getLocation()
Description copied from interface:TitleGets the location of this title.- Specified by:
getLocationin interfacePComponent- Specified by:
getLocationin interfaceTitle- Returns:
- an instance of
Pointrepresenting the base point of this title
-
setLocation
public final void setLocation(java.awt.geom.Point2D p)
Description copied from interface:TitleMoves this title to a new location.Notice: This method should be called when the position is
null, otherwise the behavior is not defined.- Specified by:
setLocationin interfaceMovableComponent- Specified by:
setLocationin interfaceTitle- Parameters:
p- the base point of the title
-
setLocation
public void setLocation(double locX, double locY)Description copied from interface:MovableComponentMoves this component to a new location.- Specified by:
setLocationin interfaceMovableComponent- Parameters:
locX- the x-coordinate of the new locationlocY- the y-coordinate of the new location
-
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
-
getText
public java.lang.String getText()
Description copied from interface:TextComponentReturns the text string.- Specified by:
getTextin interfaceTextComponent- Returns:
- a String
-
setText
public void setText(java.lang.String text)
Description copied from interface:TextComponentDefines the single line of text to be displayed. The string can be in TeX-like syntax. A pair of "$" mark into math mode and out math mode. In math mode, Greek letter can be inputed as \alpha, \beta, etc. Superscripts (up high) and subscripts (down low) can be inputed by using "^" and "_". Notice that ^ and _ apply only to the next single character. If you want several things to be superscripted or subscripted, just enclose them in braces. eg: "plain text $x_\alpha^{2y}$".- Specified by:
setTextin interfaceTextComponent
-
getTextModel
public MathElement getTextModel()
-
setTextModel
public void setTextModel(MathElement model)
-
getHAlign
public HAlign getHAlign()
Description copied from interface:TitleGet the horizontal alignment.- Specified by:
getHAlignin interfaceTextComponent- Specified by:
getHAlignin interfaceTitle- Returns:
- the horizontal alignment.
-
setHAlign
public void setHAlign(HAlign hAlign)
Description copied from interface:TitleSet the horizontal alignment. The alignment can be LEFT, CENTER, or RIGHT. eg, LEFT means the base point is on the left of this title.Notice: This method should be called when the position is
null, otherwise the behavior is not defined.- Specified by:
setHAlignin interfaceTextComponent- Specified by:
setHAlignin interfaceTitle- Parameters:
hAlign- horizontal alignment.
-
getVAlign
public VAlign getVAlign()
Description copied from interface:TitleGet the vertical alignment.- Specified by:
getVAlignin interfaceTextComponent- Specified by:
getVAlignin interfaceTitle- Returns:
- the vertical alignment.
-
setVAlign
public void setVAlign(VAlign vAlign)
Description copied from interface:TitleSet the vertical alignment. The alignment can be TOP, MIDDLE, or BOTTOM. eg, TOP means the base point is on the top of this title.Notice: This method should be called when the position is
null, otherwise the behavior is not defined.- Specified by:
setVAlignin interfaceTextComponent- Specified by:
setVAlignin interfaceTitle- Parameters:
vAlign- The vertical alignment.
-
getSize
public java.awt.geom.Dimension2D getSize()
Description copied from interface:PComponentReturns the paper size of this component.- Specified by:
getSizein interfacePComponent- Returns:
-
getPosition
public TitlePosition getPosition()
Description copied from interface:TitleGets the current position of this title in a layer.- Specified by:
getPositionin interfaceTitle- Returns:
- the position.
-
setPosition
public void setPosition(TitlePosition position)
Description copied from interface:TitleSets the position of this title. Possible value is FREE, TOPLEFT, TOPCENTER, TOPRIGHT, BOTTOMLEFT, BOTTOMCENTER, BOTTOMRIGHT. Only when position isFREE, the title can be located byTitle.setLocation(Point2D),#setHAlign(),#setVAlign().- Specified by:
setPositionin interfaceTitle- Parameters:
position- the position of this title.
-
getGapFactor
public double getGapFactor()
Description copied from interface:TitleReturns the ratio of gap to its height. The default value is 1/4.- Specified by:
getGapFactorin interfaceTitle- Returns:
- the gap factor
-
setGapFactor
public void setGapFactor(double factor)
Description copied from interface:TitleSets the ratio of gap to its height. The gap is under the title when its position is TOPLEFT, TOPCENTER, TOPRIGHT. The gap is above the title when its position is BOTTOMLEFT, BOTTOMCENTER, BOTTOMRIGHT.- Specified by:
setGapFactorin interfaceTitle
-
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.
-
calcSize
public void calcSize()
Description copied from interface:TitleExCalled by plot to calculate size of this title.
-
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 g)
Description copied from interface:ComponentExDraw this component only. All its children is not drawn.- Specified by:
drawin interfaceComponentEx- Parameters:
g- to the Graphics2D drawing. The transformation of this component is not applied.
-
-
DMelt 3.0 © DataMelt by jWork.ORG