Example usage for com.google.gwt.event.dom.client ClickEvent getType

List of usage examples for com.google.gwt.event.dom.client ClickEvent getType

Introduction

In this page you can find the example usage for com.google.gwt.event.dom.client ClickEvent getType.

Prototype

public static Type<ClickHandler> getType() 

Source Link

Document

Gets the event type associated with click events.

Usage

From source file:accelerator.client.ui.widget.AbstractButton.java

License:Open Source License

/**
 * {@inheritDoc}
 */
public HandlerRegistration addClickHandler(ClickHandler handler) {
    return addDomHandler(handler, ClickEvent.getType());
}

From source file:asquare.gwt.tk.client.ui.SimpleHyperLink.java

License:Apache License

public HandlerRegistration addClickHandler(ClickHandler handler) {
    return addDomHandler(handler, ClickEvent.getType());
}

From source file:be.progs.routeshare.client.MenuMapGadget.java

License:Open Source License

@Override
public Widget asWidget() {
    if (menu == null) {
        menu = new RouteShareMenu(mapPresenter);

        // Stop propagation of mouse events to the map:
        menu.addDomHandler(new MouseDownHandler() {

            public void onMouseDown(MouseDownEvent event) {
                event.stopPropagation();
            }//from  ww  w.ja va  2s.  c om
        }, MouseDownEvent.getType());
        menu.addDomHandler(new ClickHandler() {

            public void onClick(ClickEvent event) {
                event.stopPropagation();
            }
        }, ClickEvent.getType());
        menu.addDomHandler(new MouseUpHandler() {

            public void onMouseUp(MouseUpEvent event) {
                event.stopPropagation();
            }
        }, MouseUpEvent.getType());
        menu.addDomHandler(new DoubleClickHandler() {

            public void onDoubleClick(DoubleClickEvent event) {
                event.stopPropagation();
            }
        }, DoubleClickEvent.getType());

        // Install a timer for automatic closing when the mouse leaves us:
        menu.addDomHandler(new MouseOutHandler() {

            public void onMouseOut(MouseOutEvent event) {
                if (menu.isOpen() && closeDelay > 0) {
                    timer = new Timer() {

                        public void run() {
                            menu.setOpen(false);
                        }
                    };
                    timer.schedule(closeDelay);
                }
            }
        }, MouseOutEvent.getType());
        menu.addDomHandler(new MouseOverHandler() {

            public void onMouseOver(MouseOverEvent event) {
                if (timer != null) {
                    timer.cancel();
                }
            }
        }, MouseOverEvent.getType());
    }
    return menu;
}

From source file:ca.ubc.ece.netsyslab.tagvalue.client.SearchBarWidget.java

License:Open Source License

public HandlerRegistration addClickHandler(ClickHandler handler) {
    for (Button button : tagButtons) {
        button.addClickHandler(handler);
    }/*  w  ww . j a v a 2  s  .  com*/
    addTag.addClickHandler(handler);
    return addDomHandler(handler, ClickEvent.getType());
}

From source file:cc.alcina.framework.gwt.client.widget.FormLabel.java

License:Apache License

@Override
public HandlerRegistration addClickHandler(ClickHandler handler) {
    return addDomHandler(handler, ClickEvent.getType());
}

From source file:cc.alcina.framework.gwt.client.widget.Link.java

License:Apache License

public Link(String string, boolean asHTML, ClickHandler handler) {
    this(string, asHTML);
    addDomHandler(handler, ClickEvent.getType());
}

From source file:cc.kune.common.client.msgs.UserMessageWidget.java

License:GNU Affero Public License

@Override
public HandlerRegistration addClickHandler(final ClickHandler handler) {
    panel.addStyleName("k-pointer");
    return addDomHandler(handler, ClickEvent.getType());
}

From source file:cc.kune.common.client.notify.UserNotifierGrowl.java

License:GNU Affero Public License

/**
 * Instantiates a new user notifier growl.
 *
 * @param eventBus//from  ww w .  j  a v a2  s  .c  o m
 *          the event bus
 */
