artisynth.core.renderables
Class TextComponentBase

java.lang.Object
  extended by artisynth.core.modelbase.ModelComponentBase
      extended by artisynth.core.modelbase.RenderableComponentBase
          extended by artisynth.core.renderables.TextComponentBase
All Implemented Interfaces:
ModelComponent, RenderableComponent, java.lang.Cloneable, HasProperties, HierarchyNode, GLRenderable, GLSelectable, HasRenderProps, Renderable, Disposable, Scannable
Direct Known Subclasses:
ColorBar, HudPrintStream, TextComponent2d, TextComponent3d, TextLabeller3d

public abstract class TextComponentBase
extends RenderableComponentBase
implements Disposable

Base class for text components, setting font/alignment

Author:
Antonio

Nested Class Summary
static class TextComponentBase.FontStyle
           
static class TextComponentBase.HorizontalAlignment
           
static class TextComponentBase.VerticalAlignment
           
 
Nested classes/interfaces inherited from interface artisynth.core.modelbase.ModelComponent
ModelComponent.NavpanelVisibility
 
Field Summary
static java.lang.String defaultFontName
           
static int defaultFontSize
           
static TextComponentBase.HorizontalAlignment defaultHAlignment
           
static double defaultTextSize
           
static TextComponentBase.VerticalAlignment defaultVAlignment
           
static PropertyList myProps
           
 
Fields inherited from class artisynth.core.modelbase.ModelComponentBase
enforceUniqueCompositeNames, enforceUniqueNames, myNumber, NULL_OBJ, useCompactPathNames
 
Fields inherited from interface maspack.render.GLRenderable
TRANSLUCENT, TWO_DIMENSIONAL
 
Constructor Summary
TextComponentBase()
           
 
Method Summary
static RenderProps createDefaultRenderProps()
           
 RenderProps createRenderProps()
          Factory method to create render properties appropriate to this object.
 void dispose()
          Clears the text renderer object
 PropertyList getAllPropertyInfo()
          Returns a list giving static information about all properties exported by this object.
 java.lang.String getFontFamily()
          Returns the font family
 int getFontSize()
          Returns the base font size
 TextComponentBase.FontStyle getFontStyle()
          Gets font style, BOLD, ITALIC, BOLD_ITALIC, or PLAIN
 TextComponentBase.HorizontalAlignment getHorizontalAlignment()
          Gets the horizontal alignment
 double getTextSize()
          Gets the size of the text
 TextComponentBase.VerticalAlignment getVerticalAlignment()
          Gets the vertical alignment
 boolean isSelectable()
          Returns true if this object is in fact selectable.
 int numSelectionQueriesNeeded()
          If this selectable manages its own selection (by issuing selection queries within its render method), then this method should return the maximum number of selection queries that will be required.
 void setFont(java.awt.Font font)
          Explicitly set the font for this text component
 void setFontFamily(java.lang.String family)
          Sets the font family for the displayed text
 void setFontSize(int size)
          Sets the font size.
 void setFontStyle(TextComponentBase.FontStyle style)
          Sets the font style to be one of PLAIN, BOLD, ITALIC, BOLD_ITALIC.
 void setHorizontalAlignment(TextComponentBase.HorizontalAlignment hAlignment)
          Sets the horizontal alignment, one of LEFT, CENTRE, RIGHT
 void setTextColor(java.awt.Color c)
           
 void setTextRenderer(com.jogamp.opengl.util.awt.TextRenderer trenderer)
          Explicitly set the text renderer, for advanced uses only.
 void setTextSize(double size)
          Sets the size of the text
 void setVerticalAlignment(TextComponentBase.VerticalAlignment vAlignment)
          Sets the vertical alignment, one of TOP, CENTRE, BOTTOM
 
Methods inherited from class artisynth.core.modelbase.RenderableComponentBase
copy, getRenderHints, getRenderProps, getSelection, prerender, render, setRenderProps, updateBounds, updateRenderProps
 
Methods inherited from class artisynth.core.modelbase.ModelComponentBase
checkFlag, checkName, checkNameUniqueness, clearFlag, clone, connectToHierarchy, createTempFlag, disconnectFromHierarchy, getChildren, getGrandParent, getHardReferences, getName, getNameRange, getNavpanelVisibility, getNavpanelVisibility, getNumber, getParent, getProperty, getSoftReferences, hasChildren, hasState, isFixed, isMarked, isSelected, isWritable, makeValidName, makeValidName, notifyParentOfChange, postscan, printReferences, recursivelyContained, recursivelyContains, removeTempFlag, scan, setFixed, setFlag, setMarked, setName, setNavpanelVisibility, setNavpanelVisibility, setNumber, setParent, setSelected, updateReferences, write
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface artisynth.core.modelbase.ModelComponent
connectToHierarchy, disconnectFromHierarchy, getHardReferences, getName, getNavpanelVisibility, getNumber, getParent, getSoftReferences, hasState, isFixed, isMarked, isSelected, notifyParentOfChange, postscan, scan, setFixed, setMarked, setName, setNumber, setParent, setSelected, updateReferences
 
