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 swe.sta...@gmail.com 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 charlie.f...@gmail.com 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 ba6...@gmail.com 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 dvenu...@gmail.com 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.




 --
 charlie/

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

listener
listener-classcom.company.webapp.MyContextListener/listener-class
/listener

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

On Wed, Jun 9, 2010 at 12:02 AM, jjd jjdemp...@gmail.com 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 vyalov.e...@gmail.com 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 da...@lorgeousdays.com 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 vyalov.e...@gmail.com 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(div class='entry'myDiv/div);
   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 nicanor.bab...@gmail.com 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 Kalmensonarthur.k...@gmail.com  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 Madsenden...@demaweb.dk 
 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 Kalmensonarthur.k...@gmail.com  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 Madsenden...@demaweb.dk 
 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
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 ListString {
 
   @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? extends String c) {
   // TODO Auto-generated method stub
   return false;
   }
 
   @Override
   public boolean addAll(int index, Collection? extends String 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 IteratorString iterator() {
   // TODO Auto-generated method stub
   return null;
   }
 
   @Override
   public int lastIndexOf(Object o) {
   // TODO Auto-generated method stub
   return 0;
   }
 
   @Override
   public ListIteratorString listIterator() {
   // TODO Auto-generated method stub
   return null;
   }
 
   @Override
   public ListIteratorString 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 ListString subList(int fromIndex, int toIndex) {
 
   return null;
   }
 
   @Override
   public Object[] toArray() {
   // TODO Auto-generated method stub
   return null;
   }
 
   @Override
   public T 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 eskato...@gmail.com 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 ListString { ... }
 
 --
 
 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=.
 
 
 

--

You received this message because you are subscribed to the Google Groups 
Google 

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 lem...@gmail.com 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 ListString {
@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? extends String c) {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean addAll(int index, Collection? extends String 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 IteratorString iterator() {
// TODO Auto-generated method stub
return null;
}
@Override
public int lastIndexOf(Object o) {
// TODO Auto-generated method stub
return 0;
}
@Override
public ListIteratorString listIterator() {
// TODO Auto-generated method stub
return null;
}
@Override
public ListIteratorString 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 ListString subList(int fromIndex, int toIndex) {
return null;
}
@Override
public Object[] toArray() {
// TODO Auto-generated method stub
return null;
}
@Override
public T 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 eskato...@gmail.com 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 ListString { ... }
 --
 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

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 dim...@gmail.com 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 taim...@gmail.com
 mailto:taim...@gmail.com 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
 msull...@yahoo.com mailto:msull...@yahoo.comwrote:
  
  
  
  
  
  
  
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 taim...@gmail.com
 mailto:taim...@gmail.com 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://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 AsyncCommandT implements AsyncCallbackT, 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(..., AsyncCallBackT callBack);
2. updateItem(..., AsyncCallBackT callBack);
3. deleteItem(..., AsyncCallBackT callBack);
 
 In this case, do I need to create three Aciton classes which extends
 RetryAction?
 
 -Bakul
 
 
 On Aug 23, 9:08 am, Jason Morris lem...@gmail.com 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 jan.ehrha...@googlemail.com 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 jack.terran...@gmail.com 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 jan.ehrha...@googlemail.com 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 jack.terran...@gmail.com 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: 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 deansjo...@gmail.com 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 mean@gmail.com 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 load-on-startup1/load-
 on-startup
 
 servlet
 servlet-nameMyAppServiceImpl/servlet-name
 servlet-classmy.package.app.MyAppServiceImpl/servlet-class
 load-on-startup1/load-on-startup
 /servlet
 
 On Jun 10, 6:29 pm, Jamie jamiesharbor-sou...@yahoo.com 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 zachary.bo...@gmail.com 
 mailto:zachary.bo...@gmail.com 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

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 ispet...@gmail.com wrote:
 On Mon, Mar 16, 2009 at 7:29 PM, Joe Cole profilercorporat...@gmail.com 
 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

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

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 lem...@gmail.com 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: 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 NodeListTableRowElement rows = table.getRows();
final NodeListTableCellElement 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: gwt hosted mode in netbeans 6.5

2009-03-08 Thread Jason Morris

If you run the project in debug mode you'll get GWT hosted mode automatically.

Bare in mind 2 additional things that netbeans will do:
1) start the debugger as well (which I find very useful)
2) start your real external Tomcat instance as the server

Hope that helps.
//J

mibtar wrote:
 is there a way to use hosted mode in netbeans 6.5? like in eclipse.
  
 

--~--~-~--~~~---~--~~
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: How do you remove a handler?

2009-03-03 Thread Jason Morris

Hi Ian

All of the add*Handler methods return a HandlerRegistration object, you keep a 
reference to it, and 
then invoke HandlerRegistration.removeHandler() when you want to remove it.

I wasn't to sure of whether I liked it or not at first, but it does make 
automated removal of 
Handlers on auto-generated structures (populated from some external source) a 
lot easier, since you 
can just store all the HandlerRegistrations.

Cheers,
Jason.

Ian Bambury wrote:
 History lets you add one, but how do I get rid of it?
 
 Ta,
 
 Ian
 
 http://examples.roughian.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: GWT on NetBeans 6.5 / gwt4nb

2009-02-26 Thread Jason Morris

Heya,

Just a heads-up. I change the build.xml in the project root directory, NOT the 
build-impl or 
build-gwt files, that way GWT4NB never overwrites the changes.

I'm busy working to get this patch merged into the GWT4NB project.

If your normal build.xml is being overwritten, something is wrong. ;)
Cheers,
Jason.

Kevin Tarn wrote:
 You have to unjar GWT4NB to a directory. Modify build.xml in extracted 
 directory, and then jar the whole package back. Reinstall your revised 
 GWT4NB in NetBeans.
 
 Kevin
 
 On Fri, Feb 27, 2009 at 12:13 AM, Selfish Gene ravurib...@gmail.com 
 mailto:ravurib...@gmail.com wrote:
 
 
 Any changes to build.xml are overwritten by GWT4NB.
 
 Are there any entries I can add to gwt.properties that might help me
 solve this problem.
 
 
 
 On Feb 26, 9:37 am, Kevin Tarn kevn.t...@gmail.com
 mailto:kevn.t...@gmail.com wrote:
   Jason's blog did a good
 job:http://lemnik.wordpress.com/2008/07/27/fixing-compilation-in-gwt4nb/
  
   Kevin
  
   On Thu, Feb 26, 2009 at 11:32 PM, Selfish Gene
 ravurib...@gmail.com mailto:ravurib...@gmail.com wrote:
  
I am trying to migrate from eclipse to Netbeans as I felt 6.5 more
compelling and the migration is definitely not an easy task. I am
seeing lot of OutofMemory errors. I modified project.properties and
used jvmargs=-Xmx512m for GWT compiler, shell. But It still
 breaks
some place.
  
   
 
 ---
 
 ---
 --
Starting GlassFish V3
GlassFish V3 Start Failed
C:\My Documents\NetBeansProjects\Nodal\ShadowSettlements\nbproject
\build-gwt.xml:33: Deployment error:
GlassFish V3 Start Failed
See the server log for details.
BUILD FAILED (total time: 2 minutes 4
  
   
 
 ---
 
 ---
 --
  
The target in build.xml that breaks
  
   
 
 ---
 
 ---
 --
   target name=debug description=Debug project in IDE.
depends=init,compile,compile-jsps,-do-compile-single-jsp,dist
if=netbeans.home
   nbdeploy debugmode=true
 clientUrlPart=${client.urlPart}/
   antcall target=connect-debugger/
   antcall target=debug-connect-gwt-shell/
   /target
  
   
 
 ---
 
 ---
 --
  
Any suggestions would be greatly appreciated.
  
Thanks
-R
 
 
 
  

--~--~-~--~~~---~--~~
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: json date

2009-02-24 Thread Jason Morris

The JSON spec actually has no way of representing a date.

There are several possible methods (and hacks) that allow you to ship dates 
over JSON (though none 
of them are really perfect).

I would personally recommend sending dates as UTC numbers, since that way you 
don't have to hack the 
JSON encoding / decoding process to get it to work, the disadvantage being you 
loose readability of 
your data (as plain text).

Hope that helps a bit.
//J

sutarsa giri wrote:
 dear all,
 I'm trying to use php as beckend for my gwt application( actually I'm 
 not really confortable with gwt+json, but I don't have choice   ),
 There is a thing that make me confuse. there is 
 JSONString,JSONNumber,JSONObject,JSONBoolean, but why there is no built 
 in JSONDate?
 
 did anyone know why?, i'm also try to googling about json date. but it's 
 lead me to another confusion. any pointer woud be helped
 
 
 thx and regards,
 Gede sutarsa
 
  

--~--~-~--~~~---~--~~
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: 1-2 minute build time in netbeans with nb4gwt

2009-02-19 Thread Jason Morris

Not sure why it would take less time on the command line (memory possibly).

I blogged a nice little solution to gwt4nb's build problems here:
http://lemnik.wordpress.com/2008/07/27/fixing-compilation-in-gwt4nb/

It's a chunk of ant that you can drop in your normal build.xml to give the GWT 
compiler more memory, 
and so that it only runs when you change client side code.

I've actually got a few patches for gwt4nb, but because of some weirdness 
around the Editor Hints I 
can't deploy it at the moment :(

Hope the build script helps in the mean-time.
//J

mebassett wrote:
 Howdy folks
 
 I'm pretty new to GWT, and most everything is going fine for me...but
 trying to build the project in netbeans (using the nb4gwt plugin)
 takes forever.  Even the basic project that's built with the wizard
 takes well over a minute to build.
 
 This really kills productivity.
 
 I can build a GWT app in eclipse or through terminal in much less
 time...why is netbeans taking so long? has anyone else had this
 problem? am I doing something wrong? any tips?
 
 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: Async on the client side, what about the server side?

2009-02-16 Thread Jason Morris

On the server side there is generally a pool of threads held by the server. 
Thus a single session 
(in the JSESSIONID sense of Session) may involve any number of threads from the 
pool. Each request 
is processed on a single thread taken from the pool.

So to answer your question: chances are it won't start a new thread, but the 2 
can execute at the 
same time. Just bare in mind that the /browser/ generally limits you to 2 
concurrent connections per 
server.

Hope that explains things a bit ;)
// J

