summaryrefslogtreecommitdiffstats
path: root/server/src/com/vaadin/ui/GridLayout.java
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2012-08-20 19:29:04 +0300
committerArtur Signell <artur@vaadin.com>2012-08-22 13:58:50 +0300
commit667ef9c144bf3522100e5c8eac4d76a3c4faf65b (patch)
tree186994e13b55cda64fc5df96b5464d0905a8006b /server/src/com/vaadin/ui/GridLayout.java
parent514bffe7a6aa2c599ab9f4ba239295d63f229125 (diff)
downloadvaadin-framework-667ef9c144bf3522100e5c8eac4d76a3c4faf65b.tar.gz
vaadin-framework-667ef9c144bf3522100e5c8eac4d76a3c4faf65b.zip
Refactored margin handlers (#8292)
Only layouts actually supporting margins now implement MarginHandler CssLayout should be simplified before 7.0.0 so margin support was removed. GridLayout, VerticalLayout and HorizontalLayout were the only other layouts which actually supported margin. MarginInfo is now passed directly in the state.
Diffstat (limited to 'server/src/com/vaadin/ui/GridLayout.java')
-rw-r--r--server/src/com/vaadin/ui/GridLayout.java38
1 files changed, 36 insertions, 2 deletions
diff --git a/server/src/com/vaadin/ui/GridLayout.java b/server/src/com/vaadin/ui/GridLayout.java
index 5a748c04f6..b31ab82741 100644
--- a/server/src/com/vaadin/ui/GridLayout.java
+++ b/server/src/com/vaadin/ui/GridLayout.java
@@ -30,6 +30,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.gridlayout.GridLayoutServerRpc;
import com.vaadin.shared.ui.gridlayout.GridLayoutState;
import com.vaadin.terminal.LegacyPaint;
@@ -63,8 +64,8 @@ import com.vaadin.terminal.Vaadin6Component;
*/
@SuppressWarnings("serial")
public class GridLayout extends AbstractLayout implements
- Layout.AlignmentHandler, Layout.SpacingHandler, LayoutClickNotifier,
- Vaadin6Component {
+ Layout.AlignmentHandler, Layout.SpacingHandler, Layout.MarginHandler,
+ LayoutClickNotifier, Vaadin6Component {
private GridLayoutServerRpc rpc = new GridLayoutServerRpc() {
@@ -1416,4 +1417,37 @@ public class GridLayout extends AbstractLayout implements
LayoutClickEvent.class, listener);
}
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.ui.Layout.MarginHandler#setMargin(boolean)
+ */
+ @Override
+ public void setMargin(boolean enabled) {
+ setMargin(new MarginInfo(enabled));
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * com.vaadin.ui.Layout.MarginHandler#setMargin(com.vaadin.shared.ui.MarginInfo
+ * )
+ */
+ @Override
+ public void setMargin(MarginInfo marginInfo) {
+ getState().setMarginsBitmask(marginInfo.getBitMask());
+ requestRepaint();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.ui.Layout.MarginHandler#getMargin()
+ */
+ @Override
+ public MarginInfo getMargin() {
+ return new MarginInfo(getState().getMarginsBitmask());
+ }
+
}