Search in sources :

Example 46 with MetadataCol52

use of org.drools.workbench.models.guided.dtable.shared.model.MetadataCol52 in project drools-wb by kiegroup.

the class NewGuidedDecisionTableHandler method createEmptyDecisionTable.

private void createEmptyDecisionTable(final Path contextPath, final String baseFileName) {
    final GuidedDecisionTable52 model = new GuidedDecisionTable52();
    model.setTableFormat(options.getTableFormat());
    model.setHitPolicy(options.getHitPolicy());
    if (GuidedDecisionTable52.HitPolicy.RESOLVED_HIT.equals(options.getHitPolicy())) {
        final MetadataCol52 metadataCol52 = new MetadataCol52();
        metadataCol52.setMetadata(GuidedDecisionTable52.HitPolicy.RESOLVED_HIT_METADATA_NAME);
        model.getMetadataCols().add(metadataCol52);
    }
    model.setTableName(baseFileName);
    final RemoteCallback<Path> onSaveSuccessCallback = getSuccessCallback(newResourcePresenter);
    busyIndicatorView.showBusyIndicator(CommonConstants.INSTANCE.Saving());
    service.call((Path path) -> {
        busyIndicatorView.hideBusyIndicator();
        onSaveSuccessCallback.callback(path);
    }, new HasBusyIndicatorDefaultErrorCallback(busyIndicatorView)).create(contextPath, buildFileName(baseFileName, resourceType), model, "");
}
Also used : MetadataCol52(org.drools.workbench.models.guided.dtable.shared.model.MetadataCol52) Path(org.uberfire.backend.vfs.Path) GuidedDecisionTable52(org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52) HasBusyIndicatorDefaultErrorCallback(org.uberfire.ext.widgets.common.client.callbacks.HasBusyIndicatorDefaultErrorCallback)

Example 47 with MetadataCol52

use of org.drools.workbench.models.guided.dtable.shared.model.MetadataCol52 in project drools-wb by kiegroup.

the class ColumnsPagePresenterTest method testHideMetadataClickHandlerWhenVetoExceptionIsNotRaised.

@Test
public void testHideMetadataClickHandlerWhenVetoExceptionIsNotRaised() throws Exception {
    final MetadataCol52 clone = mock(MetadataCol52.class);
    final CheckBox checkBox = mock(CheckBox.class);
    final ClickEvent clickEvent = mock(ClickEvent.class);
    final GuidedDecisionTableView.Presenter activeDecisionTable = mock(GuidedDecisionTableView.Presenter.class);
    doReturn(Optional.of(activeDecisionTable)).when(modeller).getActiveDecisionTable();
    doReturn(clone).when(metadataColumn).cloneColumn();
    final ClickHandler clickHandler = presenter.hideMetadataClickHandler(modeller, checkBox, metadataColumn);
    clickHandler.onClick(clickEvent);
    verify(clone).setHideColumn(checkBox.getValue());
    verify(activeDecisionTable).updateColumn(metadataColumn, clone);
}
Also used : MetadataCol52(org.drools.workbench.models.guided.dtable.shared.model.MetadataCol52) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) CheckBox(org.gwtbootstrap3.client.ui.CheckBox) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) GuidedDecisionTableView(org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTableView) Test(org.junit.Test)

Example 48 with MetadataCol52

use of org.drools.workbench.models.guided.dtable.shared.model.MetadataCol52 in project drools-wb by kiegroup.

the class ColumnsPagePresenterTest method testRefreshMetaDataWidgetWhenModellerIsNotNullAndMetaDataColumnsIsNotEmpty.

@Test
public void testRefreshMetaDataWidgetWhenModellerIsNotNullAndMetaDataColumnsIsNotEmpty() {
    final MetadataCol52 metadataColumn1 = mock(MetadataCol52.class);
    final MetadataCol52 metadataColumn2 = mock(MetadataCol52.class);
    final HorizontalPanel metaDataWidget1 = mock(HorizontalPanel.class);
    final HorizontalPanel metaDataWidget2 = mock(HorizontalPanel.class);
    final List<MetadataCol52> metaDataColumns = new ArrayList<MetadataCol52>() {

        {
            add(metadataColumn1);
            add(metadataColumn2);
        }
    };
    doReturn(verticalPanel).when(presenter).getMetaDataWidget();
    doReturn(metaDataWidget1).when(presenter).makeMetaDataWidget(modeller, metadataColumn1);
    doReturn(metaDataWidget2).when(presenter).makeMetaDataWidget(modeller, metadataColumn2);
    presenter.refreshMetaDataWidget(metaDataColumns);
    verify(verticalPanel).clear();
    verify(verticalPanel).add(metaDataWidget1);
    verify(verticalPanel).add(metaDataWidget2);
}
Also used : MetadataCol52(org.drools.workbench.models.guided.dtable.shared.model.MetadataCol52) HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 49 with MetadataCol52

