Re: [gwt-contrib] Re: Custom element parsers for UiBinder

2010-01-21 Thread G. Georgopoulos

Hi Daniel,

I think if you do not inject it into a field, you don't need the custom 
parser to be registered at all, but I am not sure about that.


I will check your code later today.

Thanks,
George.

On 01/20/2010 02:01 AM, Daniel Dietrich wrote:

Hi George,

in your solution parsing of an annotated widget will not be custom
if the widget is not injected into a field, right?

Here's a different idea:

http://cafebab3.blogspot.com/2010/01/non-intrusive-gwt-2-mod-2nd-part.html

Perhaps it is useful for you...

Kind regards

Daniel

On 8 Jan., 17:30, ggeorg  wrote:
   

Hi Ray,

Please have a look at:

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

the attached patch is the simplest patch I could make. It adds support
for adding custom ElementParser(s) to UiBinder by tagging each widgets
that is using a custom parser with the @ElementParserToUse annotation,
e.g.: for GWT Mosaic's LayoutPanel the code is:

@ElementParserToUse(className =
"org.gwt.mosaic.ui.elementparsers.LayoutPanelParser")
public class LayoutPanel extends AbsolutePanel implements
HasLayoutManager,
 HasAnimation {
...

}



After applying the patch, the UiBinderWriter.registerParsers() looks
like this:

   private void registerParsers() {
 // TODO(rjrjr): Allow third-party parsers to register themselves
 // automagically

 addElementParser("com.google.gwt.dom.client.Element",
 "com.google.gwt.uibinder.elementparsers.DomElementParser");

 // Register widget parsers.
 addWidgetParser("UIObject");
 addWidgetParser("HasText");
 addWidgetParser("HasHTML");
 addWidgetParser("HasWidgets");
 addWidgetParser("HTMLPanel");
 addWidgetParser("DockPanel");
 addWidgetParser("StackPanel");
 addWidgetParser("DisclosurePanel");
 addWidgetParser("TabPanel");
 addWidgetParser("MenuItem");
 addWidgetParser("MenuBar");
 addWidgetParser("RadioButton");
 addWidgetParser("CellPanel");
 addWidgetParser("CustomButton");
 addWidgetParser("DialogBox");
 addWidgetParser("LayoutPanel");
 addWidgetParser("DockLayoutPanel");
 addWidgetParser("StackLayoutPanel");
 addWidgetParser("TabLayoutPanel");

 // Register custom widget parsers... (almost automagically)

 Collection  uiFields = ownerClass.getUiFields();

 if (uiFields == null) {
   return;
 }

 for (OwnerField uiField : uiFields) {
   JClassType fieldType = uiField.getType().getRawType().isClass();
   String uiClassName = fieldType.getQualifiedSourceName();

   if (elementParsers.containsKey(uiClassName)) {
 continue;
   }

   if (fieldType != null
   &&  fieldType.isAnnotationPresent(ElementParserToUse.class))
{
 String parserClassName = fieldType.getAnnotation
(ElementParserToUse.class).className();
 if (parserClassName != null&&  parserClassName.length()>  0) {
   addElementParser(uiClassName, parserClassName);
 }
   }
 }
   }

Kind Regards,
George.

On Jan 7, 12:04 am, Ray Ryan  wrote:



 

How could I stop you? :-)
   
 

Would you making an issue tracker entry about this and putting the patch
there?
   


-- 
http://groups.google.com/group/Google-Web-Toolkit-Contributors

[gwt-contrib] Re: Custom element parsers for UiBinder

2010-01-21 Thread Daniel Dietrich
Hi George,

in your solution parsing of an annotated widget will not be custom
if the widget is not injected into a field, right?

Here's a different idea:

http://cafebab3.blogspot.com/2010/01/non-intrusive-gwt-2-mod-2nd-part.html

Perhaps it is useful for you...

Kind regards

Daniel

