Examples of Margins


Examples of com.extjs.gxt.ui.client.util.Margins

    treeStore.add(createAlbum("Album 1"), false);
    tree.setLeaf(treeStore.getRootItems().get(0), false);

    BorderLayoutData westData = new BorderLayoutData(LayoutRegion.WEST, 200, 100, 300);
    westData.setMargins(new Margins(5, 0, 5, 5));
    westData.setSplit(true);
    container.add(west, westData);

    ContentPanel center = new ContentPanel();
    center.setHeading("My Images");
//    center.setScrollMode(Scroll.AUTO);
    center.setLayout(new FitLayout());

    BorderLayoutData centerData = new BorderLayoutData(LayoutRegion.CENTER);
    centerData.setMargins(new Margins(5));
    container.add(center, centerData);

    final ExampleServiceAsync service = (ExampleServiceAsync) Registry.get(Examples.SERVICE);

    RpcProxy<List<Photo>> proxy = new RpcProxy<List<Photo>>() {
View Full Code Here

Examples of com.extjs.gxt.ui.client.util.Margins

    // west
    ContentPanel panel = new ContentPanel();
    panel.setHeading("West");
    BorderLayoutData data = new BorderLayoutData(LayoutRegion.WEST, 150, 100, 250);
    data.setMargins(new Margins(0, 5, 0, 0));
    data.setSplit(true);
    data.setCollapsible(true);
    complex.add(panel, data);

    // center
View Full Code Here

Examples of com.google.gdt.eclipse.designer.gxt.model.property.Margins

    @Override
    public void showValue() {
      Object value = getValue();
      int all = 0;
      if (Margins.isMargins(value)) {
        Margins marginsValue = new Margins(value);
        m_topSpinner.setSelection(marginsValue.top);
        m_rightSpinner.setSelection(marginsValue.right);
        m_bottomSpinner.setSelection(marginsValue.bottom);
        m_leftSpinner.setSelection(marginsValue.left);
        //
View Full Code Here

Examples of com.gwtext.client.core.Margins

    public void setAutoHide(boolean autoHide) {
        JavaScriptObjectHelper.setAttribute(jsObj, "autoHide", autoHide);
    }

    public void setCMargins(int top, int left, int right, int  bottom) {
        setCMargins(new Margins(top, left, right, bottom));
    }
View Full Code Here

Examples of com.gwtext.client.core.Margins

    /**
     * The margins to apply to the region.
     */
    public void setMargins(int top, int left, int right, int bottom) {
        setMargins(new Margins(top, left, right, bottom));
    }
View Full Code Here

Examples of com.sencha.gxt.core.client.util.Margins

      } else {
        layoutData = new BoxLayoutData();
        widget.setLayoutData(layoutData);
      }

      Margins cm = layoutData.getMargins();
      if (cm == null) {
        cm = new Margins(0);
        layoutData.setMargins(cm);
      }
    }
   
    if (findWidth || findHeight) {
      for (int i = 0, len = getWidgetCount(); i < len; i++) {
        Widget widget = getWidget(i);

        if (!widget.isVisible()) {
          continue;
        }

        BoxLayoutData layoutData = (BoxLayoutData) widget.getLayoutData();
        Margins cm = layoutData.getMargins();

        calculateHeight += widget.getOffsetHeight();
        maxWidgetWidth = Math.max(maxWidgetWidth, widget.getOffsetWidth());

        calculateHeight += (cm.getTop() + cm.getBottom());
        maxMarginLeft = Math.max(maxMarginLeft, cm.getLeft());
        maxMarginRight = Math.max(maxMarginRight, cm.getRight());
      }
      maxWidgetWidth += (maxMarginLeft + maxMarginRight);

      if (findHeight) {
        h = calculateHeight;
      }

      if (findWidth) {
        w = maxWidgetWidth;
      }
    }

    int pl = 0;
    int pt = 0;
    int pb = 0;
    int pr = 0;
    if (getPadding() != null) {
      pl = getPadding().getLeft();
      pt = getPadding().getTop();
      pb = getPadding().getBottom();
      pr = getPadding().getRight();
    }
   
    if (findHeight) {
      h += pt + pb;
    }
    if (findWidth) {
      w += pl + pr;
    }


    int stretchWidth = w - pl - pr;
    int totalFlex = 0;
    int totalHeight = 0;
    int maxWidth = 0;
    for (int i = 0, len = getWidgetCount(); i < len; i++) {
      Widget widget = getWidget(i);
      widget.addStyleName(CommonStyles.get().positionable());

      widget.getElement().getStyle().setMargin(0, Unit.PX);

      // callLayout(widget, false);

      BoxLayoutData layoutData = (BoxLayoutData) widget.getLayoutData();
      Margins cm = layoutData.getMargins();
     
      totalFlex += layoutData.getFlex();
      totalHeight += widget.getOffsetHeight() + cm.getTop() + cm.getBottom();
      maxWidth = Math.max(maxWidth, widget.getOffsetWidth() + cm.getLeft() + cm.getRight());
    }

    int innerCtWidth = maxWidth + pl + pr;

    if (vBoxLayoutAlign.equals(VBoxLayoutAlign.STRETCH)) {
      getContainerTarget().setSize(w, h, true);
    } else {
      getContainerTarget().setSize(w = Math.max(w, innerCtWidth), h, true);
    }

    int extraHeight = h - totalHeight - pt - pb;
    int allocated = 0;
    int cw, ch, cl;
    int availableWidth = w - pl - pr;

    if (getPack().equals(BoxLayoutPack.CENTER)) {
      pt += extraHeight / 2;
    } else if (getPack().equals(BoxLayoutPack.END)) {
      pt += extraHeight;
    }

    for (int i = 0, len = getWidgetCount(); i < len; i++) {
      Widget widget = getWidget(i);

      BoxLayoutData layoutData = (BoxLayoutData) widget.getLayoutData();
      Margins cm = layoutData.getMargins();
     
      cw = widget.getOffsetWidth();
      ch = widget.getOffsetHeight();
      pt += cm.getTop();
      if (vBoxLayoutAlign.equals(VBoxLayoutAlign.CENTER)) {
        int diff = availableWidth - (cw + cm.getLeft() + cm.getRight());
        if (diff == 0) {
          cl = pl + cm.getLeft();
        } else {
          cl = pl + cm.getLeft() + (diff / 2);
        }
      } else {
        if (vBoxLayoutAlign.equals(VBoxLayoutAlign.RIGHT)) {
          cl = w - (pr + cm.getRight() + cw);
        } else {
          cl = pl + cm.getLeft();
        }
      }

      boolean component = widget instanceof Component;
      Component c = null;
      if (component) {
        c = (Component) widget;
      }

      int height = -1;
      if (component) {
        c.setPosition(cl, pt);
      } else {
        XElement.as(widget.getElement()).setLeftTop(cl, pt);
      }

      if (getPack().equals(BoxLayoutPack.START) && layoutData.getFlex() > 0) {
        int add = (int) Math.floor(extraHeight * (layoutData.getFlex() / totalFlex));
        allocated += add;
        if (isAdjustForFlexRemainder() && i == getWidgetCount() - 1) {
          add += extraHeight - allocated;
        }
        ch += add;
        height = ch;
      }
      if (vBoxLayoutAlign.equals(VBoxLayoutAlign.STRETCH)) {
        applyLayout(
            widget,
            Util.constrain(stretchWidth - cm.getLeft() - cm.getRight(), layoutData.getMinSize(), layoutData.getMaxSize()),
            height);
      } else if (vBoxLayoutAlign.equals(VBoxLayoutAlign.STRETCHMAX)) {
        applyLayout(widget,
            Util.constrain(maxWidth - cm.getLeft() - cm.getRight(), layoutData.getMinSize(), layoutData.getMaxSize()),
            height);
      } else if (height > 0) {
        applyLayout(widget, -1, height);
      }
      pt += ch + cm.getBottom();
    }
  }
