[solved] Design view Windows/IE strict modes support

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

[solved] Design view Windows/IE strict modes support

Postby peterblazejewicz » Wed Mar 12, 2008 2:08 pm

hi all,

how does GWT Designer on Windows with IE7 supports XHTML strict mode?
I've noticed that before while using legacy .css files but I've been looking for some clear, official test case sample,

here is one: IE7 (Windows) supports "first-child" selector when viewed in strict mode. Paragraph element if being first child of its parent should render red text over white background. Otherwise white text over red bacground in inheritance css chain,
While that is true in hosted mode run from GWT Designer "Design" editor mode seems to be in quirks mode:

[hosted mode]
hostedView.png
view in Hosted mode (IE7/Windows)
hostedView.png (19.92 KiB) Viewed 1670 times


[design mode]
designerView.png
view in Design editor mode (IE7/Windows)
designerView.png (4.3 KiB) Viewed 1711 times


full source code (very easy example to write):


modified generated .html page:
Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta name="generator" content="HTML Tidy, see www.w3.org">
        <meta name='gwt:module' content= 'com.mycompany.project.StrictMode'>
        <link type="text/css" rel='stylesheet' href= 'StrictMode.css'>
    </head>
    <body>
        <script type="text/javascript" language="javascript" src= "com.mycompany.project.StrictMode.nocache.js">
        </script>
        <iframe id="__gwt_historyFrame" style="width:0;height:0;border:0">
        </iframe>
    </body>
</html>


modified generated .css:
Code: Select all
body {
    font-size: 16px;
    font-family: Arial, Helvetica, sans-serif;
}

.note {
    color: white;
    background-color: red;
}

p:first-child {
    color: red;
    background-color: white;
}


entry point:
Code: Select all
package com.mycompany.project.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.RootPanel;

/**
* Entry point classes define <code>onModuleLoad()</code>.
*/
public class StrictMode implements EntryPoint {
   private HTML secondSample;
   private HTML firstSample;

   public void onModuleLoad() {
      RootPanel rootPanel = RootPanel.get();

      firstSample = new HTML("<p> The first P inside the note. </p>");
      rootPanel.add(firstSample);
      firstSample.setStyleName("note");

      secondSample = new HTML(
            "<h2>Note</h2><p> The first P inside the note. </p>");
      rootPanel.add(secondSample);
      secondSample.setStyleName("note");

   }
}


example is based on Microsf relevant example code:
http://msdn2.microsoft.com/en-us/library/ms530712(VS.85).aspx


.zip-ped project included:
IEStrictModeTest.zip
project sources
(2.42 KiB) Downloaded 95 times


regards,
Peter
Last edited by peterblazejewicz on Fri Mar 14, 2008 12:03 pm, edited 1 time in total.
Peter Blazejewicz
GWT groups profile
peterblazejewicz
 
Posts: 153
Joined: Fri Jul 27, 2007 7:09 pm
Location: Europe/Poland/Warsaw

Re: Design view Windows/IE strict modes support

Postby Eric Clayberg » Thu Mar 13, 2008 9:14 am

peterblazejewicz wrote:how does GWT Designer on Windows with IE7 supports XHTML strict mode?

That is a GWT/Browser issue, not a GWT Designer issue.

IE is strict mode is essentially just a different browser.

It doesn't appear that GWT 1.4 supports strict mode, but it looks like it will be supported in 1.5.

See discussion here: http://code.google.com/p/gwt-google-api ... tail?id=13

And for additional background: http://www.quirksmode.org/css/quirksmode.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: Design view Windows/IE strict modes support

Postby peterblazejewicz » Thu Mar 13, 2008 12:09 pm

hi Eric,

GWT (toolkit) does not support strict mode in implementation of default toolkit UI elements because supporting quirks mode was choosen. That's why tables are used nearly for every cell-like design, that's why everything could work wihtout even using .css files,
I know that
http://groups.google.com/group/Google-W ... d032eed9ff
but my example does not use toolkit UI, I could rewrite it to use raw widgets (which are not affected by strict mode at usage in that example):

Code: Select all
package com.mycompany.project.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.Widget;

/**
* Entry point classes define <code>onModuleLoad()</code>.
*/
public class StrictMode implements EntryPoint {
   static class MyWidget extends Widget {
      public MyWidget(Element element) {
         setElement(element);
      }
   }

