protected int getColumnWidth(int col) { int w = cm.getColumnWidth(col); return (El.isBorderBoxTableFixed() ? w : (w - borderWidth > 0 ? w - borderWidth : 0)); }
protected int[] getColumnWidths() { int colCount = cm.getColumnCount(); int[] columnWidths = new int[colCount]; for (int i = 0; i < colCount; i++) { columnWidths[i] = cm.getColumnWidth(i); } return columnWidths; }
protected int getColumnWidths(int start, int end) { int w = 0; for (int i = start; i < end; i++) { if (!cm.isHidden(i)) { w += cm.getColumnWidth(i); } } return w; }
w = cm.getColumnWidth(i); if (!cm.isHidden(i) && !cm.isFixed(i) && i != omitColumn) { cols.push(i); width = 0; for (int i = 0; i < colCount; i++) { w = cm.getColumnWidth(i); if (!cm.isHidden(i) && !cm.isFixed(i) && w > grid.getMinColumnWidth()) { cols.push(i);
protected void autoExpand(boolean preventUpdate) { if (!userResized && grid.getAutoExpandColumn() != null) { int tw = cm.getTotalWidth(false); int aw = grid.getWidth(true) - getScrollAdjust(); if (tw != aw) { int ci = cm.getIndexById(grid.getAutoExpandColumn()); assert ci != Style.DEFAULT : "auto expand column not found"; if (cm.isHidden(ci)) { return; } int currentWidth = cm.getColumnWidth(ci); int cw = Math.min(Math.max(((aw - tw) + currentWidth), grid.getAutoExpandMin()), grid.getAutoExpandMax()); if (cw != currentWidth) { cm.setColumnWidth(ci, cw, true); if (!preventUpdate) { updateColumnWidth(ci, cw); } } } } }
protected void onDragEnd(DragEvent e) { dragging = false; headerDisabled = false; setStyleAttribute("borderLeft", "none"); el().setStyleAttribute("opacity", "0"); el().setWidth(splitterWidth); bar.el().setVisibility(false); int endX = e.getX(); int diff = endX - startX; onColumnSplitterMoved(colIndex, cm.getColumnWidth(colIndex) + diff); }
continue; w += cm.getColumnWidth(k);
protected void updateAllColumnWidths() { int tw = getTotalWidth(); int clen = cm.getColumnCount(); Stack<Integer> ws = new Stack<Integer>(); header.updateAllColumnWidths(); for (int i = 0; i < clen; i++) { ws.push(getColumnWidth(i)); if (footer != null) { footer.updateColumnWidth(i, cm.getColumnWidth(i)); } } NodeList<Element> ns = getRows(); for (int i = 0, len = ns.getLength(); i < len; i++) { Element row = ns.getItem(i); row.getStyle().setPropertyPx("width", tw); if (row.getFirstChild() != null) { row.getFirstChildElement().getStyle().setPropertyPx("width", tw); TableSectionElement e = row.getFirstChild().cast(); TableRowElement nodeList = e.getRows().getItem(0); for (int j = 0; j < clen; j++) { ((Element) nodeList.getChildNodes().getItem(j)).getStyle().setPropertyPx("width", ws.get(j)); } } } templateOnAllColumnWidthsUpdated(ws, tw); syncHScroll(); }
updateColumnWidth(j, cm.getColumnWidth(j)); if (config.getHtml(name) != null) { footer.setHtml(j, config.getHtml(name));
protected void initFields() { ColumnModel cm = grid.getColumnModel(); for (int i = 0, len = cm.getColumnCount(); i < len; i++) { ColumnConfig c = cm.getColumn(i); CellEditor ed = c.getEditor(); Field<?> f = ed != null ? ed.getField() : new LabelField(); if (f instanceof TriggerField<?>) { ((TriggerField<? extends Object>) f).setMonitorTab(true); } f.setWidth(cm.getColumnWidth(i)); HBoxLayoutData ld = new HBoxLayoutData(); if (i == 0) { ld.setMargins(new Margins(0, 1, 2, 1)); } else if (i == len - 1) { ld.setMargins(new Margins(0, 0, 2, 1)); } else { ld.setMargins(new Margins(0, 1, 2, 2)); } f.setMessageTarget("tooltip"); f.addStyleName("x-row-editor-field"); // needed because we remove it from the celleditor clearParent(f); insert(f, i, ld); } initialized = true; }
protected void verifyLayout(boolean force) { if (initialized && (isVisible() || force)) { Element row = (Element) grid.getView().getRow(rowIndex); setSize(El.fly(row).getWidth(false), renderButtons ? btns.getHeight() : 0); syncSize(); ColumnModel cm = grid.getColumnModel(); for (int i = 0, len = cm.getColumnCount(); i < len; i++) { if (!cm.isHidden(i)) { Field<?> f = (Field<?>) getItem(i); f.show(); f.getElement().setAttribute("gxt-dindex", "" + cm.getDataIndex(i)); MarginData md = (MarginData) ComponentHelper.getLayoutData(f); f.setWidth(cm.getColumnWidth(i) - md.getMargins().left - md.getMargins().right); } else { getItem(i).hide(); } } layout(true); positionButtons(); } }