public class GCommandLauncher extends GContainer implements GDisplay, GListener
GJavaCommandLauncher
is better adapted to
launch java processes). The class takes into account the processes termination during the MMI
application closure. Program execution progress may be observed via an object
GProgressBar
provided by object GCommandLauncher.Index | Class | Item | Constraint |
0 | GExecButton | execButton | "newline" |
1 | GProgressBar | progressBar | "newline" |
2 | GExecMenuItem | execMenuItem | "newline" |
3 | GBufferedTextArea | bufferedTextArea | "newline" (see table below) |
Index | Class | Item | Constraint |
3, 0 | GEntryInt | currentPageEntry | 3, 0, 0, 0
=> "newline , split 7 , alignx Right" 3, 0, 0, 1 => (null) 3, 0, 1 => "gapleft 4 , gapright 4 , gaptop 4 , gapbottom 4 , wmin 50 , wmax 50" |
3, 1 | GLabel | totalPageNumberLabel | "gapleft 4 , gapright 4 , gaptop 4 , gapbottom 4 , wmin 50" |
3, 2 | GButton | prevPageButton | (null) |
3, 3 | GButton | nextPageButton | (null) |
3, 4 | GToggleButton | realtimeButtton | (null) |
3, 5 | GTextArea | textArea | "newline , pushx , pushy , growx , growy" |
Modifier and Type | Class and Description |
---|---|
class |
GCommandLauncher.GCommandShutdownHookThread
Hook that will be called to terminate the process and the associated treads in case the
applications quit without closing the application.
|
class |
GCommandLauncher.GExecButton
Class representing a button linked to the GCommandLauncher.
|
class |
GCommandLauncher.GExecMenuItem
Class representing a menu item linked to the GCommandLauncher.
|
static class |
GCommandLauncher.ProcessStatus
Status of the underlying process.
|
GComponent.CopyPasteOperation, GComponent.DisplayIndicatorStatus, GComponent.ItemType, GComponent.Operation
NAME_ATTRIBUTE
Constructor and Description |
---|
GCommandLauncher(String[] commandArray,
String runString,
String stopString)
Constructor.
|
GCommandLauncher(String[] commandArray,
String runString,
String stopString,
GTextAreaInterface stdoutTextArea)
Constructor.
|
GCommandLauncher(String[] commandArray,
String runString,
String stopString,
GTextAreaInterface stdoutTextArea,
GTextAreaInterface stderrTextArea)
Constructor.
|
GCommandLauncher(String widgetId,
String[] commandArray,
String runString,
String stopString)
Constructor.
|
GCommandLauncher(String widgetId,
String[] commandArray,
String runString,
String stopString,
GTextAreaInterface stdoutTextArea)
Constructor.
|
GCommandLauncher(String widgetId,
String[] commandArray,
String runString,
String stopString,
GTextAreaInterface stdoutTextArea,
GTextAreaInterface stderrTextArea)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
after(GEvent e)
Called after the event is processed.
|
void |
before(GEvent e)
Called before the event is processed.
|
protected void |
clearProcessExitDetector()
Nullify the process exit detector when it is not needed anymore.
|
void |
display()
Called when the element is to be displayed, so it can perform the actions required for its display, and
the display of its inmmediate descendants.
|
void |
generic()
The prototype of the generic function that shall exist in all the descendants.
|
int |
getExitCode()
Gets the return code of the program.
|
GCommandLauncher.GExecButton |
getGExecButton()
Get the GExecButton associated with the command launcher.
|
GCommandLauncher.GExecMenuItem |
getGExecMenuItem()
Get the GExecMenuItem associated with the command launcher.
|
GProgressBar |
getGProgressBar()
Get the GProgressBar associated with the command launcher.
|
boolean |
getInhibited()
Return the inhibits status
|
GCommandLauncher.ProcessStatus |
getProcessStatus()
Get the status of the process.
|
boolean |
getResetTextAreaInterfaceOnRun()
Get if the textAreaInterface shall be reset before each run.
|
GTextAreaInterface |
getStderrGTextAreaInterface()
Get the GTextAreaInterface associated with the command launcher stderr.
|
GTextAreaInterface |
getStdoutGTextAreaInterface()
Get the GTextAreaInterface associated with the command launcher stdout.
|
GComponent |
getSubComponent(int position)
Gets the subcomponent occupying the position defined by position.
|
boolean |
isCopyOutputToStdout()
Get if the stdout of the subprocess shall be copied to the stdout.
|
boolean |
isRunning()
Returns if the process is running.
|
void |
launchStop()
Launch or stop the process.
|
protected void |
processFinished()
Method called by the GProcessExitDetector when the process finishes.
|
protected void |
processFinishedInvokeLater()
Executes the processFinished method in the event loop through a runnable.
|
void |
setButtonIcons(ImageIcon runIcon,
ImageIcon stopIcon)
Set the run and stop icons from the provided images.
|
void |
setButtonIcons(int size)
Set the run and stop icons from the default images contained in GIcon.
|
void |
setButtonIcons(String runIconName,
String stopIconName)
Set the run and stop icons from the default images paths runIconName and stopIconName.
|
void |
setCommandLine(String[] commandLine)
Set the command line from the derived classes.
|
void |
setCopyOutputToStdout(boolean copyOutputToStdout)
Set if the stdout of the subprocess shall be copied to the stdout.
|
protected void |
setDefaultConstraints()
Set default constraints.
|
void |
setEnabled(boolean flag)
Set the enable status of the component.
|
void |
setInhibited(boolean inhibited)
Inhibits the launch and stop of the process, the inhibition is reseted after the processing
of the event.
|
void |
setMenuIcons(ImageIcon runIcon,
ImageIcon stopIcon)
Set the run and stop icons from the provided images.
|
void |
setMenuIcons(int size)
Set the run and stop icons from the default images contained in GIcon.
|
void |
setMenuIcons(String runIconName,
String stopIconName)
Set the run and stop icons from the default images paths runIconName and stopIconName.
|
void |
setResetTextAreaInterfaceOnRun(boolean resetTextAreaInterfaceOnRun)
Set if the textAreaInterface shall be reset before each run.
|
protected void |
setState(fr.cnes.genius.threads.GCommandLauncher.State state)
Set the state of the button and menu icons, changing their icons and strings.
|
void |
setStringConstraint(String constraint)
Set the constraint in string format for the component.
|
put
activateConstraintsByType, attachCopyPasteMenu, attachCopyPasteMenu, beginOfElement, beginOfElement, beginOfElement, beginOfElement, clearAllInnerDescendantConstraint, clearConstraint, clearInnerDescendantContraint, composeWidgetId, doDisplay, endOfElement, getCommentInConfigFile, getComponent, getConstraint, getCurrentOperation, getDisplayIndicatorStatus, getDisplayIsModifiedIndicator, getElement, getGClassName, getGPanel, getGParent, getGUnitInConfigFile, getInnerDescendantConstraint, getName, getNameInConfigFile, getOperationSaveValue, getPathInConfigFile, getSimpleWidgetId, getStatus, getStringConstraint, getWidgetId, handleCopyPasteEvent, handleCopyPasteEvent, handleProcessEventException, isCopyPasteEvent, isEnabled, isForcedStatus, isModified, launchInvalidPositionException, mouseWheelMoved, parseSimpleConstraint, processGEvent, processMouseWheelEvent, setBusyCursor, setCommentInConfigFile, setConstraint, setCopyPasteMenuEnabled, setCurrentOperation, setDataForConstraintsByType, setDisplayIsModifiedIndicator, setElement, setForcedStatus, setGPanel, setGParent, setGUnitInConfigFile, setInnerDescendantConstraint, setName, setNameAndCommentInConfigFile, setNameInConfigFile, setPathInConfigFile, setStatus, setToolTipText, setWidgetId, setWidth, setWindowBusyCursor, updateIsModifiedIndicator, writeCollection, writeCollection, writeCollection, writeCollection, writeConfigItem, writeConfigItem, writeConfigItem, writeConfigItem, writeConfigItem
public GCommandLauncher(String[] commandArray, String runString, String stopString)
commandArray
- line of the program to launch when the exec() method is called.runString
- string to display in the menu and the button when the process is not
running.stopString
- string to display in the menu and the button when the process is running.public GCommandLauncher(String[] commandArray, String runString, String stopString, GTextAreaInterface stdoutTextArea)
commandArray
- line of the program to launch when the exec() method is called.runString
- string to display in the menu and the button when the process is not
running.stopString
- string to display in the menu and the button when the process is running.stdoutTextArea
- where the output stream from the underlying process are sent. If it is
null both streams are sent to the standard output of the IHM. If the textArea is not a
descendant of GComponent a runtime exception is thrown.public GCommandLauncher(String[] commandArray, String runString, String stopString, GTextAreaInterface stdoutTextArea, GTextAreaInterface stderrTextArea)
commandArray
- line of the program to launch when the exec() method is called.runString
- string to display in the menu and the button when the process is not
running.stopString
- string to display in the menu and the button when the process is running.stdoutTextArea
- where the output stream from the underlying process are sent. If it is
null both streams are sent to the standard output of the IHM. If the textArea is not a
descendant of GComponent a runtime exception is thrown.stderrTextArea
- where the error stream from the underlying process are sent. If it is
null both streams are sent to the standard output of the IHM. If the textArea is not a
descendant of GComponent a runtime exception is thrown.public GCommandLauncher(String widgetId, String[] commandArray, String runString, String stopString)
widgetId
- widget identifier.commandArray
- line of the program to launch when the exec() method is called.runString
- string to display in the menu and the button when the process is not
running.stopString
- string to display in the menu and the button when the process is running.public GCommandLauncher(String widgetId, String[] commandArray, String runString, String stopString, GTextAreaInterface stdoutTextArea)
widgetId
- widget identifier.commandArray
- line of the program to launch when the exec() method is called.runString
- string to display in the menu and the button when the process is not
running.stopString
- string to display in the menu and the button when the process is running.stdoutTextArea
- where the output and error streams from the underlying process are
sent. If it is null both streams are sent to the standard output of the IHM. If the
textArea is not a descendant of GComponent a runtime exception is thrown.public GCommandLauncher(String widgetId, String[] commandArray, String runString, String stopString, GTextAreaInterface stdoutTextArea, GTextAreaInterface stderrTextArea)
widgetId
- widget identifier.commandArray
- line of the program to launch when the exec() method is called.runString
- string to display in the menu and the button when the process is not
running.stopString
- string to display in the menu and the button when the process is running.stdoutTextArea
- where the output stream from the underlying process are sent. If it is
null both streams are sent to the standard output of the IHM. If the textArea is not a
descendant of GComponent a runtime exception is thrown.stderrTextArea
- where the error stream from the underlying process are sent. If it is
null both streams are sent to the standard output of the IHM. If the textArea is not a
descendant of GComponent a runtime exception is thrown.protected void setDefaultConstraints()
GComponent
setDefaultConstraints
in class GComponent
public void setCommandLine(String[] commandLine)
commandLine
- new command line.protected void clearProcessExitDetector()
public GCommandLauncher.GExecMenuItem getGExecMenuItem()
public GCommandLauncher.GExecButton getGExecButton()
public GProgressBar getGProgressBar()
public GTextAreaInterface getStdoutGTextAreaInterface()
public GTextAreaInterface getStderrGTextAreaInterface()
public int getExitCode()
public boolean isRunning()
public GCommandLauncher.ProcessStatus getProcessStatus()
public void launchStop()
protected void processFinishedInvokeLater()
protected void processFinished()
public void before(GEvent e) throws GException
GListener
before
in interface GListener
e
- event to processed.GException
- in case there is a problem managing the event.public void setEnabled(boolean flag)
GComponent
setEnabled
in class GComponent
flag
- new enable status of the component.public void after(GEvent e) throws GException
GListener
after
in interface GListener
e
- processed event.GException
- in case there is a problem managing the event.public void generic() throws GException
GContainer
generic
in class GContainer
GException
- In case of problem.protected void setState(fr.cnes.genius.threads.GCommandLauncher.State state)
state
- new state of the menu and button.public void setInhibited(boolean inhibited)
inhibited
- if the launch and stop of the process, the inhibition is reseted after the
processing of the event.public void setButtonIcons(int size) throws GException
size
- of the icons.GException
- in case of problem loading the icons.public void setButtonIcons(String runIconName, String stopIconName)
runIconName
- name of the file containing the run icon.stopIconName
- name of the file containing the stop icon.public void setButtonIcons(ImageIcon runIcon, ImageIcon stopIcon)
runIcon
- run icon object.stopIcon
- stop icon object.public void setMenuIcons(int size) throws GException
size
- of the icons.GException
- in case of problem loading the icons.public void setMenuIcons(String runIconName, String stopIconName)
runIconName
- name of the file containing the run icon.stopIconName
- name of the file containing the stop icon.public void setMenuIcons(ImageIcon runIcon, ImageIcon stopIcon)
runIcon
- run icon object.stopIcon
- stop icon object.public void display() throws GException
GDisplay
display
in interface GDisplay
GException
- in case of problem while reading the value from file.public void setStringConstraint(String constraint)
setStringConstraint
in class GComponent
constraint
- constraint in string format to set for the component.public GComponent getSubComponent(int position) throws GComponentException
getSubComponent
in class GComponent
position
- position of the requested component.GComponentException
- in case the position argument is invalid.public void setCopyOutputToStdout(boolean copyOutputToStdout)
copyOutputToStdout
- true if the subprocess output shall be copied to the stdout, false
otherwise.public boolean isCopyOutputToStdout()
public void setResetTextAreaInterfaceOnRun(boolean resetTextAreaInterfaceOnRun)
resetTextAreaInterfaceOnRun
- true if textAreaInterface shall be reset before each run,
false otherwise.public boolean getResetTextAreaInterfaceOnRun()
public boolean getInhibited()
Copyright © 2024. All rights reserved.