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

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

Introduction

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

Prototype

public int getAbsoluteTop() 

Source Link

Document

Gets the object's absolute top position in pixels, as measured from the browser window's client area.

Usage

From source file:org.apache.hupa.client.ui.ToolBarView.java

License:Apache License

@UiHandler("mark")
public void handleMark(ClickEvent e) {
    InstrumentationLoggerProvider.get()/*  w  w w .java 2s  .  co m*/
            .instrument("org_apache_hupa_client_ui_ToolBarView_java0x09ab1f22ec72181fe");
    InstrumentationLoggerProvider.get().instrument(
            "org_apache_hupa_client_ui_ToolBarView_java0x09ab1f22ec72181fe0x20x0_____org_apache_hupa_client_ui_ToolBarView_java0x09ab1f22ec72181fe0x2_____org_apache_hupa_client_ui_ToolBarView_java0x09ab1f22ec72181fe0x3_____org_apache_hupa_client_ui_ToolBarView_java0x09ab1f22ec72181fe0x1_____org_apache_hupa_client_ui_ToolBarView_java0x09ab1f22ec72181fe0x0");
    if (isEnabled(mark)) {
        InstrumentationLoggerProvider.get().instrument(
                "org_apache_hupa_client_ui_ToolBarView_java0x09ab1f22ec72181fe0x30x00x1_____org_apache_hupa_client_ui_ToolBarView_java0x09ab1f22ec72181fe0x30x00x0_____org_apache_hupa_client_ui_ToolBarView_java0x09ab1f22ec72181fe0x30x0");
        InstrumentationLoggerProvider.get().instrument(
                "org_apache_hupa_client_ui_ToolBarView_java0x09ab1f22ec72181fe0x30x00x10x0_____org_apache_hupa_client_ui_ToolBarView_java0x09ab1f22ec72181fe0x30x00x10x00x10x0_____org_apache_hupa_client_ui_ToolBarView_java0x09ab1f22ec72181fe0x30x00x10x00x10x00x1_____org_apache_hupa_client_ui_ToolBarView_java0x09ab1f22ec72181fe0x30x00x10x00x10x00x0_____org_apache_hupa_client_ui_ToolBarView_java0x09ab1f22ec72181fe0x30x00x10x00x1_____org_apache_hupa_client_ui_ToolBarView_java0x09ab1f22ec72181fe0x30x00x10x00x0");
        Widget source = (Widget) e.getSource();
        InstrumentationLoggerProvider.get().instrument(
                "org_apache_hupa_client_ui_ToolBarView_java0x09ab1f22ec72181fe0x30x00x10x10x1_____org_apache_hupa_client_ui_ToolBarView_java0x09ab1f22ec72181fe0x30x00x10x10x0_____org_apache_hupa_client_ui_ToolBarView_java0x09ab1f22ec72181fe0x30x00x10x1_____org_apache_hupa_client_ui_ToolBarView_java0x09ab1f22ec72181fe0x30x00x10x10x10x0");
        int left = source.getAbsoluteLeft();
        InstrumentationLoggerProvider.get().instrument(
                "org_apache_hupa_client_ui_ToolBarView_java0x09ab1f22ec72181fe0x30x00x10x20x10x00x1_____org_apache_hupa_client_ui_ToolBarView_java0x09ab1f22ec72181fe0x30x00x10x2_____org_apache_hupa_client_ui_ToolBarView_java0x09ab1f22ec72181fe0x30x00x10x20x10x0_____org_apache_hupa_client_ui_ToolBarView_java0x09ab1f22ec72181fe0x30x00x10x20x0_____org_apache_hupa_client_ui_ToolBarView_java0x09ab1f22ec72181fe0x30x00x10x20x10x00x0_____org_apache_hupa_client_ui_ToolBarView_java0x09ab1f22ec72181fe0x30x00x10x20x1");
        int top = source.getAbsoluteTop() + source.getOffsetHeight();
        InstrumentationLoggerProvider.get().instrument(
                "org_apache_hupa_client_ui_ToolBarView_java0x09ab1f22ec72181fe0x30x00x10x3_____org_apache_hupa_client_ui_ToolBarView_java0x09ab1f22ec72181fe0x30x00x10x30x0");
        simplePopup.setPopupPosition(left, top);
        InstrumentationLoggerProvider.get().instrument(
                "org_apache_hupa_client_ui_ToolBarView_java0x09ab1f22ec72181fe0x30x00x10x4_____org_apache_hupa_client_ui_ToolBarView_java0x09ab1f22ec72181fe0x30x00x10x40x0");
        simplePopup.show();
    }
}