   /**
    * @wbp.factory
    */
   public static Widget getFirstNote() {
      Widget widget = new MyWidget(DOM.createDiv());
      Element note = DOM.createElement("p");
      DOM.setInnerText(note, "The first P inside the note");
      DOM.appendChild(widget.getElement(), note);
      return widget;
   }

   /**
    * @wbp.factory
    */
   public static Widget getSecondNote() {
      Widget widget = new MyWidget(DOM.createDiv());
      Element h = DOM.createElement("h2");
      DOM.setInnerText(h, "Note");
      DOM.appendChild(widget.getElement(), h);
      Element note = DOM.createElement("p");
      DOM.setInnerText(note, "The first P inside the note");
      DOM.appendChild(widget.getElement(), note);
      return widget;
   }

   private Widget firstSample;

   private Widget secondSample;

   public void onModuleLoad() {
      RootPanel rootPanel = RootPanel.get();

      firstSample = getFirstNote();
      firstSample.setStyleName("note");
      rootPanel.add(firstSample);

      secondSample = getSecondNote();
      secondSample.setStyleName("note");
      rootPanel.add(secondSample);

   }
}


the results are the same,

regards,
Peter
Peter Blazejewicz
GWT groups profile
peterblazejewicz
 
Posts: 153
Joined: Fri Jul 27, 2007 7:09 pm
Location: Europe/Poland/Warsaw

Re: Design view Windows/IE strict modes support

Postby Alexander.Mitin » Thu Mar 13, 2008 1:44 pm

The results are the same because the GWT Designer does not use your html file to render designed UI. It uses it's own customized html which is suitable for design purposes, such as maintaining image loading, css changes applying, cross-platform support, etc.
The latest build contains the code which copies doctype declaration from user's html into GWT Designers one, so your test project works as expected. But since the GWT doesn't support strict mode you may experience different issues, ex., incorrect bounds for widgets in design pane.
We schedule support strict mode at the date of GWT 1.5 released.
Alexander Mitin
Alexander.Mitin
Moderator
 
Posts: 155
Joined: Fri Jan 19, 2007 3:57 am

Re: Design view Windows/IE strict modes support

Postby peterblazejewicz » Thu Mar 13, 2008 1:57 pm

hi Alexander,

#1
The latest build contains the code which copies doctype declaration from user's html into GWT Designers one,

so should I update Designer build and retest that topic?

#2
But since the GWT doesn't support strict mode you may experience different issues,

please see previous post. GWT toolkit UI implementation is based on quirks mode which does not exclude strict mode (HTML/XHTML) support if someone choose it (and knows things about it), e.g. to support SVG rendering. Simply default widgets (or widgets from GWT-EXT/MyGWT) are built with some base design decision in mind (quirks mode view, A-grade browser support included or excluded, etc). GWT toolkit is just a tool to transcode java to javascript. If I write my own implementation for something it is supposed to run in strict mode even if GWT Toolkit is used for it,

regards,
Peter
Peter Blazejewicz
GWT groups profile
peterblazejewicz
 
Posts: 153
Joined: Fri Jul 27, 2007 7:09 pm
Location: Europe/Poland/Warsaw

Re: Design view Windows/IE strict modes support

Postby peterblazejewicz » Thu Mar 13, 2008 3:19 pm

peterblazejewicz wrote:hi Alexander,
#1
The latest build contains the code which copies doctype declaration from user's html into GWT Designers one,

so should I update Designer build and retest that topic?


Hi all,

after update to recent build it renders ok (I guess because that part of html page is read):

updatedDesignView.png
updatedDesignView.png (22.8 KiB) Viewed 1601 times


However I've got another issue: I cannot resize root canvas size (you know what I mean), Even if dragged by resize handle(s) it goes back to original dimensions (I've left resize handles on screenshots to show area rendered in design view,

regards,
Peter
Peter Blazejewicz
GWT groups profile
peterblazejewicz
 
Posts: 153
Joined: Fri Jul 27, 2007 7:09 pm
Location: Europe/Poland/Warsaw

Re: Design view Windows/IE strict modes support

Postby Alexander.Mitin » Fri Mar 14, 2008 8:05 am

