Scrolling to Elements/Widgets in Some Container

2016-01-10 Thread Jason Morris
Hi all,

Let's say that I have a VerticalPanel that contains some Composite widgets. 
  
I place this VerticalPanel inside a Scroll Panel. 

Now, I would like to be able to click a link in one of the Composites, and 
have the ScrollPanel scroll its contents to another Composite widget in the 
same VerticalPanel.

When I tried use Anchor widgets with their id attributes set (named anchors 
are not supported in HTML 5) and I set the href attributes of the 
corresponsing clickable Anchors to href="#...", the whole view scrolls 
incorrectly.


   - Is there any way to achieve the effect of ordinary named anchors and 
   anchor links in GWT using widgets?
   - Can element.scrollIntoView() be used somehow? How to limit the scope 
   to just the scroll panel and not the whole view?

Thanks!

- JM

-- 
You received this message because you are subscribed to the Google Groups "GWT 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.


Re: Detect the selected language

2010-10-12 Thread Jason Morris
Hi Stefan,

Is com.google.gwt.i18n.client.LocaleInfo.getCurrentLocale() what
you're looking for?

Hope this helps.
//Jason

On Tue, Oct 12, 2010 at 10:08 AM, StrongSteve  wrote:
> Hello,
>
> I have a GWT application with I18N features.
> Within one composite I do not want to access internationalized strings
> but I want to know which language is selected.
>
> So my question is if there is a mechanism like
> GWT.getSelectedLanguage() which would return "en" or "de".
> Is there such a thing?
>
> An intensive internet research did not help me... :(
>
> Thanks in Advance for your time!
>
> Greetings
> Stefan
>
> --
> 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.
>
>

-- 
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: Database and GWT

2010-08-24 Thread Jason Morris
Hi Charlie,

By join I'll assume you're talking about a straight database JOIN, in
which case: it's handled in EoD.

EoD doesn't parse or restructure your SQL (much the way iBatis
doesn't); and it generates it's internal ResultSet -> Object mapping
structures on a case-by-case basis. It's a loose mapping system, so
columns that can't be mapped to the object are ignored; as are object
fields that don't appear to have columns in the ResultSet (this allows
you to use many different SQL queries to load the same object).

An important principal of EoD is that your object model doesn't need
to conform to the database (although it generally does). The object
mapping is done based on the ResultSet of each SQL query rather than
the database tables.

Hope that answers your question.
//Jason

On Mon, Aug 23, 2010 at 9:34 PM, charlie  wrote:
> I don't see anything related to joins in any of those links or mailing
> lists, is this easily doable in EoD ?
>
> On Mon, Aug 23, 2010 at 11:39 AM, barnaclehead  wrote:
>>
>> I have had much success with EoDSQL. I am surprised there isn't more
>> talk about it. It is a very simple db abstraction where you write your
>> own queries and there is great GWT support. The project home is at:
>>  https://eodsql.dev.java.net/
>> and there is plenty of information on the authors' blog
>>  http://lemnik.wordpress.com/2010/02/02/eod-sql-2-1-released/
>> The best tutorial is the docs/tutorial.html  from the downloaded
>> package. There is a users mailing list but it isn't overly active, but
>> still responsive. The archive is at:
>>  https://eodsql.dev.java.net/servlets/SummarizeList?listName=users
>>
>> Good luck,
>> Barry.
>>
>> On Aug 5, 3:56 pm, Diego Venuzka  wrote:
>> > Hi!
>> > After some hours without sleep to solve my compilation problem, i stop
>> > in
>> > another problem. I'll need to insert data in database, and how GWT can
>> > help
>> > with this? Or i can insert using the "tradicional method" with Java?
>> > Thanks =)
>> >
>> > --
>> > Diego Venuzka
>>
>> --
>> 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.
>>
>
>
>
> --
> 
>
> --
> 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.
>

-- 
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: Cleaning up threads on GWT application shutdown

2010-06-10 Thread Jason Morris
Hi Jim,

Generally I would register a ServletContextListener with the
application-server (in your case Tomcat) to start and stop background
services. You would register it in your web.xml file:


com.company.webapp.MyContextListener


Hope this is what you're looking for.
//Jason

On Wed, Jun 9, 2010 at 12:02 AM, jjd  wrote:
> I have a GWT application that starts an independent thread and leaves
> it running for use by multiple GWT sessions.
>
> It appears that under Tomcat, when I Stop of Undeploy the application,
> this thread keeps running.  I can't figure out the right way to manage
> shutting down the thread when the application is stopped (but tomcat
> keeps running).
>
> I tried adding a ShutdownHook using
> Runtime.getRuntime().addShutdownHook(), but that doesn't get called
> until Tomcat itself is shutdown.
>
> What is the proper way to manage threads at application shutdown time?
>
> Thanks,
>
> --Jim--
>
> --
> 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.
>
>

-- 
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: How to scroll page to element

2010-04-13 Thread Jason Morris
I assume you're using GWT 2.0. If so dom.client.Element has a method: 
"scrollIntoView" which may be what you are looking for.

To scroll to a Button for example:

Button button = new Button();
//...

button.getElement().scrollIntoView();

This will scroll any required elements (including ScrollPanels and the 
document itself) to make sure that the Button is visible to the user.

Hope that helps.
//Jason

On Tuesday, 13 April 2010 10:35:21 mram wrote:
> I don't understand well your question, but why don't you use div to
> separate parts from the page, and then call the div class that you
> need??
> 
> On 13 abr, 08:55, redlaber  wrote:
> > The next problem: I have finished big gwt-application and I cant add a
> > ScrollPanel in it. But i know position of browser scrollbar, where I
> > want to jump (scroll). Is there no way to simply scroll through the
> > document to a given position?
> >
> > On 12 апр, 19:12, "t.dave"  wrote:
> > > use ScrollPanel.setScrollPosition().  that sets the vertical scroll
> > > position of the scrollpanel, which you will need to calculate.  try
> > > something like this:
> > >
> > > new ClickHandler() {
> > >   public void onClick( ClickEvent event ) {
> > > int tableTop = secondFlexTable.getAbsoluteTop();
> > > scrollPanel.setScrollPosition( tableTop );
> > >   }
> > >
> > > }
> > >
> > > i suppose in your case it wouldn't be a click handler if you're basing
> > > it off the history token, but hopefully this will point you in the
> > > right direction.
> > >
> > > On Apr 12, 7:34 am, redlaber  wrote:
> > > > I want to scroll page, generated with gwt, to some element. Its
> > > > should be simple, but i cannt find the solution. For example: I have
> > > > a vertical panel with two flexables. When i get the history token
> > > > "goto2" I want to scroll my page to the second table. (Sorry for the
> > > > terrible english).
> 

-- 
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: How to prepend?

2009-12-14 Thread Jason Morris
The insertFirst method on the DOM model will also fail to register / 
unregister any event listeners.

To insert a Widget at the beginning of any ComplexPanel (such as RootPanel) 
use:

panel.insert(widget, 0);

If all you want to do is modify the DOM structure:

DivElement div = Document.createDivElement();
div.setInnerText("myDiv");
Document.get().getElementById("entries").insertFirst(div);

Hope this helps a bit.
// Jason

