本文整理汇总了Java中com.google.gwt.dom.client.LIElement类的典型用法代码示例。如果您正苦于以下问题:Java LIElement类的具体用法?Java LIElement怎么用?Java LIElement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LIElement类属于com.google.gwt.dom.client包,在下文中一共展示了LIElement类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: appendList
import com.google.gwt.dom.client.LIElement; //导入依赖的package包/类
public final void appendList(ArrayList<String> choices, boolean ordered, String additionalStyle) {
if (choices == null || choices.size() == 0) {
return;
}
FlowPanel htmlList = new FlowPanel(ordered? OListElement.TAG : UListElement.TAG);
if (additionalStyle != null && additionalStyle.length() > 0) {
_promptChar.getElement().setAttribute("style", additionalStyle);
}
for (String choice : choices) {
FlowPanel item = new FlowPanel(LIElement.TAG);
item.getElement().setInnerText(choice);
htmlList.add(item);
}
appendAndScrollOrFocusAsAppropriate(htmlList);
}
示例3: findTreeViewItemLIElement
import com.google.gwt.dom.client.LIElement; //导入依赖的package包/类
public static LIElement findTreeViewItemLIElement(final Element element) {
LIElement outLIElement = null;
Element currElement = element;
while (currElement != null) {
if (LIElement.is(currElement)) {
Element parentElement = currElement.getParentElement();
if (UListElement.is(parentElement) && CONTAINER_UL_CSS_CLASS_NAME.equals(parentElement.getClassName())) {
outLIElement = currElement.cast();
} else {
currElement = parentElement.getParentElement();
}
} else {
currElement = currElement.getParentElement();
}
if (outLIElement != null) break;
}
return outLIElement;
}
示例4: _findItemIn
import com.google.gwt.dom.client.LIElement; //导入依赖的package包/类
private static TreeViewItem _findItemIn(final Collection<TreeViewItem> items,
final LIElement element) {
TreeViewItem outItem = null;
if (items != null && items.size() > 0) {
for(TreeViewItem item : items) {
if (outItem != null) break;
if (item.getElement().cast() == element) {
outItem = item;
} else if (item.hasChildren()) {
outItem = _findItemIn(item.getChildren(),element);
}
}
}
return outItem;
}
示例5: _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;
}
示例6: onBrowserEvent
import com.google.gwt.dom.client.LIElement; //导入依赖的package包/类
@Override
@SuppressWarnings("fallthrough")
public void onBrowserEvent(final Event event) {
super.onBrowserEvent(event);
int eventType = DOM.eventGetType(event);
Element eventTargetEl = DOM.eventGetTarget(event);
// GWT.log("_____" + eventTargetEl.getNodeName() + ": " + event.getType());
switch (eventType) {
case Event.ONCLICK: {
if (ImageElement.is(eventTargetEl)) {
LIElement tagLIElement = _findTagLIElementContaining(eventTargetEl);
T tag = _tagForElement(tagLIElement);
this.removeTag(tag);
}
break;
}
}
}
示例7: TreeViewItem
import com.google.gwt.dom.client.LIElement; //导入依赖的package包/类
/**
* Creates an empty tree item.
*/
TreeViewItem(final CanBePaintedAsWidget viewObjectToWidgetTransformer) {
// Create the item element structure
LIElement elem = DOM.clone(BASE_ELEM, // a simple LI
true) // deep cloning
.cast();
elem.setAttribute("id",DOM.createUniqueId());
this.setElement(elem);
// Set the ViewObject to Widget transformer
_viewObjectToWidgetTransformer = viewObjectToWidgetTransformer;
// Create the items container delegate
_childItemsContainerDelegate = new TreeViewIsHierarchicalDelegate<TreeViewItem>(_viewObjectToWidgetTransformer,
this);
// Create other delegates
_hideDisplayDelegate = new ViewHideDisplayDelegate(this);
_enableDisableDelegate = new ViewEnableDisableDelegate(this);
// Create the observable delegate
_observableDelegate = new ObservableTreeViewItemDelegate(this);
}
示例8: onLazyLoadingSuccessful
import com.google.gwt.dom.client.LIElement; //导入依赖的package包/类
@Override
public void onLazyLoadingSuccessful(final Collection<ViewObject> children) {
// GWT.log("====>" + this.getText() + " > " + (children != null ? children.size() : 0) + " child loaded");
// Remove the loading... label
LabelElement loadingLabel = _childLoadingSPANElement();
LIElement parentLI = this.getElement().cast();
parentLI.removeChild(loadingLabel);
// if the number of children loaded is 0 (there where no child items), hide the expander
// otherwise paint the children
if (CollectionUtils.isNullOrEmpty(children)) {
_expanderINPUTElement().setDisabled(true);
} else {
this.paintChildren(children);
}
}
示例9: 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);
}
示例10: 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("");
}
});
}
示例11: 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);
}
});
}
示例12: 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");
}
}
示例13: 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();
}
});
}
示例14: 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();
}
});
}
示例15: 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();
}
});
}