Search in sources :

Example 1 with OptionMap

use of com.dexels.navajo.adapter.OptionMap in project navajo by Dexels.

the class MessageMap method getSelections.

public OptionMap[] getSelections() throws UserException {
    if (selectionPointer == null) {
        throw new UserException(-1, "Set selectionPointer first.");
    }
    Property p = getPropertyObject(selectionPointer);
    if (!p.getType().equals(Property.SELECTION_PROPERTY)) {
        throw new UserException(-1, "selections only supported for selection properties");
    }
    List<Selection> all = p.getAllSelections();
    OptionMap[] om = new OptionMap[all.size()];
    for (int i = 0; i < all.size(); i++) {
        Selection s = all.get(i);
        om[i] = new OptionMap();
        om[i].setOptionName(s.getName());
        om[i].setOptionValue(s.getValue());
        om[i].setOptionSelected(s.isSelected());
    }
    return om;
}
Also used : Selection(com.dexels.navajo.document.Selection) OptionMap(com.dexels.navajo.adapter.OptionMap) UserException(com.dexels.navajo.script.api.UserException) Property(com.dexels.navajo.document.Property)

Aggregations

OptionMap (com.dexels.navajo.adapter.OptionMap)1 Property (com.dexels.navajo.document.Property)1 Selection (com.dexels.navajo.document.Selection)1 UserException (com.dexels.navajo.script.api.UserException)1