Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /*
  * 12/22/2008
  *
  * CompletionListModel.java - A model that allows bulk addition of elements.
  * Copyright (C) 2008 Robert Futrell
  * robert_futrell at users.sourceforge.net
  * http://fifesoft.com/rsyntaxtextarea
  *
  * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
 */
package org.fife.ui.autocomplete;
A list model implementation that allows the bulk addition of elements. This is the only feature missing from DefaultListModel that we need.

Author(s):
Robert Futrell
Version:
1.0
Container for items in this model.
	private ArrayList delegate;


Constructor.
	public CompletionListModel() {
		 = new ArrayList();
	}


Removes all of the elements from this list. The list will be empty after this call returns (unless it throws an exception).

	public void clear() {
		int end = .size()-1;
		if (end >= 0) {
			fireIntervalRemoved(this, 0, end);
		}
	}


	public Object getElementAt(int index) {
		return .get(index);
	}


	public int getSize() {
		return .size();
	}


Sets the contents of this model. All previous contents are removed.

Parameters:
contents The new contents of this model.
	public void setContents(Collection contents) {
		if (contents.size()>0) {
			.addAll(contents);
			fireIntervalAdded(this, 0, contents.size());
		}
	}
New to GrepCode? Check out our FAQ X