public ViewBehaviorTable getViewBehaviorTable(KeyValueList properties) { RowProvider provider = null; if (properties.contains("row-layout") && properties.contains("table-layout")) { throw new RuntimeException("May not use row-layout and table-layout at the same time."); } if (properties.contains("row-layout")) { provider = buildProviderForRowLayout(properties); } else if (properties.contains("table-layout")) { provider = buildProviderForTableLayout(properties); } else { throw new RuntimeException("Must use row-layout or table-layout"); } return new ViewBehaviorTable(properties, provider); }
private RowProvider buildProviderForRowLayout(KeyValueList properties) { if (!properties.contains("key")) { throw new RuntimeException( "row-layout expects a key for the data model array providing data for each row"); } final String rowLayout = properties.getValue("row-layout"); final String key = properties.getValue("key"); return new RowProviderRowLayout(key, rowLayout); }