<!-- Initialize a nightly build. -->
<target name="nightly-init" depends="">
+ <!-- Mandatory parameters. -->
<fail unless="version.minor" message="The version.minor property must be defined."/>
<fail unless="build.number" message="The build.number property must be defined."/>
<fail unless="nightly.publish" message="The nightly.publish property must be defined."/>
+ <!-- Optional parameters. -->
+ <property name="build.tag" value="dev"/>
+
<!-- We need to create a symlink to the GWT directory, because we -->
<!-- are building automatically. -->
<property name="gwt.link.target" value="../../gwt-1.5"/>
<!-- Create the link unless it already exists. -->
<available file="gwt" property="gwt.link.available"/>
<if>
- <isset property="gwt.link.available"/>
+ <not>
+ <isset property="gwt.link.available"/>
+ </not>
<then>
<echo>${gwt.link.available}</echo>
<symlink link="gwt" resource="${gwt.link.target}" failonerror="false"/>
<tstamp>
<format property="nightly.date" pattern="yyyyMMdd"/>
</tstamp>
- <property name="version" value="${version.minor}-nightly-${nightly.date}-b${build.number}"/>
+ <property name="version" value="${version.minor}-${build.tag}-${nightly.date}-b${build.number}"/>
<echo>##teamcity[buildNumber '${version}']</echo>
</target>
import java.util.Vector;
import com.google.gwt.user.client.ui.Widget;
+import com.itmill.toolkit.terminal.gwt.client.BrowserInfo;
import com.itmill.toolkit.terminal.gwt.client.UIDL;
+import com.itmill.toolkit.terminal.gwt.client.Util;
public class INativeSelect extends IOptionGroupBase implements Field {
select.insertItem("", null, 0);
select.setItemSelected(0, true);
}
-
+ if (BrowserInfo.get().isIE6()) {
+ // lazy size change - IE6 uses naive dropdown that does not have a
+ // proper size yet
+ Util.notifyParentOfSizeChange(this, true);
+ }
}
@Override
private boolean readonly;
+ boolean dynamicWidth = false;
+ boolean dynamicHeight = false;
+ boolean layoutRelativeWidth = false;
+ boolean layoutRelativeHeight = false;
+
+ // If centered (via UIDL), the window should stay in the centered -mode
+ // until a position is received from the server, or the user moves or
+ // resizes the window.
+ boolean centered = false;
+
private RenderSpace renderSpace = new RenderSpace(MIN_WIDTH, MIN_HEIGHT,
true);
layout = lo;
}
- boolean dynamicWidth = !uidl.hasAttribute("width");
- boolean dynamicHeight = !uidl.hasAttribute("height");
- boolean widthHasBeenFixed = false;
+ dynamicWidth = !uidl.hasAttribute("width");
+ dynamicHeight = !uidl.hasAttribute("height");
- boolean layoutRelativeWidth = uidl.hasAttribute("layoutRelativeWidth");
- boolean layoutRelativeHeight = uidl
- .hasAttribute("layoutRelativeHeight");
+ layoutRelativeWidth = uidl.hasAttribute("layoutRelativeWidth");
+ layoutRelativeHeight = uidl.hasAttribute("layoutRelativeHeight");
if (dynamicWidth && layoutRelativeWidth) {
/*
* Relative layout width, fix window width before rendering (width
* according to caption)
*/
- widthHasBeenFixed = true;
setNaturalWidth();
}
* No explicit width is set and the layout does not have relative width
* so fix the size according to the layout.
*/
- if (dynamicWidth && !widthHasBeenFixed) {
+ if (dynamicWidth && !layoutRelativeWidth) {
setNaturalWidth();
- widthHasBeenFixed = true;
}
if (dynamicHeight && layoutRelativeHeight) {
// This has to be here because we might not know the content size before
// everything is painted into the window
if (uidl.getBooleanAttribute("center")) {
+ // mark as centered - this is unset on move/resize
+ centered = true;
center();
+ } else {
+ // don't try to center the window anymore
+ centered = false;
}
updateShadowSizeAndPosition();
naturalWidth = getElement().getOffsetWidth();
headerText.getStyle().setProperty("width", headerW);
} else {
- naturalWidth = getElement().getOffsetWidth();
+ // use max(layout width, window width)
+ // i.e layout content width or caption width
+ int lowidth = contentPanel.getElement().getScrollWidth()
+ + borderWidth; // layout does not know about border
+ int elwidth = getElement().getOffsetWidth();
+ naturalWidth = (lowidth > elwidth ? lowidth : elwidth);
}
setWidth(naturalWidth + "px");
resizing = false;
case Event.ONMOUSEMOVE:
if (resizing) {
+ centered = false;
setSize(event, false);
event.preventDefault();
}
break;
case Event.ONMOUSEMOVE:
if (dragging) {
+ centered = false;
final int x = DOM.eventGetScreenX(event) - startX + origX;
final int y = DOM.eventGetScreenY(event) - startY + origY;
setPopupPosition(x, y);
}
public boolean requestLayout(Set<Paintable> child) {
+ if (dynamicWidth && !layoutRelativeWidth) {
+ setNaturalWidth();
+ }
+ if (centered) {
+ center();
+ }
updateShadowSizeAndPosition();
return true;
}
--- /dev/null
+/**
+ *
+ */
+package com.itmill.toolkit.tests.tickets;
+
+import com.itmill.toolkit.Application;
+import com.itmill.toolkit.ui.HorizontalLayout;
+import com.itmill.toolkit.ui.NativeSelect;
+import com.itmill.toolkit.ui.Window;
+
+/**
+ * @author Risto Yrjänä / IT Mill Ltd.
+ *
+ */
+public class Ticket2742 extends Application {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.itmill.toolkit.Application#init()
+ */
+ @Override
+ public void init() {
+ Window mainWindow = new Window();
+ setMainWindow(mainWindow);
+
+ String shortString = "Short";
+ String longString = "Very, very long";
+
+ HorizontalLayout hl = new HorizontalLayout();
+
+ for (int i = 0; i < 2; i++) {
+ NativeSelect ns = new NativeSelect(shortString);
+ ns.addItem(longString);
+ ns.setNullSelectionAllowed(false);
+ ns.select(longString);
+ hl.addComponent(ns);
+ }
+ mainWindow.addComponent(hl);
+ }
+
+}
\ No newline at end of file