List of usage examples for com.google.gwt.dom.client NodeList getLength
public int getLength()
From source file:com.sencha.gxt.theme.base.client.listview.ListViewCustomAppearance.java
License:sencha.com license
@Override public List<Element> findElements(XElement parent) { NodeList<Element> nodes = parent.select(itemSelector); List<Element> temp = new ArrayList<Element>(); for (int i = 0; i < nodes.getLength(); i++) { temp.add(nodes.getItem(i));/*w w w .j ava 2s .c om*/ } return temp; }
From source file:com.sencha.gxt.theme.base.client.listview.ListViewDefaultAppearance.java
License:sencha.com license
@Override public List<Element> findElements(XElement parent) { NodeList<Element> nodes = parent.select("." + style.item()); List<Element> temp = new ArrayList<Element>(); for (int i = 0; i < nodes.getLength(); i++) { temp.add(nodes.getItem(i));/*from w w w . j a va 2s .c o m*/ } return temp; }
From source file:com.sencha.gxt.theme.base.client.tabs.TabPanelBaseAppearance.java
License:sencha.com license
@Override public void onMouseOut(XElement parent, XElement target) { NodeList<Element> nodeList = parent.select("." + style.tabStripOver()); for (int i = 0; i < nodeList.getLength(); i++) { nodeList.getItem(i).removeClassName(style.tabStripOver()); }/*from www . ja v a 2 s . co m*/ if (target.is("." + style.tabScrollerLeft())) { target.removeClassName(style.tabScrollerLeftOver()); } else if (target.is("." + style.tabScrollerRight())) { target.removeClassName(style.tabScrollerRightOver()); } }
From source file:com.sencha.gxt.theme.base.client.widget.DatePickerBaseAppearance.java
License:sencha.com license
@Override public void onUpdateDayOfWeeks(XElement parent, List<SafeHtml> days) { NodeList<Element> elems = parent.select("." + style.daysWrap() + " span"); for (int i = 0; i < elems.getLength(); i++) { Element elem = elems.getItem(i); SafeHtml day = days.get(i);/*ww w. java 2 s .co m*/ elem.setInnerSafeHtml(day); } }
From source file:com.sencha.gxt.widget.core.client.grid.ColumnFooter.java
License:sencha.com license
private void adjustColumnWidths() { int[] columnWidths = gridView.getColumnWidths(); table.getStyle().setWidth(gridView.getTotalWidth(), Unit.PX); NodeList<Element> ths = table.getFirstChildElement().getFirstChildElement().getChildNodes().cast(); for (int i = 0; i < ths.getLength(); i++) { ths.getItem(i).getStyle().setPropertyPx("width", cm.isHidden(i) ? 0 : columnWidths[i]); }/* w w w .j av a2 s . c o m*/ // column widths wrong on column hide / show if (GXT.isWebKit()) { table.getStyle().setProperty("display", "block"); Scheduler.get().scheduleFinally(new ScheduledCommand() { @Override public void execute() { table.getStyle().clearDisplay(); } }); } }
From source file:com.sencha.gxt.widget.core.client.grid.ColumnHeader.java
License:sencha.com license
protected void cleanCells() { NodeList<Element> tds = DomQuery.select("tr." + styles.headRow() + " > td", table.getElement()); for (int i = 0; i < tds.getLength(); i++) { Element td = tds.getItem(i); if (!td.hasChildNodes()) { XElement.as(td).removeFromParent(); }//from w w w .java2 s . co m } }
From source file:com.sencha.gxt.widget.core.client.grid.ColumnHeader.java
License:sencha.com license
private Element getTableHeader(int columnIndex) { int domIndex = getDomIndexByColumn(columnIndex); NodeList<Element> ths = getTableHeads(); if (ths.getLength() > domIndex) { return ths.getItem(domIndex); }/* w w w .j a v a 2 s . co m*/ return null; }
From source file:com.sencha.gxt.widget.core.client.grid.GridView.java
License:sencha.com license
protected void adjustColumnWidths(int[] columnWidths) { int clen = cm.getColumnCount(); NodeList<Element> tables = scroller.select("." + appearance.styles().dataTable()); for (int t = 0, len = tables.getLength(); t < len; t++) { XElement table = tables.getItem(t).cast(); table.getStyle().setWidth(getTotalWidth(), Unit.PX); NodeList<Element> ths = getTableHeads(table); if (ths == null) { continue; }// w w w .j av a 2 s. c om for (int i = 0; i < ths.getLength(); i++) { ths.getItem(i).getStyle().setPropertyPx("width", cm.isHidden(i) ? 0 : columnWidths[i]); } } for (int i = 0; i < clen; i++) { header.updateColumnWidth(i, columnWidths[i]); if (footer != null) { footer.updateColumnWidth(i, columnWidths[i]); } } header.adjustColumnWidths(columnWidths); // safari cell widths incorrect if (GXT.isSafari()) { repaintGrid(); } }
From source file:com.sencha.gxt.widget.core.client.grid.GridView.java
License:sencha.com license
/** * Makes a pass through the rows in the grid to finalize the appearance, the default implementation in * {@link GridView} assigns the row index property and stripes the rows (if striping is enabled). * * @param startRow the row index//from w ww .j a v a 2 s .c o m * @param skipStripe true to prevent striping (striping is always prevented if {@link GridView#isStripeRows()} returns * false). */ protected void processRows(int startRow, boolean skipStripe) { if (ds.size() < 1) { return; } skipStripe = skipStripe || !isStripeRows(); NodeList<Element> rows = getRows(); String cls = styles.rowAlt(); for (int i = startRow, len = rows.getLength(); i < len; i++) { Element row = rows.getItem(i); row.setPropertyInt("rowindex", i); if (!skipStripe) { boolean isAlt = (i + 1) % 2 == 0; boolean hasAlt = row.getClassName() != null && row.getClassName().indexOf(cls) != -1; if (isAlt == hasAlt) { continue; } if (isAlt) { row.addClassName(cls); } else { row.removeClassName(cls); } } } }
From source file:com.sencha.gxt.widget.core.client.grid.GridView.java
License:sencha.com license
/** * Updates the row width and cell display properties to hide or show the given column. * * @param index the column index/*from www . j a va 2 s . c om*/ * @param hidden true to hide the column */ protected void updateColumnHidden(int index, boolean hidden) { int tw = getTotalWidth(); header.updateColumnHidden(index, hidden); if (footer != null) { footer.updateTotalWidth(getOffsetWidth(), tw); footer.updateColumnHidden(index, hidden); } NodeList<Element> tables = scroller.select("." + appearance.styles().dataTable()); for (int t = 0, len = tables.getLength(); t < len; t++) { XElement table = tables.getItem(t).cast(); table.getStyle().setWidth(getTotalWidth(), Unit.PX); NodeList<Element> ths = getTableHeads(table); if (ths == null) { continue; } if (index < ths.getLength()) { ths.getItem(index).getStyle().setPropertyPx("width", hidden ? 0 : getColumnWidth(index)); } } dataTable.getStyle().setWidth(tw, Unit.PX); // cell widths incorrect if (GXT.isIE() || GXT.isSafari()) { repaintGrid(); } lastViewWidth = -1; if (isForceFit() && !hidden) { ColumnConfig<M, ?> config = cm.getColumn(index); boolean fixed = config.isFixed(); config.setFixed(true); layout(); config.setFixed(fixed); } else { layout(); } templateOnColumnHiddenUpdated(index, hidden, tw); }