The problem is that the IE behaviour is very different in strict mode. As I've expected, the bounds for the widgets are incorrect (in this case it is the RootPane's bounds), so it can't be resized propertly.
What should we do?
1. Revert the changes back and leave the GWTD as it was before my patch yesterday. You will complain I guess. ;)
2. Try to support both "strict" and "quirks" mode. This will require implementing support for 3 additional 'browsers': strict mode IE, strict mode FF and strict mode Safari (I'm just not saying about swarm of different doctype declarations, each will require additional testing on three platforms). The FF and Safari are more standard in quirks mode according to http://hsivonen.iki.fi/doctype. Also it would require the knowlegde about which browser is currently running, I have no idea how to be 100% sure that it is the IE6, IE7 or maybe the user is a hardcore hacker and has installed the IE8 alpha (and not just change IE6's User-Agent property value).
3. Forcibly switch the browser into "strict" mode and work only using this mode. This will work fully only using GWT 1.5. Then users who prefer "quirks" mode will complain. ;)
Alexander Mitin
Alexander.Mitin
Moderator
 
Posts: 155
Joined: Fri Jan 19, 2007 3:57 am

Re: Design view Windows/IE strict modes support

Postby peterblazejewicz » Fri Mar 14, 2008 12:02 pm

hi Alexander,

I've believe that you will choose most inobstrusive way for us :D I could bet that most of us will follow toolkit modes support choosen now and in future,
thankfully from what I know from OSX i can use any mode in GWTD :-D

NOW: Workaround for poor windows os users:
Use current build if you are interested in using XHTML: put your main page into composite for layout purposes (e.g. to preview design, how components fits together, etc):

quick test case show:

using the same source code implementation now to create composite holder:
Code: Select all
package com.mycompany.project.client;

import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.Widget;

public class NotesComposite extends Composite {
   static class MyWidget extends Widget {
      public MyWidget(Element element) {
         setElement(element);
      }
   }

   /**
    * @wbp.factory
    */
   public static Widget getFirstNote() {
      Widget widget = new MyWidget(DOM.createDiv());
      Element note = DOM.createElement("p");
      DOM.setInnerText(note, "The first P inside the note");
      DOM.appendChild(widget.getElement(), note);
      return widget;
   }

   /**
    * @wbp.factory
    */
   public static Widget getSecondNote() {
      Widget widget = new MyWidget(DOM.createDiv());
      Element h = DOM.createElement("h2");
      DOM.setInnerText(h, "Note");
      DOM.appendChild(widget.getElement(), h);
      Element note = DOM.createElement("p");
      DOM.setInnerText(note, "The first P inside the note");
      DOM.appendChild(widget.getElement(), note);
      return widget;
   }

   private Widget firstSample;
   private Widget secondSample;
   private FlowPanel notes;

   public NotesComposite() {

      notes = new FlowPanel();
      initWidget(notes);
      firstSample = getFirstNote();
      firstSample.setStyleName("note");
      notes.add(firstSample);

      secondSample = getSecondNote();
      secondSample.setStyleName("note");
      notes.add(secondSample);
   }

}


and here is screenshot:

compositeView.png
example code shown as rendered in composite widget
compositeView.png (47.94 KiB) Viewed 1574 times


Also note that I don't requested strict mode support (XHTML to be *strict*), I've asked how GWTD deals with that mode and I think your answers are reasonable and fine for someone interested in topic (after discussing gwt toolkit mode supports we have moved to exact subject). I've simply noticed few quirks during last month (example I made months back does not render at all in GWTD now, 3rd party .css and html design wasn't rendered in buidls from february, etc) so I wanted to make sure,
Thankfully I'm to receive IntelMac next week so I wan't be dealing with IExplore all day :-D (hosted mode in GWT, canvas in GWTD),

thanks for researching issue and all answers, for me topic is closed,
regards,
Peter
Peter Blazejewicz
GWT groups profile
peterblazejewicz
 
Posts: 153
Joined: Fri Jul 27, 2007 7:09 pm
Location: Europe/Poland/Warsaw

Re: Design view Windows/IE strict modes support

Postby Eric Clayberg » Tue Mar 18, 2008 9:28 pm

