Class CSSGridLayout
- All Implemented Interfaces:
EventListener, IGProp<GProp<?>[]>, IPropCnr, Cloneable
- Direct Known Subclasses:
ECSSGridLayout
display: grid).It is the native counterpart of GridLayout (the "Grid layout", a port of the SWT GridLayout that measures and places every child in JavaScript). Here the client only writes CSS: the column and row tracks, the gaps and the placement of each child, and the Browser sizes and places everything, including on a resize. Nothing is measured per child, and the layout is responsive by itself through fr, minmax() and repeat(auto-fill,...).
The properties, all optional:
columns StringProp grid-template-columns, CSS track list (see CSSGridTracks)
rows StringProp grid-template-rows, CSS track list
autoColumns StringProp grid-auto-columns, track sizes of implicit columns
autoRows StringProp grid-auto-rows, track sizes of implicit rows
flow IntProp grid-auto-flow: 0=row, 1=column, 2=row dense, 3=column dense
gapX, gapY UnitProp column-gap, row-gap (CSS units only)
justifyContent IntProp justify-content: 0=start, 1=center, 2=end, 3=stretch,
4=space-between, 5=space-around, 6=space-evenly
alignContent IntProp align-content, same values
mx, my UnitProp minimum width and height of the grid
$hscroll, $vscroll the scroll settings shared by every layout
Units. Only CSS units are used, so the Browser resolves every value itself and the layout never needs a JavaScript re-layout on a container resize. A % in this layout is the CSS %: of the grid container for a track and a gap, of the grid area for a component's size. That differs from IIZI's % in the other layouts, which is computed against the parent container.
Placement. A child is auto-placed in document order by default and may be given an explicit start column and row with spans in both axes (see CSSGridData), so no filler components are needed for an empty cell. A hidden child frees its cell.
A new container with this layout gets one stretching column "1fr" in the Designer; the server side never needs computed sizes, so this class holds the properties and answers the size questions of the Designer markers only.
- Author:
- Christopher Mindus
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe name of the vertical track distribution property.static final StringThe name of the implicit column size property.static final StringThe name of the implicit row size property.static final StringThe name of the column track list property.static final String[]The CSS values ofjustifyContentandalignContent, by index.static final StringThe column track list of a new container in the Designer: one stretching column.static final StringThe name of the auto-placement flow property.static final String[]The CSS values of theflowproperty, by index.static final StringThe name of the column gap property.static final StringThe name of the row gap property.static final StringThe name of the horizontal track distribution property.static final StringThe name of the row track list property.Fields inherited from class PropCnr
EMPTY, EMPTY_CLASSES, EMPTY_CNRS, EXTENDS_FRAMEWORK_ERROR_IDFields inherited from class GProp
GPDEBUG, PROP_ATTR_STRING_EDITOR_PROP, PROP_ATTR_STRING_ERRORED_NAME, PROP_ATTR_STRING_EXTENDS, PROP_ATTR_STRING_EXTENDS_FINAL, PROP_ATTR_STRING_EXTENDS_PRIVATE, PROP_ATTR_STRING_NULLABLE, PROP_ATTR_STRING_PRIVATE, PROP_ATTR_STRING_PRIVATE_CHANGE_EVENT, PROP_ATTR_STRING_PROVENANCE, PROP_ATTR_STRING_READ_ONLY, PROP_ATTR_STRING_SECRET, PROP_USER_1, PROP_USER_2Fields inherited from interface IGProp
EQC_ERROR_IGNORE_ALL, EQC_ERROR_IGNORE_REFERENCES, EQC_IGNORE_ARRAY, EQC_IGNORE_VOLATILE_OR_EDITOR, EQC_INCLUDE_PRIVATE, EQC_SAVE_FILE, EQC_SAVE_RELEVANT_ONLY, EXT_CONTAINER_EXTENDS, EXT_CONTAINER_EXTENDS_VALID, EXT_EXTENDED, EXT_FINAL, EXT_OVERRIDES, EXT_OVERRIDES_FINAL_ERR, EXT_PRIVATEConstructor Summary
ConstructorsConstructorDescriptionCreates the layout without name with a null value.CSSGridLayout(Atom propertyAtom) Creates the layout with the specified name with a null value.CSSGridLayout(Atom propertyAtom, GProp<?>[] properties) Creates the layout with the specified name and properties.Method Summary
Modifier and TypeMethodDescriptionclone()Creates a clone out of this property.createDefaultLayoutProp(UIComp uiComp) Creates the default LayoutProp to use for a new component that is inserted directly into the UIComps container.Returns the column track list text.Returns the class required for this layout property.getRows()Returns the row track list text.protected booleanVerifies if this container has an implicit height due to e.g.protected booleanVerifies if this container has an implicit width due to e.g.protected booleanhasHeight0(CSSGridData layout) Verifies if the layout data gives the component a height; seehasWidth0(CSSGridData).booleanReturns if the layout causes implicit horizontal fill of its container: a CSS Grid container whose layout data has a width (cx) fills its frame horizontally, whatever alignment its layout data gives, so that itsfrtracks get the room; a container is an inline-block that otherwise shrinks to its content (owner ruling 2026-11-04, CSSG-D-15).booleanReturns if the layout causes implicit vertical fill of its container: a CSS Grid container whose layout data has a height (cy) fills its frame vertically; seehasImplicitAlignFillX().protected booleanhasWidth0(CSSGridData layout) Verifies if the layout data gives the component a width.booleanDoes this component require a height?booleanDoes this component require a width?voidsetAutoColumns(String tracks) Sets the size of the implicit columns (columns created by placement beyond the explicit ones), e.g.voidsetAutoRows(String tracks) Sets the size of the implicit rows, e.g.voidsetColumns(String tracks) Sets the column track list, e.g.voidsetContentAlign(int justify, int align) Sets how the tracks are distributed when they are smaller than the container.voidsetFlow(int flow) Sets the auto-placement flow.voidSets the gaps between columns and rows.voidSets the row track list; seesetColumns(String).Methods inherited from class LayoutMgr
add, add, add, getCompsCnr, getUIComps, getUIContainer, getUIPanel, onBeforeAdd, remove, virtualizeMethods inherited from class PropCnr
__transferChildProps, addPredefinedProps, addProp, addProp, addProp2, addProp2, appendPropValue, canRequestFocus, completeVirtualize, containsProp, containsProp, convertLoadedProp, couldRequestFocusIfVirtualized, createCopyOfAtom, createUniqueAtom, createUniqueAtom, createUniqueAtom, createVSReference, doPropEqualsArrayValues, enablePropCommunication, enablePropHashMap, equalsTree, equalsTree, getAllProps, getAllProps, getAllProps, getAllProps, getAllProps, getAllProps, getAllProps, getAllProps, getBool, getBool, getBool, getBool, getChildPropError, getChildPropError, getChildPropErrorSeverity, getChildPropErrorSeverity, getErrorsProp, getExtendsContainer, getExtendsError, getExtendsName, getExtendsOverride, getExtendsPossibleClasses, getFirstProp, getFirstProp, getFocusEngine, getInt, getInt, getInt, getInt, getLong, getLong, getLong, getLong, getNumber, getNumber, getNumber, getNumber, getPossibleChildren, getPredefinedProps, getProp, getProp, getProp, getProp, getProp, getProp, getProp, getProp, getProp, getProp, getProp, getPropBaseReference, getPropCnr, getPropCount, getPropCount, getPropIndex, getPropIndex, getPropIndexes, getProps, getProps, getPropValue, getPropValue, getPropValue, getPropValue, getPropValue, getPropValue, getPropValue, getPropValue0, getRetargetedVerifyContainer, getString, getString, getString, getString, getValueClasses, getVSReference, hasFocus, hasSendData, initializeElement, initializeExtendsFramework, initializeProp, initializePropTree, initializeValue, initPropCnr, insertProp, insertProp2, isChild, isExtendsOverriden, isExtendsPropertyValid, isExtendsRoot, isPropAddRemoveAllowed, isPropCommunicating, isPropExtended, isPropValueTreeLockNeeded, list, list, logPropNotFound, maybeAddProp, onInsertProp, onPropDispose, onPropRemoved, onPropTreeInitialized, onReferenceEvent, onVirtualContainerCreated, onVirtualizationCompleted, paramString, prepare, removeAllProps, removeAllProps2, removeProp, removeProp, removeProp, removeProp, removeProp, removeProp, removeProp, removeProp2, removeProp2, removeProp2, removeProp2, removeProp2, removeProp2, removeProp2, reorderProps, replaceProps, requestFocus, requestFocus, requestFocusEx, requestFocusEx, resolveReferences, resolveRuntimeReferences, setBool, setBool, setBool, setBool, setCreateRequiredProp, setExtendsName, setExtendsOverride, setInt, setInt, setInt, setLong, setLong, setLong, setLong, setNumber, setNumber, setNumber, setNumber, setProp, setProp, setProp, setProp2, setProp2, setPropValue, setPropValue, setPropValue, setPropValue, setPropValue, setPropValue, setString, setString, setString, setString, shouldCreateProps, shouldSerializeToXML, toElementString, toNativeValue0, usePropHashMap, usesPropIndex, validateChildPropInValue, validateClassInstances, validatePropType, validatePropValue, verify, verifyInternalUseOnly, verifyTreeMethods inherited from class GProp
addPropError, addPropListener, appendProp, convertPropError, dispose, equals, equals, equalsErrors, equalsObj, equalsPropValue, equalValues, finalize, fine, fine, finer, finer, finest, finest, fromElementString, getAliasName, getAppSessionGyro, getAppWorker, getAtomPath, getAttribute, getChildReferencePropName, getClientSessionGyro, getClientWorker, getConstraints, getEnvironment, getErroredPropItems, getErroredProps, getErrorsProp, getExtendsRootContainer, getFullPropName, getFullPropName, getFullPropNameDebug, getFullPropNameDebug, getListeners, getModuleFolder, getModuleFolder, getParent, getParent, getProjectName, getPropAtom, getPropError, getPropError, getPropErroredName, getPropErrorSeverity, getPropExtendsFlags, getPropFromPath, getPropFromPath, getPropFromReference, getPropFromReference, getPropIndex, getPropName, getPropPath, getPropPath, getPropReferenceTarget, getPropRootPropMgr, getPropTreeErrorSeverity, getPropValue, getPropValue, getPropValueObject, getReferencePropName, getReferencePropNameNoAssert, getRelativePropName, getRootFromName, getRootName, getRootParent, getRootParentNoAssert, getTreeLock, hasChanged, hasCircularReferencesError, hashCode, hasPrivateChangeEventProp, hasPropError, hasPropProvenance, hasPropTreeError, info, info, initializeGElement, initializeGProp, isDisposed, isPropChildOf, isPropClientCreated, isPropCreateRequired, isPropErrorPersisted, isPropExtended, isPropExtendsFinal, isPropExtendsPrivate, isPropExtendsPrivateInRoot, isPropExtendsPrivateInRoot, isPropFile, isPropFolder, isPropForEditor, isPropForEditorAtCreation, isPropNullable, isPropPrivate, isPropPrivateAtCreation, isPropReadOnly, isPropReferenceTreeValid, isPropRoot, isPropRootLoading, isPropRootTreeModificationsAllowed, isPropSaveRelevant, isPropSecret, isPropSecretCapable, isPropUSER, isPropVirtualized, isPropVirtualizing, isPropVolatile, isPropVolatileOrEditorOnly, isProxied, isSibling, list, list, list, mapAliasToReference, mapAliasToReference, mapReferenceToAlias, mapReferenceToAlias, mapReferenceToProjectRelative, modifyPropValue, moveProp, moveProp, moveProp, onEvent, onEventSelf, onInitialize, onPrepare, onPropInvalidateCache, onPropParentChanged, onPropValueSet, onRemoteEvent, paramString, paramValue, post, post, removePropError, removePropListener, removePropUSER, renameProp, renameProp2, resetChangedTree, setChanged, setConstraints, setConstraints, setParent, setPrivateChangeEventProp, setPrivateCreateRequiredProp, setPropError, setPropErroredName, setPropExtended, setPropExtendsFinal, setPropExtendsPrivate, setPropForEditor, setPropNullable, setPropPrivate, setPropProvenance, setPropReadOnly, setPropSecret, setPropUSER, setPropValue, setPropValue, setPropValue, setPropValueIncognito, setPropVolatile, severe, severe, severe, shouldSerializeToXML, throwIfReadOnly, toNativeValue, toShortString, toShortString, toString, toString, triggerRemoteEvent, triggerRemoteEvent, validateProp, warning, warning, warningMethods inherited from interface IGProp
addPropError, addPropListener, dispose, equals, fine, fine, finer, finer, finest, finest, fromElementString, getAppSessionGyro, getAtomPath, getClientSessionGyro, getConstraints, getEnvironment, getErroredPropItems, getErroredProps, getErrorsProp, getExtendsRootContainer, getFullPropName, getFullPropNameDebug, getModuleFolder, getModuleFolder, getParent, getParent, getPropAtom, getPropError, getPropError, getPropErrorSeverity, getPropExtendsFlags, getPropFromPath, getPropFromReference, getPropIndex, getPropName, getPropPath, getPropPath, getPropRootPropMgr, getPropTreeErrorSeverity, getPropValue, getPropValue, getReferencePropName, getRelativePropName, getRootParent, getTreeLock, hasChanged, hasCircularReferencesError, hasPrivateChangeEventProp, hasPropError, hasPropTreeError, info, info, initializeGElement, initializeGProp, isDisposed, isPropChildOf, isPropClientCreated, isPropCreateRequired, isPropExtended, isPropExtendsFinal, isPropExtendsPrivate, isPropExtendsPrivateInRoot, isPropExtendsPrivateInRoot, isPropFile, isPropFolder, isPropNullable, isPropPrivate, isPropReadOnly, isPropReferenceTreeValid, isPropRoot, isPropVirtualized, isSibling, list, list, list, mapAliasToReference, mapReferenceToAlias, mapReferenceToProjectRelative, moveProp, moveProp, moveProp, onEvent, onEventSelf, onRemoteEvent, removePropError, removePropListener, renameProp, setChanged, setConstraints, setConstraints, setParent, setPrivateChangeEventProp, setPropError, setPropExtendsFinal, setPropExtendsPrivate, setPropNullable, setPropPrivate, setPropReadOnly, setPropValue, setPropValue, severe, severe, severe, toNativeValue, triggerRemoteEvent, triggerRemoteEvent, validateProp, warning, warning, warningMethods inherited from interface IPropCnr
canRequestFocus, canRequestFocus, couldRequestFocusIfVirtualized, couldRequestFocusIfVirtualized
Field Details
COLUMNS
ROWS
AUTO_COLUMNS
AUTO_ROWS
FLOW
GAP_X
GAP_Y
JUSTIFY_CONTENT
The name of the horizontal track distribution property.- See Also:
ALIGN_CONTENT
The name of the vertical track distribution property.- See Also:
FLOWS
The CSS values of theflowproperty, by index. Append-only: the index is stored.CONTENT_ALIGNS
The CSS values ofjustifyContentandalignContent, by index. Append-only: the index is stored.DEFAULT_COLUMNS
The column track list of a new container in the Designer: one stretching column.- See Also:
Constructor Details
CSSGridLayout
public CSSGridLayout()Creates the layout without name with a null value.CSSGridLayout
Creates the layout with the specified name with a null value.- Parameters:
propertyAtom- the property atom.
CSSGridLayout
Creates the layout with the specified name and properties.- Parameters:
propertyAtom- the property atom.properties- the property array value for the layout manager.- Throws:
PropException- as structural changes in containers on client is prohibited.
Method Details
clone
Creates a clone out of this property. The cloning is overridden by the subclasses in order to handle cloning of its class variables appropriately.- Overrides:
clonein classLayoutMgr<CSSGridData>
createDefaultLayoutProp
Creates the default LayoutProp to use for a new component that is inserted directly into the UIComps container.- Specified by:
createDefaultLayoutPropin classLayoutMgr<CSSGridData>- Parameters:
uiComp- The component requesting the default layout property.- Returns:
- A new instance of the layout data of this layout manager.
getLayoutPropClass
Returns the class required for this layout property.- Specified by:
getLayoutPropClassin classLayoutMgr<CSSGridData>- Returns:
- The class for the layout property required.
getColumns
Returns the column track list text.- Returns:
- The CSS text, empty when not set.
setColumns
Sets the column track list, e.g."200px 1fr"or"repeat(auto-fill,minmax(160px,1fr))". The text is validated and stored in its canonical form; null or blank removes the property.- Parameters:
tracks- The CSS track list.- Throws:
IllegalArgumentException- When the text is not an accepted track list (the message says what and where).
getRows
setRows
Sets the row track list; seesetColumns(String).- Parameters:
tracks- The CSS track list, null or blank to remove.- Throws:
IllegalArgumentException- When the text is not an accepted track list.
setAutoColumns
Sets the size of the implicit columns (columns created by placement beyond the explicit ones), e.g."minmax(100px,auto)".- Parameters:
tracks- One or more CSS track sizes, norepeat(); null or blank to remove.- Throws:
IllegalArgumentException- When the text is not an accepted track size list.
setAutoRows
Sets the size of the implicit rows, e.g."minmax(48px,auto)".- Parameters:
tracks- One or more CSS track sizes, norepeat(); null or blank to remove.- Throws:
IllegalArgumentException- When the text is not an accepted track size list.
setFlow
public void setFlow(int flow) Sets the auto-placement flow.- Parameters:
flow- An index intoFLOWS.- Throws:
IllegalArgumentException- For an index outside the table.
setGap
Sets the gaps between columns and rows.- Parameters:
gapX- The column gap, null for no change.gapY- The row gap, null for no change.- Throws:
IllegalArgumentException- When a gap is not a pure CSS unit.
setContentAlign
public void setContentAlign(int justify, int align) Sets how the tracks are distributed when they are smaller than the container.- Parameters:
justify- The horizontal distribution, an index intoCONTENT_ALIGNS, -1 for no change.align- The vertical distribution, an index intoCONTENT_ALIGNS, -1 for no change.- Throws:
IllegalArgumentException- For an index outside the table.
mustHaveWidth
public boolean mustHaveWidth()Does this component require a width?- Overrides:
mustHaveWidthin classLayoutMgr<CSSGridData>- Returns:
- Returns true if the horizontal scrollbar setting is "auto" or "scroll".
mustHaveHeight
public boolean mustHaveHeight()Does this component require a height?- Overrides:
mustHaveHeightin classLayoutMgr<CSSGridData>- Returns:
- Returns true if the vertical scrollbar setting is "auto" or "scroll".
hasWidth0
Verifies if the layout data gives the component a width. In a CSS grid the component gets the width of its area only when it fills it; otherwise only an explicit width counts. (A track grows, never a child: what the Grid layout calls "grab" is anfrtrack here.)- Overrides:
hasWidth0in classLayoutMgr<CSSGridData>- Parameters:
layout- The layout data.- Returns:
- true if the component fills its area horizontally or has a non-zero width.
hasHeight0
Verifies if the layout data gives the component a height; seehasWidth0(CSSGridData).- Overrides:
hasHeight0in classLayoutMgr<CSSGridData>- Parameters:
layout- The layout data.- Returns:
- true if the component fills its area vertically or has a non-zero height.
hasContainerLayoutImplicitWidth
protected boolean hasContainerLayoutImplicitWidth()Verifies if this container has an implicit width due to e.g. children.- Overrides:
hasContainerLayoutImplicitWidthin classLayoutMgr<CSSGridData>- Returns:
- true if an implicit width is present, false (default) otherwise.
hasContainerLayoutImplicitHeight
protected boolean hasContainerLayoutImplicitHeight()Verifies if this container has an implicit height due to e.g. children.- Overrides:
hasContainerLayoutImplicitHeightin classLayoutMgr<CSSGridData>- Returns:
- true if an implicit height is present, false (default) otherwise.
hasImplicitAlignFillX
public boolean hasImplicitAlignFillX()Returns if the layout causes implicit horizontal fill of its container: a CSS Grid container whose layout data has a width (cx) fills its frame horizontally, whatever alignment its layout data gives, so that itsfrtracks get the room; a container is an inline-block that otherwise shrinks to its content (owner ruling 2026-11-04, CSSG-D-15). Not in a CSS Grid parent: when the layout data isCSSGridData, the frame is the cell and the width is the size in the cell that the alignment places (CSSG-D-17).This is the Java twin of
fillsFrame(cnr,horz)iniz/ui/CSSGridLayout.js, asked by the client'sUIContainer.alwaysFillX();UIContainer.hasImplicitAlignFillX()forwards here. A layout that has been replaced no longer answers for the container, so the stored alignment of its layout data applies again (asonPropDisposedoes in the client).- Overrides:
hasImplicitAlignFillXin classLayoutMgr<CSSGridData>- Returns:
- true when the container's layout data has a width and is not
CSSGridData.
hasImplicitAlignFillY
public boolean hasImplicitAlignFillY()Returns if the layout causes implicit vertical fill of its container: a CSS Grid container whose layout data has a height (cy) fills its frame vertically; seehasImplicitAlignFillX(). The Java twin offillsFrame(cnr,false)iniz/ui/CSSGridLayout.js, asked by the client'sUIContainer.alwaysFillY().- Overrides:
hasImplicitAlignFillYin classLayoutMgr<CSSGridData>- Returns:
- true when the container's layout data has a height and is not
CSSGridData.