On Tuesday, 15 December 2009 01:08:17 Dennis Madsen wrote:
> Thanks for your reply!
> I cannot find a way to implement what do write. I'm doing something
> like:
> 
>   HTML widget = new HTML("myDiv");
>   RootPanel.get("entries").getElement().insertFirst(widget);
> 
> But the insertFirst takes a node instead of a HTML widget. Any
> suggestions?
> 
> On 14 Dec., 18:44, Nicanor Cristian  wrote:
> > That's not necessary.
> > Suppose you want to insert an newWidget before the element "widget1".
> > All you have to do is:
> > widget1.getParent().getElement().insertBefore(newWidget,
> > widget1.getElement());
> >
> > On 12/14/2009 06:14 PM, Dennis Madsen wrote:
> > > I new to GWT - that's why! :)
> > > Could you like me to a tutorial/sample about these custom widgets?
> > >
> > > On 14 Dec., 18:06, Arthur Kalmenson  wrote:
> > >> Oh, why not just create a custom widget to display entries by date?
> > >>
> > >> --
> > >> Arthur Kalmenson
> > >>
> > >> On Mon, Dec 14, 2009 at 12:04 PM, Dennis Madsen 
 wrote:
> > >>> I'm doing some kind of guestbook which automatic async receive new
> > >>> guestbook entries. As the newest entry has to be on the top, is why I
> > >>> would like to prepend instead of adding/append.
> > >>> Since I'm receiving a lot of entries, it is not a solution to
> > >>> manually create a div in the markup for each of them.
> > >>>
> > >>> Hope you understand!
> > >>>
> > >>> On 14 Dec., 17:55, Arthur Kalmenson  wrote:
> >  You could just add another div before the entries and add to that
> >  div.
> > 
> >  --
> >  Arthur Kalmenson
> > 
> >  On Mon, Dec 14, 2009 at 11:38 AM, Dennis Madsen 
 wrote:
> > > I'm adding a label into a div on my HTML:
> > > RootPanel.get("entries").add(myLabel);
> > >
> > > But what if I would like to prepend the label instead of adding it?
> > > How can I do so?
> > >
> > > --
> > >
> > > 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
> > > athttp://groups.google.com/group/google-web-toolkit?hl=en.
> > >>>
> > >>> --
> > >>>
> > >>> 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
> > >>> athttp://groups.google.com/group/google-web-toolkit?hl=en.
> > >
> > > --
> > >
> > > 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
> > > athttp://groups.google.com/group/google-web-toolkit?hl=en.
> 
> --
> 
> 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.
> 

--

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: java.util.List

2009-11-23 Thread Jason Morris
Eclipse fills in methods based on the JDK installed, not the GWT emulated JRE. 
GWT's implementation 
of the JRE sits in the package com.google.gwt.emul.java, not java.