use of org.drools.workbench.models.guided.dtable.shared.model.MetadataCol52 in project drools-wb by kiegroup.

the class GuidedDecisionTablePresenterAttributesAndMetadataTest method appendMetadataColumn.

@Test
public void appendMetadataColumn() throws VetoException {
    reset(modellerPresenter);
    final MetadataCol52 column = new MetadataCol52();
    column.setMetadata("metadata");
    dtPresenter.appendColumn(column);
    verify(synchronizer, times(1)).appendColumn(eq(column));
    verify(refreshMetaDataPanelEvent, times(1)).fire(any(RefreshMetaDataPanelEvent.class));
    verify(modellerPresenter, times(1)).updateLinks();
}
Also used : MetadataCol52(org.drools.workbench.models.guided.dtable.shared.model.MetadataCol52) RefreshMetaDataPanelEvent(org.drools.workbench.screens.guided.dtable.client.widget.table.events.cdi.RefreshMetaDataPanelEvent) Test(org.junit.Test)

Example 50 with MetadataCol52

use of org.drools.workbench.models.guided.dtable.shared.model.MetadataCol52 in project drools-wb by kiegroup.

the class GuidedDecisionTablePresenterAttributesAndMetadataTest method isMetaDataUnique.

@Test
public void isMetaDataUnique() {
    final MetadataCol52 metadata = new MetadataCol52();
    metadata.setMetadata("metadata");
    dtPresenter.getModel().getMetadataCols().add(metadata);
    assertFalse(dtPresenter.isMetaDataUnique("metadata"));
    assertTrue(dtPresenter.isMetaDataUnique("cheese"));
}
Also used : MetadataCol52(org.drools.workbench.models.guided.dtable.shared.model.MetadataCol52) Test(org.junit.Test)

Aggregations

MetadataCol52 (org.drools.workbench.models.guided.dtable.shared.model.MetadataCol52)67 Test (org.junit.Test)52 DTCellValue52 (org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52)18 BaseColumn (org.drools.workbench.models.guided.dtable.shared.model.BaseColumn)12 ArrayList (java.util.ArrayList)11 ConditionCol52 (org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52)10 GuidedDecisionTable52 (org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52)10 DescriptionCol52 (org.drools.workbench.models.guided.dtable.shared.model.DescriptionCol52)9 RowNumberCol52 (org.drools.workbench.models.guided.dtable.shared.model.RowNumberCol52)9 AttributeCol52 (org.drools.workbench.models.guided.dtable.shared.model.AttributeCol52)8 DecisionTableSelectionsChangedEvent (org.drools.workbench.screens.guided.dtable.client.widget.table.events.cdi.DecisionTableSelectionsChangedEvent)8 DecisionTableSelectedEvent (org.drools.workbench.screens.guided.dtable.client.widget.table.events.cdi.DecisionTableSelectedEvent)7 ActionCol52 (org.drools.workbench.models.guided.dtable.shared.model.ActionCol52)6 Pattern52 (org.drools.workbench.models.guided.dtable.shared.model.Pattern52)6 RuleModel (org.drools.workbench.models.datamodel.rule.RuleModel)5 GuidedDecisionTableView (org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTableView)5 GuidedDTTemplateDataProvider (org.drools.workbench.models.guided.dtable.backend.util.GuidedDTTemplateDataProvider)4 TemplateDataProvider (org.drools.workbench.models.guided.dtable.backend.util.TemplateDataProvider)4 BaseColumnFieldDiff (org.drools.workbench.models.guided.dtable.shared.model.BaseColumnFieldDiff)4 CompositeColumn (org.drools.workbench.models.guided.dtable.shared.model.CompositeColumn)4