Re: GWT 2.3 composite editor // setValue called twice

2011-05-31 Thread Sebastian Beigel
Hi Patrick,

that's true, but it was an example only. You surely should do what you
said but it's still unnecessary (and potentially harmful for the
performance) to do this call twice (by the framework!), so I think
it's a bug in GWT's editor code that should be fixed there and not be
worked around by (application) developers.

Sebastian


On Tue, May 31, 2011 at 3:30 AM, Patrick Tucker  wrote:
> I didn't look at the code, so this may not be feasible, but shouldn't
> you be doing this heavy stuff only when the value changes?  It's
> pretty easy to check the current vale prior to doing any work, or
> implement via handling valuechangeevents.
>
> On May 27, 8:27 am, Sebastian Beigel  wrote:
>> Hi,
>>
>> unfortunately there seems to be no love for the issue I reported a
>> while ago concerning the revamped editor code (starting w/ GWT 2.3)
>> using Refresher & Initializer.
>>
>> http://code.google.com/p/google-web-toolkit/issues/detail?id=6336
>>
>> Sub-editors' setValue() methods get called twice, which can be a very
>> bad thing if you do something fancy/heavy in you setValue() method.
>> But even for non-visible use-cases (like my trivial example w/
>> TextBoxes) it's unnecessary and a can harm performance.
>>
>> Sebastian
>
> --
> 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.
>
>

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



GWT 2.3 composite editor // setValue called twice

2011-05-27 Thread Sebastian Beigel
Hi,

unfortunately there seems to be no love for the issue I reported a
while ago concerning the revamped editor code (starting w/ GWT 2.3)
using Refresher & Initializer.

http://code.google.com/p/google-web-toolkit/issues/detail?id=6336

Sub-editors' setValue() methods get called twice, which can be a very
bad thing if you do something fancy/heavy in you setValue() method.
But even for non-visible use-cases (like my trivial example w/
TextBoxes) it's unnecessary and a can harm performance.

Sebastian

-- 
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: Eclipse plugin problem with OSX Java update 4?

2011-03-10 Thread Sebastian Beigel
Maybe you have to install the latest Java developer package from Apple
("Java for Mac OS X 10.6 Update 4 Developer Package") -- I did this
and pointed my JDK 1.6 home to the (new) location:
/Library/Java/JavaVirtualMachines/1.6.0_24-b07-334.jdk/Contents/Home.
Everything works as before.

Sebastian

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



CSS @font-face rules

2011-03-04 Thread Sebastian Beigel
Hi,

I'm playing around with CSS3's @font-face. It doesn't work with GWT
2.2's CssResource unfortunately. I found this patch:

http://gwt-code-reviews.appspot.com/943802

but it isn't applied to the 2.2 source code (though it seems to
originate from pre-2.2 or event pre-2.1 times...)

What's the current status wrt @font-face support in GWT?

As a workaround, I can put @font-face rules in a 

Re: Does the new Editor support data type convert?

2010-10-28 Thread Sebastian Beigel
Use IntegerBox instead of TextBox (and see ValueBoxBase and its
subclasses for other types).

Sebastian


On Fri, Oct 29, 2010 at 4:03 AM, wangzx  wrote:
> class Person {
>   int age;
> }
>
> class PersonEditor {
>
>  TextBox ageEditor;
>
> }
>
> The GWT Compiler report: Found unexpected type int while evauating
> path "age" using getter expression ""
>
> So my question is: how to using different type other than "String" in
> the editor framework?
>
> --
> 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: Is Cell Table in 2.1 supports sorting of column ?

2010-10-28 Thread Sebastian Beigel
Hi,

CellTable doesn't support this "out of the box". Have a look at the
Expenses example for a SortableHeader implementation (and how it's
used).

Sebastian


On Thu, Oct 28, 2010 at 8:33 AM, rajakumar Iyyemperumal
 wrote:
> Hi All,
>  I am trying to work on GWT 2.1 and I want to know that the new Cell
> Table in 2.1 supports column sorting or not ?
>
> --
> 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: GWT 2.1 and Place with token

2010-10-27 Thread Sebastian Beigel
Hi Nicolas,

often your places are "parameterized", think of a detail/edit screen
for example that needs the model's id. The token is a generic way to
provide additional information (via the URL) to the place (i.e. the
activity/-ies), i.e. "#editFoo:42".

You can of course re-use one place to dispatch to several activities
based on the token. See the (currently not used) for ProxyPlace and
ProxyListPlace in the Expenses sample for an example.

Sebastian


On Wed, Oct 27, 2010 at 9:36 AM, Nicolas ANTONIAZZI
 wrote:
> Hello,
> I converted all my project to GWT 2.1 Activity/Place following the concept
> described
> on http://code.google.com/intl/fr/webtoolkit/doc/trunk/DevGuideMvpActivitiesAndPlaces.html
> But, doing this work, I came to a question : Why do we have to set a name in
> the place constructor ?
> A place generate a #ClassName:Token in the url. Would not be easier to just
> generate a #Token ?
> In my opinion it seems a bit complicated to manager class instead of an enum
> or string constant for each place.
> A simplification would be to only have 1 place class with a new token
> (string) for each place, or severals class but with an empty constructor
> that initializes its name with a constant.
> But I may have not really understood the real advantage of the
> #PlaceClass:Token, so maybe someone could help me ?
> Thanks,
> Nicolas
>
> --
> 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 get list of objects from JSON ??

2010-10-27 Thread Sebastian Beigel
> You can very well subclass JSOs [...] What you cannot do is virtual 
> dispatching (i.e. overring methods:
> methods must be final, but not necessarily classes).

Of course you are right -- I wasn't precise (and thus wrong :) What I
meant (and "hate" :) is that you're not allowed to override methods
and that there is a "one interface to one JSO" constraint (since GWT
2.0). I like to have my domain models implement something like
EntityModel (a custom interface declaring Integer getId() and String
getrLabel() for example). That way, I can really simple build/populate
things like ListBoxes etc. GWT 2.1's ProvidesKey et al. gives us
another (and more flexible) solution for these problems though.

> That's why I created JsCollections a while ago with a set of
> JsArrays.toArray() methods that copies the JsArray into an array in
> DevMode but just "casts" it in prod mode (i.e. no single overhead once
> compiled to JS).

I used to do something similar. For dates and date-times as well (as
these types are Strings in the JSON requests -- this works best for me
at least). But I must admit, I'm lazy and I just (would) prefer to not
think about these conversions and "just use" Lists, Dates etc. as I do
on the server side.

Did you do any comparison in size and performance for the JSO vs.
native beans approach?

Sebastian

-- 
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 get list of objects from JSON ??

2010-10-26 Thread Sebastian Beigel
Hi Thomas,

> Of course, if your really want Product as a "real" bean, and a List
> instead of a JsArray, you can copy things around (see below); but
> really I believe overlay types are much more readable than anything
> using com.google.gwt.json.* classes.

I used to use overlay type heavily (returning JSON from a Spring
MVC/Jackson backend) and it worked quite well. Although I found it
quite limiting to be unable to model "real" class hierarchies (JSOs
must not be subclassed). I really do this a lot on the server side. I
also really like to use the enhanced for loop for Lists and just do a
new Foo() instead of some tedious Foo.create(). Last but not least I
don't have a "Generate getters/setters" in Eclipse for my JSOs :)

All this led me to write a Generator which inspects my models ("real"
beans) and emits JSON mapping code handling simple properties, object
graphs and collections. That way I can work with real beans and
collections of beans in my (business) code and do the mapping from/to
JSON in my service/DAO layer (still sending/retrieving JSON to/from my
backend).

Sebastian

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



GWT 2.1 cell table paging bug?

