Class CSSGridData

All Implemented Interfaces:
EventListener, IGProp<GProp<?>[]>, IPropCnr, ILayoutAssumeHeight, ILayoutAssumeWidth, ILayoutDataAlignX, ILayoutDataAlignY, ILayoutUnitHeight, ILayoutUnitWidth, Cloneable
Direct Known Subclasses:
ECSSGridData

The CSSGridData is the layout data for components in a container with CSSGridLayout.

The properties, all optional:

  column, row     IntProp   the start column and row line, 1-based; 0 (default) = auto-placed
  spanX, spanY    IntProp   how many columns and rows the component covers, default 1
  alignX, alignY  IntProp   the alignment of the component in its area: 1=left/top,
                            2=center/middle, 3=right/bottom, 4=fill
  cx, cy          UnitProp  the width and height of the component inside its area
  cxMin .. cyMax  UnitProp  the minimum and maximum width and height

The grid item always fills its area; the component is aligned inside it with the same classes as in every other IIZI layout. Sizes are CSS units only: a % is the CSS % of the grid area (see CSSGridLayout).

An auto-placed component follows its predecessors in document order; one with an explicit column or row is placed there and the auto-placed ones flow around it. Two explicitly placed components may share an area; the later one in document order is drawn on top.

Author:
Christopher Mindus
  • Field Details

  • Constructor Details

    • CSSGridData

      public CSSGridData()
      Creates a CSSGridData container without name and with a null value.
    • CSSGridData

      public CSSGridData(Atom propertyAtom)
      Creates a CSSGridData container with the specified name with a null value.
      Parameters:
      propertyAtom - the property atom.
    • CSSGridData

      public CSSGridData(Atom propertyAtom, GProp<?>[] properties) throws PropException
      Creates a CSSGridData container with the specified name and properties.
      Parameters:
      propertyAtom - the property atom.
      properties - the property array value for the property.
      Throws:
      PropException - as structural changes in containers on client is prohibited.
  • Method Details

    • getColumn

      public int getColumn()
      Returns the explicit start column.
      Returns:
      The 1-based column line, 0 when auto-placed.
    • getRow

      public int getRow()
      Returns the explicit start row.
      Returns:
      The 1-based row line, 0 when auto-placed.
    • getSpanX

      public int getSpanX()
      Returns the number of columns covered.
      Returns:
      The span, at least 1.
    • getSpanY

      public int getSpanY()
      Returns the number of rows covered.
      Returns:
      The span, at least 1.
    • isAutoPlaced

      public boolean isAutoPlaced()
      Returns if the component is auto-placed in both axes.
      Returns:
      true when neither a column nor a row is set.
    • setCell

      public void setCell(int column, int row)
      Places the component at an explicit column and row, or back to auto-placement.
      Parameters:
      column - The 1-based start column, 0 for auto, -1 for no change.
      row - The 1-based start row, 0 for auto, -1 for no change.
      Throws:
      IllegalArgumentException - For a value below -1.
    • setSpan

      public void setSpan(int spanX, int spanY)
      Sets the spans.
      Parameters:
      spanX - The column span, at least 1; 0 for no change.
      spanY - The row span, at least 1; 0 for no change.
      Throws:
      IllegalArgumentException - For a negative value.
    • canSetWidth

      public boolean canSetWidth()
      Verifies if the component width can be set.
      Overrides:
      canSetWidth in class LayoutProp
      Returns:
      true if the width can be set.
    • canSetHeight

      public boolean canSetHeight()
      Verifies if the component height can be set.
      Overrides:
      canSetHeight in class LayoutProp
      Returns:
      true if the height can be set.
    • setSize

      public boolean setSize(GUnit width, GUnit height, IComplexOperation op)
      Assigns the component width and/or height.
      Overrides:
      setSize in class LayoutProp
      Parameters:
      width - The width to set, null for no change.
      height - The height to set, null for no change.
      op - The complex operation interface for undo/redo operations, null for none.
      Returns:
      true for success.