org.xith3d.ui.hud.base
Class WindowHeaderWidget

java.lang.Object
  extended by org.xith3d.ui.hud.base.WidgetBase
      extended by org.xith3d.ui.hud.base.RectangularWidget
          extended by org.xith3d.ui.hud.base.WindowHeaderWidget
All Implemented Interfaces:
org.jagatoo.datatypes.NamableObject, org.jagatoo.datatypes.NamedObject, org.openmali.types.twodee.Positioned2f, org.openmali.types.twodee.Positioned2fRO, org.openmali.types.twodee.Sized2f, org.openmali.types.twodee.Sized2fRO, BackgroundSettable, TextWidget, Widget

public class WindowHeaderWidget
extends RectangularWidget
implements BackgroundSettable, TextWidget

Represents a Window's header bar's Widget.


Nested Class Summary
static class WindowHeaderWidget.Description
           
 
Nested classes/interfaces inherited from interface org.xith3d.ui.hud.base.Widget
Widget.DescriptionBase
 
Field Summary
 
Fields inherited from class org.xith3d.ui.hud.base.WidgetBase
containerListeners, transformGroup, translation, Z_INDEX_UNIT, Z_INDEX_UNIT_ASSEMBLER
 
Constructor Summary
WindowHeaderWidget(float width, float height, java.lang.String title)
          Creates a new WindowHeaderWidget.
WindowHeaderWidget(float width, float height, WindowHeaderWidget.Description desc, java.lang.String title)
          Creates a new WindowHeaderWidget.
WindowHeaderWidget(org.openmali.types.twodee.Sized2fRO size, java.lang.String title)
          Creates a new WindowHeaderWidget.
WindowHeaderWidget(org.openmali.types.twodee.Sized2fRO size, WindowHeaderWidget.Description desc, java.lang.String title)
          Creates a new WindowHeaderWidget.
 
Method Summary
protected  Button createCloseButton(WindowHeaderWidget.Description desc)
          This method creates the close button for the Window.
protected  Button createTitleLabel(Button.Description buttonDesc)
          This method creates the close button for the Window.
 TextAlignment getAlignment()
          
 Texture getBackground()
          
 org.openmali.vecmath2.Colorf getBackgroundColor()
          
 float getBackgroundTileHeight()
          
 org.openmali.types.twodee.Sized2fRO getBackgroundTileSize()
          
 float getBackgroundTileWidth()
          
 Button getCloseButton()
           
 java.awt.Font getFont()
          
 org.openmali.vecmath2.Colorf getFontColor()
          
 java.lang.String getText()
          
 float getTransparency()
          
protected  void init()
          This method is called when the WidgetContainer is set.
 boolean isMouseOverBar(float relX, float relY)
          Checks, if the mouse is over the bar (not over any Button, etc.).
 HUDPickResult pick(int canvasX, int canvasY, HUDPickResult.HUDPickReason pickReason, org.jagatoo.input.devices.components.MouseButton button, long when, long meta, int flags)
          Tests whether a Widget is under the cursor and runs the approriate methods if true.
 void setAlignment(TextAlignment alignment)
          Sets the horizontal and vertical alignment of the text
 void setBackground(org.openmali.vecmath2.Colorf color)
          Sets the background color of the Widget.
 void setBackground(java.lang.String texture)
          Sets the background Texture of the Widget.
 void setBackground(Texture texture)
          Sets the background texture of the Widget.
 void setBackgroundTileSize(float tileWidth, float tileHeight)
          Sets the background tile size.
 void setBackgroundTileSize(org.openmali.types.twodee.Sized2fRO tileSize)
          Sets the background tile size.
 void setFont(java.awt.Font font)
          Sets the new Font to be used
 void setFontColor(org.openmali.vecmath2.Colorf color)
          Sets the new color to be used
protected  boolean setSize(float width, float height, boolean forced)
          
 void setText(java.lang.String title)
          Sets the new text to be displayed
 
Methods inherited from class org.xith3d.ui.hud.base.RectangularWidget
getPickHeight, getPickSGZPosition, getPickWidth
 