On 8 Jan., 17:30, ggeorg  wrote:
> Hi Ray,
>
> Please have a look at:
>
> http://code.google.com/p/google-web-toolkit/issues/detail?id=4461
>
> the attached patch is the simplest patch I could make. It adds support
> for adding custom ElementParser(s) to UiBinder by tagging each widgets
> that is using a custom parser with the @ElementParserToUse annotation,
> e.g.: for GWT Mosaic's LayoutPanel the code is:
>
> @ElementParserToUse(className =
> "org.gwt.mosaic.ui.elementparsers.LayoutPanelParser")
> public class LayoutPanel extends AbsolutePanel implements
> HasLayoutManager,
>     HasAnimation {
> ...
>
> }
>
> 
>
> After applying the patch, the UiBinderWriter.registerParsers() looks
> like this:
>
>   private void registerParsers() {
>     // TODO(rjrjr): Allow third-party parsers to register themselves
>     // automagically
>
>     addElementParser("com.google.gwt.dom.client.Element",
>         "com.google.gwt.uibinder.elementparsers.DomElementParser");
>
>     // Register widget parsers.
>     addWidgetParser("UIObject");
>     addWidgetParser("HasText");
>     addWidgetParser("HasHTML");
>     addWidgetParser("HasWidgets");
>     addWidgetParser("HTMLPanel");
>     addWidgetParser("DockPanel");
>     addWidgetParser("StackPanel");
>     addWidgetParser("DisclosurePanel");
>     addWidgetParser("TabPanel");
>     addWidgetParser("MenuItem");
>     addWidgetParser("MenuBar");
>     addWidgetParser("RadioButton");
>     addWidgetParser("CellPanel");
>     addWidgetParser("CustomButton");
>     addWidgetParser("DialogBox");
>     addWidgetParser("LayoutPanel");
>     addWidgetParser("DockLayoutPanel");
>     addWidgetParser("StackLayoutPanel");
>     addWidgetParser("TabLayoutPanel");
>
>     // Register custom widget parsers... (almost automagically)
>
>     Collection uiFields = ownerClass.getUiFields();
>
>     if (uiFields == null) {
>       return;
>     }
>
>     for (OwnerField uiField : uiFields) {
>       JClassType fieldType = uiField.getType().getRawType().isClass();
>       String uiClassName = fieldType.getQualifiedSourceName();
>
>       if (elementParsers.containsKey(uiClassName)) {
>         continue;
>       }
>
>       if (fieldType != null
>           && fieldType.isAnnotationPresent(ElementParserToUse.class))
> {
>         String parserClassName = fieldType.getAnnotation
> (ElementParserToUse.class).className();
>         if (parserClassName != null && parserClassName.length() > 0) {
>           addElementParser(uiClassName, parserClassName);
>         }
>       }
>     }
>   }
>
> Kind Regards,
> George.
>
> On Jan 7, 12:04 am, Ray Ryan  wrote:
>
>
>
> > How could I stop you? :-)
>
> > Would you making an issue tracker entry about this and putting the patch
> > there?
-- 
http://groups.google.com/group/Google-Web-Toolkit-Contributors

[gwt-contrib] Re: Custom element parsers for UiBinder

2010-01-08 Thread ggeorg
Because  the ElementParser is not in the client package.

