Search in sources :

Example 36 with Label

use of org.gwtbootstrap3.client.ui.Label in project drools-wb by kiegroup.

the class ActionInsertFactFieldsPageViewImpl method initialiseChosenFields.

private void initialiseChosenFields() {
    chosenFieldsContainer.add(chosenFieldsWidget);
    chosenFieldsWidget.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.ENABLED);
    chosenFieldsWidget.setMinimumWidth(130);
    final Label lstEmpty = new Label(GuidedDecisionTableConstants.INSTANCE.DecisionTableWizardNoChosenFields());
    lstEmpty.setStyleName(WizardCellListResources.INSTANCE.cellListStyle().cellListEmptyItem());
    chosenFieldsWidget.setEmptyListWidget(lstEmpty);
    final MultiSelectionModel<ActionInsertFactCol52> selectionModel = new MultiSelectionModel<ActionInsertFactCol52>(System::identityHashCode);
    chosenFieldsWidget.setSelectionModel(selectionModel);
    selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {

        @Override
        public void onSelectionChange(final SelectionChangeEvent event) {
            chosenFieldsSelections = new HashSet<ActionInsertFactCol52>();
            final Set<ActionInsertFactCol52> selections = selectionModel.getSelectedSet();
            for (ActionInsertFactCol52 a : selections) {
                chosenFieldsSelections.add(a);
            }
            chosenConditionsSelected(chosenFieldsSelections);
        }

        private void chosenConditionsSelected(final Set<ActionInsertFactCol52> 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);
            }
        }

        private void populateFieldDefinition() {
            // Fields common to all table formats
            txtColumnHeader.setEnabled(true);
            txtColumnHeader.setText(chosenFieldsSelection.getHeader());
            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 LimitedEntryActionInsertFactCol52)) {
                return;
            }
            LimitedEntryActionInsertFactCol52 lea = (LimitedEntryActionInsertFactCol52) chosenFieldsSelection;
            if (lea.getValue() == null) {
                lea.setValue(factory.makeNewValue(chosenFieldsSelection));
            }
            limitedEntryValueWidgetContainer.setWidget(factory.getWidget(chosenFieldsSelection, lea.getValue()));
        }
    });
}
Also used : ActionInsertFactCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionInsertFactCol52) LimitedEntryActionInsertFactCol52(org.drools.workbench.models.guided.dtable.shared.model.LimitedEntryActionInsertFactCol52) HashSet(java.util.HashSet) Set(java.util.Set) MultiSelectionModel(com.google.gwt.view.client.MultiSelectionModel) Label(org.gwtbootstrap3.client.ui.Label) LimitedEntryActionInsertFactCol52(org.drools.workbench.models.guided.dtable.shared.model.LimitedEntryActionInsertFactCol52) SelectionChangeEvent(com.google.gwt.view.client.SelectionChangeEvent) HashSet(java.util.HashSet)

Example 37 with Label

use of org.gwtbootstrap3.client.ui.Label in project drools-wb by kiegroup.

the class ActionInsertFactFieldsPageViewImpl method initialiseAvailableFields.

private void initialiseAvailableFields() {
    availableFieldsContainer.add(availableFieldsWidget);
    availableFieldsWidget.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.ENABLED);
    availableFieldsWidget.setMinimumWidth(130);
    final Label lstEmpty = new Label(GuidedDecisionTableConstants.INSTANCE.DecisionTableWizardNoAvailableFields());
    lstEmpty.setStyleName(WizardCellListResources.INSTANCE.cellListStyle().cellListEmptyItem());
    availableFieldsWidget.setEmptyListWidget(lstEmpty);
    final MultiSelectionModel<AvailableField> selectionModel = new MultiSelectionModel<AvailableField>();
    availableFieldsWidget.setSelectionModel(selectionModel);
    selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {

        @Override
        public void onSelectionChange(final SelectionChangeEvent event) {
            availableFieldsSelections = selectionModel.getSelectedSet();
            btnAdd.setEnabled(availableFieldsSelections.size() > 0);
        }
    });
}
Also used : MultiSelectionModel(com.google.gwt.view.client.MultiSelectionModel) Label(org.gwtbootstrap3.client.ui.Label) SelectionChangeEvent(com.google.gwt.view.client.SelectionChangeEvent)

Example 38 with Label

use of org.gwtbootstrap3.client.ui.Label in project drools-wb by kiegroup.

