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

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


            }
        });
        activeOnlyCheckBox = new CheckBox();
        activeOnlyCheckBox.setBoxLabel(textMessages.activeOnly());
        activeOnlyCheckBox.setValue(true);
        northPanel.add(searchTextBox, new HBoxLayoutData(new Margins(0, 5, 0, 0)))
        northPanel.add(searchButton, new HBoxLayoutData(new Margins(0, 5, 0, 0)))
        northPanel.add(activeOnlyCheckBox, new HBoxLayoutData(new Margins(0, 5, 0, 5)))
       
        treeStore = new TreeStore<TagData>();
        tagTree = new TreePanel<TagData>(treeStore);
        tagTree.setBorders(true);
        tagTree.sinkEvents(Event.ONDBLCLICK);
        tagTree.addListener(Events.OnDoubleClick, new Listener<TreePanelEvent<TagData>>() {
           public void handleEvent(TreePanelEvent<TagData> be)
           {
               TagData clickedTag = be.getItem();
               List<TagData> checkedTags = tagTree.getCheckedSelection();
               for (TagData checkedTag : checkedTags)
               {
                   tagTree.setChecked(checkedTag, false);
               }
               tagTree.setChecked(clickedTag, true);
               doSearch();
           }
        });
        tagTree.setCheckStyle(CheckCascade.NONE);
        tagTree.setCheckNodes(CheckNodes.LEAF);
        tagTree.setCheckable(true);
        tagTree.setDisplayProperty(Constants.NAME);
        tagTree.setWidth(250);
       
        centerPanel.setScrollMode(Scroll.AUTOX);
        List<ColumnConfig> configs = new ArrayList<ColumnConfig>(4);
        ColumnConfig column = new ColumnConfig();
        //column.setToolTip(TOOLTIP_EDIT_PASSWORD);
        column.setId(Constants.TITLE);
        column.setHeader(textMessages.title());
        column.setWidth(200);
        configs.add(column);
        column = new ColumnConfig();
        column.setId(Constants.USERNAME);
        column.setHeader(textMessages.username());
        column.setWidth(100);
        configs.add(column);
        column = new ColumnConfig();
        //column.setToolTip(TOOLTIP_VIEW_PASSWORD_VALUE);
        column.setId(Constants.PASSWORD);
        column.setHeader(textMessages.password());
        column.setWidth(100);
        configs.add(column);
        column = new ColumnConfig();
        column.setId(Constants.TAGS);
        column.setHeader(textMessages.tags());
        column.setWidth(200);
        configs.add(column);
        column = new ColumnConfig();
        column.setId(Constants.NOTES);
        column.setHeader(textMessages.notes());
        column.setWidth(300);
        configs.add(column);
       
        gridStore = new ListStore<PasswordSearchData>();
        ColumnModel cm = new ColumnModel(configs);
        passwordGrid = new Grid<PasswordSearchData>(gridStore, cm);
        passwordGrid.getSelectionModel().setSelectionMode(SelectionMode.SINGLE);
        passwordGrid.setStyleAttribute("borderTop", "none");
        passwordGrid.setBorders(true);
        passwordGrid.setStripeRows(true);
        passwordGrid.addListener(Events.CellDoubleClick, new Listener<GridEvent<PasswordSearchData>>()
        {
            @Override
            public void handleEvent(GridEvent<PasswordSearchData> ge)
            {
                if (2 == ge.getColIndex())
                {
                    doShowPasswordPopup((Long)ge.getModel().get(Constants.ID));
                }
                else
                {
                    doLoadPasswordDialog((Long)ge.getModel().get(Constants.ID));
                }
            }
        });
        centerPanel.add(passwordGrid);
       
        BorderLayoutData northData = new BorderLayoutData(LayoutRegion.NORTH, 100)
        northData.setCollapsible(true)
        northData.setFloatable(false)
        northData.setHideCollapseTool(false)
        northData.setSplit(true);
        northData.setMargins(new Margins(5, 5, 0, 5))
       
        BorderLayoutData westData = new BorderLayoutData(LayoutRegion.WEST, 150)
        westData.setSplit(true)
        westData.setCollapsible(true)
        westData.setMargins(new Margins(5))
       
        radioOR = new Radio();
        radioOR.setBoxLabel(textMessages.or());
        radioOR.setValue(true);
        radioAND = new Radio();
        radioAND.setBoxLabel(textMessages.and());
        tagMatchRG = new RadioGroup();
        tagMatchRG.setBorders(true);
        tagMatchRG.add(radioOR);
        tagMatchRG.add(radioAND);
       
        westPanel.setLayout(new RowLayout(Orientation.VERTICAL));
        westPanel.add(tagTree, new RowData(1, 1));
        westPanel.add(tagMatchRG, new RowData(1, -1));

        BorderLayoutData centerData = new BorderLayoutData(LayoutRegion.CENTER)
        centerData.setMargins(new Margins(5, 0, 5, 0))
       
        add(northPanel, northData);
        add(westPanel, westData);
        add(centerPanel, centerData);
       
View Full Code Here


  protected int getSideMargins(Component c) {
    if (GXT.isWebKit) {
      LayoutData data = getLayoutData(c);
      if (data != null && data instanceof MarginData) {
        MarginData m = (MarginData) data;
        Margins margins = m.getMargins();
        if (margins == null) {
          return 0;
        }
        int tot = 0;
        if (margins.left != -1) {
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

      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

   * 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

  protected int getSideMargins(Component c) {
    if (GXT.isWebKit) {
      LayoutData data = getLayoutData(c);
      if (data != null && data instanceof MarginData) {
        MarginData m = (MarginData) data;
        Margins margins = m.getMargins();
        if (margins == null) {
          return 0;
        }
        int tot = 0;
        if (margins.left != -1) {
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

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.