use of org.gwtbootstrap3.client.ui.Label in project kie-wb-common by kiegroup.
the class ImportsWidgetViewImpl method setup.
private void setup() {
// Setup table
table.setStriped(true);
table.setCondensed(true);
table.setBordered(true);
table.setEmptyTableWidget(new Label(ImportConstants.INSTANCE.noImportsDefined()));
// Columns
table.addColumn(importTypeColumn, new TextHeader(ImportConstants.INSTANCE.importType()));
table.addColumn(deleteImportColumn, ImportConstants.INSTANCE.remove());
deleteImportColumn.setFieldUpdater((index, importType, value) -> {
if (isReadOnly) {
return;
}
final YesNoCancelPopup confirm = YesNoCancelPopup.newYesNoCancelPopup(ImportConstants.INSTANCE.remove(), ImportConstants.INSTANCE.promptForRemovalOfImport0(importType.getType()), () -> getRemoveImportCommand().execute(importType), () -> {
/*Nothing*/
}, null);
confirm.show();
});
// Link display
getDataProvider().addDataDisplay(table);
}
use of org.gwtbootstrap3.client.ui.Label in project drools-wb by kiegroup.
the class GuidedScoreCardEditor method addCharacteristic.
private FlexTable addCharacteristic(final Characteristic characteristic) {
final FlexTable cGrid = new FlexTable();
cGrid.setBorderWidth(0);
cGrid.setCellPadding(1);
cGrid.setCellSpacing(1);
cGrid.setStyleName("rule-ListHeader");
Button btnAddAttribute = new Button(GuidedScoreCardConstants.INSTANCE.addAttribute(), new ClickHandler() {
public void onClick(final ClickEvent event) {
addAttribute(cGrid, null);
}
});
Button btnRemoveCharacteristic = new Button(GuidedScoreCardConstants.INSTANCE.removeCharacteristic(), new ClickHandler() {
public void onClick(ClickEvent event) {
removeCharacteristic(cGrid);
}
});
String selectedFact = "";
if (characteristic != null) {
selectedFact = characteristic.getFact();
if (selectedFact.lastIndexOf(".") > -1) {
selectedFact = selectedFact.substring(selectedFact.lastIndexOf(".") + 1);
}
}
// Fields List Box
final ListBox dropDownFields = new ListBox();
// Facts List Box
final ListBox dropDownFacts = new ListBox();
final String[] eligibleFacts = oracle.getFactTypes();
for (final String factType : eligibleFacts) {
dropDownFacts.addItem(factType);
}
dropDownFacts.addChangeHandler(new ChangeHandler() {
@Override
public void onChange(final ChangeEvent event) {
characteristicFactChanged(characteristic, dropDownFacts, dropDownFields);
}
});
final int selectedFactIndex = Arrays.asList(eligibleFacts).indexOf(selectedFact);
dropDownFacts.setSelectedIndex(selectedFactIndex >= 0 ? selectedFactIndex : 0);
characteristicFactChanged(characteristic, dropDownFacts, dropDownFields);
cGrid.setWidget(0, 0, new Label(GuidedScoreCardConstants.INSTANCE.name()));
final TextBox tbName = TextBoxFactory.getTextBox(DataType.TYPE_STRING);
cGrid.setWidget(0, 1, tbName);
cGrid.setWidget(0, 2, btnRemoveCharacteristic);
cGrid.setWidget(0, 3, btnAddAttribute);
cGrid.setWidget(1, 0, new Label(GuidedScoreCardConstants.INSTANCE.fact()));
cGrid.setWidget(1, 1, new Label(GuidedScoreCardConstants.INSTANCE.characteristic()));
cGrid.setWidget(1, 2, new Label(GuidedScoreCardConstants.INSTANCE.baselineScore()));
cGrid.setWidget(1, 3, new Label(GuidedScoreCardConstants.INSTANCE.reasonCode()));
cGrid.setWidget(2, 0, dropDownFacts);
cGrid.setWidget(2, 1, dropDownFields);
final TextBox tbBaseline = TextBoxFactory.getTextBox(DataType.TYPE_NUMERIC_DOUBLE);
final boolean useReasonCodesValue = "true".equalsIgnoreCase(ddUseReasonCode.getValue(ddUseReasonCode.getSelectedIndex()));
tbBaseline.setEnabled(useReasonCodesValue);
cGrid.setWidget(2, 2, tbBaseline);
final TextBox tbReasonCode = TextBoxFactory.getTextBox(DataType.TYPE_STRING);
tbReasonCode.setEnabled(useReasonCodesValue);
cGrid.setWidget(2, 3, tbReasonCode);
final SimplePanel gapPanel = new SimplePanel();
gapPanel.add(new HTML("<br/>"));
final VerticalPanel panel = new VerticalPanel();
panel.add(cGrid);
characteristicsAttrPanelMap.put(cGrid, panel);
// panel.add( addAttributeCellTable( cGrid, characteristic ) );
panel.setWidth("100%");
DecoratorPanel decoratorPanel = new DecoratorPanel();
decoratorPanel.add(panel);
characteristicsPanel.add(decoratorPanel);
characteristicsPanel.add(gapPanel);
characteristicsTables.add(cGrid);
cGrid.getColumnFormatter().setWidth(0, "150px");
cGrid.getColumnFormatter().setWidth(1, "250px");
cGrid.getColumnFormatter().setWidth(2, "150px");
cGrid.getColumnFormatter().setWidth(3, "150px");
if (characteristic != null) {
tbReasonCode.setValue(characteristic.getReasonCode());
tbBaseline.setValue("" + characteristic.getBaselineScore());
tbName.setValue(characteristic.getName());
}
return cGrid;
}
use of org.gwtbootstrap3.client.ui.Label in project drools-wb by kiegroup.
the class FactPatternWidget method getPatternLabel.
/**
* This returns the pattern label.
*/
private Widget getPatternLabel(final FactPattern fp) {
ClickHandler click = event -> popupCreator.showPatternPopup(fp, null, false);
String patternName = (pattern.isBound()) ? pattern.getFactType() + " <b>[" + pattern.getBoundName() + "]</b>" : pattern.getFactType();
String desc;
if (isAll0WithLabel) {
desc = GuidedRuleEditorResources.CONSTANTS.All0with(patternName);
} else {
if (pattern.getNumberOfConstraints() > 0) {
desc = GuidedRuleEditorResources.CONSTANTS.ThereIsAAn0With(patternName);
} else {
desc = GuidedRuleEditorResources.CONSTANTS.ThereIsAAn0(patternName);
}
desc = anA(desc, patternName);
}
return new ClickableLabel(desc, click, !this.readOnly);
}
use of org.gwtbootstrap3.client.ui.Label in project drools-wb by kiegroup.
the class GlobalsEditorViewImpl method setup.
private void setup() {
// Setup table
table.setStriped(true);
table.setCondensed(true);
table.setBordered(true);
table.setEmptyTableWidget(new Label(translationService.getTranslation(GlobalsEditorConstants.GlobalsEditorViewImplNoGlobalsDefined)));
// Columns
final TextColumn<Global> aliasColumn = new TextColumn<Global>() {
@Override
public String getValue(final Global global) {
return global.getAlias();
}
};
final TextColumn<Global> classNameColumn = new TextColumn<Global>() {
@Override
public String getValue(final Global global) {
return global.getClassName();
}
};
deleteGlobalButton = new ButtonCell(IconType.MINUS, ButtonType.DANGER, ButtonSize.SMALL);
final Column<Global, String> deleteGlobalColumn = new Column<Global, String>(deleteGlobalButton) {
@Override
public String getValue(final Global global) {
return translationService.getTranslation(GlobalsEditorConstants.GlobalsEditorViewImplRemove);
}
};
deleteGlobalColumn.setFieldUpdater((index, global, value) -> {
if (Window.confirm(translationService.format(GlobalsEditorConstants.GlobalsEditorViewImplPromptForRemovalOfGlobal, global.getAlias()))) {
dataProvider.getList().remove(index);
}
});
table.addColumn(aliasColumn, new TextHeader(translationService.getTranslation(GlobalsEditorConstants.GlobalsEditorViewImplAlias)));
table.addColumn(classNameColumn, new TextHeader(translationService.getTranslation(GlobalsEditorConstants.GlobalsEditorViewImplClassName)));
table.addColumn(deleteGlobalColumn, translationService.getTranslation(GlobalsEditorConstants.GlobalsEditorViewImplRemove));
// Link data
dataProvider.addDataDisplay(table);
dataProvider.setList(globals);
generatedLabel.setText(translationService.getTranslation(GlobalsEditorConstants.GlobalsEditorViewImplAutoGeneratedFile));
addGlobalButton.setText(translationService.getTranslation(GlobalsEditorConstants.GlobalsEditorViewImplAdd));
addGlobalButton.setIcon(IconType.PLUS);
}
use of org.gwtbootstrap3.client.ui.Label in project drools-wb by kiegroup.
the class ActionSetFieldsPageViewImpl method initialiseChosenFields.
private void initialiseChosenFields() {
chosenFieldsContainer.add(chosenFieldsWidget);
chosenFieldsWidget.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.ENABLED);
chosenFieldsWidget.setMinimumWidth(170);
final Label lstEmpty = new Label(GuidedDecisionTableConstants.INSTANCE.DecisionTableWizardNoChosenFields());
lstEmpty.setStyleName(WizardCellListResources.INSTANCE.cellListStyle().cellListEmptyItem());
chosenFieldsWidget.setEmptyListWidget(lstEmpty);
final MultiSelectionModel<ActionSetFieldCol52> selectionModel = new MultiSelectionModel<ActionSetFieldCol52>(System::identityHashCode);
chosenFieldsWidget.setSelectionModel(selectionModel);
selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
@Override
public void onSelectionChange(final SelectionChangeEvent event) {
chosenFieldsSelections = selectionModel.getSelectedSet();
chosenConditionsSelected(chosenFieldsSelections);
}
private void chosenConditionsSelected(final Set<ActionSetFieldCol52> cws) {
btnRemove.setEnabled(true);
if (cws.size() == 1) {
chosenFieldsSelection = cws.iterator().next();
fieldDefinition.setVisible(true);
validateFieldHeader();
populateFieldDefinition();
} else {
chosenFieldsSelection = null;
fieldDefinition.setVisible(false);
txtColumnHeader.setEnabled(false);
txtValueList.setEnabled(false);
defaultValueContainer.setVisible(false);
chkUpdateEngine.setEnabled(false);
}
}
private void populateFieldDefinition() {
// Fields common to all table formats
txtColumnHeader.setEnabled(true);
chkUpdateEngine.setEnabled(true);
txtColumnHeader.setText(chosenFieldsSelection.getHeader());
chkUpdateEngine.setValue(chosenFieldsSelection.isUpdate());
criteriaExtendedEntry.setVisible(presenter.getTableFormat() == GuidedDecisionTable52.TableFormat.EXTENDED_ENTRY);
criteriaLimitedEntry.setVisible(presenter.getTableFormat() == GuidedDecisionTable52.TableFormat.LIMITED_ENTRY);
// Fields specific to the table format
switch(presenter.getTableFormat()) {
case EXTENDED_ENTRY:
txtValueList.setEnabled(!presenter.hasEnums(chosenFieldsSelection));
txtValueList.setText(chosenFieldsSelection.getValueList());
makeDefaultValueWidget();
defaultValueContainer.setVisible(true);
break;
case LIMITED_ENTRY:
makeLimitedValueWidget();
limitedEntryValueContainer.setVisible(true);
break;
}
}
private void makeLimitedValueWidget() {
if (!(chosenFieldsSelection instanceof LimitedEntryActionSetFieldCol52)) {
return;
}
final LimitedEntryActionSetFieldCol52 lea = (LimitedEntryActionSetFieldCol52) chosenFieldsSelection;
if (lea.getValue() == null) {
lea.setValue(factory.makeNewValue(availablePatternsSelection, chosenFieldsSelection));
}
limitedEntryValueWidgetContainer.setWidget(factory.getWidget(availablePatternsSelection, chosenFieldsSelection, lea.getValue()));
}
});
}
Aggregations