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 */ 019 020package org.nuxeo.ecm.platform.forms.layout.api; 021 022import java.io.Serializable; 023import java.util.Map; 024 025/** 026 * Single select option top be held by the {@link WidgetDefinition} and {@link Widget} generated from the definition. 027 * 028 * @author Anahide Tchertchian 029 * @since 5.4.2 030 */ 031public interface WidgetSelectOption extends Serializable { 032 033 /** 034 * Returns the value representing the option. 035 * <p> 036 * This value is optional when using static label and values, it can be useful to use it in conjunction with the 037 * {@link #getVar()} method to retrieve the id and label from the object. 038 */ 039 Serializable getValue(); 040 041 /** 042 * Returns the var representing the value returned by {@link #getValue()} 043 * <p> 044 * This value can be used in the potential EL expressions returned by {@link #getItemLabel()}, 045 * {@link #getItemValue()}, {@link #getItemDisabled()} and {@link #getItemRendered()}. 046 */ 047 String getVar(); 048 049 /** 050 * Returns the item label for the select option. 051 * <p> 052 * This can be an EL expression if {@link #getValue()} and {@link #getVar()} return a non-null value. 053 */ 054 String getItemLabel(); 055 056 /** 057 * Getter to handle l10n localization of select options. 058 * 059 * @since 6.0 060 */ 061 String getItemLabel(String locale); 062 063 /** 064 * Getter to handle l10n localization of select options. 065 * 066 * @since 6.0 067 */ 068 Map<String, String> getItemLabels(); 069 070 /** 071 * Returns the item value for the select option. 072 * <p> 073 * This can be an EL expression if {@link #getValue()} and {@link #getVar()} return a non-null value. 074 */ 075 String getItemValue(); 076 077 /** 078 * Returns the disabled behaviour for the select option. 079 * <p> 080 * This value can either be an EL expression that should resolve to a boolean value, either a string representing a 081 * boolean ("true" or "false") either a Boolean value. 082 */ 083 Serializable getItemDisabled(); 084 085 /** 086 * Returns the rendered behaviour for the select option. 087 * <p> 088 * This value can either be an EL expression that should resolve to a boolean value, either a string representing a 089 * boolean ("true" or "false") either a Boolean value. 090 */ 091 Serializable getItemRendered(); 092 093 /** 094 * Returns the unique identifier of this select option to be used in tag configuration. 095 * 096 * @see {@link Layout#getTagConfigId()}. 097 */ 098 String getTagConfigId(); 099 100 /** 101 * @since 5.5 102 */ 103 WidgetSelectOption clone(); 104 105}