Package com.extjs.gxt.ui.client.util

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


    grid.defaultContextMenu();
    grid.setSize(GRID_WIDTH, GRID_HEIGTH);
    grid.setBorders(true);
    grid.defaultActionOnSelectItem();
    this.setBottomComponent(grid.getToolBar());
    add(grid, new RowData(GRID_WIDTH, Style.DEFAULT, new Margins()));
  }
View Full Code Here


   * Creates a new layout data.
   *
   * @param margin the margin
   */
  public MarginData(int margin) {
    this.margins = new Margins(margin);
  }
View Full Code Here

   * @param right the right margin
   * @param bottom the bottom margin
   * @param left the left margin
   */
  public MarginData(int top, int right, int bottom, int left) {
    this.margins = new Margins(top, right, bottom, left);
  }
View Full Code Here

        layoutData = (HBoxLayoutData) d;
      } else {
        layoutData = new HBoxLayoutData();
      }

      Margins cm = layoutData.getMargins();
      totalFlex += layoutData.getFlex();
      totalWidth += c.getWidth() + cm.left + cm.right;
      maxHeight = Math.max(maxHeight, c.getHeight() + cm.top + cm.bottom);
    }

    int innerCtHeight = maxHeight + t + getPadding().bottom;

    if (hBoxLayoutAlign.equals(HBoxLayoutAlign.STRETCH)) {
      innerCt.setSize(w, h, true);
    } else if (hBoxLayoutAlign.equals(HBoxLayoutAlign.MIDDLE) || hBoxLayoutAlign.equals(HBoxLayoutAlign.BOTTOM)) {
      innerCt.setSize(w, h = Math.max(h, innerCtHeight), true);
    } else {
      innerCt.setSize(w, innerCtHeight, true);
    }

    int extraWidth = w - totalWidth - l - getPadding().right;
    int allocated = 0;
    int cw, ch, ct;
    int availableHeight = h - t - getPadding().bottom;

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

    for (int i = 0; i < container.getItemCount(); i++) {
      BoxComponent c = (BoxComponent) container.getItem(i);
      HBoxLayoutData layoutData = null;
      LayoutData d = getLayoutData(c);
      if (d != null && d instanceof HBoxLayoutData) {
        layoutData = (HBoxLayoutData) d;
      } else {
        layoutData = new HBoxLayoutData();
      }
      Margins cm = layoutData.getMargins();
      cw = c.getWidth();
      ch = c.getHeight();
      l += cm.left;
      if (hBoxLayoutAlign.equals(HBoxLayoutAlign.MIDDLE)) {
        int diff = availableHeight - (ch + cm.top + cm.bottom);
View Full Code Here

          initSplitBar(LayoutRegion.SOUTH, north, data);
        } else {
          removeSplitBar(north);
        }
        Rectangle b = new Rectangle();
        Margins m = data.getMargins();
        float s = data.getSize() <= 1 ? data.getSize() * size.height : data.getSize();
        b.height = (int) s;
        b.width = w - (m.left + m.right);
        b.x = m.left;
        b.y = m.top;
        centerY = b.height + b.y + m.bottom;
        centerH -= centerY;
        b.x += sLeft;
        b.y += sTop;
        applyLayout(north, b);
      } else {
        removeSplitBar(north);
      }

    }
    if (south != null) {
      BorderLayoutData data = (BorderLayoutData) getLayoutData(south);
      south.setVisible(!data.isHidden());
      if (!data.isHidden()) {
        if (south.getData("init") == null) {
          initPanel(south);
        }
        if (data.isSplit()) {
          initSplitBar(LayoutRegion.NORTH, south, data);
        } else {
          removeSplitBar(south);
        }
        Rectangle b = south.getBounds(false);
        Margins m = data.getMargins();
        float s = data.getSize() <= 1 ? data.getSize() * size.height : data.getSize();
        b.height = (int) s;
        b.width = w - (m.left + m.right);
        b.x = m.left;
        int totalHeight = (b.height + m.top + m.bottom);
        b.y = h - totalHeight + m.top;
        centerH -= totalHeight;
        b.x += sLeft;
        b.y += sTop;
        applyLayout(south, b);
      } else {
        removeSplitBar(south);
      }
    }

    if (west != null) {
      BorderLayoutData data = (BorderLayoutData) getLayoutData(west);
      west.setVisible(!data.isHidden());
      if (!data.isHidden()) {
        if (west.getData("init") == null) {
          initPanel(west);
        }

        if (data.isSplit()) {
          initSplitBar(LayoutRegion.EAST, west, data);
        } else {
          removeSplitBar(west);
        }

        Rectangle box = new Rectangle();
        Margins m = data.getMargins();
        float s = data.getSize() <= 1 ? data.getSize() * size.width : data.getSize();
        box.width = (int) s;
        box.height = centerH - (m.top + m.bottom);
        box.x = m.left;
        box.y = centerY + m.top;
        int totalWidth = (box.width + m.left + m.right);
        centerX += totalWidth;
        centerW -= totalWidth;
        box.x += sLeft;
        box.y += sTop;
        applyLayout(west, box);

      } else {
        removeSplitBar(west);
      }

    }
    if (east != null) {
      BorderLayoutData data = (BorderLayoutData) getLayoutData(east);
      east.setVisible(!data.isHidden());
      if (!data.isHidden()) {
        if (east.getData("init") == null) {
          initPanel(east);
        }

        if (data.isSplit()) {
          initSplitBar(LayoutRegion.WEST, east, data);
        } else {
          removeSplitBar(east);
        }
        Rectangle b = east.getBounds(false);
        Margins m = data.getMargins();
        float s = data.getSize() <= 1 ? data.getSize() * size.width : data.getSize();
        b.width = (int) s;
        b.height = centerH - (m.top + m.bottom);
        int totalWidth = (b.width + m.left + m.right);
        b.x = w - totalWidth + m.left;
        b.y = centerY + m.top;
        centerW -= totalWidth;
        b.x += sLeft;
        b.y += sTop;
        applyLayout(east, b);
      } else {
        removeSplitBar(east);
      }
    }

    lastCenter = new Rectangle(centerX, centerY, centerW, centerH);

    if (center != null) {
      BorderLayoutData data = (BorderLayoutData) getLayoutData(center);
      Margins m = data.getMargins();
      lastCenter.x = centerX + m.left;
      lastCenter.y = centerY + m.top;
      lastCenter.width = centerW - (m.left + m.right);
      lastCenter.height = centerH - (m.top + m.bottom);
      lastCenter.x += sLeft;
View Full Code Here

   * Creates a new layout instance with the given margin.
   *
   * @param margin the margin
   */
  public FlowLayout(int margin) {
    setMargins(new Margins(margin));
  }
View Full Code Here

   * Sets the margins using the give margin.
   *
   * @param margin the margin
   */
  public void setMargin(int margin) {
    setMargins(new Margins(margin));
  }
View Full Code Here

      int tx = x;
      int ty = sTop;
      int tw = (int) width;
      int th = (int) height;

      Margins m = data.getMargins();
      if (m != null) {
        tx += m.left;
        ty += m.top;
        if (data.getHeight() != -1) {
          th -= m.top;
View Full Code Here

      if (d != null && d instanceof VBoxLayoutData) {
        layoutData = (VBoxLayoutData) d;
      } else {
        layoutData = new VBoxLayoutData();
      }
      Margins cm = layoutData.getMargins();
      totalFlex += layoutData.getFlex();
      totalHeight += c.getHeight() + cm.top + cm.bottom;
      maxWidth = Math.max(maxWidth, c.getWidth() + cm.left + cm.right);
    }

    int innerCtWidth = maxWidth + l + getPadding().right;

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

    int extraHeight = h - totalHeight - t - getPadding().bottom;
    int allocated = 0;
    int cw, ch, cl;
    int availableWidth = w - l - getPadding().right;

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

    for (int i = 0; i < container.getItemCount(); i++) {
      BoxComponent c = (BoxComponent) container.getItem(i);
      VBoxLayoutData layoutData = null;
      LayoutData d = getLayoutData(c);
      if (d != null && d instanceof VBoxLayoutData) {
        layoutData = (VBoxLayoutData) d;
      } else {
        layoutData = new VBoxLayoutData();
      }
      Margins cm = layoutData.getMargins();
      cw = c.getWidth();
      ch = c.getHeight();
      t += cm.top;
      if (vBoxLayoutAlign.equals(VBoxLayoutAlign.CENTER)) {
        int diff = availableWidth - (cw + cm.left + cm.right);
View Full Code Here

    ColumnModel cm = new ColumnModel(configs);

    ListStore<CautionFournieDto> data = new ListStore<CautionFournieDto>();
    cautionFournieGrid = new CustomEditorGrid<CautionFournieDto>(data, cm);
    cautionFieldset.add(cautionFournieGrid, new RowData(Style.DEFAULT, 145.0, new Margins()));
   
    cautionFournieGrid.addListener(Events.BeforeEdit, new Listener<GridEvent<CautionFournieDto>>() {
      public void handleEvent(final GridEvent<CautionFournieDto> be) {
        if((user.getBadmin() != null && user.getBadmin()) ||
            (role !=null && role.getBcontributeur()!=null && role.getBcontributeur())){
View Full Code Here

TOP

Related Classes of com.extjs.gxt.ui.client.util.Margins

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.