Retrieves a sub menu by its text.

@param text the text to search for.
@param node the current node in the WComponent tree.
@return the sub menu with the given text, or null if not found.
439717
private WSubMenu getSubMenuByText(final String text, final WComponent node) {

		if (node instanceof WSubMenu) {
			WSubMenu subMenu = (WSubMenu) node;
			if (text.equals(subMenu.getText())) {
				return subMenu;
			}
			for (MenuItem item : subMenu.getMenuItems()) {
				WSubMenu result = getSubMenuByText(text, item);
				if (result != null) {
					return result;
				}
			}
		} else if (node instanceof WMenu) {
			WMenu menu = (WMenu) node;
			for (MenuItem item : menu.getMenuItems()) {
				WSubMenu result = getSubMenuByText(text, item);
				if (result != null) {
					return result;
				}
			}
		}

		return null;
	}
596300
function getTextOfNode(node) {
        var result;
        if (node != null && node.childNodes[0]) {
            result = node.childNodes[0].nodeValue;
        } else if (node != null) {
            result = "";
        }
        return result;
    }
282176
public static <T> String get(Message<T> text, T context) {
        for (AlternativeUiTextProvider p : all()) {
            String s = p.getText(text, context);
            if (s!=null)
                return s;
        }
        return null;
    }
912937
public <V> V convertFrom(final String text) {
        if (text == null) return null;
        return (V) convertFrom(Utility.charArray(text));
    }
816940
public Object parseText(String text) {
        if (text == null || "".equals(text)) {
            throw new IllegalArgumentException("Text must not be null");
        }
        return createParser().parse(text);
    }
225957
@Override
    public void setText(String text) {
        if (text == null) {
            if (headerElem != null) {
                removeChild(headerElem);
                headerElem = null;
            }
            return;
        }

        if (headerElem == null) {
            headerElem = Document.get().createHElement(3);
            attachChild(headerElem);
        }
        headerElem.setInnerText(text);
    }
735086
public static Element getChild(Element parent, String childName) {
		NodeList nodes = parent.getChildNodes();
		for (int i = 0; i < nodes.getLength(); ++i) {
			Node node = nodes.item(i);
			if ((node instanceof Element) && node.getNodeName().equals(childName))
				return (Element)node;
		}
		return null;
	}
704399
public synchronized void addTextNode(String text) throws IOException {
		// check for non-empty string
		if(text == null || text.trim().length() == 0) {
			return;
		}
		// reject modification of already closed node
		if(isOpen==false) {
			throw new IOException("Attempted to add child text node to already closed tag '" + name + "'!");
		}
		if(lastChildNode==null) {
			// no child nodes yet, close opening tag
			writer.write(">");
		} else {
			// close previous sibling and move to new line
			// FIXME: is this a legal situation, and if: how do we format this issue nicely?
			lastChildNode.close();
			writer.write("\n");
			indentLine();
		}
		SXTextNode textNode = new SXTextNode(text, writer, tabLevel, tabString);
		lastChildNode = textNode;
	}
1099886
public static String after(String text, String after) {
        if (!text.contains(after)) {
            return null;
        }
        return text.substring(text.indexOf(after) + after.length());
    }
1329514
public static List<List<Term>> seg2sentence(String text)
    {
        List<List<Term>> resultList = new LinkedList<List<Term>>();
        {
            for (String sentence : SentencesUtil.toSentenceList(text))
            {
                resultList.add(segment(sentence));
            }
        }

        return resultList;
    }
1041046
public SnackBar actionText(CharSequence text){
		if(TextUtils.isEmpty(text))
			mAction.setVisibility(View.INVISIBLE);
		else{
			mAction.setVisibility(View.VISIBLE);		
			mAction.setText(text);
		}
		return this;
	}
569002
public TextBuilder link(final String text, final Table table) {
        this.curParagraphBuilder.link(text, table);
        return this;
    }
38184
public List<List<Term>> seg2sentence(String text, boolean shortest)
    {
        List<List<Term>> resultList = new LinkedList<List<Term>>();
        {
            for (String sentence : SentencesUtil.toSentenceList(text, shortest))
            {
                resultList.add(segSentence(sentence.toCharArray()));
            }
        }

        return resultList;
    }
623736
private WMenu buildTreeMenu(final WText selectedMenuText) {
		WMenu menu = new WMenu(WMenu.MenuType.TREE);
		menu.setSelectMode(SelectMode.SINGLE);

		mapTreeHierarchy(menu, createExampleHierarchy(), selectedMenuText);

		return menu;
	}
865996
public Node<T> getNext(Node<T> node) {
    	if (node.right != null) {
    		node = node.right;
    		while (node.left != null) node = node.left;
    		return node;
    	}
    	// nothing at right, it may be the parent node if the node is at the left
    	if (node == last) return null;
    	return getNext(root, node.value);
    }
30424
public CharSequence getCoveredText(CharSequence text) {
    if (getEnd() > text.length()) {
      throw new IllegalArgumentException("The span " + toString()
          + " is outside the given text!");
    }

    return text.subSequence(getStart(), getEnd());
  }
1098550
private void mapTreeHierarchy(final WComponent currentComponent,
			final StringTreeNode currentNode, final WText selectedMenuText) {
		if (currentNode.isLeaf()) {
			WMenuItem menuItem = new WMenuItem(currentNode.getData(), new ExampleMenuAction(
					selectedMenuText));
			menuItem.setActionObject(currentNode.getData());
			if (currentComponent instanceof WMenu) {
				((WMenu) currentComponent).add(menuItem);
			} else {
				((WSubMenu) currentComponent).add(menuItem);
			}
		} else {
			WSubMenu subMenu = new WSubMenu(currentNode.getData());
			subMenu.setSelectMode(SelectMode.SINGLE);

			if (currentComponent instanceof WMenu) {
				((WMenu) currentComponent).add(subMenu);
			} else {
				((WSubMenu) currentComponent).add(subMenu);
			}

			// Expand the first couple of levels in the tree by default.
			if (currentNode.getLevel() < 2) {
				subMenu.setOpen(true);
			}

			for (Iterator<TreeNode> i = currentNode.children(); i.hasNext();) {
				mapTreeHierarchy(subMenu, (StringTreeNode) i.next(), selectedMenuText);
			}
		}
	}