Example usage for com.google.gwt.user.client.ui ValueListBox setValue

List of usage examples for com.google.gwt.user.client.ui ValueListBox setValue

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui ValueListBox setValue.

Prototype

public void setValue(T value) 

Source Link

Document

Set the value and display it in the select element.

Usage

From source file:com.tasktop.c2c.server.tasks.client.widgets.AbstractEditTaskView.java

License:Open Source License

static <T> void configureValues(ValueListBox<T> box, List<T> values) {
    if (values != null && !values.isEmpty()) {
        box.setValue(values.get(0));
        box.setAcceptableValues(values);
    }/* www.j  a va  2 s  .c  o m*/
}

From source file:jdramaix.client.ScrollListSample.java

License:Apache License

private Widget createEffectSelector() {
    ValueListBox<Effect> listBox = new ValueListBox<Effect>(new AbstractRenderer<Effect>() {
        @Override/*www .j a  v  a  2 s  .  c  om*/
        public String render(Effect object) {
            return object != null ? object.name().toLowerCase() : "";
        }
    });

    listBox.setValue(currentEffect);
    listBox.setAcceptableValues(Arrays.asList(Effect.values()));
    listBox.addValueChangeHandler(new ValueChangeHandler<Effect>() {
        @Override
        public void onValueChange(ValueChangeEvent<Effect> event) {
            Effect effect = event.getValue();

            if (currentEffect != Effect.NONE) {
                effectContainer.removeClassName(currentEffect.getEffectStyle());
            }

            if (effect != Effect.NONE) {
                effectContainer.addClassName(effect.getEffectStyle());
            }

            currentEffect = effect;
        }
    });
    return listBox;
}

From source file:org.jboss.errai.demo.grocery.client.local.ValueListBoxProducer.java

License:Apache License

@Produces
public ValueListBox<Integer> createValueListBox() {
    Collection<Integer> values = new ArrayList<Integer>();
    values.add(Integer.valueOf(1));
    values.add(Integer.valueOf(2));
    values.add(Integer.valueOf(5));
    values.add(Integer.valueOf(10));
    values.add(Integer.valueOf(25));

    final ValueListBox<Integer> radiusPicker = new ValueListBox<Integer>();
    radiusPicker.setValue(Integer.valueOf(25));
    radiusPicker.setAcceptableValues(values);
    return radiusPicker;
}

From source file:org.kaaproject.kaa.server.admin.client.mvp.activity.ApplicationActivity.java

License:Apache License

@Override
protected void onEntityRetrieved() {
    if (!create) {
        detailsView.setTitle(entity.getName());
        detailsView.getApplicationToken().setValue(entity.getApplicationToken());
    }// w ww  .j  av a 2 s.  c om
    detailsView.getApplicationName().setValue(entity.getName());

    ValueListBox<String> serviceNames = this.detailsView.getCredentialsServiceName();
    if (serviceNames != null) {
        KaaAdmin.getDataSource().getCredentialsServiceNames(new AsyncCallback<List<String>>() {

            @Override
            public void onFailure(Throwable caught) {
                Utils.handleException(caught, ApplicationActivity.this.detailsView);
            }

            @Override
            public void onSuccess(List<String> result) {
                ApplicationActivity.this.detailsView.getCredentialsServiceName().setAcceptableValues(result);
            }
        });
        serviceNames.setValue(this.entity.getCredentialsServiceName());
    }
}