ben fenster wrote:
> thanks i removed the override and it worked can you please tell me why
>  did act like that since the eclipse filled out the implementation
> acording to the interface and if the method is not suppored  how did
> it got into the imlementation in the first place
> 
> On 23 נובמבר, 16:52, Jason Morris  wrote:
>> Hi ben,
>>
>> If you are using a version of GWT < 2.0 this error appears because the 
>> standard GWT List interface
>> doesn't have the subList method. You can either remove the @Override 
>> annotation from that method, or
>> extend AbstractList instead of implementing List directly (generally 
>> considered a better option
>> anyways).
>>
>> You could also upgrade to GWT 2.0-rc, which has the subList method included 
>> in the interface definition.
>>
>> Hope that helps.
>> //Jason
>>
>> ben fenster wrote:
>>> import java.util.Collection;
>>> import java.util.Iterator;
>>> import java.util.List;
>>> import java.util.ListIterator;
>>> public class bla implements List {
>>>@Override
>>>public boolean add(String e) {
>>>// TODO Auto-generated method stub
>>>return false;
>>>}
>>>@Override
>>>public void add(int index, String element) {
>>>// TODO Auto-generated method stub
>>>}
>>>@Override
>>>public boolean addAll(Collection c) {
>>>// TODO Auto-generated method stub
>>>return false;
>>>}
>>>@Override
>>>public boolean addAll(int index, Collection c) {
>>>// TODO Auto-generated method stub
>>>return false;
>>>}
>>>@Override
>>>public void clear() {
>>>// TODO Auto-generated method stub
>>>}
>>>@Override
>>>public boolean contains(Object o) {
>>>// TODO Auto-generated method stub
>>>return false;
>>>}
>>>@Override
>>>public boolean containsAll(Collection c) {
>>>// TODO Auto-generated method stub
>>>return false;
>>>}
>>>@Override
>>>public String get(int index) {
>>>// TODO Auto-generated method stub
>>>return null;
>>>}
>>>@Override
>>>public int indexOf(Object o) {
>>>// TODO Auto-generated method stub
>>>return 0;
>>>}
>>>@Override
>>>public boolean isEmpty() {
>>>// TODO Auto-generated method stub
>>>return false;
>>>}
>>>@Override
>>>public Iterator iterator() {
>>>// TODO Auto-generated method stub
>>>return null;
>>>}
>>>@Override
>>>public int lastIndexOf(Object o) {
>>>// TODO Auto-generated method stub
>>>return 0;
>>>}
>>>@Override
>>>public ListIterator listIterator() {
>>>// TODO Auto-generated method stub
>>>return null;
>>>}
>>>@Override
>>>public ListIterator listIterator(int index) {
>>>// TODO Auto-generated method stub
>>>return null;
>>>}
>>>@Override
>>>public boolean remove(Object o) {
>>>// TODO Auto-generated method stub
>>>return false;
>>>}
>>>@Override
>>>public String remove(int index) {
>>>// TODO Auto-generated method stub
>>>return null;
>>>}
>>>@Override
>>>public boolean removeAll(Collection c) {
>>>// TODO Auto-generated method stub
>>>return false;
>>>}
>>>@Override
>>>public boolean retainAll(Collection c) {
>>>// TODO Auto-generated method stub
>>>return false;
>>>}
>>>@Override
>>>public String set(int index, String element) {
>>>// TODO Auto-generated method stub
>>>return null;
>>>}
>>>@Override
>>>publ

Re: java.util.List

2009-11-23 Thread Jason Morris
Hi ben,

If you are using a version of GWT < 2.0 this error appears because the standard 
GWT List interface 
doesn't have the subList method. You can either remove the @Override annotation 
from that method, or 
extend AbstractList instead of implementing List directly (generally considered 
a better option 
anyways).

You could also upgrade to GWT 2.0-rc, which has the subList method included in 
the interface definition.

Hope that helps.
//Jason

ben fenster wrote:
> import java.util.Collection;
> import java.util.Iterator;
> import java.util.List;
> import java.util.ListIterator;
> 
> public class bla implements List {
> 
>   @Override
>   public boolean add(String e) {
>   // TODO Auto-generated method stub
>   return false;
>   }
> 
>   @Override
>   public void add(int index, String element) {
>   // TODO Auto-generated method stub
> 
>   }
> 
>   @Override
>   public boolean addAll(Collection c) {
>   // TODO Auto-generated method stub
>   return false;
>   }
> 
>   @Override
>   public boolean addAll(int index, Collection c) {
>   // TODO Auto-generated method stub
>   return false;
>   }
> 
>   @Override
>   public void clear() {
>   // TODO Auto-generated method stub
> 
>   }
> 
>   @Override
>   public boolean contains(Object o) {
>   // TODO Auto-generated method stub
>   return false;
>   }
> 
>   @Override
>   public boolean containsAll(Collection c) {
>   // TODO Auto-generated method stub
>   return false;
>   }
> 
>   @Override
>   public String get(int index) {
>   // TODO Auto-generated method stub
>   return null;
>   }
> 
>   @Override
>   public int indexOf(Object o) {
>   // TODO Auto-generated method stub
>   return 0;
>   }
> 
>   @Override
>   public boolean isEmpty() {
>   // TODO Auto-generated method stub
>   return false;
>   }
> 
>   @Override
>   public Iterator iterator() {
>   // TODO Auto-generated method stub
>   return null;
>   }
> 
>   @Override
>   public int lastIndexOf(Object o) {
>   // TODO Auto-generated method stub
>   return 0;
>   }
> 
>   @Override
>   public ListIterator listIterator() {
>   // TODO Auto-generated method stub
>   return null;
>   }
> 
>   @Override
>   public ListIterator listIterator(int index) {
>   // TODO Auto-generated method stub
>   return null;
>   }
> 
>   @Override
>   public boolean remove(Object o) {
>   // TODO Auto-generated method stub
>   return false;
>   }
> 
>   @Override
>   public String remove(int index) {
>   // TODO Auto-generated method stub
>   return null;
>   }
> 
>   @Override
>   public boolean removeAll(Collection c) {
>   // TODO Auto-generated method stub
>   return false;
>   }
> 
>   @Override
>   public boolean retainAll(Collection c) {
>   // TODO Auto-generated method stub
>   return false;
>   }
> 
>   @Override
>   public String set(int index, String element) {
>   // TODO Auto-generated method stub
>   return null;
>   }
> 
>   @Override
>   public int size() {
>   // TODO Auto-generated method stub
>   return 0;
>   }
> 
>   @Override
>   public List subList(int fromIndex, int toIndex) {
> 
>   return null;
>   }
> 
>   @Override
>   public Object[] toArray() {
>   // TODO Auto-generated method stub
>   return null;
>   }
> 
>   @Override
>   public  T[] toArray(T[] a) {
>   // TODO Auto-generated method stub
>   return null;
>   }
> 
> }
> 
> 
>  i am did the exact same thing and got
> 
> [ERROR] Line 131: The method subList(int, int) of type bla must
> override or implement a supertype method
> 
> 
> 
> On 23 נובמבר, 16:07, Paul MERLIN  wrote:
>> Le lundi 23 novembre 2009 15:05:18, ben fenster a écrit :
>>
>>> im sorry but i was under some presure i have a close deadline and
>>> thats pretty much the only problem idid you create an anonymous class
>>> or a class that implements the list
>> public class Test implements List { ... }
> 
> --
> 
> 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=.
> 

Re: How can I disable context menu in RichTextArea?

2009-11-03 Thread Jason Morris

To re-iterate what has already been said: you can't truly disable this menu in 
Opera (in fact you 
won't even get the event by default).

However, if you are determined to try, this may help:

public class MyRichTextArea extends RichTextArea {

public MyRichTextArea() {
addDomHandler(new ContextMenuHandler() {
public void onContextMenu(ContextMenuEvent event) {
// open your popup menu here
event.preventDefault();
}
}, ContextMenuEvent.getType());
}

}

This should work as expected for most browsers.

Taimur Mirxa wrote:
> I have checked the GoogleDocs application, in Google docs, it is also 
> showing the customized menu instead of broswer's menu. hope if you guys 
> can come up with any idea how it is accomplishing it?
> 
> the snap is also attached with this email.
> 
> 2009/11/3 Dimitrijević Ivan mailto:dim...@gmail.com>>
> 
> 
> Do not use right-mouse click popup menu. This is not supported by all
> browsers. For instance, in Opera you should change configuration in
> order to allow scripts to handle context menu events. Instead you can
> detect mouse-over event, and depending of object which is hovered, you
> can display a panel that contain options (Just like MS Word does, or
> GMail when you select picture).
> 
> 
> On Nov 3, 6:46 am, Taimur Mirxa  > wrote:
>  > Mike,
>  >
>  > I really appreciate your help, but this is not working in
> firefox. on the
>  > other side this method is working fine in hosted mode and IE. any
> idea?
>  >
>  > On Mon, Nov 2, 2009 at 12:04 PM, Michael Sullivan
> mailto:msull...@yahoo.com>>wrote:
>  >
>  >
>  >
>  >
>  >
>  >
>  >
>  > > In your client code somewhere, create this native function:
>  > >protected native void blockBrowserContextMenu(Element
> elem) /*-{
>  > >elem.oncontextmenu = function(e) {
>  > >  return false;
>  > >};
>  > >  }-*/;
>  >
>  > > Then, when you create your RichTextArea, call 'getElement()' on
> your
>  > > RTA instance and pass it to the given native method.
>  > > That will block browser context menus for that instance of
>  > > RichTextArea and for no other part of your UI.  (Though you may
> want
>  > > to consider
>  > > re-implementing Cut/Copy/Paste on your custom menu, as they may be
>  > > expected by your users).
>  >
>  > > Mike
>  >
>  > > On Nov 2, 8:39 am, Taimur Mirxa  > wrote:
>  > > > Folks,
>  >
>  > > > I have created my own popup menu, which I want to display in
>  > > RichTextArea,
>  > > > and it is appearing with right mouse click. my problem is
> that default
>  > > > broswer's context menu does also appear along with my menu.
> is there any
>  > > > resolution for this?
>  >
>  > > > I have seen lots of examples and code but all of them were
> disabling
>  > > > broswer's default menu that shows View Source and other
> options, I do not
>  > > > want to disable it, rather my point is to disable the context
> menu which
>  > > > appears in text fields or rich text areas.
>  >
>  > > > --
>  > > > Warm Regards,
>  >
>  > > > Taimur Mirza
>  >
>  > > > [To predict the behavior of ordinary people in advance, you
> only have to
>  > > > assume that they will always try to escape a disagreeable
> situation with
>  > > the
>  > > > smallest possible expenditure of intelligence.  - Friedrich
> Nietzsche]
>  >
>  > --
>  > Warm Regards,
>  >
>  > Taimur Mirza
>  >
>  > [To predict the behavior of ordinary people in advance, you only
> have to
>  > assume that they will always try to escape a disagreeable
> situation with the
>  > smallest possible expenditure of intelligence.  - Friedrich
> Nietzsche]
> 
> 
> 
> 
> -- 
> Warm Regards,
> 
> Taimur Mirza
> 
> [To predict the behavior of ordinary people in advance, you only have to 
> assume that they will always try to escape a disagreeable situation with 
> the smallest possible expenditure of intelligence.  - Friedrich Nietzsche]
> 
> > 
> 
> 
> 
> 
> 
> 

--~--~-~--~~~---~--~~
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://group

Re: Need to get around Async calls

2009-11-01 Thread Jason Morris

Exactly, it's a sort of a queue.

Each time a task finishes, it invokes the normal onSuccess method, which in 
turn invokes the 
onSuccessImpl (where you would now put your logic). Once onSuccessImpl is 
complete, the next async 
call to the server is invoked.

Each call can be "daisy-chained" onto the previous one, it's basically just a 
linked-list of async 
invocations, and their return logic (in this case with a generic onFailure 
method thrown in for 
easier coding).

Hope it helps,
//Jason

Parmeet Kohli wrote:
> Wow Jason !! That seems like quite a solution .. Can you please help
> me make certain that i totally understand it. The onSuccessImpl is my
> core test step method right ? Something like simulating a queue is
> this ? A queue of 2 test steps to be precise. The one executing
> currently and the next one to be executed.
> 
> Thanks !!
> Parmeet
> > 
> 

--~--~-~--~~~---~--~~
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: Need to get around Async calls

2009-10-30 Thread Jason Morris

Hi Parmeet,


Why not wrap each type of test step in a Command, which also implements 
AsyncCallback. Then allow 
them to be chained together:


public abstract class AsyncCommand implements AsyncCallback, Command {

private final Command next;

protected AsyncCommand(final Command next) {
this.next = next;
}

protected abstract void onSuccessImpl(T value);

public final void onSuccess(final T value) {
try {
onSuccessImpl(value);
} finally {
DeferredCommand.addCommand(next);
}
}

public void onFailure(final Throwable error) {
// generic failure code in here
}

}


The execute() method of the AsyncCommand submits itself to the RPC service, and 
the AsyncCommand 
will run the next step of the process, if the current one was successful. This 
means you can build 
up your "chain" of test steps up fron, and then just execute() the first one.

Hope that helps a bit.
//Jason.


Parmeet Kohli wrote:
> Hi All,
> 
>  I'm developing a web based testing tool using GWT as the
> front end. This tool allows the user to add several test steps to a
> test case. The user has the option to run these test steps
> individually or the whole test case together. The latter option seems
> to be an issue though. The problem being that these tests must get
> executed in the sequence the user has suggested (The result of the one
> might affect another). But the asynchronous nature of GWT RPC is
> making life difficult. Any suggestions ??
> 
> PS: Its not as simple as placing whatever i want to do after the RPC
> call in the onSuccess method. The user might add any number of test
> steps with different parameters.
> 
> Thanks,
> Parmeet
> > 
> 

--~--~-~--~~~---~--~~
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: Using a define in java

2009-10-16 Thread Jason Morris

You have several options actually.

To do exactly what you are trying to, you would use something like:

public interface RuntimeParameters {
public static final String PAGE_URL = "http://blablabla";;
}

and then use RuntimeParameters.PAGE_URL.

However, this is probably not what you actually want to do. A much better idea 
generally is to use 
the page location or module location URL as the prefix for your page (and make 
sure that the page 
has the same name in each environment). You can do this in GWT with:

GWT.getHostPageBaseURL() - to get the directory URL for the HTML page, or
GWT.getModuleBaseURL() - to the the directory URL of the JavaScript files

So something like:
final String pageUrl = GWT.getHostPageBaseURL() + "users.php";
Is far preferred to changing variable names between builds.

Generally it's considered a good idea to keep all of your environments as 
similar as possible. If 
you run Apache with PHP in production, you should generally run it locally for 
development as well 
(this is why GWT supports the '-noserver' option).

I hope this helps a bit.
//Jason

tedpottel wrote:
> Hi
> 
> I may have already posted this, but cannot find it.
> 
> I’n using Ajax code, I have 3 different servers the php file is in,
> depending on what I’m debugging. I have the Jiffy server when
> debugging within eclipse, then I have my local Apache server, when I’m
> trying to debug the php code, and a different server name for
> production run.
> 
> C and PHP has a  define statement, whare I could have something like
> #define server /local/
> And include it in all my files.
> 
> Is there a way to do this in java, so I can easly switch the server
> name, without having to change it superbly in all my classes?
> 
> Ted Define
> 
> > 
> 

--~--~-~--~~~---~--~~
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 won't load - 32 bit Java on Win64.

2009-08-25 Thread Jason Morris

Hi Ben,

You are trying to use GWT client-side classes on the server-side. These classes 
are supposed to be 
compiled to JavaScript, not to be run in a Java VM.

You will need to either use JSON.org classes, some other JSON classes, or 
spit-out the JSON as a 
String directly. Your choice ;)

That said: it looks like you're using RPC, which will handle serialization of 
GWT Java objects to 
real Java objects by itself. Adding JSON into such a mix is an unnecessary 
overhead. Either work 
with pure HTTP and JSON, or make use of the GWT RPC mechanism. If you're not 
using RPC, ignore this 
part ;)

