public SwtWindow(Element self, XulComponent parent, XulDomContainer container, String tagName) {
    super(tagName);

    Shell possibleParent = null;

    orient = Orient.VERTICAL;

    if (container.getOuterContext() != null
        && container.getOuterContext() instanceof Shell
        && (self != null && self.getAttributeValue("proxyoutercontext") != null)) {
      shell = (Shell) container.getOuterContext();
    } else {

      // First, check to see if an outer context was passed before parser started...
      if (container.getOuterContext() != null && container.getOuterContext() instanceof Shell) {
        possibleParent = (Shell) container.getOuterContext();
      }

      // If not, then try to use the API's parent parameter...
      if ((possibleParent == null) && (parent != null)) {
        possibleParent = (Shell) parent.getManagedObject();
      }

      // Otherwise, you're on your own...
      shell =
          (possibleParent != null)
              ? new Shell(possibleParent, SWT.SHELL_TRIM)
              : new Shell(SWT.SHELL_TRIM);
    }

    shell.setLayout(new GridLayout());
    shell.setBackgroundMode(SWT.INHERIT_DEFAULT);
    setManagedObject(shell);
    xulDomContainer = container;
  }
示例#2
0
  /**
   * Child XUL elements need to be notified of visibility changes if they implement Resizable.
   *
   * <p>This method is recursive.
   *
   * @param ele
   */
  private void notifyOnShow(Element ele) {

    if (ele instanceof Resizable) {
      ((Resizable) ele).onResize();
    }
    for (Element e : ele.getChildNodes()) {
      notifyOnShow(e);
    }
  }
  public SwtLabel(Element self, XulComponent parent, XulDomContainer container, String tagName) {
    super(tagName);

    String multi = (self != null) ? self.getAttributeValue("multiline") : null;
    if (multi != null && multi.equals("true")) {
      label = new Label((Composite) parent.getManagedObject(), SWT.WRAP);
      setManagedObject(label);
    } else {
      cLabel = new CLabel((Composite) parent.getManagedObject(), SWT.NONE);
      setManagedObject(cLabel);
    }
  }