On Jan 8, 11:09 pm, Miroslav Pokorny 
wrote:
> In your ElementParserToUse annontation why not pass the class instead  
> of classname which enforces some typesafety.
>
> On 09/01/2010, at 3:30 AM, ggeorg   
> wrote:
>
> > Hi Ray,
>
> > Please have a look at:
>
> >http://code.google.com/p/google-web-toolkit/issues/detail?id=4461
>
> > the attached patch is the simplest patch I could make. It adds support
> > for adding custom ElementParser(s) to UiBinder by tagging each widgets
> > that is using a custom parser with the @ElementParserToUse annotation,
> > e.g.: for GWT Mosaic's LayoutPanel the code is:
>
> > @ElementParserToUse(className =
> > "org.gwt.mosaic.ui.elementparsers.LayoutPanelParser")
> > public class LayoutPanel extends AbsolutePanel implements
> > HasLayoutManager,
> >    HasAnimation {
> > ...
> > }
>
> > 
>
> > After applying the patch, the UiBinderWriter.registerParsers() looks
> > like this:
>
> >  private void registerParsers() {
> >    // TODO(rjrjr): Allow third-party parsers to register themselves
> >    // automagically
>
> >    addElementParser("com.google.gwt.dom.client.Element",
> >        "com.google.gwt.uibinder.elementparsers.DomElementParser");
>
> >    // Register widget parsers.
> >    addWidgetParser("UIObject");
> >    addWidgetParser("HasText");
> >    addWidgetParser("HasHTML");
> >    addWidgetParser("HasWidgets");
> >    addWidgetParser("HTMLPanel");
> >    addWidgetParser("DockPanel");
> >    addWidgetParser("StackPanel");
> >    addWidgetParser("DisclosurePanel");
> >    addWidgetParser("TabPanel");
> >    addWidgetParser("MenuItem");
> >    addWidgetParser("MenuBar");
> >    addWidgetParser("RadioButton");
> >    addWidgetParser("CellPanel");
> >    addWidgetParser("CustomButton");
> >    addWidgetParser("DialogBox");
> >    addWidgetParser("LayoutPanel");
> >    addWidgetParser("DockLayoutPanel");
> >    addWidgetParser("StackLayoutPanel");
> >    addWidgetParser("TabLayoutPanel");
>
> >    // Register custom widget parsers... (almost automagically)
>
> >    Collection uiFields = ownerClass.getUiFields();
>
> >    if (uiFields == null) {
> >      return;
> >    }
>
> >    for (OwnerField uiField : uiFields) {
> >      JClassType fieldType = uiField.getType().getRawType().isClass();
> >      String uiClassName = fieldType.getQualifiedSourceName();
>
> >      if (elementParsers.containsKey(uiClassName)) {
> >        continue;
> >      }
>
> >      if (fieldType != null
> >          && fieldType.isAnnotationPresent(ElementParserToUse.class))
> > {
> >        String parserClassName = fieldType.getAnnotation
> > (ElementParserToUse.class).className();
> >        if (parserClassName != null && parserClassName.length() > 0) {
> >          addElementParser(uiClassName, parserClassName);
> >        }
> >      }
> >    }
> >  }
>
> > Kind Regards,
> > George.
>
> > On Jan 7, 12:04 am, Ray Ryan  wrote:
> >> How could I stop you? :-)
>
> >> Would you making an issue tracker entry about this and putting the  
> >> patch
> >> there?
> > --
> >http://groups.google.com/group/Google-Web-Toolkit-Contributors
-- 
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Re: [gwt-contrib] Re: Custom element parsers for UiBinder

2010-01-08 Thread Miroslav Pokorny
In your ElementParserToUse annontation why not pass the class instead  
of classname which enforces some typesafety.


On 09/01/2010, at 3:30 AM, ggeorg   
wrote:



Hi Ray,

Please have a look at:

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

the attached patch is the simplest patch I could make. It adds support
for adding custom ElementParser(s) to UiBinder by tagging each widgets
that is using a custom parser with the @ElementParserToUse annotation,
e.g.: for GWT Mosaic's LayoutPanel the code is:

@ElementParserToUse(className =
"org.gwt.mosaic.ui.elementparsers.LayoutPanelParser")
public class LayoutPanel extends AbsolutePanel implements
HasLayoutManager,
   HasAnimation {
...
}



