Search in sources :

Example 61 with AttributeCol52

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

the class AuditLogEntryCellHelperTest method getSafeHtml_Attribute.

@Test
public void getSafeHtml_Attribute() {
    AttributeCol52 originalColumn = new AttributeCol52();
    originalColumn.setReverseOrder(false);
    originalColumn.setUseRowNumber(false);
    originalColumn.setHideColumn(false);
    originalColumn.setDefaultValue(new DTCellValue52("def1"));
    // header & attribute name of an attribute column cannot be updated in the ui
    originalColumn.setAttribute("attr");
    originalColumn.setHeader("attr");
    AttributeCol52 newColumn = new AttributeCol52();
    newColumn.setReverseOrder(true);
    newColumn.setUseRowNumber(true);
    newColumn.setHideColumn(true);
    newColumn.setDefaultValue(new DTCellValue52("def2"));
    // header & attribute name of an attribute column cannot be updated in the ui
    newColumn.setAttribute("attr");
    newColumn.setHeader("attr");
    List<BaseColumnFieldDiff> diffs = originalColumn.diff(newColumn);
    SafeHtml result = helper.getSafeHtml(new UpdateColumnAuditLogEntry("mock user", originalColumn, newColumn, diffs));
    assertEquals(getAttributeHeaderRepre(newColumn.getAttribute()) + getDiffRepre(diffs), result.asString());
}
Also used : AttributeCol52(org.drools.workbench.models.guided.dtable.shared.model.AttributeCol52) UpdateColumnAuditLogEntry(org.drools.workbench.models.guided.dtable.shared.auditlog.UpdateColumnAuditLogEntry) SafeHtml(com.google.gwt.safehtml.shared.SafeHtml) BaseColumnFieldDiff(org.drools.workbench.models.guided.dtable.shared.model.BaseColumnFieldDiff) DTCellValue52(org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52) Test(org.junit.Test)

Example 62 with AttributeCol52

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

the class GuidedDecisionTablePresenterAttributesAndMetadataTest method updateAttributeColumn.

@Test
public void updateAttributeColumn() throws VetoException {
    final AttributeCol52 column = new AttributeCol52();
    column.setAttribute(RuleAttributeWidget.AUTO_FOCUS_ATTR);
    dtPresenter.appendColumn(column);
    reset(modellerPresenter);
    final AttributeCol52 update = new AttributeCol52();
    update.setAttribute(RuleAttributeWidget.ENABLED_ATTR);
    dtPresenter.updateColumn(column, update);
    verify(synchronizer, times(1)).updateColumn(eq(column), eq(update));
    verify(modellerPresenter, times(1)).updateLinks();
}
Also used : AttributeCol52(org.drools.workbench.models.guided.dtable.shared.model.AttributeCol52) Test(org.junit.Test)

Example 63 with AttributeCol52

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

the class GuidedDecisionTablePresenterAttributesAndMetadataTest method deleteAttributeColumn.

@Test
public void deleteAttributeColumn() throws VetoException {
    final AttributeCol52 column = new AttributeCol52();
    column.setAttribute(RuleAttributeWidget.AUTO_FOCUS_ATTR);
    dtPresenter.appendColumn(column);
    reset(modellerPresenter);
    dtPresenter.deleteColumn(column);
    verify(synchronizer, times(1)).deleteColumn(eq(column));
    verify(modellerPresenter, times(1)).updateLinks();
}
Also used : AttributeCol52(org.drools.workbench.models.guided.dtable.shared.model.AttributeCol52) Test(org.junit.Test)

Example 64 with AttributeCol52

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

the class GuidedDecisionTablePresenterTest method deleteAttributeColumn.

@Test
public void deleteAttributeColumn() throws Exception {
    final AttributeCol52 column = new AttributeCol52();
    column.setAttribute("salience");
    dtPresenter.appendColumn(column);
    reset(modellerPresenter);
    dtPresenter.deleteColumn(column);
    verify(synchronizer, times(1)).deleteColumn(eq(column));
    verify(modellerPresenter, times(1)).updateLinks();
    verify(refreshAttributesPanelEvent, times(2)).fire(any(RefreshAttributesPanelEvent.class));
    checkDTSelectionsChangedEventFired(1);
}
Also used : AttributeCol52(org.drools.workbench.models.guided.dtable.shared.model.AttributeCol52) RefreshAttributesPanelEvent(org.drools.workbench.screens.guided.dtable.client.widget.table.events.cdi.RefreshAttributesPanelEvent) Test(org.junit.Test)

Example 65 with AttributeCol52

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

the class GuidedDecisionTablePresenterTest method getValueListLookups.

@Test
public void getValueListLookups() {
    final AttributeCol52 attribute = new AttributeCol52();
    attribute.setAttribute(RuleAttributeWidget.ENABLED_ATTR);
    final Map<String, String> valueList = dtPresenter.getValueListLookups(attribute);
    assertNotNull(valueList);
    assertEquals(2, valueList.size());
    assertTrue(valueList.containsKey("true"));
    assertTrue(valueList.containsKey("false"));
}
Also used : AttributeCol52(org.drools.workbench.models.guided.dtable.shared.model.AttributeCol52) Test(org.junit.Test)

Aggregations

AttributeCol52 (org.drools.workbench.models.guided.dtable.shared.model.AttributeCol52)86 Test (org.junit.Test)55 DTCellValue52 (org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52)30 GuidedDecisionTable52 (org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52)20 BaseColumn (org.drools.workbench.models.guided.dtable.shared.model.BaseColumn)14 ArrayList (java.util.ArrayList)12 ConditionCol52 (org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52)12 DescriptionCol52 (org.drools.workbench.models.guided.dtable.shared.model.DescriptionCol52)10 RowNumberCol52 (org.drools.workbench.models.guided.dtable.shared.model.RowNumberCol52)10 Pattern52 (org.drools.workbench.models.guided.dtable.shared.model.Pattern52)9 ActionInsertFactCol52 (org.drools.workbench.models.guided.dtable.shared.model.ActionInsertFactCol52)8 ActionSetFieldCol52 (org.drools.workbench.models.guided.dtable.shared.model.ActionSetFieldCol52)8 MetadataCol52 (org.drools.workbench.models.guided.dtable.shared.model.MetadataCol52)7 IOException (java.io.IOException)6 InputStream (java.io.InputStream)6 ExcelParser (org.drools.decisiontable.parser.xls.ExcelParser)6 DataListener (org.drools.template.parser.DataListener)6 ConversionResult (org.drools.workbench.models.guided.dtable.shared.conversion.ConversionResult)6 ActionCol52 (org.drools.workbench.models.guided.dtable.shared.model.ActionCol52)5 IntegerUiColumn (org.drools.workbench.screens.guided.dtable.client.widget.table.columns.IntegerUiColumn)5