001/**
002 * Copyright 2005-2018 The Kuali Foundation
003 *
004 * Licensed under the Educational Community 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.opensource.org/licenses/ecl2.php
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 */
016package org.kuali.rice.krad.uif.control;
017
018import org.kuali.rice.krad.datadictionary.parse.BeanTag;
019import org.kuali.rice.krad.datadictionary.parse.BeanTagAttribute;
020import org.kuali.rice.krad.datadictionary.parse.BeanTags;
021
022/**
023 * Represents a HTML Select control. Provides preset options for the User to
024 * choose from by a drop down
025 *
026 * @author Kuali Rice Team (rice.collab@kuali.org)
027 */
028@BeanTags({@BeanTag(name = "dropdownControl", parent = "Uif-DropdownControl"),
029        @BeanTag(name = "multiSelectControl", parent = "Uif-MultiSelectControl")})
030public class SelectControlBase extends MultiValueControlBase implements SelectControl {
031    private static final long serialVersionUID = 6443247954759096815L;
032
033    private int size;
034    private boolean multiple;
035
036    public SelectControlBase() {
037        size = 1;
038        multiple = false;
039    }
040
041    /**
042     * This overridden method ...
043     * 
044     * @see org.kuali.rice.krad.uif.control.SelectControl#getSize()
045     */
046    @Override
047    @BeanTagAttribute
048    public int getSize() {
049        return this.size;
050    }
051
052    /**
053     * This overridden method ...
054     * 
055     * @see org.kuali.rice.krad.uif.control.SelectControl#setSize(int)
056     */
057    @Override
058    public void setSize(int size) {
059        this.size = size;
060    }
061
062    /**
063     * Indicates whether multiple values can be selected. Defaults to false
064     * <p>
065     * If multiple is set to true, the underlying property must be of Array type
066     * </p>
067     *
068     * @return true if multiple values can be selected, false if only
069     *         one value can be selected
070     */
071    @Override
072    @BeanTagAttribute
073    public boolean isMultiple() {
074        return this.multiple;
075    }
076
077    /**
078     * Set whether multiple values can be selected
079     *
080     * @param multiple
081     */
082    @Override
083    public void setMultiple(boolean multiple) {
084        this.multiple = multiple;
085    }
086}