edu.cs.ai.kreator.ui.cli
Interface KreatorConsole

All Known Implementing Classes:
ConsolePane

public interface KreatorConsole

This interface has to be implemented by every console. It provides the controller and other utilizing classes with an interface to print out information and results in the console.

Author:
Niklas Wulf

Method Summary
 void appendAnswerToReport(java.lang.String answer)
          Appends a message to the report view.
 void appendCommandToReport(java.lang.String command)
          Appends a command to the report view.
 void chancelWorkerCheckTimer()
          Cancels the worker check timer.
 void clearConsoleTextPane()
          Clears the output in the console pane.
 java.util.List<java.lang.String> getCmdHistory()
          Returns the console's command history, so that it can be saved in the project
 KreatorScriptEngine getScriptEngine()
          Gets the KreatorScriptEngine currently used by this console.
 boolean isRunning()
          Returns true if a worker is currently registered with this console, and thus no other worker should start working in here.
 void printErrorLine(java.lang.String message)
          Prints a message with the ERROR-AttributeSet
 void printInfoLine(java.lang.String message)
          Prints a message with the INFO AttributeSet
 void printInputLine(java.lang.String command)
          Sets the input line of this console to line
 void printJavaScriptErrorLine(java.lang.String message)
          Prints a message with the SYSTAXERROR AttributeSet
 void printOutputLine(java.lang.String message)
          Prints a message with the "OUTPUT"-AttibuteSet
 void printOutputLine(java.lang.String message, javax.swing.text.AttributeSet attrs)
          Prints a message with a given AttributeSet
 void printThreadingLine(java.lang.String message)
          Prints a message with the THREADING_ATTRS AttributeSet
 void printVerboseLine(java.lang.String message)
          If Config allows, prints a verbose message with the "VERBOSE"-AttibuteSet, otherwise the message is logged on debug level.
 void registerWorker(KreatorWorker<?> w)
          Registers the given worker as the current worker of this console.
 void resetScriptEngine(boolean doPrintPrompt)
          Clears the console pane and resets its script engine.
 void setCmdHistory(java.util.List<java.lang.String> commandList)
          Sets the console's command history.
 void setScriptEngine(KreatorScriptEngine engine)
          Sets the KreatorScriptEngine used by this console.
 void startWorkerCheckTimer()
          Starts timer to check if the worker is responsive.
 void togglePauseResumeButton()
          Toggles the state of the pause/resume button.
 boolean toggleView()
          Toggles between console and report view.
 void unregisterWorker(KreatorWorker<?> w)
          Unregisters the given worker.
 

Method Detail

printInputLine

void printInputLine(java.lang.String command)
Sets the input line of this console to line


printOutputLine

void printOutputLine(java.lang.String message)
Prints a message with the "OUTPUT"-AttibuteSet

Parameters:
message -

printOutputLine

void printOutputLine(java.lang.String message,
                     javax.swing.text.AttributeSet attrs)
Prints a message with a given AttributeSet

Parameters:
message -
attrs -

printVerboseLine

void printVerboseLine(java.lang.String message)
If Config allows, prints a verbose message with the "VERBOSE"-AttibuteSet, otherwise the message is logged on debug level.

Parameters:
message -

printErrorLine

void printErrorLine(java.lang.String message)
Prints a message with the ERROR-AttributeSet

Parameters:
message -

printJavaScriptErrorLine

void printJavaScriptErrorLine(java.lang.String message)
Prints a message with the SYSTAXERROR AttributeSet

Parameters:
message -

printInfoLine

void printInfoLine(java.lang.String message)
Prints a message with the INFO AttributeSet

Parameters:
message -

printThreadingLine

void printThreadingLine(java.lang.String message)
Prints a message with the THREADING_ATTRS AttributeSet

Parameters:
message -

getCmdHistory

java.util.List<java.lang.String> getCmdHistory()
Returns the console's command history, so that it can be saved in the project

Returns:
The console's command history

setCmdHistory

void setCmdHistory(java.util.List<java.lang.String> commandList)
Sets the console's command history. e.g. when loading a new project


appendCommandToReport

void appendCommandToReport(java.lang.String command)
Appends a command to the report view.


appendAnswerToReport

void appendAnswerToReport(java.lang.String answer)
Appends a message to the report view.
This message is automatically commented out.

Parameters:
command -

registerWorker

void registerWorker(KreatorWorker<?> w)
Registers the given worker as the current worker of this console. There may be exactly one worker at a time.


unregisterWorker

void unregisterWorker(KreatorWorker<?> w)
Unregisters the given worker.


togglePauseResumeButton

void togglePauseResumeButton()
Toggles the state of the pause/resume button.


startWorkerCheckTimer

void startWorkerCheckTimer()
Starts timer to check if the worker is responsive.


chancelWorkerCheckTimer

void chancelWorkerCheckTimer()
Cancels the worker check timer.


setScriptEngine

void setScriptEngine(KreatorScriptEngine engine)
Sets the KreatorScriptEngine used by this console.
This can be used to overload KreatorScriptEngine.done(), which will be executed after each script.

Parameters:
engine -

getScriptEngine

KreatorScriptEngine getScriptEngine()
Gets the KreatorScriptEngine currently used by this console.
The returned reference might change over the lifetime of the console, eg. if #resetScriptEngine() has been called.
Therefore its important not to hold the returned reference , because this would prevent proper garbage collection.

Returns:

resetScriptEngine

void resetScriptEngine(boolean doPrintPrompt)
Clears the console pane and resets its script engine.


clearConsoleTextPane

void clearConsoleTextPane()
Clears the output in the console pane.

See Also:
#resetScriptEngine()

isRunning

boolean isRunning()
Returns true if a worker is currently registered with this console, and thus no other worker should start working in here.

Returns:
true if there is a worker registered

toggleView

boolean toggleView()
Toggles between console and report view.

Returns:
true, if the view shows the console after execution of this method.