ralph wrote:
 
 I understand that the client side is asynchroneous, which means that I
 can call a new function from the client side to the server side
 without waiting for the previous function to be completed. Now how
 does this work on the server side? I thought that there was only a
 single thread per session on the server side. But let's say I call a
 function getEvent() and hang it on the server to produce the comet
 effect (long polling) and try to call another function meanwhile, what
 would happen on the server side? Would the next call hang till the
 first one finishes? would it open a new thread?
 
 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: Async on the client side, what about the server side?

2009-02-16 Thread Jason Morris

Synchronization on the server depends on the resources you want to protect 
access to. Synchronizing 
a method in RemoteServiceSerlvet is a /very/ bad idea, since it ensures that 
only one user can use 
that method at a time.

You also can't assume that if you take up one of the browsers connections that 
there will only be 
one left, rather you should assume you have only 2 connections to deal with, 
but don't rely on it 
for any code logic (since some browsers may allow more).

The code you posted doesn't ensure that one connection will always be taken by 
getEvents, although 
single-threaded, that code is subject to a standard race-condition with regards 
to the browser 
Connections. Other code attempting a server connection may e given the 
opportunity to grab the 
connection after one call to getEvents() returns and before onSuccess() is 
called.

To run a comet style process (or a timed comet process) you would rather start 
the next comet 
request in the onSuccess /and/ onFailure methods of the AsyncCallback. If you 
need to wait a 
specified delay before sending the next requests, use a Timer.

I would also recommend looking over:
http://code.google.com/docreader/#p=google-web-toolkit-doc-1-5s=google-web-toolkit-doc-1-5t=ReleaseNotes_1_5_Rpc
Returning the Request object so that an exiting comet request can be canceled 
if you need to send 
more data.

Not quite sure exactly what you're looking for, if I'm on the wrong track let 
me know.
Hope this is helping.
//J

ralph wrote:
 
 In that case does that mean that I should synchronize on the server
 side? And what about if I have one connection that it is continuously
 recycled, does that mean that having only one connection left I can
 confidently say that the logic is synchronous on the server side?
 
 And does this code below ensure that the connection will always be
 taken by getEvents.
 
 getEvents(new AsyncCallback() {
 
 onSuccess() {
getEvents(this);
 }
 
 }
 
 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: Library without source code

2009-02-11 Thread Jason Morris

If GWT translated to an intermediate form, it would be so close to source-code 
that it really 
wouldn't matter.

Besides that, GWT compiles from source-code to source-code (although it's 
JavaScript source code).

I've seldom worked with a commercial enterprise product that I can't get the 
source-code for, 
especially not an API product. I would say this is more a legal issue than one 
related to the way 
GWT (or any other compiler) does things.

You could always obfuscate the Java source code before JARing it up, it offers 
about as much 
security as GWT does with it's Obfuscated JavaScript output.

Just my 2c worth.
//J

Mike wrote:
 Dear all,
 
 Is it possible to create a GWT-library that can be included in other
 GWT projects *without* giving away the source code?
 
From what i understand, currently both the sources and the .class
 files should be included in a library. Including the sources can be a
 problem wrt intellectual property if the logic is nontrivial and of
 substantial size. Why doesn't GWT translate into some intermediate
 form, or just use javascript?
 
 Bye, Mike
 
  
 

--~--~-~--~~~---~--~~
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: Getting an Error No source code is available for type java.util.ResourceBundle; while compilation.

2009-02-09 Thread Jason Morris

java.util.ResourceBundle is not available to client side GWT code.

I would advise sticking to the Constants interface, since it has the advantage 
that the bundle data 
will be inlined into your JavaScript. There will be no properties files loaded 
at runtime, and no 
Hashtable like lookup when a String is needed.

Constants have the added advantage of being able to return various data-types, 
which are all checked 
for validity at compile time.

Even if ResourceBundle was available to GWT, it would be a waste of space and 
reduce the performance 
of your application.

That said, you can make use of ConstantsWithLookup which is a combination 
between Constants and 
ResourceBundle.

Hope that helps.
//J

Suresh wrote:
 Hi,
 
 I'm trying to develop a module with GWT and integrate it with
 exisiting project in JS. My Page contains lot of list boxes for which
 i have to load the values from properties file. If i use
 com.google.gwt.i18n.client.Constants i have to write lot of getter
 methods for each values with interface. Instead of this i'm planning
 to use ResourceBundle but if i use Resourcebundle i'm gettign the
 following error during compilation No source code is available for
 type java.util.ResourceBundle;. What needs to be done to resolve this
 error?
 
 Regards,
 Suresh
 
  
 

--~--~-~--~~~---~--~~
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: how to catch the double click event

2009-02-04 Thread Jason Morris

It doesn't matter that they have the same value, they are returned from 2 
different fields in Event:

if(event.getButton() == Event.BUTTON_RIGHT)

if(event.getTypeInt() == Event.ONDBLCLICK)

Hope that helps
//J

arun wrote:
 no...actually i m mentioning about event.BUTTON_RIGHT and
 event.ONDBLCLICK
 Both having same value i.e.2 and i m using both in my application.
 On Feb 4, 12:38 pm, Litty Preeth preeth.h...@gmail.com wrote:
 No the constants for both are different... Event.ONCLICK and Event.
 ONDBLCLICK



 On Wed, Feb 4, 2009 at 12:44 PM, arun theeperfection...@gmail.com wrote:

 i have a requirement to catch the double click event. i am catching
 right click too. but both event are getting mixed up. only right click
 is working fine. Thsi may be because both event have same constant
 field values. is ther eany way to distinguish these two?
 Any help would be appreciated.- Hide quoted text -
 - Show quoted text -
  
 

--~--~-~--~~~---~--~~
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: How do you retrieve the output or XML from the AJAX page?

2009-01-29 Thread Jason Morris

Hi there,

I think what you are looking for is the getText() method of the Response 
object (the one that gets 
passed into the onResponseReceived method).

To convert the String returned into an XML DOM object, you can use the classes 
in 
com.google.gwt.xml.client:

public void onResponseReceived(Request request, Response response) {
Document dom = XMLParser.parse(response.getText());
// work with the Documnet here
}

Hope this was what you were looking for?
//J

ProtoLD wrote:
 I have some code which works fine:
 
 RequestBuilder rb = new RequestBuilder(RequestBuilder.POST, http://
 localhost:8500/test.cfm);
rb.setHeader(Content-Type, 
 application/x-www-form-urlencoded);
 
try {
Request response = rb.sendRequest(stuff, new 
 RequestCallback()
{
 
public void onError(Request request, Throwable exception) {
}
public void onResponseReceived(Request request, Response 
 response)
 {
}
});
}
catch (RequestException e) {
Window.alert(Failed to send the request:  + e.getMessage());
}
 
submitProject.addClickListener(new ClickListener(){
 public void onClick(Widget w) {
 
 RequestBuilder.Method method=RequestBuilder.GET;
 final String url1=http://localhost:8500/test.cfm;;
 Window.alert(url1);
 RequestBuilder rb=new RequestBuilder(method, url1);
 
 try {
 rb.sendRequest(null, new RequestCallback() {
 
 public void onResponseReceived(Request request, Response
 response) {
 Window.alert(+response.getStatusCode());
 }
 
 public void onError(Request arg0, Throwable arg1) {
 Window.alert(error);
 }
 });
 
 } catch (RequestException e) {
 } } });
 
 However, I can't figure out any methods that return the actual XML
 response text!  When trying to turn the request into a string, I quite
 obviously get nothing of use.  I have a simple page setup that only
 has some text on it (the number 2) so how would I return that?
 
 After figuring that out I can pretty much finish this project I'm
 working on :p
  
 

--~--~-~--~~~---~--~~
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: Removing Radio Buttons

2009-01-29 Thread Jason Morris

Heya,

I think your problem is that you are not either:
1) clearing the grid before re-populating it
2) removing the last row after a remove has been performed

RadioButton rb = new MyRadioButton(group, radioButtonText);
rb.addClickListener(listener);
scrollBoxGrid.setWidget(i, 0, rb);

except that the last row is now 1 less than it used to be. So I would say just 
invoking:
scrollBoxGrid.clear();
before populating it should do the trick ;)

Hope that helps,
//J

fatjack1...@googlemail.com wrote:
 Hi,
 
 I have a button which allows the user to remove an item from the
 system by selecting a Radio Button and pressing 'Remove'. The system
 then deletes the item from the database and updates the list of radio
 buttons i.e. it removes the radio button that was selected for
 deletion. However, I have a bug in that the system does not remove the
 radio button completely, it just moves everything below the removed
 item 'up'. For example:
 
 Item1
 Item2
 Item3
 Item4
 
 If we delete Item2, item2 disappears, it moves item3 and item4 up so
 we have a list that looks like this:
 
 Item1
 Item3
 Item4
 Item4
 
 So item4 appears twice. I need to obviously remove the bottom radio
 button when an item is deleted but im a little stuck on how to this,
 with the way I structures the code. Please can someone offer a
 soluton?
 
 Here is my code:
 
 //Remove Item
   removeItemButton.addClickListener(new ClickListener() {
   public void onClick(Widget sender) {
   boolean msg = Window.confirm(Are you sure you wish to 
 remove 
 + changedRadioValue +  from the database?);
   if (msg = true){
   String removeData = DELETE FROM 
 catering.items_table WHERE
 itemName = ' + changedRadioValue + ';
   ServerService rpc = new ServerService();
   rpc.removeItem(removeData, callback2);
   }
   }
   });
 
 
