use of org.kie.workbench.common.screens.datamodeller.events.DataObjectFieldDeletedEvent in project kie-wb-common by kiegroup.
the class RemovePropertyCommand method execute.
@Override
public void execute() {
if (dataObject != null) {
ObjectProperty property = dataObject.getProperty(propertyName);
if (property != null) {
dataObject.removeProperty(propertyName);
notifyChange(new DataObjectFieldDeletedEvent(getContext().getContextId(), getSource(), getDataObject(), property));
}
}
}
use of org.kie.workbench.common.screens.datamodeller.events.DataObjectFieldDeletedEvent in project kie-wb-common by kiegroup.
the class DataObjectBrowser method notifyFieldDeleted.
private void notifyFieldDeleted(ObjectProperty deletedProperty) {
DataObjectFieldDeletedEvent dataObjectFieldDeletedEvent = new DataObjectFieldDeletedEvent(getContext().getContextId(), DataModelerEvent.DATA_OBJECT_BROWSER, getDataObject(), deletedProperty);
dataModelerEvent.fire(dataObjectFieldDeletedEvent);
}
use of org.kie.workbench.common.screens.datamodeller.events.DataObjectFieldDeletedEvent in project kie-wb-common by kiegroup.
the class DataObjectBrowserTest method onDataObjectFieldDeleted.
@Test
public void onDataObjectFieldDeleted() {
DataObjectBrowser dataObjectBrowser = spy(createBrowser());
DataModelerContext context = createContext();
context.setContextId("contextId");
dataObjectBrowser.setContext(context);
DataObject dataObject = mock(DataObject.class);
dataObjectBrowser.setDataObject(dataObject);
DataObjectFieldDeletedEvent event = new DataObjectFieldDeletedEvent();
event.setContextId("contextId");
Mockito.reset(dataObjectBrowser);
dataObjectBrowser.onDataObjectFieldDeleted(event);
verify(dataObjectBrowser, times(1)).setDataObject(dataObject);
}
Aggregations