Search in sources :

Example 1 with Item

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;
}
Also used : TextValueItem(com.scriptographer.adm.TextValueItem) ValueItem(com.scriptographer.adm.ValueItem) Item(com.scriptographer.adm.Item) ToggleItem(com.scriptographer.adm.ToggleItem) TextEditItem(com.scriptographer.adm.TextEditItem) TextPane(com.scriptographer.adm.TextPane) ItemGroup(com.scriptographer.adm.ItemGroup) Border(com.scriptographer.adm.Border)

Aggregations

Border (com.scriptographer.adm.Border)1 Item (com.scriptographer.adm.Item)1 ItemGroup (com.scriptographer.adm.ItemGroup)1 TextEditItem (com.scriptographer.adm.TextEditItem)1 TextPane (com.scriptographer.adm.TextPane)1 TextValueItem (com.scriptographer.adm.TextValueItem)1 ToggleItem (com.scriptographer.adm.ToggleItem)1 ValueItem (com.scriptographer.adm.ValueItem)1