org.keridwen.modelling.group.editor.app
Class GroupsTreeEditor

java.lang.Object
  extended by org.keridwen.modelling.group.editor.app.GroupsTreeEditor
All Implemented Interfaces:
ActionListener, EventListener

public class GroupsTreeEditor
extends Object
implements ActionListener

General Groups Editor. This editor can be used as stand alone application as well as Keridwen component.
A typical instantiation scheme can be:

 GroupsTreeEditor groupTreeEditor = new GroupsTreeEditor();
 
To recover the GUI elements:
 grpEditorGUI.getMainPanel()
 
To load a mesh and initialise the group tree and related 3D pipelines.
 selectionGroupsTree.updateTree(groupList);
 grpToVtkConverter.setMesh(theMeshIn);
 grpEditorGUI.showGroupsIn3D(grpToVtkConverter);
 
To convert attributed properties into DataFields:
 deployProperties();
 
The generated DataFields can be recovered from the DataSetManager generated by the mapper, as follow:
 getMapper().getOutputDataFieldManager()
 

Author:
J.Forest, Artenum SARL.

Constructor Summary
GroupsTreeEditor(com.artenum.frida.processing.PropertyTypesFilter propertiesTypesFilterIn, com.artenum.frida.processing.GroupOperatorTypeFilter operatorTypesFilter)
          Basic constructor.
GroupsTreeEditor(com.artenum.frida.processing.PropertyTypesFilter propertiesTypesFilterIn, com.artenum.frida.processing.GroupOperatorTypeFilter operatorTypesFilter, boolean isVtkAvailableIn)
          Main constructor.
 
Method Summary
 void actionPerformed(ActionEvent evt)
           
 void addGroupOperator(String operatorKeyName, com.artenum.frida.interfaces.GroupOperatorInterface groupOperator)
          Add a group operator to the present tree group editor.
 void addPropertyValidator(String validatorName, com.artenum.frida.processing.DefaultPropertyValidator validator)
          Add a property validator in the central table.
 void buildNewConsole()
          Generate a new JyConsole.
 void cleanUpPropertyAndCharacteristicIds(com.artenum.frida.interfaces.PropertyInterface propIn)
          Clean-up the Properties and Characteristic list.
 com.artenum.penelope.field.DataFieldManager deployDataFieldAction()
          Perform the properties deployments (mapping) action.
 com.artenum.penelope.field.DataFieldManager deployProperties()
          Deploy the properties as DataFiels according the group/Properties attributions
 void exportDataFieldsToVtkDataSet(com.artenum.penelope.field.DataFieldManager dataFieldManager, File outputDir)
          Export all DataFields gathered in the given DataFieldManager into VtkDataSet.
 void exportDataFieldToVtkAction()
          Perform the DataField export to VtkDataSet action.
static void exportMappedPropertiesToDataFields(com.artenum.penelope.field.DataFieldManager mappedPropertiesManager, File outputDir)
          Export the DataFields generated from the mapping of Properties and stored into the given DataFieldManager into vtkDataSet and write them on files.
 com.artenum.penelope.field.DataFieldManager getCentralDataFieldManager()
          Get the central output DataFieldManager, shared by the Characteristic Mapper and the various GroupOperators.
 String getDefaultPropertyValidator()
           
 com.artenum.frida.group.OrderedGroupList getGroupList()
          Get the group list.
 com.artenum.frida.interfaces.GroupOperatorInterface getGroupOperator(String operatorKeyName)
          Get the group operator for the given key-name.
 com.artenum.frida.processing.CharacteristicsToDataFieldsMapper getMapper()
          Get the mapping filter, used to deploy the Properties on Groups to DataFields.
 com.artenum.penelope.mesh.interfaces.Mesh getMesh()
          Get the loaded mesh.
 com.artenum.frida.processing.DefaultPropertyValidator getPropertyValidator(String validatorName)
          Get the PropertyValidtor for the given key name.
 ImprovedSelectionTree getSelectionGroupsTree()
          Get the selection tree for the groups.
 GroupsTreeEditorView getView()
          Get the GUI of this editor.
 void init3DComponents(boolean isVtkAvailableIn)
          Initialise the 3D viewer, if the VTK context is correctly loaded.
 com.artenum.frida.group.OrderedGroupList loadAndUpdateGroupsList(File inputFile, com.artenum.frida.group.OrderedGroupList meshGroupsList, DefaultGroupsListValidator listValidator)
          Load the OrderedGroupsList from the given file.
 void loadAndUpdateGroupsListAction()
          Open a file chooser to load a group List from a file, call a validator and load the groups list.
 void loadDefaultSettings()
          Load the default settings of the application (i.e Java properties).
 void loadGroupListFile(File selectedFile)
          Load group list from .xml file.
 com.artenum.penelope.mesh.interfaces.Mesh loadMesh(String fileInPath)
          Load the mesh and the corresponding group list.
 void loadMeshandInitModelAction()
          Performs the action of the mesh loading (from a selected file) and initialisation of the model (tree and 3D view).
 com.artenum.frida.properties.PropertiesList loadNascapMaterialCataLog(File inputDir)
          Load a NASCAP properties.
 void loadNascapMaterialsAction()
          Perform the action to load a given NASCAP material catalog.
 com.artenum.frida.properties.PropertiesList loadPropertiesCataLog(File inputDir)
          Load a catalog of properties.
 com.artenum.frida.properties.PropertiesList loadPropertiesCataLog(File inputDir, com.artenum.frida.processing.DefaultPropertyValidator validator)
          Load the given properties catalog according to the properties-to-group-types validator.
 void loadPropertiesCatalogAction()
          Performs the loading action of Properties Catalog.
