Example usage for com.google.gwt.user.client.ui Label addMouseOutHandler

List of usage examples for com.google.gwt.user.client.ui Label addMouseOutHandler

Introduction

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

Prototype

public HandlerRegistration addMouseOutHandler(MouseOutHandler handler) 

Source Link

Usage

From source file:org.ednovo.gooru.client.mvp.shelf.collection.tab.resource.add.AddQuestionResourceView.java

License:Open Source License

public void showRemoveToolTip(final Label deleteButton) {
    deleteButton.addMouseOverHandler(new MouseOverHandler() {

        @Override/* w w  w  .  j a va 2 s .com*/
        public void onMouseOver(MouseOverEvent event) {
            removeToolTip = new RemoveToolTipUc();
            int left = event.getRelativeElement().getAbsoluteLeft() - 16;
            int top = event.getRelativeElement().getAbsoluteTop() + 27;
            removeToolTip.setPopupPosition(left, top);
            removeToolTip.getElement().getStyle().setZIndex(999);
            removeToolTip.show();
        }
    });
    deleteButton.addMouseOutHandler(new MouseOutHandler() {

        @Override
        public void onMouseOut(MouseOutEvent event) {
            removeToolTip.hide();
        }
    });
}

From source file:org.ednovo.gooru.client.mvp.shelf.collection.tab.resource.item.EditQuestionPopupVc.java

License:Open Source License

public void showRemoveToolTip(final Label deleteButton) {

    deleteButton.addMouseOverHandler(new MouseOverHandler() {

        @Override//from  w  ww .jav  a  2  s.c  o m
        public void onMouseOver(MouseOverEvent event) {
            removeToolTip = new RemoveToolTipUc();
            removeToolTip.show();
            int left = event.getRelativeElement().getAbsoluteLeft() - 16;
            int top = event.getRelativeElement().getAbsoluteTop() + 27;
            removeToolTip.setPopupPosition(left, top);
            removeToolTip.getElement().getStyle().setZIndex(999);
        }
    });
    deleteButton.addMouseOutHandler(new MouseOutHandler() {
        @Override
        public void onMouseOut(MouseOutEvent event) {
            removeToolTip.hide();
        }
    });
}

From source file:org.ednovo.gooru.client.uc.CollectionStandardsView.java

License:Open Source License

public void renderStandards(List<StandardFo> standardsList) {
    for (int i = 0; i < standardsList.size(); i++) {
        Label standardText = new Label(standardsList.get(i).getCode());
        standardText.setStyleName(PlayerBundle.INSTANCE.getPlayerStyle().standardText());
        standardContainer.add(standardText);
        standardText//from  w ww .j a  va2  s  . co  m
                .addMouseOverHandler(new MouseOverShowStandardToolTip(standardsList.get(i).getDescription()));
        standardText.addMouseOutHandler(new MouseOutHideToolTip());
    }
}

From source file:org.freemedsoftware.gwt.client.widget.TaskbarIcon.java

License:Open Source License

public TaskbarIcon(String labelText, Image image, ClickHandler l) {
    final VerticalPanel verticalPanel = new VerticalPanel();
    initWidget(verticalPanel);/*from  w  ww .  j a va 2s  .c  om*/

    verticalPanel.add(image);
    verticalPanel.setCellVerticalAlignment(image, HasVerticalAlignment.ALIGN_BOTTOM);
    verticalPanel.setCellHorizontalAlignment(image, HasHorizontalAlignment.ALIGN_CENTER);

    final Label label = new Label(labelText);
    verticalPanel.add(label);
    verticalPanel.setCellHorizontalAlignment(label, HasHorizontalAlignment.ALIGN_CENTER);
    verticalPanel.setCellVerticalAlignment(label, HasVerticalAlignment.ALIGN_TOP);

    // Style this from CSS
    verticalPanel.setStylePrimaryName("taskbarIcon");

    // Push click listeners for both internal objects
    image.addClickHandler(l);
    label.addClickHandler(l);

    MouseOverHandler mlOver = new MouseOverHandler() {
        @Override
        public void onMouseOver(MouseOverEvent event) {
            getParent().setStylePrimaryName("taskbarIcon-hover");
        }
    };
    MouseOutHandler mlOut = new MouseOutHandler() {
        @Override
        public void onMouseOut(MouseOutEvent event) {
            getParent().setStylePrimaryName("taskbarIcon");
        }
    };
    image.addMouseOverHandler(mlOver);
    image.addMouseOutHandler(mlOut);
    label.addMouseOverHandler(mlOver);
    label.addMouseOutHandler(mlOut);
}

From source file:org.sigmah.client.ui.view.project.logframe.grid.IndicatorListWidget.java

License:Open Source License