Hope that helps a bit.
// Jason

Ben wrote:
> I've run into the same problem as this post:
> http://groups.google.com/group/Google-Web-Toolkit/msg/b93efbbdf07d9d37
> 
> The issue is that all of the JSON classes in
> com.google.gwt.json.client appear to be unusable on the server-side
> implementation classes, because they depend on
> com.google.gwt.core.client.JavaScriptObject, which won't load due to
> an UnsatisfiedLinkError when loading the classdef for
> JavaScriptObject.  I'm using Java 1.6.0_14-b08 x32 on Windows XP-64.
> (I can't use 64-bit Java because then GWT won't run at all.)
> 
> To demonstrate this, I took the GWT 1.7 default web-application, and
> modified GreetingServiceImpl.java like this:
> 
>   public String greetServer(String input) {
> try {
>   new com.google.gwt.json.client.JSONArray();
> }
> catch (Throwable t) {
>   return "Poop: " + t.getClass().getName() +": " + t.getMessage();
> }
> 
> The result is this: "Poop: java.lang.UnsatisfiedLinkError:
> com.google.gwt.core.client.JavaScriptObject.createArray()Lcom/google/
> gwt/core/client/JavaScriptObject;"
> 
> Any thoughts? Or should I just give up on using GWT's built-in JSON
> libs and switch to JSON.org?
> 
> > 
> 

--~--~-~--~~~---~--~~
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: Why do we define AsyncCallbacks inline?

2009-08-24 Thread Jason Morris

Thats typically the way I deal with things, it allows you to isolate eat 
"action" that occurs 
against the server.

It also allows those actions to be developed against client side interfaces. 
One of the more common 
use cases I have is "Page" structures. Any list / table / scrollable view that 
needs to lazy load 
lots of data runs through the same "FetchPage" action (which encapsulates the 
fetch from an Async 
interface and the push into a PagedModel object when the response is returned).

Another could be a SaveAction that stores an object on the server and validates 
that it was stored 
in the response.

This is the main reason I favor working with top-level classes: it lets you 
code a step away from 
your actual work-structure (and so improve code re-usability).

Hope that helps.
//J

Bakul wrote:
> Jason,
> 
> Does it mean I need to create a Action class for all kind of a backend
> call?
> 
> I mean, suppose I have three function call to back end from Async
> Interface:
> 
>1. addItem(..., AsyncCallBack callBack);
>2. updateItem(..., AsyncCallBack callBack);
>3. deleteItem(..., AsyncCallBack callBack);
> 
> In this case, do I need to create three Aciton classes which extends
> RetryAction?
> 
> -Bakul
> 
> 
> On Aug 23, 9:08 am, Jason Morris  wrote:
>> I would personally say that creating top-level or inner classes for the 
>> response of an async
>> callback (or an event) is often the best way to do it.
>>
>> Encapsulation is one of the main reasons we use OO languages because it 
>> encourages re-use. If you
>> take a look at my blog post 
>> here:http://lemnik.wordpress.com/2008/07/17/a-useful-gwt-rpc-pattern-ive-b...
>> You'll see one of the ways in which you can leverage encapsulate logic to 
>> make your code more
>> friendly. Make the RetryAction a Command object and you'll really start to 
>> see what I mean.
>>
>> I mostly find that in the long run it works better to avoid inline 
>> callbacks, since it provides
>> better separation of concerns, and acts more like the Command pattern (and 
>> you can mix in a Command
>> Processor to produce more complex logic).
>>
>> Just my 2c worth.
>> Regards.
>> //Jason
>>
>>
>>
>> jack wrote:
>>> Good question - lol.
>>> I think maybe we're not quite using the same terminology - maybe we
>>> are.
>>> By inner class I mean something like ...
>>> public MyOuterClass
>>> {
>>> }
>>> On Aug 23, 1:34 am, Jan Ehrhardt  wrote:
>>>> It's common practice to use inner classes in Java for listeners or other
>>>> simple things like callbacks.
>>>> What you want to do in the case of a callback, is invoking a method after
>>>> the the asynchronous RPC has been finished. The easiest solution would be,
>>>> to put this method as an argument to the RPC method, but since Java has no
>>>> closures, using inner classes is a nice solution. In Java 1.4, where no
>>>> inner classes where available, people implemented the AsyncCallback
>>>> interface in the class, which was calling the RPC method, so they could do
>>>> something like:
>>>> service.getSomthing(this);
>>>> But with Java 5 inner classes have become the prefered way.
>>>> Sure, you can also create your own class for this, but that's the worse
>>>> practice, I think.
>>>> What would be the best solution for this, you think?
>>>> Regards
>>>> Jan Ehrhardt
>>>> On Sat, Aug 22, 2009 at 10:43 PM, jack  wrote:
>>>>> In every RPC example I've seen, AsyncCallback are all defined inline?
>>>>> Why is this so?  What are the advantages?
>>>>> Thanks in advance
> > 
> 

--~--~-~--~~~---~--~~
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: Why do we define AsyncCallbacks inline?

2009-08-23 Thread Jason Morris

I would personally say that creating top-level or inner classes for the 
response of an async 
callback (or an event) is often the best way to do it.

Encapsulation is one of the main reasons we use OO languages because it 
encourages re-use. If you 
take a look at my blog post here:
http://lemnik.wordpress.com/2008/07/17/a-useful-gwt-rpc-pattern-ive-been-using/
You'll see one of the ways in which you can leverage encapsulate logic to make 
your code more 
friendly. Make the RetryAction a Command object and you'll really start to see 
what I mean.

I mostly find that in the long run it works better to avoid inline callbacks, 
since it provides 
better separation of concerns, and acts more like the Command pattern (and you 
can mix in a Command 
Processor to produce more complex logic).

Just my 2c worth.
Regards.
//Jason

jack wrote:
> Good question - lol.
> 
> I think maybe we're not quite using the same terminology - maybe we
> are.
> 
> By inner class I mean something like ...
> 
> public MyOuterClass
> {
> 
> }
> 
> 
> On Aug 23, 1:34 am, Jan Ehrhardt  wrote:
>> It's common practice to use inner classes in Java for listeners or other
>> simple things like callbacks.
>> What you want to do in the case of a callback, is invoking a method after
>> the the asynchronous RPC has been finished. The easiest solution would be,
>> to put this method as an argument to the RPC method, but since Java has no
>> closures, using inner classes is a nice solution. In Java 1.4, where no
>> inner classes where available, people implemented the AsyncCallback
>> interface in the class, which was calling the RPC method, so they could do
>> something like:
>>
>> service.getSomthing(this);
>>
>> But with Java 5 inner classes have become the prefered way.
>> Sure, you can also create your own class for this, but that's the worse
>> practice, I think.
>>
>> What would be the best solution for this, you think?
>>
>> Regards
>> Jan Ehrhardt
>>
>> On Sat, Aug 22, 2009 at 10:43 PM, jack  wrote:
>>
>>> In every RPC example I've seen, AsyncCallback are all defined inline?
>>> Why is this so?  What are the advantages?
>>> Thanks in advance
> > 
> 

--~--~-~--~~~---~--~~
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: java.io.NotSerializableException for gwt portlets - wps 6.1

2009-08-05 Thread Jason Morris

This complaint is coming from WebSphere, not GWT.

By implementing IsSerializable you've said "this object may be serialized by 
GWT", but you haven't 
implemented normal "java.io.Serializable" to make it serializable by WebSphere.

When session replication is turned on, any object in the session is pushed to 
all other WebSphere 
servers via normal Java serialization as part of each HTTP request / response 
cycle.

In short, you need to implement java.io.Serializable on these objects.

Hope that helps.
//Jason

kss wrote:
> We are getting  java.io.NotSerializableException in one of our gwt jsr
> 286 api portlets in WebSphere Portal 6.1. This exception has started
> to surface in the logs since we enabled session replication on our
> WebSphere Portal server. The object which its complaining about has
> isSerializable interface implemented. When we dont have session
> replication enabled; the issue dosent occur.
> 
> Has anyone seen this exception in websphere environment for gwt
> portlets or have any ideas ?
> 
> > 
> 

--~--~-~--~~~---~--~~
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: RemoteService - how to get http status of the response

2009-07-30 Thread Jason Morris

If the status code returned is not 200 the onFailure method will be passed 
StatusCodeException. The 
getStatusCode() method can be used from there.

Hope that helps.

reHa wrote:
> Hi
> 
> I have implemented RemoteService and when I'm getting response in the
> callback - in methods onFailure and onSuccess - how can I get Http
> Status (like 200, 302 or 404) of the response.
> 
> 
> Thanks
> -
> Piotr
> 
> > 
> 

--~--~-~--~~~---~--~~
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: Is it possible to set an onLoad event listener on an IFrameElement?

2009-07-17 Thread Jason Morris

Hi Jake,

Unfortunately the DOM structure is bound more to the JavaScript way of doing 
things than Widgets. In 
JavaScript you can't have more than one event listener (of a given event type) 
per element, while 
Widgets may have any number.

So to work around this: GWT Widgets are the only listeners on their nested 
Element object (notice 
they implement the com.google.gwt.user.client.EventListener interface). SO when 
they receive an 
event from the browser, they decode it into a DOMEvent and dispatch it to all 
the Handlers 
registered for that Widget.

Unfortunately there is no simple way to deal with this on the DOM nodes 
themselves, and in 
particular there is no simple way to deal with IFrame loading events. If you 
take a look at how 
FormPanel receives loading events from it's hidden IFrame there are two 
different implementations 
(one for IE6, and the generic implementation).

For normal browsers(com.google.gwt.user.client.ui.impl.FormPanelImplIE6), the 
event is hooked using:
iframe.onload = function() {
IE6 (com.google.gwt.user.client.ui.impl.FormPanelImplIE6) looks like:
iframe.onreadystatechange = function() {
if (iframe.readyState == 'complete') {

Both implementations also ensure that they "unhook" the events, by assigning 
the listener function 
to null (see FormPanel.onAttach / onDetach). I would consider extending the 
Frame Widget rather than 
using the DOM api directly. Widgets provide loads of useful safety nets that 
you otherwise need to 
write yourself (including attaching multiple Handlers to the element).

Hope this Helps.
//J

Jake wrote:
> Hi all,
> 
> I just have a quick question: I know that GWT presents a fairly low-
> level DOM API that wraps native DOM objects. What I'd like to do is
> create a new iframe element, and then set a DOM onLoad listener on it
> so that I can then manipulate the iframe's internal document (its
> contentDocument). It's very easy for me to imagine how to implement
> this, except for the fact that I cannot find a way to set any kind of
> a listener on any of the DOM objects exposed by GWT. I found some blog
> posts that mentioned that GWT's method of event handling had changed
> in 1.6 [0][1], but I'm not sure if that applies only to classes that
> extend Widget, or to the wrapped DOM objects as well. Hopefully I'm
> just missing them.
> 
> I'd greatly appreciate any guidance anyone can offer. Thanks,
> 
> Jake
> 
> [0] 
> http://lemnik.wordpress.com/2009/03/04/gwts-new-event-model-handlers-in-gwt-16/
> [1] http://lemnik.wordpress.com/2009/03/12/using-event-handlers-in-gwt-16/
> > 
> 

--~--~-~--~~~---~--~~
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: Servlet threading?

2009-07-10 Thread Jason Morris

Your question here is a little more related to servlets than GWT RPC.

The GWT RPC mechanism sits on top of servlets (on top of the doPost method to 
be exact) and 
therefore works in much the same way (ie: no serialization guarantees). 
Whenever any client invokes 
an RPC method, that method will be invoked on the RPC Servlet. However, this 
may be limited by:

1) The number of connections a client is allowed open by the browser
2) The number of processor threads allocated on the server

It's generally considered "good" to assume the client can only have 2 
connections open, since this 
is the minimum number.

On the other side of the net: most servlet containers only create one Servlet 
instance per 
ServletContext and route all requests to that instance (or at least per related 
entry in the web.xml 
file). The number of threads that are available to process requests (and how 
these threads are 
managed) is dependent on the servlet container and it's configuration.

In short, you should make sure all of your RPC methods are reentrant and your 
Servlets are 
"logically" stateless (ie: they should not have any mutable fields).

Hope this helps.
//J

David Given wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
> 
> Hi,
> 
> Does anyone have any information on threading issues as applied to the
> RPC server code? I've been unable to find anything on the 'net.
> 
> In particular, I need to know about any synchronisation guarantees
> between RPC function handlers. What happens if the client makes two RPC
> requests at the same time? Am I guaranteed to get all requests from a
> single session serialised? What about requests from multiple sessions? I
> assume that since all this is being handled by a servlet, eventually,
> the servlet may allocate new threads as it sees fit --- but I can't find
> any information about what it *actually* does.
> 
> Any information gratefully appreciated...
> 
> - --
> ┌─── dg@cowlark.com ─ http://www.cowlark.com ─
> │
> │ "They laughed at Newton. They laughed at Einstein. Of course, they
> │ also laughed at Bozo the Clown." --- Carl Sagan
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.9 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
> 
> iEYEARECAAYFAkpXLZoACgkQf9E0noFvlzhlSQCgs3QlfUDKlZjsw+mzmaaHU/eS
> zAYAniWsoRBn4divs+T/B6HdT4NP6Y5w
> =PDpc
> -END PGP SIGNATURE-
> 
> > 
> 

--~--~-~--~~~---~--~~
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: Do I have to use foreach or for-index-loop ?

2009-07-06 Thread Jason Morris

The foreach loop in normal Java will also construct an Iterator object, and 
therefore is almost 
always more expensive than a for-index-loop (assuming the Collection is 
random-access).

I would really call this a premature optimization, but if you're really 
concerned with such things, 
the (technically) fastest way of doing this would be:

final int length = list.size();
for(int i = 0; i < length; i++) {
Foo foo = list.get(i);
}

That applies for normal Java, for GWT the final is not required (since it has 
no affect on the 
output, and the compiler will declare it final anyways).

Again, serious micro-optimization that will make very little difference in the 
long run.

Ed wrote:
> Hellu,
> 
> Should I use the foreach or for-index-loop construction?
> Is GWT smart enough to implement the best solution?
> Can I simple neglect the difference in performance ?
> 
> I mean: in the Google IO presentation  they mentioned that the foreach
> construction creates a new Iterator object and as such is a bit more
> expensive. As such they used the for-index-loop construction. ... I
> can imagine when performing many foreach loops, this can become an
> issue.
> 
> Ed
> > 
> 

--~--~-~--~~~---~--~~
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: getInteger problem when trying to run hosted mode.

2009-06-17 Thread Jason Morris

Possibly you are looking for Integer.decode instead of Integer.parseInt?

Joel Paulsson wrote:
> Thanks for the help, i think i follow. I'll have to look into why
> Integer.parseInt didn't return the value i thought it would return
> then.
> 
> On 16 Juni, 07:34, "Dean S. Jones"  wrote:
>> Integer.getInteger("name") gets an integer from System properties.
>>
>> it is ( roughly ) equal to:
>>
>> Integer.parseInt(System.getProperty("name"));
>>
>> So, in the GAE, what is the definition if System.getProperty() ??? You
>> have no method or means of setting them, you don't know the properties
>> of the Runtime Environment
>>
>> Thus, it is useless to ask... and the method is not provided.
>>
>> On Jun 15, 5:00 pm, Joel Paulsson  wrote:
>>
>>> Hi!
>>> I run gwt as a plug-in to Eclipse and i have no errors in Eclipse, but
>>> when i run the program to hosted mode i get this error in the
>>> AppEngine Server:
>>> [ERROR] Line 53: The method getInteger(String) is undefined for the
>>> type Integer
>>> If i comment that line it works great, but using getInteger is pretty
>>> vital for me in this application so i need it to work. Can anyone help
>>> me understand why i get this error when i don't have any compilation
>>> errors and maybe find a soloution?
>>> /Joel
>>
> > 
> 

--~--~-~--~~~---~--~~
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: Server initialization

2009-06-11 Thread Jason Morris

Personally I would say use a ServletContextListener if the structures you are 
creating will be 
shared by several of your Servlets. That way the init is finished before any of 
your Servlets are 
created.

Load-on-startup always feels like a bit of a hack to me ;)

