示例#1
0
  public ListBoxDiscrete(ImageResource up, ImageResource down) {
    this.up = up;
    this.down = down;

    img = new ImageButton(down, "Select...");

    HorizontalPanel panel = new HorizontalPanel();
    panel.add(label);
    panel.add(img);
    initWidget(panel);

    setStylePrimaryName("SelectButton");

    img.addClickHandler(this);

    label.addClickHandler(this);

    listTable.addChangeHandler(
        new ChangeHandler() {
          @Override
          public void onChange(ChangeEvent event) {
            if (popup != null) popup.hide();

            label.setText(texts.get(listTable.getSelected()));
          }
        });
  }
示例#2
0
 public void setSelected(T selected) {
   label.setText(texts.get(selected));
   listTable.setSelected(selected);
 }
示例#3
0
 public T getSelected() {
   return listTable.getSelected();
 }
示例#4
0
 public void addChangeHandler(ChangeHandler handler) {
   listTable.addChangeHandler(handler);
 }
示例#5
0
 public void addItem(String text, T object) {
   texts.put(object, text);
   listTable.addItem(text, object);
 }