peterblazejewicz wrote:thanks for researching issue and all answers, for me topic is closed

Sounds good. Let us know if we need to re-open the issue later.
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: [solved] Design view Windows/IE strict modes support

Postby peterblazejewicz » Mon Apr 07, 2008 9:04 am

hi guys,

for your reference:
Here is how GWTD (current 4.*.* build) works with rendering strict mode on OSX/Leopard/JVM1.5.0_13/GWT1.4.61),

#1
generate default project with default entry point, here is screenshot:
quirksMode.png
quirksMode.png (11.73 KiB) Viewed 1496 times


generated html is like:

Code: Select all
<html>
    <head>
        <meta name='gwt:module' content= 'com.mycompany.project.ImageViewer'>
        <link type="text/css" rel='stylesheet' href= 'ImageViewer.css'>
    </head>
    <body>
        <script type="text/javascript" language="javascript" src= "com.mycompany.project.ImageViewer.nocache.js">
        </script>
        <iframe id="__gwt_historyFrame" style="width:0;height:0;border:0">
        </iframe>
    </body>
</html>

(comments removed)

#2
now switch to strict mode (xhtml) and - boom - root panel is collapsed (it has no vertical dimensions):
strictMode.png
strictMode.png (11.22 KiB) Viewed 1495 times


html code is:
Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta name='gwt:module' content= 'com.mycompany.project.ImageViewer'>
        <link type="text/css" rel='stylesheet' href= 'ImageViewer.css'>
    </head>
    <body>
        <script type="text/javascript" language="javascript" src= "com.mycompany.project.ImageViewer.nocache.js">
        </script>
        <iframe id="__gwt_historyFrame" style="width:0;height:0;border:0">
        </iframe>
    </body>
</html>


all examples use default entry point generated code:
Code: Select all
package com.mycompany.project.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.Widget;

/**
* Entry point classes define <code>onModuleLoad()</code>.
*/
public class ImageViewer implements EntryPoint {
   private Button clickMeButton;

   public void onModuleLoad() {
      RootPanel rootPanel = RootPanel.get();

      clickMeButton = new Button();
      rootPanel.add(clickMeButton);
      clickMeButton.setText("Click me!");
      clickMeButton.addClickListener(new ClickListener() {
         public void onClick(Widget sender) {
            Window.alert("Hello, GWT World!");
         }
      });
   }
}


when I remove button from root panel then actually I won't be able to add widgets to design canvas (becuase it will be collapsed). To add widgets I need to use property editor widget UI tree,


regards,
Peter
Peter Blazejewicz
GWT groups profile
peterblazejewicz
 
Posts: 153
Joined: Fri Jul 27, 2007 7:09 pm
Location: Europe/Poland/Warsaw

Re: [solved] Design view Windows/IE strict modes support

Postby Alexander.Mitin » Tue Apr 15, 2008 5:58 am

This possibly means that we should remove the "support" for strict mode.
Alexander Mitin
Alexander.Mitin
Moderator
 
Posts: 155
Joined: Fri Jan 19, 2007 3:57 am

Re: [solved] Design view Windows/IE strict modes support

Postby peterblazejewicz » Tue Apr 15, 2008 10:50 am

hi Alexander,

I understand, however you will never know. For example I'm currently doing everything in strict mode because i'm not using ui elements from GWT toolkit (or related 3rd party libs) and nearly everything is based on standards (I've concentrated on "niche" targets).
What I've found that "strict" HTML 4.1 works nearly fine in GWTD, only XHTML causes issues,
I understand that main feature of GWTD is to give best support for things that are available in GWT toolkit,

regards,
Peter
Peter Blazejewicz
GWT groups profile
peterblazejewicz
 
Posts: 153
Joined: Fri Jul 27, 2007 7:09 pm
Location: Europe/Poland/Warsaw

Re: [solved] Design view Windows/IE strict modes support

Postby Eric Clayberg » Thu Apr 17, 2008 5:23 am

peterblazejewicz wrote:What I've found that "strict" HTML 4.1 works nearly fine in GWTD, only XHTML causes issues

We'll keep that in mind.
peterblazejewicz wrote:I understand that main feature of GWTD is to give best support for things that are available in GWT toolkit,

True. That is certainly our goal.
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 3 guests