Class FormattedObjectDisplayNameSpan
- java.lang.Object
-
- com.vaadin.flow.component.Component
-
- com.vaadin.flow.component.HtmlComponent
-
- com.vaadin.flow.component.HtmlContainer
-
- com.vaadin.flow.component.html.Span
-
- org.neotropic.util.visual.general.FormattedObjectDisplayNameSpan
-
- All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier
,com.vaadin.flow.component.ClickNotifier<com.vaadin.flow.component.html.Span>
,com.vaadin.flow.component.DetachNotifier
,com.vaadin.flow.component.HasComponents
,com.vaadin.flow.component.HasElement
,com.vaadin.flow.component.HasEnabled
,com.vaadin.flow.component.HasSize
,com.vaadin.flow.component.HasStyle
,com.vaadin.flow.component.HasText
,Serializable
public class FormattedObjectDisplayNameSpan extends com.vaadin.flow.component.html.Span
SimpleSpan
that takes a BusinessObjectLight instance and processes its validators to generate a formatted enclosure that can be used in trees, titles, views, or in general anywhere where the display name of an object must be shown.- Author:
- Charles Edward Bedon Cortazar <charles.bedon@kuwaiba.org>
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description FormattedObjectDisplayNameSpan(BusinessObjectLight businessObject)
Default constructor with the default format settings (ignoreTextColor = false, ignoreFillColor = false, includeClassName = true, enablePadding = true)FormattedObjectDisplayNameSpan(BusinessObjectLight businessObject, boolean ignoreTextColor, boolean ignoreFillColor, boolean includeClassName, boolean enablePadding)
A customizable constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static String
getFormattedDisplayName(BusinessObjectLight businessObject, boolean includeClassName)
This helper method should be used in scenarios when it's not necessary a whole HTML component (a Span in this case), but just the text after processing the validators.boolean
isEnablePadding()
boolean
isIgnoreFillColor()
boolean
isIgnoreTextColor()
boolean
isIncludeClassName()
void
setEnablePadding(boolean enablePadding)
void
setIgnoreFillColor(boolean ignoreFillColor)
void
setIgnoreTextColor(boolean ignoreTextColor)
void
setIncludeClassName(boolean includeClassName)
-
Methods inherited from class com.vaadin.flow.component.Component
addListener, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, 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.ClickNotifier
addClickListener, addClickShortcut
-
Methods inherited from interface com.vaadin.flow.component.HasComponents
add, add, addComponentAsFirst, addComponentAtIndex, remove, removeAll
-
Methods inherited from interface com.vaadin.flow.component.HasSize
getHeight, getHeightUnit, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, getWidthUnit, setHeight, setHeight, setHeightFull, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFull
-
-
-
-
Constructor Detail
-
FormattedObjectDisplayNameSpan
public FormattedObjectDisplayNameSpan(BusinessObjectLight businessObject)
Default constructor with the default format settings (ignoreTextColor = false, ignoreFillColor = false, includeClassName = true, enablePadding = true)- Parameters:
businessObject
- The business object whose display will be formatted.
-
FormattedObjectDisplayNameSpan
public FormattedObjectDisplayNameSpan(BusinessObjectLight businessObject, boolean ignoreTextColor, boolean ignoreFillColor, boolean includeClassName, boolean enablePadding)
A customizable constructor.- Parameters:
businessObject
- The business object whose display will be formatted.ignoreTextColor
- Ignore the "color" property expected in a validator. By default this is set tofalse
.ignoreFillColor
- Ignore the "fill-color" property expected in a validator. By default this is set tofalse
.includeClassName
- Should the class name be included in the displayed name? By default this is set totrue
.enablePadding
- If the span enclosing the display name should have a 5px padding. By default this is set totrue
.
-
-
Method Detail
-
isIgnoreTextColor
public boolean isIgnoreTextColor()
-
setIgnoreTextColor
public void setIgnoreTextColor(boolean ignoreTextColor)
-
isIgnoreFillColor
public boolean isIgnoreFillColor()
-
setIgnoreFillColor
public void setIgnoreFillColor(boolean ignoreFillColor)
-
isIncludeClassName
public boolean isIncludeClassName()
-
setIncludeClassName
public void setIncludeClassName(boolean includeClassName)
-
isEnablePadding
public boolean isEnablePadding()
-
setEnablePadding
public void setEnablePadding(boolean enablePadding)
-
getFormattedDisplayName
public static String getFormattedDisplayName(BusinessObjectLight businessObject, boolean includeClassName)
This helper method should be used in scenarios when it's not necessary a whole HTML component (a Span in this case), but just the text after processing the validators. This is useful in views, where the object display name uses its own renderer which is probably not Vaadin-made, in this case, it's only necessary the text.- Parameters:
businessObject
- The business object whose display will be formatted.includeClassName
- Should the class name be included in the displayed name?- Returns:
- The business object display name decorated with the prefixes and suffixes defined by its validators.
-
-