public class Pluglet
extends java.lang.Object
Use the getName
method to retrieve the name of the
pluglet. Use the getDirectory
method to retrieve the
full path of the pluglet directory.
To use these properties and basic services, a pluglet class must extend this class. Use of this class and extending the class is optional.
Modifier and Type | Field and Description |
---|---|
java.io.PrintWriter |
out
The output for this pluglet.
|
Constructor and Description |
---|
Pluglet() |
Modifier and Type | Method and Description |
---|---|
boolean |
confirm(java.lang.String message)
Displays a message dialog with OK and Cancel
buttons.
|
boolean |
confirm(java.lang.String message,
java.lang.String title)
Displays a message dialog with OK and Cancel
buttons and the given title.
|
void |
dumpStack()
Prints a stack trace of the current thread to the pluglet output writer.
|
void |
dumpStack(java.io.PrintWriter writer)
Prints a stack trace of the current thread to the specified print
writer.
|
void |
error(java.lang.String message)
Displays an error dialog with an OK button.
|
void |
error(java.lang.String message,
java.lang.String title)
Displays an error dialog with an OK button and the
given title.
|
java.lang.Object |
executePluglet(java.lang.Class plugletClass)
Executes a pluglet.
|
java.lang.Object |
executePluglet(java.lang.Class plugletClass,
java.lang.String plugletArg)
Executes a pluglet.
|
java.lang.Object |
executePluglet(java.lang.Class plugletClass,
java.lang.String[] plugletArgs)
Executes a pluglet.
|
java.lang.Object |
executePluglet(java.lang.Class plugletClass,
java.lang.String plugletArg1,
java.lang.String plugletArg2)
Executes a pluglet.
|
IPlugletMessageDialog |
getDialog()
Retrieves the host's
IPlugletMessageDialog
implementation. |
java.lang.String |
getDirectory()
Retrieves the full path of the pluglet directory.
|
java.lang.String |
getFile()
Retrieves the full path of the pluglet file.
|
java.lang.String |
getFullName()
Retrieves the full name of the pluglet.
|
java.lang.String |
getName()
Retrieves the name of the pluglet.
|
void |
inform(java.lang.String message)
Displays an information dialog with an OK button.
|
void |
inform(java.lang.String message,
java.lang.String title)
Displays an information dialog with an OK button
and the given title.
|
void |
printStackTrace(java.lang.Throwable t)
Prints the throwable and its backtrace to the pluglet output writer.
|
void |
printStackTrace(java.lang.Throwable t,
java.io.PrintWriter writer)
Prints the throwable and its backtrace to the specified print writer.
|
java.lang.String |
prompt(java.lang.String message)
Displays an input dialog with a prompt message, a text input field, and
OK and Cancel buttons.
|
java.lang.String |
prompt(java.lang.String message,
java.lang.String initialText)
Displays an input dialog with a prompt message, the text input
field initial text, and OK and
Cancel buttons.
|
java.lang.String |
prompt(java.lang.String message,
java.lang.String initialText,
java.lang.String title)
Displays an input dialog with a prompt message, the text input
field initial text, the title, and OK button and
Cancel buttons.
|
boolean |
question(java.lang.String message)
Displays a question message dialog with
Yes and
No buttons. |
boolean |
question(java.lang.String message,
java.lang.String title)
Displays a question message dialog with Yes and
No buttons and the given title.
|
void |
setDialog(IPlugletMessageDialog dialog)
Sets the host's
IPlugletMessageDialog
implementation. |
void |
setDirectory(java.lang.String directory)
Sets the full path of the pluglet directory.
|
void |
setFile(java.lang.String file)
Sets the full path of the pluglet file.
|
void |
setFullName(java.lang.String fullName)
Sets the full name of the pluglet.
|
void |
setName(java.lang.String name)
Sets the name of the pluglet.
|
void |
warning(java.lang.String message)
Displays a warning dialog with an OK button.
|
void |
warning(java.lang.String message,
java.lang.String title)
Displays a warning dialog with an OK button and the
given title.
|
public java.lang.String getName()
public void setName(java.lang.String name)
public java.lang.String getFullName()
public void setFullName(java.lang.String fullName)
public java.lang.String getFile()
public void setFile(java.lang.String file)
public java.lang.String getDirectory()
public void setDirectory(java.lang.String directory)
public boolean confirm(java.lang.String message, java.lang.String title)
message
- The message to be displayed.title
- The title of the message dialog.boolean
value of true
when the OK button is pressed. Otherwise,
it returns a value of false
.public boolean confirm(java.lang.String message)
message
- The message to be displayed.boolean
value of true
when the OK button is pressed. Otherwise,
it returns a value of false
.public void error(java.lang.String message, java.lang.String title)
message
- The message to be displayed.title
- The title of the error dialog.public void error(java.lang.String message)
message
- The message to be displayed.public void inform(java.lang.String message, java.lang.String title)
message
- The message to be displayed.title
- The title of the information dialog.public void inform(java.lang.String message)
message
- The message to be displayed.public java.lang.String prompt(java.lang.String message, java.lang.String initialText, java.lang.String title)
message
- The prompt to be displayed.initialText
- The initial text to be displayed in the text input field.title
- The title of the input dialog.null
value but possibly
zero-length. Otherwise, it returns a value of null
.public java.lang.String prompt(java.lang.String message, java.lang.String initialText)
prompt
(message, initialText, getName
())
.message
- The prompt to be displayed.initialText
- The initial text to be displayed in the text input field.null
value but possibly
zero-length. Otherwise, it returns a value of null
.public java.lang.String prompt(java.lang.String message)
prompt
(message, "", getName
())
.message
- The prompt to be displayed.null
value but possibly
zero-length. Otherwise, it returns a value of null
.public boolean question(java.lang.String message, java.lang.String title)
message
- The question message to be displayed.title
- The title of the question message dialog.boolean
value of true
when the Yes button is pressed. Otherwise,
it returns a value of false
.public boolean question(java.lang.String message)
Yes
and
No buttons. Equivalent to
question
(message, getName
())
.message
- The question message to be displayed.boolean
value of true
when the Yes button is pressed. Otherwise,
it returns a value of false
.public void warning(java.lang.String message, java.lang.String title)
message
- The message to be displayed.title
- The title of the warning dialog.public void warning(java.lang.String message)
message
- The message to be displayed.public void printStackTrace(java.lang.Throwable t, java.io.PrintWriter writer)
t
- The throwable whose backtrace is desired.writer
- The PrintWriter to use for output.public void printStackTrace(java.lang.Throwable t)
t
- The throwable whose backtrace is desired.public void dumpStack(java.io.PrintWriter writer)
writer
- The PrintWriter to use for output.public void dumpStack()
public IPlugletMessageDialog getDialog()
IPlugletMessageDialog
implementation.public void setDialog(IPlugletMessageDialog dialog)
IPlugletMessageDialog
implementation.public java.lang.Object executePluglet(java.lang.Class plugletClass, java.lang.String[] plugletArgs) throws java.lang.Throwable
plugletClass
- The pluglet.plugletArgs
- The arguments to pass to the pluglet.null
.PlugletException
- Thrown when the main entry point does not exist.java.lang.Throwable
- Thrown when the execution of the pluglet throws an unhandled
exception. The exception is propagated to the caller of
executePluglet.public java.lang.Object executePluglet(java.lang.Class plugletClass) throws java.lang.Throwable
plugletClass
- The pluglet.null
.PlugletException
- Thrown when the main entry point does not exist.java.lang.Throwable
- Thrown when the execution of the pluglet throws an unhandled
exception. The exception is propagated to the caller of
executePluglet.public java.lang.Object executePluglet(java.lang.Class plugletClass, java.lang.String plugletArg) throws java.lang.Throwable
plugletClass
- The pluglet.plugletArg
- The argument to pass to the pluglet.null
.PlugletException
- Thrown when the main entry point does not exist.java.lang.Throwable
- Thrown when the execution of the pluglet throws an unhandled
exception. The exception is propagated to the caller of
executePluglet.public java.lang.Object executePluglet(java.lang.Class plugletClass, java.lang.String plugletArg1, java.lang.String plugletArg2) throws java.lang.Throwable
plugletClass
- The pluglet.plugletArg1
- The first argument to pass to the pluglet.plugletArg2
- The second argument to pass to the pluglet.null
.PlugletException
- Thrown when the main entry point does not exist.java.lang.Throwable
- Thrown when the execution of the pluglet throws an unhandled
exception. The exception is propagated to the caller of
executePluglet.