Methods inherited from class org.xith3d.ui.hud.base.WidgetBase
addContainerListener, addFocusListener, addInputListener, addLocationListener, addSizeListener, addVisibilityListener, detach, detach, getAspect, getAssembly, getCachedToolTipWidget, getContainer, getContextMenu, getCursor, getHeight, getHUD, getInheritedCursor, getLeft, getLocation, getName, getSGNode, getSGZPosition, getSize, getToolTip, getTop, getUserObject, getWidgetAssembler, getWidth, getZIndex, hasFocus, hasFocus, hasToolTip, isClickable, isDraggable, isFocussable, isInitialized, isInitializing, isPickable, isVisible, onAddedToContainer, onAddedToHUD, onControllerAxisChanged, onControllerButtonPressed, onControllerButtonReleased, onDetached, onFocusGained, onFocusLost, onInputStateChanged, onKeyPressed, onKeyReleased, onKeyTyped, onMouseButtonPressed, onMouseButtonReleased, onMouseEntered, onMouseLeft, onMouseMoved, onMouseStopped, onMouseUnbound, onMouseWheelMoved, onRemovedFromContainer, pickWidgetAssembler, removeContainerListener, removeFocusListener, removeInputListener, removeLocationListener, removeSizeListener, removeVisibilityListener, requestFocus, setAssembly, setCachedToolTipWidget, setClickable, setContainer, setContextMenu, setCursor, setDraggable, setFocussable, setHeight, setLocation, setLocation, setLocation, setName, setPickable, setSize, setSize, setSize, setToolTip, setTransparency, setUserObject, setVisible, setWidth, setZIndex, toString, update, updateTranslation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.xith3d.ui.hud.base.Widget
addContainerListener, addFocusListener, addInputListener, addLocationListener, addSizeListener, addVisibilityListener, detach, detach, getAspect, getAssembly, getCachedToolTipWidget, getContainer, getContextMenu, getCursor, getHeight, getHUD, getInheritedCursor, getLeft, getLocation, getName, getSGNode, getSGZPosition, getSize, getToolTip, getTop, getUserObject, getWidth, getZIndex, hasFocus, hasFocus, hasToolTip, isClickable, isDraggable, isFocussable, isPickable, isVisible, onControllerAxisChanged, onControllerButtonPressed, onControllerButtonReleased, onDetached, onFocusGained, onFocusLost, onInputStateChanged, onKeyPressed, onKeyReleased, onKeyTyped, onMouseButtonPressed, onMouseButtonReleased, onMouseEntered, onMouseLeft, onMouseMoved, onMouseStopped, onMouseUnbound, onMouseWheelMoved, removeContainerListener, removeFocusListener, removeInputListener, removeLocationListener, removeSizeListener, removeVisibilityListener, requestFocus, setAssembly, setCachedToolTipWidget, setClickable, setContainer, setContextMenu, setCursor, setDraggable, setFocussable, setLocation, setLocation, setName, setPickable, setSize, setSize, setSize, setToolTip, setTransparency, setUserObject, setVisible, setZIndex, update
 
Methods inherited from interface org.openmali.types.twodee.Sized2f
setHeight, setWidth
 

Constructor Detail

WindowHeaderWidget

public WindowHeaderWidget(float width,
                          float height,
                          WindowHeaderWidget.Description desc,
                          java.lang.String title)
Creates a new WindowHeaderWidget.


WindowHeaderWidget

public WindowHeaderWidget(org.openmali.types.twodee.Sized2fRO size,
                          WindowHeaderWidget.Description desc,
                          java.lang.String title)
Creates a new WindowHeaderWidget.


WindowHeaderWidget

public WindowHeaderWidget(float width,
                          float height,
                          java.lang.String title)
Creates a new WindowHeaderWidget.


WindowHeaderWidget

public WindowHeaderWidget(org.openmali.types.twodee.Sized2fRO size,
                          java.lang.String title)
Creates a new WindowHeaderWidget.

Method Detail

getTransparency

public float getTransparency()

Specified by:
getTransparency in interface Widget
Returns:
the whole Widget's Transparency.

setBackground

public void setBackground(Texture texture)
Sets the background texture of the Widget.

Specified by:
setBackground in interface BackgroundSettable
Parameters:
texture - the texture resource to use

setBackground

public void setBackground(java.lang.String texture)
Sets the background Texture of the Widget.

Specified by:
setBackground in interface BackgroundSettable
Parameters:
texture - the texture resource to use

getBackground

public Texture getBackground()

Specified by:
getBackground in interface BackgroundSettable
Returns:
the background Texture of the WidgetContainer.

setBackground

public void setBackground(org.openmali.vecmath2.Colorf color)
Sets the background color of the Widget.

Specified by:
setBackground in interface BackgroundSettable
Parameters:
color - the color to use

getBackgroundColor

