Java Code Examples for ca.odell.glazedlists.FilterList

The following examples show how to use ca.odell.glazedlists.FilterList. 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: jeveassets   Source File: FilterControl.java    License: GNU General Public License v2.0 5 votes vote down vote up
protected FilterControl(final JFrame jFrame, final String name, final EventList<E> eventList, final EventList<E> exportEventList, final FilterList<E> filterList, final Map<String, List<Filter>> filters, final Map<String, List<Filter>> defaultFilters) {
	this.name = name;
	this.eventList = eventList;
	this.exportEventList = exportEventList;
	this.filterList = filterList;
	eventList.addListEventListener(new ListEventListener<E>() {
		@Override @SuppressWarnings("deprecation")
		public void listChanged(ListEvent<E> listChanges) {
			try {
				eventList.getReadWriteLock().readLock().lock();
				List<E> delete = new ArrayList<E>();
				List<E> update = new ArrayList<E>();
				while(listChanges.next()) {
					switch (listChanges.getType()) {
						case ListEvent.DELETE:
							addSafe(delete, listChanges.getOldValue());
							break;
						case ListEvent.UPDATE:
							addSafe(eventList, update, listChanges.getIndex());
							break;
					}
				}
				cacheDelete(delete);
				cacheUpdate(update);
			} finally {
				eventList.getReadWriteLock().readLock().unlock();
			}
		}
	});
	this.filters = filters;
	this.defaultFilters = defaultFilters;
	ListenerClass listener = new ListenerClass();
	filterList.addListEventListener(listener);
	gui = new FilterGui<E>(jFrame, this);
	cache = new HashMap<E, String>();
}
 
Example 2
Source Project: cropplanning   Source File: TODOLists.java    License: GNU General Public License v3.0 5 votes vote down vote up
public TODOLists() {
    setModuleName("TODOLists");
    setModuleType("Core");
    setModuleVersion( CPSGlobalSettings.getVersion() );

    tempCal = new GregorianCalendar();

    data = new BasicEventList<CPSPlanting>();
    dataFiltered = new FilterList<CPSPlanting>( data );
    dataSorted = new SortedList<CPSPlanting>( dataFiltered, null );
    
}
 
Example 3
Source Project: jeveassets   Source File: FilterControl.java    License: GNU General Public License v2.0 4 votes vote down vote up
protected FilterControl(final JFrame jFrame, final String name, final EventList<E> eventList, final EventList<E> exportEventList, final FilterList<E> filterList, final Map<String, List<Filter>> filters) {
	this(jFrame, name, eventList, exportEventList, filterList, filters, new HashMap<String, List<Filter>>());
}
 
Example 4
Source Project: jeveassets   Source File: FilterControl.java    License: GNU General Public License v2.0 4 votes vote down vote up
public FilterList<E> getFilterList() {
	return filterList;
}
 
Example 5
Source Project: jeveassets   Source File: TransactionTab.java    License: GNU General Public License v2.0 4 votes vote down vote up
public TransactionsFilterControl(EnumTableFormatAdaptor<TransactionTableFormat, MyTransaction> tableFormat, JFrame jFrame, EventList<MyTransaction> eventList, EventList<MyTransaction> exportEventList, FilterList<MyTransaction> filterList, Map<String, List<Filter>> filters, Map<String, List<Filter>> defaultFilters) {
	super(jFrame, NAME, eventList, exportEventList, filterList, filters, defaultFilters);
	this.tableFormat = tableFormat;
}
 
