org.jplot2d.element.impl
Class ComponentImpl
- java.lang.Object
-
- org.jplot2d.element.impl.ElementImpl
-
- org.jplot2d.element.impl.ComponentImpl
-
- All Implemented Interfaces:
- Element, ComponentEx, ElementEx, PComponent
- Direct Known Subclasses:
- AnnotationImpl, AxisImpl, ContainerImpl, GraphImpl, LegendImpl, TitleImpl
public abstract class ComponentImpl extends ElementImpl implements ComponentEx
-
-
Constructor Summary
Constructors Constructor and Description ComponentImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidaddPropertyChangeListener(java.beans.PropertyChangeListener l)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.ComponentExcopyStructure(java.util.Map<ElementEx,ElementEx> orig2copyMap)Create a structural copy of this element and put them into orig2copyMap.java.awt.geom.Rectangle2DgetBounds()Returns the paper bounds relative to its location.java.awt.ColorgetColor()Gets the foreground color of this component.java.awt.ColorgetEffectiveColor()Returns the effective color of this component.java.awt.FontgetEffectiveFont()Returns the effective font of this component.java.lang.StringgetEffectiveFontName()floatgetEffectiveFontSize()intgetEffectiveFontStyle()java.lang.StringgetFontName()Returns the name of the font.floatgetFontScale()Returns the scale apply to parent's font size when font size is NaN.floatgetFontSize()Returns the Font size.intgetFontStyle()Returns the style of the font.java.util.Map<Element,Element>getMooringMap()Returns a map to tell why this component cannot be removed from its container.PaperTransformgetPaperTransform()Returns the paper transform of this component, which can be used to convert between device coordinate and paper coordinate of this component.ContainerExgetParent()Gets the parent of this component.java.awt.geom.Rectangle2DgetSelectableBounds()Returns the selectable bounds relative to its location.intgetZOrder()Returns the z-order of this component.booleanisCacheable()Returnstrueif this component has its own rendering cache.booleanisMovable()booleanisRedrawNeeded()Returnstruewhen this component need to be redrawn.booleanisSelectable()Returnstrueif the component is selectable by mouse.booleanisVisible()Determines whether this component should be visible when its parent is visible.voidparentEffectiveColorChanged()voidparentEffectiveFontChanged()voidremovePropertyChangeListener(java.beans.PropertyChangeListener l)voidsetCacheable(boolean cacheMode)Sets if this component has its own rendering cache.voidsetColor(java.awt.Color color)Sets the foreground color of this component.voidsetFont(java.awt.Font font)Sets the font name, style and size for this component.voidsetFontName(java.lang.String name)Apply the new font with the given namevoidsetFontScale(float scale)Sets the scale apply to parent's font size when font size is NaN.voidsetFontSize(float size)Sets a new size of the string.voidsetFontStyle(int style)Apply a new style to the font.voidsetMovable(boolean movable)Set the movable property.voidsetRedrawNeeded(boolean flag)Mark or clear the flag that indicate this component need to be redrawn, eg.voidsetSelectable(boolean selectable)Set the selectable property.voidsetVisible(boolean visible)Shows or hides this component depending on the value of parameterb.voidsetZOrder(int z)Sets the z-order of this component.-
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
draw, thisEffectiveColorChanged, thisEffectiveFontChanged
-
Methods inherited from interface org.jplot2d.element.PComponent
getLocation, getSize
-
Methods inherited from interface org.jplot2d.element.impl.ElementEx
getFullId, getInvokeStepFormParent, notify, setParent
-
Methods inherited from interface org.jplot2d.element.Element
getEnvironment, getId
-
-
-
-
Method Detail
-
addPropertyChangeListener
public void addPropertyChangeListener(java.beans.PropertyChangeListener l)
-
removePropertyChangeListener
public void removePropertyChangeListener(java.beans.PropertyChangeListener l)
-
getParent
public ContainerEx 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 interfacePComponent- Overrides:
getParentin classElementImpl- 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- Returns:
- a map. The key is the element required by its value.
-
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- Returns:
- the indicator
-
isVisible
public boolean isVisible()
Description copied from interface:PComponentDetermines whether this component should be visible when its parent is visible. Components are initially visible.- Specified by:
isVisiblein interfacePComponent- Returns:
trueif the component is visible,falseotherwise- See Also:
PComponent.setVisible(boolean)
-
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- Parameters:
visible- iftrue, shows this component; otherwise, hides this component- See Also:
PComponent.isVisible()
-
isCacheable
public boolean isCacheable()
Description copied from interface:PComponentReturnstrueif this component has its own rendering cache.- Specified by:
isCacheablein interfacePComponent- Returns:
- the cache mode of this component
-
setCacheable
public void setCacheable(boolean cacheMode)
Description copied from interface:PComponentSets if this component has its own rendering cache.- Specified by:
setCacheablein interfacePComponent- Parameters:
cacheMode- the cache mode
-
isSelectable
public boolean isSelectable()
Description copied from interface:PComponentReturnstrueif the component is selectable by mouse. Only selectable component can be movable.- Specified by:
isSelectablein interfacePComponent- Returns:
trueif selectable
-
setSelectable
public void setSelectable(boolean selectable)
Description copied from interface:PComponentSet the selectable property.- Specified by:
setSelectablein interfacePComponent
-
isMovable
public boolean isMovable()
- Specified by:
isMovablein interfaceComponentEx
-
setMovable
public void setMovable(boolean movable)
Description copied from interface:ComponentExSet the movable property.- Specified by:
setMovablein interfaceComponentEx
-
getZOrder
public int getZOrder()
Description copied from interface:PComponentReturns the z-order of this component.- Specified by:
getZOrderin interfacePComponent- Returns:
- the z-order of this component
-
setZOrder
public void setZOrder(int z)
Description copied from interface:PComponentSets the z-order of this component. The component with higher z-order is on top.- Specified by:
setZOrderin interfacePComponent- Parameters:
z- the z-order value
-
getColor
public java.awt.Color getColor()
Description copied from interface:PComponentGets the foreground color of this component.- Specified by:
getColorin interfacePComponent- Returns:
- this component's foreground color; if this component does not have a foreground color, the foreground color of its parent is returned
- See Also:
PComponent.setColor(java.awt.Color)
-
setColor
public void setColor(java.awt.Color color)
Description copied from interface:PComponentSets the foreground color of this component.- Specified by:
setColorin interfacePComponent- Parameters:
color- the color to become this component's foreground color; if this parameter isnullthen this component will inherit the foreground color of its parent- See Also:
PComponent.getColor()
-
getEffectiveColor
public java.awt.Color getEffectiveColor()
Description copied from interface:ComponentExReturns the effective color of this component.- Specified by:
getEffectiveColorin interfaceComponentEx- Returns:
- the effective color of this component
-
getFontName
public java.lang.String getFontName()
Description copied from interface:PComponentReturns the name of the font.- Specified by:
getFontNamein interfacePComponent- Returns:
- the name of the font.
-
setFontName
public void setFontName(java.lang.String name)
Description copied from interface:PComponentApply the new font with the given name- Specified by:
setFontNamein interfacePComponent- Parameters:
name- the font name.
-
getFontStyle
public int getFontStyle()
Description copied from interface:PComponentReturns the style of the font. The style can be PLAIN, BOLD, ITALIC, or BOLD+ITALIC.- Specified by:
getFontStylein interfacePComponent- Returns:
- the style of the font
- See Also:
Font
-
setFontStyle
public void setFontStyle(int style)
Description copied from interface:PComponentApply a new style to the font. The style can be PLAIN, BOLD, ITALIC, or BOLD+ITALIC.- Specified by:
setFontStylein interfacePComponent- Parameters:
style- the style to apply- See Also:
Font
-
getFontSize
public float getFontSize()
Description copied from interface:PComponentReturns the Font size.- Specified by:
getFontSizein interfacePComponent- Returns:
- the font size.
-
setFontSize
public void setFontSize(float size)
Description copied from interface:PComponentSets a new size of the string.- Specified by:
setFontSizein interfacePComponent- Parameters:
size- the new size of the font.
-
getFontScale
public float getFontScale()
Description copied from interface:PComponentReturns the scale apply to parent's font size when font size is NaN.- Specified by:
getFontScalein interfacePComponent- Returns:
- the font scale.
-
setFontScale
public void setFontScale(float scale)
Description copied from interface:PComponentSets the scale apply to parent's font size when font size is NaN.- Specified by:
setFontScalein interfacePComponent- Parameters:
scale- the scale
-
setFont
public void setFont(java.awt.Font font)
Description copied from interface:PComponentSets the font name, style and size for this component.- Specified by:
setFontin interfacePComponent- Parameters:
font- the desiredFontfor this component
-
getEffectiveFontName
public java.lang.String getEffectiveFontName()
- Specified by:
getEffectiveFontNamein interfaceComponentEx
-
getEffectiveFontStyle
public int getEffectiveFontStyle()
- Specified by:
getEffectiveFontStylein interfaceComponentEx
-
getEffectiveFontSize
public float getEffectiveFontSize()
- Specified by:
getEffectiveFontSizein interfaceComponentEx
-
getEffectiveFont
public java.awt.Font getEffectiveFont()
Description copied from interface:PComponentReturns the effective font of this component.- Specified by:
getEffectiveFontin interfacePComponent- Returns:
- the effective font of this component
-
parentEffectiveColorChanged
public final void parentEffectiveColorChanged()
- Specified by:
parentEffectiveColorChangedin interfaceComponentEx
-
parentEffectiveFontChanged
public final void parentEffectiveFontChanged()
- Specified by:
parentEffectiveFontChangedin interfaceComponentEx
-
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 interfacePComponent- Returns:
- the paper transform of this component
-
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- Returns:
- the paper bounds of this component.
-
getSelectableBounds
public java.awt.geom.Rectangle2D getSelectableBounds()
Description copied from interface:PComponentReturns the selectable bounds relative to its location. The selectable bound may be slightly larger than the bounds, for easy selection by mouse. The units of bounds is pt (1/72 inch)- Specified by:
getSelectableBoundsin interfacePComponent- Returns:
- the paper bounds of this component.
-
isRedrawNeeded
public boolean isRedrawNeeded()
Description copied from interface:ComponentExReturnstruewhen this component need to be redrawn. The result only apply to cacheable component.- Specified by:
isRedrawNeededin interfaceComponentEx- Returns:
- the redraw status
-
setRedrawNeeded
public void setRedrawNeeded(boolean flag)
Description copied from interface:ComponentExMark or clear the flag that indicate this component need to be redrawn, eg. when color changed.- Specified by:
setRedrawNeededin interfaceComponentEx- Parameters:
flag- the flag that indicate this component need to be redrawn
-
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 classElementImpl- 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 classElementImpl- Parameters:
src- the src
-
-
DMelt 3.0 © DataMelt by jWork.ORG