Package org.apache.pivot.wtk.skin
Class ContainerSkin
- java.lang.Object
-
- org.apache.pivot.wtk.skin.ComponentSkin
-
- org.apache.pivot.wtk.skin.ContainerSkin
-
- All Implemented Interfaces:
ComponentKeyListener,ComponentListener,ComponentMouseButtonListener,ComponentMouseListener,ComponentMouseWheelListener,ComponentStateListener,ComponentTooltipListener,ConstrainedVisual,ContainerListener,ContainerMouseListener,Skin,Visual
- Direct Known Subclasses:
BorderSkin,BoxPaneSkin,CalendarSkin,CardPaneSkin,ColorChooserSkin,DisplaySkin,ExpanderSkin,FileBrowserSkin,FillPaneSkin,FlowPaneSkin,GridPaneSkin,PanelSkin,RollupSkin,ScrollPaneSkin,SliderSkin,StackPaneSkin,TablePaneSkin,TabPaneSkin,TerraAccordionSkin,TerraFormSkin,TerraMenuBarSkin,TerraMenuSkin,TerraPanoramaSkin,TerraScrollBarSkin,TerraSpinnerSkin,TerraSplitPaneSkin,TextPaneSkin,VFSBrowserSkin,WindowSkin
public abstract class ContainerSkin extends ComponentSkin implements ContainerListener, ContainerMouseListener
Abstract base class for container skins.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classContainerSkin.IndexFocusTraversalPolicyFocus traversal policy that determines traversal order based on the order of components in the container's component sequence.-
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
-
-
Constructor Summary
Constructors Constructor Description ContainerSkin()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcomponentInserted(Container container, int index)Called when a component has been inserted into a container's component sequence.voidcomponentMoved(Container container, int from, int to)Called when a component has moved from one z-index to another within a container.voidcomponentsRemoved(Container container, int index, Sequence<Component> removed)Called when components have been removed from a container's component sequence.voidfocusTraversalPolicyChanged(Container container, FocusTraversalPolicy previousFocusTraversalPolicy)Called when a container's focus traversal policy has changed.java.awt.ColorgetBackgroundColor()java.awt.PaintgetBackgroundPaint()intgetPreferredHeight(int width)Returns the visual's preferred height given the provided width constraint.intgetPreferredWidth(int height)Returns the visual's preferred width given the provided height constraint.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.booleanisOpaque()By default, skins are assumed to be opaque.booleanmouseDown(Container container, Mouse.Button button, int x, int y)Called when the mouse is pressed over a container.booleanmouseMove(Container container, int x, int y)Called when the mouse is moved over a container.booleanmouseUp(Container container, Mouse.Button button, int x, int y)Called when the mouse is released over a container.booleanmouseWheel(Container container, Mouse.ScrollType scrollType, int scrollAmount, int wheelRotation, int x, int y)Called when the mouse wheel is scrolled over a container.voidpaint(java.awt.Graphics2D graphics)Paints the visual.voidsetBackgroundColor(int backgroundColorIndex)Sets the background of the container to one of the theme colors.voidsetBackgroundColor(java.awt.Color backgroundColor)Sets the background of the container to a solid color.voidsetBackgroundColor(java.lang.String backgroundColorString)Sets the background of the container to a solid color.voidsetBackgroundPaint(java.awt.Paint newBackgroundPaint)Sets the object used to paint the background of the container.voidsetBackgroundPaint(java.lang.String backgroundPaintString)Sets the object used to paint the background of the container.voidsetBackgroundPaint(Dictionary<java.lang.String,?> backgroundPaintDictionary)Sets the object used to paint the background of the container.-
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, getBaseline, getColor, getComponent, getFocusRectangleStroke, getHeight, getPreferredSize, 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: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.
-
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.
-
paint
public void paint(java.awt.Graphics2D graphics)
Description copied from interface:VisualPaints the visual.
-
isFocusable
public boolean isFocusable()
Description copied from class:ComponentSkinBy default, skins are focusable.- Specified by:
isFocusablein interfaceSkin- Overrides:
isFocusablein classComponentSkin- Returns:
false; by default, containers are not focusable.
-
isOpaque
public boolean isOpaque()
Description copied from class:ComponentSkinBy default, skins are assumed to be opaque.- Specified by:
isOpaquein interfaceSkin- Overrides:
isOpaquein classComponentSkin- Returns:
trueif this skin is opaque;falseif any part of it is transparent or translucent.
-
getBackgroundPaint
public java.awt.Paint getBackgroundPaint()
- Returns:
- The
Paintobject used to paint the background of the container.
-
setBackgroundPaint
public void setBackgroundPaint(java.awt.Paint newBackgroundPaint)
Sets the object used to paint the background of the container.- Parameters:
newBackgroundPaint- The newPaintobject to paint the background.
-
setBackgroundPaint
public final void setBackgroundPaint(java.lang.String backgroundPaintString)
Sets the object used to paint the background of the container.- Parameters:
backgroundPaintString- A string recognized by Pivot as a Color or Paint value.
-
setBackgroundPaint
public final void setBackgroundPaint(Dictionary<java.lang.String,?> backgroundPaintDictionary)
Sets the object used to paint the background of the container.- Parameters:
backgroundPaintDictionary- A dictionary containing a Paint description.
-
getBackgroundColor
public java.awt.Color getBackgroundColor()
- Returns:
- The color of the container's background if a solid color has been
set as the background; otherwise
null.
-
setBackgroundColor
public void setBackgroundColor(java.awt.Color backgroundColor)
Sets the background of the container to a solid color.- Parameters:
backgroundColor- The new background color for the container.
-
setBackgroundColor
public final void setBackgroundColor(java.lang.String backgroundColorString)
Sets the background of the container to a solid color.- Parameters:
backgroundColorString- Any of the color values recognized by Pivot.
-
setBackgroundColor
public final void setBackgroundColor(int backgroundColorIndex)
Sets the background of the container to one of the theme colors.- Parameters:
backgroundColorIndex- An index into the theme's color palette.
-
componentInserted
public void componentInserted(Container container, int index)
Description copied from interface:ContainerListenerCalled when a component has been inserted into a container's component sequence.- Specified by:
componentInsertedin interfaceContainerListener- Parameters:
container- The container that has changed.index- The index where the new component has been inserted.
-
componentsRemoved
public void componentsRemoved(Container container, int index, Sequence<Component> removed)
Description copied from interface:ContainerListenerCalled when components have been removed from a container's component sequence.- Specified by:
componentsRemovedin interfaceContainerListener- Parameters:
container- The container that has changed.index- The starting index of the components that were removed.removed- The complete sequence of removed components.
-
componentMoved
public void componentMoved(Container container, int from, int to)
Description copied from interface:ContainerListenerCalled when a component has moved from one z-index to another within a container.- Specified by:
componentMovedin interfaceContainerListener- Parameters:
container- The container that has changed.from- The starting index of the component (in Z-order).to- The place in the Z-order where this component ended up.
-
focusTraversalPolicyChanged
public void focusTraversalPolicyChanged(Container container, FocusTraversalPolicy previousFocusTraversalPolicy)
Description copied from interface:ContainerListenerCalled when a container's focus traversal policy has changed.- Specified by:
focusTraversalPolicyChangedin interfaceContainerListener- Parameters:
container- The container that has changed.previousFocusTraversalPolicy- The previous value of the focus traversal policy for this container.
-
mouseMove
public boolean mouseMove(Container container, int x, int y)
Description copied from interface:ContainerMouseListenerCalled when the mouse is moved over a container.- Specified by:
mouseMovein interfaceContainerMouseListener- Parameters:
container- The container under the mouse.x- The X-position of the mouse.y- The Y-position of the mouse.- Returns:
trueto consume the event;falseto allow it to propagate.
-
mouseDown
public boolean mouseDown(Container container, Mouse.Button button, int x, int y)
Description copied from interface:ContainerMouseListenerCalled when the mouse is pressed over a container.- Specified by:
mouseDownin interfaceContainerMouseListener- Parameters:
container- The container under the mouse.button- Which button was pressed.x- The X-position of the mouse.y- The Y-position of the mouse.- Returns:
trueto consume the event;falseto allow it to propagate.
-
mouseUp
public boolean mouseUp(Container container, Mouse.Button button, int x, int y)
Description copied from interface:ContainerMouseListenerCalled when the mouse is released over a container.- Specified by:
mouseUpin interfaceContainerMouseListener- Parameters:
container- The container under the mouse.button- Which mouse button was released.x- The X-position at the time of release.y- The Y-position at the time of release.- Returns:
trueto consume the event;falseto allow it to propagate.
-
mouseWheel
public boolean mouseWheel(Container container, Mouse.ScrollType scrollType, int scrollAmount, int wheelRotation, int x, int y)
Description copied from interface:ContainerMouseListenerCalled when the mouse wheel is scrolled over a container.- Specified by:
mouseWheelin interfaceContainerMouseListener- Parameters:
container- The container under the mouse.scrollType- Which type of scroll happened.scrollAmount- How much scrolling was requested.wheelRotation- The amount and direction of wheel rotation.x- The X-position of the mouse at the time.y- The Y-position of the mouse.- Returns:
trueto consume the event;falseto allow it to propagate.
-
-