Package org.apache.pivot.wtk.skin.terra
Class TerraMeterSkin
- java.lang.Object
-
- org.apache.pivot.wtk.skin.ComponentSkin
-
- org.apache.pivot.wtk.skin.terra.TerraMeterSkin
-
- All Implemented Interfaces:
ComponentKeyListener
,ComponentListener
,ComponentMouseButtonListener
,ComponentMouseListener
,ComponentMouseWheelListener
,ComponentStateListener
,ComponentTooltipListener
,ConstrainedVisual
,MeterListener
,Skin
,Visual
public class TerraMeterSkin extends ComponentSkin implements MeterListener
Meter skin.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ComponentKeyListener
ComponentKeyListener.Adapter, ComponentKeyListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ComponentListener
ComponentListener.Adapter, ComponentListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ComponentMouseButtonListener
ComponentMouseButtonListener.Adapter, ComponentMouseButtonListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ComponentMouseListener
ComponentMouseListener.Adapter, ComponentMouseListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ComponentMouseWheelListener
ComponentMouseWheelListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ComponentStateListener
ComponentStateListener.Adapter, ComponentStateListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ComponentTooltipListener
ComponentTooltipListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.MeterListener
MeterListener.Adapter, MeterListener.Listeners
-
-
Constructor Summary
Constructors Constructor Description TerraMeterSkin()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getBaseline(int width, int height)
Should be implemented in every subclass.java.awt.Color
getColor()
java.awt.Font
getFont()
java.awt.Color
getGridColor()
float
getGridFrequency()
int
getPreferredHeight(int width)
Returns the visual's preferred height given the provided width constraint.Dimensions
getPreferredSize()
Returns the visual's unconstrained preferred size.int
getPreferredWidth(int height)
Returns the visual's preferred width given the provided height constraint.java.awt.Color
getTextColor()
java.awt.Color
getTextFillColor()
void
install(Component component)
Must be implemented in every subclass in order to do component-specific operations at instantiation time, but every subclass must call this superclass method to setup the necessary listeners, etc.boolean
isFocusable()
By default, skins are focusable.void
layout()
If the component on which the skin is installed is a container, lays out the container's children.void
orientationChanged(Meter meter)
Listener for meter orientation changes.void
paint(java.awt.Graphics2D graphics)
Paints the visual.void
percentageChanged(Meter meter, double previousPercentage)
Listener for meter percentage changes.void
setColor(int color)
void
setColor(java.awt.Color color)
void
setColor(java.lang.String color)
void
setFont(java.awt.Font font)
void
setFont(java.lang.String font)
void
setFont(Dictionary<java.lang.String,?> font)
void
setGridColor(int gridColor)
void
setGridColor(java.awt.Color gridColor)
void
setGridColor(java.lang.String gridColor)
void
setGridFrequency(float gridFrequency)
void
setGridFrequency(java.lang.Number gridFrequency)
void
setTextColor(int color)
void
setTextColor(java.awt.Color color)
void
setTextColor(java.lang.String color)
void
setTextFillColor(int color)
void
setTextFillColor(java.awt.Color color)
void
setTextFillColor(java.lang.String color)
void
textChanged(Meter meter, java.lang.String previousText)
Listener for meter text changes.-
Methods inherited from class org.apache.pivot.wtk.skin.ComponentSkin
colorFromObject, colorFromObject, colorFromObject, colorFromObject, currentTheme, cursorChanged, decodeFont, defaultBackgroundColor, defaultForegroundColor, dragSourceChanged, dropTargetChanged, enabledChanged, focusedChanged, fontFromObject, getBaseline, getColor, getComponent, getFocusRectangleStroke, getHeight, getSize, getTextInputMethodListener, getThemeFont, getWidth, heightLimitsChanged, invalidateComponent, isOpaque, keyPressed, keyReleased, keyTyped, locationChanged, menuHandlerChanged, mouseClick, mouseDown, mouseMove, mouseOut, mouseOver, mouseUp, mouseWheel, nameChanged, parentChanged, preferredSizeChanged, repaintComponent, repaintComponent, repaintComponent, repaintComponent, repaintComponent, setDefaultStyles, setSize, sizeChanged, themeHasThickFocusRectangle, themeHasTransitionEnabled, themeIsDark, themeIsFlat, tooltipDelayChanged, tooltipTextChanged, tooltipTriggered, visibleChanged, widthLimitsChanged
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.pivot.wtk.ConstrainedVisual
setSize
-
-
-
-
Method Detail
-
install
public void install(Component component)
Description copied from class:ComponentSkin
Must be implemented in every subclass in order to do component-specific operations at instantiation time, but every subclass must call this superclass method to setup the necessary listeners, etc.- Specified by:
install
in interfaceSkin
- Overrides:
install
in classComponentSkin
- Parameters:
component
- The component to which the skin is being attached.
-
isFocusable
public boolean isFocusable()
Description copied from class:ComponentSkin
By default, skins are focusable.- Specified by:
isFocusable
in interfaceSkin
- Overrides:
isFocusable
in classComponentSkin
- Returns:
true
if this skin is focusable;false
, otherwise.
-
getPreferredWidth
public int getPreferredWidth(int height)
Description copied from interface:ConstrainedVisual
Returns the visual's preferred width given the provided height constraint.- Specified by:
getPreferredWidth
in interfaceConstrainedVisual
- Parameters:
height
- The height by which to constrain the preferred width, or-1
for no constraint.- Returns:
- The preferred width given the height constraint.
-
getPreferredHeight
public int getPreferredHeight(int width)
Description copied from interface:ConstrainedVisual
Returns the visual's preferred height given the provided width constraint.- Specified by:
getPreferredHeight
in interfaceConstrainedVisual
- Parameters:
width
- The width by which to constrain the preferred height, or-1
for no constraint.- Returns:
- The preferred height given the width constraint.
-
getPreferredSize
public Dimensions getPreferredSize()
Description copied from interface:ConstrainedVisual
Returns the visual's unconstrained preferred size.- Specified by:
getPreferredSize
in interfaceConstrainedVisual
- Overrides:
getPreferredSize
in classComponentSkin
- Returns:
- The preferred size (width and height) of this component.
Depending on the component this can be a static value or derived (as for a container) from its subcomponents, etc.
The default implementation simply calls
ConstrainedVisual.getPreferredWidth(int)
andConstrainedVisual.getPreferredHeight(int)
.
-
getBaseline
public int getBaseline(int width, int height)
Description copied from class:ComponentSkin
Should be implemented in every subclass.The default implementation here simply returns -1 (no baseline).
- Specified by:
getBaseline
in interfaceConstrainedVisual
- Overrides:
getBaseline
in classComponentSkin
- Parameters:
width
- Constrained width to compute the baseline for.height
- Constrained height to compute the baseline for.- Returns:
- The baseline relative to the origin of this visual, or
-1
if this visual does not have a baseline.
-
layout
public void layout()
Description copied from interface:Skin
If the component on which the skin is installed is a container, lays out the container's children.
-
paint
public void paint(java.awt.Graphics2D graphics)
Description copied from interface:Visual
Paints the visual.
-
getColor
public java.awt.Color getColor()
-
setColor
public void setColor(java.awt.Color color)
-
setColor
public final void setColor(java.lang.String color)
-
setColor
public final void setColor(int color)
-
getGridColor
public java.awt.Color getGridColor()
-
setGridColor
public void setGridColor(java.awt.Color gridColor)
-
setGridColor
public final void setGridColor(java.lang.String gridColor)
-
setGridColor
public final void setGridColor(int gridColor)
-
getTextColor
public java.awt.Color getTextColor()
-
setTextColor
public void setTextColor(java.awt.Color color)
-
setTextColor
public final void setTextColor(java.lang.String color)
-
setTextColor
public final void setTextColor(int color)
-
getTextFillColor
public java.awt.Color getTextFillColor()
-
setTextFillColor
public void setTextFillColor(java.awt.Color color)
-
setTextFillColor
public final void setTextFillColor(java.lang.String color)
-
setTextFillColor
public final void setTextFillColor(int color)
-
getGridFrequency
public float getGridFrequency()
-
setGridFrequency
public void setGridFrequency(float gridFrequency)
-
setGridFrequency
public final void setGridFrequency(java.lang.Number gridFrequency)
-
getFont
public java.awt.Font getFont()
-
setFont
public void setFont(java.awt.Font font)
-
setFont
public final void setFont(java.lang.String font)
-
setFont
public final void setFont(Dictionary<java.lang.String,?> font)
-
percentageChanged
public void percentageChanged(Meter meter, double previousPercentage)
Listener for meter percentage changes.- Specified by:
percentageChanged
in interfaceMeterListener
- Parameters:
meter
- The source of the event.previousPercentage
- The previous percentage value.
-
textChanged
public void textChanged(Meter meter, java.lang.String previousText)
Listener for meter text changes.- Specified by:
textChanged
in interfaceMeterListener
- Parameters:
meter
- The source of the event.previousText
- The previous text value.
-
orientationChanged
public void orientationChanged(Meter meter)
Listener for meter orientation changes.- Specified by:
orientationChanged
in interfaceMeterListener
- Parameters:
meter
- The source of the event.
-
-