private void updateRow(final int rowIndex, final IndicatorDTO indicator) {

    final Label label = new Label(indicator.getName());

    label.addClickHandler(new ClickHandler() {

        @Override//from   w w w  . ja va2s  . c  o m
        public void onClick(ClickEvent event) {
            onIndicatorClicked(rowIndex, indicator);
        }
    });
    label.addMouseOverHandler(new MouseOverHandler() {

        @Override
        public void onMouseOver(MouseOverEvent event) {
            label.addStyleName(CLICKABLE_STYLE);
        }
    });
    label.addMouseOutHandler(new MouseOutHandler() {

        @Override
        public void onMouseOut(MouseOutEvent event) {
            label.removeStyleName(CLICKABLE_STYLE);
        }
    });
    table.setWidget(rowIndex, 0, label);
    table.getFlexCellFormatter().setStyleName(rowIndex, 0, "log-frame-indicators-table-cell");

    table.setHTML(rowIndex, 1, indicator.getSourceOfVerification());
    table.getFlexCellFormatter().setStyleName(rowIndex, 1, "log-frame-indicators-table-cell");
}

From source file:org.sigmah.client.ui.view.project.logframe.ProjectLogFrameGrid.java

License:Open Source License

/**
 * Builds the widget of the menus.//from   w ww .j  a v a  2 s  .  c  om
 * 
 * @param menu
 *          The actions menu.
 * @param label
 *          The label beside this menu.
 * @return The widget to display this menu.
 */
private Widget buildMenuWidget(final ActionsMenu menu, final Label label) {

    // Menu button.
    final Anchor anchor = new Anchor();
    anchor.setHTML("&nbsp;");
    anchor.addStyleName(CSS_MENU_BUTTON_STYLE_NAME);

    final ClickHandler clickHandler = new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            menu.show(anchor);
        }
    };

    final MouseOverHandler mouseOverHandler = new MouseOverHandler() {

        @Override
        public void onMouseOver(MouseOverEvent event) {
            anchor.addStyleName(CSS_MENU_BUTTON_ACTIVE_STYLE_NAME);
            if (label != null) {
                label.addStyleName(CSS_CODE_LABEL_ACTIVE_STYLE_NAME);
            }
        }
    };
    final MouseOutHandler mouseOutHandler = new MouseOutHandler() {

        @Override
        public void onMouseOut(MouseOutEvent event) {
            anchor.removeStyleName(CSS_MENU_BUTTON_ACTIVE_STYLE_NAME);
            if (label != null) {
                label.removeStyleName(CSS_CODE_LABEL_ACTIVE_STYLE_NAME);
            }
        }
    };

    anchor.addClickHandler(clickHandler);
    anchor.addMouseOverHandler(mouseOverHandler);
    anchor.addMouseOutHandler(mouseOutHandler);

    // Label.
    if (label != null) {
        label.addClickHandler(clickHandler);
        label.addMouseOverHandler(mouseOverHandler);
        label.addMouseOutHandler(mouseOutHandler);
    }

    return anchor;
}

From source file:org.waveprotocol.wave.client.widget.button.icon.IconButtonTemplate.java

License:Apache License

@UiConstructor
public IconButtonTemplate() {
    Label label = new Label();
    initWidget(label);/*from   w  w w.  jav a  2 s .co  m*/
    label.addClickHandler(this);
    label.addMouseOverHandler(this);
    label.addMouseOutHandler(this);
    label.addMouseUpHandler(this);
    label.addMouseDownHandler(this);
}

From source file:org.wisepersist.gwt.uploader.client.Uploader.java

License:Apache License