AsyncCallback callback2 = new AsyncCallback()
 {
 public void onFailure(Throwable caught)
 {
   updateItemsRootPanel.add(new HTML(Failed: +
 caught.getMessage()));
 }
 
 public void onSuccess(Object result)
 {
 
   Window.alert(changedRadioValue +  was successfully removed
 from the database.);
   getStatusDataFromServer();
 }
 
 };
 
 
 ClickListener listener = new ClickListener()
 {
 public void onClick(Widget sender)
 {
 changedRadioValue = MyRadioButton.getCurrentText();;
 }
 };
 
 
 
 private void getStatusDataFromServer(){
   ServerService.getInstance().getStatusData(
   new ServerStatsUpdater());
   }
 
 //inner class setting up the radio buttons
 
   class ServerStatsUpdater extends AbstractAsyncHandler
   {
   public void handleFailure(Throwable caught){
   }
   public void handleSuccess(Object result){
   ServerSQLData data = (ServerSQLData) result;
 
 
 
   for (int i = 0; idata.itemNameArrayList.size();i++){
   radioButtonText = 
 data.itemNameArrayList.get(i).toString();
   RadioButton rb = new MyRadioButton(group, 
 radioButtonText);
   rb.addClickListener(listener);
 
   scrollBoxGrid.setWidget(i, 0, rb);
   }
   for (int i = 0; 
 idata.itemQuantityArrayList.size();i++){
   Label quantityInStock = new Label();
   quantityInStock.setText(+
 data.itemQuantityArrayList.get(i).toString());
 
   scrollBoxGrid.setWidget(i, 2, quantityInStock);
   }
 
   }
   }
 
 
 
 Any help much appreciated.
 
 Regards,
 Jack
 
  
 

--~--~-~--~~~---~--~~
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: random vertical scroll bar

2009-01-29 Thread Jason Morris

Have you tried:

Window.setMargin(0);
Window.enableScrolling(false);

Which will remove the default padding the browser puts around the document, and 
disables scrolling 
of the document as well (ScrollPanel's will still work though ;) )

Hope that helps
//J

JohnMudd wrote:
 The following code produces a vertical scroll bar (on the right side)
 even though the panel size doesn't exceed the window size.  I'm using
 ver 1.5.3 in shell mode.
 
 The scroll bar does not always appear.  If I press Refresh repeatedly
 then I will see the scroll bar come and go.  There's some randomness
 to this problem.
 
 The scroll bar appears even when I reduce the root window size from
 100% height to 95% height.  At 94% height I still see the root width
 toggle randomly but the scroll bar does not appear.  Down around 90%
 height there is no problem.
 
 The layout also has problems in compile mode with Firefox 3 also.  But
 after about 5 refreshes the problems go away and I get an accurate
 layout.
 
 Is this a known problem?
 
 John
 
 
 
 package com.mudd.client;
 
 import com.google.gwt.core.client.*;
 import com.google.gwt.user.client.ui.*;
 import com.google.gwt.user.client.*;
 
 public class panelSizeDemo implements EntryPoint {
 
   public void onModuleLoad() {
 try {
   main();
 }
 catch (Exception e) {
   Window.alert(General Error:\n + e);
 }
   }
 
   static RootPanel rootPanel = RootPanel.get();
   static HorizontalPanel basePanel = new HorizontalPanel();
 
   public void main() {
 rootPanel.setSize(100%, 100%);  // Even if h=100.0% or as low
 as 95%
 rootPanel.add(basePanel);
 basePanel.setBorderWidth(30);
 basePanel.setSize(100%, 100%);
 basePanel.add(new Label(root:  + rootPanel.getOffsetWidth()+
   , + rootPanel.getOffsetHeight()));
   }
 }
 
  
 

--~--~-~--~~~---~--~~
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: Threaded Servlet

2009-01-27 Thread Jason Morris

Actually most containers pool their processor threads in order to conserve and 
regulate resources.

The RemoteServiceServlet in GWT simply decodes the response and invokes the 
method which the request 
relates to. Theres no magic or rocket science going on here. I don't know what 
tests you've run, but 
they're obviously giving you some skew results.

That said, a single browser will generally only allow 2 concurrent connections 
to the server. If 
your tests ran in your browser, what you're likely seeing is this limitation.

Hope that helps a bit.
Take a look at the RemoteServiceServlet and RPC code to see how it works 
otherwise.

stephen.sm...@paretopartners.com wrote:
 I never said it cretaed multiple instances, simply a new thread per
 request.
 
 On Jan 23, 4:30 pm, Shawn Pearce s...@google.com wrote:
 On Fri, Jan 23, 2009 at 08:17, stephen.sm...@paretopartners.com 

 stephen.sm...@paretopartners.com wrote:

 Standard servlets create a new thread per request but from a few
 simple test i have run this appears not to be the case with GWT.
 *Wrong*.

 Standard servlets create *one* instance per application container.  Multiple
 threads can be calling the servlet at once.

 Why is this and is there any way to do this other than explicitly
 creating a new thread at each method my service exposes.
 Because GWT is following the standard servlet conventions... it is after all
 running a standard servlet container (Tomcat) in its hosted mode debugging
 tool.
  
 

--~--~-~--~~~---~--~~
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: Threaded Servlet

2009-01-27 Thread Jason Morris

I tried reproducing your test to see what you were getting. I found the 
behavior when I ran the code 
in Hosted Mode and executed serverMethod() /twice/ before executing 
anotherMethod() (it didn't 
matter how many Hosted Browsers I had open).

When running the same test in real browsers (I used Firefox and Konqueror) the 
behavior was 
substantially different.

Like I said, browsers generally only allow for 2 open connections per server. 
If you invoke a 
connection hogging method twice, you have no more connections to invoke a 
different method. That 
said, this is a strictly client side issue, GWT's RemoteServiceServlet is not 
limiting you to a 
single Thread.

Try the same test with a normal HttpServlet and a RequestBuilder, you'll see 
the same results as you 
do with RPC.

stephen.sm...@paretopartners.com wrote:
 @shawn
 Thats ok :)
 
 @jason
 Well these Tests are very basic. i create an app with a simple rpc
 call to the server that does something like this:
 
 public boolean serverMethod() {
   for (;;) {
 if (false) {
   break;
 }
   }
   return true;
 }
 
 public boolean anotherMethod() {
   return true;
 }
 
 As you would expect, callingserverMethod() creates an infinite loop
 tying up that thread.
 
 then i opened up a second, seperate browser and called anotherMethod
 ().
 
 result: Nothing. Not a sausage :)
 
 So id say my results are pretty solid. 1 single lonely thread :(
 
 On Jan 27, 3:17 pm, Shawn Pearce s...@google.com wrote:
 On Tue, Jan 27, 2009 at 01:42, stephen.sm...@paretopartners.com 

 stephen.sm...@paretopartners.com wrote:

 I never said it cretaed multiple instances, simply a new thread per
 request.
 *sigh*.  I must not have had enough coffee in the morning before replying to
 your post.  I read thread as instance in your original post.  Sorry.

 On Jan 23, 4:30 pm, Shawn Pearce s...@google.com wrote:
 On Fri, Jan 23, 2009 at 08:17, stephen.sm...@paretopartners.com 
 stephen.sm...@paretopartners.com wrote:
 Standard servlets create a new thread per request but from a few
 simple test i have run this appears not to be the case with GWT.
 Like what everyone else has already said; each concurrent request runs on
 its own thread, but that thread isn't necessarily new.

 Most containers recycle threads as thread spin-up/shutdown are relatively
 expensive operations.  Pooling threads and recycling them across requests
 reduces the per-request overheads imposed by the container, allowing
 applications to use a larger percentage of the CPU, and the per-request
 latency target the developer is shooting for.  E.g. in my latest GWT based
 application, I was trying to hit 200 ms latency.  The more of that time
 that is available to the application, the more useful work I can do within
 that window.
  
 

--~--~-~--~~~---~--~~
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: HashMap difference between Host mode and Web mode

2009-01-19 Thread Jason Morris

The get method defined in Map accepts an Object as the key, it doesn't enforce 
the generic 
constraint since you are not modifying the contents of the Map (and thus 
supposedly not doing 
anything dangerous).

Lothar Kimmeringer wrote:
 Francisco schrieb:
  HashMapString, Integer map = new HashMapString, Integer();
  OtherStringClass otherTestString = new 
 OtherStringClass(testString);
 [...]
  Integer fromOhter = map.get(otherTestString);
 
 How can this compile? OtherStringClass can't be derived from java.lang.String
 and isn't in your code.
 
 
 Regards, Lothar
 
  
 

--~--~-~--~~~---~--~~
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: problem in parsing XML

2009-01-15 Thread Jason Morris

It's not really a GWT related question, but heres what you're looking for:

final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
final DocumentBuilder builder = dbf.newDocumentBuilder();
final Document doc = builder.parse(new 
ByteArrayInputStream(xml.getBytes(UTF-8)));

The String parameter accepted from InputSource is a systemId (generally a URI 
of sorts pointing to 
the XML file).

Hope this helps.

javaz wrote:
 hi everyone ,
 i got an error while running the below code in the server side  .Could
 anyone please help me in sorting out the solution to this error?
 
 here is the code:
 
 
   public boolean saveEmployeeInfo(String xml)  {
   try{
 
 InputSource s = new InputSource(new 
 String(xml));//xml is the xml
 document
 DocumentBuilderFactory dbf = 
 DocumentBuilderFactory.newInstance
 ();
 DocumentBuilder db = dbf.newDocumentBuilder();
 Document doc = (Document)db.parse(s);
 doc.getDocumentElement().normalize();
 System.out.println(Root element  + 
 doc.getDocumentElement
 ().getNodeName());
 
 
   }catch(Exception e){
   e.printStackTrace();
   }
 
 
 
 
 here is the error:
 java.net.MalformedURLException:
 
  no protocol: EmployeeRegistrationBranchf/BranchNamefffgf/
 NameDepartmentgfg/DepartmentDesignatonfdg/
 DesignatonJoinedDatefdg/JoinedDateDateofBirthvgfsdg/
 DateofBirth/EmployeeRegistration
 
   at java.net.URL.init(Unknown Source)
   at java.net.URL.init(Unknown Source)
   at java.net.URL.init(Unknown Source)
   at
 com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity
 (Unknown Source)
   at
 com.sun.org.apache.xerces.internal.impl.XMLVersionDetector.determineDocVersion
 (Unknown Source)
   at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse
 (Unknown Source)
   at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse
 (Unknown Source)
   at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown
 Source)
   at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(Unknown
 Source)
   at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse
 (Unknown Source)
   at np.com.rts.hris.server.HRISServiceImpl.saveEmployeeInfo
 (HRISServiceImpl.java:24)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
   at java.lang.reflect.Method.invoke(Unknown Source)
   at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse
 (RPC.java:527)
   at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall
 (RemoteServiceServlet.java:164)
   at com.google.gwt.user.server.rpc.RemoteServiceServlet.doPost
 (RemoteServiceServlet.java:86)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
   at com.google.gwt.dev.shell.GWTShellServlet.service
 (GWTShellServlet.java:289)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
 (ApplicationFilterChain.java:237)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter
 (ApplicationFilterChain.java:157)
   at org.apache.catalina.core.StandardWrapperValve.invoke
 (StandardWrapperValve.java:214)
   at org.apache.catalina.core.StandardValveContext.invokeNext
 (StandardValveContext.java:104)
   at org.apache.catalina.core.StandardPipeline.invoke
 (StandardPipeline.java:520)
   at org.apache.catalina.core.StandardContextValve.invokeInternal
 (StandardContextValve.java:198)
   at org.apache.catalina.core.StandardContextValve.invoke
 (StandardContextValve.java:152)
   at org.apache.catalina.core.StandardValveContext.invokeNext
 (StandardValveContext.java:104)
   at org.apache.catalina.core.StandardPipeline.invoke
 (StandardPipeline.java:520)
   at org.apache.catalina.core.StandardHostValve.invoke
 (StandardHostValve.java:137)
   at org.apache.catalina.core.StandardValveContext.invokeNext
 (StandardValveContext.java:104)
   at org.apache.catalina.valves.ErrorReportValve.invoke
 (ErrorReportValve.java:118)
   at org.apache.catalina.core.StandardValveContext.invokeNext
 (StandardValveContext.java:102)
   at org.apache.catalina.core.StandardPipeline.invoke
 (StandardPipeline.java:520)
   at org.apache.catalina.core.StandardEngineValve.invoke
 (StandardEngineValve.java:109)
   at org.apache.catalina.core.StandardValveContext.invokeNext
 (StandardValveContext.java:104)
   at org.apache.catalina.core.StandardPipeline.invoke
 (StandardPipeline.java:520)
   at 

Re: Performance overhead of virtual methods

2009-01-03 Thread Jason Morris

nathan.r.matth...@googlemail.com wrote:
 Hi GWTers
 
 I'm writing some performance sensitive code for GWT. I'm wondering how
 GWT compiles virtual functions to JavaScript. What's the associated
 performance overhead? Obviously I'd like to use proper polymorphism
 but if there's a significant performance overhead it may be worth re-
 factoring various parts of the code-base.
 
 Regards,
 
 Nathan
 


Hi Nathan,

Someone else can correct me if I'm wrong, but after taking a look at the 
generated code, it seems 
that virtual methods shouldn't incur any additional performance overhead in 
GWT. Basically the 
bottom level method is given the top-level declared name in each object 
instance, thus the lookup 
expense is the same as that of a non-virtual method.

Like I said, if I'm wrong on this, someone should correct me. ;)

Cheers,
Jason.

--~--~-~--~~~---~--~~
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: Proxy class generation

2009-01-03 Thread Jason Morris



Madhu CM wrote:
 Hi all,
 I am new to GWT, and i like the way its been implemented.
 But i am struck up with something  I have developed sample
 application just
 to do RPC.
 when i do GWT.create() . where will be the proxy class generated ?
 is it done dynamically?dynamically create object for Async?? please
 explain about this .
 
 Thanks,
 

The Proxy class is generated at compile time through whats known as Deferred 
Binding. Take a 
look here for more information about GWT.create(...):

http://code.google.com/docreader/#p=google-web-toolkit-doc-1-5s=google-web-toolkit-doc-1-5t=DevGuideDeferredBinding

Basically the GWT.create(...) method is used to run a bit of special code 
during the compilation 
which can generate additional code. It's also using in GWT localization, 
ImageBundles and a few 
other places. It's not a runtime method (it doesn't exist at runtime).