2010-10-26 Thread Sebastian Beigel
AbstractPager uses HasRows#getVisibleRange()#getLength() to obtain the
page size. This doesn't seem to be a good idea as you can see in the
Showcase exmpale (Cell Widgets/Cell Table [1]).

This table gets populated with 250 entries and shows 15 per page. Now
click on the "next page" button. You go (correctly) all the way to
showing "226 - 240". But the next click switches to "236 - 250". I
expect the table to go to "241 - 250" (and thus showing only 10 rows).
But it gets worse: If you now start to navigate back, the display
range is moved by this offset. So you reach "11 - 25" and then "1 -
15"?!

I don't think this behaviour is intentional. At least the "go to last
page" and "go to first page" buttons work properly (showing "1 - 15"
and "241 - 250").

Bug?

Sebastian

[1] http://gwt.google.com/samples/Showcase/Showcase.html#!CwCellTable

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



Flashing/collapsing CellTable

2010-10-26 Thread Sebastian Beigel
Hi,

I'm looking at the new data presentation widgets in GWT 2.1 and I
mostly like what I see :)

I have one problem with the "workflow" updating/paging a cell table though.

I'm using a (heavily) customized version of AbstractProxyListActivity
from the Expenses example and I just don't understand why
HasDataPresenter is clearing the table content while loading the
next/previous page.

Instead of the current rows, a loading indicator is displayed (with
different a height resulting in a collapsing/expanding table). I
already filed a bug (5487) to make this customizable (at least via
sub-classing).

For the moment, I deactivated this loading indicator (I show a
application-wide indicator in my app and don't want to show inline
indicators). This deactivation makes the "flashing" even more obvious.

I want my "old" rows to be there until they are replaced by the "new"
ones, maybe overlayed by some "glass" and a loading indicator -- but
not replaced! That way the table doesn't collapse and no "flashing" is
visible in the ui.

What's the reason for HasDataPresenter to clear the row data in
setVisibleRange? I try very hard to not show flashing and resizing
elements my apps' UIs but set up everything correctly *before* adding
it to the display list.

Sebastian

-- 
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: GWT 2.1 hellomvp using GIN

2010-10-21 Thread Sebastian Beigel
Thank you Thomas,

that's what I was thinking -- and I'm playing with a custom code
generator already :)

Just wondering what "they" mean with the GIN comments in the doc/code...

In my pre-2.1 homegrown framework I use a code-generated presenter
config based on a Ginjector (declaring all the getFooPresenter()
methods annotated with location (place) and security informations). My
presenters were singletons and were "started" with the actual Place.
That way I could use GIN to (constructor) inject all my dependencies.
I'm not sure if I like this 2.1-design (constructing activities with
the actual place) which means I cannot use GIN to construct them.
Maybe I make my activities extends some AbstractBaseActivity
containing a setPlace(P place) method which is called in the
ActivityMapper...

Sebastian


On Wed, Oct 20, 2010 at 11:22 PM, Thomas Broyer  wrote:
>
> On 20 oct, 11:42, Sebastian Beigel  wrote:
>> Hi,
>>
>> I'm looking at 2.1 (RC1) for the first time right now and I try to
>> refactor the hellomvp sample to use GIN.
>>
>> Unfortunately, I have some problems with the places -> activities
>> mapping. The doc says "A better way to implement the chain of nested
>> ifs would be with a GIN module." and the code is commented "Map each
>> Place to its corresponding Activity. This would be a great use for
>> GIN.".
>>
>> I agree, but I don't really know how to do this mapping :) Has anyone
>> refactored this code to use GIN?
>
> You just can't actually. What could work is using a Ginjector as the
> factory of a PlaceHistoryMapperWithFactory, but for ActivityMapper
> this is not possible (it could be by adding a code generator using a
> factory of activity factories, similar to the factory of place
> tokenizers (which are kind of factories for places) for
> PlaceHistoryMapperWithFactory).
> I wrote an code generator for ActivityMapper some time ago <http://gwt-
> code-reviews.appspot.com/845802/show> it won't do what you're asking
> for but could probably be used as a basis for it. But you'd first have
> to decide how to model a "factory of activities" that would be
> returned by your "Ginjector as a factory for
> ActivityMapperWithFactory".
>
> --
> 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.



GWT 2.1 hellomvp using GIN

2010-10-20 Thread Sebastian Beigel
Hi,

I'm looking at 2.1 (RC1) for the first time right now and I try to
refactor the hellomvp sample to use GIN.

Unfortunately, I have some problems with the places -> activities
mapping. The doc says "A better way to implement the chain of nested
ifs would be with a GIN module." and the code is commented "Map each
Place to its corresponding Activity. This would be a great use for
GIN.".

I agree, but I don't really know how to do this mapping :) Has anyone
refactored this code to use GIN?

Thank you,
Sebastian

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



ValueChangeEvent in DatePicker

2010-01-25 Thread Sebastian Beigel
Hi,

I wrapped a DatePicker in a (custom) Popup and I like to hide the
popup when a value is selected in the DatePicker. That's working great
for "new" values, but if I don't change the value but click at the
same, highlighted (and thus already selected) date, no
ValueChangeEvent is fired.

I guess that's desirable most of the time, but not for me :)

To solve this, I had tried to override DatePicker#setValue -- but it's
declared final :(

So I tried to subclass DefaultCalendarView and override onSelected in
its inner class DataCell. But again no luck as DefaultCalendarView is
final...

Ok, last resort, I copied the code of DefaultCalendarView into
MyCalendarView (arrg) -- and it's even worse... Since CellGridImpl is
package-private, I had to move MyCalendarView to
com.google.gwt.user.datepicker.client :(((

I can't tell you how dirty I feel by this "solution" :) Do you have
any idea how to do this w/out duplicating code *and* polluting the
framework's namespace? Of course I could implement my own date picker
(or take any of the open source ones) -- but the existing one is
perfectly fine -- expect for this part...

Sebastian

-- 
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: Icon next to anchor

2010-01-11 Thread Sebastian Beigel
Thank you Thomas, good idea -- but I try to keep the markup as pure as
possible, that means I really try to separate visual design aspects
from content. We all now, that browsers often spoil this and we have
to throw a good measure of DIVs and SPANs here and there -- but for
this use case I prefer going without :)

Sebastian


On Mon, Jan 11, 2010 at 3:46 PM, Thomas Broyer  wrote:
>
>
> On Jan 11, 3:38 pm, Sebastian Beigel  wrote:
>> Right now I use a DataResource (instead of an ImageResource) in my
>> ClientBundle and use something like this in my CSS:
>>
>> @url createNewImg createNew;
>>
>> a.add {
>>         background: createNewImg no-repeat;
>>         float: right;
>>         padding-left: 18px;
>>         height: 13px;
>>
>> }
>>
>> This works and is optimized to an data-url. Nice. Is this the
>> recommended way to use images in CSS if you need to control the
>> element's dimensions (i.e. the images are not subject to real
>> spriting)?
>
> Yes, though in you case I'd have done it differently (and using
> @sprite):
>
> .add {
>   float: right;
> }
> @sprite .addIcon {
>   gwt-image: "createNew";
>   display: inline-block;
> }
>
> 
>   
>   create new
> 
>
> (and of course, you can also use an 
> instead of the  if you prefer; in this case you no longer need
> the "display: inline-block")
>
> --
> 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: Icon next to anchor

2010-01-11 Thread Sebastian Beigel
Right now I use a DataResource (instead of an ImageResource) in my
ClientBundle and use something like this in my CSS:

@url createNewImg createNew;

a.add {
background: createNewImg no-repeat;
float: right;
padding-left: 18px;
height: 13px;
}

This works and is optimized to an data-url. Nice. Is this the
recommended way to use images in CSS if you need to control the
element's dimensions (i.e. the images are not subject to real
spriting)?

