1 /* 2 * Copyright (c) 2007 Creative Sphere Limited. 3 * All rights reserved. This program and the accompanying materials 4 * are made available under the terms of the Eclipse Public License v1.0 5 * which accompanies this distribution, and is available at 6 * http://www.eclipse.org/legal/epl-v10.html 7 * 8 * Contributors: 9 * 10 * Creative Sphere - initial API and implementation 11 * 12 */ 13 package org.abstracthorizon.aequo; 14 15 import javax.swing.ListModel; 16 17 /** 18 * {@link ListModel} adapter over one column 19 * 20 * @author Daniel Sendula 21 */ 22 public class ColumnListModelAdapter extends ListModelAdapter { 23 24 /** Column adapter is working on*/ 25 protected int column; 26 27 /** 28 * Constructor 29 * @param defaultCompareModel model 30 * @param column column 31 */ 32 public ColumnListModelAdapter(CompareModel<? ,?> defaultCompareModel, int column) { 33 super(defaultCompareModel); 34 this.column = column; 35 } 36 37 /** 38 * Returns element at given index 39 * 40 * @param index index 41 * 42 * @return element at given index 43 */ 44 public Object getElementAt(int index) { 45 return ((CompareEntry<?>)this.model.getElementAt(index)).getData()[column]; 46 } 47 }