GWT 1.5 Plugin - Can I still get it?

2009-08-26 Thread Hiedi

I made the mistake of updating my GWT eclipse plugin whie prototyping
a 1.7 upgrade path and now I can't run anything that has the 1.5 SDK
in hosted mode. Does anyone know how to get around that - or how to
get a copy of the old google plugin??

Thanks,
Hiedi
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to google-web-toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en
-~--~~~~--~~--~--~---



Re: onModuleLoad is sometimes not called (Internet Explorer)

2009-06-30 Thread Hiedi

I have seen this alot with multiple GWT modules that my team has
built. The root of the problem is a timing issue between GWT
downloading and executing the moduleLoad and the page actually being
done downloading all its content and rendering the host page. I am not
surprised that disabling compression helped a few posters because
compression adds an additional step for IE to write the data to disk,
uncompress, and update the cache (index.dat) with the entry. The
additional compression sometimes wreaks havoc since there are bugs in
IE that hang threads when there is a lot of dynamic javascript loading
static content like gifs and css. If the resource requests are not
satsified from cache there are often many aborted http requests made
that tie up threads (you can see this with a tool like IEWatch). Alot
of times, the hang or issue with onmoduleload will go away when your
cache is primed because it avoids the additional aborted calls.

We solved this by doing a few things:

1) Make your onmoduleLoad re-entrant - meaning if its called twice, it
will only execute once and the second time won't fail.
2) Gwt will either call onModuleLoad or IE can call onModuleLoad in
its onload methods if Gwt hasn't done it yet. One of them will work!
3) Pre-load any static content on your page -- like CSS and GIFs so
that your cache is primed before your GWT app requests content. This
will reduce your exposure to timing issues and compression.

By doing this we avoided onModuleLoad never being called -- it always
works from at least one call b/c IE's body.onload won't fire until all
the non-deferred resources have been downloaded.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Re: Mouseover/mouseout event on GRID/FLEX TABLE

2009-06-15 Thread Hiedi

This is basically how I did it:

1) Create a RowListener interface
2) Create a RowListenerCollection
3) Create an implementation of RowListener
4) Add your rowListener to the table you care about -- the table
should know what its styles are and have a contract for hovering and
resetting its own styles that the rowListener can call -- that way you
can use the same listeners every where but the styles are controlled
by your dataTable.
5) Lastly -- your table needs to implement onBrowserEvent and figure
out what row its supposed to be acting on.


import java.util.EventListener;

public interface RowListener extends EventListener {

void onMouseLeave(int row);

void onMouseEnter(int row);

void onMouseOver(int row);

}


import java.util.ArrayList;

public class RowListenerCollection extends ArrayListRowListener {

private static final long serialVersionUID = 1L;


public void fireMouseEnterEvent(int row) {
for (RowListener listener : this) {
listener.onMouseEnter(row);
}
}

public void fireMouseOverEvent(int row) {
for (RowListener listener : this) {
listener.onMouseOver(row);
}
}

public void fireMouseLeaveEvent(int row) {
for (RowListener listener : this) {
listener.onMouseLeave(row);
}
}

}

import com.google.gwt.user.client.ui.SourcesTableEvents;
import com.google.gwt.user.client.ui.TableListener;

public class RowHighlighter implements TableListener, RowListener {

private DataTable table = null;

public RowHighlighter(DataTable table) {

this.table = table;
}

public void onCellClicked(SourcesTableEvents sender, int row, int
cell) {

if (sender == table) {
table.selectRow(row);
}
}

public void onMouseEnter(int row) {

if (table.getLastSelectedRow() != row) {
table.hoverRow(row);
}

}

public void onMouseLeave(int row) {
if (table.getLastSelectedRow() != row) {
table.resetRowStyle(row);
}

}

public void onMouseOver(int row) {
// TODO Auto-generated method stub

}

}


mport com.google.gwt.user.client.ui.Widget;

public interface DataTable {

public abstract void highlightRow(int row);

public abstract void hoverRow(int row);

public abstract void resetRowStyle(int row);

public abstract void resetTableStyle();

public abstract int getLastSelectedRow();

public abstract void setLastSelectedRow(int row);

public abstract int getRowCount();

public abstract int getCellCount(int row);

public abstract Widget getWidget(int row, int col);

public abstract void selectRow(int row);

}