View Full Code Here

Examples of com.sencha.gxt.core.client.util.Margins

    if (w == null) {
      return 0;
    }
    Object data = w.getLayoutData();
    if (data instanceof HasMargins) {
      Margins margins = ((HasMargins) data).getMargins();
      if (margins == null) {
        return 0;
      }
      int tot = 0;
      if (margins.getLeft() != -1) {
        tot += margins.getLeft();
      }
      if (margins.getRight() != -1) {
        tot += margins.getRight();
      }
      return tot;
    }
    return 0;
  }
View Full Code Here

Examples of com.sencha.gxt.core.client.util.Margins

  protected int getSideMargins(Widget w) {
    if (GXT.isWebKit()) {
      Object data = w.getLayoutData();
      if (data != null && data instanceof MarginData) {
        MarginData m = (MarginData) data;
        Margins margins = m.getMargins();
        if (margins == null) {
          return 0;
        }
        int tot = 0;
        if (margins.getLeft() != -1) {
          tot += margins.getLeft();
        }
        if (margins.getRight() != -1) {
          tot += margins.getRight();
        }
        return tot;
      }
    } else {
      return w.getElement().<XElement> cast().getMargins(Side.LEFT, Side.RIGHT);
View Full Code Here

Examples of com.sencha.gxt.core.client.util.Margins

    if (w == null) {
      return 0;
    }
    Object data = w.getLayoutData();
    if (data instanceof HasMargins) {
      Margins margins = ((HasMargins) data).getMargins();
      if (margins == null) {
        return 0;
      }
      int tot = 0;
      if (margins.getLeft() != -1) {
        tot += margins.getTop();
      }
      if (margins.getRight() != -1) {
        tot += margins.getBottom();
      }
      return tot;
    }

    return 0;
View Full Code Here

Examples of com.sencha.gxt.core.client.util.Margins

    d.setMoveAfterProxyDrag(false);
    d.setSizeProxyToSource(true);
    d.setEnabled(!portlet.isPinned());

    getWidget(column).insert(portlet, index, new VerticalLayoutData(1, -1, new Margins(0, 0, 10, 0)));
    getWidget(column).forceLayout();
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.