aboutsummaryrefslogtreecommitdiffstats
path: root/src/com/itmill
diff options
context:
space:
mode:
authorMatti Tahvonen <matti.tahvonen@itmill.com>2009-05-04 13:44:14 +0000
committerMatti Tahvonen <matti.tahvonen@itmill.com>2009-05-04 13:44:14 +0000
commit6dceb4332e13e1d2377b04eac9746bc4e235479a (patch)
tree9c36e13a7663c16445b7aeee67e82dcbb60b7f46 /src/com/itmill
parent7334a8f060de0bd1fde66344783ff3ed365a55d1 (diff)
downloadvaadin-framework-6dceb4332e13e1d2377b04eac9746bc4e235479a.tar.gz
vaadin-framework-6dceb4332e13e1d2377b04eac9746bc4e235479a.zip
basic caption implementation for iabsolutelayout
svn changeset:7615/svn branch:6.0
Diffstat (limited to 'src/com/itmill')
-rw-r--r--src/com/itmill/toolkit/terminal/gwt/client/ui/IAbsoluteLayout.java49
1 files changed, 43 insertions, 6 deletions
diff --git a/src/com/itmill/toolkit/terminal/gwt/client/ui/IAbsoluteLayout.java b/src/com/itmill/toolkit/terminal/gwt/client/ui/IAbsoluteLayout.java
index 8b10854959..a64a41fa7f 100644
--- a/src/com/itmill/toolkit/terminal/gwt/client/ui/IAbsoluteLayout.java
+++ b/src/com/itmill/toolkit/terminal/gwt/client/ui/IAbsoluteLayout.java
@@ -18,6 +18,7 @@ import com.google.gwt.user.client.ui.Widget;
import com.itmill.toolkit.terminal.gwt.client.ApplicationConnection;
import com.itmill.toolkit.terminal.gwt.client.BrowserInfo;
import com.itmill.toolkit.terminal.gwt.client.Container;
+import com.itmill.toolkit.terminal.gwt.client.ICaption;
import com.itmill.toolkit.terminal.gwt.client.Paintable;
import com.itmill.toolkit.terminal.gwt.client.RenderSpace;
import com.itmill.toolkit.terminal.gwt.client.UIDL;
@@ -113,8 +114,9 @@ public class IAbsoluteLayout extends ComplexPanel implements Container {
}
public void updateCaption(Paintable component, UIDL uidl) {
- // TODO Auto-generated method stub
-
+ AbsoluteWrapper parent2 = (AbsoluteWrapper) ((Widget) component)
+ .getParent();
+ parent2.updateCaption(uidl);
}
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
@@ -189,9 +191,10 @@ public class IAbsoluteLayout extends ComplexPanel implements Container {
private void relayoutRelativeChildren() {
for (Widget widget : getChildren()) {
- if (widget instanceof Paintable) {
- Paintable new_name = (Paintable) widget;
- client.handleComponentRelativeSize(widget);
+ if (widget instanceof AbsoluteWrapper) {
+ AbsoluteWrapper w = (AbsoluteWrapper) widget;
+ client.handleComponentRelativeSize(w.getWidget());
+ w.updateCaptionPosition();
}
}
}
@@ -213,7 +216,9 @@ public class IAbsoluteLayout extends ComplexPanel implements Container {
private void relayoutWrappersForIe6() {
for (Widget wrapper : getChildren()) {
- ((AbsoluteWrapper) wrapper).ie6Layout();
+ if (wrapper instanceof AbsoluteWrapper) {
+ ((AbsoluteWrapper) wrapper).ie6Layout();
+ }
}
}
@@ -226,13 +231,35 @@ public class IAbsoluteLayout extends ComplexPanel implements Container {
private String zIndex;
private Paintable paintable;
+ private ICaption caption;
public AbsoluteWrapper(Paintable paintable) {
this.paintable = paintable;
setStyleName(CLASSNAME + "-wrapper");
}
+ public void updateCaption(UIDL uidl) {
+
+ boolean captionIsNeeded = ICaption.isNeeded(uidl);
+ if (captionIsNeeded) {
+ if (caption == null) {
+ caption = new ICaption(paintable, client);
+ IAbsoluteLayout.this.add(caption);
+ }
+ caption.updateCaption(uidl);
+ updateCaptionPosition();
+ } else {
+ if (caption != null) {
+ caption.removeFromParent();
+ caption = null;
+ }
+ }
+ }
+
public void destroy() {
+ if (caption != null) {
+ caption.removeFromParent();
+ }
client.unregisterPaintable(paintable);
removeFromParent();
}
@@ -285,7 +312,17 @@ public class IAbsoluteLayout extends ComplexPanel implements Container {
ie6Layout();
}
}
+ updateCaptionPosition();
+ }
+ private void updateCaptionPosition() {
+ if (caption != null) {
+ Style style = caption.getElement().getStyle();
+ style.setProperty("position", "absolute");
+ style.setPropertyPx("left", getElement().getOffsetLeft());
+ style.setPropertyPx("top", getElement().getOffsetTop()
+ - caption.getHeight());
+ }
}
private void ie6Layout() {