Search in sources :

Example 1 with IOperator

use of org.jowidgets.cap.common.api.filter.IOperator in project jo-client-platform by jo-source.

the class AttributeFilterControlImpl method setAttributeImpl.

private void setAttributeImpl(final IAttribute<?> attribute, final IFilterType filterType, final boolean setDefaultOperator) {
    Assert.paramNotNull(attribute, "attribute");
    Assert.paramNotNull(filterType, "filterType");
    final IFilterPanelProvider<IOperator> filterPanelProvider = getFilterPanelProvider(attribute, filterType);
    final ICustomWidgetCreator<IFilterControl<IOperator, Object, IUiConfigurableFilter<Object>>> creator;
    creator = createPanelCreator(filterPanelProvider);
    final IComposite composite = getWidget();
    if (filterControl != null) {
        filterControl.removeInputListener(inputListener);
        composite.remove(filterControl);
    }
    filterControl = composite.add(creator, "growx, w 0::");
    filterControl.setEditable(editable);
    filterControl.addInputListener(inputListener);
    filterControl.addValidationConditionListener(validationConditionListener);
    this.operatorProvider = filterPanelProvider.getOperatorProvider();
    cmbOperator.removeInputListener(operatorListener);
    cmbOperator.setElements(operatorProvider.getOperators());
    final IOperator defaultOperator = operatorProvider.getDefaultOperator();
    if (defaultOperator != null) {
        if (setDefaultOperator) {
            cmbOperator.setValue(defaultOperator);
            filterControl.setOperator(defaultOperator);
        }
        setCmbNotEnabledByOperator(defaultOperator);
    }
    cmbOperator.addInputListener(operatorListener);
}
Also used : IOperator(org.jowidgets.cap.common.api.filter.IOperator) IComposite(org.jowidgets.api.widgets.IComposite) IFilterControl(org.jowidgets.cap.ui.api.filter.IFilterControl)

Example 2 with IOperator

use of org.jowidgets.cap.common.api.filter.IOperator in project jo-client-platform by jo-source.

the class AttributeFilterControlImpl method comboBoxOperatorBp.

private static IComboBoxSelectionBluePrint<IOperator> comboBoxOperatorBp() {
    final IBluePrintFactory bpf = Toolkit.getBluePrintFactory();
    final IObjectStringConverter<IOperator> converter = new IObjectStringConverter<IOperator>() {

        @Override
        public String convertToString(final IOperator value) {
            if (value != null) {
                return value.getLabelLong();
            } else {
                return null;
            }
        }

        @Override
        public String getDescription(final IOperator value) {
            if (value != null) {
                return value.getDescription();
            } else {
                return null;
            }
        }
    };
    return bpf.comboBoxSelection(converter).autoSelectionOn();
}
Also used : IOperator(org.jowidgets.cap.common.api.filter.IOperator) IObjectStringConverter(org.jowidgets.api.convert.IObjectStringConverter) IBluePrintFactory(org.jowidgets.api.widgets.blueprint.factory.IBluePrintFactory)

Aggregations

IOperator (org.jowidgets.cap.common.api.filter.IOperator)2 IObjectStringConverter (org.jowidgets.api.convert.IObjectStringConverter)1 IComposite (org.jowidgets.api.widgets.IComposite)1 IBluePrintFactory (org.jowidgets.api.widgets.blueprint.factory.IBluePrintFactory)1 IFilterControl (org.jowidgets.cap.ui.api.filter.IFilterControl)1