use of org.kie.workbench.common.screens.datamodeller.events.DataObjectFieldSelectedEvent in project kie-wb-common by kiegroup.
the class DataObjectBrowser method notifyFieldSelected.
private void notifyFieldSelected() {
dataModelerWBContextEvent.fire(new DataModelerWorkbenchContextChangeEvent());
dataModelerEvent.fire(new DataObjectFieldSelectedEvent(getContext().getContextId(), DataModelerEvent.DATA_MODEL_BROWSER, getDataObject(), context.getObjectProperty()));
}
use of org.kie.workbench.common.screens.datamodeller.events.DataObjectFieldSelectedEvent in project kie-wb-common by kiegroup.
the class DataModelerScreenPresenterObserversTest method titleChangeOnFieldSelectionTest.
/**
* The following test checks that the title for the main properties panel on the view is properly set when the
* a field is selected.
*/
@Test
public void titleChangeOnFieldSelectionTest() {
// expected initial invocation when the data object was loaded.
String title = testObject1Title;
String tooltip = testObject1Tooltip;
verify(view, times(1)).setDomainContainerTitle(title, tooltip);
// Now we emulate the arrival of an event produced by some of the "domain editors" or the "data object browser"
// that are working on this context. Typically when the user clicks on a given field in the fields table.
presenter.onDataObjectFieldSelectedEvent(new DataObjectFieldSelectedEvent(dataModelerWBContext.getActiveContext().getContextId(), "", testObject1, testObject1.getProperty("field1")));
// expected title and tooltip given that "field1" was selected.
title = "'field1'" + Constants.INSTANCE.modelEditor_general_properties_label();
tooltip = "org.test.TestObject1.field1";
verify(view, times(1)).setDomainContainerTitle(title, tooltip);
// now emulate the user selecting "field2"
presenter.onDataObjectFieldSelectedEvent(new DataObjectFieldSelectedEvent(dataModelerWBContext.getActiveContext().getContextId(), "", testObject1, testObject1.getProperty("field2")));
// expected title and tooltip given that "field2" was selected.
title = "'field2'" + Constants.INSTANCE.modelEditor_general_properties_label();
tooltip = "org.test.TestObject1.field2";
verify(view, times(1)).setDomainContainerTitle(title, tooltip);
}
Aggregations