/** * Inserts the given child as the first child of this node. * * @param child the child to be inserted * @return The node being inserted */ public final Node insertFirst(Node child) { assert (child != null) : "Cannot add a null child node"; return insertBefore(child, getFirstChild()); }
/** * Inserts the given child as the first child of this node. * * @param child the child to be inserted * @return The node being inserted */ public final Node insertFirst(Node child) { assert (child != null) : "Cannot add a null child node"; return insertBefore(child, getFirstChild()); }
/** * Inserts the given child as the first child of this node. * * @param child the child to be inserted * @return The node being inserted */ public final Node insertFirst(Node child) { assert (child != null) : "Cannot add a null child node"; return insertBefore(child, getFirstChild()); }
/** * The first child of this node. If there is no such node, this returns * <code>null</code>. * @return The first child of this node. */ public final OMNode getFirstChild() { Node firstChild = ot.getFirstChild(); return (firstChild != null) ? convert(firstChild) : null; }
@Override public Node getFirstChild() { return new NodeWrapper(node.getFirstChild()); }
/** * The first child of this node. If there is no such node, this returns * <code>null</code>. * @return The first child of this node. */ public final OMNode getFirstChild() { Node firstChild = ot.getFirstChild(); return (firstChild != null) ? convert(firstChild) : null; }
@Override public Node getFirstChild() { return new NodeWrapper(node.getFirstChild()); }
/** * Returns the grid's <TD> HtmlElement at the specified coordinates. * * @param row the row index in which to find the cell * @param col the column index of the cell * @return the <TD> at the specified coordinates */ public Element getCell(int row, int col) { // ROW DIV TABLE TR TD Element rowEl = getRow(row); return (Element) ((rowEl != null && rowEl.hasChildNodes()) ? rowEl.getFirstChild().getFirstChild().getFirstChild().getChildNodes().getItem(col) : null); }
private Element getWrapperElement() { return getElement().getFirstChild().getFirstChild().cast(); }
public void setFocus(String itemKey, String columnKey) { HasWidgets row = tableWidget.getRenderedRowByKey(itemKey); int columnIndex = Arrays.asList(tableWidget.getVisibleColOrder()).indexOf(columnKey); for (Widget childWidget : row) { Element element = ((Widget) row).getElement(); if (element.getChild(columnIndex).getFirstChild() == childWidget.getElement().getParentNode()) { this.focusWidget(childWidget); break; } } }
/** * Wrap all the elements in the matched set into a single wrapper element. This is different from * .wrap() where each element in the matched set would get wrapped with an element. This wrapping * process is most useful for injecting additional structure into a document, without ruining the * original semantic qualities of a document. * * This works by going through the first element provided (which is generated, on the fly, from * the provided HTML) and finds the deepest descendant element within its structure -- it is that * element that will enwrap everything else. */ public GQuery wrapAll(GQuery query) { if (!isEmpty()) { GQuery wrap = query.clone(); if (get(0).getParentNode() != null) { wrap.insertBefore(get(0)); } for (Element e : wrap.elements) { Node n = e; while (n.getFirstChild() != null && n.getFirstChild().getNodeType() == Node.ELEMENT_NODE) { n = n.getFirstChild(); } $((Element) n).append(this); } } return this; }
private void removeSlotFocus() { if (focusedSlot < 0) { return; } if (focusedSlot == 0) { Element child = tr.getChild(focusedSlot).getFirstChild().cast(); child.setClassName( VScrollTablePatched.this.getStylePrimaryName() + "-resizer"); } else if (focusedSlot > 0) { Element child = tr.getChild(focusedSlot - 1).getFirstChild() .cast(); child.setClassName( VScrollTablePatched.this.getStylePrimaryName() + "-resizer"); } focusedSlot = -1; }
private void setHeight( int height ) { for ( int i = 0; i < tre.getChildCount(); i++ ) { tre.getChild( i ).getFirstChild().<DivElement>cast().getStyle().setHeight( height, Unit.PX ); } fireResizeEvent(); }
/** Improves splitter visibility. */ public void tuneSplitter(SplitLayoutPanel splitLayoutPanel) { NodeList<Node> nodes = splitLayoutPanel.getElement().getChildNodes(); for (int i = 0; i < nodes.getLength(); i++) { Node node = nodes.getItem(i); if (node.hasChildNodes()) { com.google.gwt.dom.client.Element el = node.getFirstChild().cast(); if ("gwt-SplitLayoutPanel-HDragger".equals(el.getClassName())) { tuneSplitter(el); } } } }
/** Improves splitter visibility. */ private void tuneSplitter(SplitLayoutPanel splitLayoutPanel) { NodeList<Node> nodes = splitLayoutPanel.getElement().getChildNodes(); for (int i = 0; i < nodes.getLength(); i++) { Node node = nodes.getItem(i); if (node.hasChildNodes()) { Element el = node.getFirstChild().cast(); String className = el.getClassName(); if (HORIZONTAL_DRAGGER_CLASS.equals(className)) { tuneVerticalSplitter(el); } else if (VERTICAL_DRAGGER_CLASS.equals(className)) { tuneHorizontalSplitter(el); } } } }
/** Makes splitter better. */ public void tuneSplitters() { NodeList<Node> nodes = splitPanel.getElement().getChildNodes(); boolean firstFound = false; for (int i = 0; i < nodes.getLength(); i++) { Node node = nodes.getItem(i); if (node.hasChildNodes()) { com.google.gwt.dom.client.Element el = node.getFirstChild().cast(); if ("gwt-SplitLayoutPanel-HDragger".equals(el.getClassName())) { if (!firstFound) { firstFound = true; tuneLeftSplitter(el); } else { tuneRightSplitter(el); } } else if ("gwt-SplitLayoutPanel-VDragger".equals(el.getClassName())) { tuneBottomSplitter(el); } } } }
private void focusSlot(int index) { removeSlotFocus(); if (index > 0) { Element child = tr.getChild(index - 1).getFirstChild().cast(); child.setClassName( VScrollTablePatched.this.getStylePrimaryName() + "-resizer"); child.addClassName(VScrollTablePatched.this.getStylePrimaryName() + "-focus-slot-right"); } else { Element child = tr.getChild(index).getFirstChild().cast(); child.setClassName( VScrollTablePatched.this.getStylePrimaryName() + "-resizer"); child.addClassName(VScrollTablePatched.this.getStylePrimaryName() + "-focus-slot-left"); } focusedSlot = index; }
public void show(final int mx, final int my, int columnIndex, int rowIndex, String group, boolean asProperty) { super.show(mx, my, columnIndex, group, asProperty); columnContextLIElement .getChild(1) // a element .getChild(3) // span element .getFirstChild() // b element .getChild(0) // text .setNodeValue(group); mapEvent(insertRowAboveLIElement, new InsertRowEvent(rowIndex)); mapEvent(insertRowBelowLIElement, new InsertRowEvent(rowIndex + 1)); mapEvent(duplicateRowLIElement, new DuplicateRowEvent(rowIndex)); mapEvent(deleteRowLIElement, new DeleteRowEvent(rowIndex)); } }
protected void onAdd(List<M> models, int index) { if (rendered) { if (all.getCount() == 0) { refresh(); return; } NodeList<Element> nodes = bufferRender(models); Element[] elements = Util.toElementArray(nodes); all.insert(elements, index); Element ref = index == 0 ? all.getElement(elements.length) : all.getElement(index - 1); for (int i = elements.length - 1; i >= 0; i--) { Node n = ref.getParentNode(); if (index == 0) { n.insertBefore(elements[i], n.getFirstChild()); } else { Node next = ref == null ? null : ref.getNextSibling(); if (next == null) { n.appendChild(elements[i]); } else { n.insertBefore(elements[i], next); } } if (GXT.isAriaEnabled()) { elements[i].setId(XDOM.getUniqueId()); } } updateIndexes(index, -1); } }
protected boolean addTreeSpacer(UIDL rowUidl) { if (cellShowsTreeHierarchy(getElement().getChildCount() - 1)) { Element container = (Element) getElement().getLastChild() .getFirstChild(); if (rowUidl.hasAttribute("icon")) { Icon icon = client .getIcon(rowUidl.getStringAttribute("icon")); icon.setAlternateText("icon"); container.insertFirst(icon.getElement()); } String classname = "v-treetable-treespacer"; if (rowUidl.getBooleanAttribute("ca")) { canHaveChildren = true; open = rowUidl.getBooleanAttribute("open"); classname += open ? " v-treetable-node-open" : " v-treetable-node-closed"; } treeSpacer = Document.get().createSpanElement(); treeSpacer.setClassName(classname); container.insertFirst(treeSpacer); depth = rowUidl.hasAttribute("depth") ? rowUidl.getIntAttribute("depth") : 0; setIndent(); isTreeCellAdded = true; return true; } return false; }