本文整理汇总了Java中com.google.gwt.dom.client.LIElement.setClassName方法的典型用法代码示例。如果您正苦于以下问题:Java LIElement.setClassName方法的具体用法?Java LIElement.setClassName怎么用?Java LIElement.setClassName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.dom.client.LIElement
的用法示例。
在下文中一共展示了LIElement.setClassName方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addBreadcrumbItem
import com.google.gwt.dom.client.LIElement; //导入方法依赖的package包/类
@Override
public void addBreadcrumbItem(String navItemName, Command onClicked) {
LIElement li = Document.get().createLIElement();
breadcrumb.appendChild((Node) li);
if (onClicked != null) {
AnchorElement anchor = Document.get().createAnchorElement();
anchor.setInnerText(navItemName);
li.appendChild(anchor);
li.getStyle().setCursor(Style.Cursor.POINTER);
Event.sinkEvents(anchor, Event.ONCLICK);
Event.setEventListener(anchor, event -> {
if (Event.ONCLICK == event.getTypeInt()) {
onClicked.execute();
}
});
} else {
((Node) li).setTextContent(navItemName);
li.setClassName("active");
}
}
示例2: addItem
import com.google.gwt.dom.client.LIElement; //导入方法依赖的package包/类
private void addItem(UnorderedList unorderedList, String name, boolean selected, Command onSelect) {
AnchorElement anchor = Document.get().createAnchorElement();
anchor.setInnerText(name);
LIElement li = Document.get().createLIElement();
li.getStyle().setCursor(Style.Cursor.POINTER);
li.appendChild(anchor);
li.setClassName(selected ? "selected" : "");
unorderedList.appendChild((Node) li);
Event.sinkEvents(anchor, Event.ONCLICK);
Event.setEventListener(anchor, event -> {
if(Event.ONCLICK == event.getTypeInt()) {
onSelect.execute();
}
});
}
示例3: addCommandDivider
import com.google.gwt.dom.client.LIElement; //导入方法依赖的package包/类
@Override
public void addCommandDivider() {
LIElement li = Document.get().createLIElement();
li.setClassName("divider");
commandMenu.appendChild((Node) li);
}
示例4: addDivider
import com.google.gwt.dom.client.LIElement; //导入方法依赖的package包/类
@Override
public void addDivider() {
LIElement li = Document.get().createLIElement();
li.setClassName("divider");
dropDownMenu.appendChild((Node) li);
}
示例5: createTreeNode
import com.google.gwt.dom.client.LIElement; //导入方法依赖的package包/类
/**
* Creates a single tree node from the given trace node.
* @param node
*/
protected LIElement createTreeNode(TraceNodeBean node) {
String nodeId = String.valueOf(nodeIdCounter++);
nodeMap.put(nodeId, node);
boolean isCall = "Call".equals(node.getType()); //$NON-NLS-1$
boolean hasChildren = !node.getTasks().isEmpty();
LIElement li = Document.get().createLIElement();
li.setClassName(hasChildren ? "parent_li" : "leaf_li"); //$NON-NLS-1$ //$NON-NLS-2$
if (hasChildren)
li.setAttribute("role", "treeitem"); //$NON-NLS-1$ //$NON-NLS-2$
SpanElement span = Document.get().createSpanElement();
span.setAttribute("data-nodeid", nodeId); //$NON-NLS-1$
Element icon = Document.get().createElement("i"); //$NON-NLS-1$
span.appendChild(icon);
span.appendChild(Document.get().createTextNode(" ")); //$NON-NLS-1$
if (isCall) {
span.setClassName(node.getStatus());
icon.setClassName("icon-minus-sign"); //$NON-NLS-1$
span.appendChild(Document.get().createTextNode(node.getOperation()));
span.appendChild(Document.get().createTextNode(":")); //$NON-NLS-1$
span.appendChild(Document.get().createTextNode(node.getComponent()));
} else {
span.appendChild(Document.get().createTextNode(node.getDescription()));
span.setClassName("Info"); //$NON-NLS-1$
icon.setClassName("icon-info-sign"); //$NON-NLS-1$
}
li.appendChild(span);
if (node.getDuration() != -1) {
li.appendChild(Document.get().createTextNode(" [")); //$NON-NLS-1$
li.appendChild(Document.get().createTextNode(String.valueOf(node.getDuration())));
li.appendChild(Document.get().createTextNode("ms]")); //$NON-NLS-1$
}
if (node.getPercentage() != -1) {
li.appendChild(Document.get().createTextNode(" (")); //$NON-NLS-1$
li.appendChild(Document.get().createTextNode(String.valueOf(node.getPercentage())));
li.appendChild(Document.get().createTextNode("%)")); //$NON-NLS-1$
}
if (hasChildren) {
UListElement ul = Document.get().createULElement();
ul.setAttribute("role", "group"); //$NON-NLS-1$ //$NON-NLS-2$
li.appendChild(ul);
List<TraceNodeBean> tasks = node.getTasks();
for (TraceNodeBean task : tasks) {
LIElement tn = createTreeNode(task);
ul.appendChild(tn);
}
}
return li;
}