@@ -53,7 +53,7 @@ abstract public class BaseAlignment extends BaseLayoutTestUI { | |||
// TODO Auto-generated catch block | |||
e.printStackTrace(); | |||
} | |||
layout.setHeight("300px"); | |||
layout.setHeight("100px"); | |||
layout.setWidth("200px"); | |||
layout.addComponent(components[i]); | |||
layout.setComponentAlignment(components[i], alignments[i]); |
@@ -65,8 +65,6 @@ public class BaseLayoutExpand extends BaseLayoutTestUI { | |||
} | |||
Table t1 = getTestTable(); | |||
Table t2 = getTestTable(); | |||
t1.setSizeFull(); | |||
t2.setSizeFull(); | |||
l2.addComponent(t1); | |||
l2.addComponent(t2); | |||
@@ -48,8 +48,6 @@ public class BaseLayoutForSpacingMargin extends BaseLayoutTestUI { | |||
private void buildLayout() { | |||
Table t1 = getTestTable(); | |||
Table t2 = getTestTable(); | |||
t1.setSizeFull(); | |||
t2.setSizeFull(); | |||
l2.addComponent(t1); | |||
l2.setMargin(false); | |||
l2.setSpacing(false); |
@@ -45,11 +45,11 @@ public abstract class BaseLayoutTestUI extends AbstractTestUI { | |||
protected static final String CALENDAR_32_PNG = "../runo/icons/16/calendar.png"; | |||
protected static final String LOCK_16_PNG = "../runo/icons/16/lock.png"; | |||
protected static final String GLOBE_16_PNG = "../runo/icons/16/globe.png"; | |||
public Alignment[] alignments = new Alignment[] { Alignment.TOP_CENTER, | |||
Alignment.TOP_LEFT, Alignment.TOP_RIGHT, Alignment.BOTTOM_CENTER, | |||
Alignment.BOTTOM_LEFT, Alignment.BOTTOM_RIGHT, | |||
Alignment.MIDDLE_CENTER, Alignment.MIDDLE_LEFT, | |||
Alignment.MIDDLE_RIGHT }; | |||
public Alignment[] alignments = new Alignment[] { Alignment.TOP_LEFT, | |||
Alignment.TOP_CENTER, Alignment.TOP_RIGHT, Alignment.MIDDLE_LEFT, | |||
Alignment.MIDDLE_CENTER, Alignment.MIDDLE_RIGHT, | |||
Alignment.BOTTOM_LEFT, Alignment.BOTTOM_CENTER, | |||
Alignment.BOTTOM_RIGHT }; | |||
public final String[] CAPTIONS = new String[] { "", | |||
"VeryLongOneWordCaption", | |||
@@ -93,7 +93,8 @@ public abstract class BaseLayoutTestUI extends AbstractTestUI { | |||
private void fillComponents() { | |||
for (int i = 0; i < components.length; i++) { | |||
String name = "Field" + i; | |||
TextField field = new TextField(); | |||
TextField field = new TextField(alignments[i].getVerticalAlignment() | |||
+ " " + alignments[i].getHorizontalAlignment()); | |||
field.setValue(name); | |||
components[i] = field; | |||
} | |||
@@ -110,9 +111,7 @@ public abstract class BaseLayoutTestUI extends AbstractTestUI { | |||
l2.setMargin(false); | |||
final AbstractComponent c1 = getTestTable(); | |||
c1.setSizeFull(); | |||
final AbstractComponent c2 = getTestTable(); | |||
c2.setSizeFull(); | |||
class SetSizeButton extends Button { | |||
SetSizeButton(final String size) { | |||
@@ -128,6 +127,7 @@ public abstract class BaseLayoutTestUI extends AbstractTestUI { | |||
} else if (compType == "component") { | |||
c2.setHeight(size); | |||
c2.setWidth(size); | |||
c2.setCaption("Configured width"); | |||
} else { | |||
} | |||
@@ -163,11 +163,13 @@ public abstract class BaseLayoutTestUI extends AbstractTestUI { | |||
} | |||
}); | |||
btn2.setCaption(btn2.getCaption() + " + add Label"); | |||
} | |||
protected Table getTestTable() { | |||
Table t = new Table(); | |||
t.setPageLength(5); | |||
t.setSizeFull(); | |||
t.setCaption("100% default width"); | |||
t.addContainerProperty("test", String.class, null); | |||
t.addItem(new Object[] { "qwertyuiop asdfghjköäxccvbnm,m,." }, 1); | |||
t.addItem(new Object[] { "YGVYTCTCTRXRXRXRX" }, 2); | |||
@@ -235,6 +237,12 @@ public abstract class BaseLayoutTestUI extends AbstractTestUI { | |||
*/ | |||
@Override | |||
protected void setup(VaadinRequest request) { | |||
mainLayout.setSizeUndefined(); | |||
getLayout().setSizeUndefined(); | |||
if (getLayout().getParent() instanceof VerticalLayout) { | |||
((VerticalLayout) getLayout().getParent()).setSizeUndefined(); | |||
} | |||
mainLayout.addComponent(l1); | |||
mainLayout.addComponent(l2); | |||
addComponent(mainLayout); | |||
@@ -254,8 +262,8 @@ public abstract class BaseLayoutTestUI extends AbstractTestUI { | |||
AbstractOrderedLayout l2, String w, String h) { | |||
l1.setWidth(w); | |||
l1.setHeight(h); | |||
l2.setWidth(h); | |||
l2.setHeight(w); | |||
l2.setWidth(w); | |||
l2.setHeight(h); | |||
} | |||
protected void setDefaultForVertical(AbstractOrderedLayout l1, |
@@ -23,6 +23,7 @@ public class GridAlignment extends GridBaseLayoutTestUI { | |||
protected void setup(VaadinRequest request) { | |||
buildLayout(); | |||
super.setup(request); | |||
layout.setSizeFull(); | |||
} | |||
/** | |||
@@ -31,8 +32,6 @@ public class GridAlignment extends GridBaseLayoutTestUI { | |||
private void buildLayout() { | |||
layout.setColumns(3); | |||
layout.setRows(3); | |||
// layout.setHeight("600px"); | |||
// layout.setWidth("900px"); | |||
for (int i = 0; i < components.length; i++) { | |||
layout.addComponent(components[i]); | |||
layout.setComponentAlignment(components[i], alignments[i]); |
@@ -43,8 +43,7 @@ public abstract class GridBaseLayoutTestUI extends BaseLayoutTestUI { | |||
@Override | |||
protected void setup(VaadinRequest request) { | |||
layout.setMargin(true); | |||
layout.setSizeFull(); | |||
layout.setSizeUndefined(); | |||
getUI().setContent(layout); | |||
} | |||
@@ -55,9 +54,7 @@ public abstract class GridBaseLayoutTestUI extends BaseLayoutTestUI { | |||
layout.setMargin(false); | |||
final AbstractComponent c1 = getTestTable(); | |||
c1.setSizeFull(); | |||
final AbstractComponent c2 = getTestTable(); | |||
c2.setSizeFull(); | |||
class SetSizeButton extends Button { | |||
SetSizeButton(final String size) { | |||
@@ -73,6 +70,7 @@ public abstract class GridBaseLayoutTestUI extends BaseLayoutTestUI { | |||
} else if (compType == "component") { | |||
c2.setHeight(size); | |||
c2.setWidth(size); | |||
c2.setCaption("Configured width"); | |||
} else { | |||
} | |||
@@ -81,7 +79,7 @@ public abstract class GridBaseLayoutTestUI extends BaseLayoutTestUI { | |||
} | |||
} | |||
Button btn1 = new SetSizeButton("550px"); | |||
Button btn1 = new SetSizeButton("350px"); | |||
Button btn2 = new SetSizeButton("-1px"); | |||
Button btn3 = new SetSizeButton("75%"); | |||
Button btn4 = new SetSizeButton("100%"); | |||
@@ -104,5 +102,6 @@ public abstract class GridBaseLayoutTestUI extends BaseLayoutTestUI { | |||
layout.addComponent(newLabel); | |||
} | |||
}); | |||
btn2.setCaption(btn2.getCaption() + " + add Label"); | |||
} | |||
} |
@@ -28,5 +28,6 @@ public class GridComponentSizing extends GridBaseLayoutTestUI { | |||
protected void setup(VaadinRequest request) { | |||
getLayoutForLayoutSizing("component"); | |||
super.setup(request); | |||
layout.setSizeFull(); | |||
} | |||
} |
@@ -16,6 +16,7 @@ | |||
package com.vaadin.tests.layouts.layouttester.GridLayout; | |||
import com.vaadin.server.VaadinRequest; | |||
import com.vaadin.ui.AbstractOrderedLayout; | |||
import com.vaadin.ui.Button; | |||
import com.vaadin.ui.ComboBox; | |||
import com.vaadin.ui.Label; | |||
@@ -39,4 +40,13 @@ public class GridIcon extends GridBaseLayoutTestUI { | |||
layout.addComponent(createLabelsFields(TabSheet.class, true, "")); | |||
super.setup(request); | |||
} | |||
@Override | |||
protected void setLayoutMeasures(AbstractOrderedLayout l1, | |||
AbstractOrderedLayout l2, String w, String h) { | |||
super.setLayoutMeasures(l1, l2, "400px", "-1px"); | |||
l1.setSpacing(true); | |||
l2.setSpacing(true); | |||
mainLayout.setSpacing(true); | |||
} | |||
} |
@@ -30,6 +30,7 @@ public class GridLayoutExpand extends GridBaseLayoutTestUI { | |||
protected void setup(VaadinRequest request) { | |||
buildLayout(); | |||
super.setup(request); | |||
layout.setSizeFull(); | |||
} | |||
private void buildLayout() { | |||
@@ -50,8 +51,6 @@ public class GridLayoutExpand extends GridBaseLayoutTestUI { | |||
} | |||
Table t1 = getTestTable(); | |||
Table t2 = getTestTable(); | |||
t1.setSizeFull(); | |||
t2.setSizeFull(); | |||
layout.setColumns(4); | |||
layout.setRows(4); | |||
layout.addComponent(new ExpandButton(1, 2, 1.0f, 0.0f), 0, 0); |
@@ -39,8 +39,8 @@ public class GridLayoutMarginSpacing extends GridBaseLayoutTestUI { | |||
private void buildLayout() { | |||
Table t1 = getTestTable(); | |||
Table t2 = getTestTable(); | |||
t1.setSizeFull(); | |||
t2.setSizeFull(); | |||
t1.setSizeUndefined(); | |||
t2.setSizeUndefined(); | |||
final Button btn1 = new Button("Toggle margin on/off"); | |||
btn1.addClickListener(new ClickListener() { |
@@ -16,6 +16,7 @@ | |||
package com.vaadin.tests.layouts.layouttester.GridLayout; | |||
import com.vaadin.server.VaadinRequest; | |||
import com.vaadin.ui.AbstractOrderedLayout; | |||
import com.vaadin.ui.Button; | |||
import com.vaadin.ui.CheckBox; | |||
import com.vaadin.ui.ComboBox; | |||
@@ -51,4 +52,10 @@ public class GridLayoutRegError extends GridBaseLayoutTestUI { | |||
layout.addComponent(createLabelsFields(CheckBox.class, true, "")); | |||
} | |||
@Override | |||
protected void setDefaultForVertical(AbstractOrderedLayout l1, | |||
AbstractOrderedLayout l2) { | |||
setLayoutMeasures(l1, l2, "800px", "800px"); | |||
} | |||
} |
@@ -16,6 +16,12 @@ | |||
package com.vaadin.tests.layouts.layouttester.GridLayout; | |||
import com.vaadin.server.VaadinRequest; | |||
import com.vaadin.shared.ui.label.ContentMode; | |||
import com.vaadin.ui.AbstractComponent; | |||
import com.vaadin.ui.Button; | |||
import com.vaadin.ui.Button.ClickEvent; | |||
import com.vaadin.ui.Button.ClickListener; | |||
import com.vaadin.ui.Label; | |||
/** | |||
* | |||
@@ -28,5 +34,63 @@ public class GridLayoutSizing extends GridBaseLayoutTestUI { | |||
protected void setup(VaadinRequest request) { | |||
getLayoutForLayoutSizing("layout"); | |||
super.setup(request); | |||
layout.setSizeFull(); | |||
} | |||
@Override | |||
protected void getLayoutForLayoutSizing(final String compType) { | |||
layout.setSpacing(false); | |||
layout.setMargin(false); | |||
final AbstractComponent c1 = getTestTable(); | |||
final AbstractComponent c2 = getTestTable(); | |||
class SetSizeButton extends Button { | |||
SetSizeButton(final String size) { | |||
super(); | |||
setCaption("Set size " + size); | |||
addClickListener(new ClickListener() { | |||
@Override | |||
public void buttonClick(ClickEvent event) { | |||
if (compType == "layout") { | |||
layout.setHeight(size); | |||
layout.setWidth(size); | |||
} else if (compType == "component") { | |||
c2.setHeight(size); | |||
c2.setWidth(size); | |||
} else { | |||
} | |||
} | |||
}); | |||
} | |||
} | |||
Button btn1 = new SetSizeButton("600px"); | |||
Button btn2 = new SetSizeButton("-1px"); | |||
Button btn3 = new SetSizeButton("75%"); | |||
Button btn4 = new SetSizeButton("100%"); | |||
layout.addComponent(btn1); | |||
layout.addComponent(btn2); | |||
layout.addComponent(btn3); | |||
layout.addComponent(btn4); | |||
layout.addComponent(c1); | |||
layout.addComponent(new Label( | |||
"<div style='height: 1px'></div><hr /><div style='height: 1px'></div>", | |||
ContentMode.HTML)); | |||
layout.addComponent(c2); | |||
btn2.addClickListener(new ClickListener() { | |||
@Override | |||
public void buttonClick(ClickEvent event) { | |||
Label newLabel = new Label("--- NEW LABEL ---"); | |||
newLabel.setSizeUndefined(); | |||
layout.addComponent(newLabel); | |||
} | |||
}); | |||
btn2.setCaption(btn2.getCaption() + " + add Label"); | |||
} | |||
} |
@@ -15,8 +15,8 @@ | |||
*/ | |||
package com.vaadin.tests.layouts.layouttester.HLayout; | |||
import com.vaadin.annotations.Theme; | |||
import com.vaadin.tests.layouts.layouttester.BaseAddReplaceMove; | |||
import com.vaadin.ui.AbstractOrderedLayout; | |||
import com.vaadin.ui.HorizontalLayout; | |||
public class HAddReplaceMove extends BaseAddReplaceMove { | |||
@@ -28,4 +28,10 @@ public class HAddReplaceMove extends BaseAddReplaceMove { | |||
super(HorizontalLayout.class); | |||
} | |||
@Override | |||
protected void setLayoutMeasures(AbstractOrderedLayout l1, | |||
AbstractOrderedLayout l2, String w, String h) { | |||
super.setLayoutMeasures(l1, l2, "1200px", h); | |||
} | |||
} |