org.xith3d.ui.hud.widgets.assemblies
Class HUDConsole

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.BackgroundSettableRectangularWidget
              extended by org.xith3d.ui.hud.widgets.assemblies.HUDConsole
All Implemented Interfaces:
org.jagatoo.datatypes.NamableObject, org.jagatoo.datatypes.NamedObject, org.jagatoo.logging.LogInterface, org.openmali.types.twodee.Positioned2f, org.openmali.types.twodee.Positioned2fRO, org.openmali.types.twodee.Sized2f, org.openmali.types.twodee.Sized2fRO, BackgroundSettable, BackgroundSettableWidget, BorderSettable, PopUpable, Widget

public class HUDConsole
extends BackgroundSettableRectangularWidget
implements BorderSettable, PopUpable, org.jagatoo.logging.LogInterface

A Console is what you will know from many kinds of games mostly from FPS games. Logging is dumped to it and you can type commands.


Nested Class Summary
static class HUDConsole.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
HUDConsole(float width, float height, boolean initiallyVisible)
           
HUDConsole(float width, float height, HUDConsole.Description desc, boolean initiallyVisible)
           
HUDConsole(float width, float height, int channelFilter, boolean initiallyVisible)
           
HUDConsole(float width, float height, int channelFilter, HUDConsole.Description desc, boolean initiallyVisible)
           
HUDConsole(float width, float height, int channelFilter, int logLevel, boolean initiallyVisible)
           
HUDConsole(float width, float height, int channelFilter, int logLevel, HUDConsole.Description desc, boolean initiallyVisible)
           
HUDConsole(org.openmali.types.twodee.Sized2fRO size, boolean initiallyVisible)
           
HUDConsole(org.openmali.types.twodee.Sized2fRO size, HUDConsole.Description desc, boolean initiallyVisible)
           
HUDConsole(org.openmali.types.twodee.Sized2fRO size, int channelFilter, boolean initiallyVisible)
           
HUDConsole(org.openmali.types.twodee.Sized2fRO size, int channelFilter, HUDConsole.Description desc, boolean initiallyVisible)
           
HUDConsole(org.openmali.types.twodee.Sized2fRO size, int channelFilter, int logLevel, boolean initiallyVisible)
           
HUDConsole(org.openmali.types.twodee.Sized2fRO size, int channelFilter, int logLevel, HUDConsole.Description desc, boolean initiallyVisible)
           
 
Method Summary
 boolean acceptsChannel(org.jagatoo.logging.LogChannel channel)
           
 void addConsoleListener(ConsoleListener l)
          Adds a ConsoleListener to the list of notified listeners.
 void close()
          
protected  AbstractImage createBackgroundImage(float width, float height, org.openmali.vecmath2.Colorf color)
          
protected  AbstractImage createBackgroundImage(float width, float height, Texture texture)
          
 void flush()
          
 Border getBorder()
          
 int getChannelFilter()
           
 char[] getIgnoredChars()
           
 org.openmali.vecmath2.Colorf getListFontColor(int logLevel)
           
 int getLogLevel()
           
 float getTransparency()
          
protected  void init()
          This method is called when the WidgetContainer is set.
 boolean isInputBoxVisible()
           
 boolean isPoppedUp()
          
 boolean isTrimMessages()
           
protected  void onAddedToHUD(HUD hud)
          This event is fired, when this Widget is added to a WidgetContainer and the container itself is already added to the HUD or is the HUD itself.
protected  void onCommandEntered(java.lang.String commandLine)
          This event is fired when a command has been typed to the input-box.
 void popUp(boolean p)
          Pops up the popupable Widget (or un-pops it)
 void print(org.jagatoo.logging.LogChannel channel, int logLevel, java.lang.String message)
          
 boolean println(int logLevel, java.lang.String message)
           
 void println(org.jagatoo.logging.LogChannel channel, int logLevel, java.lang.String message)
          
 boolean println(java.lang.String message)
           
 boolean println(java.lang.String message, org.openmali.vecmath2.Colorf color)
           
 void registerCommand(org.jagatoo.commands.Command command)
           
 void registerCommands(org.jagatoo.commands.Command[] commands)
           
 void registerCommands(java.util.List<org.jagatoo.commands.Command> commands)
           
 void removeConsoleListener(ConsoleListener l)
          Removes a ConsoleListener from the list of notified listeners.
 void setBorder(Border.Description borderDesc)
          Creates a new Border from the given Border.Desctiption and invokes setBorder(Border).
 void setBorder(Border border)
          Sets the Border to use for this BorderSettable Widget.
 void setChannelFilter(int filter)
           
 void setIgnoredChars(char... ignoredChars)
          Sets the array of chars ignored by this HUDConsole.
 void setInputBoxVisible(boolean visible)
          Defines, if the HUDConsole's input-box is visible or hidden.
 void setListFontColor(int logLevel, org.openmali.vecmath2.Colorf color)
          Sets the color to be used for the given LogLevel.
 void setLogLevel(int logLevel)
           
