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  
26  public class SelectItem extends javax.faces.model.SelectItem implements Visual {
27  
28    private static final long serialVersionUID = 2582455665060354639L;
29  
30    private String image;
31    private Markup markup = Markup.NULL;
32    private CustomClass customClass;
33  
34    public SelectItem() {
35      super();
36    }
37  
38    public SelectItem(final Object value) {
39      super(value);
40    }
41  
42    public SelectItem(final Object value, final String label) {
43      super(value, label);
44    }
45  
46    public SelectItem(final Object value, final String label, final String tip) {
47      super(value, label, tip);
48    }
49  
50    public SelectItem(final Object value, final String label, final String tip, final String image) {
51      this(value, label, tip, false, image);
52    }
53  
54    public SelectItem(
55        final Object value, final String label, final String tip, final String image, final Markup markup) {
56      this(value, label, tip, false, image, markup);
57    }
58  
59    public SelectItem(
60        final Object value, final String label, final String tip, final boolean disabled, final String image) {
61      this(value, label, tip, disabled, image, Markup.NULL);
62    }
63  
64    public SelectItem(
65        final Object value, final String label, final String tip, final boolean disabled, final String image,
66        final Markup markup) {
67      super(value, label, tip, disabled);
68      this.image = image;
69      this.markup = markup;
70    }
71  
72    /**
73     * Alias name for description.
74     */
75    public String getTip() {
76      return getDescription();
77    }
78  
79    /**
80     * Alias name for description.
81     */
82    public void setTip(String tip) {
83      setDescription(tip);
84    }
85  
86    public String getImage() {
87      return image;
88    }
89  
90    public void setImage(final String image) {
91      this.image = image;
92    }
93  
94    @Override
95    public Markup getMarkup() {
96      return markup;
97    }
98  
99    @Override
100   public void setMarkup(final Markup markup) {
101     this.markup = markup;
102   }
103 
104   @Override
105   public CustomClass getCustomClass() {
106     return customClass;
107   }
108 
109   @Override
110   public void setCustomClass(CustomClass customClass) {
111     this.customClass = customClass;
112   }
113 
114   @Override
115   public String getRendererType() {
116     throw new UnsupportedOperationException();
117   }
118 }