Package io.jmix.dynattrui.panel
Class DynamicAttributesPanel
- All Implemented Interfaces:
AttachNotifier,Component,Component.BelongToFrame,HasDebugId,HasHtmlSanitizer,HasMargin,Validatable
@StudioComponent(category="Components",
unsupportedProperties={"enable","responsive"},
xmlns="http://jmix.io/schema/dynattr/ui",
xmlnsAlias="dynattr",
icon="io/jmix/dynattrui/icon/component/dynamicAttributesPanel.svg",
canvasIcon="io/jmix/dynattrui/icon/component/dynamicAttributesPanel_canvas.svg",
canvasIconSize=LARGE)
public class DynamicAttributesPanel
extends CompositeComponent<VBoxLayout>
implements Validatable, HasMargin
-
Nested Class Summary
Nested classes/interfaces inherited from class io.jmix.ui.component.CompositeComponent
CompositeComponent.CreateEventNested classes/interfaces inherited from interface io.jmix.ui.component.Component
Component.Alignment, Component.BelongToFrame, Component.Disposable, Component.Editable, Component.Focusable, Component.HasCaption, Component.HasDescription, Component.HasIcon, Component.HasXmlDescriptor, Component.Wrapper -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected HBoxLayoutprotected Integerstatic final Stringprotected DynAttrMetadataprotected Stringprotected Stringprotected InstanceContainer<?>protected Messagesstatic final Stringprotected Formprotected Integerprotected UiComponentsprotected UiComponentsGeneratorFields inherited from class io.jmix.ui.component.CompositeComponent
applicationContext, frame, id, prefixId, rootFields inherited from interface io.jmix.ui.component.Component
AUTO_SIZE, AUTO_SIZE_PX, FULL_SIZE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddFieldsToForm(Form newPropertiesForm, Map<AttributeDefinition, Component> fields) protected ComponentgenerateFieldComponent(AttributeDefinition attribute) protected Collection<AttributeDefinition>protected Collection<CategoryDefinition>protected Categoryprotected intgetRowsPerColumn(int propertiesCount) protected voidinitCategoryField(InstanceContainer<?> instanceContainer) protected voidinitFieldCaptionWidth(Form newRuntimeForm) protected voidbooleanisValid()protected voidonCreate(CompositeComponent.CreateEvent createEvent) protected voidvoidsetCategoryFieldVisible(boolean visible) Sets visibility of theCategoryFieldcomponent.voidsetColumnsCount(Integer cols) Sets the number of columns.voidsetFieldCaptionWidth(String fieldCaptionWidth) Sets the width of the fields caption.voidsetFieldWidth(String fieldWidth) Sets the width of the fields.voidsetInstanceContainer(InstanceContainer<Object> container) Defines InstanceContainer for DynamicAttributesPanel.voidsetMargin(MarginInfo marginInfo) voidsetRowsCount(Integer rows) Sets the number of rows.protected voidsetWidth(Component component, AttributeDefinition attribute) voidvalidate()Methods inherited from class io.jmix.ui.component.CompositeComponent
addAttachListener, addCreateListener, addDetachListener, addStyleName, assignDebugId, attached, detached, disableEventListeners, enableEventListeners, getAlignment, getComposition, getCompositionOrNull, getDebugId, getEventHub, getFrame, getFullId, getHeight, getHeightSizeUnit, getId, getInnerComponent, getInnerComponentOptional, getParent, getPrefixId, getStyleName, getUiEventListeners, getWidth, getWidthSizeUnit, hasSubscriptions, isAttached, isEnabled, isEnabledRecursive, isHtmlSanitizerEnabled, isResponsive, isVisible, isVisibleRecursive, publish, removeStyleName, setAlignment, setApplicationContext, setComposition, setDebugId, setEnabled, setFrame, setHeight, setHtmlSanitizerEnabled, setId, setParent, setResponsive, setStyleName, setUiEventListeners, setVisible, setWidth, unsubscribe, unwrap, unwrapComposition, unwrapCompositionOrNull, unwrapOrNull, updateComponentIds, updateIdIfNeeded, withUnwrapped, withUnwrappedCompositionMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.jmix.ui.component.Component
setHeightAuto, setHeightFull, setSizeAuto, setSizeFull, setWidthAuto, setWidthFullMethods inherited from interface io.jmix.ui.component.Validatable
isValidateOnCommit
-
Field Details
-
NAME
- See Also:
-
DEFAULT_FIELD_WIDTH
-
uiComponentsGenerator
-
uiComponents
-
messages
-
dynAttrMetadata
-
instanceContainer
-
cols
-
rows
-
fieldWidth
-
fieldCaptionWidth
-
propertiesForm
-
categoryFieldBox
-
categoryField
-
-
Constructor Details
-
DynamicAttributesPanel
public DynamicAttributesPanel()
-
-
Method Details
-
onCreate
-
initPropertiesForm
protected void initPropertiesForm() -
addFieldsToForm
-
getRowsPerColumn
protected int getRowsPerColumn(int propertiesCount) -
getAttributesByCategory
-
generateFieldComponent
-
setWidth
-
initCategoryField
-
getDefaultCategory
-
getCategoryDefinitions
-
getCategoriesOptionsList
-
initFieldCaptionWidth
-
onInstanceContainerItemChangeEvent
-
setInstanceContainer
@StudioProperty(name="dataContainer", type=DATACONTAINER_REF, required=true) public void setInstanceContainer(InstanceContainer<Object> container) Defines InstanceContainer for DynamicAttributesPanel.- Parameters:
container-InstanceContainerobject with editing entity
-
setColumnsCount
Sets the number of columns. Ifnullvalue is passed, columns count will be determined based on therowsparameter.- Parameters:
cols- positive integer ornull
-
setRowsCount
Sets the number of rows. This parameter will only be taken into account ifcols == null.- Parameters:
rows- positive integer ornull
-
setFieldWidth
Sets the width of the fields. This parameter is used if some dynamic attribute does not have own width value.- Parameters:
fieldWidth- width of the fields
-
setFieldCaptionWidth
Sets the width of the fields caption.fieldCaptionWidthwith '%' unit is unsupported.- Parameters:
fieldCaptionWidth- width of the fields caption
-
setCategoryFieldVisible
public void setCategoryFieldVisible(boolean visible) Sets visibility of theCategoryFieldcomponent.- Parameters:
visible- visibility flag
-
isValid
public boolean isValid()- Specified by:
isValidin interfaceValidatable
-
validate
- Specified by:
validatein interfaceValidatable- Throws:
ValidationException
-
setMargin
-
getMargin
-