protected  boolean setSize(float width, float height, boolean forced)
          
 void setTrimMessages(boolean trimMessages)
          Sets if the messages should be trimmed before display.
protected  void updatePreviewListSize(List<Label> previewList)
           
protected  void updateTypePreview(java.lang.String text)
           
 
Methods inherited from class org.xith3d.ui.hud.base.BackgroundSettableRectangularWidget
getBackground, getBackgroundColor, getBackgroundTileHeight, getBackgroundTileSize, getBackgroundTileWidth, setBackground, setBackground, setBackground, setBackgroundTileSize, setBackgroundTileSize, setContainer
 
Methods inherited from class org.xith3d.ui.hud.base.RectangularWidget
getPickHeight, getPickSGZPosition, getPickWidth, pick
 
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, 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, 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, pick, removeContainerListener, removeFocusListener, removeInputListener, removeLocationListener, removeSizeListener, removeVisibilityListener, requestFocus, setAssembly, setCachedToolTipWidget, setClickable, 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

HUDConsole

public HUDConsole(float width,
                  float height,
                  int channelFilter,
                  int logLevel,
                  HUDConsole.Description desc,
                  boolean initiallyVisible)

HUDConsole

public HUDConsole(float width,
                  float height,
                  int channelFilter,
                  HUDConsole.Description desc,
                  boolean initiallyVisible)

HUDConsole

public HUDConsole(float width,
                  float height,
                  HUDConsole.Description desc,
                  boolean initiallyVisible)

HUDConsole

public HUDConsole(org.openmali.types.twodee.Sized2fRO size,
                  int channelFilter,
                  int logLevel,
                  HUDConsole.Description desc,
                  boolean initiallyVisible)

HUDConsole

public HUDConsole(org.openmali.types.twodee.Sized2fRO size,
                  int channelFilter,
                  HUDConsole.Description desc,
                  boolean initiallyVisible)

HUDConsole

public HUDConsole(org.openmali.types.twodee.Sized2fRO size,
                  HUDConsole.Description desc,
                  boolean initiallyVisible)

HUDConsole

public HUDConsole(float width,
                  float height,
                  int channelFilter,
                  int logLevel,
                  boolean initiallyVisible)

HUDConsole

public HUDConsole(float width,
                  float height,
                  int channelFilter,
                  boolean initiallyVisible)

HUDConsole

public HUDConsole(float width,
                  float height,
                  boolean initiallyVisible)

HUDConsole

public HUDConsole(org.openmali.types.twodee.Sized2fRO size,
                  int channelFilter,
                  int logLevel,
                  boolean initiallyVisible)

HUDConsole

public HUDConsole(org.openmali.types.twodee.Sized2fRO size,
                  int channelFilter,
                  boolean initiallyVisible)

HUDConsole

public HUDConsole(org.openmali.types.twodee.Sized2fRO size,
                  boolean initiallyVisible)
Method Detail

addConsoleListener

public final void addConsoleListener(ConsoleListener l)
Adds a ConsoleListener to the list of notified listeners.

Parameters:
l -

removeConsoleListener

public final void removeConsoleListener(ConsoleListener l)
Removes a ConsoleListener from the list of notified listeners.

Parameters:
l -

setBorder

public void setBorder(Border border)
Sets the Border to use for this BorderSettable Widget.

Specified by:
setBorder in interface BorderSettable
Parameters:
border - the new Border (null for no border)

setBorder

public void setBorder(Border.Description borderDesc)
Creates a new Border from the given Border.Desctiption and invokes setBorder(Border).

Specified by:
setBorder in interface BorderSettable
Parameters:
borderDesc - the Border.Description to create the new Border from (null for no border)
See Also:
BorderSettable.setBorder(Border)

getBorder

public final Border getBorder()

Specified by:
getBorder in interface BorderSettable
Returns:
the Border used for this BorderSettable Widget

createBackgroundImage

protected AbstractImage createBackgroundImage(float width,
                                              float height,
                                              Texture texture)

Specified by:
createBackgroundImage in class BackgroundSettableRectangularWidget
Returns:
a new instance of AbstractImage to be used as the background image.

createBackgroundImage

