Fixed iLayout in several components so it does not run iLayout for its children (this is done automatically by runDescendentsLayout). svn changeset:5910/svn branch:trunktags/6.7.0.beta1
@@ -657,7 +657,8 @@ public class ApplicationConnection { | |||
} | |||
if (html.length() != 0) { | |||
INotification n = new INotification(1000 * 60 * 45); //45min | |||
/* 45 min */ | |||
INotification n = new INotification(1000 * 60 * 45); | |||
n.addEventListener(new NotificationRedirect(url)); | |||
n.show(html, INotification.CENTERED_TOP, | |||
INotification.STYLE_SYSTEM); | |||
@@ -1085,7 +1086,21 @@ public class ApplicationConnection { | |||
* | |||
* @param container | |||
*/ | |||
private boolean runningLayout = false; | |||
public void runDescendentsLayout(HasWidgets container) { | |||
if (runningLayout) { | |||
// getConsole().log( | |||
// "Already running descendents layout. Not running again for " | |||
// + Util.getSimpleName(container)); | |||
return; | |||
} | |||
runningLayout = true; | |||
internalRunDescendentsLayout(container); | |||
runningLayout = false; | |||
} | |||
private void internalRunDescendentsLayout(HasWidgets container) { | |||
// getConsole().log( | |||
// "runDescendentsLayout(" + Util.getSimpleName(container) + ")"); | |||
final Iterator childWidgets = container.iterator(); | |||
@@ -1104,12 +1119,12 @@ public class ApplicationConnection { | |||
((ContainerResizedListener) child).iLayout(); | |||
} else if (child instanceof HasWidgets) { | |||
final HasWidgets childContainer = (HasWidgets) child; | |||
runDescendentsLayout(childContainer); | |||
internalRunDescendentsLayout(childContainer); | |||
} | |||
} | |||
} else if (child instanceof HasWidgets) { | |||
// propagate over non Paintable HasWidgets | |||
runDescendentsLayout((HasWidgets) child); | |||
internalRunDescendentsLayout((HasWidgets) child); | |||
} | |||
} |
@@ -13,6 +13,7 @@ import com.google.gwt.user.client.Command; | |||
import com.google.gwt.user.client.DOM; | |||
import com.google.gwt.user.client.DeferredCommand; | |||
import com.google.gwt.user.client.Element; | |||
import com.google.gwt.user.client.Window; | |||
import com.google.gwt.user.client.ui.RootPanel; | |||
import com.google.gwt.user.client.ui.Widget; | |||
import com.itmill.toolkit.terminal.gwt.client.RenderInformation.FloatSize; | |||
@@ -404,4 +405,11 @@ public class Util { | |||
public static boolean isCached(UIDL uidl) { | |||
return uidl.getBooleanAttribute("cached"); | |||
} | |||
public static void alert(String string) { | |||
if (true) { | |||
Window.alert(string); | |||
} | |||
} | |||
} |
@@ -154,6 +154,9 @@ public class IAccordion extends ITabsheetBase implements | |||
if (index != activeTabIndex) { | |||
open(index); | |||
iLayout(); | |||
// TODO Check if this is needed | |||
client.runDescendentsLayout(this); | |||
} | |||
item.setContent(contentUidl); | |||
} | |||
@@ -258,8 +261,6 @@ public class IAccordion extends ITabsheetBase implements | |||
openTab.setWidth(maxWidth); | |||
} | |||
client.runDescendentsLayout(openTab); | |||
Util.runWebkitOverflowAutoFix(openTab.getContainerElement()); | |||
} | |||
@@ -504,6 +505,9 @@ public class IAccordion extends ITabsheetBase implements | |||
* new size. | |||
*/ | |||
iLayout(); | |||
// TODO Check if this is needed | |||
client.runDescendentsLayout(this); | |||
return false; | |||
} else { | |||
/* |
@@ -193,6 +193,8 @@ public class ICoordinateLayout extends ComplexPanel implements Container, | |||
// Make sure coordinateLayout gets done every time | |||
iLayout(); | |||
// TODO Check if this is needed | |||
client.runDescendentsLayout(this); | |||
}// updateFromUIDL | |||
@@ -339,8 +341,6 @@ public class ICoordinateLayout extends ComplexPanel implements Container, | |||
} | |||
} | |||
// Run layout functions for children | |||
client.runDescendentsLayout(this); | |||
} | |||
toUpdate.clear(); |
@@ -140,6 +140,8 @@ public class ICustomLayout extends ComplexPanel implements Paintable, | |||
scripts = null; | |||
iLayout(); | |||
// TODO Check if this is needed | |||
client.runDescendentsLayout(this); | |||
Set oldWidgets = new HashSet(); | |||
oldWidgets.addAll(locationToWidget.values()); | |||
@@ -169,6 +171,9 @@ public class ICustomLayout extends ComplexPanel implements Paintable, | |||
} | |||
iLayout(); | |||
// TODO Check if this is needed | |||
client.runDescendentsLayout(this); | |||
} | |||
/** Initialize HTML-layout. */ | |||
@@ -416,9 +421,7 @@ public class ICustomLayout extends ComplexPanel implements Paintable, | |||
} | |||
public void iLayout() { | |||
if (!iLayoutJS(DOM.getFirstChild(getElement()))) { | |||
client.runDescendentsLayout(this); | |||
} | |||
iLayoutJS(DOM.getFirstChild(getElement())); | |||
} | |||
/** |
@@ -123,6 +123,8 @@ public class IForm extends ComplexPanel implements Container, | |||
} | |||
iLayout(); | |||
// TODO Check if this is needed | |||
client.runDescendentsLayout(this); | |||
final UIDL layoutUidl = uidl.getChildUIDL(0); | |||
Container newLo = (Container) client.getPaintable(layoutUidl); | |||
@@ -169,8 +171,6 @@ public class IForm extends ComplexPanel implements Container, | |||
renderInformation.setContentAreaWidth(renderInformation | |||
.getRenderedSize().getWidth() | |||
- borderPaddingHorizontal); | |||
client.runDescendentsLayout(this); | |||
} | |||
public RenderSpace getAllocatedSpace(Widget child) { |
@@ -189,9 +189,10 @@ public class IOrderedLayout extends CellBasedLayout { | |||
// w.mark("recalculateComponentSizesAndAlignments done"); | |||
/* Must inform child components about possible size updates */ | |||
client.runDescendentsLayout(this); | |||
// if (isDynamicHeight() || isDynamicWidth()) { | |||
// client.runDescendentsLayout(this); | |||
// } | |||
// w.mark("runDescendentsLayout done"); | |||
isRendering = false; | |||
} | |||
@@ -263,8 +264,19 @@ public class IOrderedLayout extends CellBasedLayout { | |||
} | |||
/** | |||
* Updated components with relative height in horizontal layouts and | |||
* components with relative width in vertical layouts. This is only needed | |||
* if the height (horizontal layout) or width (vertical layout) has not been | |||
* specified. | |||
*/ | |||
private void updateRelativeSizesInNonMainDirection() { | |||
int updateDirection = 1 - orientation; | |||
if ((updateDirection == ORIENTATION_HORIZONTAL && !isDynamicWidth()) | |||
|| (updateDirection == ORIENTATION_VERTICAL && !isDynamicHeight())) { | |||
return; | |||
} | |||
for (ChildComponentContainer componentContainer : widgetToComponentContainer | |||
.values()) { | |||
if (componentContainer.isComponentRelativeSized(updateDirection)) { | |||
@@ -635,7 +647,8 @@ public class IOrderedLayout extends CellBasedLayout { | |||
} | |||
if (!isRendering) { | |||
if (recalculateLayoutAndComponentSizes()) { | |||
boolean sameSize = recalculateLayoutAndComponentSizes(); | |||
if (!sameSize) { | |||
/* Must inform child components about possible size updates */ | |||
client.runDescendentsLayout(this); | |||
} | |||
@@ -652,7 +665,8 @@ public class IOrderedLayout extends CellBasedLayout { | |||
} | |||
if (!isRendering) { | |||
if (recalculateLayoutAndComponentSizes()) { | |||
boolean sameSize = recalculateLayoutAndComponentSizes(); | |||
if (!sameSize) { | |||
/* Must inform child components about possible size updates */ | |||
client.runDescendentsLayout(this); | |||
} |
@@ -151,8 +151,6 @@ public class ISplitPanel extends ComplexPanel implements Container, | |||
return; | |||
} | |||
renderInformation.updateSize(getElement()); | |||
setSplitPosition(uidl.getStringAttribute("position")); | |||
locked = uidl.hasAttribute("locked"); | |||
@@ -182,6 +180,8 @@ public class ISplitPanel extends ComplexPanel implements Container, | |||
newFirstChild.updateFromUIDL(uidl.getChildUIDL(0), client); | |||
newSecondChild.updateFromUIDL(uidl.getChildUIDL(1), client); | |||
renderInformation.updateSize(getElement()); | |||
if (Util.isIE7()) { | |||
// Part III of IE7 hack | |||
DeferredCommand.addCommand(new Command() { | |||
@@ -199,6 +199,9 @@ public class ISplitPanel extends ComplexPanel implements Container, | |||
DOM.setStyleAttribute(splitter, "top", pos); | |||
} | |||
iLayout(); | |||
// TODO Check if this is needed | |||
client.runDescendentsLayout(this); | |||
} | |||
/* | |||
@@ -286,10 +289,6 @@ public class ISplitPanel extends ComplexPanel implements Container, | |||
break; | |||
} | |||
client.runDescendentsLayout(this); | |||
renderInformation.updateSize(getElement()); | |||
// fixes scrollbars sometimes seen on webkit 528.5, but not in Safari | |||
// 3.1 | |||
Util.runWebkitOverflowAutoFix(secondContainer); | |||
@@ -368,6 +367,9 @@ public class ISplitPanel extends ComplexPanel implements Container, | |||
break; | |||
} | |||
iLayout(); | |||
// TODO Check if this is needed | |||
client.runDescendentsLayout(this); | |||
} | |||
private void onHorizontalMouseMove(int x) { |
@@ -19,7 +19,6 @@ import com.google.gwt.user.client.ui.ComplexPanel; | |||
import com.google.gwt.user.client.ui.Label; | |||
import com.google.gwt.user.client.ui.Widget; | |||
import com.itmill.toolkit.terminal.gwt.client.ApplicationConnection; | |||
import com.itmill.toolkit.terminal.gwt.client.ContainerResizedListener; | |||
import com.itmill.toolkit.terminal.gwt.client.ICaption; | |||
import com.itmill.toolkit.terminal.gwt.client.Paintable; | |||
import com.itmill.toolkit.terminal.gwt.client.RenderInformation; | |||
@@ -27,8 +26,7 @@ import com.itmill.toolkit.terminal.gwt.client.RenderSpace; | |||
import com.itmill.toolkit.terminal.gwt.client.UIDL; | |||
import com.itmill.toolkit.terminal.gwt.client.Util; | |||
public class ITabsheet extends ITabsheetBase implements | |||
ContainerResizedListener { | |||
public class ITabsheet extends ITabsheetBase { | |||
class TabBar extends ComplexPanel implements ClickListener { | |||
@@ -146,6 +144,8 @@ public class ITabsheet extends ITabsheetBase implements | |||
*/ | |||
private Widget previousVisibleWidget; | |||
private boolean rendering = false; | |||
private void onTabSelected(final int tabIndex) { | |||
if (disabled || waitingForResponse) { | |||
return; | |||
@@ -256,6 +256,8 @@ public class ITabsheet extends ITabsheetBase implements | |||
} | |||
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { | |||
rendering = true; | |||
super.updateFromUIDL(uidl, client); | |||
// Add proper stylenames for all elements (easier to prevent unwanted | |||
@@ -302,11 +304,12 @@ public class ITabsheet extends ITabsheetBase implements | |||
updateDynamicWidth(); | |||
} | |||
updateTabScroller(); | |||
iLayout(); | |||
renderInformation.updateSize(getElement()); | |||
waitingForResponse = false; | |||
rendering = false; | |||
} | |||
private void updateDynamicWidth() { | |||
@@ -438,8 +441,12 @@ public class ITabsheet extends ITabsheetBase implements | |||
DOM.setStyleAttribute(contentNode, "height", ""); | |||
renderSpace.setHeight(0); | |||
} | |||
updateOpenTabSize(); | |||
iLayout(); | |||
if (!rendering) { | |||
updateOpenTabSize(); | |||
iLayout(); | |||
// TODO Check if this is needed | |||
client.runDescendentsLayout(this); | |||
} | |||
} | |||
public void setWidth(String width) { | |||
@@ -459,17 +466,19 @@ public class ITabsheet extends ITabsheetBase implements | |||
contentNode.getStyle().setProperty("width", contentWidth + "px"); | |||
renderSpace.setWidth(contentWidth); | |||
} | |||
updateOpenTabSize(); | |||
iLayout(); | |||
} | |||
public void iLayout() { | |||
if (client != null) { | |||
if (!rendering) { | |||
updateOpenTabSize(); | |||
iLayout(); | |||
// TODO Check if this is needed | |||
client.runDescendentsLayout(this); | |||
} | |||
updateTabScroller(); | |||
} | |||
public void iLayout() { | |||
updateTabScroller(); | |||
tp.runWebkitOverflowAutoFix(); | |||
} | |||
@@ -590,6 +599,8 @@ public class ITabsheet extends ITabsheetBase implements | |||
* new size. | |||
*/ | |||
iLayout(); | |||
client.runDescendentsLayout(this); | |||
return false; | |||
} else { | |||
/* |
@@ -363,6 +363,7 @@ public class ChildComponentContainer extends Panel { | |||
newCaption = new ICaption((Paintable) widget, client); | |||
// Set initial height to avoid Safari flicker | |||
newCaption.setHeight("18px"); | |||
// newCaption.setHeight(newCaption.getHeight()); // This might be better... ?? | |||
} | |||
boolean positionChanged = newCaption.updateCaption(uidl); |