From source file:org.apache.solr.explorer.client.core.manager.ui.WidgetProgressIndicator.java

License:Apache License

/**
 * Constructs a new MessageProgressIndicator with a given initial message to be displayed.
 *
 * @param widget The widget this indicator is for.
 * @param message The initial message to be displayed.
 *///  w ww  . j a va 2  s .c  om
public WidgetProgressIndicator(final Widget widget, String message) {
    super(false, true);
    messageLabel = new Label(message);
    messageLabel.setStyleName("Label");
    setPopupPositionAndShow(new PositionCallback() {
        public void setPosition(int offsetWidth, int offsetHeight) {
            int left = widget.getAbsoluteLeft();
            int top = widget.getAbsoluteTop();
            setPopupPosition(left, top);
        }
    });

    CenterPanel centerPanel = new CenterPanel(messageLabel);
    centerPanel.setSize(widget.getOffsetWidth() + "px", widget.getOffsetHeight() + "px");
    setWidget(centerPanel);
    setStyleName("WidgetProgressIndicator");
    addStyleName("transparent-50");
}

From source file:org.bioversityinternational.cisf.client.tooltip.MobileTooltipMouseListener.java

License:Open Source License

private int getDisplayLocationY(Widget sender, int y) {
    return sender.getAbsoluteTop() + y + getPageScrollTop() + mobileTooltip.getOffsetY();
}

From source file:org.bonitasoft.console.client.view.categories.CategoryEditorPanel.java

License:Open Source License

public CategoryEditorPanel(CategoryDataSource categoryDataSource, CategoryUUID categoryUUID) {
    super();// w  w w.  ja  v a 2 s. c  o  m
    this.myCategoryDataSource = categoryDataSource;
    if (categoryUUID != null) {
        this.myCategory = categoryDataSource.getItem(categoryUUID);
    }
    FlowPanel myOuterPanel = new FlowPanel();
    FlexTable myCategoryEditor = new FlexTable();

    if (this.myCategory == null) {
        myCategoryNameTextBox.setValue("");
        myCategoryNameTextBox.setEnabled(true);
        myPreviewCSSStyle = LabelModel.DEFAULT_PREVIEW_CSS;
        myCSSStyle = LabelModel.DEFAULT_READONLY_CSS;
    } else {
        myCategoryNameTextBox.setValue(myCategory.getName());
        myCategoryNameTextBox.setEnabled(false);
        if (myCategory.getPreviewCSSStyleName() == null) {
            myPreviewCSSStyle = LabelModel.DEFAULT_PREVIEW_CSS;
        } else {
            myPreviewCSSStyle = myCategory.getPreviewCSSStyleName();
        }

        if (myCategory.getCSSStyleName() == null) {
            myCSSStyle = LabelModel.DEFAULT_READONLY_CSS;
        } else {
            myCSSStyle = myCategory.getCSSStyleName();
        }
    }

    myColorPicker = new Image(PICTURE_PLACE_HOLDER);
    myColorPicker.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent aEvent) {
            if (myCssStyleSelectorWidget == null) {
                myCssStyleSelectorWidget = new CSSStyleSelectorWidget();
                myCssStyleSelectorWidget.setStyleSelectionListener(new StyleSelectionListener() {

                    public void notifySelectionChange(String aEditableCSSStyle, String aPreviewCSSStyle,
                            String aReadOnlyCSSStyle) {
                        myPreviewCSSStyle = aPreviewCSSStyle;
                        myCSSStyle = aReadOnlyCSSStyle;
                        updateColorPickerStyle();
                        // hide the popup
                        myCssStyleSelectorWidget.hide();
                    }

                });
            }
            // Reposition the popup relative to the button
            Widget source = (Widget) aEvent.getSource();
            int left = source.getAbsoluteLeft();
            int top = source.getAbsoluteTop() + getOffsetHeight();
            myCssStyleSelectorWidget.setPopupPosition(left, top);

            // Show the popup
            myCssStyleSelectorWidget.show();
        }
    });
    myColorPickerContainer = new DecoratorPanel();
    myColorPickerContainer.add(myColorPicker);
    updateColorPickerStyle();

    int theRow = 0;
    myCategoryEditor.setWidget(theRow, 0, myErrorMessageLabel);
    myCategoryEditor.getFlexCellFormatter().setColSpan(theRow, 0, 3);

    theRow++;
    myCategoryEditor.setWidget(theRow, 0, categoryNameLabel);
    myCategoryEditor.getFlexCellFormatter().setStyleName(theRow, 0, "identity_form_label");
    myCategoryNameTextBox.setStyleName("category_dialog_input");
    myCategoryEditor.setWidget(theRow, 1, myCategoryNameTextBox);
    myCategoryEditor.setHTML(theRow, 2, constants.mandatorySymbol());

    theRow++;
    myCategoryEditor.setHTML(theRow, 0, constants.categoryColor());
    myCategoryEditor.getFlexCellFormatter().setStyleName(theRow, 0, "identity_form_label");
    myCategoryNameTextBox.setStyleName("category_dialog_input");
    myCategoryEditor.setWidget(theRow, 1, myColorPickerContainer);

    FlowPanel buttonPanel = new FlowPanel();
    mySaveButton.setStyleName("identity_form_button");
    buttonPanel.add(mySaveButton);
    mySaveButton.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {
            if (myCategory == null) {
                create();
            } else {
                update();
            }
        }
    });
    myCancelButton.setStyleName("identity_form_button");
    buttonPanel.add(myCancelButton);
    buttonPanel.setStyleName("identity_form_button_group");
    myCategoryEditor.setWidget(4, 0, buttonPanel);
    myCategoryEditor.getFlexCellFormatter().setColSpan(4, 0, 3);
    myOuterPanel.add(myCategoryEditor);
    initWidget(myOuterPanel);
}