Just my 2c

Steve wrote:
> where you define your servlet in web.xml add 1 on-startup>
> 
> 
> MyAppServiceImpl
> my.package.app.MyAppServiceImpl
> 1
> 
> 
> On Jun 10, 6:29 pm, Jamie  wrote:
>> You might try using the servlet configuration 'load-on-startup'
>> setting in your web.xml servlet definition.
>>
>> You could also define your own base class and derive your servlets
>> from that so you at least have the code in one place...
>>
>> Jamie.
>> ---
>> Search for analog and digital television broadcast antennas in your
>> area:http://www.antennamap.com/
> > 
> 

--~--~-~--~~~---~--~~
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: unused code in "compiled" javascript

2009-04-27 Thread Jason Morris

Actually HashMap and many of the Collections classes /are/ used in that simple 
bit on code.

The Widget classes and Event management make heavy use of the Collections 
classes. RootPanel alone 
uses a HashMap, and HashSet (which in turn use AbstractSet, etc.), RootPanel 
also uses the Window 
class with uses ArrayList and Collections.

So basically by using RootPanel.get().add() you've effectively made use of a 
large chunk of the 
Collections classes, parts of the Event system, etc.

The compiler is fairly good at removing unused code, but theres only so far it 
can go. The fact is: 
in a fairly complex GWT application you're likely to be using that code anyways.

