Package net.mygwt.ui.client.data

Examples of net.mygwt.ui.client.data.Model


   * @param model the model
   */
  public static void buildTree(Tree tree, Model model) {
    TreeItem root = tree.getRootItem();
    for (int i = 0; i < model.getChildCount(); i++) {
      Model m = model.getChild(i);
      TreeItem item = new TreeItem();
      item.setText(m.toString());
      root.add(item);
      process(item, m);
    }
  }
View Full Code Here


    }
  }

  private static void process(TreeItem parentItem, Model model) {
    for (int i = 0; i < model.getChildCount(); i++) {
      Model m = model.getChild(i);
      TreeItem item = new TreeItem();
      item.setText(m.toString());
      parentItem.add(item);
      process(item, m);
    }
  }
View Full Code Here

  public ModelComparator(String compareProperty) {
    this.compareProperty = compareProperty;
  }

  public int compare(Object o1, Object o2) {
    Model m1 = (Model) o1;
    Model m2 = (Model) o2;

    o1 = m1.get(compareProperty);
    o2 = m2.get(compareProperty);

    return super.compare(o1, o2);
  }
View Full Code Here

  public String getIconStyle(Object element) {
    return null;
  }

  public String getText(Object element) {
    Model m = (Model) element;
    return m.getAsString(textProperty);
  }
View Full Code Here

  public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
    this.viewer = viewer;
    if (monitorChanges) {
      if (oldInput != null) {
        Model m = (Model) oldInput;
        m.removeChangeListener(this);
      }
      Model m = (Model) newInput;
      m.addChangeListener(this);
    }
  }
View Full Code Here

  public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
    this.viewer = (TreeViewer) viewer;
    if (monitorChanges) {
      if (oldInput != null) {
        Model m = (Model) oldInput;
        m.removeChangeListener(this);
      }
      Model m = (Model) newInput;
      m.addChangeListener(this);
    }
  }
View Full Code Here

  public void modelChanged(ChangeEvent event) {
    int type = event.type;
    switch (type) {
      case Model.Add: {
        Model parent = event.source;
        Model add = event.item;
        viewer.add(parent, add);
        break;
      }
      case Model.Insert: {
        Model parent = event.source;
        Model insert = event.item;
        viewer.insert(parent, insert, event.index);
        break;
      }
      case Model.Remove: {
        viewer.remove(event.item);
View Full Code Here

TOP

Related Classes of net.mygwt.ui.client.data.Model

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.