Duy
(Duy Vo)
1
How would i go about adding a simple div element in a css layout. For instance:
public class MyLayout extends CssLayout {
public MyLayout() {
//addComponent(WHAT DO I PUT HERE?);
}
}
For instance, i would like to add just 1 div:
I need to do it without the framework adding additional extraneous divs around my div.
Thanks!
duy
Jouni1
(Jouni Koivuviita)
2
Use a plain Label component. That’s just one DIV on the client side, and you can set the classname of that DIV with Label.setStyleName(String)
E.g.[code]
public class MyLayout extends CssLayout {
public MyLayout() {
Label l = new Label();
l.setSizeUndefined(); // labels are 100% wide by default
l.setStyleName(“divClass1”);
addComponent(l);
}
}
[/code]
But since I don’t know what you’re needs are exactly, this might be a totally useless approach.
Ezra5
(Ezra Epstein)
3
How to nest another component inside the div ? Doesn’t seem that Labels take sub-components?
ollit.1
(Olli Tietäväinen)
4
Nope, you can’t put components inside a Label. You can put HTML, though, if you specify the correct Content Mode. Maybe you want a
Custom Layout
?
-Olli