Java Code Examples for com.google.gwt.user.client.ui.Widget#equals()

The following examples show how to use com.google.gwt.user.client.ui.Widget#equals() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Tools.java    From cuba with Apache License 2.0 5 votes vote down vote up
public static boolean isLayoutChild(VAbstractOrderedLayout layout, Widget child) {
    for (Widget widget : layout) {
        Slot slot = (Slot) widget;
        Widget slotWidget = slot.getWidget();
        if (slotWidget.equals(child)) {
            return true;
        }
    }
    return false;
}
 
Example 2
Source File: VDDFormLayout.java    From cuba with Apache License 2.0 5 votes vote down vote up
/**
 * Updates the drop details while dragging. This is needed to ensure client
 * side criterias can validate the drop location.
 * 
 * @param widget
 *            The container which we are hovering over
 * @param event
 *            The drag event
 */
protected void updateDragDetails(Widget widget, VDragEvent event) {
    /*
     * The horizontal position within the cell
     */
    event.getDropDetails().put(Constants.DROP_DETAIL_VERTICAL_DROP_LOCATION,
            getVerticalDropLocation(VDDFormLayout.getRowFromChildElement(
                    widget.getElement(), VDDFormLayout.this.getElement()),
                    event));

    /*
     * The index over which the drag is. Can be used by a client side
     * criteria to verify that a drag is over a certain index.
     */
    event.getDropDetails().put(Constants.DROP_DETAIL_TO, "-1");
    for (int i = 0; i < table.getRowCount(); i++) {
        Widget w = table.getWidget(i, COLUMN_WIDGET);
        if (widget.equals(w)) {
            event.getDropDetails().put(Constants.DROP_DETAIL_TO, i);
        }
    }

    /*
     * Add Classname of component over the drag. This can be used by a a
     * client side criteria to verify that a drag is over a specific class
     * of component.
     */
    String className = widget.getClass().getName();
    event.getDropDetails().put(Constants.DROP_DETAIL_OVER_CLASS, className);

    // Add mouse event details
    MouseEventDetails details = MouseEventDetailsBuilder
            .buildMouseEventDetails(event.getCurrentGwtEvent(),
                    getElement());
    event.getDropDetails().put(Constants.DROP_DETAIL_MOUSE_EVENT,
            details.serialize());
}
 
Example 3
Source File: MaterialCollapsibleItem.java    From gwt-material with Apache License 2.0 5 votes vote down vote up
@Override
public boolean remove(Widget w) {
    if (w instanceof HasCollapsibleParent) {
        ((HasCollapsibleParent) w).setParent(null);
    }

    if (w.equals(body)) {
        body = null;
    } else if (w.equals(header)) {
        header = null;
    }
    return super.remove(w);
}