Package org.vaadin.firitin.components
Class CustomLayout
- java.lang.Object
-
- com.vaadin.flow.component.Component
-
- com.vaadin.flow.component.Composite<com.vaadin.flow.component.html.Div>
-
- org.vaadin.firitin.components.CustomLayout
-
- All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier,com.vaadin.flow.component.DetachNotifier,com.vaadin.flow.component.HasElement,Serializable
public class CustomLayout extends com.vaadin.flow.component.Composite<com.vaadin.flow.component.html.Div>A replacement for V7/8 era custom layout component for which one can provide a template dynamically and still place Vaadin components into it. Slots where you want to put component(s), must be identified with id, e.g.<div><h1>Hello!<h1><div id="tmpl-slot"></div></div>
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description CustomLayout()CustomLayout(String htmlTemplate)Creates a new CustomLayout with given html template.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddComponent(String slotId, com.vaadin.flow.component.Component c)Adds component to an element identified by an id.voidremove(com.vaadin.flow.component.Component child)voidsetTemplate(String htmlTemplate)Sets the html template.-
Methods inherited from class com.vaadin.flow.component.Composite
getChildren, getContent, getElement, initContent
-
Methods inherited from class com.vaadin.flow.component.Component
addListener, findAncestor, fireEvent, from, get, getEventBus, getId, getListeners, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, scrollIntoView, set, setElement, setId, setVisible
-
-
-
-
Constructor Detail
-
CustomLayout
public CustomLayout()
-
CustomLayout
public CustomLayout(String htmlTemplate)
Creates a new CustomLayout with given html template. Note, that html is handled as raw, so be sure to sanitize it if you can't trust the source.- Parameters:
htmlTemplate- the html template.
-
-
Method Detail
-
addComponent
public void addComponent(String slotId, com.vaadin.flow.component.Component c)
Adds component to an element identified by an id.- Parameters:
slotId- the id of the slot into the component should be addedc- the component to add
-
remove
public void remove(com.vaadin.flow.component.Component child)
-
setTemplate
public void setTemplate(String htmlTemplate)
Sets the html template. Note, that html is handled as raw, so be sure to sanitize it if you can't trust the source.- Parameters:
htmlTemplate- the html template.
-
-