weltermann17

it's just a blog.

jit + gwt: MouseOverLabelEvent/MouseOutLabelEvent July 7, 2009

Filed under: jit with gwt — weltermann17 @ 20:12
Tags: ,

These event types were added to enable easy “tooltip” or “show details when hovering over jit labels” implementation. Their usage was described in the previous post.

Before you complain, I’ll add a link to download the entire package plus samples in the next couple of days.

import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.event.shared.HasHandlers;

public interface HasMouseOutLabelHandlers extends HasHandlers {

    HandlerRegistration addMouseOutLabelHandler(MouseOutLabelHandler handler);

}

import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.event.shared.HasHandlers;

public interface HasMouseOverLabelHandlers extends HasHandlers {

    HandlerRegistration addMouseOverLabelHandler(MouseOverLabelHandler handler);

}

import com.google.gwt.event.shared.EventHandler;

public interface MouseOutLabelHandler extends EventHandler {

    void onMouseOutLabel(MouseOutLabelEvent event);

}

import com.google.gwt.event.shared.EventHandler;

public interface MouseOverLabelHandler extends EventHandler {

    void onMouseOverLabel(MouseOverLabelEvent event);

}

import com.google.gwt.dom.client.NativeEvent;
import com.google.gwt.event.dom.client.HasNativeEvent;
import com.google.gwt.event.shared.GwtEvent;

public class MouseOutLabelEvent extends GwtEvent<MouseOutLabelHandler> implements HasNativeEvent {

    protected MouseOutLabelEvent(NativeEvent nativeevent) {
	this.nativeevent = nativeevent;
    }

    public static Type getType() {
	return TYPE;
    }

    public static void fire(HasMouseOutLabelHandlers source, NativeEvent nativeevent) {
	source.fireEvent(new MouseOutLabelEvent(nativeevent));
    }

    @Override
    protected void dispatch(MouseOutLabelHandler handler) {
	handler.onMouseOutLabel(this);
    }

    @Override
    public final Type getAssociatedType() {
	return TYPE;
    }

    @Override
    public NativeEvent getNativeEvent() {
	return nativeevent;
    }

    private static Type<MouseOutLabelHandler> TYPE = new Type<MouseOutLabelHandler>();
    private final NativeEvent nativeevent;

}

import com.google.gwt.dom.client.NativeEvent;
import com.google.gwt.event.dom.client.HasNativeEvent;
import com.google.gwt.event.shared.GwtEvent;

public class MouseOverLabelEvent extends GwtEvent<MouseOverLabelHandler> implements HasNativeEvent {

    protected MouseOverLabelEvent(NativeEvent nativeevent) {
	this.nativeevent = nativeevent;
    }

    public static Type getType() {
	return TYPE;
    }

    public static void fire(HasMouseOverLabelHandlers source, NativeEvent nativeevent) {
	source.fireEvent(new MouseOverLabelEvent(nativeevent));
    }

    @Override
    protected void dispatch(MouseOverLabelHandler handler) {
	handler.onMouseOverLabel(this);
    }

    @Override
    public final Type getAssociatedType() {
	return TYPE;
    }

    @Override
    public NativeEvent getNativeEvent() {
	return nativeevent;
    }

    private static Type<MouseOverLabelHandler> TYPE = new Type<MouseOverLabelHandler>();
    private final NativeEvent nativeevent;

}
Advertisement
 

5 Responses to “jit + gwt: MouseOverLabelEvent/MouseOutLabelEvent”

  1. Dmitriy Says:

    Hi, thx for providing this workaround on how to use JIT with GWT. Unfortunately, I can’t make your example work. It will be very useful if you publish the entire package with example. Also, would you be so kind to provide your code for dataset() method ? Looking forward for your blog updates.

  2. Sherman Says:

    Hi, I have been trying to get the code to compile in GWT through maven, but the GWT compiler never kicks in. Please let me know if you spot something wrong with this setup.

    Thanks,
    Sherman

    In my set up, I have the following directory structure:
    /testproject
    | /jit-test
    | | /src
    | | | |/main
    | | | | /java
    | | | | | /org/kuali/student/da/graph/gwt
    | | | | | |ClickLabelEvent.java
    | | | | | |ClickLabelHandler.java
    | | | | | |…
    | | | | | |JitGlueEntryPoint.java (my own class basically empty for now)
    | |pom.xml
    |pom.xml

    Below is my class which is pretty much empty for now.
    package org.kuali.student.da.graph.gwt;

    import com.google.gwt.core.client.EntryPoint;

    public class JitGlueEntryPoint implements EntryPoint {

    public void onModuleLoad() {
    }

    }

    Below is my pom.xml in jit-test:

    4.0.0
    sherman.test
    jit-test
    0.0.1-SNAPSHOT
    jar
    JIT Test
    JIT Test

    jit-test-project
    sherman.test
    0.0.1-SNAPSHOT

    build-gwt

    org.apache.maven.plugins
    maven-war-plugin
    2.0

    compile

    war

    com.totsp.gwt
    maven-googlewebtoolkit2-plugin

    gwt-test
    test

    gwt

    org.kuali.student.da.graph.gwt/JitGlue.html

    org.kuali.student.da.graph.gwt.JitGlue

    org.kuali.student.da.graph.gwt.JitGlue

    -Xmx512m

    org.apache.maven.plugins
    maven-dependency-plugin

    org.kuali.student.core
    ks-cxf
    0.0.1-SNAPSHOT
    pom
    runtime

    org.springframework
    spring-web
    runtime

    <!–

    org.codehaus.mojo
    tomcat-maven-plugin

    jit-test

    –>

    org.kuali.student.core
    ks-core-impl
    0.0.1-SNAPSHOT

    org.kuali.student.core
    ks-common-ui
    0.0.1-SNAPSHOT
    sources
    provided

    org.kuali.student.core
    ks-core-ui
    0.0.1-SNAPSHOT

    org.kuali.student.core
    ks-core-ui
    0.0.1-SNAPSHOT
    sources
    provided

    org.kuali.student.core
    ks-core-api
    0.0.1-SNAPSHOT

    org.kuali.student.core
    ks-core-api
    0.0.1-SNAPSHOT
    sources
    provided

    And the project pom.xml

    4.0.0
    sherman.test
    jit-test-project
    0.0.1-SNAPSHOT
    pom

    JIT Test Project
    JIT Test Project

    ks-core
    org.kuali.student.core
    0.0.1-SNAPSHOT

    jit-test

    <!–

    org.apache.maven.plugins
    maven-javadoc-plugin
    ${javadoc.plugin.version}

    256m
    true
    private
    1.6

    http://cxf.apache.org/javadoc/2.1/

    http://java.sun.com/javase/6/docs/api/

    http://java.sun.com/javaee/5/docs/api/

    http://static.springframework.org/spring/docs/2.5.x/api/

    http://student.kuali.org/site/core/${ks.core.version}/apidocs/

    javadoc

    –>

    • weltermann17 Says:

      Sorry, I don’t use maven (yet) just the simple GWT compile. Maybe somebody else can help out?

  3. Sherman Says:

    Thank you weltermann17,

    Don’t worry about it. I have figured it out. I have posted the maven project at http://groups.google.com/group/javascript-information-visualization-toolkit/browse_frm/thread/f05dcc987cfafab0?tvc=1

    Sherman


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

 
Follow

Get every new post delivered to your Inbox.