Class PanelLayout

java.lang.Object
com.trevlar.menukit.core.PanelLayout

public final class PanelLayout extends Object
Pure layout utility. Resolves PanelPosition constraints across a list of panels and produces per-panel PanelBounds.

Context-neutral. The caller supplies per-panel sizes (computed in a context-specific way — inventory-menu handlers compute sizes from slot groups; standalone screens compute sizes from element bounds) and the utility applies the constraint model.

Constraint model:

  • Body panels stack vertically in a single column starting at titleHeight, separated by bodyGap.
  • Relative panels (rightOf / leftOf / above / below another panel) are positioned adjacent to their anchor panel with a separation of relativeGap.

Hidden panels are skipped (their bounds are not computed). Relative panels whose anchor is hidden are also skipped.

  • Method Details

    • resolve

      public static Map<String, PanelBounds> resolve(List<Panel> panels, Map<String,int[]> sizes, int bodyGap, int relativeGap, int titleHeight)
      Resolves layout bounds for a list of panels given their computed sizes.
      Parameters:
      panels - the panels in declaration order
      sizes - map from panel id to int[]{width, height} — must contain an entry for every visible panel
      bodyGap - vertical gap between stacked body panels, in pixels
      relativeGap - gap between a relative panel and its anchor, in pixels
      titleHeight - Y offset reserved above the first body panel
      Returns:
      ordered map from panel id to resolved bounds