use of com.google.gwt.dom.client.Node in project gwt-test-utils by gwt-test-utils.
the class UIObjectPatcher method replaceNode.
@PatchMethod
static void replaceNode(UIObject uiObject, Element node, Element newNode) {
Node parent = node.getParentNode();
if (parent != null) {
parent.insertBefore(newNode, node);
parent.removeChild(node);
}
}
use of com.google.gwt.dom.client.Node in project GwtMobile by dennisjzh.
the class DragController method fireSwipeEvent.
protected void fireSwipeEvent(SwipeEvent e) {
if (_capturingSwipeEventsHandler != null) {
e.dispatch(_capturingSwipeEventsHandler);
return;
}
if (_capturingDragEventsHandler != null) {
return;
}
EventTarget target = e.getNativeEvent().getEventTarget();
Node node = Node.as(target);
if (!Element.is(node)) {
//Text node
node = node.getParentNode();
}
if (Element.is(node)) {
Element ele = Element.as(target);
int count = 0;
while (ele != null) {
for (SwipeEventsHandler handler : _swipeEventHandlers) {
if (ele.equals(handler.getElement())) {
e.dispatch(handler);
count++;
if (e.getStopPropagation() || count == _swipeEventHandlers.size()) {
return;
}
}
}
ele = ele.getParentElement();
}
}
}
use of com.google.gwt.dom.client.Node in project GwtMobile by dennisjzh.
the class DragController method fireDragEvent.
protected void fireDragEvent(DragEvent e) {
if (_capturingDragEventsHandler != null) {
e.dispatch(_capturingDragEventsHandler);
return;
}
EventTarget target = e.getNativeEvent().getEventTarget();
Node node = Node.as(target);
if (!Element.is(node)) {
//Text node
node = node.getParentNode();
}
if (Element.is(node)) {
Element ele = Element.as(target);
int count = 0;
while (ele != null) {
for (DragEventsHandler handler : _dragEventHandlers) {
if (ele.equals(handler.getElement())) {
e.dispatch(handler);
count++;
if (e.getStopPropagation() || count == _dragEventHandlers.size()) {
return;
}
}
}
ele = ele.getParentElement();
}
}
}
use of com.google.gwt.dom.client.Node in project che by eclipse.
the class RadioButtonGroup method addButton.
/**
* Adds the new button to the group.
*
* @param label
* button's label
* @param title
* button's tooltip
* @param icon
* button's icon
* @param clickHandler
* click handler
*/
public void addButton(String label, String title, @Nullable SVGResource icon, ClickHandler clickHandler) {
final RadioButton radioButton = new RadioButton(GROUP_NAME, label);
radioButton.setTitle(title);
radioButton.setStyleName(resources.getCSS().button());
radioButton.addClickHandler(clickHandler);
final Node child = radioButton.getElement().getLastChild();
if (icon != null) {
final SVGImage svgImage = new SVGImage(icon);
child.insertFirst(svgImage.getElement());
}
mainPanel.add(radioButton);
buttons.add(radioButton);
}
use of com.google.gwt.dom.client.Node in project che by eclipse.
the class SplitEditorPartViewImpl method tuneSplitter.
/**
* Improves splitter visibility.
*/
private void tuneSplitter(SplitLayoutPanel splitLayoutPanel) {
NodeList<Node> nodes = splitLayoutPanel.getElement().getChildNodes();
for (int i = 0; i < nodes.getLength(); i++) {
Node node = nodes.getItem(i);
if (node.hasChildNodes()) {
Element el = node.getFirstChild().cast();
String className = el.getClassName();
if (HORIZONTAL_DRAGGER_CLASS.equals(className)) {
tuneVerticalSplitter(el);
} else if (VERTICAL_DRAGGER_CLASS.equals(className)) {
tuneHorizontalSplitter(el);
}
}
}
}
Aggregations