001/** 002 * Copyright 2010 The Kuali Foundation Licensed under the 003 * Educational Community License, Version 2.0 (the "License"); you may 004 * not use this file except in compliance with the License. You may 005 * obtain a copy of the License at 006 * 007 * http://www.osedu.org/licenses/ECL-2.0 008 * 009 * Unless required by applicable law or agreed to in writing, 010 * software distributed under the License is distributed on an "AS IS" 011 * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 012 * or implied. See the License for the specific language governing 013 * permissions and limitations under the License. 014 */ 015 016package org.kuali.student.common.ui.client.widgets.searchtable; 017 018import java.util.HashMap; 019import java.util.Map; 020 021import org.kuali.student.r1.common.dto.Idable; 022 023import com.google.gwt.user.client.rpc.IsSerializable; 024 025public class ResultRow implements IsSerializable, Idable,Comparable<ResultRow>{ 026 private String id; 027 private Map<String, String> columnValues = new HashMap<String, String>(); 028 static String NAME_COLUMN_KEY = "name"; 029 static String TYPE_COLUMN_KEY = "type"; 030 031 @Override 032 public String getId() { 033 return id; 034 } 035 036 @Override 037 public void setId(String id) { 038 this.id = id; 039 } 040 041 public String getValue(String columnKey) { 042 return columnValues.get(columnKey); 043 } 044 045 public void setValue(String columnKey, String value) { 046 columnValues.put(columnKey, value); 047 } 048 049 public Map<String, String> getColumnValues() { 050 return columnValues; 051 } 052 053 @Override 054 public int compareTo(ResultRow row) { 055 // TODO Auto-generated method stub 056 if(columnValues.get(TYPE_COLUMN_KEY).compareToIgnoreCase(row.getColumnValues().get(TYPE_COLUMN_KEY))==0) 057 return columnValues.get(NAME_COLUMN_KEY).compareToIgnoreCase(row.getColumnValues().get(NAME_COLUMN_KEY)); 058 else 059 return columnValues.get(TYPE_COLUMN_KEY).compareToIgnoreCase(row.getColumnValues().get(TYPE_COLUMN_KEY)); 060 } 061}