Class PanelLayout
java.lang.Object
com.trevlar.menukit.core.PanelLayout
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 bybodyGap. - 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 Summary
-
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 ordersizes- map from panel id toint[]{width, height}— must contain an entry for every visible panelbodyGap- vertical gap between stacked body panels, in pixelsrelativeGap- gap between a relative panel and its anchor, in pixelstitleHeight- Y offset reserved above the first body panel- Returns:
- ordered map from panel id to resolved bounds
-