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 intgetBaseline(int width, int height)Should be implemented in every subclass.java.awt.ColorgetColor()java.awt.FontgetFont()java.awt.ColorgetGridColor()floatgetGridFrequency()intgetPreferredHeight(int width)Returns the visual's preferred height given the provided width constraint.DimensionsgetPreferredSize()Returns the visual's unconstrained preferred size.intgetPreferredWidth(int height)Returns the visual's preferred width given the provided height constraint.java.awt.ColorgetTextColor()java.awt.ColorgetTextFillColor()voidinstall(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.booleanisFocusable()By default, skins are focusable.voidlayout()If the component on which the skin is installed is a container, lays out the container's children.voidorientationChanged(Meter meter)Listener for meter orientation changes.voidpaint(java.awt.Graphics2D graphics)Paints the visual.voidpercentageChanged(Meter meter, double previousPercentage)Listener for meter percentage changes.voidsetColor(int color)voidsetColor(java.awt.Color color)voidsetColor(java.lang.String color)voidsetFont(java.awt.Font font)voidsetFont(java.lang.String font)voidsetFont(Dictionary<java.lang.String,?> font)voidsetGridColor(int gridColor)voidsetGridColor(java.awt.Color gridColor)voidsetGridColor(java.lang.String gridColor)voidsetGridFrequency(float gridFrequency)voidsetGridFrequency(java.lang.Number gridFrequency)voidsetTextColor(int color)voidsetTextColor(java.awt.Color color)voidsetTextColor(java.lang.String color)voidsetTextFillColor(int color)voidsetTextFillColor(java.awt.Color color)voidsetTextFillColor(java.lang.String color)voidtextChanged(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:ComponentSkinMust 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:
installin interfaceSkin- Overrides:
installin classComponentSkin- Parameters:
component- The component to which the skin is being attached.
-
isFocusable
public boolean isFocusable()
Description copied from class:ComponentSkinBy default, skins are focusable.- Specified by:
isFocusablein interfaceSkin- Overrides:
isFocusablein classComponentSkin- Returns:
trueif this skin is focusable;false, otherwise.
-
getPreferredWidth
public int getPreferredWidth(int height)
Description copied from interface:ConstrainedVisualReturns the visual's preferred width given the provided height constraint.- Specified by:
getPreferredWidthin interfaceConstrainedVisual- Parameters:
height- The height by which to constrain the preferred width, or-1for no constraint.- Returns:
- The preferred width given the height constraint.
-
getPreferredHeight
public int getPreferredHeight(int width)
Description copied from interface:ConstrainedVisualReturns the visual's preferred height given the provided width constraint.- Specified by:
getPreferredHeightin interfaceConstrainedVisual- Parameters:
width- The width by which to constrain the preferred height, or-1for no constraint.- Returns:
- The preferred height given the width constraint.
-
getPreferredSize
public Dimensions getPreferredSize()
Description copied from interface:ConstrainedVisualReturns the visual's unconstrained preferred size.- Specified by:
getPreferredSizein interfaceConstrainedVisual- Overrides:
getPreferredSizein 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:ComponentSkinShould be implemented in every subclass.The default implementation here simply returns -1 (no baseline).
- Specified by:
getBaselinein interfaceConstrainedVisual- Overrides:
getBaselinein 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
-1if this visual does not have a baseline.
-
layout
public void layout()
Description copied from interface:SkinIf 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:VisualPaints 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:
percentageChangedin 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:
textChangedin 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:
orientationChangedin interfaceMeterListener- Parameters:
meter- The source of the event.
-
-