use of com.google.gwt.user.client.ui.Label in project drools-wb by kiegroup.
the class ColumnsPagePresenterTest method testRefreshAttributeWidgetWhenAttributeColumnsIsNotEmpty.
@Test
public void testRefreshAttributeWidgetWhenAttributeColumnsIsNotEmpty() {
final AttributeColumnConfigRow attributeColumnConfigRow = mock(AttributeColumnConfigRow.class);
final Label blankSlate = mock(Label.class);
final AttributeCol52 attributeCol52 = mock(AttributeCol52.class);
final Widget widget = mock(Widget.class);
final List<AttributeCol52> attributeColumns = new ArrayList<AttributeCol52>() {
{
add(attributeCol52);
}
};
doReturn(verticalPanel).when(presenter).getAttributeWidget();
doReturn(attributeColumnConfigRow).when(this.attributeColumnConfigRow).get();
doReturn(widget).when(attributeColumnConfigRow).getView();
doReturn(blankSlate).when(presenter).blankSlate();
presenter.refreshAttributeWidget(attributeColumns);
verify(attributeColumnConfigRow).init(attributeCol52, modeller);
verify(verticalPanel, never()).add(blankSlate);
verify(verticalPanel).add(widget);
}
use of com.google.gwt.user.client.ui.Label in project drools-wb by kiegroup.
the class ColumnsPagePresenterTest method testRefreshMetaDataWidgetWhenModellerIsNotNullAndMetaDataColumnsIsEmpty.
@Test
public void testRefreshMetaDataWidgetWhenModellerIsNotNullAndMetaDataColumnsIsEmpty() {
final List<MetadataCol52> metaDataColumns = new ArrayList<>();
final Label blankSlate = mock(Label.class);
doReturn(verticalPanel).when(presenter).getMetaDataWidget();
doReturn(blankSlate).when(presenter).blankSlate();
presenter.refreshMetaDataWidget(metaDataColumns);
verify(verticalPanel).clear();
verify(verticalPanel).add(blankSlate);
}
use of com.google.gwt.user.client.ui.Label in project drools-wb by kiegroup.
the class ColumnsPagePresenterTest method testRefreshActionsWidgetWhenActionColumnsIsEmpty.
@Test
public void testRefreshActionsWidgetWhenActionColumnsIsEmpty() {
final List<ActionCol52> actionColumns = new ArrayList<>();
final ColumnManagementView columnManagementView = mock(ColumnManagementView.class);
final GuidedDecisionTableAccordionItem item = mock(GuidedDecisionTableAccordionItem.class);
final Label blankSlate = mock(Label.class);
doReturn(verticalPanel).when(presenter).getActionsWidget();
doReturn(columnManagementView).when(presenter).getActionsPanel();
doReturn(blankSlate).when(presenter).blankSlate();
doReturn(item).when(accordion).getItem(ACTION);
presenter.refreshActionsWidget(actionColumns);
verify(item).setOpen(false);
verify(verticalPanel).add(blankSlate);
verify(verticalPanel, never()).add(columnManagementView);
verify(columnManagementView, never()).renderColumns(any());
}
use of com.google.gwt.user.client.ui.Label in project drools-wb by kiegroup.
the class ExpressionBuilder method createWidgetForExpression.
// Render Widgets for the Expression. ExpressionMethodParameter and ExpressionText parts
// are represented by a TextBox to allow the User to edit the values, Updates are
// reflected in the model.
private Widget createWidgetForExpression() {
final HorizontalPanel container = new HorizontalPanel();
container.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
container.setStylePrimaryName(GuidedRuleEditorResources.INSTANCE.css().container());
for (ExpressionPart expressionPart : expression.getParts()) {
if (expressionPart instanceof ExpressionUnboundFact) {
continue;
} else if (this.readOnly) {
container.add(new Label(expressionPart.getName()));
} else if (expressionPart instanceof ExpressionMethod) {
container.add(new Label(expressionPart.getName()));
container.add(new Label("("));
final ExpressionMethod em = (ExpressionMethod) expressionPart;
final List<ExpressionFormLine> emParams = em.getOrderedParams();
for (int index = 0; index < emParams.size(); index++) {
final ExpressionFormLine paramValueHolder = emParams.get(index);
final String paramDataType = em.getParameterDataType(paramValueHolder);
final ExpressionMethodParameter paramValue = ((ExpressionMethodParameter) paramValueHolder.getRootExpression());
final TextBox paramValueEditor = TextBoxFactory.getTextBox(paramDataType);
paramValueEditor.addValueChangeHandler(new ValueChangeHandler<String>() {
@Override
public void onValueChange(ValueChangeEvent<String> event) {
paramValue.setText(event.getValue());
}
});
paramValueEditor.setText(paramValue.getName());
container.add(paramValueEditor);
if (index < emParams.size() - 1) {
container.add(new Label(", "));
}
}
container.add(new Label(")"));
} else if (!(expressionPart instanceof ExpressionText)) {
container.add(new Label(expressionPart.getName()));
} else {
final TextBox tb = new TextBox();
final ExpressionText expressionTextPart = (ExpressionText) expressionPart;
tb.setText(expressionTextPart.getName());
tb.addChangeHandler(new ChangeHandler() {
@Override
public void onChange(final ChangeEvent changeEvent) {
expressionTextPart.setText(tb.getText());
}
});
container.add(tb);
}
container.add(new Label("."));
}
return container;
}
use of com.google.gwt.user.client.ui.Label in project drools-wb by kiegroup.
the class FactPatternWidget method createCEPWindowWidget.
// Widget for CEP 'windows'
private Widget createCEPWindowWidget(final RuleModeller modeller, final HasCEPWindow c) {
final HorizontalPanel hp = new HorizontalPanel();
modeller.getDataModelOracle().isFactTypeAnEvent(pattern.getFactType(), new Callback<Boolean>() {
@Override
public void callback(final Boolean result) {
if (Boolean.TRUE.equals(result)) {
final Label lbl = new Label(HumanReadableConstants.INSTANCE.OverCEPWindow());
lbl.setStyleName("paddedLabel");
hp.add(lbl);
final CEPWindowOperatorsDropdown cwo = new CEPWindowOperatorsDropdown(c, readOnly);
if (!isReadOnly()) {
cwo.addValueChangeHandler(new ValueChangeHandler<OperatorSelection>() {
public void onValueChange(ValueChangeEvent<OperatorSelection> event) {
setModified(true);
OperatorSelection selection = event.getValue();
String selected = selection.getValue();
c.getWindow().setOperator(selected);
}
});
}
hp.add(cwo);
}
}
});
return hp;
}
Aggregations