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.SupportsMarkup;
23  import org.apache.myfaces.tobago.context.Markup;
24  
25  public class SelectItem extends javax.faces.model.SelectItem implements SupportsMarkup {
26  
27    private static final long serialVersionUID = 2582455665060354639L;
28  
29    private String image;
30    private Markup markup = Markup.NULL;
31    private Markup currentMarkup = null;
32  
33    public SelectItem() {
34      super();
35    }
36  
37    public SelectItem(final Object value) {
38      super(value);
39    }
40  
41    public SelectItem(final Object value, final String label) {
42      super(value, label);
43    }
44  
45    public SelectItem(final Object value, final String label, final String tip) {
46      super(value, label, tip);
47    }
48  
49    public SelectItem(final Object value, final String label, final String tip, final String image) {
50      this(value, label, tip, false, image);
51    }
52  
53    /**
54     * @deprecated since 1.5.0
55     */
56    @Deprecated
57    public SelectItem(
58        final Object value, final String label, final String tip, final String image, final String[] markup) {
59      this(value, label, tip, false, image, markup);
60    }
61  
62    public SelectItem(
63        final Object value, final String label, final String tip, final String image, final Markup markup) {
64      this(value, label, tip, false, image, markup);
65    }
66  
67    public SelectItem(
68        final Object value, final String label, final String tip, final boolean disabled, final String image) {
69      this(value, label, tip, disabled, image, Markup.NULL);
70    }
71  
72    /**
73     * @deprecated since 1.5.0
74     */
75    public SelectItem(
76        final Object value, final String label, final String tip, final boolean disabled, final String image,
77        final String[] markup) {
78      this(value, label, tip, disabled, image, Markup.valueOf(markup));
79    }
80  
81    public SelectItem(
82        final Object value, final String label, final String tip, final boolean disabled, final String image,
83        final Markup markup) {
84      super(value, label, tip, disabled);
85      this.image = image;
86      this.markup = markup;
87    }
88  
89    /**
90     * Alias name for description.
91     */
92    public String getTip() {
93      return getDescription();
94    }
95  
96    /**
97     * Alias name for description.
98     */
99    public void setTip(String tip) {
100     setDescription(tip);
101   }
102 
103   public String getImage() {
104     return image;
105   }
106 
107   public void setImage(final String image) {
108     this.image = image;
109   }
110 
111   public Markup getMarkup() {
112     return markup;
113   }
114 
115   public void setMarkup(final Markup markup) {
116     this.markup = markup;
117   }
118 
119   public Markup getCurrentMarkup() {
120     return currentMarkup;
121   }
122 
123   public void setCurrentMarkup(final Markup currentMarkup) {
124     this.currentMarkup = currentMarkup;
125   }
126 }