Hi folks,
I was trying to align my label along with an image into a HorizontalLayout. The label (which is the first component of the layout) needs to be aligned on the middle right and the image on the middle left. See the snippet:
public class PageNotFoundView extends VerticalLayout implements View {
public PageNotFoundView () {
HorizontalLayout horizontalLayout = new HorizontalLayout();
horizontalLayout.setSizeFull();
horizontalLayout.setMargin(true);
horizontalLayout.setSpacing(true);
Label ops = new Label("OPS! Page not found.");
String imagePath = VaadinService.getCurrent().getBaseDirectory().getAbsolutePath();
FileResource brasaoResource = new FileResource(new File(imagePath + "/WEB-INF/img/brasao.png"));
Embedded brasao = new Embedded(null, brasaoResource);
horizontalLayout.addComponent(ops);
horizontalLayout.addComponent(brasao);
horizontalLayout.setComponentAlignment(ops, Alignment.MIDDLE_RIGHT);
horizontalLayout.setComponentAlignment(brasao, Alignment.MIDDLE_LEFT);
addComponent(horizontalLayout);
setComponentAlignment(horizontalLayout, Alignment.MIDDLE_CENTER);
}
@Override
public void enter(ViewChangeEvent event) {
// TODO Auto-generated method stub
}
}
The label aligns vertically but not horizontally, so the alignment RIGHT or CENTER does not works for the label component. For the image all the alignments are ok.
I checked in the Chrome F12 feature and the class v-align is not added to the div that holds the label like occurs on the image’s div.
Is it a RC1 layout issue or a common behavior?
Thanks in advance.