public class ContextToolWrapper extends java.lang.Object implements WandoraTool
Modifier and Type | Field and Description |
---|---|
private Context |
context |
private WandoraTool |
wrapped |
Constructor and Description |
---|
ContextToolWrapper(WandoraTool wrapped)
Creates a new instance of ContextToolWrapper
|
ContextToolWrapper(WandoraTool wrapped,
Context context) |
Modifier and Type | Method and Description |
---|---|
void |
configure(Wandora admin,
Options options,
java.lang.String prefix)
Open configuration dialog and allow user to configure the tool.
|
void |
execute(Wandora admin)
Runs the tool.
|
void |
execute(Wandora admin,
java.awt.event.ActionEvent event)
Runs the tool.
|
void |
execute(Wandora admin,
Context context)
Runs the tool.
|
boolean |
forceStop()
Logger should have a mechanism to receive user interruption.
|
Context |
getContext()
Get tool's execution context.
|
java.lang.String |
getDescription()
Returns description of the tool.
|
java.lang.String |
getHistory()
Returns all collected logs as a string.
|
javax.swing.Icon |
getIcon()
Return tool's icon.
|
java.lang.String |
getName()
Return tool's name.
|
int |
getState()
Returns logger's current state.
|
SimpleMenuItem |
getToolMenuItem(Wandora admin,
java.lang.String instanceName) |
WandoraToolType |
getType()
Returns tool's type.
|
void |
hlog(java.lang.String message)
Shortcut to access tool's logger.
|
void |
initialize(Wandora admin,
Options options,
java.lang.String prefix)
Read settings from options and initialize tool.
|
boolean |
isConfigurable()
Return true if tool has something to configure.
|
boolean |
isRunning()
Returns boolean value true if the tool is running and false if the
execution has ended.
|
void |
lockLog(boolean lock)
Should the logger change current log message? If true, the log should
keep the current message visible although new log data is generated.
|
void |
log(java.lang.Error e)
Shortcut to access tool's logger.
|
void |
log(java.lang.Exception e)
Shortcut to access tool's logger.
|
void |
log(java.lang.String message)
Shortcut to access tool's logger.
|
void |
log(java.lang.String message,
java.lang.Exception e)
Shortcut to access tool's logger.
|
boolean |
requiresRefresh()
Should the Wandora application refresh.
|
void |
setContext(Context context)
Set tool's execution context.
|
void |
setLogTitle(java.lang.String title)
Logging system may have a title.
|
void |
setProgress(int n)
Logger may view progress information for operation.
|
void |
setProgressMax(int maxn)
Set the progress point where operation is ready.
|
void |
setState(int state)
Sets logger's current state.
|
void |
setToolLogger(WandoraToolLogger logger)
Sets tools logger.
|
void |
writeOptions(Wandora admin,
Options options,
java.lang.String prefix)
Save current tool settings to options.
|
private WandoraTool wrapped
private Context context
public ContextToolWrapper(WandoraTool wrapped)
public ContextToolWrapper(WandoraTool wrapped, Context context)
public WandoraToolType getType()
WandoraTool
getType
in interface WandoraTool
public Context getContext()
WandoraTool
getContext
in interface WandoraTool
public void setContext(Context context)
WandoraTool
setContext
in interface WandoraTool
context
- Tool's new context.public boolean forceStop()
WandoraToolLogger
Logger should have a mechanism to receive user interruption. Typically this
is realized with a Cancel or Stop button. Whenever the user interrupts the
operation the logger should return true as the return code of forceStop
method.
forceStop
mechanism relies that the tool using the logger polls
forceStop
method frequently and cancels the operation as soon as
true is returned.
forceStop
in interface WandoraToolLogger
forceStop
in interface TopicMapLogger
public int getState()
WandoraToolLogger
getState
in interface WandoraToolLogger
public void setState(int state)
WandoraToolLogger
setState
in interface WandoraToolLogger
state
- of logger.public void setToolLogger(WandoraToolLogger logger)
WandoraTool
setToolLogger
in interface WandoraTool
logger
- is new logger object.public void hlog(java.lang.String message)
WandoraTool
hlog
in interface WandoraTool
hlog
in interface WandoraToolLogger
hlog
in interface TopicMapLogger
message
- to be logged.public void log(java.lang.String message)
WandoraTool
log
in interface WandoraTool
log
in interface WandoraToolLogger
log
in interface TopicMapLogger
message
- to be logged.public void log(java.lang.String message, java.lang.Exception e)
WandoraTool
log
in interface WandoraTool
log
in interface WandoraToolLogger
log
in interface TopicMapLogger
message
- to be logged.e
- Exception to be logged.public void log(java.lang.Exception e)
WandoraTool
log
in interface WandoraTool
log
in interface WandoraToolLogger
log
in interface TopicMapLogger
e
- Exception to be logged.public void log(java.lang.Error e)
WandoraTool
log
in interface WandoraTool
log
in interface WandoraToolLogger
e
- Error to be logged.public void setProgress(int n)
WandoraToolLogger
setProgressMax
.setProgress
in interface WandoraToolLogger
setProgress
in interface TopicMapLogger
n
- is integer value representing the state of current progress.public void setProgressMax(int maxn)
WandoraToolLogger
setProgressMax
in interface WandoraToolLogger
setProgressMax
in interface TopicMapLogger
maxn
- is integer value representing progress when the task is ready.public void setLogTitle(java.lang.String title)
WandoraToolLogger
setLogTitle
in interface WandoraToolLogger
setLogTitle
in interface TopicMapLogger
title
- is a string viewed as a title of logger window.public void lockLog(boolean lock)
WandoraToolLogger
lockLog
in interface WandoraToolLogger
lock
- boolean variable that locks or unlocks logger.public java.lang.String getHistory()
WandoraToolLogger
getHistory
in interface WandoraToolLogger
public java.lang.String getName()
WandoraTool
getName
in interface WandoraTool
public java.lang.String getDescription()
WandoraTool
getDescription
in interface WandoraTool
public void initialize(Wandora admin, Options options, java.lang.String prefix) throws TopicMapException
WandoraTool
initialize
in interface WandoraTool
TopicMapException
public boolean isConfigurable()
WandoraTool
isConfigurable
in interface WandoraTool
public void configure(Wandora admin, Options options, java.lang.String prefix) throws TopicMapException
WandoraTool
configure
in interface WandoraTool
TopicMapException
public void writeOptions(Wandora admin, Options options, java.lang.String prefix)
WandoraTool
writeOptions
in interface WandoraTool
public void execute(Wandora admin) throws TopicMapException
WandoraTool
execute
in interface WandoraTool
TopicMapException
public void execute(Wandora admin, Context context) throws TopicMapException
WandoraTool
execute
in interface WandoraTool
TopicMapException
public void execute(Wandora admin, java.awt.event.ActionEvent event) throws TopicMapException
WandoraTool
execute
in interface WandoraTool
admin
- is the application context.event
- is the event triggering the event.TopicMapException
public boolean isRunning()
WandoraTool
isRunning
in interface WandoraTool
public boolean requiresRefresh()
WandoraTool
requiresRefresh
in interface WandoraTool
public SimpleMenuItem getToolMenuItem(Wandora admin, java.lang.String instanceName)
getToolMenuItem
in interface WandoraTool
public javax.swing.Icon getIcon()
WandoraTool
getIcon
in interface WandoraTool
Copyright 2004-2015 Wandora Team