protected void computeWidgetMap() { if (rows == null || rows.length == 0) { return; } for (LayoutRow row : rows) { Widget[] widgets = row.getWidgets(); if (widgets == null || widgets.length == 0) { continue; } for (Widget widget : widgets) { if (widget != null) { widgetMap.put(widget.getName(), widget); } } } }
@Override public void setValueName(String valueName) { this.valueName = valueName; // set it on all widgets too if (rows == null || rows.length == 0) { return; } for (LayoutRow row : rows) { Widget[] widgets = row.getWidgets(); if (widgets == null || widgets.length == 0) { continue; } for (Widget widget : widgets) { if (widget != null) { widget.setValueName(valueName); } } } }
protected void writeLayoutRow(LayoutRow layoutRow, JsonGenerator jg) throws IOException { jg.writeStartObject(); String name = layoutRow.getName(); if (name != null) { jg.writeStringField("name", name); } // fill selection info only if that's not the default value from the // definition if (layoutRow.isAlwaysSelected()) { jg.writeBooleanField("alwaysSelected", true); } if (!layoutRow.isSelectedByDefault()) { jg.writeBooleanField("selectedByDefault", false); } Map<String, Serializable> properties = layoutRow.getProperties(); if (MapUtils.isNotEmpty(properties)) { writeSerializableMapField("properties", properties, jg); } Widget[] widgets = layoutRow.getWidgets(); if (ArrayUtils.isNotEmpty(widgets)) { jg.writeArrayFieldStart("widgets"); for (Widget widget : widgets) { writeWidget(widget, jg); } jg.writeEndArray(); } jg.writeEndObject(); }