本文整理汇总了Java中com.google.gwt.dom.client.LIElement.appendChild方法的典型用法代码示例。如果您正苦于以下问题:Java LIElement.appendChild方法的具体用法?Java LIElement.appendChild怎么用?Java LIElement.appendChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.dom.client.LIElement
的用法示例。
在下文中一共展示了LIElement.appendChild方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: prepareToAdoptChildren
import com.google.gwt.dom.client.LIElement; //导入方法依赖的package包/类
@Override
public void prepareToAdoptChildren() {
if (!this.hasChildren()) {
// BEFORE the item is prepared to adopt children, it's just like:
// <li>
// <input type="checkbox" class="expander" disabled> <!-- input.expander DISABLED = no child -->
// <span class="expander"></span>
// <input type="checkbox" class="selection">
// <!-- the widget --> <!-- if it's a text item: <label>Child Node 1</label> -->
// <!-- there's NO child items container -->
// </li>
//
// AFTER the item is prepared to adopt children, it's:
// <li>
// <input type="checkbox" class="expander"> <!-- input.expander ENABLED = has child -->
// <span class="expander"></span>
// <input type="checkbox" class="selection">
// <!-- the widget --> <!-- if it's a text item: <label>Child Node 1</label> -->
// <ul class='childContainer'> <!-- child items container is present -->
// ... here will come the child items
// </ul>
// </li>
//
// [1] - Create a child items container UL by cloning the BASE_INTERNAL_ELEM
UListElement childContainerULElem = DOM.clone(BASE_CHILD_CONTAINER_ELEM,// an UL
true) // deep cloning
.cast();
// [2] - set the new UL as a child of the item (the LI)
LIElement parentLI = this.getElement().cast();
parentLI.appendChild(childContainerULElem);
// [3] - Change the <input type="checkbox" class="expander"> status from DISABLED to ENABLED
InputElement expanderINPUT = parentLI.getFirstChild().cast(); // from Node to Element
expanderINPUT.setDisabled(false);
} else {
throw new IllegalStateException();
}
}
示例2: _createBaseTagElement
import com.google.gwt.dom.client.LIElement; //导入方法依赖的package包/类
private static LIElement _createBaseTagElement() {
// <ul class='tags'>
// <li><span><img />Tag1</span></li>
// <li><span><img />Tag1</span></li>
// ...
// </ul>
LIElement containerLIEl = DOM.createElement("li").cast();
SpanElement spanEl = DOM.createSpan().cast();
ImageElement imgEl = DOM.createImg().cast();
// assemble the structure
spanEl.appendChild(imgEl);
spanEl.appendChild(Document.get().createTextNode(""));
containerLIEl.appendChild(spanEl);
return containerLIEl;
}
示例3: addEntry
import com.google.gwt.dom.client.LIElement; //导入方法依赖的package包/类
private void addEntry(String entry, boolean logout) {
AnchorElement anchor = Document.get().createAnchorElement();
anchor.setInnerText(entry);
Event.sinkEvents(anchor, Event.ONCLICK);
Event.setEventListener(anchor, event -> {
if (Event.ONCLICK == event.getTypeInt()) {
if (!logout) {
onRoleClicked(entry);
} else {
onLogoutClicked();
}
}
});
LIElement li = Document.get().createLIElement();
li.getStyle().setCursor(Style.Cursor.POINTER);
li.appendChild(anchor);
roleList.appendChild((Node) li);
}
示例4: addSourceCodeItem
import com.google.gwt.dom.client.LIElement; //导入方法依赖的package包/类
@Override
public void addSourceCodeItem(String name) {
AnchorElement anchor = Document.get().createAnchorElement();
String displayName = DisplayerHtmlConstants.INSTANCE.getString("displayer_source_code_" + name);
anchor.setInnerText(displayName);
LIElement li = Document.get().createLIElement();
li.getStyle().setCursor(Style.Cursor.POINTER);
li.appendChild(anchor);
tabList.appendChild((Node) li);
Event.sinkEvents(anchor, Event.ONCLICK);
Event.setEventListener(anchor, event -> {
if(Event.ONCLICK == event.getTypeInt()) {
presenter.onSourceCodeItemSelected(name);
if (selectedItem != null) {
selectedItem.setClassName("");
selectedItem.getStyle().setCursor(Style.Cursor.POINTER);
}
selectedItem = li;
selectedItem.setClassName("active");
selectedItem.getStyle().setCursor(Style.Cursor.DEFAULT);
previewItem.setClassName("");
}
});
}
示例5: declareVariable
import com.google.gwt.dom.client.LIElement; //导入方法依赖的package包/类
@Override
public void declareVariable(String var, String description) {
SpanElement span = Document.get().createSpanElement();
span.setInnerText(var);
AnchorElement anchor = Document.get().createAnchorElement();
anchor.setTitle(description);
anchor.appendChild(span);
LIElement li = Document.get().createLIElement();
li.getStyle().setCursor(Style.Cursor.POINTER);
li.appendChild(anchor);
variablesMenu.appendChild((Node) li);
Event.sinkEvents(anchor, Event.ONCLICK);
Event.setEventListener(anchor, event -> {
if(Event.ONCLICK == event.getTypeInt()) {
presenter.onVariableSelected(var);
}
});
}
示例6: 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");
}
}
示例7: 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();
}
});
}
示例8: addCommand
import com.google.gwt.dom.client.LIElement; //导入方法依赖的package包/类
@Override
public void addCommand(String name, Command command) {
AnchorElement anchor = Document.get().createAnchorElement();
anchor.setInnerText(name);
LIElement li = Document.get().createLIElement();
li.getStyle().setCursor(Style.Cursor.POINTER);
li.appendChild(anchor);
commandMenu.appendChild((Node) li);
Event.sinkEvents(anchor, Event.ONCLICK);
Event.setEventListener(anchor, event -> {
if(Event.ONCLICK == event.getTypeInt()) {
command.execute();
}
});
}
示例9: addItem
import com.google.gwt.dom.client.LIElement; //导入方法依赖的package包/类
@Override
public void addItem(String id, String name, String description, Command onItemSelected) {
AnchorElement anchor = Document.get().createAnchorElement();
anchor.setInnerText(name);
if (description != null && !description.equals(name)) {
anchor.setTitle(description);
}
LIElement li = Document.get().createLIElement();
li.getStyle().setCursor(Style.Cursor.POINTER);
li.appendChild(anchor);
navWidget.appendChild((Node) li);
itemMap.put(id, li);
Event.sinkEvents(anchor, Event.ONCLICK);
Event.setEventListener(anchor, event -> {
if (Event.ONCLICK == event.getTypeInt()) {
onItemSelected.execute();
}
});
}
示例10: addItem
import com.google.gwt.dom.client.LIElement; //导入方法依赖的package包/类
@Override
public void addItem(String name, Command onSelect) {
AnchorElement anchor = Document.get().createAnchorElement();
anchor.setInnerText(name);
LIElement li = Document.get().createLIElement();
li.getStyle().setCursor(Style.Cursor.POINTER);
li.appendChild(anchor);
selectorItems.appendChild((Node) li);
Event.sinkEvents(anchor, Event.ONCLICK);
Event.setEventListener(anchor, event -> {
if(Event.ONCLICK == event.getTypeInt()) {
onSelect.execute();
}
});
}
示例11: addHitPolicyOption
import com.google.gwt.dom.client.LIElement; //导入方法依赖的package包/类
@Override
public void addHitPolicyOption( final GuidedDecisionTable52.HitPolicy hitPolicy ) {
final AnchorElement anchor = Document.get()
.createAnchorElement();
anchor.setInnerText( HitPolicyInternationalizer.internationalize( hitPolicy ) );
Event.sinkEvents( anchor,
Event.ONCLICK );
Event.setEventListener( anchor,
event -> {
if ( Event.ONCLICK == event.getTypeInt() ) {
presenter.onHitPolicySelected( hitPolicy );
}
} );
final LIElement li = Document.get()
.createLIElement();
li.appendChild( anchor );
listOfAvailableHitModes.appendChild( (Node) li );
}
示例12: _createBaseElement
import com.google.gwt.dom.client.LIElement; //导入方法依赖的package包/类
private static LIElement _createBaseElement() {
// <li>
// [1] --- EXPANDER --
// <input type="checkbox" class="expander" disabled> <!-- input.expander DISABLED = no child -->
// <span class="expander"></span>
//
// [2] --- CHECK
// <input type="checkbox" class="selection">
//
// [3] --- WIDGET
// <!-- the widget --> <!-- if it's a text item: <label>Child Node 1</label> -->
// </li>
// [1] - Create the expander hidden checkbox and span to fake the expander image over the checkbox
TreeViewExpanderDOMElements expanderDOMEls = TreeViewUtils.createExpanderDOMElements();
// [2] - Create the selection checkbox
InputElement checkINPUT = DOM.createInputCheck().cast();
checkINPUT.addClassName(TreeViewUtils.CHECKER_CLASS_NAME);
// [3] - Create the container LI
LIElement containerLI = DOM.createElement("li").cast();
Roles.getTreeitemRole().set(containerLI);
// assemble the structure
containerLI.appendChild(expanderDOMEls.getInputElement());
containerLI.appendChild(expanderDOMEls.getSpanElement());
containerLI.appendChild(checkINPUT);
return containerLI;
}
示例13: _initDOM
import com.google.gwt.dom.client.LIElement; //导入方法依赖的package包/类
/**
* Builds the element structure:
* <pre class='brush:html'>
* <ul class='treeview'>
* <li>
* <input type="checkbox" class="expander" disabled> <!-- input.expander DISABLED = no child -->
* <span class="expander"></span>
*
* <!-- The root node widget --> <!-- usually is a the tree caption -->
*
* <ul class='childContainer'>..</ul> <!-- the child items container -->
* </li>
* </ul>
* </pre>
*/
private void _initDOM() {
// [1] - Create a main UL
UListElement mainULEl = DOM.createElement("ul").cast();
mainULEl.addClassName(TreeViewUtils.TREEVIEW_CSS_CLASS_NAME);
// [2] - Create a single LI for the tree label and append it to the UL
LIElement mainLIEl = DOM.createElement("li").cast();
mainULEl.appendChild(mainLIEl);
// [3] - Create an UL to contain the root nodes and append it to the title's LI
_rootNodesContainerElement = DOM.createElement("ul").cast();
_rootNodesContainerElement.addClassName(TreeViewUtils.CONTAINER_UL_CSS_CLASS_NAME);
mainLIEl.appendChild(_rootNodesContainerElement);
// [4] - set the widget DOM element
this.setElement(mainULEl);
// Capture events
this.sinkEvents(Event.ONMOUSEDOWN | Event.ONCLICK | Event.KEYEVENTS); // = DOM.sinkEvents(this.getElement(),Event.ONMOUSEDOWN | Event.ONCLICK | Event.KEYEVENTS)
DOM.sinkEvents(this.getElement(), // main UL
Event.FOCUSEVENTS);
// Add area role "tree"
Roles.getTreeRole()
.set(this.getElement());
}
示例14: 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;
}