public org.openmali.vecmath2.Colorf getBackgroundColor()

Specified by:
getBackgroundColor in interface BackgroundSettable
Returns:
the background color of the Widget.

setBackgroundTileSize

public void setBackgroundTileSize(float tileWidth,
                                  float tileHeight)
Sets the background tile size.
Use any negative value for no tiling.

Specified by:
setBackgroundTileSize in interface BackgroundSettable
Parameters:
tileWidth - the tile width (or negative for no tiling of width)
tileHeight - the tile height (or negative for no tiling of height)

setBackgroundTileSize

public void setBackgroundTileSize(org.openmali.types.twodee.Sized2fRO tileSize)
Sets the background tile size.
Use any negative value for no tiling.

Specified by:
setBackgroundTileSize in interface BackgroundSettable
Parameters:
tileSize - the tile size (or null for no tiling)

getBackgroundTileSize

public org.openmali.types.twodee.Sized2fRO getBackgroundTileSize()

Specified by:
getBackgroundTileSize in interface BackgroundSettable
Returns:
the background tile size (or null for no tiling)

getBackgroundTileWidth

public float getBackgroundTileWidth()

Specified by:
getBackgroundTileWidth in interface BackgroundSettable
Returns:
the background tile width (or negative for no tiling)

getBackgroundTileHeight

public float getBackgroundTileHeight()

Specified by:
getBackgroundTileHeight in interface BackgroundSettable
Returns:
the background tile width (or negative for no tiling)

setText

public void setText(java.lang.String title)
Sets the new text to be displayed

Specified by:
setText in interface TextWidget
Parameters:
title - the new Text

getText

public java.lang.String getText()

Specified by:
getText in interface TextWidget
Returns:
the text that is displayed

setFont

public void setFont(java.awt.Font font)
Sets the new Font to be used

Specified by:
setFont in interface TextWidget
Parameters:
font - the new Font

getFont

public java.awt.Font getFont()

Specified by:
getFont in interface TextWidget
Returns:
the used Font

setFontColor

public void setFontColor(org.openmali.vecmath2.Colorf color)
Sets the new color to be used

Specified by:
setFontColor in interface TextWidget
Parameters:
color - the new color

getFontColor

public org.openmali.vecmath2.Colorf getFontColor()

Specified by:
getFontColor in interface TextWidget
Returns:
the used color

setAlignment

public void setAlignment(TextAlignment alignment)
Sets the horizontal and vertical alignment of the text

Specified by:
setAlignment in interface TextWidget

getAlignment

public TextAlignment getAlignment()

Specified by:
getAlignment in interface TextWidget
Returns:
the horizontal and vertical alignment of the text

getCloseButton

public Button getCloseButton()
Returns:
the Button, which closes the Window

isMouseOverBar

public boolean isMouseOverBar(float relX,
                              float relY)
Checks, if the mouse is over the bar (not over any Button, etc.).

Parameters:
relX -
relY -

pick

public HUDPickResult pick(int canvasX,
                          int canvasY,
                          HUDPickResult.HUDPickReason pickReason,
                          org.jagatoo.input.devices.components.MouseButton button,
                          long when,
                          long meta,
                          int flags)
Tests whether a Widget is under the cursor and runs the approriate methods if true.

Specified by:
pick in interface Widget
Overrides:
pick in class RectangularWidget
Parameters:
canvasX - the x position of the mouse on the Canvas3D
canvasY - the y position of the mouse on the Canvas3D
pickReason - the action which caused this pick operation
button - the mouse-button, that caused the picking
when - the timestamp of the picking
meta - this could be either the lastPressTime, lastReleaseTime, buttonsState mask or the page-move-boolean. (depends on the pickReason)
Returns:
an instance of HUDPickResult holding the picked Widget and absolute and relative picking positions or null.

setSize

protected boolean setSize(float width,
                          float height,
                          boolean forced)

Overrides:
setSize in class WidgetBase

createTitleLabel

protected Button createTitleLabel(Button.Description buttonDesc)
This method creates the close button for the Window. It may return null, if you want.

Parameters:
buttonDesc - the Button.Description for the close Button
Returns:
the created close Button

createCloseButton

protected Button createCloseButton(WindowHeaderWidget.Description desc)
This method creates the close button for the Window. It may return null, if you want.

Parameters:
desc - the WindowHeaderWidget.Description
Returns:
the created close Button

init

protected void init()
This method is called when the WidgetContainer is set.

Specified by:
init in class WidgetBase