protected AbstractImage createBackgroundImage(float width,
                                              float height,
                                              org.openmali.vecmath2.Colorf color)

Specified by:
createBackgroundImage in class BackgroundSettableRectangularWidget
Returns:
a new instance of AbstractImage to be used as the background image.

popUp

public void popUp(boolean p)
Pops up the popupable Widget (or un-pops it)

Specified by:
popUp in interface PopUpable
Parameters:
p - if true, the pop-up will be visible

isPoppedUp

public boolean isPoppedUp()

Specified by:
isPoppedUp in interface PopUpable
Returns:
whether the pop-up is currently visible

getTransparency

public float getTransparency()

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

setListFontColor

public void setListFontColor(int logLevel,
                             org.openmali.vecmath2.Colorf color)
Sets the color to be used for the given LogLevel.
Currently ERROR, EXCEPTION and REGULAR use distinct colors and DEBUG, EXHAUSTIVE and PROFILE will use the REGULAR color.

Parameters:
logLevel -
color -

getListFontColor

public org.openmali.vecmath2.Colorf getListFontColor(int logLevel)
Parameters:
logLevel -
Returns:
the color to be used for the given LogLevel.
Currently ERROR, EXCEPTION and REGULAR use distinct colors and DEBUG, EXHAUSTIVE and PROFILE will use the REGULAR color.

setLogLevel

public final void setLogLevel(int logLevel)

getLogLevel

public final int getLogLevel()
Specified by:
getLogLevel in interface org.jagatoo.logging.LogInterface

setChannelFilter

public final void setChannelFilter(int filter)

getChannelFilter

public final int getChannelFilter()
Specified by:
getChannelFilter in interface org.jagatoo.logging.LogInterface

acceptsChannel

public final boolean acceptsChannel(org.jagatoo.logging.LogChannel channel)

println

public boolean println(java.lang.String message,
                       org.openmali.vecmath2.Colorf color)

println

public boolean println(int logLevel,
                       java.lang.String message)

println

public boolean println(java.lang.String message)

print

public void print(org.jagatoo.logging.LogChannel channel,
                  int logLevel,
                  java.lang.String message)

Specified by:
print in interface org.jagatoo.logging.LogInterface

println

public void println(org.jagatoo.logging.LogChannel channel,
                    int logLevel,
                    java.lang.String message)

Specified by:
println in interface org.jagatoo.logging.LogInterface

registerCommand

public void registerCommand(org.jagatoo.commands.Command command)

registerCommands

public void registerCommands(org.jagatoo.commands.Command[] commands)

registerCommands

public void registerCommands(java.util.List<org.jagatoo.commands.Command> commands)

onCommandEntered

protected void onCommandEntered(java.lang.String commandLine)
This event is fired when a command has been typed to the input-box.

Parameters:
commandLine - the entered command

updatePreviewListSize

protected void updatePreviewListSize(List<Label> previewList)

updateTypePreview

protected void updateTypePreview(java.lang.String text)

flush

public void flush()

Specified by:
flush in interface org.jagatoo.logging.LogInterface

close

public void close()

Specified by:
close in interface org.jagatoo.logging.LogInterface

setIgnoredChars

public void setIgnoredChars(char... ignoredChars)
Sets the array of chars ignored by this HUDConsole. This is especially useful when a printable char's key is used to popup the console.

Parameters:
ignoredChars -

getIgnoredChars

public char[] getIgnoredChars()
Returns:
the array of chars ignored by this HUDConsole. This is especially useful when a printable char's key is used to popup the console.

setTrimMessages

public void setTrimMessages(boolean trimMessages)
Sets if the messages should be trimmed before display.
Default is 'true'.

Parameters:
trimMessages - 'true' if messages should be trimmed.

isTrimMessages

public boolean isTrimMessages()
Returns:
'true' if messages are trimmed before displaying them

setInputBoxVisible

public void setInputBoxVisible(boolean visible)
Defines, if the HUDConsole's input-box is visible or hidden.

Parameters:
visible -

isInputBoxVisible

public boolean isInputBoxVisible()
Returns:
if the HUDConsole's input-box is visible or hidden.

onAddedToHUD

protected void onAddedToHUD(HUD hud)
Description copied from class: WidgetBase
This event is fired, when this Widget is added to a WidgetContainer and the container itself is already added to the HUD or is the HUD itself.

Overrides:
onAddedToHUD in class WidgetBase
Parameters:
hud - the HUD, the Widget is added to

setSize

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

Overrides:
setSize in class WidgetBase

init

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

Specified by:
init in class WidgetBase