List of usage examples for com.google.gwt.dom.client NodeList getLength
public int getLength()
From source file:org.opencms.ade.contenteditor.client.CmsContentEditor.java
License:Open Source License
/** * Initializes the editor.<p>/* w w w . java2s .c o m*/ * * @param context the editor context * @param contentDefinition the content definition * @param formParent the inline form parent panel, used for inline editing only * @param inline <code>true</code> to render the editor for inline editing * @param mainLocale the main language to copy in case the element language node does not exist yet */ void initEditor(CmsEditorContext context, CmsContentDefinition contentDefinition, I_CmsInlineFormParent formParent, boolean inline, String mainLocale) { m_context = context; m_locale = contentDefinition.getLocale(); m_entityId = contentDefinition.getEntityId(); m_deleteOnCancel = contentDefinition.isDeleteOnCancel(); m_autoUnlock = contentDefinition.isAutoUnlock(); m_isDirectEdit = contentDefinition.isDirectEdit(); initClosingHandler(); setContentDefinition(contentDefinition); initToolbar(); if (inline && (formParent != null)) { if ((mainLocale != null) && (CmsDomUtil.querySelector("[about^='" + m_entityId + "']", formParent.getElement()) == null)) { // in case a main locale is given and there are not any HTML elements attributed to the current entity id, // check if the content was rendered for the main locale CmsUUID structureId = CmsContentDefinition.entityIdToUuid(m_entityId); String mainLocaleEntityId = CmsContentDefinition.uuidToEntityId(structureId, mainLocale); NodeList<Element> elements = CmsDomUtil.querySelectorAll("[about^='" + mainLocaleEntityId + "']", formParent.getElement()); if (elements.getLength() > 0) { for (int i = 0; i < elements.getLength(); i++) { Element element = elements.getItem(i); element.setAttribute("about", element.getAttribute("about").replace(mainLocaleEntityId, m_entityId)); } } } initEditOverlay(formParent.getElement()); addOverlayClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { exitWithSaving(); } }); m_hideHelpBubblesButton.setVisible(false); setNativeResourceInfo(m_sitePath, m_locale); initEntityObserver(); if (m_definitions.get(m_locale).hasEditorChangeHandlers()) { initEditorChangeHandlers(m_definitions.get(m_locale).getEditorChangeScopes()); } renderInlineEntity(m_entityId, formParent); } else { initFormPanel(); renderFormContent(); fixFocus(); } if (contentDefinition.isPerformedAutocorrection()) { CmsNotification.get().send(CmsNotification.Type.NORMAL, Messages.get().key(Messages.GUI_WARN_INVALID_XML_STRUCTURE_0)); setChanged(); } }
From source file:org.opencms.ugc.client.CmsUgcWrapper.java
License:Open Source License
/** * Gets all form fields.<p>/* w ww . java2s . c o m*/ * * @return the list of form fields */ List<InputElement> getAllFields() { NodeList<Element> fields = getElement().getElementsByTagName(InputElement.TAG); List<InputElement> result = Lists.newArrayList(); for (int i = 0; i < fields.getLength(); i++) { InputElement field = InputElement.as(fields.getItem(i)); result.add(field); } return result; }
From source file:org.opencms.ui.client.CmsBreadCrumbConnector.java
License:Open Source License
/** * Updates the entry max-width according to the available space.<p> */// w w w.j a v a 2 s . com void updateMaxWidth() { Element base = getWidget().getElement(); int availableWidth = base.getOffsetWidth(); int requiredWidth = 0; NodeList<Element> children = CmsDomUtil.querySelectorAll("div > a, div > span", base); for (int i = 0; i < children.getLength(); i++) { Element child = children.getItem(i); Style style = child.getFirstChildElement().getStyle(); style.setProperty("maxWidth", "none"); requiredWidth += child.getOffsetWidth(); style.clearProperty("maxWidth"); } if (requiredWidth > availableWidth) { int padding = 30 + ((children.getLength() - 1) * 35); int maxWidth = (availableWidth - padding) / children.getLength(); setMaxWidth(maxWidth + "px"); } else { setMaxWidth("none"); } }
From source file:org.opennms.features.gwt.combobox.client.NodeSuggestionCombobox.java
License:Open Source License
/** * This is the entry point method./*from ww w. j av a 2s . com*/ */ @Override public void onModuleLoad() { if (Window.Navigator.getUserAgent().contains("MSIE")) { NodeList<Element> divs = RootPanel.getBodyElement().getElementsByTagName("div"); for (int j = 0; j < divs.getLength(); j++) { Element element = divs.getItem(j); if (element.hasAttribute("name") && element.getAttribute("name").contains("opennms-nodeSuggestionCombobox")) { createView(element); } } } else { NodeList<Element> nodes = RootPanel.getBodyElement() .getElementsByTagName("opennms:nodeSuggestionCombobox"); if (nodes.getLength() > 0) { for (int i = 0; i < nodes.getLength(); i++) { createView(nodes.getItem(i)); } } } }
From source file:org.opennms.features.gwt.graph.resource.list.client.GraphResourceList.java
License:Open Source License
/** * This is the entry point method./*from w w w . ja v a 2s. co m*/ */ @Override public void onModuleLoad() { if (Navigator.getUserAgent().contains("MSIE")) { NodeList<Element> divs = RootPanel.getBodyElement().getElementsByTagName("div"); for (int k = 0; k < divs.getLength(); k++) { Element element = divs.getItem(k); if (element.hasAttribute("name")) { if (element.getAttribute("name").equals("opennms-kscChooseResourceList")) { createKscChooseResourceView(element); } else if (element.getAttribute("name").equals("opennms-graphResourceList")) { createGraphResourceView(element); } else if (element.getAttribute("name").equals("opennms-nodeSnmpReportList")) { createKscReportListView(element); } else if (element.getAttribute("name").equals("opennms-kscCustomReportList")) { createKscCustomReportView(element); } else if (element.getAttribute("name").equals("opennms-reportSelectionList")) { createReportSelectView(element); } } } } else { NodeList<Element> kscChooseResourceList = RootPanel.getBodyElement() .getElementsByTagName("opennms:kscChooseResourceList"); if (kscChooseResourceList.getLength() > 0) { for (int i = 0; i < kscChooseResourceList.getLength(); i++) { Element elem = kscChooseResourceList.getItem(i); createKscChooseResourceView(elem); } } NodeList<Element> graphResourceListNodes = RootPanel.getBodyElement() .getElementsByTagName("opennms:graphResourceList"); if (graphResourceListNodes.getLength() > 0) { for (int i = 0; i < graphResourceListNodes.getLength(); i++) { Element elem = graphResourceListNodes.getItem(i); createGraphResourceView(elem); } } NodeList<Element> nodeSnmpReportNodes = RootPanel.getBodyElement() .getElementsByTagName("opennms:nodeSnmpReportList"); if (nodeSnmpReportNodes.getLength() > 0) { for (int i = 0; i < nodeSnmpReportNodes.getLength(); i++) { Element elem = nodeSnmpReportNodes.getItem(i); createKscReportListView(elem); } } NodeList<Element> kscCustomReportNodes = RootPanel.getBodyElement() .getElementsByTagName("opennms:kscCustomReportList"); if (kscCustomReportNodes.getLength() > 0) { for (int i = 0; i < kscCustomReportNodes.getLength(); i++) { Element elem = kscCustomReportNodes.getItem(i); createKscCustomReportView(elem); } } NodeList<Element> reportSelectListNodes = RootPanel.getBodyElement() .getElementsByTagName("opennms:reportSelectionList"); if (reportSelectListNodes.getLength() > 0) { for (int i = 0; i < reportSelectListNodes.getLength(); i++) { Element elem = reportSelectListNodes.getItem(i); createReportSelectView(elem); } } } }
From source file:org.opennms.features.gwt.ksc.add.client.KSCResourceAddGraph.java
License:Open Source License
@Override public void onModuleLoad() { final KscReportService service = new DefaultKscReportService(); final NodeList<Element> nodes = RootPanel.getBodyElement().getElementsByTagName("opennms-addKscReport"); if (nodes.getLength() > 0) { service.getAllReports(new RequestCallback() { @Override//from w w w . j a va 2s . c o m public void onResponseReceived(final Request request, final Response response) { final String responseText; if (response.getStatusCode() == 200) { responseText = response.getText(); } else { if (DEBUG) { responseText = m_debugResponse; } else { Window.alert("Error occurred retrieving list of KSC reports (response was " + response.getStatusCode() + "."); responseText = null; } } if (responseText != null) { handleResponseText(nodes, responseText); } } @Override public void onError(final Request request, final Throwable exception) { if (DEBUG) { handleResponseText(nodes, m_debugResponse); } else { Window.alert("Error occurred retrieving list of KSC reports: " + exception.getLocalizedMessage()); } } public void handleResponseText(final NodeList<Element> nodes, final String responseText) { final List<KscReport> reports = KscReportRestResponseMapper.translate(responseText); for (int i = 0; i < nodes.getLength(); i++) { createView(nodes.getItem(i), reports); } } }); } }
From source file:org.opennms.features.gwt.ksc.combobox.client.KSCResourceCombobox.java
License:Open Source License
/** * This is the entry point method./* w w w .j ava 2s. co m*/ */ @Override public void onModuleLoad() { if (Window.Navigator.getUserAgent().contains("MSIE")) { NodeList<Element> divs = RootPanel.getBodyElement().getElementsByTagName("div"); for (int j = 0; j < divs.getLength(); j++) { Element element = divs.getItem(j); if (element.hasAttribute("name") && element.getAttribute("name").contains("opennms-kscReportCombobox")) { createView(element); } } } else { NodeList<Element> nodes = RootPanel.getBodyElement().getElementsByTagName("opennms:kscReportCombobox"); if (nodes.getLength() > 0) { for (int i = 0; i < nodes.getLength(); i++) { createView(nodes.getItem(i)); } } } }
From source file:org.opennms.features.gwt.snmpselect.list.client.SnmpSelectListEntry.java
License:Open Source License
@Override public void onModuleLoad() { if (Navigator.getUserAgent().contains("MSIE")) { NodeList<Element> divs = RootPanel.getBodyElement().getElementsByTagName("div"); for (int j = 0; j < divs.getLength(); j++) { Element element = divs.getItem(j); if (element.hasAttribute("name") && element.getAttribute("name").equals("opennms-snmpSelectList")) { createView(element);/*from w w w.ja v a 2 s . c o m*/ } } } else { NodeList<Element> nodes = RootPanel.getBodyElement().getElementsByTagName("opennms:snmpSelectList"); if (nodes.getLength() > 0) { for (int i = 0; i < nodes.getLength(); i++) { Element elem = nodes.getItem(i); createView(elem); } } } }
From source file:org.opennms.features.node.list.gwt.client.NodeInterfaceList.java
License:Open Source License
/** * This is the entry point method.//from ww w .j a va 2 s . c om */ @Override public void onModuleLoad() { if (Navigator.getUserAgent().contains("MSIE")) { NodeList<Element> divs = RootPanel.getBodyElement().getElementsByTagName("div"); for (int j = 0; j < divs.getLength(); j++) { Element element = divs.getItem(j); if (element.hasAttribute("name") && element.getAttribute("name").equals("opennms-interfacelist")) { createView(element); } } } else { NodeList<Element> nodes = RootPanel.getBodyElement().getElementsByTagName("opennms:interfacelist"); if (nodes.getLength() > 0) { for (int i = 0; i < nodes.getLength(); i++) { Element elem = nodes.getItem(i); createView(elem); } } } }
From source file:org.opennms.features.poller.remote.gwt.client.MapQuestMapPanel.java
License:Open Source License
/** {@inheritDoc} */ @Override//ww w . j av a 2s . com public void showLocationDetails(final String name, final String htmlTitle, final String htmlContent) { final MQAPoi point = getMarker(name); if (point != null) { point.setInfoTitleHTML(htmlTitle); point.setInfoContentHTML(htmlContent); point.showInfoWindow(); final NodeList<Element> elements = Document.get().getElementsByTagName("div"); for (int i = 0; i < elements.getLength(); i++) { final Element e = elements.getItem(i); if (e.getClassName().equals("mqpoicontenttext")) { final Style s = e.getStyle(); s.setOverflow(Overflow.HIDDEN); break; } } } }