Directory

SpaceWrapper - Vaadin Add-on Directory

SpaceWrapper - if you do not want to bloat your css files with margins and paddings SpaceWrapper - Vaadin Add-on Directory
By using SpaceWrapper you can avoid bloating your css file with unnecessary rules. For instance, a label that needs to be a little repositioned. To do it the "old" way, you may add a stylename to the label and then edit the theme's css-file. But what if you have a lot of quirks like this, or what if you want to dynamically change the paddings or margins dynamically? With SpaceWrapper, this is easy. You can wrap any AbstractComponent, and the SpaceWrapper also takes care of the component sizing. An important thing to note, is that after you wrapped your component, if you want to do any sizing operations, you should do such via the wrapper. Changing the size of your wrapper, also changes the contained component in the same fashion. For instance, if you want to set your contained label to 100px wide, you instead call setWidth() of the wrapper. With SpaceWrapper, you can dynamically create custom margins and paddings to your component. The SpaceWrapper itself is invisible. Please check out the demo, where a layout has been wrapped. The red background has been added to hilight the wrapper.