Package net.mygwt.ui.client.widget

Examples of net.mygwt.ui.client.widget.ListItem


  }

  public Widget findItem(Object elem) {
    int size = list.getWidgetCount();
    for (int i = 0; i < size; i++) {
      ListItem item = list.getItem(i);
      if (item.getData() == elem) {
        return item;
      }
    }
    return null;
  }
View Full Code Here


    }
    return null;
  }

  public boolean getChecked(Object element) {
    ListItem item = (ListItem) findItem(element);

    if (item != null) {
      return item.isChecked();
    }

    return false;
  }
View Full Code Here

  public void insert(Object elem, int index) {
    renderItem(elem, index);
  }

  public void remove(Object elem) {
    ListItem item = (ListItem) findItem(elem);
    if (item != null) {
      removeElement(elem);
      item.setData(null);
    }
  }
View Full Code Here

      checkChangeListener.remove(listener);
    }
  }

  public boolean setChecked(Object element, boolean state) {
    ListItem item = (ListItem) findItem(element);

    if (item != null) {
      item.setChecked(state);
      return true;
    }

    return false;
  }
View Full Code Here

  public void setSelection(ISelection selection, boolean reveal) {
    java.util.List selected = selection.toList();
    int ct = list.getWidgetCount();
    for (int i = 0; i < ct; i++) {
      ListItem item = list.getItem(i);
      Object elem = item.getData();
      if (selected.contains(elem)) {
        list.select(i);
      } else {
        list.deselect(i);
      }
View Full Code Here

      updateInternal(list.getItem(i));
    }
  }

  public void update(Object elem) {
    ListItem item = (ListItem) findItem(elem);
    updateInternal(item);
  }
View Full Code Here

    renderList();
  }

  private void fireCheckStateChanged(BaseEvent be) {
    if (checkChangeListener != null) {
      ListItem item = (ListItem) be.item;

      CheckStateChangedEvent evt = new CheckStateChangedEvent(this, item.getData(),
          item.isChecked());
      Iterator it = checkChangeListener.iterator();

      while (it.hasNext()) {
        ((ICheckStateListener) it.next()).checkStateChanged(evt);
      }
View Full Code Here

    }
  }

  private void renderItem(Object elem, int position) {
    ILabelProvider lp = (ILabelProvider) getLabelProvider();
    ListItem item = new ListItem();
    item.setData(elem);
    item.setText(lp.getText(elem));
    String style = lp.getIconStyle(elem);
    if (style != null) {
      item.setIconStyle(lp.getIconStyle(elem));
    }
    list.insert(item, position);
  }
View Full Code Here

TOP

Related Classes of net.mygwt.ui.client.widget.ListItem

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.