Search in sources :

Example 1 with Select

use of org.gwtbootstrap3.extras.select.client.ui.Select in project ovirt-engine by oVirt.

the class AbstractModeSwitchingPopupWidget method switchMode.

public void switchMode(boolean advanced) {
    Set<Widget> allConfiguredWidgets = widgetConfiguration.getAll().keySet();
    for (Widget widget : allConfiguredWidgets) {
        widget.setVisible(widgetConfiguration.get(widget).isCurrentlyVisible(advanced, createInstanceMode));
    }
    TabListItem activeTab = ((DialogTabPanel) getWidget()).getActiveTab();
    // select the first tab if the selected tab has been hidden
    if (!advanced && widgetConfiguration.getVisibleInAdvanceMode().keySet().contains(activeTab)) {
        ((DialogTabPanel) getWidget()).switchTab(defaultTab);
    }
}
Also used : DialogTabPanel(org.ovirt.engine.ui.common.widget.dialog.tab.DialogTabPanel) Widget(com.google.gwt.user.client.ui.Widget) TabListItem(org.gwtbootstrap3.client.ui.TabListItem)

Example 2 with Select

use of org.gwtbootstrap3.extras.select.client.ui.Select in project drools-wb by kiegroup.

the class ConstraintValueEditor method literalEditor.

private Widget literalEditor() {
    // Custom screen
    if (this.constraint instanceof SingleFieldConstraint) {
        final SingleFieldConstraint con = (SingleFieldConstraint) this.constraint;
        CustomFormConfiguration customFormConfiguration = getWorkingSetManager().getCustomFormConfiguration(modeller.getPath(), factType, fieldName);
        if (customFormConfiguration != null) {
            Button btnCustom = new Button(con.getValue(), new ClickHandler() {

                public void onClick(ClickEvent event) {
                    showTypeChoice(constraint);
                }
            });
            btnCustom.setEnabled(!this.readOnly);
            return btnCustom;
        }
    }
    // Label if read-only
    if (this.readOnly) {
        return new SmallLabel(getSanitizedValue());
    }
    // Enumeration (these support multi-select for "in" and "not in", so check before comma separated lists)
    if (this.dropDownData != null) {
        final String operator = constraint.getOperator();
        final boolean multipleSelect = OperatorsOracle.operatorRequiresList(operator);
        EnumDropDown enumDropDown = new EnumDropDown(constraint.getValue(), new DropDownValueChanged() {

            public void valueChanged(String newText, String newValue) {
                // Prevent recursion once value change has been applied
                if (!newValue.equals(constraint.getValue())) {
                    constraint.setValue(newValue);
                    executeOnValueChangeCommand();
                }
            }
        }, dropDownData, multipleSelect, modeller.getPath());
        return enumDropDown;
    }
    // Comma separated value list (this will become a dedicated Widget but for now a TextBox suffices)
    String operator = null;
    if (this.constraint instanceof SingleFieldConstraint) {
        SingleFieldConstraint sfc = (SingleFieldConstraint) this.constraint;
        operator = sfc.getOperator();
    }
    if (OperatorsOracle.operatorRequiresList(operator)) {
        return getNewTextBox(DataType.TYPE_STRING);
    }
    // Date picker
    boolean isCEPOperator = CEPOracle.isCEPOperator((this.constraint).getOperator());
    if (DataType.TYPE_DATE.equals(this.fieldType) || (DataType.TYPE_THIS.equals(this.fieldName) && isCEPOperator)) {
        if (this.readOnly) {
            return new SmallLabel(constraint.getValue());
        }
        final DatePicker datePicker = new DatePicker(false);
        // Wire up update handler
        datePicker.addValueChangeHandler(new ValueChangeHandler<Date>() {

            @Override
            public void onValueChange(final ValueChangeEvent<Date> event) {
                final Date date = datePicker.getValue();
                final String sDate = (date == null ? null : DATE_FORMATTER.format(datePicker.getValue()));
                boolean update = constraint.getValue() == null || !constraint.getValue().equals(sDate);
                constraint.setValue(sDate);
                if (update) {
                    executeOnValueChangeCommand();
                }
            }
        });
        datePicker.setFormat(DATE_FORMAT);
        datePicker.setValue(getSanitizedDateValue());
        return datePicker;
    }
    // Default editor for all other literals
    return getNewTextBox(fieldType);
}
Also used : SmallLabel(org.uberfire.ext.widgets.common.client.common.SmallLabel) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) CustomFormConfiguration(org.guvnor.common.services.workingset.client.factconstraints.customform.CustomFormConfiguration) Date(java.util.Date) SingleFieldConstraint(org.drools.workbench.models.datamodel.rule.SingleFieldConstraint) BaseSingleFieldConstraint(org.drools.workbench.models.datamodel.rule.BaseSingleFieldConstraint) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) Button(org.gwtbootstrap3.client.ui.Button) EnumDropDown(org.drools.workbench.screens.guided.rule.client.widget.EnumDropDown) DatePicker(org.uberfire.ext.widgets.common.client.common.DatePicker) DropDownValueChanged(org.uberfire.ext.widgets.common.client.common.DropDownValueChanged)