I assume you're compressing your compiled code before shipping it out to the 
browser, and setting 
the cache headers correctly, since once the user has the code (the .cache.* 
files) they never need 
to download them again (the name will change if the content of the file is 
changed).

Hope that explains the behavior a bit ;)
// J

Vitali Lovich wrote:
> The GWT compiler is supposed to remove all unused code.  If you believe 
> that there's code in there that is unused, or can be removed, I would 
> recommend filing a bug.  Hopefully a GWT developer would be able to 
> provide more information about this particular question.
> 
> On Sun, Apr 26, 2009 at 5:03 PM, zbo  > wrote:
> 
> 
> Hello,
> 
>   I am working on reducing the compiled js size of a relatively
> complex GWT application.  I've been looking at the detailed output of
> the compile process, and find quite a few blocks of code that seem to
> be included no matter what.  To test things and get a better
> understanding of the GWT compile process, I build a trivial GWT app:
> 
>onModuleLoad() {
>RootPanel.get().add(new Label("placeholder");
>}
> 
>  Detailed output of this app was approximately 105k in size, and
> filled with code I would expect (management of GWTEvents, onLoad
> methods, String handling, etc) but also a lot of code that I wouldn't
> expect (Hashmap, HashSet, AbstractSet, Set, Collections, etc.)  My
> question - is this entirely necessary, and if not, how do I avoid
> having all of this code included a final compile of a real app?
> 
> -Z
> 
> 
> 
> 
> > 

--~--~-~--~~~---~--~~
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: Information on the GWT1.6 Compared with GWT1.5

2009-04-01 Thread Jason Morris

On the surface, a Handler is just a Listener, but with only 1 event method. 
Event Handlers also 
don't have a removeOnClickHandler method, instead the add method returns a 
registration object that 
can be used to de-register that handler.

Underneath, Handlers are a very different beast. All of the Handlers for a 
specific Widget are 
registered with the same HandlerManager, thus no more needs for a 
ClickListenerCollection and a 
MouseListenerCollection and a KeyboardListenerCollection, etc. The 
HandlerManager will also manage 
any Handlers and Events that you invent and want to add to the Widget.

On top of that, DOM events (click, mouse, keyboard, etc) are handled specially 
and only sinkEvents 
when the related handler is added.

The result of this "uniform event mechanism" is that the amount of code GWT 
generates is a lot less, 
and consumes less memory than the old Listener mechanism.

More detail available on my blog:

http://lemnik.wordpress.com/2009/03/04/gwts-new-event-model-handlers-in-gwt-16/
http://lemnik.wordpress.com/2009/03/12/using-event-handlers-in-gwt-16/

Hope that helps a bit.
//J

Ved wrote:
> Hi,
> 
> I have a query regarding the listners which are exposed by GWT1.6 API
> for the widgets Comparing the same with GWT 1.5
> 
> I have seen a drastic change in the listner API exposed by the GWT 1.6
> for Eg:
> addClickListner is not present in GWT1.6 it has addClickHandler
> 
> 
> Can i know why these listeners are deprecated and what advantage i get
> it from Using 1.6 rather than GWT 1.5
> 
> 
> Thanks & Regards,
> Ved Prakash Kamishetty
> 
> 
> > 
> 

--~--~-~--~~~---~--~~
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: Interesting issue for experts!

2009-03-17 Thread Jason Morris

Except that objects that are bound to some sort of server-side data store (DB, 
FS, whatever) will be 
used on both the client and the server. Some of these tools use annotations to 
describe parts of the 
mapping information (column name / size / type of a field).

So while the annotations have no effect on the client side code, they may be 
needed in order for the 
server side code to work correctly, since the same object is being serialized 
from client to server. 
I am well aware of Hibernates limitations regarding GWT's serialization 
mechanism (I haven't used 
Hibernate myself in years). I do however make use of EoD SQL and the GWT 
compiler hasn't complained 
once about my fields being annotated with @ResultColumn or @AutoGeneratedKeys, 
since it's not used 
anywhere on the client side, it is however kinda important to have at runtime 
for the server so the 
EoD knows what to put where ;)

