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

java.lang.Object
  extended by org.xith3d.ui.hud.base.Widget
      extended by org.xith3d.ui.hud.base.BackgroundSettableWidget
          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, PopUpable

public class HUDConsole
extends BackgroundSettableWidget
implements 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 class org.xith3d.ui.hud.base.BackgroundSettableWidget
BackgroundSettableWidget.BackgroundSettableDescriptionBase
 
Nested classes/interfaces inherited from class org.xith3d.ui.hud.base.Widget
Widget.DescriptionBase
 
Field Summary
 
Fields inherited from class org.xith3d.ui.hud.base.Widget
transformHeight_Pixels2HUD, transformWidth_Pixels2HUD
 
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)
           
 
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  void drawWidget(Texture2DCanvas texCanvas, int offsetX, int offsetY, int width, int height, boolean drawsSelf)
          
 void dumpKnownCommands()
          Dumps all registered Commands to the console.
 void flush()
          
 int getChannelFilter()
           
 char[] getIgnoredChars()
           
 org.openmali.vecmath2.Colorf getListFontColor(int logLevel)
           
 int getLogLevel()
           
 org.jagatoo.commands.Command[] getRegisteredCommands()
           
protected  void init()
          This method is called when the WidgetContainer is set.
 boolean isInputBoxVisible()
           
 boolean isPoppedUp()
          
 boolean isTrimMessages()
           
protected  void onAttachedToHUD(HUD hud)
          This event is fired, when this Widget is added to the HUD live Widget hierarchy.
protected  void onCommandEntered(java.lang.String commandLine)
          This event is fired when a command has been typed to the input-box.
protected  void onSizeChanged(float oldWidth, float oldHeight, float newWidth, float newHeight)
          
 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 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)
           
 void setTrimMessages(boolean trimMessages)
          Sets if the messages should be trimmed before display.
protected  void updatePreviewListSize(List previewList)
           
protected  void updateTypePreview(java.lang.String text)
           
 
Methods inherited from class org.xith3d.ui.hud.base.BackgroundSettableWidget
drawBackground, getBackgroundColor, getBackgroundTexture, getBackgroundTileMode, setBackground, setBackground, setBackground, setBackgroundColor, setBackgroundTexture, setBackgroundTexture, setBackgroundTexture, setBackgroundTexture, setBackgroundTileMode, setNoBackground
 
Methods inherited from class org.xith3d.ui.hud.base.Widget
addContainerListener, addControllerListener, addFocusListener, addInputListener, addKeyboardListener, addLocationListener, addMouseListener, addSizeListener, addVisibilityListener, bindToGlobalMouseMovement, blocksFocusMoveDeviceComponent, calculateTransformHeight_Pixels2HUD, calculateTransformWidth_Pixels2HUD, compareAbsZIndex, createShape, detach, drawAndUpdateWidget, drawBorder, drawWidgetAfterWidgetAssembler, drawWidgetContents, getAbsoluteLocationOnHUD_, getAspect, getAssembly, getBorder, getContainer, getContentAspect, getContentHeight, getContentHeightPX, getContentLeftPX, getContentOffset, getContentTopPX, getContentWidth, getContentWidthPX, getContextMenu, getCursor, getEqualHeight_, getEqualWidth_, getForcedRedrawFrequency, getHeight, getHeightPX, getHUD, getLeft, getLevel, getLocation, getLocation, getLocationHUD2Pixels_, getLocationHUD2SG_, getLocationPixels2HUD_, getLocationSG2HUD_, getMaxRedrawFrequency, getMinHeight, getMinWidth, getName, getParentWindow, getPickHeight, getPickWidth, getRelLocationHUD2Pixels_, getRootHostWidget, getShape, getSize, getSizeHUD2Pixels_, getSizeHUD2SG_, getSizeOfPixels_, getSizePixels2HUD_, getSizeSG2HUD_, getToolTip, getTop, getTransparency, getUserObject, getWidgetAssembler, getWidth, getWidthPX, getZIndex, hasDropShadow, hasFocus, hasFocus, hasToolTip, initSize, isAHostedWidgetDirty, isClickable, isDraggable, isFocussable, isHeavyWeight, isHovered, isInitialized, isInitializing, isPickable, isThisWidgetDirty, isVisible, notifyOnDragStopped, onAttachedToContainer, onControllerAxisChanged, onControllerButtonPressed, onControllerButtonReleased, onDetachedFromContainer, onDetachedFromHUD, onFocusGained, onFocusLost, onInputStateChanged, onKeyPressed, onKeyReleased, onKeyTyped, onLocationChanged, onMouseButtonPressed, onMouseButtonReleased, onMouseEntered, onMouseExited, onMouseMoved, onMouseStopped, onMouseWheelMoved, onVisibilityChanged, pick, pickConditionsMatch, removeContainerListener, removeControllerListener, removeFocusListener, removeInputListener, removeKeyboardListener, removeLocationListener, removeMouseListener, removeSizeListener, removeVisibilityListener, requestFocus, resetWidgetDirty, setBorder, setBorder, setClickable, setContentClipRect, setContextMenu, setCursor, setDraggable, setFocussable, setForcedRedrawFrequency, setHasDropShadow, setHeight, setHostedWidgetDirty, setHostTextureDirty, setHostTextureDirty, setHostWidget, setLocation, setLocation, setLocation, setMaxRedrawFrequency, setName, setPickable, setSize, setSize, setSize, setSize, setTextureDirty, setTextureDirty, setToolTip, setTransparency, setTransparency, setUserObject, setVisible, setWidgetDirty, setWidth, setZIndex, startDragging, toString, update, updateAbsZIndex, updateSizeFactors, updateTranslation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

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(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)
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 -

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

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 final boolean println(int logLevel,
                             java.lang.String message)

println

public final boolean println(java.lang.String message)

print

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

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

println

public final 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)

getRegisteredCommands

public org.jagatoo.commands.Command[] getRegisteredCommands()

dumpKnownCommands

public void dumpKnownCommands()
Dumps all registered Commands to the console.


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 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.

onAttachedToHUD

protected void onAttachedToHUD(HUD hud)
Description copied from class: Widget
This event is fired, when this Widget is added to the HUD live Widget hierarchy.

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

onSizeChanged

protected void onSizeChanged(float oldWidth,
                             float oldHeight,
                             float newWidth,
                             float newHeight)

Overrides:
onSizeChanged in class Widget

drawWidget

protected void drawWidget(Texture2DCanvas texCanvas,
                          int offsetX,
                          int offsetY,
                          int width,
                          int height,
                          boolean drawsSelf)

Specified by:
drawWidget in class Widget

init

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

Specified by:
init in class Widget