After applying the patch, the UiBinderWriter.registerParsers() looks
like this:

 private void registerParsers() {
   // TODO(rjrjr): Allow third-party parsers to register themselves
   // automagically

   addElementParser("com.google.gwt.dom.client.Element",
   "com.google.gwt.uibinder.elementparsers.DomElementParser");

   // Register widget parsers.
   addWidgetParser("UIObject");
   addWidgetParser("HasText");
   addWidgetParser("HasHTML");
   addWidgetParser("HasWidgets");
   addWidgetParser("HTMLPanel");
   addWidgetParser("DockPanel");
   addWidgetParser("StackPanel");
   addWidgetParser("DisclosurePanel");
   addWidgetParser("TabPanel");
   addWidgetParser("MenuItem");
   addWidgetParser("MenuBar");
   addWidgetParser("RadioButton");
   addWidgetParser("CellPanel");
   addWidgetParser("CustomButton");
   addWidgetParser("DialogBox");
   addWidgetParser("LayoutPanel");
   addWidgetParser("DockLayoutPanel");
   addWidgetParser("StackLayoutPanel");
   addWidgetParser("TabLayoutPanel");

   // Register custom widget parsers... (almost automagically)

   Collection uiFields = ownerClass.getUiFields();

   if (uiFields == null) {
 return;
   }

   for (OwnerField uiField : uiFields) {
 JClassType fieldType = uiField.getType().getRawType().isClass();
 String uiClassName = fieldType.getQualifiedSourceName();

 if (elementParsers.containsKey(uiClassName)) {
   continue;
 }

 if (fieldType != null
 && fieldType.isAnnotationPresent(ElementParserToUse.class))
{
   String parserClassName = fieldType.getAnnotation
(ElementParserToUse.class).className();
   if (parserClassName != null && parserClassName.length() > 0) {
 addElementParser(uiClassName, parserClassName);
   }
 }
   }
 }


Kind Regards,
George.


On Jan 7, 12:04 am, Ray Ryan  wrote:

How could I stop you? :-)

Would you making an issue tracker entry about this and putting the  
patch

there?

--
http://groups.google.com/group/Google-Web-Toolkit-Contributors
-- 
http://groups.google.com/group/Google-Web-Toolkit-Contributors

[gwt-contrib] Re: Custom element parsers for UiBinder

2010-01-08 Thread ggeorg
Hi Ray,

Please have a look at:

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

the attached patch is the simplest patch I could make. It adds support
for adding custom ElementParser(s) to UiBinder by tagging each widgets
that is using a custom parser with the @ElementParserToUse annotation,
e.g.: for GWT Mosaic's LayoutPanel the code is:

@ElementParserToUse(className =
"org.gwt.mosaic.ui.elementparsers.LayoutPanelParser")
public class LayoutPanel extends AbsolutePanel implements
HasLayoutManager,
HasAnimation {
...
}



After applying the patch, the UiBinderWriter.registerParsers() looks
like this:

  private void registerParsers() {
// TODO(rjrjr): Allow third-party parsers to register themselves
// automagically

addElementParser("com.google.gwt.dom.client.Element",
"com.google.gwt.uibinder.elementparsers.DomElementParser");

// Register widget parsers.
addWidgetParser("UIObject");
addWidgetParser("HasText");
addWidgetParser("HasHTML");
addWidgetParser("HasWidgets");
addWidgetParser("HTMLPanel");
addWidgetParser("DockPanel");
addWidgetParser("StackPanel");
addWidgetParser("DisclosurePanel");
addWidgetParser("TabPanel");
addWidgetParser("MenuItem");
addWidgetParser("MenuBar");
addWidgetParser("RadioButton");
addWidgetParser("CellPanel");
addWidgetParser("CustomButton");
addWidgetParser("DialogBox");
addWidgetParser("LayoutPanel");
addWidgetParser("DockLayoutPanel");
addWidgetParser("StackLayoutPanel");
addWidgetParser("TabLayoutPanel");

// Register custom widget parsers... (almost automagically)

Collection uiFields = ownerClass.getUiFields();

if (uiFields == null) {
  return;
}

for (OwnerField uiField : uiFields) {
  JClassType fieldType = uiField.getType().getRawType().isClass();
  String uiClassName = fieldType.getQualifiedSourceName();

  if (elementParsers.containsKey(uiClassName)) {
continue;
  }

  if (fieldType != null
  && fieldType.isAnnotationPresent(ElementParserToUse.class))
{
String parserClassName = fieldType.getAnnotation
(ElementParserToUse.class).className();
if (parserClassName != null && parserClassName.length() > 0) {
  addElementParser(uiClassName, parserClassName);
}
  }
}
  }


Kind Regards,
George.


