HorizontalLayout has spacing = true and margin = false by default.
Fixes vaadin/framework8-issues#526
*/
protected void writeMargin(Element design, MarginInfo margin,
MarginInfo defMargin, DesignContext context) {
- if (margin.hasAll()) {
+ if (margin.hasAll() || margin.hasNone()) {
DesignAttributeHandler.writeAttribute("margin", design.attributes(),
margin.hasAll(), defMargin.hasAll(), boolean.class,
context);
* Constructs an empty HorizontalLayout.
*/
public HorizontalLayout() {
-
+ setSpacing(true);
}
/**
*/
public LegacyWindow() {
super(new VerticalLayout());
- ((VerticalLayout) getContent()).setMargin(true);
+ ((VerticalLayout) getContent()).setSpacing(false);
}
/**
* the caption of the window
*/
public LegacyWindow(String caption) {
- super(new VerticalLayout());
- ((VerticalLayout) getContent()).setMargin(true);
+ this();
setCaption(caption);
}
*/
public VerticalLayout() {
setWidth("100%");
+ setSpacing(true);
+ setMargin(true);
}
/**
public abstract class DeclarativeMarginTestBase<L extends Layout & MarginHandler>
extends DeclarativeTestBase<L> {
- protected void testMargins(String componentTag) {
+ protected void testMargins(String componentTag, boolean defaultMargin) {
for (int i = 0; i < 16; ++i) {
boolean top = (i & 1) == 1;
MarginInfo m = new MarginInfo(top, right, bottom, left);
- String design = getMarginTag(componentTag, top, right, bottom,
+ String design = getMarginTag(componentTag, defaultMargin, top, right, bottom,
left);
// The assertEquals machinery in DeclarativeTestBase uses bean
// introspection and MarginInfo is not a proper bean. It ends up
// considering *all* MarginInfo objects equal... (#18229)
L layout = read(design);
- Assert.assertEquals(m, layout.getMargin());
+ Assert.assertEquals("For tag: " + design, m, layout.getMargin());
testWrite(design, layout);
}
}
- private String getMarginTag(String componentTag, boolean top, boolean right,
- boolean bottom, boolean left) {
+ private String getMarginTag(String componentTag, boolean defaultMargin, boolean top, boolean right,
+ boolean bottom, boolean left) {
String s = "<" + componentTag + " ";
+ String suffix = defaultMargin ? "=false " : " ";
- if (left && right && top && bottom) {
- s += "margin";
+ if (top == left && top == right && top == bottom) {
+ if(top != defaultMargin)
+ {
+ s += "margin" + suffix;
+ }
} else {
- if (left) {
- s += "margin-left ";
+ if (left != defaultMargin) {
+ s += "margin-left" + suffix;
}
- if (right) {
- s += "margin-right ";
+ if (right != defaultMargin) {
+ s += "margin-right" + suffix;
}
- if (top) {
- s += "margin-top ";
+ if (top != defaultMargin) {
+ s += "margin-top" + suffix;
}
- if (bottom) {
- s += "margin-bottom ";
+ if (bottom != defaultMargin) {
+ s += "margin-bottom" + suffix;
}
}
return s + " />";
import java.util.Arrays;
import java.util.List;
+import org.junit.Ignore;
import org.junit.Test;
import com.vaadin.shared.ui.label.ContentMode;
private List<String> defaultAlignments = Arrays.asList(":top", ":left");
@Test
- public void testMargins() {
- testMargins("vaadin-vertical-layout");
+ public void testMarginsVertical() {
+ testMargins("vaadin-vertical-layout", true);
+ }
+
+ @Test
+ public void testMarginsHorizontal() {
+ testMargins("vaadin-horizontal-layout", false);
}
@Test
@Test
public void testMargins() {
- testMargins("vaadin-grid-layout");
+ testMargins("vaadin-grid-layout",false);
}
@Test
return (bitMask & ALL) == ALL;
}
+ /**
+ * Checks if this MarginInfo object has no margins enabled.
+ *
+ * @since 8.0.0
+ *
+ * @return true if all edges have margins disabled
+ */
+ public boolean hasNone() {
+ return (bitMask & ALL) == 0;
+ }
+
/**
* Checks if this MarginInfo object has the left edge margin enabled.
*
label.setWidth("100%");
VerticalLayout rootLayout = new VerticalLayout();
- rootLayout.setMargin(true);
+ rootLayout.setSpacing(false);
setContent(rootLayout);
layout = new VerticalLayout();
+ layout.setSpacing(false);
+ layout.setMargin(false);
rootLayout.addComponent(label);
rootLayout.addComponent(layout);
window.addComponent(label);
layout = new VerticalLayout();
+ layout.setMargin(false);
+ layout.setSpacing(false);
window.addComponent(layout);
((VerticalLayout) window.getContent()).setExpandRatio(layout, 1);
protected void setup() {
HorizontalLayout buttonLayout = new HorizontalLayout();
+ buttonLayout.setSpacing(false);
addComponent(buttonLayout);
Button page1 = new Button("Hello World");
@Override
protected void setup(VaadinRequest request) {
VerticalLayout layout = new VerticalLayout();
+ layout.setMargin(false);
+ layout.setSpacing(false);
setContent(layout);
layout.setWidth("50px");
private Component makeOtherComponentWrapper(DragStartMode componentOther) {
VerticalLayout parent = new VerticalLayout();
parent.setWidth("200px");
- parent.setSpacing(true);
+ parent.setMargin(false);
CssLayout header = new CssLayout();
Label dragStartModeLabel = new Label(
@Override
protected void init(VaadinRequest request) {
VerticalLayout layout = new VerticalLayout();
+ layout.setMargin(false);
+ layout.setSpacing(false);
setContent(layout);
layout.setSizeFull();
layout.setWidth("600px");
layout.addComponent(button);
VerticalLayout l = new VerticalLayout();
+ l.setMargin(false);
+ l.setSpacing(false);
l.setSizeFull();
l.addComponent(grid);
private VerticalLayout createVerticalLayout(boolean useCaption) {
VerticalLayout vl = new VerticalLayout();
+ vl.setMargin(false);
+ vl.setSpacing(false);
vl.setWidth("320px");
addLabel(vl, "200px", Alignment.MIDDLE_LEFT, useCaption);
import com.vaadin.server.VaadinRequest;
import com.vaadin.tests.components.AbstractReindeerTestUI;
+import com.vaadin.ui.AbstractOrderedLayout;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
-import com.vaadin.ui.ComponentContainer;
import com.vaadin.ui.GridLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.VerticalLayout;
protected Button testButton;
private GridLayout gl;
- protected ComponentContainer vl;
+ protected AbstractOrderedLayout vl;
@Override
protected void setup(VaadinRequest request) {
gl.addComponent(testButton);
vl = new VerticalLayout();
+ vl.setMargin(false);
+ vl.setSpacing(false);
vl.addComponent(new Label("I'm inside the inner layout"));
gl.addComponent(vl);
VerticalLayout container = new VerticalLayout();
container.setStyleName("mystyle");
container.setId("container");
- container.setSpacing(true);
+ container.setMargin(false);
container.setSizeFull();
addComponent(container);
@Override
protected void setup(VaadinRequest request) {
VerticalLayout layout = new VerticalLayout();
- layout.setSpacing(true);
+ layout.setMargin(false);
layout.setSizeFull();
setContent(layout);
@Override
protected void setup(VaadinRequest request) {
final VerticalLayout layout = new VerticalLayout();
- layout.setSpacing(true);
+ layout.setMargin(false);
layout.setWidth("500px");
addComponent(layout);
protected void setup(VaadinRequest request) {
TabSheet tabs = new TabSheet();
- VerticalLayout horizontalSplitsLayout = new VerticalLayout();
- horizontalSplitsLayout.setCaption("Horizontal splits");
+ VerticalLayout verticalLayout = new VerticalLayout();
+ verticalLayout.setMargin(false);
+ verticalLayout.setSpacing(false);
+ verticalLayout.setCaption("Horizontal splits");
HorizontalSplitPanel percentagePositionWithPercentageLimitsHorizontal = new HorizontalSplitPanel();
percentagePositionWithPercentageLimitsHorizontal.setMinSplitPosition(10,
.setSecondComponent(new Label("Max 80 %"));
percentagePositionWithPercentageLimitsHorizontal.setSplitPosition(50,
Sizeable.UNITS_PERCENTAGE);
- horizontalSplitsLayout
+ verticalLayout
.addComponent(percentagePositionWithPercentageLimitsHorizontal);
HorizontalSplitPanel pixelPositionWithPercentageLimitsHorizontal = new HorizontalSplitPanel();
.setSecondComponent(new Label("Max 80 %"));
pixelPositionWithPercentageLimitsHorizontal.setSplitPosition(400,
Sizeable.UNITS_PIXELS);
- horizontalSplitsLayout
+ verticalLayout
.addComponent(pixelPositionWithPercentageLimitsHorizontal);
HorizontalSplitPanel pixelPositionWithPixelLimitsHorizontal = new HorizontalSplitPanel();
.setSecondComponent(new Label("Max 550 px"));
pixelPositionWithPixelLimitsHorizontal.setSplitPosition(400,
Sizeable.UNITS_PIXELS);
- horizontalSplitsLayout
+ verticalLayout
.addComponent(pixelPositionWithPixelLimitsHorizontal);
HorizontalSplitPanel percentagePositionWithPixelLimitsHorizontal = new HorizontalSplitPanel();
.setSecondComponent(new Label("Max 550 px"));
percentagePositionWithPixelLimitsHorizontal.setSplitPosition(30,
Sizeable.UNITS_PERCENTAGE);
- horizontalSplitsLayout
+ verticalLayout
.addComponent(percentagePositionWithPixelLimitsHorizontal);
HorizontalSplitPanel percentagePositionWithPercentageLimitsHorizontalResersed = new HorizontalSplitPanel();
.setSecondComponent(new Label("Min 10 %"));
percentagePositionWithPercentageLimitsHorizontalResersed
.setSplitPosition(50, Sizeable.UNITS_PERCENTAGE, true);
- horizontalSplitsLayout.addComponent(
+ verticalLayout.addComponent(
percentagePositionWithPercentageLimitsHorizontalResersed);
HorizontalSplitPanel pixelPositionWithPercentageLimitsHorizontalResersed = new HorizontalSplitPanel();
.setSecondComponent(new Label("Min 10 %"));
pixelPositionWithPercentageLimitsHorizontalResersed
.setSplitPosition(400, Sizeable.UNITS_PIXELS, true);
- horizontalSplitsLayout.addComponent(
+ verticalLayout.addComponent(
pixelPositionWithPercentageLimitsHorizontalResersed);
HorizontalSplitPanel pixelPositionWithPixelLimitsHorizontalResersed = new HorizontalSplitPanel();
.setSecondComponent(new Label("Min 100 px"));
pixelPositionWithPixelLimitsHorizontalResersed.setSplitPosition(400,
Sizeable.UNITS_PIXELS, true);
- horizontalSplitsLayout
+ verticalLayout
.addComponent(pixelPositionWithPixelLimitsHorizontalResersed);
HorizontalSplitPanel percentagePositionWithPixelLimitsHorizontalResersed = new HorizontalSplitPanel();
.setSecondComponent(new Label("Min 100 px"));
percentagePositionWithPixelLimitsHorizontalResersed.setSplitPosition(30,
Sizeable.UNITS_PERCENTAGE, true);
- horizontalSplitsLayout.addComponent(
+ verticalLayout.addComponent(
percentagePositionWithPixelLimitsHorizontalResersed);
- horizontalSplitsLayout.setSizeFull();
- tabs.addComponent(horizontalSplitsLayout);
+ verticalLayout.setSizeFull();
+ tabs.addComponent(verticalLayout);
- HorizontalLayout verticalSplitsLayout = new HorizontalLayout();
- verticalSplitsLayout.setCaption("Vertical splits");
+ HorizontalLayout horizontalLayout = new HorizontalLayout();
+ horizontalLayout.setSpacing(false);
+ horizontalLayout.setCaption("Vertical splits");
VerticalSplitPanel percentagePositionWithPercentageLimitsVertical = new VerticalSplitPanel();
percentagePositionWithPercentageLimitsVertical.setMinSplitPosition(10,
.setSecondComponent(new Label("Max 80 %"));
percentagePositionWithPercentageLimitsVertical.setSplitPosition(50,
Sizeable.UNITS_PERCENTAGE);
- verticalSplitsLayout
+ horizontalLayout
.addComponent(percentagePositionWithPercentageLimitsVertical);
VerticalSplitPanel pixelPositionWithPercentageLimitsVertical = new VerticalSplitPanel();
.setSecondComponent(new Label("Max 80 %"));
pixelPositionWithPercentageLimitsVertical.setSplitPosition(400,
Sizeable.UNITS_PIXELS);
- verticalSplitsLayout
+ horizontalLayout
.addComponent(pixelPositionWithPercentageLimitsVertical);
VerticalSplitPanel pixelPositionWithPixelLimitsVertical = new VerticalSplitPanel();
.setSecondComponent(new Label("Max 450 px"));
pixelPositionWithPixelLimitsVertical.setSplitPosition(400,
Sizeable.UNITS_PIXELS);
- verticalSplitsLayout.addComponent(pixelPositionWithPixelLimitsVertical);
+ horizontalLayout.addComponent(pixelPositionWithPixelLimitsVertical);
VerticalSplitPanel percentagePositionWithPixelLimitsVertical = new VerticalSplitPanel();
percentagePositionWithPixelLimitsVertical.setMinSplitPosition(100,
.setSecondComponent(new Label("Max 450 px"));
percentagePositionWithPixelLimitsVertical.setSplitPosition(30,
Sizeable.UNITS_PERCENTAGE);
- verticalSplitsLayout
+ horizontalLayout
.addComponent(percentagePositionWithPixelLimitsVertical);
VerticalSplitPanel percentagePositionWithPercentageLimitsVerticalReversed = new VerticalSplitPanel();
.setSecondComponent(new Label("Min 10 %"));
percentagePositionWithPercentageLimitsVerticalReversed
.setSplitPosition(50, Sizeable.UNITS_PERCENTAGE, true);
- verticalSplitsLayout.addComponent(
+ horizontalLayout.addComponent(
percentagePositionWithPercentageLimitsVerticalReversed);
VerticalSplitPanel pixelPositionWithPercentageLimitsVerticalReversed = new VerticalSplitPanel();
.setSecondComponent(new Label("Min 10 %"));
pixelPositionWithPercentageLimitsVerticalReversed.setSplitPosition(400,
Sizeable.UNITS_PIXELS, true);
- verticalSplitsLayout.addComponent(
+ horizontalLayout.addComponent(
pixelPositionWithPercentageLimitsVerticalReversed);
VerticalSplitPanel pixelPositionWithPixelLimitsVerticalReversed = new VerticalSplitPanel();
.setSecondComponent(new Label("Min 100 px"));
pixelPositionWithPixelLimitsVerticalReversed.setSplitPosition(300,
Sizeable.UNITS_PIXELS, true);
- verticalSplitsLayout
+ horizontalLayout
.addComponent(pixelPositionWithPixelLimitsVerticalReversed);
VerticalSplitPanel percentagePositionWithPixelLimitsVerticalReversed = new VerticalSplitPanel();
.setSecondComponent(new Label("Min 100 px"));
percentagePositionWithPixelLimitsVerticalReversed.setSplitPosition(30,
Sizeable.UNITS_PERCENTAGE, true);
- verticalSplitsLayout.addComponent(
+ horizontalLayout.addComponent(
percentagePositionWithPixelLimitsVerticalReversed);
- tabs.addComponent(verticalSplitsLayout);
- verticalSplitsLayout.setSizeFull();
+ tabs.addComponent(horizontalLayout);
+ horizontalLayout.setSizeFull();
final VerticalLayout togglableSplitPanelLayout = new VerticalLayout();
+ togglableSplitPanelLayout.setSpacing(false);
+ togglableSplitPanelLayout.setMargin(false);
togglableSplitPanelLayout.setCaption("Togglable minimum/maximum");
final HorizontalSplitPanel togglableSplitPanel = new HorizontalSplitPanel();
togglableSplitPanelLayout.addComponent(togglableSplitPanel);
final HorizontalLayout buttonLayout = new HorizontalLayout();
+ buttonLayout.setSpacing(false);
Button disableMinimum = new Button("Disable min limit",
new Button.ClickListener() {
@Override
protected void setup(VaadinRequest request) {
HorizontalLayout layout = new HorizontalLayout();
- layout.setSpacing(true);
final Table table = new Table();
table.setWidth("400px");
// Add some options to play with
VerticalLayout options = new VerticalLayout();
- options.setSpacing(true);
+ options.setMargin(false);
final CheckBox visible = new CheckBox("Footers Visible", true);
visible.addValueChangeListener(
}
});
HorizontalLayout footer1 = new HorizontalLayout();
+ footer1.setSpacing(false);
footer1.addComponent(footer1Value);
footer1.addComponent(footer1Btn);
options.addComponent(footer1);
}
});
HorizontalLayout footer2 = new HorizontalLayout();
+ footer2.setSpacing(false);
footer2.addComponent(footer2Value);
footer2.addComponent(footer2Btn);
options.addComponent(footer2);
}
});
HorizontalLayout footer3 = new HorizontalLayout();
+ footer3.setSpacing(false);
footer3.addComponent(footer3Value);
footer3.addComponent(footer3Btn);
options.addComponent(footer3);
addComponent(table);
HorizontalLayout buttonsLo = new HorizontalLayout();
+ buttonsLo.setSpacing(false);
addComponent(buttonsLo);
Button setTableWidth100 = new Button("table.setWidth(100%)",
protected void initMain() {
((AbstractOrderedLayout) getContent()).setMargin(false);
layout = new HorizontalLayout();
- layout.setSpacing(true);
- layout.setMargin(false);
layout.setSizeFull();
+ buttonLayout.setSpacing(false);
addComponent(buttonLayout);
addComponent(layout);
@Override
protected void setup(VaadinRequest request) {
VerticalLayout layout = new VerticalLayout();
- layout.setMargin(true);
+ layout.setSpacing(false);
setContent(layout);
TabSheet tabSheet = new TabSheet();
public class TabComposite extends CustomComponent {
public TabComposite() {
- Layout mainLayout = new VerticalLayout();
+ VerticalLayout mainLayout = new VerticalLayout();
+ mainLayout.setSpacing(false);
+ mainLayout.setMargin(false);
addComponent(mainLayout);
setCompositionRoot(mainLayout);
}
private Tab addTab() {
- Layout content = new VerticalLayout();
+ VerticalLayout content = new VerticalLayout();
+ content.setMargin(false);
+ content.setSpacing(false);
tabs.add(content);
Label label = new Label("Tab " + index);
label.setId(labelID(index));
createCustomStyleStringField();
HorizontalLayout selectors = new HorizontalLayout();
- selectors.setSpacing(true);
selectors.addComponent(customStyle);
selectors.addComponent(setStyleName);
setWidth("100%");
VerticalLayout vl = new VerticalLayout();
+ vl.setSpacing(false);
+ vl.setMargin(false);
FieldGroup fg = new BeanFieldGroup<>(Person.class);
fg.setItemDataSource(new BeanItem<>(new Person()));
for (Object propId : fg.getUnboundPropertyIds()) {
public NotificationsCssTest(TestSampler parent) {
this.parent = parent;
+ setSpacing(false);
+ setMargin(false);
parent.registerComponent(this);
Button humanized = new Button("Humanized message",
public WindowsCssTest(TestSampler parent) {
this.parent = parent;
+ setMargin(false);
+ setSpacing(false);
parent.registerComponent(this);
Button defWindow = new Button("Default window",
// Let's use a separate layout without margins to make the
// button widths not dependent on the selected theme.
VerticalLayout layout = new VerticalLayout();
+ layout.setMargin(false);
+ layout.setSpacing(false);
layout.setWidth("500px");
layout.addComponent(getImmediateUpload("upload1", "300px"));
Panel p = new Panel();
VerticalLayout content = new VerticalLayout();
+ content.setMargin(false);
+ content.setSpacing(false);
p.setContent(content);
content.setHeight("500px");
w.center();
VerticalLayout content = new VerticalLayout();
+ content.setMargin(false);
+ content.setSpacing(false);
w.setContent(content);
content.setHeight("1000px");
ComboBox<String> cb = new ComboBox<>();
setWidth(200, Unit.PIXELS);
VerticalLayout layoutRoot = new VerticalLayout();
+ layoutRoot.setMargin(false);
+ layoutRoot.setSpacing(false);
Panel container = new Panel();
container.setHeight(200, Unit.PIXELS);
VerticalLayout containerContent = new VerticalLayout();
+ containerContent.setMargin(false);
+ containerContent.setSpacing(false);
for (int i = 0; i < 300; i++) {
Panel hello = new Panel("hello");
containerContent.addComponent(hello);
@Override
protected void setup(VaadinRequest request) {
HorizontalLayout layout = new HorizontalLayout();
+ layout.setSpacing(false);
layout.addStyleName("layout-update");
layout.setWidth("100%");
setContent(layout);
private void buildUI(final Resource icon) {
VerticalLayout layout = new VerticalLayout();
setContent(layout);
- layout.setMargin(true);
+ layout.setSpacing(false);
layout.setIcon(icon);
private GridLayout generateLayout() {
VerticalLayout fields1 = new VerticalLayout();
+ fields1.setMargin(false);
+ fields1.setSpacing(false);
NativeButton nb = new NativeButton("A button");
nb.setHeight("300px");
fields1.addComponent(nb);
VerticalLayout fields3 = new VerticalLayout();
+ fields3.setMargin(false);
+ fields3.setSpacing(false);
fields3.addComponent(new TextField("field14"));
NativeButton b = new NativeButton("A big button");
// TODO Auto-generated catch block
e.printStackTrace();
}
+ layout.setMargin(false);
+ layout.setSpacing(false);
layout.setHeight("300px");
layout.setWidth("200px");
layout.addComponent(components[i]);
try {
l1 = (AbstractOrderedLayout) layoutClass.newInstance();
l2 = (AbstractOrderedLayout) layoutClass.newInstance();
+ l1.setMargin(false);
+ l1.setSpacing(false);
+ l2.setMargin(false);
+ l2.setSpacing(false);
} catch (InstantiationException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
protected AbstractLayout createLabelsFields(
Class<? extends AbstractComponent> compType, boolean useIcon,
String ErrorMessage) {
- AbstractLayout mainLayout = new VerticalLayout();
+ AbstractOrderedLayout mainLayout = new VerticalLayout();
+ mainLayout.setSpacing(false);
+ mainLayout.setMargin(false);
AbstractLayout curLayout = null;
try {
curLayout = layoutClass.newInstance();
+ if(curLayout instanceof AbstractOrderedLayout) {
+ ((AbstractOrderedLayout)curLayout).setMargin(false);
+ ((AbstractOrderedLayout)curLayout).setSpacing(false);
+ }
} catch (InstantiationException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
*/
@Override
protected void setup(VaadinRequest request) {
+ mainLayout.setMargin(false);
+ mainLayout.setSpacing(false);
mainLayout.addComponent(l1);
mainLayout.addComponent(l2);
addComponent(mainLayout);
public class HCaption extends BaseCaption {
- /**
- * @param layoutClass
- */
public HCaption() {
super(HorizontalLayout.class);
}
public class HComponentSizing extends BaseComponentSizing {
- /**
- * @param layoutClass
- */
public HComponentSizing() {
super(HorizontalLayout.class);
}
public class VCaption extends BaseCaption {
- /**
- * @param layoutClass
- */
public VCaption() {
super(VerticalLayout.class);
// TODO Auto-generated constructor stub
gl.setHeight("800px");
HorizontalLayout images = new HorizontalLayout();
- images.setSpacing(true);
Label l = new Label("Chameleon theme image in caption");
l.setIcon(new ThemeResource("img/magnifier.png"));
getLayout().setSpacing(true);
Window w = new Window();
- w.setContent(new VerticalLayout(new Button("Button in window")));
+ VerticalLayout content = new VerticalLayout(new Button("Button in window"));
+ content.setSpacing(false);
+ content.setMargin(false);
+ w.setContent(content);
addWindow(w);
}
public class Accordions extends VerticalLayout implements View {
public Accordions() {
- setMargin(true);
+ setSpacing(false);
Label h1 = new Label("Accordions");
h1.addStyleName(ValoTheme.LABEL_H1);
addComponent(h1);
HorizontalLayout row = new HorizontalLayout();
- row.setSpacing(true);
row.setWidth("100%");
addComponent(row);
*
*/
public ButtonsAndLinks() {
- setMargin(true);
+ setSpacing(false);
Label h1 = new Label("Buttons");
h1.addStyleName(ValoTheme.LABEL_H1);
HorizontalLayout row = new HorizontalLayout();
row.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING);
- row.setSpacing(true);
addComponent(row);
Button button = new Button("Normal");
row = new HorizontalLayout();
row.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING);
- row.setSpacing(true);
addComponent(row);
Link link = new Link("vaadin.com",
public class CheckBoxes extends VerticalLayout implements View {
public CheckBoxes() {
- setMargin(true);
+ setSpacing(false);
Label h1 = new Label("Check Boxes");
h1.addStyleName(ValoTheme.LABEL_H1);
HorizontalLayout row = new HorizontalLayout();
row.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING);
- row.setSpacing(true);
addComponent(row);
CheckBox check = new CheckBox("Checked", true);
row = new HorizontalLayout();
row.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING);
- row.setSpacing(true);
addComponent(row);
OptionGroup options = new OptionGroup("Choose one, explicit width");
public class ColorPickers extends VerticalLayout implements View {
public ColorPickers() {
- setMargin(true);
+ setSpacing(false);
Label h1 = new Label("Color Pickers");
h1.addStyleName(ValoTheme.LABEL_H1);
HorizontalLayout row = new HorizontalLayout();
row.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING);
- row.setSpacing(true);
addComponent(row);
TestIcon testIcon = new TestIcon(40);
public class ComboBoxes extends VerticalLayout implements View {
public ComboBoxes() {
- setMargin(true);
+ setSpacing(false);
Label h1 = new Label("Combo Boxes");
h1.addStyleName(ValoTheme.LABEL_H1);
HorizontalLayout row = new HorizontalLayout();
row.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING);
- row.setSpacing(true);
addComponent(row);
ComboBox combo = new ComboBox("Normal");
public class CommonParts extends VerticalLayout implements View {
public CommonParts() {
- setMargin(true);
+ setSpacing(false);
Label h1 = new Label("Common UI Elements");
h1.addStyleName(ValoTheme.LABEL_H1);
Panel p = new Panel("Loading Indicator");
VerticalLayout content = new VerticalLayout();
p.setContent(content);
- content.setSpacing(true);
- content.setMargin(true);
content.addComponent(new Label(
"You can test the loading indicator by pressing the buttons."));
String styleString = "";
TextField delay = new TextField();
{
- setSpacing(true);
- setMargin(true);
-
title.setPlaceholder("Title for the notification");
title.addValueChangeListener(event -> {
if (title.getValue() == null
Panel p = new Panel("Tooltips");
HorizontalLayout content = new HorizontalLayout() {
{
- setSpacing(true);
setMargin(true);
addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING);
public class DateFields extends VerticalLayout implements View {
public DateFields() {
- setMargin(true);
+ setSpacing(false);
Label h1 = new Label("Date Fields");
h1.addStyleName(ValoTheme.LABEL_H1);
HorizontalLayout row = new HorizontalLayout();
row.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING);
- row.setSpacing(true);
addComponent(row);
AbstractDateField date = new TestDateField("Default resolution");
SortableLayout sample;
public Dragging() {
- setMargin(true);
- setSpacing(true);
Label h1 = new Label("Dragging Components");
h1.addStyleName(ValoTheme.LABEL_H1);
components.add(documentLayout);
final VerticalLayout buttonLayout = new VerticalLayout();
+ buttonLayout.setSpacing(false);
+ buttonLayout.setMargin(false);
final Button button = new Button("Button");
button.addClickListener(new Button.ClickListener() {
@Override
public SortableLayout() {
layout = new HorizontalLayout();
layout.setMargin(true);
+ layout.setSpacing(false);
dropHandler = new ReorderLayoutDropHandler(layout);
// final DragAndDropWrapper pane = new DragAndDropWrapper(layout);
*/
public class Labels extends VerticalLayout implements View {
public Labels() {
- setMargin(true);
+ setSpacing(false);
Label h1 = new Label("Labels");
h1.addStyleName(ValoTheme.LABEL_H1);
HorizontalLayout split = new HorizontalLayout();
split.setWidth("100%");
+ split.setSpacing(false);
addComponent(split);
VerticalLayout left = new VerticalLayout();
+ left.setSpacing(false);
left.setMargin(new MarginInfo(false, true, false, false));
split.addComponent(left);
split.addComponent(p);
VerticalLayout right = new VerticalLayout();
- right.setSpacing(true);
- right.setMargin(true);
p.setContent(right);
Label label = new Label(
public class NativeSelects extends VerticalLayout implements View {
public NativeSelects() {
- setMargin(true);
+ setSpacing(false);
Label h1 = new Label("Selects");
h1.addStyleName(ValoTheme.LABEL_H1);
HorizontalLayout row = new HorizontalLayout();
row.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING);
- row.setSpacing(true);
addComponent(row);
NativeSelect select = new NativeSelect("Drop Down Select");
public class Panels extends VerticalLayout implements View {
public Panels() {
- setMargin(true);
+ setSpacing(false);
Label h1 = new Label("Panels & Layout panels");
h1.addStyleName(ValoTheme.LABEL_H1);
HorizontalLayout row = new HorizontalLayout();
row.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING);
- row.setSpacing(true);
addComponent(row);
TestIcon testIcon = new TestIcon(60);
layout.addStyleName(ValoTheme.LAYOUT_CARD);
row.addComponent(layout);
HorizontalLayout panelCaption = new HorizontalLayout();
+ panelCaption.setSpacing(false);
panelCaption.addStyleName("v-panel-caption");
panelCaption.setWidth("100%");
// panelCaption.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
Component panelContent() {
VerticalLayout layout = new VerticalLayout();
layout.setSizeFull();
- layout.setMargin(true);
- layout.setSpacing(true);
Label content = new Label(
"Suspendisse dictum feugiat nisl ut dapibus. Mauris iaculis porttitor posuere. Praesent id metus massa, ut blandit odio.");
content.setWidth("10em");
Component panelContentScroll() {
VerticalLayout layout = new VerticalLayout();
- layout.setMargin(true);
- layout.setSpacing(true);
Label content = new Label(
"Suspendisse dictum feugiat nisl ut dapibus. Mauris iaculis porttitor posuere. Praesent id metus massa, ut blandit odio. Suspendisse dictum feugiat nisl ut dapibus. Mauris iaculis porttitor posuere. Praesent id metus massa, ut blandit odio.");
content.setWidth("10em");
public class PopupViews extends VerticalLayout implements View {
public PopupViews() {
- setMargin(true);
+ setSpacing(false);
Label h1 = new Label("Popup Views");
h1.addStyleName(ValoTheme.LABEL_H1);
HorizontalLayout row = new HorizontalLayout();
row.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING);
- row.setSpacing(true);
addComponent(row);
PopupView pv = new PopupView(new Content() {
public Component getPopupComponent() {
return new VerticalLayout() {
{
- setMargin(true);
+ setSpacing(false);
setWidth("300px");
addComponent(new Label(
"Fictum, deserunt mollit anim laborum astutumque! Magna pars studiorum, prodita quaerimus."));
}
return new VerticalLayout() {
{
- setMargin(true);
+ setSpacing(false);
addComponent(
new Label(
"<h3>Thanks for waiting!</h3><p>You've opened this popup <b>"
public class Sliders extends VerticalLayout implements View {
public Sliders() {
- setMargin(true);
+ setSpacing(false);
Label h1 = new Label("Sliders");
h1.addStyleName(ValoTheme.LABEL_H1);
HorizontalLayout row = new HorizontalLayout();
row.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING);
- row.setSpacing(true);
addComponent(row);
Slider slider = new Slider("Horizontal");
row = new HorizontalLayout();
row.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING);
- row.setSpacing(true);
addComponent(row);
pb = new ProgressBar();
public class SplitPanels extends VerticalLayout implements View {
public SplitPanels() {
- setMargin(true);
+ setSpacing(false);
Label h1 = new Label("Split Panels");
h1.addStyleName(ValoTheme.LABEL_H1);
HorizontalLayout row = new HorizontalLayout();
row.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING);
- row.setSpacing(true);
row.setMargin(new MarginInfo(true, false, false, false));
addComponent(row);
VerticalLayout getContent() {
return new VerticalLayout() {
{
- setMargin(true);
+ setSpacing(false);
Label label = new Label(
"Fictum, deserunt mollit anim laborum astutumque!");
label.setWidth("100%");
TabSheet tabs;
public Tabsheets() {
- setMargin(true);
+ setSpacing(false);
Label h1 = new Label("Tabs");
h1.addStyleName(ValoTheme.LABEL_H1);
addComponent(h1);
HorizontalLayout wrap = new HorizontalLayout();
- wrap.setSpacing(true);
wrap.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING);
addComponent(wrap);
addComponent(h3);
wrap = new HorizontalLayout();
- wrap.setSpacing(true);
wrap.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING);
wrap.setMargin(new MarginInfo(false, false, true, false));
addComponent(wrap);
? sg.nextString(true) + " " + sg.nextString(false) : null;
VerticalLayout content = new VerticalLayout();
- content.setMargin(true);
- content.setSpacing(true);
content.addComponent(new Label("Content for tab " + i));
if (i == 2) {
content.addComponent(new Label(
private TestIcon testIcon = new TestIcon(140);
public TextFields() {
- setMargin(true);
+ setSpacing(false);
Label h1 = new Label("Text Fields");
h1.addStyleName(ValoTheme.LABEL_H1);
HorizontalLayout row = new HorizontalLayout();
row.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING);
- row.setSpacing(true);
addComponent(row);
TextField tf = new TextField("Normal");
row = new HorizontalLayout();
row.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING);
- row.setSpacing(true);
addComponent(row);
TextArea ta = new TextArea("Normal");
public class Trees extends VerticalLayout implements View {
public Trees() {
- setMargin(true);
+ setSpacing(false);
Label h1 = new Label("Trees");
h1.addStyleName(ValoTheme.LABEL_H1);
HorizontalLayout row = new HorizontalLayout();
row.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING);
- row.setSpacing(true);
addComponent(row);
Tree tree = new Tree();
public ValoMenuLayout() {
setSizeFull();
+ setSpacing(false);
menuArea.setPrimaryStyleName(ValoTheme.MENU_ROOT);
HorizontalLayout top = new HorizontalLayout();
top.setWidth("100%");
+ top.setSpacing(false);
top.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
top.addStyleName(ValoTheme.MENU_TITLE);
menu.addComponent(top);
private int nextLogNr = 1;
public Log(int nr) {
+ setSpacing(false);
+ setMargin(false);
for (int i = 0; i < nr; i++) {
Label l = createEventLabel();
l.setId("Log_row_" + i);
@Override
protected void init(VaadinRequest request) {
VerticalLayout layout = new VerticalLayout();
+ layout.setMargin(false);
+ layout.setSpacing(false);
setContent(layout);
layout.setSizeFull();
layout.setWidth("600px");
<!DOCTYPE html>
<html>
<body>
- <v-vertical-layout size-auto="true">
+ <v-vertical-layout size-auto="true" margin="false" spacing="false">
<v-vertical-layout spacing="true" size-auto="true" margin="true">
<v-css-layout _id="narrow" caption="801-1100px = narrow menu" width="801px" height="200px">
- <v-horizontal-layout style-name="valo-menu-responsive" responsive="true" size-full="true">
+ <v-horizontal-layout style-name="valo-menu-responsive" responsive="true" size-full="true" spacing="false">
<v-css-layout style-name="valo-menu">
<v-css-layout style-name="valo-menu-part">
- <v-horizontal-layout style-name="valo-menu-title" width-full="true" >
+ <v-horizontal-layout style-name="valo-menu-title" width-full="true" spacing="false">
<v-label size-auto="true" :middle="" :expand="">
The
<strong>Application</strong>
</v-css-layout>
<v-css-layout _id="wide" caption="Over 1100px = wide menu" width="1101px" height="200px">
- <v-horizontal-layout style-name="valo-menu-responsive" responsive="true" size-full="true">
+ <v-horizontal-layout style-name="valo-menu-responsive" responsive="true" size-full="true" spacing="false">
<v-css-layout style-name="valo-menu">
<v-css-layout style-name="valo-menu-part">
- <v-horizontal-layout style-name="valo-menu-title" width-full="true" >
+ <v-horizontal-layout style-name="valo-menu-title" width-full="true" spacing="false">
<v-label size-auto="true" :middle="" :expand="">
The
<strong>Application</strong>
<v-vertical-layout spacing="true" margin="true" :expand=""></v-vertical-layout>
</v-horizontal-layout>
</v-css-layout>
- </v-vertical-layout>
+ </v-vertical-layout>
<v-css-layout _id="collapsed" caption="Collapsed menu w/ hover" width="500px" height="200px">
- <v-horizontal-layout style-name="valo-menu-responsive" responsive="true" size-full="true">
+ <v-horizontal-layout style-name="valo-menu-responsive" responsive="true" size-full="true" spacing="false">
<v-css-layout style-name="valo-menu valo-menu-hover">
<v-css-layout style-name="valo-menu-part">
- <v-horizontal-layout style-name="valo-menu-title" width-full="true">
+ <v-horizontal-layout style-name="valo-menu-title" width-full="true" spacing="false">
<v-label size-auto="true" :middle="" :expand="">
The
<strong>Application</strong>