summaryrefslogtreecommitdiffstats
path: root/server/src/com/vaadin/ui/AbstractOrderedLayout.java
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/com/vaadin/ui/AbstractOrderedLayout.java')
-rw-r--r--server/src/com/vaadin/ui/AbstractOrderedLayout.java53
1 files changed, 30 insertions, 23 deletions
diff --git a/server/src/com/vaadin/ui/AbstractOrderedLayout.java b/server/src/com/vaadin/ui/AbstractOrderedLayout.java
index a7cc780414..596bbb7ee2 100644
--- a/server/src/com/vaadin/ui/AbstractOrderedLayout.java
+++ b/server/src/com/vaadin/ui/AbstractOrderedLayout.java
@@ -25,6 +25,7 @@ import com.vaadin.event.LayoutEvents.LayoutClickNotifier;
import com.vaadin.shared.Connector;
import com.vaadin.shared.EventId;
import com.vaadin.shared.MouseEventDetails;
+import com.vaadin.shared.ui.MarginInfo;
import com.vaadin.shared.ui.orderedlayout.AbstractOrderedLayoutServerRpc;
import com.vaadin.shared.ui.orderedlayout.AbstractOrderedLayoutState;
import com.vaadin.shared.ui.orderedlayout.AbstractOrderedLayoutState.ChildComponentData;
@@ -32,7 +33,8 @@ import com.vaadin.terminal.Sizeable;
@SuppressWarnings("serial")
public abstract class AbstractOrderedLayout extends AbstractLayout implements
- Layout.AlignmentHandler, Layout.SpacingHandler, LayoutClickNotifier {
+ Layout.AlignmentHandler, Layout.SpacingHandler, LayoutClickNotifier,
+ Layout.MarginHandler {
private AbstractOrderedLayoutServerRpc rpc = new AbstractOrderedLayoutServerRpc() {
@@ -61,7 +63,7 @@ public abstract class AbstractOrderedLayout extends AbstractLayout implements
}
@Override
- public AbstractOrderedLayoutState getState() {
+ protected AbstractOrderedLayoutState getState() {
return (AbstractOrderedLayoutState) super.getState();
}
@@ -142,13 +144,10 @@ public abstract class AbstractOrderedLayout extends AbstractLayout implements
private void componentRemoved(Component c) {
getState().getChildData().remove(c);
- requestRepaint();
}
private void componentAdded(Component c) {
getState().getChildData().put(c, new ChildComponentData());
- requestRepaint();
-
}
/**
@@ -226,23 +225,10 @@ public abstract class AbstractOrderedLayout extends AbstractLayout implements
components.add(newLocation, oldComponent);
}
- requestRepaint();
+ markAsDirty();
}
}
- /*
- * (non-Javadoc)
- *
- * @see com.vaadin.ui.Layout.AlignmentHandler#setComponentAlignment(com
- * .vaadin.ui.Component, int, int)
- */
- @Override
- public void setComponentAlignment(Component childComponent,
- int horizontalAlignment, int verticalAlignment) {
- Alignment a = new Alignment(horizontalAlignment + verticalAlignment);
- setComponentAlignment(childComponent, a);
- }
-
@Override
public void setComponentAlignment(Component childComponent,
Alignment alignment) {
@@ -251,7 +237,6 @@ public abstract class AbstractOrderedLayout extends AbstractLayout implements
if (childData != null) {
// Alignments are bit masks
childData.setAlignmentBitmask(alignment.getBitMask());
- requestRepaint();
} else {
throw new IllegalArgumentException(
"Component must be added to layout before using setComponentAlignment()");
@@ -285,7 +270,6 @@ public abstract class AbstractOrderedLayout extends AbstractLayout implements
@Override
public void setSpacing(boolean spacing) {
getState().setSpacing(spacing);
- requestRepaint();
}
/*
@@ -335,8 +319,7 @@ public abstract class AbstractOrderedLayout extends AbstractLayout implements
}
childData.setExpandRatio(ratio);
- requestRepaint();
- };
+ }
/**
* Returns the expand ratio of given component.
@@ -392,4 +375,28 @@ public abstract class AbstractOrderedLayout extends AbstractLayout implements
return components.get(index);
}
+ @Override
+ public void setMargin(boolean enabled) {
+ setMargin(new MarginInfo(enabled));
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.ui.Layout.MarginHandler#getMargin()
+ */
+ @Override
+ public MarginInfo getMargin() {
+ return new MarginInfo(getState().getMarginsBitmask());
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.ui.Layout.MarginHandler#setMargin(MarginInfo)
+ */
+ @Override
+ public void setMargin(MarginInfo marginInfo) {
+ getState().setMarginsBitmask(marginInfo.getBitMask());
+ }
}