From source file:org.bonitasoft.console.client.view.processes.ProcessMouseHandler.java

License:Open Source License

public void onMouseOver(MouseOverEvent anEvent) {
    // Reposition the popup relative to the button
    Widget source = (Widget) anEvent.getSource();
    int left = source.getAbsoluteLeft() + source.getOffsetWidth() + 1;
    int top = source.getAbsoluteTop();
    myPopup.setPopupPosition(left, top);

    // Show the popup
    myPopup.show();/*from   w w w .j av  a  2s.co  m*/
}

From source file:org.bonitasoft.forms.client.view.widget.FormFieldWidget.java

License:Open Source License

/**
 * Create the widget//from ww w.  j  av  a  2s .c  om
 *
 * @param widgetData
 *        the widget data object
 */
protected void createWidget(final ReducedFormWidget widgetData, final FormFieldValue fieldValue) {
    // label creation
    if (widgetData.isMandatory() || widgetData.getLabel() != null && widgetData.getLabel().length() > 0) {
        labelWidget = new LabelWidget(widgetData, mandatoryFieldSymbol, mandatoryFieldClasses);
        if (ItemPosition.LEFT.equals(widgetData.getLabelPosition())) {
            addLabel(labelWidget, "bonita_form_label_left");
        } else if (ItemPosition.TOP.equals(widgetData.getLabelPosition())) {
            addLabel(labelWidget, "bonita_form_label_top");
        }
    }
    // field creation
    switch (widgetType) {
    case TEXTBOX:
        fieldWidget = createTextBox(widgetData, fieldValue);
        break;
    case TEXTAREA:
        fieldWidget = createTextArea(widgetData, fieldValue);
        break;
    case RICH_TEXTAREA:
        fieldWidget = createRichTextArea(widgetData, fieldValue);
        break;
    case PASSWORD:
        fieldWidget = createPasswordTextBox(widgetData, fieldValue);
        break;
    case TEXT:
        fieldWidget = createText(widgetData, fieldValue);
        break;
    case CHECKBOX:
        fieldWidget = createCheckBox(widgetData, fieldValue);
        break;
    case RADIOBUTTON_GROUP:
        fieldWidget = createRadioButtonGroup(widgetData, fieldValue);
        break;
    case LISTBOX_SIMPLE:
        fieldWidget = createListBox(widgetData, fieldValue);
        break;
    case LISTBOX_MULTIPLE:
        fieldWidget = createListBoxMulti(widgetData, fieldValue);
        break;
    case SUGGESTBOX:
        fieldWidget = createSuggestBox(widgetData, fieldValue);
        break;
    case SUGGESTBOX_ASYNC:
        fieldWidget = createSuggestBoxAsync(widgetData, fieldValue);
        break;
    case CHECKBOX_GROUP:
        fieldWidget = createCheckboxGroup(widgetData, fieldValue);
        break;
    case DATE:
        fieldWidget = createDateBox(widgetData, fieldValue);
        break;
    case DURATION:
        fieldWidget = createDuration(widgetData, fieldValue);
        break;
    case FILEUPLOAD:
        fieldWidget = createFileUpload(widgetData, fieldValue);
        break;
    case FILEDOWNLOAD:
        fieldWidget = createFileDownload(widgetData, fieldValue);
        break;
    case IMAGE:
        fieldWidget = createImage(widgetData, fieldValue, widgetData.isDisplayAttachmentImage());
        break;
    case TABLE:
        fieldWidget = createTable(widgetData, fieldValue);
        break;
    case EDITABLE_GRID:
        fieldWidget = createEditableGrid(widgetData, fieldValue);
        break;
    case HIDDEN:
        fieldWidget = createHidden(widgetData, fieldValue);
        fieldContainer.add(fieldWidget);
        break;
    default:
        Window.alert(widgetType + " widget not supported.");
        break;
    }

    if (widgetType == WidgetType.LISTBOX_SIMPLE) {
        final FlowPanel div = new FlowPanel();
        div.add(fieldWidget);
        addStandardWidgetFeatures(div, widgetData);
        div.addStyleName("list_container");
    } else {
        addStandardWidgetFeatures(fieldWidget, widgetData);
    }

    if (labelWidget != null) {
        if (ItemPosition.RIGHT.equals(widgetData.getLabelPosition())) {
            addLabel(labelWidget, "bonita_form_label_right");
            if (isStaticField()) {
                fieldWidget.addStyleName("bonita_form_static_field_left");
            } else if (WidgetType.TEXTAREA.equals(widgetData.getType()) && widgetData.getMaxLength() != 0) {
                fieldWidget.addStyleName("bonita_form_field_left_no_width");
            } else {
                fieldWidget.addStyleName("bonita_form_field_left");
            }
        } else if (ItemPosition.BOTTOM.equals(widgetData.getLabelPosition())) {
            addLabel(labelWidget, "bonita_form_label_bottom");
            if (isStaticField()) {
                fieldWidget.addStyleName("bonita_form_static_field_top");
            } else if (WidgetType.TEXTAREA.equals(widgetData.getType()) && widgetData.getMaxLength() != 0) {
                fieldWidget.addStyleName("bonita_form_field_top_no_width");
            } else {
                fieldWidget.addStyleName("bonita_form_field_top");
            }
        } else if (ItemPosition.TOP.equals(widgetData.getLabelPosition())) {
            if (isStaticField()) {
                fieldWidget.addStyleName("bonita_form_static_field_bottom");
            } else if (WidgetType.TEXTAREA.equals(widgetData.getType()) && widgetData.getMaxLength() != 0) {
                fieldWidget.addStyleName("bonita_form_field_bottom_no_width");
            } else {
                fieldWidget.addStyleName("bonita_form_field_bottom");
            }
        } else {
            if (isStaticField()) {
                fieldWidget.addStyleName("bonita_form_static_field_right");
            } else if (WidgetType.TEXTAREA.equals(widgetData.getType()) && widgetData.getMaxLength() != 0) {
                fieldWidget.addStyleName("bonita_form_field_right_no_width");
            } else {
                fieldWidget.addStyleName("bonita_form_field_right");
            }
        }
        if (widgetData.getLabelStyle() != null && widgetData.getLabelStyle().length() > 0) {
            labelWidget.addStyleName(widgetData.getLabelStyle());
        }
    } else {
        if (isStaticField()) {
            fieldWidget.addStyleName("bonita_form_static_field_top");
        } else {
            fieldWidget.addStyleName("bonita_form_field_top");
        }
    }
    if (widgetData.getInputStyle() != null && widgetData.getInputStyle().length() > 0) {
        fieldWidget.addStyleName(widgetData.getInputStyle());
    }

    // display sub title
    if (widgetData.getSubtitle() != null) {
        final String label = widgetData.getSubtitle().getLabel();
        if (label != null && label.trim().length() > 0) {
            if (SubTitlePosition.TOP.equals(widgetData.getSubtitle().getPosition())) {
                final HTML subTitle = new HTML(widgetData.getSubtitle().getLabel());
                subTitle.addStyleName("bonita_form_field_sub_title");
                flowPanel.add(subTitle);
                flowPanel.add(fieldContainer);
            } else {
                final HTML subTitle = new HTML(widgetData.getSubtitle().getLabel());
                subTitle.addStyleName("bonita_form_field_sub_title");
                flowPanel.add(fieldContainer);
                flowPanel.add(subTitle);
            }
        } else {
            flowPanel.add(fieldContainer);
        }
    } else {
        flowPanel.add(fieldContainer);
    }
    flowPanel.addStyleName("bonita_form_vertical_panel");

    // tool-tip widget display
    if (widgetData.getPopupTooltip() != null && widgetData.getPopupTooltip().length() > 0) {

        theOuterToolTipPanel = new FlowPanel();
        final PopupPanel toolTipPopupFrame = new PopupPanel(true);
        toolTipPopupFrame.setWidget(new Label(widgetData.getPopupTooltip()));
        toolTipPopupFrame.addStyleName("bonita_form_popup_tooltip");

        final Image toolTipIcon = new Image("themeResource?theme=portal&location=images/tooltip.gif");
        toolTipIcon.setStylePrimaryName("bonita_form_popup_tooltip_img");
        theOuterToolTipPanel.add(toolTipIcon);
        theOuterToolTipPanel.setStylePrimaryName("bonita_form_popup_tooltip_icon");

        toolTipIcon.addClickHandler(new ClickHandler() {

            @Override
            public void onClick(final ClickEvent event) {
                final Widget source = (Widget) event.getSource();
                final int left = source.getAbsoluteLeft();
                final int top = source.getAbsoluteTop();
                toolTipPopupFrame.setPopupPosition(left + 10, top + 5);
                toolTipPopupFrame.show();
            }
        });
        if (ItemPosition.RIGHT.equals(widgetData.getLabelPosition())) {
            toolTipPopupFrame.addStyleName("bonita_form_popup_tooltip_left");
            fieldContainer.add(theOuterToolTipPanel);
        } else if (ItemPosition.LEFT.equals(widgetData.getLabelPosition())) {
            fieldContainer.add(theOuterToolTipPanel);
        } else if (ItemPosition.TOP.equals(widgetData.getLabelPosition())) {
            fieldContainer.add(theOuterToolTipPanel);
        } else if (ItemPosition.BOTTOM.equals(widgetData.getLabelPosition())) {
            fieldContainer.add(theOuterToolTipPanel);
        }
    }
}

From source file:org.drools.brms.client.admin.CategoryManager.java

License:Apache License

public CategoryManager() {

    FormStyleLayout form = new FormStyleLayout("images/edit_category.gif", "Edit categories");
    form.addAttribute("", new HTML(
            "<i>Categories aid in managing large numbers of rules/assets. A shallow hierarchy is recommented.</i>"));

    explorer = new CategoryExplorerWidget(new CategorySelectHandler() {
        public void selected(String sel) {
            //don't need this here as we don't do anything on select in this spot
        }//  w  ww.j  ava2  s. co  m
    });
    explorer.setStyleName("category-explorer-Admin");

    SimplePanel editable = new SimplePanel();
    editable.setStyleName("metadata-Widget");
    editable.add(explorer);
    form.addRow(new HTML("<hr/>"));
    form.addAttribute("Current categories:", editable);

    Image refresh = new ImageButton("images/refresh.gif");
    refresh.setTitle("Refresh categories");
    refresh.addClickListener(new ClickListener() {
        public void onClick(Widget w) {
            explorer.refresh();
        }
    });
    form.addAttribute("Refresh view:", refresh);
    form.addRow(new HTML("<hr/>"));

    Image newCat = new ImageButton("images/new.gif");
    newCat.setTitle("Create a new category");
    newCat.addClickListener(new ClickListener() {
        public void onClick(Widget w) {
            CategoryEditor newCat = new CategoryEditor(explorer.getSelectedPath());
            newCat.setPopupPosition(w.getAbsoluteLeft(), w.getAbsoluteTop() - 400);
            newCat.show();
        }
    });

    form.addAttribute("Create a new category:", newCat);

    Image delete = new ImageButton("images/delete_obj.gif");
    delete.addClickListener(new ClickListener() {
        public void onClick(Widget w) {
            deleteSelected();
        }
    });
    delete.setTitle(
            "Deletes the currently selected category. You won't be able to delete if the category is in use.");

    form.addAttribute("Delete the currently selected category:", delete);

    initWidget(form);
}

