using offsetHeight/offsetWidth in design view [IE/Windows]

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

using offsetHeight/offsetWidth in design view [IE/Windows]

Postby peterblazejewicz » Mon Feb 25, 2008 1:34 pm

hi,

is there a way to make widget based on subcomponents which are resized according to parent component size using "offsetHeight" properties to work in design view?

here is example code:
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.Widget;

public class TestPanel extends Widget {
  Element header;
  Element body;
  Element footer;

  public TestPanel() {
    setElement(DOM.createDiv());
    DOM.setStyleAttribute(getElement(), "border", "1px solid #666666");
    header = DOM.createDiv();
    setText(header, "header");
    DOM.appendChild(getElement(), header);
    DOM.setStyleAttribute(header, "backgroundColor", "yellow");
    body = DOM.createDiv();
    setText(body, "body");
    DOM.appendChild(getElement(), body);
    DOM.setStyleAttribute(body, "backgroundColor", "red");
    footer = DOM.createDiv();
    setText(footer, "footer");
    DOM.appendChild(getElement(), footer);
    DOM.setStyleAttribute(footer, "backgroundColor", "yellow");
  }

  private void setText(Element element, String text) {
    DOM.setInnerText(element, text);
  }

  /* @Override */
  public void setHeight(String height) {
    super.setHeight(height);
    updateBodyHeight();
  }

  private void updateBodyHeight() {
    int pHeight = getOffsetHeight();
    int hHeight = DOM.getElementPropertyInt(header, "offsetHeight");
    int fHeight = DOM.getElementPropertyInt(footer, "offsetHeight");
    int bH = pHeight - hHeight - fHeight;
    setText(header, pHeight + ":" + hHeight + ":" + fHeight + ":" + bH);
    DOM.setStyleAttribute(body, "height", bH + "");
  }
}


body content (red color) should be resized to fill parent content, header/footer are left as is,
this is like common Panel UI is modelled,
the required Designer view is inverted Spain flag colors (y/r/y) and it works in hosted mode but fails in design view when red area take all available height,

I could upload .zip-ped designer project but code just works without errors,
use in entry point:
Code: Select all
/**
* Entry point classes define <code>onModuleLoad()</code>.
*/
public class TestPanelHeight implements EntryPoint {
   public void onModuleLoad() {
      RootPanel rootPanel = RootPanel.get();
      final TestPanel testPanel = new TestPanel();
      rootPanel.add(testPanel, 5, 5);
      testPanel.setSize("320px", "240px");
   }
}


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

Re: using offsetHeight/offsetWidth in design view [IE/Windows]

Postby Eric Clayberg » Fri Feb 29, 2008 1:37 pm

We have not been able to make this work.

There appear to be some low level GWT bugs that are preventing this from working correctly.

We are investigating possible work arounds.
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: using offsetHeight/offsetWidth in design view [IE/Windows]

Postby peterblazejewicz » Fri Feb 29, 2008 1:45 pm

hi Eric,

thanks, this is just rudimentary panel-like widget with api that should be use to measure height at runtime for subcomponents,
I'll test on OSX and let you know how it works,

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

Re: using offsetHeight/offsetWidth in design view [IE/Windows]

Postby Eric Clayberg » Fri Mar 07, 2008 12:36 pm

Further investigation and testing indicates that this is definitely caused by some low level GWT bugs.

We still don't have a work around yet.
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: using offsetHeight/offsetWidth in design view [IE/Windows]

Postby roger » Thu Mar 20, 2008 3:02 pm

Works perfectly for me. Very good example.
roger
 
Posts: 3
Joined: Thu Mar 20, 2008 2:21 pm

Re: using offsetHeight/offsetWidth in design view [IE/Windows]

Postby Eric Clayberg » Fri Mar 21, 2008 5:01 pm

roger wrote:Works perfectly for me. Very good example.

Using what exact configuration?
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: using offsetHeight/offsetWidth in design view [IE/Windows]

Postby roger » Mon Mar 24, 2008 10:13 am

Take any GWT example.
1. Put the 2 classes mentioned in the example in your client package.
2. Modify your .gwt.xml file to point to the entry point class, mine looks like this:
<entry-point class='com.mycompany.client.TestPanelHeight'/>
3. Run your app specific *-shell script and you should see the example working.
roger
 
Posts: 3
Joined: Thu Mar 20, 2008 2:21 pm

Re: using offsetHeight/offsetWidth in design view [IE/Windows]

Postby Eric Clayberg » Mon Mar 24, 2008 10:23 am

Using what configuration of GWT, GWT Designer, OS, IE, JDK, etc.?
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: using offsetHeight/offsetWidth in design view [IE/Windows]

Postby roger » Mon Mar 24, 2008 11:37 am

GWT version: gwt-linux-1.4.61
OS: Redhat Enterprise Linux(2.6.9-34.EL)
Firefox: 2.0
java version : "1.6.0_04"
roger
 
Posts: 3
Joined: Thu Mar 20, 2008 2:21 pm

Re: using offsetHeight/offsetWidth in design view [IE/Windows]

Postby Eric Clayberg » Mon Mar 24, 2008 11:46 am

roger wrote:GWT version: gwt-linux-1.4.61
OS: Redhat Enterprise Linux(2.6.9-34.EL)
Firefox: 2.0
java version : "1.6.0_04"

Good. As indicated by the title of the thread, this is an IE/Windows issue.
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