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
,com.vaadin.flow.component.HasStyle
,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:
-
Constructor Summary
ConstructorDescriptionCustomLayout
(String htmlTemplate) Creates a new CustomLayout with given html template. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addComponent
(String slotId, com.vaadin.flow.component.Component c) Adds component to an element identified by an id.void
remove
(com.vaadin.flow.component.Component child) void
setTemplate
(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, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setVisible
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.vaadin.flow.component.AttachNotifier
addAttachListener
Methods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListener
Methods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName
-
Constructor Details
-
CustomLayout
public CustomLayout() -
CustomLayout
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 Details
-
addComponent
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
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.
-