WidgetInfo widget,
boolean horizontal,
String locationTitle) {
Location location = getLocation(widget, horizontal);
//
ComplexProperty complexProperty;
{
@SuppressWarnings("unchecked")
Map<String, ComplexProperty> complexProperties =
(Map<String, ComplexProperty>) widget.getArbitraryValue(this);
if (complexProperties == null) {
complexProperties = Maps.newTreeMap();
widget.putArbitraryValue(this, complexProperties);
}
complexProperty = complexProperties.get(locationTitle);
if (complexProperty == null) {
complexProperty = new ComplexProperty(locationTitle, "<properties>");
complexProperty.setCategory(PropertyCategory.system(10));
complexProperties.put(locationTitle, complexProperty);
}
properties.add(complexProperty);
}
// prepare sub-properties
List<Property> subProperties = Lists.newArrayList();
if (location.leading != null) {
String title = location.leading.attribute;
subProperties.add(new LocationValue_Property(title, location.leading));
subProperties.add(new LocationUnit_Property(title + " unit", location.leading));
}
if (location.trailing != null) {
String title = location.trailing.attribute;
subProperties.add(new LocationValue_Property(title, location.trailing));
subProperties.add(new LocationUnit_Property(title + " unit", location.trailing));
}
if (location.size != null) {
String title = location.size.attribute;
subProperties.add(new LocationValue_Property(title, location.size));
subProperties.add(new LocationUnit_Property(title + " unit", location.size));
}
complexProperty.setProperties(subProperties);
}