static void main(String[] args)
          To be run as standalone application.
 void moveDown()
          Move the priority of the selected group down.
 void moveUp()
          Move the priority of the selected group up.
 void resetModelAndUpdateView()
          Reset the model and update the view.
 void resetPropertyValidatorMap()
          Reset (i.e remove all loaded elements) of the central PropertyValidators.
 void saveDataFieldsToXML(com.artenum.penelope.field.DataFieldManager dataFieldManager, String meshPath, File outputDir)
          Save the DataFields of the given DataSetManager into the Penelope XML format.
 void saveDataFieldToXMLAction()
          Perform the DataField saving action to Penelope's XML format.
 void saveDefaultSettings(String settingKey)
          Sate the global settings of the application.
 void saveGroupsList(File ouputFile)
          Save the GroupsList into the given file.
 void saveGroupsListAction()
          Open a save file chooser and save the group list.
 void setCentralDataFieldManager(com.artenum.penelope.field.DataFieldManager centralDataFieldManager)
          Set the central output DataFieldManager, shared by the Characteristic Mapper and the various GroupOperators.
 void setDefaultPropertyValidator(String defaultPropertyValidator)
           
 void setGroupList(com.artenum.frida.group.OrderedGroupList groupList)
          Set the group list.
 void setGroupListAndUpdateModels(com.artenum.frida.group.OrderedGroupList groupList)
          Set the group list, update all related models (i.e tree and mapper) and expands groups nodes having properties in the tree.
 void setMapper(com.artenum.frida.processing.CharacteristicsToDataFieldsMapper mapper)
          Set the mapping filter, used to deploy the Properties on Groups to DataFields.
 void setMesh(com.artenum.penelope.mesh.interfaces.Mesh mesh)
          Set the Mesh of support containing the MeshMasks corresponding to the groups
 void setSelectionGroupsTree(ImprovedSelectionTree selectionGroupsTree)
          Set the selection tree for the groups.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GroupsTreeEditor

public GroupsTreeEditor(com.artenum.frida.processing.PropertyTypesFilter propertiesTypesFilterIn,
                        com.artenum.frida.processing.GroupOperatorTypeFilter operatorTypesFilter)
Basic constructor. This constructor instantiates the class in a degraded mode, without VTK 3D view. Use the @see GroupsTreeEditor(PropertyTypesFilter propertiesTypesFilterIn, GroupOperatorTypeFilter operatorTypesFilter, boolean isVtkAvialableIn) constructor instead if you want to use the 3D view.


GroupsTreeEditor

public GroupsTreeEditor(com.artenum.frida.processing.PropertyTypesFilter propertiesTypesFilterIn,
                        com.artenum.frida.processing.GroupOperatorTypeFilter operatorTypesFilter,
                        boolean isVtkAvailableIn)
Main constructor.

Parameters:
propertiesTypesFilterIn - - Set the input PropertyTypes to GroupTypes filter.
operatorTypesFilter - - Set the input OperatorTypes to GroupTypes filter.
isVtkAvailableIn - - Set if the VTK context is available or not, to display (or not) the 3D view.
Method Detail

main

public static void main(String[] args)
To be run as standalone application.

Parameters:
args -

init3DComponents

public void init3DComponents(boolean isVtkAvailableIn)
Initialise the 3D viewer, if the VTK context is correctly loaded.

Parameters:
isVtkAvailableIn -

addGroupOperator

public void addGroupOperator(String operatorKeyName,
                             com.artenum.frida.interfaces.GroupOperatorInterface groupOperator)
Add a group operator to the present tree group editor.