Or am I barking up the wrong dog here?

Jason Gillam wrote:
> Even if it doesn't complain about the annotations... I don't think
> this really addresses the problem, does it?  If your annotations are
> in your client-side code, they aren't going to be used, are they?  It
> seems to me that putting them there just confuses matters.  This goes
> back to what some of the first responses indicated... people don't
> read the FAQ nor understand how they are supposed to program in GWT.
> 
> The way I think about it is quite simple - you break down every GWT
> project into two main pieces...  you have client-side code (GWT -->
> Javascript), and server-side code (Java, PHP, whatever you feel like
> doing).  The client-side code has many constraints because it is what
> will be compiled into Javascript and sent to the browser.  You
> obviously cannot access a Hibernate object directly from your browser,
> so you have to come up with some way to do it indirectly (as Vitali
> suggested).  And yes, I know... there's another piece which ties the
> two together ("Controller" code) - but that's a bit arbitrary.  The
> fact is, GWT makes Javascript... therefore, if it can't be done in
> Javascript, it should not be in your client-side GWT code.
> 
> On Mar 17, 6:13 am, Jason Morris  wrote:
>> As far as I know it won't complain (doesn't complain when I use annotations 
>> from EoD SQL).
>>
>> The best way to find out is write a test class with some annotations and try 
>> compile it ;)
>>
>> //J
>>
>> djd wrote:
>>> For hibernate entity beans, can I use hibernate's specific
>>> annotations? I never actually tried it, since we've mapped them
>>> using .hbm.xml config files. But will GWT ignore the annotations or,
>>> better said, how do I map entity beans using annotations without
>>> making GWT scream about the imports? :)
>>> On Mar 17, 5:41 am, Ian Petersen  wrote:
>>>> On Mon, Mar 16, 2009 at 7:29 PM, Joe Cole  
>>>> wrote:
>>>>> Even better: make the error message in gwt be super-specific. That way
>>>>> people won't need to go to the FAQ.
>>>>> Error: The class X was not in one of the gwt-compilation folders
>>>>> (a,b,c). Since gwt only compiles code below these folders into
>>>>> javascript your class was removed from compilation. Your options are
>>>>> to: 1) provide a replacement class (seehttp://faq) , 2) rewrite the
>>>>> functionality you need to a reachable class or 3) move the class into
>>>>> one of the folders reachable by your modules.
>>>> That sounds like a good idea, but it seems like lots of people are
>>>> already not reading the existing error messages.  Adding more text is
>>>> only going to create more problems, I think.
>>>> Ian
> > 
> 

--~--~-~--~~~---~--~~
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: Interesting issue for experts!

2009-03-17 Thread Jason Morris

As far as I know it won't complain (doesn't complain when I use annotations 
from EoD SQL).

The best way to find out is write a test class with some annotations and try 
compile it ;)

//J

