本文整理了Java中com.google.gwt.user.client.ui.Tree.getElement()
方法的一些代码示例,展示了Tree.getElement()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Tree.getElement()
方法的具体详情如下:
包路径:com.google.gwt.user.client.ui.Tree
类名称:Tree
方法名:getElement
暂无
代码示例来源:origin: com.google.gwt/gwt-servlet
/**
* Removes one of this item's children.
*
* @param item the item to be removed
*/
@Override
public void removeItem(TreeItem item) {
// Validate.
if (children == null || !children.contains(item)) {
return;
}
// Orphan.
Tree oldTree = tree;
item.setTree(null);
// Physical detach.
if (isRoot) {
oldTree.getElement().removeChild(item.getElement());
} else {
childSpanElem.removeChild(item.getElement());
}
// Logical detach.
item.setParentItem(null);
children.remove(item);
if (!isRoot && children.size() == 0) {
updateState(false, false);
}
}
代码示例来源:origin: com.google.gwt/gwt-servlet
private void init(ImageAdapter images, boolean useLeafImages) {
setImages(images, useLeafImages);
setElement(DOM.createDiv());
getElement().getStyle().setProperty("position", "relative");
// Fix rendering problem with relatively-positioned elements and their
// children by
// forcing the element that is positioned relatively to 'have layout'
getElement().getStyle().setProperty("zoom", "1");
focusable = FocusPanel.impl.createFocusable();
focusable.getStyle().setProperty("fontSize", "0");
focusable.getStyle().setProperty("position", "absolute");
// Hide focus outline in Mozilla/Webkit
focusable.getStyle().setProperty("outline", "0px");
// Hide focus outline in IE 6/7
focusable.setAttribute("hideFocus", "true");
DOM.setIntStyleAttribute(focusable, "zIndex", -1);
DOM.appendChild(getElement(), focusable);
sinkEvents(Event.ONMOUSEDOWN | Event.ONCLICK | Event.KEYEVENTS);
DOM.sinkEvents(focusable, Event.FOCUSEVENTS);
// The 'root' item is invisible and serves only as a container
// for all top-level items.
root = new TreeItem(true);
root.setTree(this);
setStyleName("gwt-Tree");
// Add a11y role "tree"
Roles.getTreeRole().set(focusable);
}
代码示例来源:origin: com.google.gwt/gwt-servlet
private boolean elementClicked(Element hElem) {
ArrayList<Element> chain = new ArrayList<Element>();
collectElementChain(chain, getElement(), hElem);
TreeItem item = findItemByChain(chain, 0, root);
if (item != null && item != root) {
if (item.getChildCount() > 0
&& item.getImageElement().isOrHasChild(hElem)) {
item.setState(!item.getState(), true);
return true;
} else if (item.getElement().isOrHasChild(hElem)) {
onSelection(item, true, !shouldTreeDelegateFocusToElement(hElem));
return true;
}
}
return false;
}
代码示例来源:origin: com.google.gwt/gwt-servlet
Element childContainer = isRoot ? tree.getElement() : childSpanElem;
if (beforeIndex == childCount) {
childContainer.appendChild(item.getElement());
代码示例来源:origin: com.google.gwt/gwt-servlet
if ((DOM.eventGetCurrentTarget(event) == getElement())
&& (event.getButton() == Event.BUTTON_LEFT)) {
elementClicked(DOM.eventGetTarget(event));
if (event.getKeyCode() == KeyCodes.KEY_TAB) {
ArrayList<Element> chain = new ArrayList<Element>();
collectElementChain(chain, getElement(), DOM.eventGetTarget(event));
TreeItem item = findItemByChain(chain, 0, root);
if (item != getSelectedItem()) {
代码示例来源:origin: net.wetheinter/gwt-user
/**
* Removes one of this item's children.
*
* @param item the item to be removed
*/
@Override
public void removeItem(TreeItem item) {
// Validate.
if (children == null || !children.contains(item)) {
return;
}
// Orphan.
Tree oldTree = tree;
item.setTree(null);
// Physical detach.
if (isRoot) {
oldTree.getElement().removeChild(item.getElement());
} else {
childSpanElem.removeChild(item.getElement());
}
// Logical detach.
item.setParentItem(null);
children.remove(item);
if (!isRoot && children.size() == 0) {
updateState(false, false);
}
}
代码示例来源:origin: com.vaadin.external.gwt/gwt-user
/**
* Removes one of this item's children.
*
* @param item the item to be removed
*/
@Override
public void removeItem(TreeItem item) {
// Validate.
if (children == null || !children.contains(item)) {
return;
}
// Orphan.
Tree oldTree = tree;
item.setTree(null);
// Physical detach.
if (isRoot) {
oldTree.getElement().removeChild(item.getElement());
} else {
childSpanElem.removeChild(item.getElement());
}
// Logical detach.
item.setParentItem(null);
children.remove(item);
if (!isRoot && children.size() == 0) {
updateState(false, false);
}
}
代码示例来源:origin: com.vaadin.external.gwt/gwt-user
private boolean elementClicked(Element hElem) {
ArrayList<Element> chain = new ArrayList<Element>();
collectElementChain(chain, getElement(), hElem);
TreeItem item = findItemByChain(chain, 0, root);
if (item != null && item != root) {
if (item.getChildCount() > 0
&& item.getImageElement().isOrHasChild(hElem)) {
item.setState(!item.getState(), true);
return true;
} else if (item.getElement().isOrHasChild(hElem)) {
onSelection(item, true, !shouldTreeDelegateFocusToElement(hElem));
return true;
}
}
return false;
}
代码示例来源:origin: net.wetheinter/gwt-user
private void init(ImageAdapter images, boolean useLeafImages) {
setImages(images, useLeafImages);
setElement(DOM.createDiv());
getElement().getStyle().setProperty("position", "relative");
// Fix rendering problem with relatively-positioned elements and their
// children by
// forcing the element that is positioned relatively to 'have layout'
getElement().getStyle().setProperty("zoom", "1");
focusable = FocusPanel.impl.createFocusable();
focusable.getStyle().setProperty("fontSize", "0");
focusable.getStyle().setProperty("position", "absolute");
// Hide focus outline in Mozilla/Webkit
focusable.getStyle().setProperty("outline", "0px");
// Hide focus outline in IE 6/7
focusable.setAttribute("hideFocus", "true");
DOM.setIntStyleAttribute(focusable, "zIndex", -1);
DOM.appendChild(getElement(), focusable);
sinkEvents(Event.ONMOUSEDOWN | Event.ONCLICK | Event.KEYEVENTS);
DOM.sinkEvents(focusable, Event.FOCUSEVENTS);
// The 'root' item is invisible and serves only as a container
// for all top-level items.
root = new TreeItem(true);
root.setTree(this);
setStyleName("gwt-Tree");
// Add a11y role "tree"
Roles.getTreeRole().set(focusable);
}
代码示例来源:origin: com.vaadin.external.gwt/gwt-user
private void init(ImageAdapter images, boolean useLeafImages) {
setImages(images, useLeafImages);
setElement(DOM.createDiv());
getElement().getStyle().setProperty("position", "relative");
// Fix rendering problem with relatively-positioned elements and their
// children by
// forcing the element that is positioned relatively to 'have layout'
getElement().getStyle().setProperty("zoom", "1");
focusable = FocusPanel.impl.createFocusable();
focusable.getStyle().setProperty("fontSize", "0");
focusable.getStyle().setProperty("position", "absolute");
// Hide focus outline in Mozilla/Webkit
focusable.getStyle().setProperty("outline", "0px");
// Hide focus outline in IE 6/7
focusable.setAttribute("hideFocus", "true");
DOM.setIntStyleAttribute(focusable, "zIndex", -1);
DOM.appendChild(getElement(), focusable);
sinkEvents(Event.ONMOUSEDOWN | Event.ONCLICK | Event.KEYEVENTS);
DOM.sinkEvents(focusable, Event.FOCUSEVENTS);
// The 'root' item is invisible and serves only as a container
// for all top-level items.
root = new TreeItem(true);
root.setTree(this);
setStyleName("gwt-Tree");
// Add a11y role "tree"
Roles.getTreeRole().set(focusable);
}
代码示例来源:origin: net.wetheinter/gwt-user
private boolean elementClicked(Element hElem) {
ArrayList<Element> chain = new ArrayList<Element>();
collectElementChain(chain, getElement(), hElem);
TreeItem item = findItemByChain(chain, 0, root);
if (item != null && item != root) {
if (item.getChildCount() > 0
&& item.getImageElement().isOrHasChild(hElem)) {
item.setState(!item.getState(), true);
return true;
} else if (item.getElement().isOrHasChild(hElem)) {
onSelection(item, true, !shouldTreeDelegateFocusToElement(hElem));
return true;
}
}
return false;
}
代码示例来源:origin: com.vaadin.external.gwt/gwt-user
Element childContainer = isRoot ? tree.getElement() : childSpanElem;
if (beforeIndex == childCount) {
childContainer.appendChild(item.getElement());
代码示例来源:origin: net.wetheinter/gwt-user
Element childContainer = isRoot ? tree.getElement() : childSpanElem;
if (beforeIndex == childCount) {
childContainer.appendChild(item.getElement());
代码示例来源:origin: org.eclipse.che.plugin/che-plugin-java-ext-lang-client
@Override
public void setTreeOfChanges(Map<String, PreviewNode> nodes) {
containerChanges.clear();
showDiffPanel(false);
final SelectionModel<PreviewNode> selectionModel = new SingleSelectionModel<>();
selectionModel.addSelectionChangeHandler(
event -> {
PreviewNode selectedNode =
(PreviewNode) ((SingleSelectionModel) selectionModel).getSelectedObject();
delegate.onSelectionChanged(selectedNode);
});
Tree tree = new Tree();
tree.getElement().setId("tree-of-changes");
for (PreviewNode parentChange : nodes.values()) {
TreeItem treeItem = new TreeItem();
containerChanges.put(treeItem, parentChange);
createTreeElement(treeItem, parentChange.getDescription(), parentChange.getChildren());
tree.addItem(treeItem);
}
tree.addSelectionHandler(
event -> {
if (selectedElement != null) {
selectedElement.getStyle().setProperty("background", "transparent");
}
selectedElement = event.getSelectedItem().getWidget().getElement();
selectedElement.getStyle().setProperty("background", getEditorSelectionColor());
});
treePanel.clear();
treePanel.add(tree);
}
代码示例来源:origin: net.wetheinter/gwt-user
if ((DOM.eventGetCurrentTarget(event) == getElement())
&& (event.getButton() == Event.BUTTON_LEFT)) {
elementClicked(DOM.eventGetTarget(event));
if (event.getKeyCode() == KeyCodes.KEY_TAB) {
ArrayList<Element> chain = new ArrayList<Element>();
collectElementChain(chain, getElement(), DOM.eventGetTarget(event));
TreeItem item = findItemByChain(chain, 0, root);
if (item != getSelectedItem()) {
代码示例来源:origin: com.vaadin.external.gwt/gwt-user
if ((DOM.eventGetCurrentTarget(event) == getElement())
&& (event.getButton() == Event.BUTTON_LEFT)) {
elementClicked(DOM.eventGetTarget(event));
if (event.getKeyCode() == KeyCodes.KEY_TAB) {
ArrayList<Element> chain = new ArrayList<Element>();
collectElementChain(chain, getElement(), DOM.eventGetTarget(event));
TreeItem item = findItemByChain(chain, 0, root);
if (item != getSelectedItem()) {
内容来源于网络,如有侵权,请联系作者删除!