public class ALDOperatorParameterPanel extends ALDParameterPanelParent
Modifier and Type | Class and Description |
---|---|
private static class |
ALDOperatorParameterPanel.ParameterType
Types of parameters appearing in Alida's operator concept.
|
Modifier and Type | Field and Description |
---|---|
private Parameter.ExpertMode |
displayMode
Mode for displaying parameters.
|
private static String |
headerOptionalParamsPanel
Title string for the panel with optional parameters.
|
private static String |
headerRequiredParamsPanel
Title string for the panel with required parameters.
|
private static String |
headerSupplementalParamsPanel
Title string for the panel with supplemental parameters.
|
private static org.slf4j.Logger |
logger
Slf4j logger.
|
private JPanel |
mainPanel
Main panel containing all operator parameters.
|
private ALDOperator |
operator
The operator associated with this panel.
|
private LinkedList<ALDOpParameterDescriptor> |
opParamDescrips
List of all parameter descriptors associated with the operator.
|
private ALDParameterPanel |
panelOptionalParams
Sub-panel managing the configuration of optional parameters.
|
private ALDParameterPanel |
panelRequiredParams
Sub-panel managing the configuration of required parameters.
|
private ALDParameterPanel |
panelSupplementalParams
Sub-panel managing the configuration of supplemental parameters.
|
protected ALDOperatorControlFrame |
parentFrame
Reference to the control frame linked to this panel.
|
private boolean |
topLevelCall
Flag indicating if panel is used on top level or not.
|
listenerList
Constructor and Description |
---|
ALDOperatorParameterPanel(ALDOperator op,
Parameter.ExpertMode mode,
boolean topLevel,
ALDSwingValueChangeListener listener)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
changeViewMode(Parameter.ExpertMode mode)
Switches view mode of the panel.
|
void |
copyConfiguration(ALDOperatorParameterPanel opParameterPanel)
TODO Function should usually not be required...
|
private ALDParameterPanel |
createInParameterPanel(Boolean useRequired,
Boolean useSupplemental,
String panelTitle)
Create a panel with an entry for each input parameter as requested.
|
void |
disableComponents()
Disables all components in the different sub-panels.
|
void |
dispose()
Disposes all components in the different sub-panels.
|
void |
enableComponents()
Enables all components in the different sub-panels.
|
JPanel |
getJPanel()
Get access to the main panel.
|
private LinkedList<ALDOpParameterDescriptor> |
getParameterDescriptors(ALDOperatorParameterPanel.ParameterType type)
Gets all the parameter descriptors of the given type.
|
protected Object |
getParameterValue(boolean isRequired,
boolean isSupplemental,
ALDParameterDescriptor descr)
Get the current value for a paramter.
|
void |
handleValueChangeEvent(ALDSwingValueChangeEvent event)
Method which is called on event occurence.
|
private void |
initPanel()
Inits the panel according to formerly specified descriptors.
|
HashMap<ALDOpParameterDescriptor,String> |
readGUIParameterValues()
Retrieve parameter values from GUI and configure operator accordingly.
|
HashMap<ALDOpParameterDescriptor,String> |
setNewOperator(ALDOperator op)
Sets a new operator for the panel.
|
private boolean |
setOperatorParameter(String paramName)
Retrieve parameter value from GUI and configure operator.
|
boolean |
setParameterBatchModeInput(String paramName) |
boolean |
setParameterLinked(String paramName,
String sourceOp,
String sourceParamName)
Changes panel for a parameter to indicate that it is linked.
|
boolean |
setParameterNotLinked(String paramName)
Changes panel for a parameter to indicate that it is not linked anymore.
|
void |
setParentFrame(ALDOperatorControlFrame pf)
Configure parent frame in which given one is embedded.
|
void |
updateConfigurationStatus(Collection<String> missingParams)
Marks configurations status of required parameters by color.
|
private void |
updateOperatorParameterDescriptors()
Updates the set of parameter descriptors.
|
private void |
updateParameterPanels()
Initializes all internal members dealing with operator descriptors.
|
private HashMap<ALDOpParameterDescriptor,String> |
updateParameterValues()
Updates panel according to values in currently given operator.
|
HashMap<ALDParameterDescriptor,String> |
validateOperatorParameters(boolean deepValidate)
Check if operator is ready to run.
|
addValueChangeEventListener, fireALDSwingValueChangeEvent, removeValueChangeEventListener
private static org.slf4j.Logger logger
private static final String headerRequiredParamsPanel
private static final String headerOptionalParamsPanel
private static final String headerSupplementalParamsPanel
private JPanel mainPanel
private ALDOperator operator
protected ALDOperatorControlFrame parentFrame
private boolean topLevelCall
Using the panel on top-level refers to usage with operators directly executed, while non-top-level use refers to usage with operators passed as parameters to other operators. In the second case no deep validation is done, i.e. required parameters are allowed to have null values.
private LinkedList<ALDOpParameterDescriptor> opParamDescrips
private ALDParameterPanel panelRequiredParams
private ALDParameterPanel panelOptionalParams
private ALDParameterPanel panelSupplementalParams
private Parameter.ExpertMode displayMode
In standard mode the view is restricted to parameters annotated as standard, in advanced mode all annotated parameters of the operator are displayed in the GUI.
public ALDOperatorParameterPanel(ALDOperator op, Parameter.ExpertMode mode, boolean topLevel, ALDSwingValueChangeListener listener)
Note that value change event listeners added after construction of the object might will events generated during initialization. To avoid that a listener can be handed over to the object upon creation.
op
- Operator associated with this panel.mode
- Display mode of the panel.topLevel
- If true, a top-level context is assumed.listener
- Optional value change event listener.private void initPanel()
private ALDParameterPanel createInParameterPanel(Boolean useRequired, Boolean useSupplemental, String panelTitle)
The latter is determined via useRequired
and
useSupplemental
.
useRequired
- If non-null only parameters with a required flag are used; if
null the required flag is ignored.useSupplemental
- If non-null use only parameters with supplemental flag,
otherwise supplemental flag is ignored.panelTitle
- Title string to be shown at the top of the panel.private void updateOperatorParameterDescriptors()
Note that the set of descriptors of an operator is not static, but might change due to dynamic parameter modifications by callback functions.
private HashMap<ALDOpParameterDescriptor,String> updateParameterValues()
private void updateParameterPanels()
private LinkedList<ALDOpParameterDescriptor> getParameterDescriptors(ALDOperatorParameterPanel.ParameterType type)
type
- Type of descriptors to be returned.private boolean setOperatorParameter(String paramName)
paramName
- Name of the parameter value to retrieve.protected Object getParameterValue(boolean isRequired, boolean isSupplemental, ALDParameterDescriptor descr)
Usually the value of a parameter is fetched directly from the operator itself. However, sometimes values depend on the system state or are taken from external devices (database, GUI). This method allows to customize the reading of parameter values and is intended to be overriden by sub-classes.
getParameterValue
in class ALDParameterPanelParent
isRequired
- Should be true, if parameter is required.isSupplemental
- Should be true, if parameter is required.descr
- Parameter descriptor in question.public HashMap<ALDOpParameterDescriptor,String> readGUIParameterValues()
public JPanel getJPanel()
public void setParentFrame(ALDOperatorControlFrame pf)
pf
- Reference to the parent frame.public boolean setParameterLinked(String paramName, String sourceOp, String sourceParamName)
paramName
- Name of the parameter.sourceOp
- Source node from where the edge originates.sourceParamName
- Name of the source parameter.public boolean setParameterNotLinked(String paramName)
paramName
- Name of the parameter.public boolean setParameterBatchModeInput(String paramName)
public HashMap<ALDOpParameterDescriptor,String> setNewOperator(ALDOperator op) throws ALDDataIOProviderException
This function is, e.g., called in case of loading a new operator from file.
op
- New operator object to be associated with GUI.ALDDataIOProviderException
public void updateConfigurationStatus(Collection<String> missingParams)
A required parameter which is neither properly configured nor has an incoming edge is gets a red label, all others get black labels.
public void changeViewMode(Parameter.ExpertMode mode)
mode
- Desired view mode.public void disableComponents()
public void enableComponents()
public void dispose()
public HashMap<ALDParameterDescriptor,String> validateOperatorParameters(boolean deepValidate) throws ALDOperatorException
The operator can be run if all GUI elements of required parameters return non-null values, and if furtheron the operator's validate() method returns true.
deepValidate
- True if operator has to be validate itself.ALDOperatorException
public void handleValueChangeEvent(ALDSwingValueChangeEvent event)
ALDSwingValueChangeListener
event
- Event to be handled.public void copyConfiguration(ALDOperatorParameterPanel opParameterPanel) throws ALDDataIOException
opLink
- b
- ALDDataIOException
Copyright © 2010–2021 Martin Luther University Halle-Wittenberg, Institute of Computer Science, Pattern Recognition and Bioinformatics. All rights reserved.