public void onBrowserEvent(Event event) {

// Find out which row.
Element td = getEventTargetCell(event);
if (td == null) {
return;
}
Element tr = DOM.getParent
((com.google.gwt.user.client.Element) td);
Element body = DOM.getParent(tr);
int row = DOM.getChildIndex(body, tr);

switch (DOM.eventGetType(event)) {

case Event.ONMOUSEOVER:
// Only fire the mouseEnter event if it's coming from
outside this
// widget.
Element from = DOM.eventGetFromElement(event);
if (from == null || !DOM.isOrHasChild(tr, from)) {
rowListeners.fireMouseEnterEvent(row);
}
break;
case Event.ONMOUSEOUT:
// Only fire the mouseLeave event if it's actually leaving
this
// widget.
Element to = DOM.eventGetToElement(event);
if (to == null || !DOM.isOrHasChild(tr, to)) {
rowListeners.fireMouseLeaveEvent(row);
}
break;

default: {
// Do nothing
}

super.onBrowserEvent(event);
}
}

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Need some JSNI help/explanation

2008-09-17 Thread Hiedi

I am working on a new class and I want to expose instance fields and
methods via a prototype via JSNI so I can call from third party script
into my GWT code like this.

var mySimpleObject = new Simple(test);
test.callMyName();

I have been working through a series of examples that build on each
other but I am not sure that my assumptions about why the ones that
work really work and why the ones that fail really fail.

Here they are -- JSNI experts please comment!

Thanks!

package com.test.client;

public class Simple {

public String name;

public Simple(String name) {

this.name = name;
}

public static Simple createSimple(String name) {
return new Simple(name);

}

// this works becuase you are passing in the Simple reference
public native void callMyNameWorks(Simple myInstance)
/*-{

 $wnd.callMyName = function(){

alert( [EMAIL PROTECTED]::name);
 }

 alert( [EMAIL PROTECTED]::name);

 $wnd.callMyName();

 }-*/;

// this works because we COPY the reference and store it in a
closure.
public native void callMyNameWorks()
/*-{

 var myInstance = this;

 $wnd.callMyName = function(){


alert( [EMAIL PROTECTED]::name);
 }

 //this in GWT entrypoint is the Simple object that called this
method.
 alert( [EMAIL PROTECTED]::name);

 $wnd.callMyName();

 }-*/;

// this broken because this is not the right object when our new
function
// gets called.
public native void callMyNameHalfBroken()
/*-{

 $wnd.callMyName = function(){

 //this will break because at this is actually the window object
now (or who called the method)
 alert( [EMAIL PROTECTED]::name);
 }

 //this works b/c GWT entrypoint is the Simple object that called
this method.
 alert( [EMAIL PROTECTED]::name);

 $wnd.callMyName();

 }-*/;

public static native void callMyNameStaticGlobalWorks()
/*-{

 //---
 //NOTE: this RETURNS the GWT Simple Object not a js object
 //---
 $wnd.jsSimple = function (name){
 return
@com.siemens.soarian.sf.uiarch.client.Simple::createSimple(Ljava/lang/
String;)(name)
 }

 //myObject must be an instance of the GWT Simple Object
 $wnd.callMyNameGlobal = function(myGwtJavaObject){

alert([EMAIL PROTECTED]::name);
 }

 var myJsSimple = new $wnd.jsSimple(testing);

 //works bc we pass in the actual GWT Java Simple object
 $wnd.callMyNameGlobal(myJsSimple);

 }-*/;

public static native void callMyNameStaticGlobalBroken()
/*-{

 debugger;

 //---
 //NOTE: effectively assigns the value of var name = javascript
instance of gwt java object
 //if you look at the object in debug you will see name.instance is
now defined.
 //name.instance is a reference to the gwt object
 //---
 $wnd.jsSimple = function (name){
 this.instance =
@com.siemens.soarian.sf.uiarch.client.Simple::createSimple(Ljava/lang/
String;)(name);
 }

 //myObject must be an instance of the GWT Simple Object
 $wnd.callMyNameGlobal = function(myobject){

 alert([EMAIL PROTECTED]::name);

 }

 //debug shows that there is now a name.instance defined;
 var myJsSimple = new $wnd.jsSimple(testing);
 $wnd.callMyNameGlobal(myJsSimple);

 }-*/;

public static native void callMyNameStaticLocalBroken()
/*-{

 debugger;

 //---
 //NOTE: effectively assigns the value of var name = javascript
instance of gwt java object
 //if you look at the object in debug you will see name.instance is
now defined.
 //name.instance is a reference to the gwt object
 //---
 $wnd.jsSimple = function (name){
 this.instance =
@com.siemens.soarian.sf.uiarch.client.Simple::createSimple(Ljava/lang/
String;)(name);
 }

 //store a copy of the prototype reference to use later
 var _= $wnd.jsSimple.prototype;
 _.callMyNameLocal = function(){

 //who is this when its called? it won't be a GWT Java Simple
object!!!
 //it is actually the javascript object -- So the myInstance[blah
blah] will be undefined
 var myInstance = this;

alert([EMAIL PROTECTED]::name);
 }

 var myJsSimple = new $wnd.jsSimple(testing);
 myJsSimple.callMyNameLocal();

 }-*/;

public static native void callMyNameStaticLocalWorks1()
/*-{