Parameters:
operatorKeyName - - Key name of the input GroupOperator.
groupOperator - - Input Group Operator

getGroupOperator

public com.artenum.frida.interfaces.GroupOperatorInterface getGroupOperator(String operatorKeyName)
Get the group operator for the given key-name.

Parameters:
operatorKeyName - - key name of the group operator.
Returns:
the group operator if found, null otherwise.

loadMesh

public com.artenum.penelope.mesh.interfaces.Mesh loadMesh(String fileInPath)
Load the mesh and the corresponding group list.

Parameters:
fileInPath - - Path of the input mesh.
Returns:
- the loaded Mesh object

getMesh

public com.artenum.penelope.mesh.interfaces.Mesh getMesh()
Get the loaded mesh.

Returns:

getView

public GroupsTreeEditorView getView()
Get the GUI of this editor.

Returns:
The GUI of the editor.

getSelectionGroupsTree

public ImprovedSelectionTree getSelectionGroupsTree()
Get the selection tree for the groups.

Returns:
- Tree of groups selection.

setSelectionGroupsTree

public void setSelectionGroupsTree(ImprovedSelectionTree selectionGroupsTree)
Set the selection tree for the groups.

Parameters:
selectionGroupsTree -

getGroupList

public com.artenum.frida.group.OrderedGroupList getGroupList()
Get the group list.

Returns:
- The group list.

setGroupList

public void setGroupList(com.artenum.frida.group.OrderedGroupList groupList)
Set the group list.

Parameters:
groupList - - the group list.

setGroupListAndUpdateModels

public void setGroupListAndUpdateModels(com.artenum.frida.group.OrderedGroupList groupList)
Set the group list, update all related models (i.e tree and mapper) and expands groups nodes having properties in the tree.

Parameters:
groupList - - input groups list

getMapper

public com.artenum.frida.processing.CharacteristicsToDataFieldsMapper getMapper()
Get the mapping filter, used to deploy the Properties on Groups to DataFields.

Returns:
- The mapper.

setMapper

public void setMapper(com.artenum.frida.processing.CharacteristicsToDataFieldsMapper mapper)
Set the mapping filter, used to deploy the Properties on Groups to DataFields.

Parameters:
mapper - - The mapper.

actionPerformed

public void actionPerformed(ActionEvent evt)
Specified by:
actionPerformed in interface ActionListener

moveUp

public void moveUp()
Move the priority of the selected group up.


moveDown

public void moveDown()
Move the priority of the selected group down.


deployDataFieldAction

public com.artenum.penelope.field.DataFieldManager deployDataFieldAction()
Perform the properties deployments (mapping) action.


saveGroupsListAction

public void saveGroupsListAction()
Open a save file chooser and save the group list.


saveGroupsList

public void saveGroupsList(File ouputFile)
Save the GroupsList into the given file.

Parameters:
ouputFile - - output file.

loadNascapMaterialsAction

public void loadNascapMaterialsAction()
Perform the action to load a given NASCAP material catalog.


loadAndUpdateGroupsListAction

public void loadAndUpdateGroupsListAction()
Open a file chooser to load a group List from a file, call a validator and load the groups list.


loadGroupListFile

public void loadGroupListFile(File selectedFile)
Load group list from .xml file.

Parameters:
selectedFile - the xml file which must be used to load group list.

loadAndUpdateGroupsList

public com.artenum.frida.group.OrderedGroupList loadAndUpdateGroupsList(File inputFile,
                                                                        com.artenum.frida.group.OrderedGroupList meshGroupsList,
                                                                        DefaultGroupsListValidator listValidator)
Load the OrderedGroupsList from the given file. If the ListValidator is not null, the loaded list is compared again the reference one. If the acceptance criterion is verified, the validated groups list is returned, otherwise a null list is returned. If the ListValidator is not defined (i.e equals to null), the loaded list is returned without validation. If is was impossible to load the list, the null value is returned.

Parameters:
inputFile - - File with the list to be read.
meshGroupsList - - mesh based group list.
listValidator - - Validator of the groups lists.
Returns:
validated list.

saveDataFieldToXMLAction

public void saveDataFieldToXMLAction()
Perform the DataField saving action to Penelope's XML format. This open a file chooser and save the DataFields.


loadMeshandInitModelAction

public void loadMeshandInitModelAction()
Performs the action of the mesh loading (from a selected file) and initialisation of the model (tree and 3D view).


setMesh

public void setMesh(com.artenum.penelope.mesh.interfaces.Mesh mesh)
Set the Mesh of support containing the MeshMasks corresponding to the groups

Parameters:
mesh - - input mesh.

resetModelAndUpdateView

