Esempio n. 1
0
  public void addToParent(VirtualContainer theParent) {
    if (theParent == null) {
      throw new IllegalArgumentException("Argument cannot be null");
    } else {
      if (!(theParent instanceof SWTContainer)) {
        throw new IllegalArgumentException("Argument must be of SWT type");
      } else {
        if (theParent.getPhysicalComponent() == null) {
          throw new IllegalArgumentException("Cannot add to an uninitialized parent");
        }
      }
    }

    component = new Tree((Composite) theParent.getPhysicalComponent(), SWT.BORDER);

    init();

    if (model != null) {
      generateFromModel(model.getRoot(), getTree());
    }
    getComponent().setSize(width, height);
  }
Esempio n. 2
0
 protected void recurseModel(Object currentNode, TreeItem currItem) {
   for (int i = 0; i < model.getChildCount(currentNode); i++) {
     generateFromModel(model.getChild(currentNode, i), currItem);
   }
 }