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

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

Introduction

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

Prototype

@Override
    public int getOffsetWidth() 

Source Link

Usage

From source file:org.jbpm.form.builder.ng.model.client.form.items.FieldSetLayoutFormItem.java

License:Apache License

@Override
public void add(PhantomPanel phantom, int x, int y) {
    for (int index = 0; index < panel.getWidgetCount(); index++) {
        Widget item = panel.getWidget(index);
        int left = item.getAbsoluteLeft();
        int right = left + item.getOffsetWidth();
        int top = item.getAbsoluteTop();
        int bottom = top + item.getOffsetHeight();
        if (x > left && x < right && y > top && y < bottom) {
            panel.insert(phantom, index);
            break;
        }//from   w  w w.  jav  a 2 s  .c o m
    }
}

From source file:org.jbpm.form.builder.ng.model.client.form.items.HorizontalLayoutFormItem.java

License:Apache License

@Override
public void add(PhantomPanel phantom, int x, int y) {
    Widget beforeWidget = null;//  w w  w. j av  a2 s .co  m
    for (Widget widget : this.panel) {
        int left = widget.getAbsoluteLeft();
        int right = left + widget.getOffsetWidth();
        if (x > left && x < right) {
            beforeWidget = widget;
            break;
        }
    }
    if (beforeWidget == null) {
        this.panel.add(phantom);
    } else {
        int index = this.panel.getWidgetIndex(beforeWidget);
        this.panel.insert(phantom, index);
    }
}

From source file:org.jbpm.form.builder.ng.model.client.form.items.TabbedLayoutFormItem.java

License:Apache License

public int getTabForCoordinates(int x, int y) {
    int tabNumber = 0;
    while (tabNumber < panel.getWidgetCount()) {
        Widget widget = this.panel.getTabWidget(tabNumber);
        int left = widget.getAbsoluteLeft();
        int top = widget.getAbsoluteTop();
        int right = left + widget.getOffsetWidth();
        int bottom = top + widget.getOffsetHeight();
        if (x > left && x < right && y > top && y < bottom) {
            return tabNumber;
        }/* w  w w  .ja v a2s. c  om*/
        tabNumber++;
    }
    return panel.getSelectedIndex();
}

From source file:org.jbpm.formModeler.editor.client.editors.FormModelerPanelViewImpl.java

License:Apache License

protected void doOnResize() {
    Widget w = getParent();
    if (w != null) {
        int width = w.getOffsetWidth();
        int height = w.getOffsetHeight() - 30;
        if (width > 0)
            frame.setWidth(width + "px");
        if (height > 0)
            frame.setHeight(height + "px");
    }/*from  ww  w .  j  a  v  a 2 s.  c o m*/
}

From source file:org.kie.jbpm.designer.client.DesignerView.java

License:Apache License

@Override
public void onResize() {
    final Widget w = getParent();
    final int width = w.getOffsetWidth();
    vp.setWidth(width + "px");
}

From source file:org.kie.uberfire.client.common.MultiPageEditorView.java

License:Apache License

public Tab cloneTab(final TabLink tabLink, final boolean fromDropdown, final boolean toDropdown) {

    final String heading = tabLink.getText();
    final Widget content = ((ComplexPanel) tabLink.getTabPane().getWidget(0)).getWidget(0);

    if (!fromDropdown && toDropdown && tabLink.getOffsetWidth() > maxDropdownTabLinkWidth) {
        maxDropdownTabLinkWidth = tabLink.getOffsetWidth();
    }//w  ww .ja v  a 2s  .  c om

    return createTab(heading, content, tabLink.isActive(), content.getOffsetWidth(), content.getOffsetHeight());
}

From source file:org.kie.uberfire.client.common.MultiPageEditorView.java

License:Apache License

