When GWT Designer parses

GWT Designer allows you to quickly create the modules, composites, panels, remote services and other elements that comprise Google Web Tookit applications.

Moderators: Konstantin.Scheglov, gnebling, Alexander.Mitin, jwren, Eric Clayberg

When GWT Designer parses

Postby pe_oliff » Wed Dec 03, 2008 11:50 am

the following code crashes the system because the line EHCEntry.frontendCache.userPropertyNo("OnlyShowMemberSearchCombo")
is not initialized.

Code: Select all
if (EHCEntry.frontendCache.userPropertyNo("OnlyShowMemberSearchCombo"))
      {
         final EhcLabel groupLabel = new EhcLabel("Group:");
         flexTable.setWidget(3, 0, groupLabel);
         groupLabel.setWordWrap(false);

         flexTable.setWidget(3, 1, locateMemberGroupTxt);

         final EhcLabel memberIdLabel = new EhcLabel("Member Id:");
         flexTable.setWidget(4, 0, memberIdLabel);
         memberIdLabel.setWordWrap(false);


Is there a way to test that the code is being parsed by the designer like with some sort of code like
Code: Select all
if (GWTDesigner.inCodeParser() || ... my other if statements) {
}
pe_oliff
 
Posts: 3
Joined: Wed Dec 03, 2008 11:43 am

Re: When GWT Designer parses

Postby Eric Clayberg » Wed Dec 03, 2008 11:54 am

You can use an isDesignTime() check as shown in the docs...

http://download.instantiations.com/Desi ... DesignTime

Or possibly use a code hiding tag...

http://download.instantiations.com/Desi ... rsing.html
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA

Re: When GWT Designer parses

Postby pe_oliff » Wed Dec 03, 2008 12:01 pm

Thanks for your reply I found the isDesignTime() but it only works by itself in an if
Code: Select all
if (isDesignTime())


when I use it with an || (or) it will not go in the code.
Code: Select all
if (isDesignTime() || .. other test)

does not work
even this fails
Code: Select all
if (isDesignTime() || 1==1)
pe_oliff
 
Posts: 3
Joined: Wed Dec 03, 2008 11:43 am

Re: When GWT Designer parses

Postby Eric Clayberg » Wed Dec 03, 2008 1:37 pm

That is correct. The parser looks for that very specific pattern. That is intentional.

Note that you can also use code hoding tags. The isDesignTime() call is primarily used to suppress design-time behavior at runtime or runtime behavior at design time.
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA

Re: When GWT Designer parses

Postby pe_oliff » Thu Dec 04, 2008 7:05 am

I pondered this for a while and figured out that the // $hide>>$ and unhiding code is what I needed.

Thanks for your support

I liked the fact that this is configurable so it allowed me to change the expression that is used for hiding and unhiding because when you run the formatter on the code it puts a space between the // and the $ so your example on the help page was useful.

So I am using
Code: Select all
      // $hide>>$
      if (userPropertyIsNo("OnlyShowMemberSearchCombo"))  // show or hide widget based on a property
      {
         // $hide<<$

                ... widgets here who's visibility are property driven ...

         // $hide>>$
      }
      // $hide<<$
pe_oliff
 
Posts: 3
Joined: Wed Dec 03, 2008 11:43 am

Re: When GWT Designer parses

Postby Eric Clayberg » Thu Dec 04, 2008 4:30 pm

pe_oliff wrote:I liked the fact that this is configurable so it allowed me to change the expression that is used for hiding and unhiding because when you run the formatter on the code it puts a space between the // and the $ so your example on the help page was useful.

That was exactly why we made it configurable. ;-)
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA


Return to GWT Designer

Who is online

Users browsing this forum: No registered users and 2 guests