Package org.apache.pivot.wtk.skin.terra
Class TerraFormSkin
- java.lang.Object
-
- org.apache.pivot.wtk.skin.ComponentSkin
-
- org.apache.pivot.wtk.skin.ContainerSkin
-
- org.apache.pivot.wtk.skin.terra.TerraFormSkin
-
- All Implemented Interfaces:
ComponentKeyListener
,ComponentListener
,ComponentMouseButtonListener
,ComponentMouseListener
,ComponentMouseWheelListener
,ComponentStateListener
,ComponentTooltipListener
,ConstrainedVisual
,ContainerListener
,ContainerMouseListener
,FormAttributeListener
,FormListener
,Skin
,Visual
public class TerraFormSkin extends ContainerSkin implements FormListener, FormAttributeListener
Terra form skin.TODO Animate preferred size calculations when flags change (make this configurable via a style flag)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.pivot.wtk.skin.ContainerSkin
ContainerSkin.IndexFocusTraversalPolicy
-
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.ContainerListener
ContainerListener.Adapter, ContainerListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ContainerMouseListener
ContainerMouseListener.Adapter, ContainerMouseListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.FormAttributeListener
FormAttributeListener.Adapter, FormAttributeListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.FormListener
FormListener.Adapter, FormListener.Listeners
-
-
Constructor Summary
Constructors Constructor Description TerraFormSkin()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
fieldInserted(Form.Section section, int index)
Called when a form field has been inserted.void
fieldsRemoved(Form.Section section, int index, Sequence<Component> fields)
Called when form fields have been removed.void
flagChanged(Form form, Component field, Form.Flag previousFlag)
Called when a field's flag attribute has changed.int
getBaseline(int width, int height)
Should be implemented in every subclass.java.lang.String
getDelimiter()
boolean
getFill()
int
getFlagIconOffset()
int
getHorizontalSpacing()
java.awt.Font
getLabelFont()
boolean
getLeftAlignLabels()
java.awt.Font
getMessageFont()
Insets
getPadding()
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
getSeparatorColor()
java.awt.Color
getSeparatorHeadingColor()
boolean
getShowFlagHighlight()
boolean
getShowFlagIcons()
boolean
getShowFlagMessagesInline()
int
getVerticalSpacing()
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.void
labelChanged(Form form, Component field, java.lang.String previousLabel)
Called when a field's label attribute has changed.void
layout()
If the component on which the skin is installed is a container, lays out the container's children.void
paint(java.awt.Graphics2D graphics)
Paints the visual.void
requiredChanged(Form form, Component field)
Called when a fields's required attribute has changed.void
sectionHeadingChanged(Form.Section section)
Called when a form section's heading has changed.void
sectionInserted(Form form, int index)
Called when a form section has been inserted.void
sectionsRemoved(Form form, int index, Sequence<Form.Section> removed)
Called when form sections have been removed.void
setDelimiter(java.lang.String delimiter)
void
setFill(boolean fill)
void
setFlagIconOffset(int flagIconOffset)
void
setFlagIconOffset(java.lang.Number flagIconOffset)
void
setHorizontalSpacing(int horizontalSpacing)
void
setHorizontalSpacing(java.lang.Number horizontalSpacing)
void
setLabelFont(java.awt.Font font)
void
setLabelFont(java.lang.String fontString)
void
setLabelFont(Dictionary<java.lang.String,?> fontDict)
void
setLeftAlignLabels(boolean leftAlignLabels)
void
setMessageFont(java.awt.Font font)
void
setMessageFont(java.lang.String fontString)
void
setMessageFont(Dictionary<java.lang.String,?> fontDict)
void
setPadding(int padding)
void
setPadding(java.lang.Number padding)
void
setPadding(java.lang.String padding)
void
setPadding(Dictionary<java.lang.String,?> padding)
void
setPadding(Sequence<?> padding)
void
setPadding(Insets padding)
void
setSeparatorColor(java.awt.Color separatorColor)
void
setSeparatorColor(java.lang.String separatorColor)
void
setSeparatorHeadingColor(java.awt.Color separatorHeadingColor)
void
setSeparatorHeadingColor(java.lang.String separatorHeadingColor)
void
setShowFlagHighlight(boolean showFlagHighlight)
void
setShowFlagIcons(boolean showFlagIcons)
void
setShowFlagMessagesInline(boolean showFlagMessagesInline)
void
setVerticalSpacing(int verticalSpacing)
void
setVerticalSpacing(java.lang.Number verticalSpacing)
-
Methods inherited from class org.apache.pivot.wtk.skin.ContainerSkin
componentInserted, componentMoved, componentsRemoved, focusTraversalPolicyChanged, getBackgroundColor, getBackgroundPaint, isFocusable, isOpaque, mouseDown, mouseMove, mouseUp, mouseWheel, setBackgroundColor, setBackgroundColor, setBackgroundColor, setBackgroundPaint, setBackgroundPaint, setBackgroundPaint
-
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, 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 classContainerSkin
- Parameters:
component
- The component to which the skin is being attached.
-
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
- Overrides:
getPreferredWidth
in classContainerSkin
- 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
- Overrides:
getPreferredHeight
in classContainerSkin
- 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.- Specified by:
paint
in interfaceVisual
- Overrides:
paint
in classContainerSkin
- Parameters:
graphics
- The graphics context in which to paint the visual.
-
getPadding
public Insets getPadding()
-
setPadding
public void setPadding(Insets padding)
-
setPadding
public final void setPadding(Dictionary<java.lang.String,?> padding)
-
setPadding
public final void setPadding(Sequence<?> padding)
-
setPadding
public final void setPadding(int padding)
-
setPadding
public final void setPadding(java.lang.Number padding)
-
setPadding
public final void setPadding(java.lang.String padding)
-
getHorizontalSpacing
public int getHorizontalSpacing()
-
setHorizontalSpacing
public void setHorizontalSpacing(int horizontalSpacing)
-
setHorizontalSpacing
public final void setHorizontalSpacing(java.lang.Number horizontalSpacing)
-
getVerticalSpacing
public int getVerticalSpacing()
-
setVerticalSpacing
public void setVerticalSpacing(int verticalSpacing)
-
setVerticalSpacing
public final void setVerticalSpacing(java.lang.Number verticalSpacing)
-
getFlagIconOffset
public int getFlagIconOffset()
-
setFlagIconOffset
public void setFlagIconOffset(int flagIconOffset)
-
setFlagIconOffset
public final void setFlagIconOffset(java.lang.Number flagIconOffset)
-
getFill
public boolean getFill()
-
setFill
public void setFill(boolean fill)
-
getShowFlagIcons
public boolean getShowFlagIcons()
-
setShowFlagIcons
public void setShowFlagIcons(boolean showFlagIcons)
-
getShowFlagHighlight
public boolean getShowFlagHighlight()
-
setShowFlagHighlight
public void setShowFlagHighlight(boolean showFlagHighlight)
-
getShowFlagMessagesInline
public boolean getShowFlagMessagesInline()
-
setShowFlagMessagesInline
public void setShowFlagMessagesInline(boolean showFlagMessagesInline)
-
getLeftAlignLabels
public boolean getLeftAlignLabels()
-
setLeftAlignLabels
public void setLeftAlignLabels(boolean leftAlignLabels)
-
getDelimiter
public java.lang.String getDelimiter()
-
setDelimiter
public void setDelimiter(java.lang.String delimiter)
-
getSeparatorColor
public java.awt.Color getSeparatorColor()
-
setSeparatorColor
public void setSeparatorColor(java.awt.Color separatorColor)
-
setSeparatorColor
public final void setSeparatorColor(java.lang.String separatorColor)
-
getSeparatorHeadingColor
public java.awt.Color getSeparatorHeadingColor()
-
setSeparatorHeadingColor
public void setSeparatorHeadingColor(java.awt.Color separatorHeadingColor)
-
setSeparatorHeadingColor
public final void setSeparatorHeadingColor(java.lang.String separatorHeadingColor)
-
getLabelFont
public final java.awt.Font getLabelFont()
-
setLabelFont
public final void setLabelFont(java.awt.Font font)
-
setLabelFont
public final void setLabelFont(java.lang.String fontString)
-
setLabelFont
public final void setLabelFont(Dictionary<java.lang.String,?> fontDict)
-
getMessageFont
public final java.awt.Font getMessageFont()
-
setMessageFont
public final void setMessageFont(java.awt.Font font)
-
setMessageFont
public final void setMessageFont(java.lang.String fontString)
-
setMessageFont
public final void setMessageFont(Dictionary<java.lang.String,?> fontDict)
-
sectionInserted
public void sectionInserted(Form form, int index)
Description copied from interface:FormListener
Called when a form section has been inserted.- Specified by:
sectionInserted
in interfaceFormListener
- Parameters:
form
- The form that has changed.index
- The index where the new section has been inserted.
-
sectionsRemoved
public void sectionsRemoved(Form form, int index, Sequence<Form.Section> removed)
Description copied from interface:FormListener
Called when form sections have been removed.- Specified by:
sectionsRemoved
in interfaceFormListener
- Parameters:
form
- The form that has changed.index
- The starting index where sections were removed.removed
- The complete sequence of the removed sections.
-
sectionHeadingChanged
public void sectionHeadingChanged(Form.Section section)
Description copied from interface:FormListener
Called when a form section's heading has changed.- Specified by:
sectionHeadingChanged
in interfaceFormListener
- Parameters:
section
- The form section whose heading changed.
-
fieldInserted
public void fieldInserted(Form.Section section, int index)
Description copied from interface:FormListener
Called when a form field has been inserted.- Specified by:
fieldInserted
in interfaceFormListener
- Parameters:
section
- The enclosing form section that has changed.index
- The index where a new field has been inserted.
-
fieldsRemoved
public void fieldsRemoved(Form.Section section, int index, Sequence<Component> fields)
Description copied from interface:FormListener
Called when form fields have been removed.- Specified by:
fieldsRemoved
in interfaceFormListener
- Parameters:
section
- The enclosing form section.index
- The starting index where fields were removed.fields
- The complete sequence of fields that were removed.
-
labelChanged
public void labelChanged(Form form, Component field, java.lang.String previousLabel)
Description copied from interface:FormAttributeListener
Called when a field's label attribute has changed.- Specified by:
labelChanged
in interfaceFormAttributeListener
- Parameters:
form
- The enclosing form.field
- The field whose form label has changed.previousLabel
- The previous form label for this field.
-
requiredChanged
public void requiredChanged(Form form, Component field)
Description copied from interface:FormAttributeListener
Called when a fields's required attribute has changed.- Specified by:
requiredChanged
in interfaceFormAttributeListener
- Parameters:
form
- The enclosing form.field
- The field that is or is not now required.
-
flagChanged
public void flagChanged(Form form, Component field, Form.Flag previousFlag)
Description copied from interface:FormAttributeListener
Called when a field's flag attribute has changed.- Specified by:
flagChanged
in interfaceFormAttributeListener
- Parameters:
form
- The enclosing form.field
- The field whose flag attribute has changed.previousFlag
- The previous flag value for this field.
-
-