public void resetModelAndUpdateView()
Reset the model and update the view.


addPropertyValidator

public void addPropertyValidator(String validatorName,
                                 com.artenum.frida.processing.DefaultPropertyValidator validator)
Add a property validator in the central table. See @DefaultPropertyValidator for further information.

Parameters:
validatorName - - Key name of the validator (also used in the GUI)
validator - - The loaded validator.

getPropertyValidator

public com.artenum.frida.processing.DefaultPropertyValidator getPropertyValidator(String validatorName)
Get the PropertyValidtor for the given key name.

Parameters:
validatorName - - Key-name of the PropertyValidtor.
Returns:
- The returned PropertyValidtor.

resetPropertyValidatorMap

public void resetPropertyValidatorMap()
Reset (i.e remove all loaded elements) of the central PropertyValidators.


loadPropertiesCatalogAction

public void loadPropertiesCatalogAction()
Performs the loading action of Properties Catalog. Open a file chooser and load the catalog. The properties catalog is a simple directory containing XML based properties files.


exportDataFieldToVtkAction

public void exportDataFieldToVtkAction()
Perform the DataField export to VtkDataSet action. Open a file chooser and export the DataFields.


saveDataFieldsToXML

public void saveDataFieldsToXML(com.artenum.penelope.field.DataFieldManager dataFieldManager,
                                String meshPath,
                                File outputDir)
Save the DataFields of the given DataSetManager into the Penelope XML format.

Parameters:
dataFieldManager -
meshPath -
outputDir -

loadPropertiesCataLog

public com.artenum.frida.properties.PropertiesList loadPropertiesCataLog(File inputDir)
Load a catalog of properties.

Parameters:
inputDir -
Returns:
loaded list of Properties.

loadPropertiesCataLog

public com.artenum.frida.properties.PropertiesList loadPropertiesCataLog(File inputDir,
                                                                         com.artenum.frida.processing.DefaultPropertyValidator validator)
Load the given properties catalog according to the properties-to-group-types validator.

Parameters:
inputDir -
validator -
Returns:

loadNascapMaterialCataLog

public com.artenum.frida.properties.PropertiesList loadNascapMaterialCataLog(File inputDir)
Load a NASCAP properties.

Parameters:
inputDir - the folder which contains the nascap material file.
Returns:
loaded list of Properties.

cleanUpPropertyAndCharacteristicIds

public void cleanUpPropertyAndCharacteristicIds(com.artenum.frida.interfaces.PropertyInterface propIn)
Clean-up the Properties and Characteristic list.

Parameters:
propIn - - list to be cleaned.

saveDefaultSettings

public void saveDefaultSettings(String settingKey)
Sate the global settings of the application.

Parameters:
settingKey -

loadDefaultSettings

public void loadDefaultSettings()
Load the default settings of the application (i.e Java properties).


deployProperties

public com.artenum.penelope.field.DataFieldManager deployProperties()
Deploy the properties as DataFiels according the group/Properties attributions


exportDataFieldsToVtkDataSet

public void exportDataFieldsToVtkDataSet(com.artenum.penelope.field.DataFieldManager dataFieldManager,
                                         File outputDir)
Export all DataFields gathered in the given DataFieldManager into VtkDataSet. All files are stored in the given outputDir. If outputDir is null, an empty directory is built at "./tmp". If the given directory contains already previous VtkDataSet, they are systematically removed to avoid mistakes.

Parameters:
outputDir -

exportMappedPropertiesToDataFields

public static void exportMappedPropertiesToDataFields(com.artenum.penelope.field.DataFieldManager mappedPropertiesManager,
                                                      File outputDir)
Export the DataFields generated from the mapping of Properties and stored into the given DataFieldManager into vtkDataSet and write them on files.

Parameters:
mappedPropertiesManager -
outputDir -

buildNewConsole

public void buildNewConsole()
Generate a new JyConsole.


getCentralDataFieldManager

public com.artenum.penelope.field.DataFieldManager getCentralDataFieldManager()
Get the central output DataFieldManager, shared by the Characteristic Mapper and the various GroupOperators.

Returns:
- Get the central output DataFieldManager.

setCentralDataFieldManager

public void setCentralDataFieldManager(com.artenum.penelope.field.DataFieldManager centralDataFieldManager)
Set the central output DataFieldManager, shared by the Characteristic Mapper and the various GroupOperators.

Parameters:
centralDataFieldManager - - Central dataFieldManager.

getDefaultPropertyValidator

public String getDefaultPropertyValidator()

setDefaultPropertyValidator

public void setDefaultPropertyValidator(String defaultPropertyValidator)


Copyright © 2012-2013 Artenum. All Rights Reserved.