@Override
protected void onLoad() {
    if (loaded) {
        return;/*from w ww . j  a v a2s . c  o  m*/
    }
    loaded = true;

    // Make sure our entire panel fits the size that they wanted for the button
    if (this.buttonWidth >= 0) {
        this.setWidth(this.buttonWidth + "px");
    }
    if (this.buttonHeight >= 0) {
        this.setHeight(this.buttonHeight + "px");
    }

    if (ajaxUploadEnabled && isAjaxUploadWithProgressEventsSupported()) {

        // If the browser supports the XMLHttpRequest Level 2 type then we can avoid rendering the
        // flash component and just stick with a DOM/Ajax approach.

        // Use a hidden file input component to handle allowing the user to popup the file system
        // dialog (but keep it outside of the button itself so it doesn't interfere with the mouse
        // events)
        this.add(createFileUpload());

        // Create the main element that will hold all of the inner workings of the uploader component
        Label button = new Label();
        button.setWidth("100%");
        button.setHeight("100%");
        if (this.buttonCursor != null) {
            switch (this.buttonCursor) {
            case ARROW:
                button.getElement().getStyle().setCursor(Style.Cursor.DEFAULT);
                break;
            case HAND:
                button.getElement().getStyle().setCursor(Style.Cursor.POINTER);
                break;
            }
        }

        // Setup what we want to happen when someone clicks anywhere on the button
        button.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                if (buttonDisabled) {
                    return;
                }
                switch (buttonAction) {
                case START_UPLOAD:
                    startUpload();
                    break;
                case SELECT_FILES:
                    openFileDialog(fileUpload, true);
                    break;
                case SELECT_FILE:
                default:
                    openFileDialog(fileUpload, false);
                    break;
                }
            }
        });

        button.addMouseOverHandler(new MouseOverHandler() {
            public void onMouseOver(MouseOverEvent event) {
                if (buttonImageURL != null && buttonHeight >= 0 && !buttonDisabled) {
                    buttonImageElement.getStyle().setProperty("backgroundPosition",
                            "0px -" + buttonHeight + "px");
                }
            }
        });
        button.addMouseOutHandler(new MouseOutHandler() {
            public void onMouseOut(MouseOutEvent event) {
                if (buttonImageURL != null && buttonHeight >= 0 && !buttonDisabled) {
                    buttonImageElement.getStyle().setProperty("backgroundPosition", "0px 0px");
                }
            }
        });
        button.addMouseDownHandler(new MouseDownHandler() {
            public void onMouseDown(MouseDownEvent event) {
                if (buttonImageURL != null && buttonHeight >= 0 && !buttonDisabled) {
                    buttonImageElement.getStyle().setProperty("backgroundPosition",
                            "0px -" + (buttonHeight * 2) + "px");
                }
            }
        });
        button.addMouseUpHandler(new MouseUpHandler() {
            public void onMouseUp(MouseUpEvent event) {
                if (buttonImageURL != null && buttonHeight >= 0 && !buttonDisabled) {
                    buttonImageElement.getStyle().setProperty("backgroundPosition", "0px 0px");
                }
            }
        });

        // Depending on the way they wanted the uploader button rendered, create the appropriate
        // elements in the DOM that the user will click on.
        if (this.buttonTextStyle != null) {
            buttonTextStyleElement = Document.get().createStyleElement();
            buttonTextStyleElement.setInnerText(this.buttonTextStyle);
            button.getElement().appendChild(buttonTextStyleElement);
        }
        if (this.buttonText != null) {
            buttonTextElement = Document.get().createDivElement();
            buttonTextElement.setInnerHTML(this.buttonText);
            buttonTextElement.getStyle().setWidth(100, Style.Unit.PCT);
            buttonTextElement.getStyle().setHeight(100, Style.Unit.PCT);
            if (this.buttonTextLeftPadding > Integer.MIN_VALUE) {
                buttonTextElement.getStyle().setPaddingLeft(this.buttonTextLeftPadding, Style.Unit.PX);
            }
            if (this.buttonTextTopPadding > Integer.MIN_VALUE) {
                buttonTextElement.getStyle().setPaddingTop(this.buttonTextTopPadding, Style.Unit.PX);
            }
            button.getElement().appendChild(buttonTextElement);
        }

        if (this.buttonImageURL != null) {
            buttonImageElement = Document.get().createDivElement();
            buttonImageElement.getStyle().setBackgroundImage("url(\"" + this.buttonImageURL + "\")");
            if (this.buttonDisabled) {
                buttonImageElement.getStyle().setProperty("backgroundPosition",
                        "0px -" + (buttonHeight * 3) + "px");
            } else {
                buttonImageElement.getStyle().setProperty("backgroundPosition", "0px 0px");
            }
            buttonImageElement.getStyle().setWidth(100, Style.Unit.PCT);
            buttonImageElement.getStyle().setHeight(100, Style.Unit.PCT);
            button.getElement().appendChild(buttonImageElement);
        }

        // Add the entire button to the DOM
        this.add(button);

    } else {

        // If the browser doesn't support the XMLHttpRequest Level 2 type, then our only option is
        // to use the Flash/SWFUpload component.

        // The SWFUpload JS code completely replaces the DOM element that you give it as a target,
        // so we're creating an inner component that it can replace - leaving the outer component
        // for the caller to use as the GWT Widget that they can manage and style within the
        // appropriate container within their GWT application
        DivElement swfUploadElement = Document.get().createDivElement();
        swfUploadElement.setId(Document.get().createUniqueId());
        this.getElement().appendChild(swfUploadElement);

        JavaScriptObject nativeOptions = createNativeOptions(swfUploadElement.getId());

        // Build a map that we'll use during the native creation process to setup
        // the necessary JSNI bridges to our Java event handlers...
        JSONObject eventHandlers = new JSONObject();
        eventHandlers.put("swfupload_loaded_handler", JSONBoolean.getInstance(swfUploadLoadedHandler != null));
        eventHandlers.put("file_dialog_start_handler", JSONBoolean.getInstance(fileDialogStartHandler != null));
        eventHandlers.put("file_queued_handler", JSONBoolean.getInstance(fileQueuedHandler != null));
        eventHandlers.put("file_queue_error_handler", JSONBoolean.getInstance(fileQueueErrorHandler != null));
        eventHandlers.put("file_dialog_complete_handler",
                JSONBoolean.getInstance(fileDialogCompleteHandler != null));
        eventHandlers.put("upload_start_handler", JSONBoolean.getInstance(uploadStartHandler != null));
        eventHandlers.put("upload_progress_handler", JSONBoolean.getInstance(uploadProgressHandler != null));
        eventHandlers.put("upload_error_handler", JSONBoolean.getInstance(uploadErrorHandler != null));
        eventHandlers.put("upload_success_handler", JSONBoolean.getInstance(uploadSuccessHandler != null));
        eventHandlers.put("upload_complete_handler", JSONBoolean.getInstance(uploadCompleteHandler != null));

        swfUpload = nativeCreateSWFUpload(nativeOptions, eventHandlers.getJavaScriptObject());
    }
}