List of usage examples for com.google.gwt.user.client Element getNextSiblingElement
@Override
public Element getNextSiblingElement()
From source file:com.extjs.gxt.ui.client.widget.tree.DefaultTreeItemUI.java
License:Open Source License
public void afterRender() { if (item.root) return;//from w w w . ja v a2 s . c o m itemEl = item.getElement().getFirstChild().cast(); fly(itemEl).addStyleName(styleTreeItem); El el = item.el(); Element td = el.selectNode("td:first-child").dom; indentEl = td.getFirstChildElement().cast(); jointEl = td.getNextSiblingElement().cast(); jointDivEl = jointEl.getFirstChild().cast(); checkEl = jointEl.getNextSiblingElement().getNextSiblingElement().cast(); checkDivEl = checkEl.getFirstChild().cast(); iconEl = checkEl.getNextSibling().cast(); iconDivEl = iconEl.getFirstChild().cast(); textEl = iconEl.getNextSiblingElement().cast(); textSpanEl = textEl.getFirstChildElement().cast(); containerEl = el.getChild(1); containerEl.setVisible(false); containerEl.makePositionable(); if (item.getItemStyleName() != null) { item.el().firstChild().addStyleName(item.getItemStyleName()); } if (checkEl != null) { fly(checkEl).setVisible(item.tree.getCheckable()); } item.updateIconStyle(); item.updateJointStyle(); if (item.getTextStyle() != null) { onTextStyleChange(item.getTextStyle()); } if (item.isChecked()) { onCheckChange(true); } fly(indentEl).setWidth(item.getIndent() - 18); item.disableTextSelection(true); }
From source file:org.opencms.ade.containerpage.client.CmsContainerpageUtil.java
License:Open Source License
/** * Transforms all contained elements into {@link CmsContainerPageElementPanel}.<p> * //from ww w . j a v a2s. c o m * @param container the container */ public void consumeContainerElements(I_CmsDropContainer container) { // the drag element widgets are created from the existing DOM elements, Element child = (Element) container.getElement().getFirstChildElement(); while (child != null) { boolean isContainerElement = CmsDomUtil.hasClass(CLASS_CONTAINER_ELEMENT_START_MARKER, child); boolean isGroupcontainerElement = CmsDomUtil.hasClass(CLASS_GROUP_CONTAINER_ELEMENT_MARKER, child); if (isContainerElement || isGroupcontainerElement) { String clientId = child.getAttribute("clientId"); String sitePath = child.getAttribute("alt"); String noEditReason = child.getAttribute("rel"); String newType = child.getAttribute("newType"); boolean hasProps = Boolean.parseBoolean(child.getAttribute("hasprops")); boolean hasViewPermission = Boolean.parseBoolean(child.getAttribute("hasviewpermission")); boolean releasedAndNotExpired = Boolean.parseBoolean(child.getAttribute("releasedandnotexpired")); if (isContainerElement) { // searching for content element root Element elementRoot = (Element) child.getNextSibling(); while ((elementRoot != null) && (elementRoot.getNodeType() != Node.ELEMENT_NODE)) { Element temp = elementRoot; elementRoot = (Element) elementRoot.getNextSibling(); temp.removeFromParent(); } if (elementRoot == null) { child.removeFromParent(); child = null; continue; } if (CmsDomUtil.hasClass(CLASS_CONTAINER_ELEMENT_START_MARKER, elementRoot)) { // broken element, already at next start marker child.removeFromParent(); child = elementRoot; continue; } if (CmsDomUtil.hasClass(CLASS_CONTAINER_ELEMENT_END_MARKER, elementRoot)) { // broken element, no content element root child.removeFromParent(); child = (Element) elementRoot.getNextSiblingElement(); elementRoot.removeFromParent(); continue; } else { // looking for the next marker that wraps the current element Element endMarker = (Element) elementRoot.getNextSibling(); // only if the end marker node is not null and has neither the end-marker class or start-marker class // remove the current node and check the next sibling while (!((endMarker == null) || ((endMarker.getNodeType() == Node.ELEMENT_NODE) && (CmsDomUtil.hasClass(CLASS_CONTAINER_ELEMENT_END_MARKER, endMarker) || CmsDomUtil .hasClass(CLASS_CONTAINER_ELEMENT_START_MARKER, endMarker))))) { Element temp = endMarker; endMarker = (Element) endMarker.getNextSibling(); temp.removeFromParent(); } if (endMarker == null) { // broken element, end marker missing elementRoot.removeFromParent(); child.removeFromParent(); child = null; continue; } if (CmsDomUtil.hasClass(CLASS_CONTAINER_ELEMENT_START_MARKER, endMarker)) { // broken element, end marker missing elementRoot.removeFromParent(); child.removeFromParent(); child = endMarker; } CmsDomUtil.removeScriptTags(elementRoot); CmsContainerPageElementPanel containerElement = createElement(elementRoot, container, clientId, sitePath, noEditReason, hasProps, hasViewPermission, releasedAndNotExpired); if ((newType != null) && (newType.length() > 0)) { containerElement.setNewType(newType); } container.adoptElement(containerElement); child.removeFromParent(); child = (Element) endMarker.getNextSiblingElement(); // (Element)container.getElement().getFirstChildElement(); endMarker.removeFromParent(); } } else if (isGroupcontainerElement && (container instanceof CmsContainerPageContainer)) { CmsDomUtil.removeScriptTags(child); CmsGroupContainerElementPanel groupContainer = createGroupcontainer(child, container, clientId, sitePath, noEditReason, hasProps, hasViewPermission, releasedAndNotExpired); groupContainer.setContainerId(container.getContainerId()); container.adoptElement(groupContainer); consumeContainerElements(groupContainer); if (groupContainer.getWidgetCount() == 0) { groupContainer .addStyleName(I_CmsLayoutBundle.INSTANCE.containerpageCss().emptyGroupContainer()); } // important: adding the option-bar only after the group-containers have been consumed addOptionBar(groupContainer); child = (Element) child.getNextSiblingElement(); } } else { Element sibling = (Element) child.getNextSiblingElement(); DOM.removeChild((Element) container.getElement(), child); child = sibling; continue; } } }