View Javadoc

1   //$Id: XSObjectListModelAdapter.java 165 2009-05-28 21:46:38Z agony $
2   /* xsAnalyzer - XML schema analyzing tool.
3    * Copyright (C) 2008  Michael Engelhardt
4    * 
5    * This program is free software; you can redistribute it and/or
6    * modify it under the terms of the GNU General Public License
7    * as published by the Free Software Foundation; either version 2
8    * of the License, or (at your option) any later version.
9    * 
10   * This program is distributed in the hope that it will be useful,
11   * but WITHOUT ANY WARRANTY; without even the implied warranty of
12   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13   * GNU General Public License for more details.
14   * 
15   * You should have received a copy of the GNU General Public License
16   * along with this program; if not, write to the Free Software
17   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
18   */
19  /**
20   * 
21   */
22  package de.mindcrimeilab.xsanalyzer.model;
23  
24  import javax.swing.AbstractListModel;
25  import javax.swing.ListModel;
26  
27  import org.apache.xerces.xs.XSObjectList;
28  
29  /**
30   * @author Michael Engelhardt<me@mindcrime-ilab.de>
31   * @author $Author: agony $
32   * @version $Revision: 165 $
33   * 
34   */
35  public class XSObjectListModelAdapter extends AbstractListModel implements
36  		ListModel {
37  
38  	private final XSObjectList list;
39  
40  	public XSObjectListModelAdapter(XSObjectList list) {
41  		this.list = list;
42  	}
43  
44  	@Override
45  	public Object getElementAt(int index) {
46  		return list.item(index);
47  	}
48  
49  	@Override
50  	public int getSize() {
51  		return list.getLength();
52  	}
53  }