On Jan 7, 12:04 am, Ray Ryan  wrote:
> How could I stop you? :-)
>
> Would you making an issue tracker entry about this and putting the patch
> there?
-- 
http://groups.google.com/group/Google-Web-Toolkit-Contributors

[gwt-contrib] Re: Custom element parsers for UiBinder

2010-01-06 Thread ggeorg
Hi Sami,

yes I still use the ScrollTable and PagingScrollTable. I am thing
about forking them if they do not appear in the main GWT trunk very
soon.

George.

On Jan 7, 12:19 am, Sami Jaber  wrote:
> Please Ray, when you have anything in terms of design doc regarding the
> Element Custom Parser API (what a cool name, ECP ;-)), let us know thru the
> list.
> The options that will be made here are going to engage all the third party
> framework that will stick on it...
> btw, keep up the good work George, Mosaic is really cool  (do you still have
> any dependency with incubator projects components? this project is supposed
> to disappear ...)
>
> Sami
>
> On Wed, Jan 6, 2010 at 11:04 PM, Ray Ryan  wrote:
> > How could I stop you? :-)
>
> > Would you making an issue tracker entry about this and putting the patch
> > there?
>
> > --
> >http://groups.google.com/group/Google-Web-Toolkit-Contributors
-- 
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Re: [gwt-contrib] Re: Custom element parsers for UiBinder

2010-01-06 Thread Sami Jaber
Please Ray, when you have anything in terms of design doc regarding the
Element Custom Parser API (what a cool name, ECP ;-)), let us know thru the
list.
The options that will be made here are going to engage all the third party
framework that will stick on it...
btw, keep up the good work George, Mosaic is really cool  (do you still have
any dependency with incubator projects components? this project is supposed
to disappear ...)

Sami

On Wed, Jan 6, 2010 at 11:04 PM, Ray Ryan  wrote:

> How could I stop you? :-)
>
> Would you making an issue tracker entry about this and putting the patch
> there?
>
>
> --
> http://groups.google.com/group/Google-Web-Toolkit-Contributors
>
-- 
http://groups.google.com/group/Google-Web-Toolkit-Contributors

[gwt-contrib] Re: Custom element parsers for UiBinder

2010-01-06 Thread ggeorg
OK, sure.
Thanks.

On Jan 7, 12:04 am, Ray Ryan  wrote:
> How could I stop you? :-)
>
> Would you making an issue tracker entry about this and putting the patch
> there?
-- 
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Re: [gwt-contrib] Re: Custom element parsers for UiBinder

2010-01-06 Thread Ray Ryan
How could I stop you? :-)

Would you making an issue tracker entry about this and putting the patch
there?
-- 
http://groups.google.com/group/Google-Web-Toolkit-Contributors

[gwt-contrib] Re: Custom element parsers for UiBinder

2010-01-06 Thread ggeorg
Hi,

thanks for the reply.

> A nit: we've tried to keep a convention of using lower case names for XML
> elements that don't correspond to runtime objects, so  should
> probably be .

OK, I will do the required changes to keep the same convention.

> If you want to get this out the door in the meantime, I'm afraid you'll have
> to copy and paste UiBinderGenerator and UiBinderWriter, and provide some
> gwt.xml magic to let your generator run instead of ours for GWT.create calls
> on UiBinder.class.

I tried to rename UiBinderGenerator and UiBinderWriter but there is a
problem with the
ElementParser.parse(XMLElement elem, String fieldName, JClassType
type, UiBinderWriter writer)
it requires a UiBinderWriter.

Extending UiBinderWriter is also not possible since all register
methods are private.

> Another alternative is to do some classpath cheating. Patch UiBinderWriter
> to register your parsers, and put your version in the Mosaic jar. If your
> users put your jar in the classpath before gwt's, you should be good to go.

Maybe I keep this for simplicity. This is what I do so far.

Can I post a patch for GWT-2.1 as a temporary solution, that allows
registration of custom handlers, until you provide a final API for
UiBinder generator?

Thanks,
George.
-- 
http://groups.google.com/group/Google-Web-Toolkit-Contributors