Methods inherited from interface maspack.properties.HasProperties
getProperty
 
Methods inherited from interface maspack.properties.HierarchyNode
getChildren, hasChildren
 
Methods inherited from interface maspack.util.Scannable
isWritable, write
 

Field Detail

defaultFontSize

public static int defaultFontSize

defaultTextSize

public static double defaultTextSize

defaultFontName

public static java.lang.String defaultFontName

defaultHAlignment

public static TextComponentBase.HorizontalAlignment defaultHAlignment

defaultVAlignment

public static TextComponentBase.VerticalAlignment defaultVAlignment

myProps

public static PropertyList myProps
Constructor Detail

TextComponentBase

public TextComponentBase()
Method Detail

getAllPropertyInfo

public PropertyList getAllPropertyInfo()
Description copied from interface: HasProperties
Returns a list giving static information about all properties exported by this object.

Specified by:
getAllPropertyInfo in interface HasProperties
Overrides:
getAllPropertyInfo in class ModelComponentBase
Returns:
static information for all exported properties

createDefaultRenderProps

public static RenderProps createDefaultRenderProps()

createRenderProps

public RenderProps createRenderProps()
Description copied from interface: HasRenderProps
Factory method to create render properties appropriate to this object.

Specified by:
createRenderProps in interface HasRenderProps
Overrides:
createRenderProps in class RenderableComponentBase
Returns:
new render properties for this object

setFont

public void setFont(java.awt.Font font)
Explicitly set the font for this text component


setTextRenderer

public void setTextRenderer(com.jogamp.opengl.util.awt.TextRenderer trenderer)
Explicitly set the text renderer, for advanced uses only. This is not saved along with the component.


getFontSize

public int getFontSize()
Returns the base font size


setFontSize

public void setFontSize(int size)
Sets the font size. This is only used to control text resolution. The actual size of the displayed text should be controlled by the "text size".

See Also:
setTextSize(double)

setTextSize

public void setTextSize(double size)
Sets the size of the text


getTextSize

public double getTextSize()
Gets the size of the text


getFontFamily

public java.lang.String getFontFamily()
Returns the font family


setFontFamily

public void setFontFamily(java.lang.String family)
Sets the font family for the displayed text


setFontStyle

public void setFontStyle(TextComponentBase.FontStyle style)
Sets the font style to be one of PLAIN, BOLD, ITALIC, BOLD_ITALIC.


getFontStyle

public TextComponentBase.FontStyle getFontStyle()
Gets font style, BOLD, ITALIC, BOLD_ITALIC, or PLAIN


getHorizontalAlignment

public TextComponentBase.HorizontalAlignment getHorizontalAlignment()
Gets the horizontal alignment


setHorizontalAlignment

public void setHorizontalAlignment(TextComponentBase.HorizontalAlignment hAlignment)
Sets the horizontal alignment, one of LEFT, CENTRE, RIGHT


getVerticalAlignment

public TextComponentBase.VerticalAlignment getVerticalAlignment()
Gets the vertical alignment


setVerticalAlignment

public void setVerticalAlignment(TextComponentBase.VerticalAlignment vAlignment)
Sets the vertical alignment, one of TOP, CENTRE, BOTTOM


dispose

public void dispose()
Clears the text renderer object

Specified by:
dispose in interface Disposable

isSelectable

public boolean isSelectable()
Description copied from class: RenderableComponentBase
Returns true if this object is in fact selectable.

Specified by:
isSelectable in interface GLSelectable
Overrides:
isSelectable in class RenderableComponentBase
Returns:
true if this object is selectable

numSelectionQueriesNeeded

public int numSelectionQueriesNeeded()
Description copied from interface: GLSelectable
If this selectable manages its own selection (by issuing selection queries within its render method), then this method should return the maximum number of selection queries that will be required. Otherwise, this method should return -1.

Specified by:
numSelectionQueriesNeeded in interface GLSelectable
Overrides:
numSelectionQueriesNeeded in class RenderableComponentBase
Returns:
maximum number of selection queries needed by this component, or -1 if this component does not manage its own selection.

setTextColor

public void setTextColor(java.awt.Color c)