KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ejbca > ui > web > admin > configuration > SortableSelectItem


1 /*************************************************************************
2  * *
3  * EJBCA: The OpenSource Certificate Authority *
4  * *
5  * This software is free software; you can redistribute it and/or *
6  * modify it under the terms of the GNU Lesser General Public *
7  * License as published by the Free Software Foundation; either *
8  * version 2.1 of the License, or any later version. *
9  * *
10  * See terms of license at gnu.org. *
11  * *
12  *************************************************************************/

13
14 package org.ejbca.ui.web.admin.configuration;
15
16 import javax.faces.model.SelectItem;
17
18 /**
19  * An extention to the SelectItem class that is
20  * sortable, used by select lists that should be alphabetic
21  * order.
22  *
23  *
24  * @author Philip Vendil 2006 sep 27
25  *
26  * @version $Id: SortableSelectItem.java,v 1.2 2006/11/02 08:03:23 anatom Exp $
27  */

28
29 public class SortableSelectItem extends SelectItem implements Comparable JavaDoc{
30
31     public SortableSelectItem(Object JavaDoc arg0, String JavaDoc arg1, String JavaDoc arg2, boolean arg3) {
32         super(arg0, arg1, arg2, arg3);
33     }
34
35     public SortableSelectItem(Object JavaDoc arg0, String JavaDoc arg1, String JavaDoc arg2) {
36         super(arg0, arg1, arg2);
37     }
38
39     public SortableSelectItem(Object JavaDoc arg0, String JavaDoc arg1) {
40         super(arg0, arg1);
41     }
42
43     public int compareTo(Object JavaDoc arg0) {
44         int retval = 0;
45         if(arg0 instanceof SelectItem){
46             return this.getLabel().compareTo(((SelectItem) arg0).getLabel());
47         }
48         return retval;
49     }
50
51 }
52
Popular Tags