@Override
public void onResize() {
    final Widget parent = getParent();
    if (parent != null) {
        final int width = parent.getOffsetWidth();
        final int height = parent.getOffsetHeight();
        setPixelSize(width, height);//from  w w w  .  j  a va  2 s  .  c  o m

        if (width == 0 && height == 0) {
            //it's `invisible` = makes no sense try to resize
            return;
        }

        final ComplexPanel content = getTabContent();
        for (int i = 0; i < content.getWidgetCount(); i++) {
            final Widget widget = content.getWidget(i);
            if (widget instanceof TabPane) {
                final TabPane tabPane = (TabPane) widget;
                final LayoutPanel flowPanel = ((LayoutPanel) (tabPane).getWidget(0));
                flowPanel.setPixelSize(width, height - getTabHeight());

                //Resize children
                for (int iChild = 0; iChild < tabPane.getWidgetCount(); iChild++) {
                    final Widget childWidget = tabPane.getWidget(iChild);
                    if (childWidget instanceof RequiresResize) {
                        ((RequiresResize) childWidget).onResize();
                    }
                }
            }
        }

        final ComplexPanel tabs = getTabs();
        if (tabs != null && tabs.getWidgetCount() > 0) {
            final Widget firstTabItem = tabs.getWidget(0);
            final Widget lastTabItem = getLastTab();
            if (width < getTabBarWidth() || tabs.getOffsetHeight() > firstTabItem.getOffsetHeight()) {
                shrinkTabBar();
            } else if (lastTabItem instanceof DropdownTab
                    && (getTabBarWidth() + getLastTab().getOffsetWidth()) < width) {
                expandTabBar();
            }
        }
    }
}

From source file:org.kie.uberfire.client.common.MultiPageEditorView.java

License:Apache License

private int getTabBarWidth() {
    final ComplexPanel tabs = getTabs();

    int width = 0;
    for (final Widget currentTab : tabs) {
        width += currentTab.getOffsetWidth();
    }/*  w  ww .  ja  v a2  s .co m*/

    int margin = 42;

    if (getLastTab() instanceof DropdownTab) {
        margin = maxDropdownTabLinkWidth;
    }

    return width + margin;
}

From source file:org.kie.workbench.common.stunner.project.client.editor.ProjectDiagramEditorView.java

License:Apache License

@Override
public void onResize() {
    final Widget parent = getParent();
    if (parent != null) {
        final double w = parent.getOffsetWidth();
        final double h = parent.getOffsetHeight();
        setPixelSize((int) w, (int) h);
    }/*from w w w. j  a  v  a2  s. com*/

    if (editorPanel.getWidgetCount() > 0) {
        final IsWidget widget = editorPanel.getWidget(0);
        if (widget instanceof RequiresResize) {
            ((RequiresResize) widget).onResize();
        }
    }
}

From source file:org.mobicents.servlet.management.client.dnd.PickupDragController.java

License:Open Source License

/**
 * Called by {@link PickupDragController#dragStart(Widget)} to allow subclasses to
 * provide their own drag proxies.//from   w w w  . java  2 s.c  o m
 * 
 * @param context the current drag context
 * @return a new drag proxy
 */
protected Widget newDragProxy(DragContext context) {
    AbsolutePanel container = new AbsolutePanel();
    DOM.setStyleAttribute(container.getElement(), "overflow", "visible");

    WidgetArea draggableArea = new WidgetArea(context.draggable, null);
    for (int q = 0; q < context.selectedWidgets.size(); q++) {
        Widget widget = (Widget) context.selectedWidgets.get(q);
        WidgetArea widgetArea = new WidgetArea(widget, null);
        Widget proxy = new SimplePanel();
        proxy.setPixelSize(widget.getOffsetWidth(), widget.getOffsetHeight());
        proxy.addStyleName(PRIVATE_CSS_PROXY);
        container.add(proxy, widgetArea.getLeft() - draggableArea.getLeft(),
                widgetArea.getTop() - draggableArea.getTop());
    }

    return container;
}