Re: Two GWT scripts in one page.

2011-11-01 Thread Robert Zaleski
I know in the past I used one page for dev mode developing, and I did JS 
debugging in the full app for integration testing with the obfuscation 
setting turned down or off so I could step through things in Firefox if 
needed.  I had a bunch of legacy JS I was integrating with in the full app.

I would think if your site needs two different GWT modules, you would want 
to do the same.  I'm assuming the functionality for each module is separate 
enough it makes sense to develop them independently, otherwise why wouldn't 
you just compile one module to be loaded?

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/tFa6hKgXIhQJ.
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: GWT advantages

2011-10-26 Thread Robert Zaleski
It's funny to me that you feel this way, because every large project I've 
worked on using a dynamically typed language has turned into a rats nest 
and has caused me undue headaches with me having to maintain the runtime 
context in my head instead of having that determined for me.  I'm talking 
about once you get into the 30K plus lines of code.

I do think that if you're just adding a menu or some other JS glitz to a 
page, GWT is definitely more than you need, which is why I still hack out 
PERL scripts whenever I want to churn through a file for some quick one off 
analysis.

I know there are large projects written completely in dynamic languages 
though, have you written one, and are there things you do to keep them 
maintainable?  I know you can create a rats nest with JAVA too, but at 
least I always know simple things like what variables I have access to and 
if my refactorings changed every instance calling my function.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/YVrOCcww59EJ.
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: UI Binder, really a good approach?

2009-12-12 Thread Robert Zaleski
After reading the posts, I just had to chime in.  I would like to
start with UIBinder wasn't on my list of reasons for making our team
jump from 1.7 to 2.0 early, but when I finally had a place to use
UIBinder, I became enamoured with it.

The design for any website boils down to HTML/CSS.  If that is how
your page is laid out, then keeping all of the view related stuff in
one place as possible is the best way to go.  That's what UIBinder
lets you do, all of your HTML and CSS in some XML files, which is the
best way to have your layout.  You have the ability to do any web
layout you want there.  The real bang comes with using MVP.  You can
hide all of your touch points to the view behind interfaces and
bundled in a view interface.  Then UIBinder can generate the view
implementation and pop it in.  Plus you can write your own widgets
that you can pop in to the UIBinder and have extra methods if you need
them.

I can understand wanting to do all of the view coding in Java ala
Swing, and depending on the team you have, and if your design specs
allow it, that would be fine.  I don't see any reason GWT doesn't
allow for that with only GWT JAVA layout code and some optional CSS.
But as soon as you're dropping HTML in your JAVA code, or CSS alone
for styling won't do, I think UIBinder becomes a must.

The one thing that should be avoided is 30% of the layout in HTML, 40%
in CSS, and 30% in Java.  If that's what you end up with to get your
view to look right, then you'd be better off having it 80% in UIBinder
with 20% in some globaly shared CSS resources.  And that is definitely
something UIBinder can give you.

--

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-tool...@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.




GWT TDD

2009-12-07 Thread Robert Zaleski
Hey Guys,
 I've been trying to do some more TDD in places where I haven't
been able to.  With GWT, I was looking and for some of the small
samples, a GWT Test Case takes 30 seconds.  I timed doing a refresh of
Dev mode on 2.0-rc2 and that's taking like 6 seconds for our app.

So my thought is, is there any framework for running Tests either
in Dev mode, or running them in GWT Test Case.  I think the dual mode
is key, so in dev I can quickly rerun tests, to make sure things work,
and then cruise can automatically rerun them for me on every commit.

I know another practice is to do MVP so we can just do straight up
JUnits, but I've been working on  a lot of widget level work which we
don't have any coverage on right now due to the GWTTestCase slowness.

Let me know if there's anything on this.  For now I mocked out
something like so in a test main which I use for debugging the widget
by itself, which is cruder than I like, but it works.

public interface Test {
public void doTest();
public String getName();
}

ArrayList tests = new ArrayList();

   public void makeTests() {
  // Make other tests
tests.add(new Test() { public void doTest() {
}
public String getName() { return "No-Op Test"; }
});
   }

