use of com.scriptographer.adm.Item in project scriptographer by scriptographer.
the class AdmComponentProxy method addToContent.
protected int addToContent(Dialog dialog, LinkedHashMap<String, com.scriptographer.adm.Component> content, int column, int row) {
Item valueItem = createItem(dialog);
String label = component.getLabel();
boolean isRuler = component.getType() == ComponentType.RULER;
boolean hasLabel = !isRuler && label != null && !"".equals(label);
if (hasLabel) {
TextPane labelItem = new TextPane(dialog);
labelItem.setText(label + ":");
// Adjust top margin of label to reflect the native margin
// in the value item.
Item marginItem = valueItem;
// This is only needed for FontPopupList so far.
if (marginItem instanceof ItemGroup)
marginItem = (Item) ((ItemGroup) marginItem).getContent().get(0);
Border margin = marginItem.getVisualMargin();
// Also take into account any margins the component might have set
if (valueItem != marginItem)
margin = margin.add(valueItem.getMargin());
labelItem.setMargin(margin.top + 3, 4, 0, 0);
content.put(column + ", " + row + ", right, top", labelItem);
}
boolean fullSize = component.getFullSize();
String justification = isRuler || component.getFullSize() ? "full, center" : "left, center";
content.put(isRuler || !hasLabel && fullSize ? column + ", " + row + ", " + (column + 1) + ", " + row + ", " + justification : (column + 1) + ", " + row + ", " + justification, valueItem);
return row + 1;
}
Aggregations