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

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

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

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

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

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 =

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

Re: java.util.List

2009-11-23 Thread Jason Morris
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

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() {

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

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

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 ;)

Re: Why do we define AsyncCallbacks inline?

2009-08-24 Thread Jason Morris
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

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:

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

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

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

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

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

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:

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

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

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

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

Re: Different sessionIDs in one application

2009-03-16 Thread Jason Morris
, 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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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.

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

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

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

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) {

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

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

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

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.

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

Re: Mixing up XMLParser with DOM...

2008-11-24 Thread Jason Morris
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

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

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

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.

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

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

Re: Reading XML file from localhost

2008-11-11 Thread Jason Morris
, 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

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

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

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

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;

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

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:

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

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

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