Sebastian


On Mon, Jan 11, 2010 at 3:19 PM, Sebastian Beigel  wrote:
> Hi,
>
> I want to position an image left to an anchor (for example a
> plus-image likes this "[+] create new"). I like to use an
> ImageResource for this, but defining @sprite/gwt-image in the CSS
> rules adds dimension attributes (as clearly documented and admittedly
> sensible for spriting!).
>
> In my case, I don't want to add the dimensions because the anchor
> element has to be much wider than the prefixed image is. Overwriting
> width (with auto for example) can result in rendering errors according
> to the doc (which makes sense thinking about multi-image sprites).
>
> Is there any solution but falling back to "native" CSS (using a
> background-image: url(...) rule with no (automatic) optimization)?
>
> Thanks
> Sebastian
>
-- 
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.




Icon next to anchor

2010-01-11 Thread Sebastian Beigel
Hi,

I want to position an image left to an anchor (for example a
plus-image likes this "[+] create new"). I like to use an
ImageResource for this, but defining @sprite/gwt-image in the CSS
rules adds dimension attributes (as clearly documented and admittedly
sensible for spriting!).

In my case, I don't want to add the dimensions because the anchor
element has to be much wider than the prefixed image is. Overwriting
width (with auto for example) can result in rendering errors according
to the doc (which makes sense thinking about multi-image sprites).

Is there any solution but falling back to "native" CSS (using a
background-image: url(...) rule with no (automatic) optimization)?

Thanks
Sebastian
-- 
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: Loading/parsing time for CssResource

2010-01-09 Thread Sebastian Beigel
Please ignore this post, it's a double post as I didn't realize that
new mails are moderated. I wrote a newer (and more concise :) post
discussing this subject (search for "Injected CSS rules are evaluated
after onModuleLoad/Widget#onLoad")

My apologies,
Sebastian
-- 
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: Injected CSS rules are evaluated after onModuleLoad/Widget#onLoad

2010-01-09 Thread Sebastian Beigel
Replacing

globalResources.fooCss().ensureInjected();

with

StyleInjector.inject(globalResources.fooCss().getText(), true);

solves the problem as well! Thanks Dave.

In the meanwhile, I wrapped my onModuleLoad code in a
DeferredCommand() (mainly for an UncaughtExceptionHandler) and removed
the DeferredCommand wrap in Widget#onLoad (as described in my previous
post). That also works.

Anyway, I use both modifications, deferring the onModuleLoad (mainly
for the logger) and ensuring immediate CSS injection -- explicit is
better than implicit :) Or do you see any (performance) issues with
this approach?

Sebastian


On Sat, Jan 9, 2010 at 1:25 AM, DaveC
 wrote:
> Have you tried StyleInjector.inject(cssText, true) ...?
>
> " the DOM will be updated immediately instead of just before returning
> to the event loop. Using this option excessively will decrease
> performance, especially if used with an inject-css-on-init coding
> pattern"
>
> I had a similar problem using the gwt-fx library (which parses the
> stylesheets in the DOM looking for selectors I passed in) the styles
> weren't injected in time.
>
> Cheers,
> Dave
>
> On Jan 8, 4:39 pm, Sebastian Beigel  wrote:
>> I found a "work around", I wrapped the positioning code in my onLoad()
>> method in a DeferredCommand and it works. Is this the preferred
>> solution for this "problem"?
>>
>> Sebastian
>>
>>
>>
>>
>>
>> On Fri, Jan 8, 2010 at 4:38 PM, Sebastian Beigel  wrote:
>> > Hi,
>>
>> > I tried to follow the best practices and moved my static CSS files
>> > from style-tags in the HTML-page to CssResources in a ClientBundle
>> > declared in my EntryPoint and injected in a static initializer.
>>
>> > Unfortunately, this doesn't work for me because I do some element
>> > positioning in an onLoad-method of a Widget (which is contained in the
>> > UIBinder template of my EntryPoint). The calculations of the
>> > (relative) positions are wrong and I found out that the injected CSS
>> > rules are not evaluated until my positioning code runs.
>> > Profiling the generated JS code shows the following timing:
>>
>> > - entering onModuleLoad
>> > - entering Widget#onLoad
>> > - leaving onLoad
>> > - leading onModuleLoad
>> > - injecting CSS
>>
>> > Tested in Webkit and Firefox 3.5 on a Mac with Snow Leopard.
>>
>> > If I defer the positioning (by triggering it manually via a Button
>> > click in the UI) everything works as expected.
>>
>> > Is this a bug? Is there a work-around? I really don't want to move my
>> > CSS back to static files and lose all the great advantages from using
>> > ClientBundles. But I need my CSS rules parsed and evaluated *before*
>> > my code runs.
>>
>> > Thank you,
>> > Sebastian
>>
>> --
>> Sebastian Beigelhttp://beigel.de/sebastian
>
> --
> 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.
>
>
>
>



-- 
Sebastian Beigel
http://beigel.de/sebastian
-- 
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.




Injected CSS rules are evaluated after onModuleLoad/Widget#onLoad

2010-01-08 Thread Sebastian Beigel
Hi,

I tried to follow the best practices and moved my static CSS files
from style-tags in the HTML-page to CssResources in a ClientBundle
declared in my EntryPoint and injected in a static initializer.

Unfortunately, this doesn't work for me because I do some element
positioning in an onLoad-method of a Widget (which is contained in the
UIBinder template of my EntryPoint). The calculations of the
(relative) positions are wrong and I found out that the injected CSS
rules are not evaluated until my positioning code runs.
Profiling the generated JS code shows the following timing:

- entering onModuleLoad
- entering Widget#onLoad
- leaving onLoad
- leading onModuleLoad
- injecting CSS

Tested in Webkit and Firefox 3.5 on a Mac with Snow Leopard.

If I defer the positioning (by triggering it manually via a Button
click in the UI) everything works as expected.

Is this a bug? Is there a work-around? I really don't want to move my
CSS back to static files and lose all the great advantages from using
ClientBundles. But I need my CSS rules parsed and evaluated *before*
my code runs.

Thank you,
Sebastian
-- 
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: Injected CSS rules are evaluated after onModuleLoad/Widget#onLoad

2010-01-08 Thread Sebastian Beigel
I found a "work around", I wrapped the positioning code in my onLoad()
method in a DeferredCommand and it works. Is this the preferred
solution for this "problem"?

Sebastian


On Fri, Jan 8, 2010 at 4:38 PM, Sebastian Beigel  wrote:
> Hi,
>
> I tried to follow the best practices and moved my static CSS files
> from style-tags in the HTML-page to CssResources in a ClientBundle
> declared in my EntryPoint and injected in a static initializer.
>
> Unfortunately, this doesn't work for me because I do some element
> positioning in an onLoad-method of a Widget (which is contained in the
> UIBinder template of my EntryPoint). The calculations of the
> (relative) positions are wrong and I found out that the injected CSS
> rules are not evaluated until my positioning code runs.
> Profiling the generated JS code shows the following timing:
>
> - entering onModuleLoad
> - entering Widget#onLoad
> - leaving onLoad
> - leading onModuleLoad
> - injecting CSS
>
> Tested in Webkit and Firefox 3.5 on a Mac with Snow Leopard.
>
> If I defer the positioning (by triggering it manually via a Button
> click in the UI) everything works as expected.
>
> Is this a bug? Is there a work-around? I really don't want to move my
> CSS back to static files and lose all the great advantages from using
> ClientBundles. But I need my CSS rules parsed and evaluated *before*
> my code runs.
>
> Thank you,
> Sebastian
>



-- 
Sebastian Beigel
http://beigel.de/sebastian
-- 
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.