Some newbie questions regarding resources and ClientBundle.

2012-08-30 Thread MAQ
Say I've got an app which includes a lot (more than 100) images to be used. 
For instance these images could be part of a game of some sort. Within a 
page the user will only need to fetch about 5 to 10 images.

What's a good way to implement that?
Should I build a single ClientBundle class which has all of the 100 
resources? (I reckon that would be a bad design)

Basically I want to do something like this:
Resources imageResources = GWT.create(Resources.class);
Image img = new Image(imageResources.image(635));

Which would return a reference to the image of id 635.


I thought of this design, I create an interface eg. HasAppResource which 
has some methods eg. getXImage(). Then the relevant entities would 
implement this interface and make the method return the ImageResource. I'm 
not even sure how to do this though.

Thanks

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/3n1xsudtZ-IJ.
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: some newbie questions

2010-10-11 Thread Thomas Broyer


On 9 oct, 04:15, Ray Tayek rta...@ca.rr.com wrote:
 hi, starting a project using eclipse galileo and a week old download
 of gwt eclipse plugin..

 i sometime get a: A widget that has an existing parent widget may
 not be added to the detach list error when doing the following type of thing:

 //div id=barstatic bar/div
 Label bar = new Label(bar label);
 bar.getElement().setId(barid);
 RootPanel.get(bar).add(bar);
 RootPanel rp = RootPanel.get(barid);

You cannot have root widgets whose elements are nested (i.e. there's
no parent/child relationship between the widgets, but there's one
between their elements in the DOM). There are several reasons
(including FUD) and there has never been a compelling argument for
allowing it.
The only exception is RootPanel.get() (without an ID argument).

 this usually fails. doesn't seem to matter whether bar is a panel, an
 html, or a label (does seem to work with buttons though). seems like
 i am not using gwt properly and breaking some rule 
 like:http://markmail.org/message/l3okzeqycanf5alg

 can someone point me to some doc on this?

See issue 3552 (RootPanel.get() is very similar to SomeWidget.wrap()
methods)

 also, i am using gwt-logger. when this crashes, i get this big grey
 thing that says: GWT Code Server Disconnected  which hides the log
 stiff and my html stuff. i have poor vision, is there some way to
 move the thing that has the GWT Code Server Disconnected  so i can
 see what's underneath?

In Firebug or any developer tool, set display:none on the DIV.

-- 
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: some newbie questions

2010-10-11 Thread Ray Tayek

At 02:25 AM 10/11/2010, you wrote:



On 9 oct, 04:15, Ray Tayek rta...@ca.rr.com wrote:
 ... i sometime get a: A widget that has an existing parent widget may
 not be added to the detach list error  ...

You cannot have root widgets whose elements are nested (i.e. there's
no parent/child relationship between the widgets, but there's one
between their elements in the DOM).  ...


ok.


...
 also, i am using gwt-logger. when this crashes, i get this big grey
 thing that says: GWT Code Server Disconnected  which hides the log
 stiff and my html stuff. i have poor vision, is there some way to
 move the thing that  ...

In Firebug or any developer tool, set display:none on the DIV.


great, i will try that.

thanks

---
co-chair http://ocjug.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-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: some newbie questions

2010-10-09 Thread George Georgovassilis
Hello Ray,

I can't see why the exact piece of code you posted should fail. You've
got probably more going on.

You can avoid this problem if you programmatically construct the page.
Thus, the html should contain only a div with an ID, which you get
through RootPanel.get(id) and then you keep adding your widgets to
that.

If you prefer designing your page as static html and wrapping widgets
around them you need to understand how the widget hierarchy works. For
my taste, it's ill-documented but follows more or less this rule: if
widget A contains widget B, you need to attach first widget B and then
A. An example:

HTML:
form id=A
...
input id=B type=text/
...
/form

Code:

TextBox b = TextBox.wrap(DOM.getElementById(B));
FormPanel a = FormPanel.wrap(DOM.getElementById(A));

If you first do A and then B it will fail.



