⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 departmentuserlist.java

📁 jsf在线考试系统的实例
💻 JAVA
字号:
/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */
package com.jlobo.web.beans;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

/**
 * DOCUMENT ME!
 * @author Thomas Spiegl (latest modification by $Author: lzket $)
 * @version $Revision: 1.1 $ $Date: 2007/09/11 02:11:10 $
 */
public class DepartmentUserList extends SortableList
{
    private List _departmentUsers;    
    
    public DepartmentUserList()
    {
        super("localName");

        _departmentUsers = new ArrayList();
        
    }

    public List getDepartmentUsers()
    {
        sort(getSort(), isAscending());
        return _departmentUsers;
    }
    
    public void  setDepartmentUsers(List departmentUsers)
    {
        this._departmentUsers = departmentUsers;
    }

    protected boolean isDefaultAscending(String sortColumn)
    {
        return true;
    }

    protected void sort(final String column, final boolean ascending)
    {
        Comparator comparator = new Comparator()
        {
            public int compare(Object o1, Object o2)
            {
                DepartmentUser c1 = (DepartmentUser)o1;
                DepartmentUser c2 = (DepartmentUser)o2;
                if (column == null) {
                    return 0;
                }
                if (column.equals("localname")){
                    return ascending ? c1.getLocalName().compareTo(c2.getLocalName()) : c2.getLocalName().compareTo(c1.getLocalName());
                } else if (column.equals("type")) {                	
                    return ascending ? c1.getId().get_class().compareTo(c2.getId().get_class()) : c2.getId().get_class().compareTo(c1.getId().get_class());
                } else if (column.equals("describe")) {
                    return ascending ? c1.getDescribe().compareTo(c2.getDescribe()) : c2.getDescribe().compareTo(c1.getDescribe());
                } else 
                	return 0;
            }
        };
        Collections.sort(_departmentUsers, comparator);
    }	
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -