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

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

Introduction

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

Prototype

public int getAbsoluteLeft() 

Source Link

Document

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

Usage

From source file:gov.nih.nci.ncicb.tcgaportal.level4.gwt.anomalysearch.client.results.ModeControllerPathway.java

private void createTabForPathway(SinglePathwayResults pathwayResult) {
    final PathwayDiagramPanel panel = new PathwayDiagramPanel(pathwayResult, this);
    panel.addCopyToFilterClickListener(new ClickListener() {
        public void onClick(Widget sender) {
            String list = panel.makeListFromCheckedRows();
            addToElementList(list);/*from w ww . j av  a  2  s .c o  m*/
            addToFilterPopup.setPopupPosition(sender.getAbsoluteLeft(), sender.getAbsoluteTop() - 15);
            addToFilterPopup.show();
            Timer hideTimer = new Timer() {
                public void run() {
                    addToFilterPopup.hide();
                }
            };
            hideTimer.schedule(2000);
        }
    });
    tabPanel.addOrReplaceTab(panel, getModeColorSchemeClass());
}

From source file:gov.nih.nci.ncicb.tcgaportal.level4.gwt.anomalysearch.client.util.TooltipListener.java

License:Open Source License

public void onMouseEnter(final Widget sender) {
    //if instance already visible, do nothing
    if (tooltip != null && tooltip.isVisible()) {
        return;/*from   www.  j a  v  a  2 s .  com*/
    }

    mouseIsOnLink = true;
    int delay = (DELAYBEFORESHOW < 0 ? 0 : DELAYBEFORESHOW);
    Timer t = new Timer() {
        public void run() {
            if (mouseIsOnLink && (tooltip == null || !tooltip.isVisible())) { //in case onMouseEnter is called twice, will only create tooltip once
                tooltip = new Tooltip(sender.getAbsoluteLeft() + DEFAULT_OFFSET_X,
                        sender.getAbsoluteTop() + DEFAULT_OFFSET_Y, text, styleName);
                tooltip.show();
            }
        }
    };
    t.schedule(delay);
}

From source file:ilarkesto.gwt.client.TooltipPopup.java

License:Open Source License

/**
 * Creates a new Tool Tip with the default show delay and no auto hiding
 * //from w w w.j a  v  a 2s  .com
 * @param sender The widget to create the tool tip for
 * @param relLeft The left offset from the &lt;code&gt;sender&lt;/code&gt;
 * @param relTop The top offset from the &lt;code&gt;sender&lt;/code&gt;
 * @param text The tool tip text to display
 * @param useRelTop If true, then use the relative top offset. If not, then just use the sender's offset
 *            height.
 */
public TooltipPopup(Widget sender, int relLeft, int relTop, final Widget contents, boolean useRelTop) {
    super(true);

    this.showTimer = null;
    this.hideTimer = null;

    add(contents);

    int left = getPageScrollLeft() + sender.getAbsoluteLeft() + relLeft;
    int top = getPageScrollTop() + sender.getAbsoluteTop();

    if (useRelTop) {
        top += relTop;
    } else {
        top += sender.getOffsetHeight() + 1;
    }

    setAutoHideEnabled(true);
    setPopupPosition(left, top);
    addStyleName("Tooltip");
}

From source file:info.magnolia.ui.vaadin.gwt.client.magnoliashell.shell.ShellAppLauncher.java

License:Open Source License

private void doUpdateDivetPosition(final ShellAppType type, boolean animated) {
    Widget w = controlsMap.get(type);
    divetWrapper.getStyle().setDisplay(Display.BLOCK);

    switch (type) {
    case APPLAUNCHER:
        divetWrapper.setClassName("divet-green");
        break;/*  w  w w .  j a  va 2 s. com*/
    case PULSE:
        divetWrapper.setClassName("divet-gray");
        break;
    case FAVORITE:
        divetWrapper.setClassName("divet-white");
        break;
    default:
        divetWrapper.setClassName("divet-white");
    }

    int divetPos = w.getAbsoluteLeft() + (w.getOffsetWidth() / 2) - divetWrapper.getOffsetWidth() / 2;
    if (animated && divetWrapper.getAbsoluteLeft() != divetPos) {
        Logger.getLogger(getClass().getName()).log(Level.INFO, "DIVET POS: " + divetPos);
        divetAnimation.setProperty("left", divetPos);
        divetAnimation.run(DIVET_ANIMATION_SPEED, divetWrapper);

    } else {
        divetWrapper.getStyle().setLeft(divetPos, Unit.PX);
    }

}

From source file:net.s17fabu.vip.gwt.showcase.client.content.popups.CwBasicPopup.java

License:Apache License

/**
 * Initialize this example.//from   w ww  . java 2 s  .  c  om
 */
@Override
public Widget onInitialize() {
    // Create a basic popup widget
    final DecoratedPopupPanel simplePopup = new DecoratedPopupPanel(true);
    simplePopup.ensureDebugId("cwBasicPopup-simplePopup");
    simplePopup.setWidth("150px");
    simplePopup.setWidget(new HTML(constants.cwBasicPopupClickOutsideInstructions()));

    // Create a button to show the popup
    Button openButton = new Button(constants.cwBasicPopupShowButton(), new ClickHandler() {
        public void onClick(ClickEvent event) {
            // Reposition the popup relative to the button
            Widget source = (Widget) event.getSource();
            int left = source.getAbsoluteLeft() + 10;
            int top = source.getAbsoluteTop() + 10;
            simplePopup.setPopupPosition(left, top);

            // Show the popup
            simplePopup.show();
        }
    });

    // Create a popup to show the full size image
    Image jimmyFull = Showcase.images.jimmy().createImage();
    final PopupPanel imagePopup = new PopupPanel(true);
    imagePopup.setAnimationEnabled(true);
    imagePopup.ensureDebugId("cwBasicPopup-imagePopup");
    imagePopup.setWidget(jimmyFull);
    jimmyFull.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            imagePopup.hide();
        }
    });

    // Add an image thumbnail
    Image jimmyThumb = Showcase.images.jimmyThumb().createImage();
    jimmyThumb.ensureDebugId("cwBasicPopup-thumb");
    jimmyThumb.addStyleName("cw-BasicPopup-thumb");
    jimmyThumb.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            imagePopup.center();
        }
    });

    // Add the widgets to a panel
    VerticalPanel vPanel = new VerticalPanel();
    vPanel.setSpacing(5);
    vPanel.add(openButton);
    vPanel.add(new HTML("<br><br><br>" + constants.cwBasicPopupInstructions()));
    vPanel.add(jimmyThumb);

    // Return the panel
    return vPanel;
}

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 .  j  ava2 s.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.
 *///from   w  w  w.ja  va 2  s . co m
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 getDisplayLocationX(Widget sender, int x) {
    return sender.getAbsoluteLeft() + x + getPageScrollLeft() + mobileTooltip.getOffsetX();
}

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.  j  a va2s  .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.  ja va2 s  .  c o  m
}