Hope that helps.
Jason.

--~--~-~--~~~---~--~~
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: What am I misunderstanding about the event model?

2008-12-22 Thread Jason Morris

The GWT event model is a close relation of the standard Java event model.

The problem with the standard DOM EventListeners is that only one listener can 
be attached to an 
Element. The other problem is that a custom Widget may be required to listen 
for a sequence of 
low-level events in order to trigger a single high-level event (think 
MOUSEDOWN/UP/MOVE in relation 
to itemDraggedAndDropped()).

So you hide the low-level events within Widget classes, which when they receive 
the event can 
trigger the collection of ClickListeners / MouseListeners / 
MyFancyListenerNumber3.

If you are extending the classes over and over again, adding your 
double-click behavior to each 
one in it's onBrowserEvent method, you're doing it wrong. The correct way is to 
extend once, and 
allow for adding any additional listeners (double-click, keyboard, etc.) to the 
extended class 
(which should trigger them in it's onBrowserEvent method). This way the event 
handling logic remains 
separated from the Widget itself.

Also bare in mind Composite style classes (like a TabPanel) that want to turn a 
Click event on a tab 
into onBeforeTabSelected and onTabSelected for it's TabListeners.

Hope that helps a bit.

David H. Cook wrote:
 
 The more code I implement and the more event-related APIs
 I look at in GWT, the more confused I get.  After
 looking at complete examples about 'listeners' on website such as:
 http://examples.roughian.com/index.htm#Listeners~Summary
 or posts in this group, I conclude that the most general
 is an 'EventListener', because then I can get at ANY/ALL events
 that I might be interested in, as it's method gets 'Event e'
 as an input param.  But, what seems to me like
 a real NEGATIVE is that I must 'extend' (sub-class) an object
 to use EventListener, right?
 
 Now, if I only care about a 'click', then I do NOT need to extend,
 because there are 'clicklisteners', which listen for just ONE event
 type...'click'.  But, if I want, say, 'double-click', well, there
 are NOT any 'double-click' listeners, so it seems that I'll need
 to use the more general EventListener.
 
 That would be reasonable/acceptable if there was just
 ONE object that I wanted/needed to extend in a given app.
 But, let's say, I care about 'doubleclicks' from 3 different
 objects in the same app...anchors, tabs, and images.
 (Maybe not the best examples, but bear with me.)
 So, it seems that now I need to extend three objects, so I'll
 need 3 java classes (and thus, ...3 FILES...one class per file).
 [Some posts/examples mention 'widget builders'  as a separate
 class of developer.  But, I don't want to build new 'widgets'...
 I just want a write a simple app.
 
 Somehow, the APIs seem to be making things unnecessarily 'complex',
 when I compare this to how easy it was to implement events
 in javascript language (before I started using GWT).  And, its
 beginning to seem like the designers of the event-model/event-apis in
 GWT
 might have miss-designed the APIs?!  (I wasn't around at the
 beginning, so I don't know how the event-APIs looked in version 1.00.)
 
 Both the author of roughian website and other posters all seem to
 bemoan
 this need to extend, but all say it is necessary.  For example,
 roughian
 says:
 
 [Notes:
 This is something you should only use if you are subclassing a widget
 - it's not much use otherwise,
 you can't addEventListener() to anything I'm aware of.
 So, as a builder of widgets, you'd use this to pick up events and use
 them in ways
 that you can't do with the ordinarily supported event interfaces]
 
 Clearly, I (and others?) must all be missing something.  Where have I
 gone 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: How to forward in GWT?

2008-12-17 Thread Jason Morris

Window.Location.assign(String url)

Should do what you're looking for.

crnl...@gmail.com wrote:
 I have a problem when creating forward in different apps in GWT.
 I tryed to implement it by using method WIndow.Location.replace
 (String url), But by this way I can't back to History.
 Window.open() may not be use because of Refusing by most of browers.
 Is there another method to implement forwarding?
 Anybody help? 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: Clickable text

2008-12-15 Thread Jason Morris

You could use myLabel.addStyleName(Hyperlink) to style it like a hyperlink 
with CSS.

Smith wrote:
 Thanks, Kevin. How about  myLabel.addClickListener(ClickListener
 listener)  ?
 
 Also,is there a  disadvantage with making labels clickable? The user
 wouldn't know if that text is clickable unless you mention that
 explicitly. I mean if you bring the mouse over it, would it give any
 indication that it's clickable?
 
 Thanks,
 
 
 On Dec 15, 7:20 am, Kevin Tarn kevn.t...@gmail.com wrote:
 You can inherit Label and sink ONCLICK event by add below line in
 constructor of inherited class.

 void InheritLabelConstructor(String text) {
 super(text);
 sinkEvents(Event.ONCLICK);

 }

 void onBrowserEvent(Event event) {
 super.onBrowserEvent(event);
 if (event.getTypeInt() == Event.ONCLICK) {
  // do something
 }

 }

 Best
 Kevin

 On Mon, Dec 15, 2008 at 11:07 PM, Smith smitha.kang...@gmail.com wrote:

 All,
 Is there a way to add some clickable text into a panel? I am aware of
 Hyperlink, but I don't need history support. All I need is to show
 another panel when a text is clicked on.
  
 

--~--~-~--~~~---~--~~
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 Side Byte Code Obfuscation

2008-12-10 Thread Jason Morris

The obfuscator should either leave those method alone by default (since they're 
defined in an 
outside interface), or you should be able to configure it to leave them alone.

Either way, RemoteServiceServlet uses reflection and thus does need the method 
names intact. You may 
be able to alter the generated JavaScript code, or config to change the method 
names there as well, 
but I'm not sure how you would go about this. Easiest just to leave the method 
names alone.

Magno Machado wrote:
 Won't it break rpc?
 Unless your obfuscator keep the names of your services methods, I think 
 RemoteServiceServlet won't find them when you make a RPC call. But I'm 
 not sure about this..
 
 2008/12/10 Allahbaksh [EMAIL PROTECTED] 
 mailto:[EMAIL PROTECTED]
 
 
 HI Rob and Shawn,
 Thanks for your reply. I am thinking to use ProGuard.Do you have any
 other open source alternatives. Please let me know if you have used
 any other?
 Regards,
 Allahbaksh
 
 On Dec 9, 9:35 pm, Rob Coops [EMAIL PROTECTED]
 mailto:[EMAIL PROTECTED] wrote:
   On Tue, Dec 9, 2008 at 5:17 PM, Allahbaksh
 [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote:
  
Hi,
We are distributing an application. We want to obfuscate the server
side code to the client so that they should not reverse
 engineer the
code. Is it works fine?
  
What will happend to servlets? Whether they work fine?
  
Regards,
Allahbaksh
  
   Hi Allahbaksh,
  
   Obfuscating code is not going to stop any determined person from
 reverse
   engineering your code, it might make it slightly more difficult
 but that is
   about it. The code should still work otherwise the obfuscation
 failed and
   you simply broke your own code.
  
   In the end any and all code you write can be reversed engineered
 regardless
   of obfuscation or any other technique used to make it harder to
 do so. So in
   that respect you will have to look at the cost you make
 obfuscating your
   code as opposed to the risk you run with someone actually taking
 the trouble
   of reverse engineering your code. How much will you loose if
 someone reverse
   engineers your code in a week and how much will you loose if it
 takes them a
   month... you might very well find that the cost of hiding you
 code is not
   worth the money.
  
   Regards,
  
   Rob
 
 
 
  

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Re: FileUpload pbm

2008-12-04 Thread Jason Morris

A web browser won't allow you to do this, since it would basically allow anyone 
to pull copies of 
important files off your hard disk without your permission, this a FileUpload 
(like input 
type=file) is a readonly structure from a JavaScript point of view.

You can however use flash, or a signed Java Applet to access the file-system 
and upload the file.

Mogoye wrote:
 Hello,
 
 I need to upload a file to my server. Looking to GWT API the only way
 to do that seems to use
 FileUpload class associated with a FormPanel.
 
 My problem is that I already know the name of the file to upload and
 don't want to ask to my user
 to select it on the file system.
 My 1th idea was to call myFileUpload.setFileName();  but this
 method does not exist.
 
 Is there any other solution to upload a file ?
 
 Thx for reading.
  
 

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Re: Toggle text color in timer

2008-12-03 Thread Jason Morris

Label lblOfflineLabel = new Label();
Timer offlineLabelTimer;
lblOfflineLabel.addStyleName(OfflineLabel);
lblOfflineLabel.addStyleName(OfflineLabel-blink);

offlineLabelTimer = new Timer() {
private boolean on = true;
public void run() {
   if(on = !on) {
  lblOfflineLabel.removeStyleName(OfflineLabel-blink);
   } else {
  lblOfflineLabel.addStyleName(OfflineLabel-blink);
   }
}
};

ArunDhaJ wrote:
 Hi,
 I wanted to make a label to blink, like toggling two colors. I've
 implemented a timer to do the same.
 How can I know which color has been previously set ?? so that I can
 swap with the new color...
 
 //
 Label lblOfflineLabel = new Label();
 Timer offlineLabelTimer;
 lblOfflineLabel.addStyleName(OfflineLabel);
 lblOfflineLabel.addStyleName(OfflineLabel-blink);
 
 offlineLabelTimer = new Timer() {
public void run() {
   lblOfflineLabel.removeStyleName(OfflineLabel-blink);
}
 };
 
 // blink at the rate of 2 second
 offlineLabelTimer.scheduleRepeating(2000);
 //
 
 How to implement the run logic to toggle the two styles ???...
 
 .OfflineLabel{
   color: #FF;
 }
 
 .OfflineLabel-blink {
   color: #00FF00;
 }
 
 
 Thanks in advance !!!
 
 - ArunDhaJ
  
 

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Re: Why it's so slow?

2008-11-26 Thread Jason Morris

The GWT Compiler does a massive amount of optimization and it does so for each 
of the browsers. This 
process takes a lot of time.

GWT has it's own browser that runs your Java code with less compilation work 
(and lets you debug 
your Java code instead of the generated JavaScript). To access this 
functionality in Netbeans use 
Debug Project instead of Run Project.

You should also look here:
http://lemnik.wordpress.com/2008/07/27/fixing-compilation-in-gwt4nb/
For a patch to the default build.xml thats generated by gwt4nb (it stops the 
GWT Compiler running 
when it doesn't need to).

Hope that helps.

Andrey wrote:
 Hello,
 
 I begin learning GWT and meet with problem of slow building of GWT
 project :(.
 
 I created a new GWT web-project in NetBeans, download a sample
 addressBook application and adjust it for the project.
 
 Building procedure takes about a minute :(.
 
 Most of the time is spending after the message:
 
 ...
 Computing all possible rebind results for
 'com.acme.client.AddressBookService'
 ...
 .
 
 So, how is it possible to develop anything with such a speed?
 
 
 Regards,
 
 -Andrey
 
  
 

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Re: @Override causes error when defining anonymous class

2008-11-25 Thread Jason Morris

The GWT Compiler doesn't like to have @Override on an interface method, if the 
method definition 
comes from a class it's happy, but if the direct parent declaration is in an 
interface it won't compile.

[EMAIL PROTECTED] wrote:
 I get the error message in the development shell:
 
  The method onClick(Widget) of type new ClickListener(){} must
 override a superclass method
 
 When I do
 
 addClickListener(new ClickListener() {
 
   @Override
   public void onClick(Widget sender) { ...
 
 but all is fine if I have
 
 addClickListener(new ClickListener() {
 
   public void onClick(Widget sender) { ...
 
 
 Why is it wrong to include @Override? Eclipse quick fix puts it
 there for me.
 
 Best,
 
 -ken
  
 

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Re: Mixing up XMLParser with DOM...

2008-11-24 Thread Jason Morris

This is something you simply can't do cleanly across all the browsers. The 
elements returned by the 
XMLParser are totally different classes to the HTMLParser. The way to do this 
is to set the 
innerHTML on an HTML Element object to the value returned from the 
RequestBuilder. Then you can use 
the normal Element.getChildNodes() to fetch the DOM objects that were returned 
from the service.

Cristiano wrote:
 Hello Everyone,
 
 How to 'cast' or 'transform' a com.google.gwt.xml.client.Document to
 a com.google.gwt.dom.client.Document ???
 
 I'm dealing with the requirement of handling DOM elements retrieved by
 a server (as an HTTP xml/text response), parse them with XMLParser
 and them into an existing document:
 
 I handle the DOM of the current page with
 com.google.gwt.dom.client.Document and com.google.gwt.user.client.DOM.
 
 I handle the HTTP request with the RequestBuilder.
 
 I parse them with com.google.gwt.xml.client.XMLParser.
 
 However the com.google.gwt.xml.client.XMLParser do return a
 com.google.gwt.dom.client.Document, and I cannot add it to a
 com.google.gwt.dom.client.Document because appendChild does not
 accept as input a com.google.gwt.xml.client.Element: it wants a
 com.google.gwt.doc.client.Element.
 
 Can you help me in find the right direction resolve this (I'm using
 eclipse)?
 
 Thanks,
 Cristiano
 
  
 

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Re: best way to test an image file exists?

2008-11-24 Thread Jason Morris

It's not really that Safari doesn't support it, it just doesn't allow for 
XmlHttpRequest objects to 
have a Method of anything other that GET / POST. The issue may have actually 
been resolved (I'm open 
to correction here), but some people are still using versions of Safari with 
this problem.

Lothar Kimmeringer wrote:
 darkflame schrieb:
 oh...it seems GWT dosnt support the Head method only Post / Get :-/
 (apperently Saffire dosnt support it)
 
 It's a FAQ here. You can use the protected contructor using an
 anonymous inner class:
 
 RequestBuilder builder = new RequestBuilder(HEAD, url) {
  /* nothing to override */
 };
 
 I'm wondering if HEAD is not supported by Safari, because this
 method is implemented by HTTP-servers since the time where one
 kilobyte weighted one kilogram.
 
 
 Regards, Lothar
 
  
 

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Re: Compiling in 1.5.3

2008-11-24 Thread Jason Morris

You need to switch to using the Java 5 way of declaring Collections (ie: using 
generics):

public ListToolOptions toolList = null;

slledru wrote:
 I am trying to move my app from 1.4 to 1.5.3.
 I am using ant to build and am getting following warnings and would
 like to get rid of them.
 What am I doing wrong?
 I am using JDK1.6.
 
  [java] Scanning source for uses of the deprecated gwt.typeArgs
 javadoc annotation; please use Java parameterized types instead
  [java]Type com.sirsidynix.client.request.report.ReportRunInfo
  [java]   Field toolList
  [java]  [WARN] Unable to recognize
 'java.util.Listjava.util.List' as a type name (is it fully qualified?)
  [java] com.google.gwt.core.ext.typeinfo.NotFoundException: Unable
 to recognize 'java.util.Listjava.util.List' as a type name (is it
 fully qualified?)
  [java]   at com.google.gwt.core.ext.typeinfo.TypeOracle.parseImpl
 (TypeOracle.java:892)
 
 
 And in ReportRunInfo, I have:
 /**
  * @gwt.typeArgs
 java.util.Listcom.sirsidynix.client.reports.tools.ToolOptions
  */
 public List toolList = null;
 
  
 

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Re: Mixing up XMLParser with DOM...

2008-11-24 Thread Jason Morris

GWT's methods of implementing the DOM objects and the XML objects are totally 
different. The DOM 
implementation extends JavaScriptObject, whereas the XML objects encapsulate 
their JavaScriptObject 
structures. I would advise using the method I suggested, since it'll take a lot 
less of your time 
(and be technically a lot safer) than trying to do hackery with GWT's XML 
package.

String responseFromServer = ...;

Element domElement = Document.get().createDivElement();
domElement.setInnerHtml(responseFromServer);

NodeListNode children = domElement.getChildNodes();

If you need to work with sub-elements of the HTML / XML returned from the 
server, I would suggest 
using RPC, or embedding the HTML inside CDATA sections of the returned XML 
document.

If you really feel the need to work with the HTML / XML by hand, you may need 
to make a copy of the 
GWT xml / xml.impl packages and expose the underlying JavaScriptObjects that 
make up the DOM 
structure (and even then: I'm not sure it'll work).

Cristiano wrote:
 Thank you,
 
 And do you know if can find a solution which may works even if only
 inside a specific browser?
 On Firefox the underlaying DOM objects tyep are the same if you use an
 XHTML page and correclty handle the namespaces in the XML of the HTTP
 response.
 I'm able to get what I want with javascript on FF, and by the way my
 gwt solution only need to work on this browser: I need gwt for other
 purpose than broswser portability.
 
 My question may change the into: do you know how to convert elements
 in XML package to elements in DOM package in Firefox by using GWT?
 
 Thnak you again,
 Cristiano
 
 
 
 
 Jason Morris wrote:
 This is something you simply can't do cleanly across all the browsers. The 
 elements returned by the
 XMLParser are totally different classes to the HTMLParser. The way to do 
 this is to set the
 innerHTML on an HTML Element object to the value returned from the 
 RequestBuilder. Then you can use
 the normal Element.getChildNodes() to fetch the DOM objects that were 
 returned from the service.

 Cristiano wrote:
 Hello Everyone,

 How to 'cast' or 'transform' a com.google.gwt.xml.client.Document to
 a com.google.gwt.dom.client.Document ???

 I'm dealing with the requirement of handling DOM elements retrieved by
 a server (as an HTTP xml/text response), parse them with XMLParser
 and them into an existing document:

 I handle the DOM of the current page with
 com.google.gwt.dom.client.Document and com.google.gwt.user.client.DOM.

 I handle the HTTP request with the RequestBuilder.

 I parse them with com.google.gwt.xml.client.XMLParser.

 However the com.google.gwt.xml.client.XMLParser do return a
 com.google.gwt.dom.client.Document, and I cannot add it to a
 com.google.gwt.dom.client.Document because appendChild does not
 accept as input a com.google.gwt.xml.client.Element: it wants a
 com.google.gwt.doc.client.Element.

 Can you help me in find the right direction resolve this (I'm using
 eclipse)?

 Thanks,
 Cristiano

  
 

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Re: variable argument type in RPC service

2008-11-21 Thread Jason Morris

I would say: pass the data as an array, and wrap the RPC service on the client 
side:

public void doSomething(Object param1, AsyncCallback callback, String... 
strings) {
asyncClient.doSomething(param1, strings, callback);
}

If you really need varargs. Bare in mind the expense of varargs in JavaScript 
is fairly high (since 
it's turned into an Array underneath by the GWT compiler)... A better option is 
to just go with the 
old 1.4 syntax:

doSomething(param1, new String[] { String 1, String 2 });

although it's the same expense as varargs, it plays nicely with RPC.

Litty Preeth wrote:
 Hi all,
 
 Anybody have any idea how to use variable length argument (like
 String...) in an RPC service. Coz the corresponding async service
 should have AsyncCallback as its last argument. But when we use
 variable type argument that should be the last argument of the method.
 
 Thanks,
 Litty Preeth
  
 

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Re: Socket connection

2008-11-21 Thread Jason Morris

The only types of connection available to JavaScript in HTTP/S, and then not 
with Streams of data 
(data is sent and received as Strings). Therefore GWT can't emulate a true 
Socket of any sort.

If you describe your problem in more detail, perhaps someone can suggest a 
solution.

Pete Kay wrote:
 Hi
  
 Does anyone know of any GWT lib that can do socket connection?
  
 Thanks alot in advance for your help.
  
 Pete
 
  

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Re: java.lang.ref.* in GoogleWebToolkit ?

2008-11-18 Thread Jason Morris

You can't use java.lang.ref on the client side, because JavaScript has no 
notion of weak, soft, or 
phantom references. You can however use the java.lang.ref package on the server.

If you need to release objects on the client side, it is best to do so by hand 
when they are no 
longer in use. If you need to also tell the server to release them, use an RPC 
call of some sort, 
and have the server release the data when the session expires (if you are not 
actually storing the 
data in the session).

Garo.Garabedyan wrote:
 http://garabedyan.wordpress.com/2008/11/18/javalangref-in-googlewebtoolkit/
 
 Is java.lang.ref.* functioning in GWT? I come to an idea that
 java.lang.ref.* is necessary to enable proper garbage collection while
 implementing the Observer pattern in Model View Controller.
 
  
 

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Re: Hide Popup panel

2008-11-16 Thread Jason Morris

You should rather encapsulate your context menu logic in a PopupMenu or 
ContextMenu class. Something like this may help:

public class ContextMenu extends PopupPanel {
private final ClickListener closeListener = new ClickListener() {
public void onClick(final Widget sender) {
hide();
}
};

private final MouseListener rolloverListener
= new MouseListenerAdapter() {

public void onMouseEnter(final Widget sender) {
for(final Widget widget : items) {
if(widget == sender) {
widget.addStyleDependantName(Hover);
} else {
widget.removeStyleDependantName(Hover);
}
}
}
};

private final VerticalPanel items = new VerticalPanel();

public ContextMenu() {
super(true, false);
setWidget(items);
addStyleName(ContextMenu);
}

public SourcesClickEvents addItem(final String displayText) {
final Label label = new Label(displayText);
label.setStylePrimaryName(ContextMenu-Item);
label.addClickListener(closeListener);
label.addMouseListener(rolloverListener);
items.add(label);

return label;
}

public void show(final Widget parent, final int x, final int y) {
setPopupPositionAndShow(new PositionCallback() {
public void setPosition(
final int width, final int height) {

int px = parent.getAbsoluteLeft() + x;
int py = parent.getAbsoluteTop() + y;

if(px + width  Window.getClientWidth()) {
px = Window.getClientWidth() - width;
}

if(py + height  Window.getClientHeight()) {
py = Window.getClientHeight() - height;
}

ContextMenu.this.setPosition(px, py);
}
});
}
}

The above class adds Labels with a ClickListener to close the PopupPanel and a 
MouseListener to handle rollover (Hover) styles. You can use

addItem(Delete This).addClickListener(new ClickListener() {
public void onClick(Widget sender) {
currentItem.delete();
}
});

to add your actual handling ClickListener to the Labels.

Hope that helps a bit.

ArunDhaJ wrote:
 I've tried...
 RootPanel.get().remove(sender.getParent().getParent().getParent());
 and removed it. But once I remove this way, it gets permanantly
 removed and menu doesnt appear once again.
 
 I've even tried
 sender.getParent().getParent().getParent().setVisible(false);
 the same problem as above persists.. once hidden its not coming up
 again...
 
 Regards
 ArunDhaJ
 
  
 

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Re: Resizable Popup Panel or DialogBox

2008-11-14 Thread Jason Morris

I would say take a look at the GWT Mosaic project:

http://code.google.com/p/gwt-mosaic/

http://69.20.122.77/gwt-mosaic-current/Showcase.html#CwWindowPanel

benw wrote:
 Is anybody willing to share some example code for a resizable
 DialogBox or any kind of resizable panel?
 
 Thanks,
 -Ben
  
 

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Re: Reading XML file from localhost

2008-11-11 Thread Jason Morris
, however I really want to develop this
 app of mine full GWT-style. Hope you could help me again, thanks.

 On Nov 10, 5:58 pm, Jason Morris [EMAIL PROTECTED] wrote:

 Heya,
 Your basic problem here is that you can't have your XmlParserUtil return a
 Document object. The doc field will only be filled in when the async
 RequestBuilder request returns and the parser is finished with the XML 
 string.
 By that time, your method has already returned.
 The only way to solve this is to create something like a:
 public interface CallbackV {
 void callback(V value);
 }
 and have the XmlParserUtil look something more like this:
 public class XmlParserUtil {
 String url;
 Document doc;
 public RequestBuilder requestBuilder;
 String xmlStr;
 public XmlParserUtil(String xmlFileName) {
 this.url = xmlFileName;
 }
 public void getDocument(CallbackDocument callback) {
 if(doc != null) {
 callback.callback(doc);
 return;
 }
 try {
 requestBuilder = new 
 RequestBuilder(RequestBuilder.GET,url);
 requestBuilder.sendRequest(null,new 
 RequestCallback()
 {public void onResponseReceived(Request arg0, 
 Response arg1) {
 xmlStr = arg1.getText();
 callback.callback(doc = 
 XMLParser.parse(xmlStr));
 }
 public void onError(Request request, Throwable 
 exception) {
 }});
 }
 catch (RequestException ex) {
 GWT.log(ex.getMessage(), ex);
 }
 }
 }
 For more information about async problems, it's related to RPC, but 
 applicable
 to the RequestBuilder as well:
 http://lemnik.wordpress.com/2008/07/04/gwt-rpc-is-called-aynchronous-...
 mives29 wrote:
 okay, let me be clear on this, again, my code. (now posting full
 reworked source code)
 // A composite w/c contains a tree.
 public class TreeX extends Composite {
Document doc;
Tree t = new Tree();
int imgUris;
XmlParserUtil xmlParser;
public TreePol() {
TreeItem tItem = getTreeItem();
t.addItem(tItem);
initWidget(t);
}
private TreeItem getTreeItem() {
doc = getDoc();
imgUris = doc.getElementsByTagName(Image).getLength();
TreeItem root = null;
root = new TreeItem(Image Names);
for (int i=0;iimgUris;i++) {
String tmpImgUri =
 doc.getElementsByTagName(Image).item(i).getChildNodes().item(1).toString();
root.addItem(tmpImgUri);
}
return root;
}
public Document getDoc() {
xmlParser = new XmlParserUtil(image_uris.xml);
  while (doc==null) {
  doc = xmlParser.getDocument();
  }
return doc;
}
 }
 //A class that i want to use as a utility class for parsing xml
 documents. intended to be reusable
 public class XmlParserUtil {
String url;
Document doc;
public RequestBuilder requestBuilder;
String xmlStr;
public XmlParserUtil(String xmlFileName) {
this.url = xmlFileName;
}
public Document getDocument() {
try {
requestBuilder = new 
 RequestBuilder(RequestBuilder.GET,url);
requestBuilder.sendRequest(null,new RequestCallback()
{public void onResponseReceived(Request arg0, Response 
 arg1) {
xmlStr = arg1.getText();
doc = XMLParser.parse(xmlStr);
}
public void onError(Request request, Throwable 
 exception) {
}});
}
catch (RequestException ex) {
GWT.log(ex.getMessage(), ex);
}
return doc;
}
 }
 //my entrypoint's onModuleLoad(), which adds the various custom
 widgets i made to a tab panel
 public void onModuleLoad() {
  RichTextAreaX1 rtaPol = new RichTextAreaX1();
  PictureViewer imgBrowser = new PictureViewer();
  TreeX tree = new TreeX();
  TabPanel tp = new TabPanel();
  tp.add(tree, 1);
  tp.add(rtaPol, 2);
  tp.add(imgBrowser, 3);
  tp.selectTab(0);
  tp.setWidth(100%);
  RootPanel.get(leftpanel).add(tp);
   }
 as you can see, I intend the XmlParserUtil class to be reusable. If I
 place there various logic, then it would be out of scope for that
 classs, because I intend to use XmlParserUtil just to parse an XML
 file, and bring me back a parsed Document object. now how would I do
 that if XmlParserUtil, which contains the requestbuilder and callback,
 would be used by another class (which is a composite).
 im new to this async thing, more so

Re: Reading XML file from localhost

2008-11-10 Thread Jason Morris

Heya,

Your basic problem here is that you can't have your XmlParserUtil return a 
Document object. The doc field will only be filled in when the async 
RequestBuilder request returns and the parser is finished with the XML string. 
By that time, your method has already returned.

The only way to solve this is to create something like a:

public interface CallbackV {
void callback(V value);
}

and have the XmlParserUtil look something more like this:

public class XmlParserUtil {
String url;
Document doc;
public RequestBuilder requestBuilder;
String xmlStr;

public XmlParserUtil(String xmlFileName) {
this.url = xmlFileName;
}

public void getDocument(CallbackDocument callback) {
if(doc != null) {
callback.callback(doc);
return;
}

try {
requestBuilder = new 
RequestBuilder(RequestBuilder.GET,url);
requestBuilder.sendRequest(null,new RequestCallback()
{public void onResponseReceived(Request arg0, Response 
arg1) {
xmlStr = arg1.getText();
callback.callback(doc = 
XMLParser.parse(xmlStr));
}
public void onError(Request request, Throwable 
exception) {

}});
}
catch (RequestException ex) {
GWT.log(ex.getMessage(), ex);
}
}
}

For more information about async problems, it's related to RPC, but applicable 
to the RequestBuilder as well:

http://lemnik.wordpress.com/2008/07/04/gwt-rpc-is-called-aynchronous-for-a-reason/


mives29 wrote:
 okay, let me be clear on this, again, my code. (now posting full
 reworked source code)
 
 // A composite w/c contains a tree.
 public class TreeX extends Composite {
   Document doc;
   Tree t = new Tree();
   int imgUris;
   XmlParserUtil xmlParser;
   public TreePol() {
   TreeItem tItem = getTreeItem();
   t.addItem(tItem);
   initWidget(t);
   }
   private TreeItem getTreeItem() {
   doc = getDoc();
   imgUris = doc.getElementsByTagName(Image).getLength();
   TreeItem root = null;
   root = new TreeItem(Image Names);
   for (int i=0;iimgUris;i++) {
   String tmpImgUri =
 doc.getElementsByTagName(Image).item(i).getChildNodes().item(1).toString();
   root.addItem(tmpImgUri);
   }
   return root;
   }
   public Document getDoc() {
   xmlParser = new XmlParserUtil(image_uris.xml);
 while (doc==null) {
 doc = xmlParser.getDocument();
 }
   return doc;
   }
 }
 
 //A class that i want to use as a utility class for parsing xml
 documents. intended to be reusable
 public class XmlParserUtil {
   String url;
   Document doc;
   public RequestBuilder requestBuilder;
   String xmlStr;
 
   public XmlParserUtil(String xmlFileName) {
   this.url = xmlFileName;
   }
 
   public Document getDocument() {
   try {
   requestBuilder = new 
 RequestBuilder(RequestBuilder.GET,url);
   requestBuilder.sendRequest(null,new RequestCallback()
   {public void onResponseReceived(Request arg0, Response 
 arg1) {
   xmlStr = arg1.getText();
   doc = XMLParser.parse(xmlStr);
   }
   public void onError(Request request, Throwable 
 exception) {
 
   }});
   }
   catch (RequestException ex) {
   GWT.log(ex.getMessage(), ex);
   }
   return doc;
   }
 }
 
 //my entrypoint's onModuleLoad(), which adds the various custom
 widgets i made to a tab panel
 
 public void onModuleLoad() {
 RichTextAreaX1 rtaPol = new RichTextAreaX1();
 PictureViewer imgBrowser = new PictureViewer();
 TreeX tree = new TreeX();
 
 TabPanel tp = new TabPanel();
 tp.add(tree, 1);
 tp.add(rtaPol, 2);
 tp.add(imgBrowser, 3);
 
 tp.selectTab(0);
 tp.setWidth(100%);
 
 RootPanel.get(leftpanel).add(tp);
   }
 
 as you can see, I intend the XmlParserUtil class to be reusable. If I
 place there various logic, then it would be out of scope for that
 classs, because I intend to use XmlParserUtil just to parse an XML
 file, and bring me back a parsed Document object. now how would I do
 that if XmlParserUtil, which contains the requestbuilder and callback,
 would be used by another class (which is a composite).
 
 im new to this 

Re: How to deserialize request ?

2008-10-22 Thread Jason Morris

boraldomaster wrote:
 I have a service (class that extends RemoteServiceServlet).
 I have overriden method onBeforeRequestDeserialized there.
 
 This method recieves serializedRequest as a string.
 How can I deserialize it ?
 
  
 

I'm assuming you actually need to deserialize the string by hand. If this is 
the 
case, take a look at the com.google.gwt.user.server.rpc.RPC class.

Generally you shouldn't need to deserialize by hand, the RemoteServiceServlet 
will do it for you. So I'll assume you're logging the data for debugging, or 
some such ;)

Hope this helps!

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Re: Your opinion sought: Jetty or Tomcat?

2008-10-14 Thread Jason Morris

I personally use Tomcat a lot more, mainly because it started as the reference 
implementation (though I know it no longer technically holds that position). 
The 
few times I've wanted to use Jetty I've had to switch back to Tomcat due to 
lack 
of system admin knowledge (ie: the various admins I was working with didn't 
know 
it).

That all said, I almost never use Hosted Mode, and system admins don't have to 
deal with a development time engine. Tomcat does have much better IDE support 
than Jetty, but since Hosted Mode is in charge of that, again it makes no real 
difference. When I do run Hosted Mode it's with the -noserver option.

So my end opinion: I think the change is a good idea, since the additional 
speed 
and lower memory load will encourage people trying out GWT for the first time.

Tim wrote:
 jetty is awesome.
 
 In their latest drop (6.1.12.rc2 and rc3) there is a new feature in
 maven-jetty-plugin to reload jetty on keyboard events in console
 rather than automatically - it's indispensable when java GWT code
 lives in the same source tree as the server side java code (just in
 different package). And generally, maven jetty plugin is way better
 than Cargo stuff that's used for Tomcat.
 
 Also, Jetty Continuations are just some much easier to work with than
 Tomcat's Comet. No wonder they are including it into Servlet spec 3.0.
 
 Nothing particularly wrong with Tomcat but I think it's just lagging
 in terms of developer productivity features behind Jetty.
 
 
 On Oct 13, 9:42 pm, Michael Vogt [EMAIL PROTECTED] wrote:
 Hi Bruce.

 As part of this effort, we've all but decided to switch the hosted mode
 embedded HTTP server from Tomcat to Jetty. Would this break you? (And if so,
 how mad would you be if we did it anyway?) We figure most people who really
 care about the web.xml and so on are already using -noserver to have full
 control over their server config.
 I personally would welcome Jetty. I'm using it as part of Grails right
 now. It's fast and easy going.

 Cheers,
 Michael
  
 


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Re: passing parameters to gwt application

2008-10-14 Thread Jason Morris

If you're on GWT 1.5, you can just use

Window.Location.getParameter(key);

rudolf michael wrote:
 you just have to parse the http URL in your address bar.
 in your onModuleLoad method just call the following method
 public static native String getHref() /*-{
 return $wnd.location.href;
 }-*/;
 public void onModuleLoad(){
String url = getHref();
// you just have to parse the url now using a regex and any 
 string utility you are familiar with
 }
 
 On Tue, Oct 14, 2008 at 12:44 PM, Tanzeem [EMAIL PROTECTED] 
 mailto:[EMAIL PROTECTED] wrote:
 
 
 hi
 
 i have a non-gwt applicaton's html page from which i have to pass
 parameters trhough a href definition like  a href=http://localhost:
 7070/MyGWTApp?key=value
 to a gwt application.How do i make changes in the GWT application to
 enable parameter recieving?
 Any help please.
 
 
 
  


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Re: setting an image to have a transparent background? (.getElement().setAttribute(style, .....)

2008-10-13 Thread Jason Morris

As a rule of thumb, never setAttribute, when there is a property for that 
element that does the same job. For example, use setClassName() instead of 
setAttribute(class, ...), and getStyle().setProperty() instead of 
setAttribute(style).

IE has problems handing setAttribute with any special values. So even when it 
comes to setting the URL for an image, rather use the setSrc() method in 
ImageElement.

I wish someone had told me this earlier when I started coding JavaScript :P

darkflame wrote:
 That method worked, I wasnt aware of that method of doing it.
 Cheers! :)
 
 My own method, incidently, always worked in Firefox, and firebug
 simply showed opacity: 0.65; for the style, without the
 alpha(opacity=65); for IE present at all.
 
 
 On Oct 13, 2:10 am, Paul Robinson [EMAIL PROTECTED] wrote:
 What happens if you try:

 Style style = temp.getElement().getStyle();
 style.setProperty(filter, alpha(opacity=65));
 style.setProperty(opacity, 0.65);

 firebug will tell you what style is in force for each element

 HTH
 Paul



 darkflame wrote:
 I'm trying to make a standard image have a code-dependant uniform
 transparency background, and for it to work across all browsers.
 Doing this in css is easy, and works, but GWT seems to not be having
 it.
 I'm using simply;
 temp.getElement().setAttribute(style, filter: alpha(opacity=65);
 opacity: 0.65);
 Where temp is just an image.
 This doesn't seem to have any effect, but I'm not sure why.
 The same style code in CSS works, does it have to be different when
 applied this way? And what referance do I look at to see the changes
 made?
  
 


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Re: How to Dynamically resize RichTextArea

2008-10-13 Thread Jason Morris

samsus wrote:
 Hello,
 
 Is there a way i can dynamically resize the RichTextArea Height?, that
 is, it starts with 50px height, and if the content inside the
 RichTextArea passes that limit, the height is increased.
 
 Any ideas?
  
 

I'm not sure about automatically resizing the field (ie: it's probably 
possible, 
but will almost certainly involve a few hacks that will make you very dependant 
of the version of GWT you run).

That said, why not add a grippy of some sort at the bottom that lets the user 
drag to resize the field (like WordPress has on their editor)? So you can 
resize 
it's height much like you resize a window? That way the user is in control of 
how big the area is.

Just and idea ;)

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Re: Download file from server to client - w Servlet etc PLEASE?

2008-09-12 Thread Jason Morris

I assume what you want is for the client to have a new file on their 
hard-drive. 
First you'll need a servlet that produces the data. I'm not sure what 
data-format you want to work with, so I'm gonna assume a plain text file here 
(note, this is all typed directly into my mail client, sorry for any mistakes).

public class MyFileServlet extends HttpServlet {
protected void doGet(HttpServletRequest req, HttpServletResponse resp) 
throws 
ServletException, IOException {

resp.setContentType(text/plain);
resp.setHeader(Content-Disposition, attachment; 
filename=output.txt);

PrintWriter out = resp.getWriter();
out.println(This is the output content);
out.println(Probably something dynamic should go in here);
}
}


Then you'll want to write the client side to fetch the file.


public class MyEntryPoint implements EntryPoint {
public void onModuleLoad() {
String link = GWT.getModuleBaseURL() + servlet/myfiledownload;
RootPanel.get().add(new HTML(a href=\ + link + \Download 
File/a));
}
}


You can also use Window.open(link, downloadWindow, );
to download the file from an EventListener.

Finally you'll need to configure the servlet in either your Module.gwt.xml file 
(for hosted mode), or in your web.xml file for web mode.

Module.gwt.xml example, add:

servlet path=/servlet/myfiledownload 
class=your.package.name.here.MyFileServlet /


web.xml add:

servlet
servlet-nameMyFileServlet/servlet-name
servlet-classyour.package.name.here.MyFileServlet/servlet-class
/servlet

servlet-mapping
servlet-nameMyFileServlet/servlet-name

url-pattern/your.package.name.here/servlet/myfiledownload/url-pattern
/servlet-mapping


Like I show in the web.xml example, you'll need to make sure that the servlet 
is 
bound to the module base directory (where the nocache.html files all live), and 
not next to the host HTML page. Another important factor is: the Servlet must 
not be in your client package, since the GWT compiler shouldn't get hold of 
it.

Hope this helps.
Jason.

JohnnyGWT wrote:
 I've seen several discussions on how to download a file to the client.
 All contain bits of code but no complete examples.
 
 FileUpload is fine  easy using Apache commons stuff.
 
 Can someone PLEASE provide some examples etc for downloading a file to
 the client?
 In my scenario I have to send a newly created file to the client.
 Either this is by a download servlet 'get' method or a URL.
 
 Any full examples would be greatly appreciated.
 
 Thanx 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Re: How to make DialogBox modal both in terms of code execution and events?

2008-09-01 Thread Jason Morris

This is the way it's done.

You can think of JavaScript as running on the event-dispatch-thread.

Therefore, opening a DialogBox and making the thread wait until a button is 
clicked results in the following on the queue:

++ +-+
| wait for click | -  | click event |
++ +-+

the wait for click will wait for ever since it never lets the thread move onto 
the click event task and process the actual event.

This is a simplification, but in essence the way it works. I wrote about this 
problem in terms of GWT RPC... but the principal is the same:

http://lemnik.wordpress.com/2008/07/04/gwt-rpc-is-called-aynchronous-for-a-reason/

Hope that explains things a bit.

lama wrote:
 I have the same question.
 I've had to workaround this by adding callbacks to transfer the data
 from the dialog back to the caller.
 
 Regards,
 lama
 
 On Aug 29, 9:16 am, gwt-user [EMAIL PROTECTED] wrote:
 1.  To illustrate the first point. In the following code:

 boolean ok = Window.confirm(Are you sure .);

 if (ok) {

 

 }

 code inside the if block will be executed only after user presses
 button on the confirm dialog. Is it possible to do the same with
 instance of DialogBox?

 2.  The following code

 DialogBox dialog =  new DialogBox(true, true);
 dialog.show();

 does not ignore keyboard and mouse events for widgets not contained by
 the dialog

 Thank you,

Boris
  
 


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Re: Problem with applaying z-index in firefox

2008-08-25 Thread Jason Morris

As far as I know all versions of Firefox have this problem.

Any HTML will always sit behind a flash object. I've never seen anyone fix it, 
and it really frustrates me when I hit a site that puts their navigation menu 
on top of a flash object, because it makes the site totally unusable.

Bottom line: move the flash object; don't have a drop-down menu; or forget 
supporting Firefox.

Sorry for the ranty tone, this is just something that really frustrates me.

ahmed saber wrote:
 Hi,
 i just building i vertical menu with sub menu relative to it, also i
 have a flash banner
 problem that when i traying view submenu it goes behind flash banner
 
 i traying some tips like
 give the main div {menu div} z-index: 1;
 and the flash div z-index: -1 or zero;
 
 also added this code to the object code
 
 param name=wmode value=transparent
 
 this works in IE only and i face problem with firefox version 3.0
 
 
  
 


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---