From fb30fffdcb4c1e1e07e4ec8c1dc68f8104c911ee Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Mon, 25 Mar 2013 23:31:19 +0200 Subject: Enable setting default alignment for VerticalLayout, HorizontalLayout, GridLayout (#11421) Change-Id: I56b14a6a027dc700748f2bd7219b47e1134bb56a --- .../src/com/vaadin/ui/AbstractOrderedLayout.java | 28 +++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'server/src/com/vaadin/ui/AbstractOrderedLayout.java') diff --git a/server/src/com/vaadin/ui/AbstractOrderedLayout.java b/server/src/com/vaadin/ui/AbstractOrderedLayout.java index 8c2f86926d..b06b2e0871 100644 --- a/server/src/com/vaadin/ui/AbstractOrderedLayout.java +++ b/server/src/com/vaadin/ui/AbstractOrderedLayout.java @@ -53,6 +53,8 @@ public abstract class AbstractOrderedLayout extends AbstractLayout implements */ protected LinkedList components = new LinkedList(); + private Alignment defaultComponentAlignment = Alignment.TOP_LEFT; + /* Child component alignments */ /** @@ -147,7 +149,9 @@ public abstract class AbstractOrderedLayout extends AbstractLayout implements } private void componentAdded(Component c) { - getState().childData.put(c, new ChildComponentData()); + ChildComponentData ccd = new ChildComponentData(); + ccd.alignmentBitmask = getDefaultComponentAlignment().getBitMask(); + getState().childData.put(c, ccd); } /** @@ -417,4 +421,26 @@ public abstract class AbstractOrderedLayout extends AbstractLayout implements public void setMargin(MarginInfo marginInfo) { getState().marginsBitmask = marginInfo.getBitMask(); } + + /* + * (non-Javadoc) + * + * @see com.vaadin.ui.Layout.AlignmentHandler#getDefaultComponentAlignment() + */ + @Override + public Alignment getDefaultComponentAlignment() { + return defaultComponentAlignment; + } + + /* + * (non-Javadoc) + * + * @see + * com.vaadin.ui.Layout.AlignmentHandler#setDefaultComponentAlignment(com + * .vaadin.ui.Alignment) + */ + public void setDefaultComponentAlignment(Alignment defaultAlignment) { + defaultComponentAlignment = defaultAlignment; + } + } -- cgit v1.2.3