001/* 002 * (C) Copyright 2010 Nuxeo SA (http://nuxeo.com/) and contributors. 003 * 004 * All rights reserved. This program and the accompanying materials 005 * are made available under the terms of the GNU Lesser General Public License 006 * (LGPL) version 2.1 which accompanies this distribution, and is available at 007 * http://www.gnu.org/licenses/lgpl.html 008 * 009 * This library is distributed in the hope that it will be useful, 010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 012 * Lesser General Public License for more details. 013 * 014 * Contributors: 015 * Anahide Tchertchian 016 */ 017package org.nuxeo.ecm.platform.forms.layout.descriptors; 018 019import java.io.Serializable; 020import java.util.HashMap; 021import java.util.Map; 022 023import org.nuxeo.common.xmap.annotation.XNode; 024import org.nuxeo.common.xmap.annotation.XNodeMap; 025import org.nuxeo.common.xmap.annotation.XObject; 026import org.nuxeo.ecm.platform.forms.layout.api.WidgetSelectOption; 027import org.nuxeo.ecm.platform.forms.layout.api.impl.WidgetSelectOptionsImpl; 028 029/** 030 * @author Anahide Tchertchian 031 * @since 5.4.2 032 */ 033@XObject("options") 034public class WidgetSelectOptionsDescriptor { 035 036 @XNode("@value") 037 protected String value; 038 039 @XNode("@var") 040 protected String var; 041 042 @XNode("@itemLabel") 043 protected String itemLabel; 044 045 @XNodeMap(value = "itemLabel", key = "@locale", type = HashMap.class, componentType = String.class) 046 protected Map<String, String> itemLabels = new HashMap<String, String>(); 047 048 @XNode("@itemValue") 049 protected String itemValue; 050 051 @XNode("@itemDisabled") 052 protected String itemDisabled; 053 054 @XNode("@itemRendered") 055 protected String itemRendered; 056 057 @XNode("@ordering") 058 protected String ordering; 059 060 @XNode("@caseSensitive") 061 protected Boolean caseSensitive; 062 063 public Serializable getValue() { 064 return value; 065 } 066 067 public String getVar() { 068 return var; 069 } 070 071 public String getItemLabel() { 072 return itemLabel; 073 } 074 075 public String getItemValue() { 076 return itemValue; 077 } 078 079 public Serializable getItemDisabled() { 080 return itemDisabled; 081 } 082 083 public Serializable getItemRendered() { 084 return itemRendered; 085 } 086 087 public String getOrdering() { 088 return ordering; 089 } 090 091 public Boolean getCaseSensitive() { 092 return caseSensitive; 093 } 094 095 public WidgetSelectOption getWidgetSelectOption() { 096 WidgetSelectOptionsImpl res = new WidgetSelectOptionsImpl(value, var, itemLabel, itemValue, itemDisabled, 097 itemRendered, ordering, caseSensitive); 098 res.setItemLabels(itemLabels); 099 return res; 100 } 101 102}