Java Code Examples for ca.odell.glazedlists.swing.GlazedListsSwing

The following examples show how to use ca.odell.glazedlists.swing.GlazedListsSwing. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: FlatLaf   Source File: FlatGlazedListsTest.java    License: Apache License 2.0 5 votes vote down vote up
FlatGlazedListsTest() {
	initComponents();

	EventList<Item> itemEventList = new BasicEventList<>();
	itemEventList.add( new Item( "item 1", "item 1b", "January", 123, null ) );
	itemEventList.add( new Item( "item 2", "item 2b", "February", 456, true ) );
	itemEventList.add( new Item( "item 3", null, "March", null, false ) );
	itemEventList.add( new Item( "item 4", null, "April", 234, true ) );
	itemEventList.add( new Item( "item 5", null, "May", null, false ) );
	itemEventList.add( new Item( "item 6", null, "June", null, null ) );
	itemEventList.add( new Item( "item 7", null, "July", null, null ) );
	itemEventList.add( new Item( "item 8", null, "August", null, null ) );
	itemEventList.add( new Item( "item 9", null, "September", null, null ) );
	itemEventList.add( new Item( "item 10", null, "October", null, null ) );
	itemEventList.add( new Item( "item 11", null, "November", null, null ) );
	itemEventList.add( new Item( "item 12", null, "December", null, null ) );

	Comparator<Item> itemComparator = Comparator.comparing( Item::getName );
	SortedList<Item> sortedItems = new SortedList<>( itemEventList, itemComparator );
	AdvancedTableModel<Item> tableModel = GlazedListsSwing.eventTableModelWithThreadProxyList( sortedItems, new ItemTableFormat() );
	itemsTable.setModel( tableModel );
	TableComparatorChooser<Item> tableComparatorChooser = TableComparatorChooser.install(
		itemsTable, sortedItems, TableComparatorChooser.MULTIPLE_COLUMN_MOUSE );
	tableComparatorChooser.appendComparator( 0, 0, false );

	TableComparatorChooser.setIconPath( "resources/windowsxp" );
}
 
Example 2
Source Project: jeveassets   Source File: EventModels.java    License: GNU General Public License v2.0 5 votes vote down vote up
public static <E> EventList<E> createSwingThreadProxyList(EventList<E> source) {
	final EventList<E> result;
	source.getReadWriteLock().readLock().lock();
	try {
		result = GlazedListsSwing.swingThreadProxyList(source);
	} finally {
		source.getReadWriteLock().readLock().unlock();
	}
	return result;
}