On Oct 9, 4:15 am, Ray Tayek rta...@ca.rr.com wrote:
 hi, starting a project using eclipse galileo and a week old download
 of gwt eclipse plugin..

 i sometime get a: A widget that has an existing parent widget may
 not be added to the detach list error when doing the following type of thing:

 //div id=barstatic bar/div
 Label bar = new Label(bar label);
 bar.getElement().setId(barid);
 RootPanel.get(bar).add(bar);
 RootPanel rp = RootPanel.get(barid);

 this usually fails. doesn't seem to matter whether bar is a panel, an
 html, or a label (does seem to work with buttons though). seems like
 i am not using gwt properly and breaking some rule 
 like:http://markmail.org/message/l3okzeqycanf5alg

 can someone point me to some doc on this?

 also, i am using gwt-logger. when this crashes, i get this big grey
 thing that says: GWT Code Server Disconnected  which hides the log
 stiff and my html stuff. i have poor vision, is there some way to
 move the thing that has the GWT Code Server Disconnected  so i can
 see what's underneath?

 what i am trying to do is to wire up a bunch of buttons (each of
 which makes an rpc call) with their corresponding status/result
 widgets. the staus/result can be just text for now (maybe some
 graphic that changes later).

 the button case fails if i try to do a RootPanel.get() immediately.
 if i do it in a click handler, it seems to work ok, so maybe it's a
 timing problem?

 thanks

 ---
 co-chairhttp://ocjug.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-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: some newbie questions

2010-10-09 Thread Ray Tayek

At 01:00 AM 10/9/2010, you wrote:

... I can't see why the exact piece of code you posted should fail. You've
got probably more going on.


ok.



You can avoid this problem if you programmatically construct the page.
Thus, the html should contain only a div with an ID, which you get
through RootPanel.get(id) and then you keep adding your widgets to
that.


ok. i can do that. but does it have to be a div? i want to arrange 
buttons and statuses in row?


the widgets that i attach will be just buttons and labels (i guess). 
my static html looks like:


div id=hookForCommand1/div
div id=hookForStatusForCommand1/div
div id=hookForCommand2/div
div id=hookForStatusForCommand2/div




If you prefer designing your page as static html and wrapping widgets
around them you need to understand how the widget hierarchy works. For
my taste, it's ill-documented but follows more or less this rule: if
widget A contains widget B, you need to attach first widget B and then
A.  ...


ok,. i think i can avoid those problems now.

thanks


On Oct 9, 4:15 am, Ray Tayek rta...@ca.rr.com wrote:
 hi, starting a project using eclipse galileo and a week old download
 of gwt eclipse plugin..

 i sometime get a: A widget that has an existing parent widget may
 not be added to the detach list error when doing the following 
type of thing:


 //div id=barstatic bar/div
 Label bar = new Label(bar label);
 bar.getElement().setId(barid);
 RootPanel.get(bar).add(bar);
 RootPanel rp = RootPanel.get(barid);

 this usually fails. doesn't seem to matter whether bar is a panel, an
 html, or a label (does seem to work with buttons though). seems like
 i am not using gwt properly and breaking some rule 
like:http://markmail.org/message/l3okzeqycanf5alg


 can someone point me to some doc on this?

 also, i am using gwt-logger. when this crashes, i get this big grey
 thing that says: GWT Code Server Disconnected  which hides the log
 stiff and my html stuff. i have poor vision, is there some way to
 move the thing that has the GWT Code Server Disconnected  so i can
 see what's underneath?

 what i am trying to do is to wire up a bunch of buttons (each of
 which makes an rpc call) with their corresponding status/result
 widgets. the staus/result can be just text for now (maybe some
 graphic that changes later).

 the button case fails if i try to do a RootPanel.get() immediately.
 if i do it in a click handler, it seems to work ok, so maybe it's a
 timing problem? ...


---
co-chair http://ocjug.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-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.



some newbie questions

2010-10-08 Thread Ray Tayek
hi, starting a project using eclipse galileo and a week old download 
of gwt eclipse plugin..


i sometime get a: A widget that has an existing parent widget may 
not be added to the detach list error when doing the following type of thing:


//div id=barstatic bar/div
Label bar = new Label(bar label);
bar.getElement().setId(barid);
RootPanel.get(bar).add(bar);
RootPanel rp = RootPanel.get(barid);

this usually fails. doesn't seem to matter whether bar is a panel, an 
html, or a label (does seem to work with buttons though). seems like 
i am not using gwt properly and breaking some rule like: 
http://markmail.org/message/l3okzeqycanf5alg


can someone point me to some doc on this?

also, i am using gwt-logger. when this crashes, i get this big grey 
thing that says: GWT Code Server Disconnected  which hides the log 
stiff and my html stuff. i have poor vision, is there some way to 
move the thing that has the GWT Code Server Disconnected  so i can 
see what's underneath?


what i am trying to do is to wire up a bunch of buttons (each of 
which makes an rpc call) with their corresponding status/result 
widgets. the staus/result can be just text for now (maybe some 
graphic that changes later).


the button case fails if i try to do a RootPanel.get() immediately. 
if i do it in a click handler, it seems to work ok, so maybe it's a 
timing problem?


thanks

---
co-chair http://ocjug.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-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.