Search in sources :

Example 1 with IObjectStringConverter

use of org.jowidgets.api.convert.IObjectStringConverter in project jo-client-platform by jo-source.

the class AttributeFilterControlImpl method comboBoxNotBp.

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

        @Override
        public String convertToString(final Boolean bool) {
            if (bool) {
                return NOT.get();
            } else {
                return "";
            }
        }

        @Override
        public String getDescription(final Boolean bool) {
            if (bool) {
                return NOT.get();
            } else {
                return "";
            }
        }
    };
    final IComboBoxSelectionBluePrint<Boolean> result = bpf.comboBoxSelection(converter);
    result.autoCompletionOff().autoSelectionOn().setElements(Boolean.FALSE, Boolean.TRUE);
    return result;
}
Also used : IObjectStringConverter(org.jowidgets.api.convert.IObjectStringConverter) IBluePrintFactory(org.jowidgets.api.widgets.blueprint.factory.IBluePrintFactory)

Example 2 with IObjectStringConverter

use of org.jowidgets.api.convert.IObjectStringConverter 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

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