org.apache.pivot.wtk.skin.terra
Class TerraFormSkin

java.lang.Object
  extended by org.apache.pivot.wtk.skin.ComponentSkin
      extended by org.apache.pivot.wtk.skin.ContainerSkin
          extended by 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.FormListener
FormListener.Adapter
 
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.FormAttributeListener
FormAttributeListener.Adapter
 
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ContainerListener
ContainerListener.Adapter
 
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ContainerMouseListener
ContainerMouseListener.Adapter
 
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ComponentListener
ComponentListener.Adapter
 
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ComponentStateListener
ComponentStateListener.Adapter
 
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ComponentMouseListener
ComponentMouseListener.Adapter
 
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ComponentMouseButtonListener
ComponentMouseButtonListener.Adapter
 
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ComponentKeyListener
ComponentKeyListener.Adapter
 
Constructor Summary
TerraFormSkin()
           
 
Method Summary
 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 forms fields items 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)
          Returns the baseline for a given width and height.
 String getDelimiter()
           
 boolean getFill()
           
 int getFlagIconOffset()
           
 int getHorizontalSpacing()
           
 boolean getLeftAlignLabels()
           
 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.
 Color getSeparatorColor()
           
 Color getSeparatorHeadingColor()
           
 boolean getShowFlagHighlight()
           
 boolean getShowFlagIcons()
           
 boolean getShowFlagMessagesInline()
           
 int getVerticalSpacing()
           
 void install(Component component)
          Associates a skin with a component.
 void labelChanged(Form form, Component field, String previousLabel)
          Called when a fields'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(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(String delimiter)
           
 void setFill(boolean fill)
           
 void setFlagIconOffset(int flagIconOffset)
           
 void setFlagIconOffset(Number flagIconOffset)
           
 void setHorizontalSpacing(int horizontalSpacing)
           
 void setHorizontalSpacing(Number horizontalSpacing)
           
 void setLeftAlignLabels(boolean leftAlignLabels)
           
 void setPadding(Dictionary<String,?> padding)
           
 void setPadding(Insets padding)
           
 void setPadding(int padding)
           
 void setPadding(Number padding)
           
 void setPadding(String padding)
           
 void setSeparatorColor(Color separatorColor)
           
 void setSeparatorColor(String separatorColor)
           
 void setSeparatorHeadingColor(Color separatorHeadingColor)
           
 void setSeparatorHeadingColor(String separatorHeadingColor)
           
 void setShowFlagHighlight(boolean showFlagHighlight)
           
 void setShowFlagIcons(boolean showFlagIcons)
           
 void setShowFlagMessagesInline(boolean showFlagMessagesInline)
           
 void setVerticalSpacing(int verticalSpacing)
           
 void setVerticalSpacing(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, setBackgroundPaint, setBackgroundPaint, setBackgroundPaint
 
Methods inherited from class org.apache.pivot.wtk.skin.ComponentSkin
cursorChanged, decodeFont, dragSourceChanged, dropTargetChanged, enabledChanged, focusedChanged, getBaseline, getComponent, getHeight, getWidth, heightLimitsChanged, invalidateComponent, keyPressed, keyReleased, keyTyped, locationChanged, menuHandlerChanged, mouseClick, mouseDown, mouseMove, mouseOut, mouseOver, mouseUp, mouseWheel, nameChanged, parentChanged, preferredSizeChanged, repaintComponent, repaintComponent, repaintComponent, repaintComponent, repaintComponent, setSize, sizeChanged, tooltipDelayChanged, tooltipTextChanged, tooltipTriggered, visibleChanged, widthLimitsChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TerraFormSkin

public TerraFormSkin()
Method Detail

install

public void install(Component component)
Description copied from interface: Skin
Associates a skin with a component.

Specified by:
install in interface Skin
Overrides:
install in class ContainerSkin
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 interface ConstrainedVisual
Overrides:
getPreferredWidth in class ContainerSkin
Parameters:
height - The height by which to constrain the preferred width, or -1 for no 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 interface ConstrainedVisual
Overrides:
getPreferredHeight in class ContainerSkin
Parameters:
width - The width by which to constrain the preferred height, or -1 for no constraint.

getPreferredSize

public Dimensions getPreferredSize()
Description copied from interface: ConstrainedVisual
Returns the visual's unconstrained preferred size.

Specified by:
getPreferredSize in interface ConstrainedVisual
Overrides:
getPreferredSize in class ComponentSkin

getBaseline

public int getBaseline(int width,
                       int height)
Description copied from interface: ConstrainedVisual
Returns the baseline for a given width and height.

Specified by:
getBaseline in interface ConstrainedVisual
Overrides:
getBaseline in class ComponentSkin
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.

Specified by:
layout in interface Skin

paint

public void paint(Graphics2D graphics)
Description copied from interface: Visual
Paints the visual.

Specified by:
paint in interface Visual
Overrides:
paint in class ContainerSkin
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<String,?> padding)

setPadding

public final void setPadding(int padding)

setPadding

public final void setPadding(Number padding)

setPadding

public final void setPadding(String padding)

getHorizontalSpacing

public int getHorizontalSpacing()

setHorizontalSpacing

public void setHorizontalSpacing(int horizontalSpacing)

setHorizontalSpacing

public final void setHorizontalSpacing(Number horizontalSpacing)

getVerticalSpacing

public int getVerticalSpacing()

setVerticalSpacing

public void setVerticalSpacing(int verticalSpacing)

setVerticalSpacing

public final void setVerticalSpacing(Number verticalSpacing)

getFlagIconOffset

public int getFlagIconOffset()

setFlagIconOffset

public void setFlagIconOffset(int flagIconOffset)

setFlagIconOffset

public final void setFlagIconOffset(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 String getDelimiter()

setDelimiter

public void setDelimiter(String delimiter)

getSeparatorColor

public Color getSeparatorColor()

setSeparatorColor

public void setSeparatorColor(Color separatorColor)

setSeparatorColor

public final void setSeparatorColor(String separatorColor)

getSeparatorHeadingColor

public Color getSeparatorHeadingColor()

setSeparatorHeadingColor

public void setSeparatorHeadingColor(Color separatorHeadingColor)

setSeparatorHeadingColor

public final void setSeparatorHeadingColor(String separatorHeadingColor)

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 interface FormListener

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 interface FormListener

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 interface FormListener

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 interface FormListener

fieldsRemoved

public void fieldsRemoved(Form.Section section,
                          int index,
                          Sequence<Component> fields)
Description copied from interface: FormListener
Called when forms fields items have been removed.

Specified by:
fieldsRemoved in interface FormListener

labelChanged

public void labelChanged(Form form,
                         Component field,
                         String previousLabel)
Description copied from interface: FormAttributeListener
Called when a fields's label attribute has changed.

Specified by:
labelChanged in interface FormAttributeListener

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 interface FormAttributeListener

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 interface FormAttributeListener