List of usage examples for com.google.gwt.dom.client NodeList getItem
public T getItem(int index)
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);/* w w w .j a va 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 w ww. j a v a2 s . c o m */ @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//from ww w.j a v a 2 s . c o m 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; } } } }
From source file:org.openremote.modeler.client.gxtextends.CheckBoxListViewExt.java
License:Open Source License
public List<M> getChecked() { List<M> l = new ArrayList<M>(); NodeList<Element> nodes = el().select(checkBoxSelector); for (int i = 0; i < nodes.getLength(); i++) { InputElement e = nodes.getItem(i).cast(); if (e.isChecked()) { l.add(getStore().getAt(i));/*from ww w . j ava 2 s .c o m*/ } } return l; }
From source file:org.openremote.modeler.client.gxtextends.CheckBoxListViewExt.java
License:Open Source License
/** * Selects a specific item in the view/*ww w.ja v a2 s.co m*/ * * @param m the modeldata that should be checked * @param checked true to check */ public void setChecked(M m, boolean checked) { if (rendered) { NodeList<Element> nodes = el().select(checkBoxSelector); int index = store.indexOf(m); if (index != -1) { Element e = nodes.getItem(index); if (e != null) { ((InputElement) e.cast()).setChecked(checked); } } } else { if (checkedPreRender == null) { checkedPreRender = new ArrayList<M>(); } if (checked) { if (!checkedPreRender.contains(m)) { checkedPreRender.add(m); } } else { checkedPreRender.remove(m); } } }
From source file:org.openxdata.sharedlib.client.util.FormUtil.java
public static String getDivValue(String id) { com.google.gwt.dom.client.Element p = com.google.gwt.dom.client.Document.get().getElementById(id); if (p != null) { NodeList<Node> nodes = p.getChildNodes(); if (nodes != null && nodes.getLength() > 0) { Node node = nodes.getItem(0); String s = node.getNodeValue(); p.removeChild(node);//from w w w. ja v a 2 s. co m return s; } } return null; }
From source file:org.otalo.ao.client.widget.chlist.client.ChosenImpl.java
License:Apache License
private void setDefaultValues() { clickTestAction = new Function() { @Override//from w w w . j a va 2s . co m public boolean f(Event e) { return testActiveClick(e); } }; activateAction = new Function() { @Override public boolean f(Event e) { return activateField(e); } }; activeField = false; mouseOnContainer = false; resultsShowing = false; NodeList<OptionElement> optionsList = selectElement.getOptions(); allowSingleDeselect = options.isAllowSingleDeselect() && optionsList.getLength() > 0 && "".equals(optionsList.getItem(0).getText()); choices = 0; if (options.getResources() != null) { css = options.getResources().css(); } else { css = GWT.<Resources>create(Resources.class).css(); } // Force the injection the first time only // If you want to use different css file for different GwtChosen component // please register your css files (css.ensureInject()) before the first call of the plugin if (!cssInjected) { StyleInjector.inject(css.getText(), true); cssInjected = true; } }
From source file:org.otalo.ao.client.widget.chlist.gwt.ChosenListBox.java
License:Apache License
/** * Return the values of all selected options in an array. * Usefull to know which options are selected in case of multiple ChosenListBox * @return/* w w w . j av a 2 s. c om*/ */ public String[] getValues() { if (!isMultipleSelect()) { return new String[] { getValue() }; } JsArrayString values = JsArrayString.createArray().cast(); NodeList<OptionElement> options = SelectElement.as(getElement()).getOptions(); for (int i = 0; i < options.getLength(); i++) { OptionElement option = options.getItem(i); if (option.isSelected()) { values.push(option.getValue()); } } String[] result = new String[values.length()]; for (int i = 0; i < values.length(); i++) { result[i] = values.get(i); } return result; }
From source file:org.overlord.commons.gwt.client.local.widgets.SortableTemplatedWidgetTable.java
License:Apache License
/** * Sets a column in the table to be sortable. This will convert the content in the * "th" to be something the user can click on. When the user clicks on it, the * internal state of the table will be altered *and* an event will be fired. * @param columnIndex//from w w w. j a va 2 s. c om * @param columnId */ public void setColumnSortable(int columnIndex, final String columnId) { Element thElement = null; NodeList<com.google.gwt.dom.client.Element> elementsByTagName = this.thead.getElementsByTagName("th"); //$NON-NLS-1$ if (columnIndex <= elementsByTagName.getLength()) { thElement = elementsByTagName.getItem(columnIndex).cast(); } if (thElement == null) { return; } String columnLabel = thElement.getInnerText(); thElement.setInnerText(""); //$NON-NLS-1$ SortableTableHeader widget = new SortableTableHeader(columnLabel, columnId); widget.removeFromParent(); DOM.appendChild(thElement, widget.getElement()); adopt(widget); widget.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { onColumnHeaderClick(columnId); } }); columnIdMap.put(columnId, widget); }
From source file:org.overlord.commons.gwt.client.local.widgets.TemplatedWidgetTable.java
License:Apache License
/** * Called when the table is attached. This is here to better support the WidgetTable * in an Errai UI template. This method will grab the thead and tbody from the * template. In addition, it will remove all of the tr children from the tbody. *//*from w w w .ja va 2s. co m*/ protected void doAttachInit() { NodeList<Node> nodes = getElement().getChildNodes(); for (int j = 0; j < nodes.getLength(); j++) { Node item = nodes.getItem(j); if ("thead".equalsIgnoreCase(item.getNodeName())) { //$NON-NLS-1$ this.thead = item.cast(); NodeList<Node> childNodes = this.thead.getChildNodes(); for (int i = 0; i < childNodes.getLength(); i++) { Node theadtr = childNodes.getItem(i); if ("tr".equalsIgnoreCase(theadtr.getNodeName())) { //$NON-NLS-1$ int thcount = 0; NodeList<Node> nodeList = theadtr.getChildNodes(); for (int k = 0; k < nodeList.getLength(); k++) { if ("th".equalsIgnoreCase(nodeList.getItem(k).getNodeName())) { //$NON-NLS-1$ thcount++; } } this.columnCount = thcount; } } } else if ("tbody".equalsIgnoreCase(item.getNodeName())) { //$NON-NLS-1$ this.tbody = item.cast(); removeAllChildNodes(this.tbody); } } }