Example 6
Source Project: jeveassets   Source File: ContractsTab.java    License: GNU General Public License v2.0 4 votes vote down vote up
public ContractsTab(Program program) {
	super(program, TabsContracts.get().title(), Images.TOOL_CONTRACTS.getIcon(), true);

	JFixedToolBar jToolBarLeft = new JFixedToolBar();

	JFixedToolBar jToolBarRight = new JFixedToolBar();

	JButton jCollapse = new JButton(TabsContracts.get().collapse(), Images.MISC_COLLAPSED.getIcon());
	jCollapse.setActionCommand(ContractsAction.COLLAPSE.name());
	jCollapse.addActionListener(listener);
	jToolBarRight.addButton(jCollapse);

	JButton jExpand = new JButton(TabsContracts.get().expand(), Images.MISC_EXPANDED.getIcon());
	jExpand.setActionCommand(ContractsAction.EXPAND.name());
	jExpand.addActionListener(listener);
	jToolBarRight.addButton(jExpand);

	//Table Format
	tableFormat = new EnumTableFormatAdaptor<ContractsTableFormat, MyContractItem>(ContractsTableFormat.class);
	//Backend
	eventList = program.getProfileData().getContractItemEventList();
	//Sorting (per column)
	eventList.getReadWriteLock().readLock().lock();
	SortedList<MyContractItem> sortedListColumn = new SortedList<MyContractItem>(eventList);
	eventList.getReadWriteLock().readLock().unlock();

	//Sorting Separator (ensure export always has the right order)
	eventList.getReadWriteLock().readLock().lock();
	SortedList<MyContractItem> sortedListSeparator = new SortedList<MyContractItem>(sortedListColumn, new SeparatorComparator());
	eventList.getReadWriteLock().readLock().unlock();

	//Filter
	eventList.getReadWriteLock().readLock().lock();
	filterList = new FilterList<MyContractItem>(sortedListSeparator);
	eventList.getReadWriteLock().readLock().unlock();
	//Separator
	separatorList = new SeparatorList<MyContractItem>(filterList, new SeparatorComparator(), 1, Integer.MAX_VALUE);
	//Table Model
	tableModel = EventModels.createTableModel(separatorList, tableFormat);
	//Table
	jTable = new JContractsTable(program, tableModel, separatorList);
	jTable.setSeparatorRenderer(new ContractsSeparatorTableCell(jTable, separatorList, listener));
	jTable.setSeparatorEditor(new ContractsSeparatorTableCell(jTable, separatorList, listener));
	jTable.setCellSelectionEnabled(true);
	PaddingTableCellRenderer.install(jTable, 3);
	//Sorting
	TableComparatorChooser.install(jTable, sortedListColumn, TableComparatorChooser.MULTIPLE_COLUMN_MOUSE, tableFormat);
	//Selection Model
	selectionModel = EventModels.createSelectionModel(separatorList);
	selectionModel.setSelectionMode(ListSelection.MULTIPLE_INTERVAL_SELECTION_DEFENSIVE);
	jTable.setSelectionModel(selectionModel);
	//Listeners
	installTable(jTable, NAME);
	//Scroll
	JScrollPane jTableScroll = new JScrollPane(jTable);
	//Table Filter
	filterControl = new ContractsFilterControl(
			tableFormat,
			program.getMainWindow().getFrame(),
			eventList,
			sortedListSeparator,
			filterList,
			Settings.get().getTableFilters(NAME)
	);

	//Menu
	installMenu(program, new ContractsTableMenu(), jTable, MyContractItem.class);

	layout.setHorizontalGroup(
			layout.createParallelGroup(GroupLayout.Alignment.TRAILING)
					.addComponent(filterControl.getPanel())
					.addGroup(layout.createSequentialGroup()
							.addComponent(jToolBarLeft, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, Integer.MAX_VALUE)
							.addGap(0)
							.addComponent(jToolBarRight)
					)
					.addComponent(jTableScroll, 0, 0, Short.MAX_VALUE)
	);
	layout.setVerticalGroup(
			layout.createSequentialGroup()
					.addComponent(filterControl.getPanel())
					.addGroup(layout.createParallelGroup()
							.addComponent(jToolBarLeft, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
							.addComponent(jToolBarRight, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
					)
					.addComponent(jTableScroll, 0, 0, Short.MAX_VALUE)
	);
}
 
Example 7
Source Project: jeveassets   Source File: ContractsTab.java    License: GNU General Public License v2.0 4 votes vote down vote up
public ContractsFilterControl(EnumTableFormatAdaptor<ContractsTableFormat, MyContractItem> tableFormat, JFrame jFrame, EventList<MyContractItem> eventList, EventList<MyContractItem> exportEventList, FilterList<MyContractItem> filterList, Map<String, List<Filter>> filters) {
	super(jFrame, NAME, eventList, exportEventList, filterList, filters);
	this.tableFormat = tableFormat;
}
 
Example 8
Source Project: jeveassets   Source File: TreeTab.java    License: GNU General Public License v2.0 4 votes vote down vote up
public AssetFilterControl(JFrame jFrame, EventList<TreeAsset> eventList, EventList<TreeAsset> exportEventList, FilterList<TreeAsset> filterList, Map<String, List<Filter>> filters) {
	super(jFrame, NAME, eventList, exportEventList, filterList, filters);
}
 
Example 9
Source Project: jeveassets   Source File: ReprocessedTab.java    License: GNU General Public License v2.0 4 votes vote down vote up
public ReprocessedTab(final Program program) {
	super(program, TabsReprocessed.get().title(), Images.TOOL_REPROCESSED.getIcon(), true);

	JFixedToolBar jToolBarLeft = new JFixedToolBar();

	JButton jClear = new JButton(TabsReprocessed.get().removeAll(), Images.EDIT_DELETE.getIcon());
	jClear.setActionCommand(ReprocessedAction.CLEAR.name());
	jClear.addActionListener(listener);
	jToolBarLeft.addButton(jClear);

	jToolBarLeft.addSpace(30);

	JLabel jInfo = new JLabel(TabsReprocessed.get().info());
	jInfo.setMinimumSize(new Dimension(100, Program.getButtonsHeight()));
	jInfo.setMaximumSize(new Dimension(Short.MAX_VALUE, Program.getButtonsHeight()));
	jInfo.setHorizontalAlignment(SwingConstants.LEFT);
	jToolBarLeft.add(jInfo);

	JFixedToolBar jToolBarRight = new JFixedToolBar();

	JButton jCollapse = new JButton(TabsReprocessed.get().collapse(), Images.MISC_COLLAPSED.getIcon());
	jCollapse.setActionCommand(ReprocessedAction.COLLAPSE.name());
	jCollapse.addActionListener(listener);
	jToolBarRight.addButton(jCollapse);

	JButton jExpand = new JButton(TabsReprocessed.get().expand(), Images.MISC_EXPANDED.getIcon());
	jExpand.setActionCommand(ReprocessedAction.EXPAND.name());
	jExpand.addActionListener(listener);
	jToolBarRight.addButton(jExpand);

	//Table Format
	tableFormat = new EnumTableFormatAdaptor<>(ReprocessedTableFormat.class);
	//Backend
	eventList = EventListManager.create();
	//Sorting (per column)
	eventList.getReadWriteLock().readLock().lock();
	SortedList<ReprocessedInterface> sortedListColumn = new SortedList<>(eventList);
	eventList.getReadWriteLock().readLock().unlock();

	//Sorting Total (Ensure that total is always last)
	eventList.getReadWriteLock().readLock().lock();
	SortedList<ReprocessedInterface> sortedListTotal = new SortedList<>(sortedListColumn, new TotalComparator());
	eventList.getReadWriteLock().readLock().unlock();
	//Filter
	eventList.getReadWriteLock().readLock().lock();
	filterList = new FilterList<>(sortedListTotal);
	eventList.getReadWriteLock().readLock().unlock();
	//Separator
	separatorList = new SeparatorList<>(filterList, new ReprocessedSeparatorComparator(), 1, Integer.MAX_VALUE);
	//Table Model
	tableModel = EventModels.createTableModel(separatorList, tableFormat);
	//Table
	jTable = new JReprocessedTable(program, tableModel, separatorList);
	jTable.setSeparatorRenderer(new ReprocessedSeparatorTableCell(jTable, separatorList, listener));
	jTable.setSeparatorEditor(new ReprocessedSeparatorTableCell(jTable, separatorList, listener));
	jTable.setCellSelectionEnabled(true);
	PaddingTableCellRenderer.install(jTable, 3);
	//Sorting
	TableComparatorChooser.install(jTable, sortedListColumn, TableComparatorChooser.MULTIPLE_COLUMN_MOUSE, tableFormat);
	//Selection Model
	selectionModel = EventModels.createSelectionModel(separatorList);
	selectionModel.setSelectionMode(ListSelection.MULTIPLE_INTERVAL_SELECTION_DEFENSIVE);
	jTable.setSelectionModel(selectionModel);
	//Listeners
	installTable(jTable, NAME);
	//Scroll
	JScrollPane jTableScroll = new JScrollPane(jTable);
	//Table Filter
	filterControl = new ReprocessedFilterControl(
			tableFormat,
			program.getMainWindow().getFrame(),
			eventList,
			sortedListTotal,
			filterList,
			Settings.get().getTableFilters(NAME)
			);

	//Menu
	installMenu(program, new ReprocessedTableMenu(), jTable, ReprocessedInterface.class);

	layout.setHorizontalGroup(
		layout.createParallelGroup(GroupLayout.Alignment.TRAILING)
			.addComponent(filterControl.getPanel())
			.addGroup(layout.createSequentialGroup()
				.addComponent(jToolBarLeft, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, Integer.MAX_VALUE)
				.addGap(0)
				.addComponent(jToolBarRight)
			)
			.addComponent(jTableScroll, 0, 0, Short.MAX_VALUE)
	);
	layout.setVerticalGroup(
		layout.createSequentialGroup()
			.addComponent(filterControl.getPanel())
			.addGroup(layout.createParallelGroup()
				.addComponent(jToolBarLeft, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
				.addComponent(jToolBarRight, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
			)
			.addComponent(jTableScroll, 0, 0, Short.MAX_VALUE)
	);
}
 
Example 10
Source Project: jeveassets   Source File: ReprocessedTab.java    License: GNU General Public License v2.0 4 votes vote down vote up
public ReprocessedFilterControl(EnumTableFormatAdaptor<ReprocessedTableFormat, ReprocessedInterface> tableFormat, JFrame jFrame, EventList<ReprocessedInterface> eventList, EventList<ReprocessedInterface> exportEventList, FilterList<ReprocessedInterface> filterList, Map<String, List<Filter>> filters) {
	super(jFrame, NAME, eventList, exportEventList, filterList, filters);
	this.tableFormat = tableFormat;
}
 
Example 11
Source Project: jeveassets   Source File: MarketOrdersTab.java    License: GNU General Public License v2.0 4 votes vote down vote up
public MarketOrdersFilterControl(EnumTableFormatAdaptor<MarketTableFormat, MyMarketOrder> tableFormat, JFrame jFrame, EventList<MyMarketOrder> eventList, EventList<MyMarketOrder> exportEventList, FilterList<MyMarketOrder> filterList, Map<String, List<Filter>> filters, Map<String, List<Filter>> defaultFilters) {
	super(jFrame, NAME, eventList, exportEventList, filterList, filters, defaultFilters);
	this.tableFormat = tableFormat;
}
 
Example 12
Source Project: jeveassets   Source File: StockpileDialog.java    License: GNU General Public License v2.0 4 votes vote down vote up
private void setLocationType(LocationType locationType) {
	this.locationType = locationType;
	boolean empty = false;
	if (locationType == LocationType.PLANET) {
		jLocationType.setIcon(Images.LOC_PLANET.getIcon());
		jLocationType.setToolTipText(TabsStockpile.get().planet());
		jPanel.setBorder(BorderFactory.createTitledBorder(TabsStockpile.get().planet()));
		try {
			planets.getReadWriteLock().readLock().lock();
			empty = planets.isEmpty();
			filterList = new FilterList<>(planets);
		} finally {
			planets.getReadWriteLock().readLock().unlock();
		}
		jPlanet.setSelected(true);
	} else if (locationType == LocationType.STATION) {
		jLocationType.setIcon(Images.LOC_STATION.getIcon());
		jLocationType.setToolTipText(TabsStockpile.get().station());
		jPanel.setBorder(BorderFactory.createTitledBorder(TabsStockpile.get().station()));
		try {
			stations.getReadWriteLock().readLock().lock();
			empty = stations.isEmpty();
			filterList = new FilterList<>(stations);
		} finally {
			stations.getReadWriteLock().readLock().unlock();
		}
		jStation.setSelected(true);
	} else if (locationType == LocationType.SYSTEM) {
		jLocationType.setIcon(Images.LOC_SYSTEM.getIcon());
		jLocationType.setToolTipText(TabsStockpile.get().system());
		jPanel.setBorder(BorderFactory.createTitledBorder(TabsStockpile.get().system()));
		try {
			systems.getReadWriteLock().readLock().lock();
			empty = systems.isEmpty();
			filterList = new FilterList<>(systems);
		} finally {
			systems.getReadWriteLock().readLock().unlock();
		}
		jSystem.setSelected(true);
	} else if (locationType == LocationType.REGION) {
		jLocationType.setIcon(Images.LOC_REGION.getIcon());
		jLocationType.setToolTipText(TabsStockpile.get().region());
		jPanel.setBorder(BorderFactory.createTitledBorder(TabsStockpile.get().region()));
		try {
			regions.getReadWriteLock().readLock().lock();
			empty = regions.isEmpty();
			filterList = new FilterList<>(regions);
		} finally {
			regions.getReadWriteLock().readLock().unlock();
		}
		jRegion.setSelected(true);
	} else {
		jLocationType.setIcon(Images.LOC_LOCATIONS.getIcon());
		jLocationType.setToolTipText(TabsStockpile.get().universe());
		jPanel.setBorder(BorderFactory.createTitledBorder(TabsStockpile.get().universe()));
		EventList<MyLocation> eventList = EventListManager.create();
		try {
			eventList.getReadWriteLock().readLock().lock();
			filterList = new FilterList<>(eventList);
		} finally {
			eventList.getReadWriteLock().readLock().unlock();
		}
		jUniverse.setSelected(true);
	}
	if (autoComplete != null) { //Remove old
		jLocation.removeItemListener(listener);
		autoComplete.uninstall();
		autoComplete = null;
	}
	if (locationType != LocationType.UNIVERSE) {
		if (empty) {
			jLocation.setEnabled(false);
			jLocation.getModel().setSelectedItem(TabsStockpile.get().noLocationsFound());
		} else {
			jLocation.setEnabled(true);
			autoComplete = AutoCompleteSupport.install(jLocation, EventModels.createSwingThreadProxyList(filterList), new LocationsFilterator());
			autoComplete.setStrict(true);
			autoComplete.setCorrectsCase(true);
			jLocation.addItemListener(listener); //Must be added after AutoCompleteSupport
		}
	} else {
		jLocation.setEnabled(false);
		jLocation.getModel().setSelectedItem(TabsStockpile.get().universe());
	}
}
 
Example 13
Source Project: jeveassets   Source File: StockpileTab.java    License: GNU General Public License v2.0 4 votes vote down vote up
public StockpileFilterControl(EnumTableFormatAdaptor<StockpileTableFormat, StockpileItem> tableFormat, JFrame jFrame, EventList<StockpileItem> eventList, EventList<StockpileItem> exportEventList, FilterList<StockpileItem> filterList, Map<String, List<Filter>> filters) {
	super(jFrame, NAME, eventList, exportEventList, filterList, filters);
	this.tableFormat = tableFormat;
}
 
Example 14
Source Project: jeveassets   Source File: ValueTableTab.java    License: GNU General Public License v2.0 4 votes vote down vote up
public ValueTableTab(final Program program) {
	super(program, TabsValues.get().title(), Images.TOOL_VALUE_TABLE.getIcon(), true);
	//Table Format
	tableFormat = new EnumTableFormatAdaptor<>(ValueTableFormat.class);
	//Backend
	eventList = EventListManager.create();
	//Sorting (per column)
	eventList.getReadWriteLock().readLock().lock();
	SortedList<Value> columnSortedList = new SortedList<>(eventList);
	eventList.getReadWriteLock().readLock().unlock();
	//Sorting Total
	eventList.getReadWriteLock().readLock().lock();
	SortedList<Value> totalSortedList = new SortedList<>(columnSortedList, new TotalComparator());
	eventList.getReadWriteLock().readLock().unlock();
	//Filter
	eventList.getReadWriteLock().readLock().lock();
	filterList = new FilterList<>(totalSortedList);
	eventList.getReadWriteLock().readLock().unlock();
	//Table Model
	tableModel = EventModels.createTableModel(filterList, tableFormat);
	//Table
	jTable = new JValueTable(program, tableModel);
	jTable.setCellSelectionEnabled(true);
	jTable.setRowSelectionAllowed(true);
	jTable.setColumnSelectionAllowed(true);
	PaddingTableCellRenderer.install(jTable, 3);
	//Sorting
	TableComparatorChooser.install(jTable, columnSortedList, TableComparatorChooser.MULTIPLE_COLUMN_MOUSE, tableFormat);
	//Selection Model
	selectionModel = EventModels.createSelectionModel(filterList);
	selectionModel.setSelectionMode(ListSelection.MULTIPLE_INTERVAL_SELECTION_DEFENSIVE);
	jTable.setSelectionModel(selectionModel);
	//Listeners
	installTable(jTable, NAME);
	//Scroll
	JScrollPane jTableScroll = new JScrollPane(jTable);
	//Table Filter
	filterControl = new ValueFilterControl(
			tableFormat,
			program.getMainWindow().getFrame(),
			eventList,
			totalSortedList,
			filterList,
			Settings.get().getTableFilters(NAME)
			);

	//Menu
	installMenu(program, new ValueTableMenu(), jTable, Value.class);

	layout.setHorizontalGroup(
		layout.createParallelGroup()
			.addComponent(filterControl.getPanel())
			.addComponent(jTableScroll, 0, 0, Short.MAX_VALUE)
	);
	layout.setVerticalGroup(
		layout.createSequentialGroup()
			.addComponent(filterControl.getPanel())
			.addComponent(jTableScroll, 0, 0, Short.MAX_VALUE)
	);
}
 
Example 15
Source Project: jeveassets   Source File: ValueTableTab.java    License: GNU General Public License v2.0 4 votes vote down vote up
public ValueFilterControl(EnumTableFormatAdaptor<ValueTableFormat, Value> tableFormat, JFrame jFrame, EventList<Value> eventList, EventList<Value> exportEventList, FilterList<Value> filterList, Map<String, List<Filter>> filters) {
	super(jFrame, NAME, eventList, exportEventList, filterList, filters);
	this.tableFormat = tableFormat;
}
 
Example 16
Source Project: jeveassets   Source File: AssetsTab.java    License: GNU General Public License v2.0 4 votes vote down vote up
public AssetsTab(final Program program) {
	super(program, TabsAssets.get().assets(), Images.TOOL_ASSETS.getIcon(), false);
	layout.setAutoCreateGaps(true);

	ListenerClass listener = new ListenerClass();

	//Table Format
	tableFormat = new EnumTableFormatAdaptor<AssetTableFormat, MyAsset>(AssetTableFormat.class);
	//Backend
	EventList<MyAsset> eventList = program.getProfileData().getAssetsEventList();
	//Sorting (per column)
	eventList.getReadWriteLock().readLock().lock();
	SortedList<MyAsset> sortedList = new SortedList<MyAsset>(eventList);
	eventList.getReadWriteLock().readLock().unlock();
	
	//Filter
	eventList.getReadWriteLock().readLock().lock();
	filterList = new FilterList<MyAsset>(sortedList);
	eventList.getReadWriteLock().readLock().unlock();

	filterList.addListEventListener(listener);
	//Table Model
	tableModel = EventModels.createTableModel(filterList, tableFormat);
	//Table
	jTable = new JAssetTable(program, tableModel);
	jTable.setCellSelectionEnabled(true);
	jTable.setRowSelectionAllowed(true);
	jTable.setColumnSelectionAllowed(true);
	//Sorting
	TableComparatorChooser.install(jTable, sortedList, TableComparatorChooser.MULTIPLE_COLUMN_MOUSE, tableFormat);
	//Selection Model
	selectionModel = EventModels.createSelectionModel(filterList);
	selectionModel.setSelectionMode(ListSelection.MULTIPLE_INTERVAL_SELECTION_DEFENSIVE);
	jTable.setSelectionModel(selectionModel);
	
	//Listeners
	installTable(jTable, NAME);
	//Scroll
	JScrollPane jTableScroll = new JScrollPane(jTable);
	//Table Filter
	filterControl = new AssetFilterControl(
			program.getMainWindow().getFrame(),
			eventList,
			sortedList,
			filterList,
			Settings.get().getTableFilters(NAME)
			);

	//Menu
	installMenu(program, new AssetTableMenu(), jTable, MyAsset.class);

	jVolume = StatusPanel.createLabel(TabsAssets.get().totalVolume(), Images.ASSETS_VOLUME.getIcon());
	this.addStatusbarLabel(jVolume);

	jCount = StatusPanel.createLabel(TabsAssets.get().totalCount(), Images.EDIT_ADD.getIcon()); //Add
	this.addStatusbarLabel(jCount);

	jAverage = StatusPanel.createLabel(TabsAssets.get().average(), Images.ASSETS_AVERAGE.getIcon());
	this.addStatusbarLabel(jAverage);

	jReprocessed = StatusPanel.createLabel(TabsAssets.get().totalReprocessed(), Images.SETTINGS_REPROCESSING.getIcon());
	this.addStatusbarLabel(jReprocessed);

	jValue = StatusPanel.createLabel(TabsAssets.get().totalValue(), Images.TOOL_VALUES.getIcon());
	this.addStatusbarLabel(jValue);

	layout.setHorizontalGroup(
		layout.createParallelGroup()
			.addComponent(filterControl.getPanel())
			.addComponent(jTableScroll, 0, 0, Short.MAX_VALUE)
	);
	layout.setVerticalGroup(
		layout.createSequentialGroup()
			.addComponent(filterControl.getPanel())
			.addComponent(jTableScroll, 0, 0, Short.MAX_VALUE)
	);
}
 
Example 17
Source Project: jeveassets   Source File: AssetsTab.java    License: GNU General Public License v2.0 4 votes vote down vote up
public AssetFilterControl(JFrame jFrame, EventList<MyAsset> eventList, EventList<MyAsset> exportEventList, FilterList<MyAsset> filterList, Map<String, List<Filter>> filters) {
	super(jFrame, NAME, eventList, exportEventList, filterList, filters);
}
 
Example 18
Source Project: jeveassets   Source File: IndustryJobsTab.java    License: GNU General Public License v2.0 4 votes vote down vote up
public IndustryJobsTab(final Program program) {
	super(program, TabsJobs.get().industry(), Images.TOOL_INDUSTRY_JOBS.getIcon(), true);

	ListenerClass listener = new ListenerClass();
	//Table Format
	tableFormat = new EnumTableFormatAdaptor<IndustryJobTableFormat, MyIndustryJob>(IndustryJobTableFormat.class);
	//Backend
	eventList = program.getProfileData().getIndustryJobsEventList();
	//Sorting (per column)
	eventList.getReadWriteLock().readLock().lock();
	SortedList<MyIndustryJob> sortedList = new SortedList<MyIndustryJob>(eventList);
	eventList.getReadWriteLock().readLock().unlock();

	//Filter
	eventList.getReadWriteLock().readLock().lock();
	filterList = new FilterList<MyIndustryJob>(sortedList);
	eventList.getReadWriteLock().readLock().unlock();
	filterList.addListEventListener(listener);
	//Table Model
	tableModel = EventModels.createTableModel(filterList, tableFormat);
	//Table
	jTable = new JIndustryJobsTable(program, tableModel);
	jTable.setCellSelectionEnabled(true);
	PaddingTableCellRenderer.install(jTable, 1);
	//Sorting
	TableComparatorChooser.install(jTable, sortedList, TableComparatorChooser.MULTIPLE_COLUMN_MOUSE, tableFormat);
	//Selection Model
	selectionModel = EventModels.createSelectionModel(filterList);
	selectionModel.setSelectionMode(ListSelection.MULTIPLE_INTERVAL_SELECTION_DEFENSIVE);
	jTable.setSelectionModel(selectionModel);
	//Listeners
	installTable(jTable, NAME);
	//Scroll
	JScrollPane jTableScroll = new JScrollPane(jTable);
	//Table Filter
	Map<String, List<Filter>> defaultFilters = new HashMap<String, List<Filter>>();
	List<Filter> filter;
	filter = new ArrayList<Filter>();
	filter.add(new Filter(LogicType.AND, IndustryJobTableFormat.STATE, CompareType.EQUALS_NOT, IndustryJobState.STATE_DELIVERED.toString()));
	defaultFilters.put(TabsJobs.get().active(), filter);
	filter = new ArrayList<Filter>();
	filter.add(new Filter(LogicType.AND, IndustryJobTableFormat.STATE, CompareType.EQUALS, IndustryJobState.STATE_DELIVERED.toString()));
	defaultFilters.put(TabsJobs.get().completed(), filter);
	filterControl = new IndustryJobsFilterControl(
			tableFormat,
			program.getMainWindow().getFrame(),
			eventList,
			sortedList,
			filterList,
			Settings.get().getTableFilters(NAME),
			defaultFilters
			);

	//Menu
	installMenu(program, new JobsTableMenu(), jTable, MyIndustryJob.class);

	jInventionSuccess = StatusPanel.createLabel(TabsJobs.get().inventionSuccess(), Images.JOBS_INVENTION_SUCCESS.getIcon());
	this.addStatusbarLabel(jInventionSuccess);

	jManufactureOutputValue = StatusPanel.createLabel(TabsJobs.get().manufactureJobsValue(), Images.TOOL_VALUES.getIcon());
	this.addStatusbarLabel(jManufactureOutputValue);

	jCount = StatusPanel.createLabel(TabsJobs.get().count(), Images.EDIT_ADD.getIcon());
	this.addStatusbarLabel(jCount);

	layout.setHorizontalGroup(
		layout.createParallelGroup()
			.addComponent(filterControl.getPanel())
			.addComponent(jTableScroll, 700, 700, Short.MAX_VALUE)
	);
	layout.setVerticalGroup(
		layout.createSequentialGroup()
			.addComponent(filterControl.getPanel())
			.addComponent(jTableScroll, 100, 400, Short.MAX_VALUE)
	);
}
 
Example 19
Source Project: jeveassets   Source File: IndustryJobsTab.java    License: GNU General Public License v2.0 4 votes vote down vote up
public IndustryJobsFilterControl(EnumTableFormatAdaptor<IndustryJobTableFormat, MyIndustryJob> tableFormat, JFrame jFrame, EventList<MyIndustryJob> eventList, EventList<MyIndustryJob> exportEventList, FilterList<MyIndustryJob> filterList, Map<String, List<Filter>> filters, Map<String, List<Filter>> defaultFilters) {
	super(jFrame, NAME, eventList, exportEventList, filterList, filters, defaultFilters);
	this.tableFormat = tableFormat;
}
 
Example 20
Source Project: jeveassets   Source File: ItemsTab.java    License: GNU General Public License v2.0 4 votes vote down vote up
public ItemsTab(final Program program) {
	super(program, TabsItems.get().items(), Images.TOOL_ITEMS.getIcon(), true);

	//Table Format
	tableFormat = new EnumTableFormatAdaptor<>(ItemTableFormat.class);
	//Backend
	eventList = EventListManager.create();
	//Sorting (per column)
	eventList.getReadWriteLock().readLock().lock();
	SortedList<Item> sortedList = new SortedList<>(eventList);
	eventList.getReadWriteLock().readLock().unlock();
	//Filter
	eventList.getReadWriteLock().readLock().lock();
	filterList = new FilterList<>(sortedList);
	eventList.getReadWriteLock().readLock().unlock();
	
	//Table Model
	tableModel = EventModels.createTableModel(filterList, tableFormat);
	//Table
	jTable = new JAutoColumnTable(program, tableModel);
	jTable.setCellSelectionEnabled(true);
	//Sorting
	TableComparatorChooser.install(jTable, sortedList, TableComparatorChooser.MULTIPLE_COLUMN_MOUSE, tableFormat);
	//Selection Model
	selectionModel = EventModels.createSelectionModel(filterList);
	selectionModel.setSelectionMode(ListSelection.MULTIPLE_INTERVAL_SELECTION_DEFENSIVE);
	jTable.setSelectionModel(selectionModel);
	//Listeners
	installTable(jTable, NAME);
	//Scroll
	JScrollPane jTableScroll = new JScrollPane(jTable);
	//Table Filter
	filterControl = new ItemsFilterControl(
			tableFormat,
			program.getMainWindow().getFrame(),
			eventList,
			sortedList,
			filterList,
			Settings.get().getTableFilters(NAME)
			);

	//Menu
	installMenu(program, new ItemTableMenu(), jTable, Item.class);

	layout.setHorizontalGroup(
		layout.createParallelGroup()
			.addComponent(filterControl.getPanel())
			.addComponent(jTableScroll, 0, 0, Short.MAX_VALUE)
	);
	layout.setVerticalGroup(
		layout.createSequentialGroup()
			.addComponent(filterControl.getPanel())
			.addComponent(jTableScroll, 0, 0, Short.MAX_VALUE)
	);

	try {
		eventList.getReadWriteLock().writeLock().lock();
		eventList.clear();
		eventList.addAll(StaticData.get().getItems().values());
	} finally {
		eventList.getReadWriteLock().writeLock().unlock();
	}
}
 
Example 21
Source Project: jeveassets   Source File: ItemsTab.java    License: GNU General Public License v2.0 4 votes vote down vote up
public ItemsFilterControl(EnumTableFormatAdaptor<ItemTableFormat, Item> tableFormat, JFrame jFrame, EventList<Item> eventList, SortedList<Item> sortedList, FilterList<Item> filterList, Map<String, List<Filter>> filters) {
	super(jFrame, NAME, eventList, sortedList, filterList, filters);
	this.tableFormat = tableFormat;
}