View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  
20  package org.apache.myfaces.tobago.model;
21  
22  import org.apache.myfaces.tobago.component.Visual;
23  import org.apache.myfaces.tobago.context.Markup;
24  import org.apache.myfaces.tobago.renderkit.css.CustomClass;
25  import org.apache.myfaces.tobago.renderkit.css.Style;
26  
27  public class SelectItem extends javax.faces.model.SelectItem implements Visual {
28  
29    private static final long serialVersionUID = 2582455665060354639L;
30  
31    private String image;
32    private Markup markup = Markup.NULL;
33    private Style style;
34    private CustomClass customClass;
35  
36    public SelectItem() {
37      super();
38    }
39  
40    public SelectItem(final Object value) {
41      super(value);
42    }
43  
44    public SelectItem(final Object value, final String label) {
45      super(value, label);
46    }
47  
48    public SelectItem(final Object value, final String label, final String tip) {
49      super(value, label, tip);
50    }
51  
52    public SelectItem(final Object value, final String label, final String tip, final String image) {
53      this(value, label, tip, false, image);
54    }
55  
56    public SelectItem(
57        final Object value, final String label, final String tip, final String image, final Markup markup) {
58      this(value, label, tip, false, image, markup);
59    }
60  
61    public SelectItem(
62        final Object value, final String label, final String tip, final boolean disabled, final String image) {
63      this(value, label, tip, disabled, image, Markup.NULL);
64    }
65  
66    public SelectItem(
67        final Object value, final String label, final String tip, final boolean disabled, final String image,
68        final Markup markup) {
69      super(value, label, tip, disabled);
70      this.image = image;
71      this.markup = markup;
72    }
73  
74    /**
75     * Alias name for description.
76     */
77    public String getTip() {
78      return getDescription();
79    }
80  
81    /**
82     * Alias name for description.
83     */
84    public void setTip(String tip) {
85      setDescription(tip);
86    }
87  
88    public String getImage() {
89      return image;
90    }
91  
92    public void setImage(final String image) {
93      this.image = image;
94    }
95  
96    @Override
97    public Markup getMarkup() {
98      return markup;
99    }
100 
101   @Override
102   public void setMarkup(final Markup markup) {
103     this.markup = markup;
104   }
105 
106   @Override
107   public Style getStyle() {
108     return style;
109   }
110 
111   @Override
112   public void setStyle(Style style) {
113     this.style = style;
114   }
115 
116   @Override
117   public CustomClass getCustomClass() {
118     return customClass;
119   }
120 
121   @Override
122   public void setCustomClass(CustomClass customClass) {
123     this.customClass = customClass;
124   }
125 
126   @Override
127   public String getRendererType() {
128     throw new UnsupportedOperationException();
129   }
130 }