Class FWAbstractFunctionality
java.lang.Object
java.lang.Thread
net.simplace.pipe.functionality.FWAbstractFunctionality
- All Implemented Interfaces:
Runnable
- Direct Known Subclasses:
BrowserFunctionality, EditXMLFunctionality, FormFunctionality, PDFViewerFunctionality, PipeLineFunctionality, RuleFunctionality, ShowImageFunctionality, SimEnvGraphFunctionality
Base class of functionalities, the functions of the GUI framework. A functionality is instantiated by class
name via
FWFunctionalityFactory from a FWFunctionalityModel; startFunctionality() is
called whenever it is run.
The parameters of the function element and the parameters passed along the chain of functions are handled here; implementations have access to the main frame and the selected tab of the tab view.
- Author:
- Andreas Enders
-
Nested Class Summary
Nested classes/interfaces inherited from class Thread
Thread.Builder, Thread.State, Thread.UncaughtExceptionHandler -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringparameter set by the client controller when it runs a function:DIRECTION_NEXTorDIRECTION_BACKstatic final Stringvalue ofDIRECTION: the function was reached going backstatic final Stringvalue ofDIRECTION: the function was reached going forwardFields inherited from class Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedProtected default constructor, used for instantiation by class name. -
Method Summary
Modifier and TypeMethodDescriptionprotected org.jdom2.ElementgetID()Collection<org.jdom2.Element> protected StringgetLocaleValue(String aKey) Reads a localised text with the prefix of the layout provider plusSYSTEM_ID.net.simplace.core.FWObservablegetOID()getParameter(String aKey) booleanprotected voidinitialize(Map<String, Object> aParameterMap) Initialises the functionality with parameters only (no function model).protected voidinitialize(FWFunctionalityModel aFunctionModel) Initialises the functionality with its model; the initial parameters are taken from the model.voidrun()Thread entry: callsstartFunctionality(); errors are logged.net.simplace.core.FWObservableRuns the functionality: in its own thread if the parameterown_threadistrue, otherwise synchronously.voidsetCenterPanel(JPanel aCenterPanel) voidsetObservable(net.simplace.core.FWObservable aOservable) Sets the parameters; the initial parameters are added (and overwrite existing ones).voidsetOutputParameter(String aKey, Object aValue) protected voidsetRunningThread(Thread aCurrentThread) booleanEvaluates the attributeifof the function (seeFWPipeLineHelper.checkIfExpression(String, FWObservable)).protected abstract voidImplements the function; called whenever the functionality is run.booleanInterrupts the current thread if it is still running, and this functionality's thread.org.jdom2.ElementtoXML()Methods inherited from class Thread
activeCount, checkAccess, clone, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, isVirtual, join, join, join, join, ofPlatform, ofVirtual, onSpinWait, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, sleep, start, startVirtualThread, stop, threadId, toString, yield
-
Field Details
-
DIRECTION
parameter set by the client controller when it runs a function:DIRECTION_NEXTorDIRECTION_BACK- See Also:
-
DIRECTION_NEXT
-
DIRECTION_BACK
-
-
Constructor Details
-
FWAbstractFunctionality
protected FWAbstractFunctionality()Protected default constructor, used for instantiation by class name.
-
-
Method Details
-
initialize
-
initialize
Initialises the functionality with its model; the initial parameters are taken from the model.- Parameters:
aFunctionModel- the function model
-
startFunctionality
-
getFunctionElement
protected org.jdom2.Element getFunctionElement()- Returns:
- the function element of the model
-
runFunctionality
Runs the functionality: in its own thread if the parameterown_threadistrue, otherwise synchronously.- Returns:
- the parameters after the run; when run in its own thread, the current parameters (possibly
null) are returned immediately - Throws:
Exception- if the synchronous run fails
-
run
public void run()Thread entry: callsstartFunctionality(); errors are logged. -
getID
- Returns:
- id of the function, or
nullwithout function model
-
getSystemID
- Returns:
- id of the system the function belongs to (the function id if none is set)
-
getOID
- Returns:
- unique object id of this functionality instance, or
nullwithout function model (created with a parameter map)
-
getStringParameterValue
-
getParameter
-
getMainFrame
- Returns:
- MainFrame of application
-
getMainComponent
- Returns:
- selected tab panel of TabView
-
getObservable
public net.simplace.core.FWObservable getObservable()- Returns:
- the parameters passed along the chain of functions (created from the initial parameters on first call)
-
getNextFunction
- Returns:
- id of the next function (attribute
nextFunction, tokens replaced), ornull(also without function model)
-
getPreviousFunction
- Returns:
- id of the previous function (attribute
previousFunction, tokens replaced), ornull(also without function model)
-
shouldFunctionBeRun
Evaluates the attributeifof the function (seeFWPipeLineHelper.checkIfExpression(String, FWObservable)).- Returns:
trueif the function should be run (always without function model)- Throws:
PipeLineException- declared, not thrown
-
setOutputParameter
-
setObservable
public void setObservable(net.simplace.core.FWObservable aOservable) Sets the parameters; the initial parameters are added (and overwrite existing ones).- Parameters:
aOservable- the new parameters
-
getLocaleValue
-
stopThread
public boolean stopThread()Interrupts the current thread if it is still running, and this functionality's thread.- Returns:
trueif a current thread was set,falseotherwise
-
setRunningThread
- Parameters:
aCurrentThread- the thread running the function
-
hasInfoElements
public boolean hasInfoElements()- Returns:
trueif the function element hasinfochildren (falsewithout function model)
-
getInfoElements
- Returns:
- the
infochildren of the function element (empty without function model)
-
getCenterPanel
- Returns:
- center Panel
-
setCenterPanel
- Parameters:
aCenterPanel- the center panel of the function
-
getCurrentThread
- Returns:
- the current Thread
-
toXML
public org.jdom2.Element toXML()- Returns:
- an XML description of this functionality; not implemented, always
null
-