From source file:org.drools.brms.client.common.InfoPopup.java

License:Apache License

public InfoPopup(final String title, final String message) {
    Image info = new Image("images/information.gif");
    info.setTitle(message);/*w  w  w  .  j  a v  a  2  s  .  c o  m*/
    info.addClickListener(new ClickListener() {
        public void onClick(Widget w) {
            final FormStylePopup pop = new FormStylePopup("images/information.gif", title);
            pop.addRow(new Lbl(message, "small-Text"));
            pop.setPopupPosition(w.getAbsoluteLeft(), w.getAbsoluteTop());
            pop.show();
        }
    });
    initWidget(info);
}

From source file:org.drools.brms.client.modeldriven.ui.ActionInsertFactWidget.java

License:Apache License

private void doLayout() {
    layout.clear();//from w  ww  .  ja  v  a2 s .c  o m
    layout.setWidget(0, 0, getAssertLabel());

    DirtyableFlexTable inner = new DirtyableFlexTable();

    for (int i = 0; i < model.fieldValues.length; i++) {
        ActionFieldValue val = model.fieldValues[i];

        inner.setWidget(i, 0, fieldSelector(val));
        inner.setWidget(i, 1, valueEditor(val));
        final int idx = i;
        Image remove = new ImageButton("images/delete_item_small.gif");
        remove.addClickListener(new ClickListener() {
            public void onClick(Widget w) {
                YesNoDialog diag = new YesNoDialog("Remove this item?", new Command() {
                    public void execute() {
                        model.removeField(idx);
                        modeller.refreshWidget();
                    }
                });
                diag.setPopupPosition(w.getAbsoluteLeft(), w.getAbsoluteTop());
                diag.show();
            }
        });
        inner.setWidget(i, 2, remove);

    }

    layout.setWidget(0, 1, inner);

}

From source file:org.drools.brms.client.modeldriven.ui.ActionInsertFactWidget.java

License:Apache License

protected void showAddFieldPopup(Widget w) {
    final FormStylePopup popup = new FormStylePopup("images/newex_wiz.gif", "Add a field");
    popup.setStyleName("ks-popups-Popup");
    final ListBox box = new ListBox();
    box.addItem("...");

    for (int i = 0; i < fieldCompletions.length; i++) {
        box.addItem(fieldCompletions[i]);
    }//from  w w w  . ja  v a2s .c  om

    box.setSelectedIndex(0);

    popup.addAttribute("Add field", box);
    box.addChangeListener(new ChangeListener() {
        public void onChange(Widget w) {
            String fieldName = box.getItemText(box.getSelectedIndex());
            String fieldType = completions.getFieldType(model.factType, fieldName);
            model.addFieldValue(new ActionFieldValue(fieldName, "", fieldType));
            modeller.refreshWidget();
            popup.hide();
        }
    });

    popup.setPopupPosition(w.getAbsoluteLeft(), w.getAbsoluteTop());
    popup.show();

}