Example usage for com.google.gwt.user.client.ui Widget getParent

List of usage examples for com.google.gwt.user.client.ui Widget getParent

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui Widget getParent.

Prototype

public Widget getParent() 

Source Link

Document

Gets this widget's parent panel.

Usage

From source file:org.gwtportlets.portlet.client.layout.LayoutUtil.java

License:Open Source License

/**
 * Get the logical parent of w. This will normally be its parent widget
 * but might be a widget in a different heirachy (see
 * {@link org.gwtportlets.portlet.client.layout.Container#getLogicalParent()}).
 *///from ww w .  j av a  2 s. com
public static Widget getLogicalParent(Widget w) {
    return w instanceof Container ? ((Container) w).getLogicalParent() : w.getParent();
}

From source file:org.gwtportlets.portlet.client.layout.LayoutUtil.java

License:Open Source License

/**
 * Find the next stop point for maximizing windows in the tree by searching
 * upwards from w. May return null if none found.
 *//*  w  w  w. j a  v  a2s  .  c o m*/
public static Container getNextMaximizeStop(Widget w) {
    for (;;) {
        w = w.getParent();
        if (w instanceof Container) {
            Container c = (Container) w;
            if (c.isLimitMaximize() || w.getParent() == null) {
                return c;
            }
        } else if (w == null) {
            return null;
        }
        if (w.getParent() == null) {
            return null;
        }
    }
}

From source file:org.jboss.errai.ui.shared.TemplateWidget.java

License:Apache License

@Override
public boolean remove(Widget child) {
    if (child.getParent() != this) {
        return false;
    }/*from ww w  .  j  a va  2  s  .c  om*/
    orphan(child);
    child.getElement().removeFromParent();
    return children.remove(child);
}

From source file:org.jbpm.console.ng.es.client.editors.jobdetails.JobDetailsPresenter.java

License:Apache License

@OnOpen
public void onOpen() {
    this.requestId = Long.valueOf(place.getParameter("requestId", "0"));
    Modal modal = null;/*w w w .j a v a 2  s .  c o  m*/
    Widget parent = ((JobDetailsViewImpl) view).getParent();
    while (parent != null) {
        if (parent instanceof Modal) {
            modal = (Modal) parent;
            break;
        } else {
            parent = parent.getParent();
        }
    }
    if (modal != null) {
        modal.addShownHandler(new ShownHandler() {
            @Override
            public void onShown(ShownEvent shownEvent) {
                view.refreshTable();
            }
        });
    }
    this.executorServices.call(new RemoteCallback<RequestDetails>() {
        @Override
        public void callback(RequestDetails response) {
            view.setRequest(response.getRequest(), response.getErrors(), response.getParams());
        }
    }).getRequestDetails(Long.valueOf(this.requestId));
}

From source file:org.jbpm.form.builder.ng.model.client.effect.ChangeColspanFormEffect.java

License:Apache License

private MIGLayoutFormItem getContainer(FBFormItem item) {
    Widget parent = item.getParent();
    while (!(parent instanceof MIGLayoutFormItem)) {
        parent = parent.getParent();
    }/*from w  w w .  j  a  va2s . co m*/
    return (MIGLayoutFormItem) parent;
}

From source file:org.jbpm.formbuilder.client.edition.EditionViewImpl.java

License:Apache License

@Override
public void selectTab() {
    Widget parent = getParent();
    while (!(parent instanceof TabLayoutPanel)) {
        parent = parent.getParent();
    }/*from w w w .  jav  a 2 s.com*/
    TabLayoutPanel tab = (TabLayoutPanel) parent;
    tab.selectTab(this);
}

From source file:org.jbpm.formbuilder.client.tree.TreePresenter.java

License:Apache License

public TreePresenter(TreeView treeView) {
    this.view = treeView;
    bus.addHandler(FormItemRemovedEvent.TYPE, new FormItemRemovedHandler() {
        @Override/*from   w  w  w  .j  a  v  a  2 s  . c  o  m*/
        public void onEvent(FormItemRemovedEvent event) {
            FBFormItem item = event.getFormItem();
            view.removeFormItem(item);
        }
    });
    bus.addHandler(FormItemAddedEvent.TYPE, new FormItemAddedHandler() {
        @Override
        public void onEvent(FormItemAddedEvent event) {
            FBFormItem item = event.getFormItem();
            Widget parent = event.getFormItemHolder();
            FBCompositeItem parentItem = null;
            while (parent != null && parentItem == null) {
                if (parent instanceof FBCompositeItem) {
                    parentItem = (FBCompositeItem) parent;
                } else {
                    parent = parent.getParent();
                }
            }
            view.addFormItem(item, parentItem);
        }
    });
}

From source file:org.kaaproject.kaa.server.admin.client.layout.CustomDeckLayoutPanel.java

License:Apache License

/**
 * Assert that the specified widget is null or a child of this widget.
 *
 * @param widget the widget to check//  ww w  .  j  ava2 s . com
 */
void assertIsChild(Widget widget) {
    assert (widget == null)
            || (widget.getParent() == this) : "The specified widget is not a child of this panel";
}

From source file:org.kuali.student.common.ui.client.configurable.mvc.LayoutController.java

License:Educational Community License

/**
 * Finds the first parent LayoutController of this LayoutController, returns null if this
 * is the top level LayoutController.// w ww .ja  va2s. co m
 * @param w
 * @return
 */
public static LayoutController findParentLayout(Widget w) {
    LayoutController result = null;
    while (true) {
        if (w == null) {
            break;
        } else if (w instanceof HasLayoutController) {
            result = ((HasLayoutController) w).getLayoutController();
            if (result != null) {
                break;
            }
        } else if (w instanceof LayoutController) {
            result = (LayoutController) w;
            break;
        }
        w = w.getParent();

    }
    return result;
}

From source file:org.kuali.student.common.ui.client.mvc.Controller.java

License:Educational Community License

/**
 * Attempts to find the parent controller of a given widget via the DOM
 * //from   w ww .  j a v  a 2  s. c o  m
 * @param w
 *            the widget for which to find the parent controller
 * @return the controller, or null if not found
 */
public static Controller findController(Widget w) {
    Controller result = null;
    while (true) {
        w = w.getParent();
        if (w == null) {
            break;
        } else if (w instanceof Controller) {
            result = (Controller) w;
            break;
        } else if (w instanceof View) {
            // this is in the event that a parent/child relationship is broken by a view being rendered in a lightbox,
            // etc
            result = ((View) w).getController();
            break;
        }
    }
    return result;
}