Search in sources :

Example 1 with DataObjectFieldDeletedEvent

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));
        }
    }
}
Also used : ObjectProperty(org.kie.workbench.common.services.datamodeller.core.ObjectProperty) DataObjectFieldDeletedEvent(org.kie.workbench.common.screens.datamodeller.events.DataObjectFieldDeletedEvent)

Example 2 with DataObjectFieldDeletedEvent

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);
}
Also used : DataObjectFieldDeletedEvent(org.kie.workbench.common.screens.datamodeller.events.DataObjectFieldDeletedEvent)

Example 3 with 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);
}
Also used : DataObject(org.kie.workbench.common.services.datamodeller.core.DataObject) DataObjectFieldDeletedEvent(org.kie.workbench.common.screens.datamodeller.events.DataObjectFieldDeletedEvent) DataModelerContext(org.kie.workbench.common.screens.datamodeller.client.DataModelerContext) DomainEditorBaseTest(org.kie.workbench.common.screens.datamodeller.client.widgets.DomainEditorBaseTest) Test(org.junit.Test)

Aggregations

DataObjectFieldDeletedEvent (org.kie.workbench.common.screens.datamodeller.events.DataObjectFieldDeletedEvent)3 Test (org.junit.Test)1 DataModelerContext (org.kie.workbench.common.screens.datamodeller.client.DataModelerContext)1 DomainEditorBaseTest (org.kie.workbench.common.screens.datamodeller.client.widgets.DomainEditorBaseTest)1 DataObject (org.kie.workbench.common.services.datamodeller.core.DataObject)1 ObjectProperty (org.kie.workbench.common.services.datamodeller.core.ObjectProperty)1