public void runTests() {
Document d = Document.get();
int failed = 0;
for ( Test t : tests ) {
try {
t.doTest();
} catch ( Throwable e) {
failed++;
ParagraphElement p = d.createPElement();
StringBuilder sb = new StringBuilder();
sb.append("ERROR during 
\"").append(t.getName()).append("\":
").append(e.getMessage()).append("");

StackTraceElement[] stack = e.getStackTrace();
for ( int i = 0; i < stack.length; i++ ) {
StackTraceElement el = stack[i];

sb.append(el.getFileName()).append('.').append(el.getMethodName
())
.append("() : 
").append(el.getLineNumber()).append("");
}

p.setInnerHTML(sb.toString());
d.getBody().appendChild(p);
}
}
ParagraphElement p = d.createPElement();
p.setInnerHTML("Passed " + ( tests.size() - failed ) + " / " +
tests.size() );
d.getBody().appendChild(p);
}

Longer term, I'd like to do something generator based, but I was
curious what other thoughts there were on doing development like
this.  Dev Mode seems to be optimized to refresh/re-run faster

--

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-tool...@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: Using JSNI to access external JavaScript function of an external library

2009-11-02 Thread Robert Zaleski


I think you want $doc instead of document.

I'm pretty sure 'document' will point to you're GWT IFrames document,
and not to the document associated with $wnd (The enclosing HTML you
provided.).

On Nov 2, 10:41 am, Prashant  wrote:
> Hi,
>
> I am trying to integrate CKEditor with GWT so I tried following code:
>
>     public void onModuleLoad(){
>         FlowPanel panel = new FlowPanel();
>         panel.addStyleName("edit-
> tools");
>         panel.add(new Button("Edit", new ClickHandler() {
>             @Override
>             public void onClick(ClickEvent event) {
>                 loadEditor();
>             }
>         }));
>
>         RootPanel.get("content").add(panel);
>     }
>
> native void loadEditor()/*-{
>         $wnd.CKEDITOR.replace(document.getElementById("content-block"));
>     }-*/;
>
> but it didn't work. could anyone point out where i am wrong?
--~--~-~--~~~---~--~~
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: JavaScriptObject on trunk causes AbstractMethodError

2009-08-21 Thread Robert Zaleski

Just a follow up, If I drop the generics, it works but then I have to
cast everywhere.  ba.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



JavaScriptObject on trunk causes AbstractMethodError

2009-08-21 Thread Robert Zaleski

I figured I'd ask here before I open a bug report.  I don't know if
it's unwanted to open bugs against trunk, but I'm running into this
problem, and thought it'd be good to bring up.

For some brackground, I've got a large amount of JavaScript code, and
I'm refactoring some components to GWT and integrating it with the
existing data model.  I am using JavaScriptObjects (Generated from
server side code) to match the data model our existing JavaScript
uses, and that works fine.  The integration itself went fine, but
while trying to abstract the DTO objects from the DataModel so we
could use pure java unit tests I ran into an issue.

I compiled the trunk code and used an interface to hide the JSO
implementation, so I could then used a generated JAVA DTO to test
outside of the Gwt container.  During the final stages,  I run into an
AbstractMethodError, only in Hosted mode.  The code compiles fine and
deploys to the hybrid JS/Gwt application.  Here's what I have.

/*
 * IList - Interface
 */
package com.zs.type;

public interface IList {

T get(int index);

int length();

void set(int idx, T val);
}

/*
 * JavaScriptObject implementation.
 */
package com.zs.type.jsImpl;

import com.google.gwt.core.client.JavaScriptObject;
import com.zs.type.IList;

class JsArray extends JavaScriptObject implements IList {

protected JsArray() { }

private native final T doGet(int index)/*-{
return this[index];
}-*/;

private native final int getLength() /*-{
return this.length;
}-*/;

private native final void doSet(int idx, Object val) /*-{
this[idx] = val;
}-*/;

final public T get(int index) {
return (T)doGet(index);
}

final public int length() {
return getLength();
}

final public void set(int idx, T val) {
doSet(idx, val);
}
}

/*
 * Unit test
 */

package com.zs.type.jsImpl;

import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.junit.client.GWTTestCase;
import com.zs.type.IList;

public class JsArrayGwtTest extends GWTTestCase {

/**
 * Passes - So Far so good
 */
public void testSet() {
JsArray l = JavaScriptObject.createArray().cast();
l.set(3, 5);
}

/**
 * Barfs See Stack Trace below.
 */
public void testIListSet() {
JsArray jsList = JavaScriptObject.createArray().cast();
IList l = jsList;
l.set(3, 4);
}

@Override
public String getModuleName() {
return "com.zs.Type";
}
}

/* Type.gwt.xml  - for completeness */








I'm running this using the codehaus maven plugin, and a gwtHome
pointed at the build/staging/gwt-linux-0.0.0 dir which I updated to
rev 5989.  When I run this I get the following stack trace

[INFO] [jar:jar]
[INFO] Building jar: /home/robert/workspace/gwt/baseLibs/target/
baseLibs-1.0-SNAPSHOT.jar
[INFO] [gwt:test {execution: default}]
[INFO] using GWT jars from local installation /home/robert/workspace/
gwt-trunk/build/staging/gwt-linux-0.0.0
[INFO] establishing classpath list (scope = test)
[INFO]
[INFO] ---
[INFO]  T E S T S
[INFO] ---
[INFO] Running com.zs.type.jsImpl.JsArrayGwtTest
[INFO] Tests run: 3, Failures: 0, Errors: 1, Skipped: 0, Time elapsed:
23.837 sec <<< FAILURE!
[INFO] testListSet(com.zs.type.jsImpl.JsArrayGwtTest)  Time elapsed:
0.074 sec  <<< ERROR!
[INFO] java.lang.AbstractMethodError:
com.google.gwt.core.client.JavaScriptObject$.com_zs_type_IList_set
(ILjava/lang/Object;)V
[INFO]  at com.zs.type.jsImpl.JsArrayGwtTest.testIListSet
(JsArrayGwtTest.java:18)
[INFO]  at com.zs.type.jsImpl.__JsArrayGwtTest_unitTestImpl.doRunTest
(transient source for com.zs.type.jsImpl.__JsArrayGwtTest_unitTestImpl:
10)
[INFO]  at junit.framework.TestCase.runTest(TestCase.java:62)
[INFO]  at com.google.gwt.junit.client.GWTTestCase.runBare
(GWTTestCase.java:206)
[INFO]  at com.google.gwt.junit.client.GWTTestCase.__doRunTest
(GWTTestCase.java:137)
[INFO]  at com.google.gwt.junit.client.impl.GWTRunner.runTest
(GWTRunner.java:233)
[INFO]  at com.google.gwt.junit.client.impl.GWTRunner.doRunTest
(GWTRunner.java:195)

I also have a JAVA implementation which runs during the standard
surefire java tests, and does the same tests.  This works perfectly
fine in surefire, but blows up when it runs in a GwtTestCase.  From
the little I found on the exception, it seems it may be an eclipse
javac bug?  I don't know details about eclipses relation to javac/
reimplementation, or if GWT uses that internally, but I thought I'd
post before opening a bug in case someone knew of something better to
help.

I also don't know if there's another way to hide the JSO
implementatio

Re: JSNI Issue

2009-08-17 Thread Robert Zaleski

We pass the scope, the this, around with callbacks.  We started doing
this before we tried GWT as it's allot quicker to pass two variables
(scope and cb) instead of making a closure.  Ext.js also uses this.
Then the caller just does

cb.call(scope, extra args);

I've done this a few times in GWT and it works.

If you want an object you can call multiple methods on, I'd use the
Exporter stuff at

http://code.google.com/p/gwt-exporter/downloads/list

It lets you new and call an object multiple times.  It also will
export your static methods for you, and let you pass objects into
them.  So it's nice.  I currently use a mixture of both to integrate
with some legacy code.

On Aug 17, 10:37 am, Thomas Broyer  wrote:
> On 17 août, 16:31, CI-CUBE  wrote:
>
> > My workaround is to use static methods (1 for each Callback) in the
> > base class that redirect the request to virtual members of a static
> > member object. This introduces some overhead but works... anyway is
> > there some advice how to use a true member method in an assignment to
> > a JS callback?
> > > > >        protected native void initializeCBs() /*-{
>
>             var that = this;
>             $wnd.x4ResizeAppCB = function() {
>
> th...@com.egr.x4gpl.apps.saturn.client.application.resizecb()();
>             };
>
> > > > >        }-*/;
>
> It's basically the same as what you described above, without the need
> for Java statics.

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---