001/* 002 * (C) Copyright 2010 Nuxeo SA (http://nuxeo.com/) and others. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 * 016 * Contributors: 017 * Anahide Tchertchian 018 */ 019package org.nuxeo.ecm.platform.forms.layout.descriptors; 020 021import java.io.Serializable; 022import java.util.HashMap; 023import java.util.Map; 024 025import org.nuxeo.common.xmap.annotation.XNode; 026import org.nuxeo.common.xmap.annotation.XNodeMap; 027import org.nuxeo.common.xmap.annotation.XObject; 028import org.nuxeo.ecm.platform.forms.layout.api.WidgetSelectOption; 029import org.nuxeo.ecm.platform.forms.layout.api.impl.WidgetSelectOptionsImpl; 030 031/** 032 * @author Anahide Tchertchian 033 * @since 5.4.2 034 */ 035@XObject("options") 036public class WidgetSelectOptionsDescriptor { 037 038 @XNode("@value") 039 protected String value; 040 041 @XNode("@var") 042 protected String var; 043 044 @XNode("@itemLabel") 045 protected String itemLabel; 046 047 @XNodeMap(value = "itemLabel", key = "@locale", type = HashMap.class, componentType = String.class) 048 protected Map<String, String> itemLabels = new HashMap<String, String>(); 049 050 @XNode("@itemValue") 051 protected String itemValue; 052 053 @XNode("@itemDisabled") 054 protected String itemDisabled; 055 056 @XNode("@itemRendered") 057 protected String itemRendered; 058 059 @XNode("@ordering") 060 protected String ordering; 061 062 @XNode("@caseSensitive") 063 protected Boolean caseSensitive; 064 065 public Serializable getValue() { 066 return value; 067 } 068 069 public String getVar() { 070 return var; 071 } 072 073 public String getItemLabel() { 074 return itemLabel; 075 } 076 077 public String getItemValue() { 078 return itemValue; 079 } 080 081 public Serializable getItemDisabled() { 082 return itemDisabled; 083 } 084 085 public Serializable getItemRendered() { 086 return itemRendered; 087 } 088 089 public String getOrdering() { 090 return ordering; 091 } 092 093 public Boolean getCaseSensitive() { 094 return caseSensitive; 095 } 096 097 public WidgetSelectOption getWidgetSelectOption() { 098 WidgetSelectOptionsImpl res = new WidgetSelectOptionsImpl(value, var, itemLabel, itemValue, itemDisabled, 099 itemRendered, ordering, caseSensitive); 100 res.setItemLabels(itemLabels); 101 return res; 102 } 103 104}