djd wrote:
> For hibernate entity beans, can I use hibernate's specific
> annotations? I never actually tried it, since we've mapped them
> using .hbm.xml config files. But will GWT ignore the annotations or,
> better said, how do I map entity beans using annotations without
> making GWT scream about the imports? :)
> 
> On Mar 17, 5:41 am, Ian Petersen  wrote:
>> On Mon, Mar 16, 2009 at 7:29 PM, Joe Cole  
>> wrote:
>>> Even better: make the error message in gwt be super-specific. That way
>>> people won't need to go to the FAQ.
>>> Error: The class X was not in one of the gwt-compilation folders
>>> (a,b,c). Since gwt only compiles code below these folders into
>>> javascript your class was removed from compilation. Your options are
>>> to: 1) provide a replacement class (seehttp://faq) , 2) rewrite the
>>> functionality you need to a reachable class or 3) move the class into
>>> one of the folders reachable by your modules.
>> That sounds like a good idea, but it seems like lots of people are
>> already not reading the existing error messages.  Adding more text is
>> only going to create more problems, I think.
>>
>> Ian
> > 
> 

--~--~-~--~~~---~--~~
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: Different sessionIDs in one application

2009-03-16 Thread Jason Morris

I think the problem here is specific to the "long polling" case mixed with RPC.

If the first call that requests a Session is in the long polling method, while 
the second call (to 
the other method) occurs before the "long polling method" has completed: the 
browser won't have 
received the Session ID cookie from the first request (since it hasn't returned 
yet).

You could test this by using
HttpSession.isNew()
in each of the Servlet methods to see if both requests have created their own 
session.

Putting a "dummy" request for a session into a Servlet or JSP when the host 
page is served 
establishes the session with the client, since the page content will have a 
Cookie header containing 
the Session ID the browser needs to send to all the RPC methods.

It's not the client code setting the Cookie, but rather the Servlet Container 
setting the session ID 
with the client so that the client will request that Session in subsequent 
invocations.

Hope that explains my thinking a bit better.
//J

djd wrote:
> 
> So just making a dummy call is enough? i.e. 2 method calls one after
> the other (in client code) will result in different IDs? More, since
> this mechanism is sevlet specific, client code shouldn't set any
> cookies, by hand at least.
> 
> 
> On Mar 16, 9:10 am, Jason Morris  wrote:
>> Hi Markus,
>>
>> Is it possible the SessionId Cookie hasn't been sent to the client when the 
>> second method is
>> invoked? You may need to force the Server to create the HttpSession object 
>> and send the Cookie in
>> your host page (or before you reach it).
>>
>> Basically any call to HttpServletRequest.getSession() should create the 
>> session and assign an ID to
>> it, but until the response has been sent to the client, the browser won't 
>> have knowledge of that
>> Session.
>>
>> Let me know if thats not the problem.
>> //J
>>
>> Markus wrote:
>>> Hello
>>> I have following problem with my application.
>>> If I make generally rpc calls during RemoteServiceServlet all is fine,
>>> if I use: this.getThreadLocalRequest().getSession().getId() I allways
>>> get the same sessionID back
>>> and I can work with it.
>>> No I have following case. I added a long polling mechanism to get
>>> actual data from the server.
>>> Exactly I have a RemoteServiceServlet which is waiting for data.
>>> Now the problem:
>>> If I make another rpc call to another RemoteServiceServlet, during the
>>> long polling servlet is running,
>>> I get on that second Servlet, a new sessionID if I do
>>> this.getThreadLocalRequest().getSession().getId().
>>> How can it be, that I get 2 different sessionIDs with the same
>>> application?
> > 
> 

--~--~-~--~~~---~--~~
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: Different sessionIDs in one application

2009-03-16 Thread Jason Morris

Hi Markus,

Is it possible the SessionId Cookie hasn't been sent to the client when the 
second method is 
invoked? You may need to force the Server to create the HttpSession object and 
send the Cookie in 
your host page (or before you reach it).

Basically any call to HttpServletRequest.getSession() should create the session 
and assign an ID to 
it, but until the response has been sent to the client, the browser won't have 
knowledge of that 
Session.

Let me know if thats not the problem.
//J

Markus wrote:
> Hello
> 
> I have following problem with my application.
> If I make generally rpc calls during RemoteServiceServlet all is fine,
> if I use: this.getThreadLocalRequest().getSession().getId() I allways
> get the same sessionID back
> and I can work with it.
> 
> No I have following case. I added a long polling mechanism to get
> actual data from the server.
> Exactly I have a RemoteServiceServlet which is waiting for data.
> 
> Now the problem:
> If I make another rpc call to another RemoteServiceServlet, during the
> long polling servlet is running,
> I get on that second Servlet, a new sessionID if I do
> this.getThreadLocalRequest().getSession().getId().
> 
> How can it be, that I get 2 different sessionIDs with the same
> application?
> 
> 
> > 
> 

--~--~-~--~~~---~--~~
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: H-Panel mouse click

2009-03-15 Thread Jason Morris

Unfortunately there is no quick way to do this, you will need to search for the 
element by hand.

private int indexOf(final Element target) {
final TableElement table = TableElement.as(getElement());
final NodeList rows = table.getRows();
final NodeList cells = rows.getItem(0).getCells();
final int length = cells.getLength();

for(int i = 0; i < length; i++) {
if(cells.getItem(i).isOrHasChild(target)) {
return i;
}
}

return -1;
}

Hope that helps a bit.
//J

Riyaz Mansoor wrote:
> 
> I have attached a ClickHandler to a HorizontalPanel and it recieves
> events.
> 
> How can I find the index of the cell that generated the 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
-~--~~~~--~~--~--~---



Re: ImageBundle problem

2009-03-11 Thread Jason Morris

Is your GsImageBundle interface in the client-side source-path ("client" by 
default, unless you've 
changed it)?

// J

javacup wrote:
> Hi,
> 
> I'm new to using GWT. So I need your help.
> 
> I'm trying to add an image to a panel from one of the examples in the
> tutorial.
> 
> I'm getting "[ERROR] Line 31: No source code is available for type
> com.gs.images.GsImageBundle; did you forget to inherit a required
> module?"
> 
> gwt version: 1.5.3 for mac.
> 
> public interface GsImageBundle extends ImageBundle {
> 
>   public static final GsImageBundle INSTANCE = (GsImageBundle)
> GWT.create(GsImageBundle.class);
> 
>   AbstractImagePrototype logo98x40();
> 
> }
> 
> in onModuleLoad method
> ..
> 
> //get Image Bundle
> GsImageBundle gsImageBundle = GsImageBundle.INSTANCE
> .
> 
> panel.add(gsImageBundle.logo98x40().createImage());
> 
> 
> .
> 
> gives me an error when I run the app..
> 
> 
> 
> [ERROR] Line 31: No source code is available for type
> com.gs.images.GsImageBundle; did you forget to inherit a required
> module?
> 
> 
> Some help here will be appreciated ... thanks
> 
> > 
> 

--~--~-~--~~~---~--~~
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: Using GWT with JBoss 4.0

2009-03-10 Thread Jason Morris

anything stored under WEB-INF is invisible to the outside world, putting your 
script there will 
cause JBoss to respond with a 404.

Imagine me hitting your site with http://yoursite.com/WEB-INF/web.xml and then 
downloading your 
Servlet classes, not exactly what you want is it ;)

Just put the GWT compiler output in the same directory as your JSP page and 
change the URL reference 
in the  tag and everything should work just fine!

Cheers.
//J

Jawwad wrote:
> Hi everyone, Ive just started GWT. I made some small modules using GWT
> which seam to work fine with "shell" i.e. GWT's own browser in an html
> file. It works properly and also performs all the required
> functionality.
> BUT when I try to run the same code on a jsp page it doesnt work at
> all. Ive included the following line:
> 
>