@Inject
public UserNotifierGrowl(final EventBus eventBus) {

    eventBus.addHandler(UserNotifyEvent.getType(), new UserNotifyEvent.UserNotifyHandler() {

        @Override
        public void onUserNotify(final UserNotifyEvent event) {

            final GrowlOptions options = GrowlHelper.getNewOptions();

            final GrowlPosition position = GrowlHelper.getNewPosition();
            position.setCenter();
            position.setTop(false);
            options.setGrowlPosition(position);

            String id = event.getId();
            boolean hasId = TextUtils.notEmpty(id);

            if (hasId && DOM.getElementById(id) != null) {
                // this notification is already present so, don't do nothing
                return;
            }

            final GrowlTemplate gt = GrowlHelper.getNewTemplate();

            // As a workaround, we set the id in the <br>

            gt.setTitleDivider(hasId ? "<br id=\"" + id + "\">" : "<br>");
            options.setTemplateObject(gt);

            final Boolean closeable = event.getCloseable();
            if (closeable) {
                options.setDelay(0);
            }
            options.setAllowDismiss(closeable);
            options.setPauseOnMouseOver(true);

            final String message = event.getMessage();
            String icon = "";
            final String iconStyleBase = Styles.FONT_AWESOME_BASE + SEPARATOR + IconSize.TIMES2.getCssName()
                    + " growl-icon-margin ";

            final NotifyLevel level = event.getLevel();
            switch (level) {
            case error:
                options.setDangerType();
                icon = iconStyleBase + IconType.EXCLAMATION_CIRCLE.getCssName();
                break;
            case avatar:
                final ClickHandler clickHandler = event.getClickHandler();
                final Container container = new Container();
                container.setFluid(true);
                final Image avatar = new Image(event.getLevel().getUrl());
                avatar.setSize(AVATAR_SIZE, AVATAR_SIZE);
                avatar.addStyleName("k-fl");
                avatar.addStyleName("growl-icon-margin");
                container.add(avatar);
                container.add(new HTML(message));
                container.addDomHandler(clickHandler, ClickEvent.getType());
                Growl.growl(container.getElement().getInnerHTML(), options);
                return;
            case veryImportant:
            case important:
                options.setWarningType();
                icon = iconStyleBase + IconType.WARNING.getCssName();
                break;
            case success:
                options.setSuccessType();
                icon = iconStyleBase + IconType.CHECK_CIRCLE.getCssName();
                break;
            case info:
                options.setInfoType();
                icon = iconStyleBase + IconType.INFO_CIRCLE.getCssName();
                break;
            case log:
                // Do nothing with this level
                return;
            default:
                break;
            }

            Growl.growl(event.getTitle(), message, icon, options);
        }
    });
}

From source file:cc.kune.common.client.ui.BasicThumb.java

License:GNU Affero Public License

/**
 * Adds the click handler impl.// ww  w  . ja va  2 s.  c  o  m
 *
 * @param clickHandler
 *          the click handler
 */
private void addClickHandlerImpl(final ClickHandler clickHandler) {
    panel.addDomHandler(clickHandler, ClickEvent.getType());
}

From source file:cc.kune.core.client.sub.SubtitlesWidget.java

License:GNU Affero Public License

/**
 * Instantiates a new subtitles widget.//from   ww  w  . j  ava  2s.  co m
 */
public SubtitlesWidget() {
    popup = new PopupPanel(false, false);
    popup.ensureDebugId(SUBTITLE_MANAGER_ID);
    widget = uiBinder.createAndBindUi(this);
    popup.addDomHandler(new ClickHandler() {
        @Override
        public void onClick(final ClickEvent event) {
            if (showing) {
                final SlideRight slideAtEnd = new SlideRight(widget.getElement());
                slideAtEnd.invert();
                slideAtEnd.setDuration(2);
                slideAtEnd.play();
                // final Fade fadeAtEnd = new Fade(popup.getElement());
                // fadeAtEnd.setDuration(2);
                // fadeAtEnd.play();
                slideAtEnd.addEffectCompletedHandler(new EffectCompletedHandler() {
                    @Override
                    public void onEffectCompleted(final EffectCompletedEvent event) {
                        popup.hide();
                        callback.onCallback();
                    }
                });
                showing = false;
            }
        }
    }, ClickEvent.getType());
    Window.addResizeHandler(new ResizeHandler() {
        @Override
        public void onResize(final ResizeEvent event) {
            setSize(event.getWidth(), event.getHeight());
        }
    });
}