001    /*
002     * Licensed to the Apache Software Foundation (ASF) under one
003     * or more contributor license agreements.  See the NOTICE file
004     * distributed with this work for additional information
005     * regarding copyright ownership.  The ASF licenses this file
006     * to you under the Apache License, Version 2.0 (the
007     * "License"); you may not use this file except in compliance
008     * with the License.  You may obtain a copy of the License at
009     *
010     *   http://www.apache.org/licenses/LICENSE-2.0
011     *
012     * Unless required by applicable law or agreed to in writing,
013     * software distributed under the License is distributed on an
014     * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015     * KIND, either express or implied.  See the License for the
016     * specific language governing permissions and limitations
017     * under the License.
018     */
019    
020    package org.apache.myfaces.tobago.model;
021    
022    import org.apache.myfaces.tobago.component.SupportsMarkup;
023    import org.apache.myfaces.tobago.component.UISelectItem;
024    
025    /*
026     * Date: Apr 5, 2005
027     * Time: 6:11:16 PM
028     */
029    public class SelectItem extends javax.faces.model.SelectItem implements SupportsMarkup {
030    
031      private static final long serialVersionUID = 2582455665060354639L;
032    
033      private String image;
034      private String[] markup = new String[0];
035    
036      public SelectItem() {
037        super();
038      }
039    
040      public SelectItem(UISelectItem component) {
041        this(component.getItemValue() == null ? "" : component.getItemValue(),
042            component.getItemLabel(), component.getItemDescription(),
043            component.isItemDisabled(), component.getItemImage(), component.getMarkup());
044      }
045    
046      public SelectItem(Object value) {
047        super(value);
048      }
049    
050      public SelectItem(Object value, String label) {
051        super(value, label);
052      }
053    
054      public SelectItem(Object value, String label, String description) {
055        super(value, label, description);
056      }
057    
058      public SelectItem(Object value, String label, String description, String image) {
059        this(value, label, description, false, image);
060      }
061    
062      public SelectItem(Object value, String label, String description, String image, String[] markup) {
063        this(value, label, description, false, image, markup);
064      }
065    
066      public SelectItem(Object value, String label, String description,
067          boolean disabled, String image) {
068        this(value, label, description, disabled, image, null);
069      }
070    
071      public SelectItem(Object value, String label, String description,
072          boolean disabled, String image, String[] markup) {
073        super(value, label, description, disabled);
074        this.image = image;
075        this.markup = markup;
076      }
077    
078      public String getImage() {
079        return image;
080      }
081    
082      public void setImage(String image) {
083        this.image = image;
084      }
085    
086      public String[] getMarkup() {
087        return markup;
088      }
089    
090      public void setMarkup(String[] markup) {
091        this.markup = markup;
092      }
093    }