the class ImportsPageViewImpl method initialiseAvailableImports.

private void initialiseAvailableImports() {
    availableImportsContainer.add(availableImportsWidget);
    availableImportsWidget.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.ENABLED);
    availableImportsWidget.setMinimumWidth(270);
    final Label lstEmpty = new Label(GuidedDecisionTableConstants.INSTANCE.DecisionTableWizardNoAvailableImports());
    lstEmpty.setStyleName(WizardCellListResources.INSTANCE.cellListStyle().cellListEmptyItem());
    availableImportsWidget.setEmptyListWidget(lstEmpty);
    availableImportsWidget.setSelectionModel(availableImportsSelectionModel);
    availableImportsSelectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {

        @Override
        public void onSelectionChange(final SelectionChangeEvent event) {
            availableImportsSelections = availableImportsSelectionModel.getSelectedSet();
            btnAdd.setEnabled(availableImportsSelections.size() > 0);
        }
    });
}
Also used : Label(org.gwtbootstrap3.client.ui.Label) SelectionChangeEvent(com.google.gwt.view.client.SelectionChangeEvent)

Example 39 with Label

use of org.gwtbootstrap3.client.ui.Label in project drools-wb by kiegroup.

the class ImportsPageViewImpl method initialiseChosenImports.

private void initialiseChosenImports() {
    chosenImportsContainer.add(chosenImportsWidget);
    chosenImportsWidget.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.ENABLED);
    chosenImportsWidget.setMinimumWidth(270);
    final Label lstEmpty = new Label(GuidedDecisionTableConstants.INSTANCE.DecisionTableWizardNoChosenImports());
    lstEmpty.setStyleName(WizardCellListResources.INSTANCE.cellListStyle().cellListEmptyItem());
    chosenImportsWidget.setEmptyListWidget(lstEmpty);
    chosenImportsWidget.setSelectionModel(chosenImportsSelectionModel);
    chosenImportsSelectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {

        @Override
        public void onSelectionChange(final SelectionChangeEvent event) {
            chosenImportSelections = chosenImportsSelectionModel.getSelectedSet();
            btnRemove.setEnabled(chosenImportSelections.size() > 0);
        }
    });
}
Also used : Label(org.gwtbootstrap3.client.ui.Label) SelectionChangeEvent(com.google.gwt.view.client.SelectionChangeEvent)

Example 40 with Label

use of org.gwtbootstrap3.client.ui.Label in project ovirt-engine by oVirt.

the class FunctionPolicyUnitPanel method createUpButton.

private Button createUpButton(final Label weightLabel, final Button downButton) {
    Button upButton = new Button("", IconType.PLUS, event -> {
        factor++;
        model.updateFactor(policyUnit, factor);
        weightLabel.setText(String.valueOf(factor));
        if (factor > 1) {
            downButton.setEnabled(true);
        }
    });
    upButton.getElement().getStyle().setFloat(Style.Float.LEFT);
    upButton.getElement().getStyle().setPosition(Position.RELATIVE);
    upButton.getElement().getStyle().setTop(1, Unit.PX);
    upButton.getElement().getStyle().setMarginRight(5, Unit.PX);
    return upButton;
}
Also used : Button(org.gwtbootstrap3.client.ui.Button)

Aggregations

Label (org.gwtbootstrap3.client.ui.Label)26 SelectionChangeEvent (com.google.gwt.view.client.SelectionChangeEvent)16 MultiSelectionModel (com.google.gwt.view.client.MultiSelectionModel)10 Label (com.google.gwt.user.client.ui.Label)6 Button (org.gwtbootstrap3.client.ui.Button)6 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)5 Map (java.util.Map)4 ListGroupItem (org.gwtbootstrap3.client.ui.ListGroupItem)4 TextBox (org.gwtbootstrap3.client.ui.TextBox)4 Span (org.gwtbootstrap3.client.ui.html.Span)4 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)3 TextHeader (com.google.gwt.user.cellview.client.TextHeader)3 FlexTable (com.google.gwt.user.client.ui.FlexTable)3 HTML (com.google.gwt.user.client.ui.HTML)3 HorizontalPanel (com.google.gwt.user.client.ui.HorizontalPanel)3 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)3 Pattern52 (org.drools.workbench.models.guided.dtable.shared.model.Pattern52)3 Anchor (org.gwtbootstrap3.client.ui.Anchor)3 SmallLabel (org.uberfire.ext.widgets.common.client.common.SmallLabel)3