Example 3 with Select

use of org.gwtbootstrap3.extras.select.client.ui.Select in project kie-wb-common by kiegroup.

the class PeriodBox method createOptionAndAddtoSelect.

private void createOptionAndAddtoSelect(Select typeSelector, String name, String value) {
    Option option = new Option();
    option.setValue(value);
    option.setText(name);
    typeSelector.add(option);
}
Also used : Option(org.gwtbootstrap3.extras.select.client.ui.Option)

Example 4 with Select

use of org.gwtbootstrap3.extras.select.client.ui.Select in project kie-wb-common by kiegroup.

the class PackageListBox method clearSelect.

void clearSelect() {
    if (select != null) {
        select.removeFromParent();
        removeSelect(select.getElement());
    }
    select = new Select();
    panel.setWidget(select);
}
Also used : Select(org.gwtbootstrap3.extras.select.client.ui.Select)

Example 5 with Select

use of org.gwtbootstrap3.extras.select.client.ui.Select in project drools-wb by kiegroup.

the class ActionValueEditor method boundVariable.

private Widget boundVariable() {
    // If there is a bound variable that is the same type of the current variable type, then display a list
    ListBox listVariable = new ListBox();
    listVariable.addItem(GuidedRuleEditorResources.CONSTANTS.Choose());
    List<String> bindings = getApplicableBindings();
    for (String v : bindings) {
        listVariable.addItem(v);
    }
    // Pre-select applicable item
    if (value.getValue().equals("=")) {
        listVariable.setSelectedIndex(0);
    } else {
        for (int i = 0; i < listVariable.getItemCount(); i++) {
            if (listVariable.getItemText(i).equals(value.getValue().substring(1))) {
                listVariable.setSelectedIndex(i);
            }
        }
    }
    // Add event handler
    if (listVariable.getItemCount() > 0) {
        listVariable.addChangeHandler(new ChangeHandler() {

            public void onChange(ChangeEvent event) {
                ListBox w = (ListBox) event.getSource();
                value.setValue("=" + w.getValue(w.getSelectedIndex()));
                executeOnChangeCommand();
                refresh();
            }
        });
    }
    if (this.readOnly) {
        return new SmallLabel(listVariable.getItemText(listVariable.getSelectedIndex()));
    }
    return listVariable;
}
Also used : SmallLabel(org.uberfire.ext.widgets.common.client.common.SmallLabel) ChangeEvent(com.google.gwt.event.dom.client.ChangeEvent) ValueChangeEvent(com.google.gwt.event.logical.shared.ValueChangeEvent) ValueChangeHandler(com.google.gwt.event.logical.shared.ValueChangeHandler) ChangeHandler(com.google.gwt.event.dom.client.ChangeHandler) ListBox(org.gwtbootstrap3.client.ui.ListBox) SingleFieldConstraint(org.drools.workbench.models.datamodel.rule.SingleFieldConstraint) FieldConstraint(org.drools.workbench.models.datamodel.rule.FieldConstraint)

Aggregations

SingleFieldConstraint (org.drools.workbench.models.datamodel.rule.SingleFieldConstraint)2 SmallLabel (org.uberfire.ext.widgets.common.client.common.SmallLabel)2 ChangeEvent (com.google.gwt.event.dom.client.ChangeEvent)1 ChangeHandler (com.google.gwt.event.dom.client.ChangeHandler)1 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)1 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)1 ValueChangeEvent (com.google.gwt.event.logical.shared.ValueChangeEvent)1 ValueChangeHandler (com.google.gwt.event.logical.shared.ValueChangeHandler)1 Widget (com.google.gwt.user.client.ui.Widget)1 Date (java.util.Date)1 BaseSingleFieldConstraint (org.drools.workbench.models.datamodel.rule.BaseSingleFieldConstraint)1 FieldConstraint (org.drools.workbench.models.datamodel.rule.FieldConstraint)1 EnumDropDown (org.drools.workbench.screens.guided.rule.client.widget.EnumDropDown)1 CustomFormConfiguration (org.guvnor.common.services.workingset.client.factconstraints.customform.CustomFormConfiguration)1 Button (org.gwtbootstrap3.client.ui.Button)1 ListBox (org.gwtbootstrap3.client.ui.ListBox)1 TabListItem (org.gwtbootstrap3.client.ui.TabListItem)1 Option (org.gwtbootstrap3.extras.select.client.ui.Option)1 Select (org.gwtbootstrap3.extras.select.client.ui.Select)1 DialogTabPanel (org.ovirt.engine.ui.common.widget.dialog.tab.DialogTabPanel)1