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.uberfire.client.util.Layouts.java

License:Apache License

/**
 * Disables the scrolling behaviour of the nearest scrollpanel found in the given widget's containment hierarchy.
 * <p>/*from w  w w  . ja  v a  2  s  .co m*/
 * FIXME this is a really horrible workaround! should instead modify UF API to allow PanelDefinition to opt out of having a scroll panel.
 * The better fix would require changes to:
 * <ul>
 * <li>WorkbenchPartPresenter.View
 * <li>WorkbenchPartView and its mock
 * <li>The @WorkbenchPanel annotation
 * <li>The annotation processor code generators and their tests
 * </ul>
 * @return true if a scroll panel was found and disabled; false if no scroll panel was found.
 */
public static boolean disableNearestScrollPanel(Widget w) {
    while (w != null) {
        if (w instanceof ScrollPanel) {
            w.getElement().getStyle().clearOverflow();
            w.getElement().getParentElement().getStyle().clearOverflow();
            return true;
        }
        w = w.getParent();
    }
    return false;
}

From source file:org.uberfire.client.views.pfly.notifications.NotificationPopupsManagerView.java

License:Apache License

private int getTopPosition(final Widget widget) {
    int top = widget.getAbsoluteTop();
    // if top is negative (due to scrolling) we try to align with the parent
    // to make sure the notifications are always visible
    if (top < 0 && widget.getParent() != null) {
        top = getTopPosition(widget.getParent());
    }/*  w w w .  j  a  v  a2  s.c o m*/
    return Math.max(top, 0);
}

From source file:org.uberfire.client.views.pfly.notifications.NotificationPopupsManagerView.java

License:Apache License

private int getLeftPosition(final Widget widget) {
    int left = widget.getAbsoluteLeft();
    // if left is negative (due to scrolling) we try to align with the parent
    // to make sure the notifications are always visible
    if (left < 0 && widget.getParent() != null) {
        left = getLeftPosition(widget.getParent());
    }/*w  w  w. j av a 2s  .c o  m*/
    return Math.max(left, 0);
}

From source file:org.uberfire.client.workbench.widgets.split.WorkbenchSplitLayoutPanel.java

License:Apache License

private void assertIsAChild(Widget widget) {
    assert (widget == null)
            || (widget.getParent() == this) : "The specified widget is not a child of this panel";
}

From source file:org.utgenome.gwt.utgb.client.track.lib.old.OldUTGBSubOperationImpl.java

License:Apache License

public void execute(Widget sender, int x, int y) {
    final TrackGroup trackGroup = getTrack().getTrackGroup();

    final Map<String, String> parameterMap = new HashMap<String, String>();

    final String[] propertyNameArray = OldUTGBProperty.getPropertyNameArray();

    final TrackGroupProperty propertyReader = trackGroup.getPropertyReader();

    for (int i = 0; i < propertyNameArray.length; i++) {
        final String key = propertyNameArray[i];
        final String value = propertyReader.getProperty(key);

        parameterMap.put(key, value);//from  w w w  . ja  va2  s  . c  o  m
    }

    final TrackWindow trackWindow = trackGroup.getTrackWindow();

    final long startIndex = trackWindow.getStartOnGenome();
    final long endIndex = trackWindow.getEndOnGenome();

    parameterMap.put("start", Long.toString(startIndex));
    parameterMap.put("end", Long.toString(endIndex));
    parameterMap.put("width", Integer.toString(((OldUTGBTrack) track).getMainPanelWidth()));

    {
        final Widget absoluteParentPanel = sender.getParent();

        final int parentAbsX = absoluteParentPanel.getAbsoluteLeft();
        final int parentAbsY = absoluteParentPanel.getAbsoluteTop();

        final int selfAbsX = sender.getAbsoluteLeft();
        final int selfAbsY = sender.getAbsoluteTop();

        final int relativeX = selfAbsX - parentAbsX + x;
        final int relativeY = selfAbsY - parentAbsY + y;

        parameterMap.put("pos", Integer.toString(relativeX) + "," + Integer.toString(relativeY));
        // parameterMap.put("y", Integer.toString(relativeY));
    }

    final String fullURL = url.getURL(parameterMap);

    RPCServiceManager.getRPCService().getHTTPContent(fullURL, new Command(sender, x, y));
}

From source file:org.vaadin.alump.fancylayouts.gwt.client.GwtFancyCssLayout.java

License:Apache License

private void removeWidgetWithTransition(Widget child) {
    Element wrapperElement = child.getParent().getElement();

    if (!child.isVisible()) {
        performFancyRemove(child);//from   w  w w.ja  v  a2 s.  c om
    } else if (!removingMap.contains(child)) {
        removingMap.add(child);
        addTransitionEndListener(wrapperElement);
        wrapperElement.getStyle().setOpacity(0.0);
        if (verticalMarginTransitionEnabled) {
            wrapperElement.getStyle().setMarginTop(-wrapperElement.getOffsetHeight() / 2.0, Unit.PX);
            wrapperElement.getStyle().setMarginBottom(-wrapperElement.getOffsetHeight() / 2.0, Unit.PX);
        }
        if (horizontalMarginTransitionEnabled) {
            wrapperElement.getStyle().setMarginLeft(-wrapperElement.getOffsetWidth() / 2.0, Unit.PX);
            wrapperElement.getStyle().setMarginRight(-wrapperElement.getOffsetWidth() / 2.0, Unit.PX);
        }
    }
}

From source file:org.vaadin.alump.fancylayouts.gwt.client.GwtFancyCssLayout.java

License:Apache License

@Override
public boolean remove(Widget widget) {

    if (children.contains(widget)) {
        Widget wrapper = widget.getParent();
        widgetMap.remove(wrapper.getElement());
        removingMap.remove(widget);//from   w  w w  . j  ava 2  s . c  o m

        flowPanel.remove(wrapper);
        children.remove(widget);
        return true;
    } else {
        return false;
    }
}

From source file:org.vaadin.alump.gridstack.client.GwtGridStack.java

License:Apache License

public Element getWrapper(Widget child) {
    if (child.getParent() == this) {
        throw new IllegalArgumentException("Given widget is not child of this GridStack");
    }//from   w  ww  .j  av a2 s  .  c o  m
    return child.getElement().getParentElement();
}

From source file:org.vaadin.alump.masonry.client.MasonryPanel.java

License:Apache License

public void removeItem(Widget widget) {
    Element item = widget.getElement().getParentElement();
    elementMap.remove(item);//from  w  ww.  ja  v  a2 s .  c om

    if (widget.getParent() == this) {
        super.remove(widget);
    }

    nativeRemoveItem(msnry, item);
    item.removeFromParent();
}

From source file:org.vaadin.hene.splitbutton.widgetset.client.ui.VSplitButton.java

License:Apache License

public boolean hasChildComponent(Widget component) {
    return component.getParent() == panel;
}