public LeftTabPanel() {
    initWidget(main);
    main.add(left);
    left.add(leftTree);
    DecoratorPanel decorator = new DecoratorPanel();
    Style decoratorStyle = decorator.getElement().getStyle();
    decoratorStyle.setPropertyPx("marginLeft", 15);
    Style rightStyle = right.getElement().getStyle();
    rightStyle.setPropertyPx("margin", 5);
    decorator.add(right);

    main.add(decorator);
    leftTree.addSelectionHandler(
        new SelectionHandler<TreeItem>() {
          public void onSelection(SelectionEvent<TreeItem> event) {
            String name = event.getSelectedItem().getText();
            setWidget(right, cogs.get(name));
          }
        });
  }
示例#2
0
  private DivElement addPanel(String styleName, int halign, int valign) {
    DivElement div = Document.get().createDivElement();
    div.setClassName(styleName);

    Style style = div.getStyle();
    style.setPosition(Style.Position.ABSOLUTE);

    switch (halign) {
      case LEFT:
        style.setPropertyPx("left", 0);
        style.setPropertyPx("width", 10);
        break;
      case CENTER:
        style.setPropertyPx("left", 10);
        style.setPropertyPx("right", 10);
        break;
      case RIGHT:
        style.setPropertyPx("right", 0);
        style.setPropertyPx("width", 10);
        break;
    }
    switch (valign) {
      case TOP:
        style.setPropertyPx("top", 0);
        style.setPropertyPx("height", 26);
        break;
      case MIDDLE:
        style.setPropertyPx("top", 26);
        style.setPropertyPx("bottom", 26);
        break;
      case BOTTOM:
        style.setPropertyPx("bottom", 0);
        style.setPropertyPx("height", 26);
    }

    layout_.getElement().appendChild(div);
    return div;
  }