Class CollectionPresenter
- java.lang.Object
-
- org.drools.workbench.screens.scenariosimulation.client.collectioneditor.CollectionPresenter
-
- All Implemented Interfaces:
CollectionView.Presenter
public class CollectionPresenter extends Object implements CollectionView.Presenter
-
-
Field Summary
Fields Modifier and Type Field Description protected CollectionViewcollectionViewprotected ConfirmPopupPresenterconfirmPopupPresenterprotected Map<String,Map<String,Map<String,String>>>expandablePropertiesMapMapused to pair theMapwith instance' expandable properties classes with a specific key representing the property, i.e Classname#propertyname (e.g Author#books)protected ItemEditingBoxPresenterlistEditingBoxPresenterprotected ItemElementPresenterlistElementPresenterprotected KeyValueEditingBoxPresentermapEditingBoxPresenterprotected KeyValueElementPresentermapElementPresenterprotected ScenarioConfirmationPopupPresenterscenarioConfirmationPopupPresenterprotected Map<String,Map<String,String>>simplePropertiesMapMapused to pair theMapwith instance' simple properties classes with a specific key representing the property, i.e Classname#propertyname (e.g Author#books)protected ViewsProviderviewsProvider
-
Constructor Summary
Constructors Constructor Description CollectionPresenter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddListItem(Map<String,String> simplePropertiesValues, Map<String,Map<String,String>> expandablePropertiesValues)Creates a new single item element with values taken from givenMapvoidaddMapItem(Map<String,String> keyPropertiesValues, Map<String,String> valuePropertiesValues)Creates a new key/value item element with values taken from givenMapprotected voidcommonInit(String key, CollectionView collectionView)protected Map<String,Map<String,String>>getExpandablePropertiesValues(com.google.gwt.json.client.JSONObject jsonObject)protected StringgetExpressionValue()protected com.google.gwt.json.client.JSONObjectgetJSONObject(String jsonString)protected com.google.gwt.json.client.JSONObjectgetJSONObject(Map<String,String> properties)Translates aMapto aJSONObjectprotected com.google.gwt.json.client.JSONValuegetJSONValue(String jsonString)protected StringgetListValue()protected StringgetMapValue()protected Map<String,String>getSimplePropertiesMap(com.google.gwt.json.client.JSONObject jsonObject)protected StringgetValueFromCreateCollection()It gets the guided "Create Collection" editorvoidinitListStructure(String key, Map<String,String> simplePropertiesMap, Map<String,Map<String,String>> expandablePropertiesMap, CollectionView collectionView)Actual implementations should invoke this method first to retrieve information about the collection generic type and the structure of such typevoidinitMapStructure(String key, Map<String,String> keyPropertyMap, Map<String,String> valuePropertyMap, CollectionView collectionView)Actual implementations should invoke this method first to retrieve information about the collection generic type and the structure of such typeprotected voidokRemoveCommandMethod()voidonToggleRowExpansion(boolean isShown)Toggle the expansion of the items included in the collection.protected voidpopulateCreateCollection(com.google.gwt.json.client.JSONValue value)It populates the guided "Create Collection" editorprotected voidpopulateExpression(com.google.gwt.json.client.JSONValue jsonValue)protected voidpopulateList(com.google.gwt.json.client.JSONValue jsonValue)protected voidpopulateMap(com.google.gwt.json.client.JSONValue jsonValue)voidremove()Completely remove the givenCollection, i.e. set it tonullvoidsave()Actual implementations are meant to retrieve the json representation of the content of the currentCollectionEditorViewand save it.voidsetValue(String jsonString)Actual implementations are meant to transform that json representation to acom.google.gwt.json.client.JSONValueand use that to populate the currentCollectionEditorViewvoidshowEditingBox()Show the editing box in the currentCollectionEditorViewvoidtoggleEditingStatus(boolean editingStatus)Toggles the status of the addItem buttonvoidupdateRowExpansionStatus(boolean isShown)Updates the expanded status of main collection container to reflect the status of all contained items, when they have the same expanded status
-
-
-
Field Detail
-
listElementPresenter
@Inject protected ItemElementPresenter listElementPresenter
-
mapElementPresenter
@Inject protected KeyValueElementPresenter mapElementPresenter
-
viewsProvider
@Inject protected ViewsProvider viewsProvider
-
listEditingBoxPresenter
@Inject protected ItemEditingBoxPresenter listEditingBoxPresenter
-
mapEditingBoxPresenter
@Inject protected KeyValueEditingBoxPresenter mapEditingBoxPresenter
-
scenarioConfirmationPopupPresenter
@Inject protected ScenarioConfirmationPopupPresenter scenarioConfirmationPopupPresenter
-
confirmPopupPresenter
@Inject protected ConfirmPopupPresenter confirmPopupPresenter
-
simplePropertiesMap
protected Map<String,Map<String,String>> simplePropertiesMap
Mapused to pair theMapwith instance' simple properties classes with a specific key representing the property, i.e Classname#propertyname (e.g Author#books)
-
expandablePropertiesMap
protected Map<String,Map<String,Map<String,String>>> expandablePropertiesMap
Mapused to pair theMapwith instance' expandable properties classes with a specific key representing the property, i.e Classname#propertyname (e.g Author#books)
-
collectionView
protected CollectionView collectionView
-
-
Method Detail
-
initListStructure
public void initListStructure(String key, Map<String,String> simplePropertiesMap, Map<String,Map<String,String>> expandablePropertiesMap, CollectionView collectionView)
Description copied from interface:CollectionView.PresenterActual implementations should invoke this method first to retrieve information about the collection generic type and the structure of such type- Specified by:
initListStructurein interfaceCollectionView.Presenter- Parameters:
key- The key representing the property, i.e classname#propertyname (e.g Author#books)
-
initMapStructure
public void initMapStructure(String key, Map<String,String> keyPropertyMap, Map<String,String> valuePropertyMap, CollectionView collectionView)
Description copied from interface:CollectionView.PresenterActual implementations should invoke this method first to retrieve information about the collection generic type and the structure of such type- Specified by:
initMapStructurein interfaceCollectionView.Presenter- Parameters:
key- The key representing the property, i.e classname#propertyname (e.g Author#books)
-
setValue
public void setValue(String jsonString)
Description copied from interface:CollectionView.PresenterActual implementations are meant to transform that json representation to acom.google.gwt.json.client.JSONValueand use that to populate the currentCollectionEditorView- Specified by:
setValuein interfaceCollectionView.Presenter
-
populateCreateCollection
protected void populateCreateCollection(com.google.gwt.json.client.JSONValue value)
It populates the guided "Create Collection" editor- Parameters:
value-
-
showEditingBox
public void showEditingBox()
Description copied from interface:CollectionView.PresenterShow the editing box in the currentCollectionEditorView- Specified by:
showEditingBoxin interfaceCollectionView.Presenter
-
onToggleRowExpansion
public void onToggleRowExpansion(boolean isShown)
Description copied from interface:CollectionView.PresenterToggle the expansion of the items included in the collection.- Specified by:
onToggleRowExpansionin interfaceCollectionView.Presenter- Parameters:
isShown- the current expansion status of the collection
-
updateRowExpansionStatus
public void updateRowExpansionStatus(boolean isShown)
Description copied from interface:CollectionView.PresenterUpdates the expanded status of main collection container to reflect the status of all contained items, when they have the same expanded status- Specified by:
updateRowExpansionStatusin interfaceCollectionView.Presenter- Parameters:
isShown- the current expansion status of the collection
-
addListItem
public void addListItem(Map<String,String> simplePropertiesValues, Map<String,Map<String,String>> expandablePropertiesValues)
Description copied from interface:CollectionView.PresenterCreates a new single item element with values taken from givenMap- Specified by:
addListItemin interfaceCollectionView.Presenter
-
addMapItem
public void addMapItem(Map<String,String> keyPropertiesValues, Map<String,String> valuePropertiesValues)
Description copied from interface:CollectionView.PresenterCreates a new key/value item element with values taken from givenMap- Specified by:
addMapItemin interfaceCollectionView.Presenter
-
save
public void save()
Description copied from interface:CollectionView.PresenterActual implementations are meant to retrieve the json representation of the content of the currentCollectionEditorViewand save it.- Specified by:
savein interfaceCollectionView.Presenter
-
getValueFromCreateCollection
protected String getValueFromCreateCollection()
It gets the guided "Create Collection" editor
-
remove
public void remove()
Description copied from interface:CollectionView.PresenterCompletely remove the givenCollection, i.e. set it tonull- Specified by:
removein interfaceCollectionView.Presenter
-
toggleEditingStatus
public void toggleEditingStatus(boolean editingStatus)
Description copied from interface:CollectionView.PresenterToggles the status of the addItem button- Specified by:
toggleEditingStatusin interfaceCollectionView.Presenter
-
okRemoveCommandMethod
protected void okRemoveCommandMethod()
-
commonInit
protected void commonInit(String key, CollectionView collectionView)
-
populateList
protected void populateList(com.google.gwt.json.client.JSONValue jsonValue)
-
populateMap
protected void populateMap(com.google.gwt.json.client.JSONValue jsonValue)
-
populateExpression
protected void populateExpression(com.google.gwt.json.client.JSONValue jsonValue)
-
getJSONObject
protected com.google.gwt.json.client.JSONObject getJSONObject(String jsonString)
-
getJSONValue
protected com.google.gwt.json.client.JSONValue getJSONValue(String jsonString)
-
getExpressionValue
protected String getExpressionValue()
-
getListValue
protected String getListValue()
-
getJSONObject
protected com.google.gwt.json.client.JSONObject getJSONObject(Map<String,String> properties)
Translates aMapto aJSONObject- Parameters:
properties-- Returns:
-
getSimplePropertiesMap
protected Map<String,String> getSimplePropertiesMap(com.google.gwt.json.client.JSONObject jsonObject)
- Parameters:
jsonObject-- Returns:
- a
Mapwith propertyName/propertyValue
-
getExpandablePropertiesValues
protected Map<String,Map<String,String>> getExpandablePropertiesValues(com.google.gwt.json.client.JSONObject jsonObject)
- Parameters:
jsonObject-- Returns:
- a
Mapwhere the key is the name of the complex property, and the value is a aMapwith the nested propertyName/propertyValue
-
getMapValue
protected String getMapValue()
- Returns:
-
-