本文整理汇总了Java中ca.odell.glazedlists.swing.TableComparatorChooser.install方法的典型用法代码示例。如果您正苦于以下问题:Java TableComparatorChooser.install方法的具体用法?Java TableComparatorChooser.install怎么用?Java TableComparatorChooser.install使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ca.odell.glazedlists.swing.TableComparatorChooser
的用法示例。
在下文中一共展示了TableComparatorChooser.install方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: HostsTable
import ca.odell.glazedlists.swing.TableComparatorChooser; //导入方法依赖的package包/类
HostsTable(JTable jTable)
{
ObservableElementList.Connector<ObservableObject> connector = GlazedLists.beanConnector(ObservableObject.class);
SortedList<ObservableObject> servicesEventList =
new SortedList<ObservableObject>(
new ObservableElementList<ObservableObject> (
GlazedLists.threadSafeList(
new BasicEventList<ObservableObject>()
), connector
));
EventTableModel<ObservableObject> servicesTableModel = new EventTableModel<ObservableObject>(servicesEventList,
new BeanTableFormat<ObservableObject>(propertyNames, columnLabels));
list = new ObservableList(servicesEventList, propertyNames, new String[]{"name"});
//JTable jTable = new JTable(servicesTableModel);
jTable.setModel(servicesTableModel);
_selection = new EventSelectionModel<ObservableObject>(servicesEventList);
jTable.setSelectionModel(_selection);
TableComparatorChooser tableSorter = TableComparatorChooser.install(jTable, servicesEventList, TableComparatorChooser.SINGLE_COLUMN);
Dimension size = jTable.getPreferredScrollableViewportSize();
// jTable.setPreferredScrollableViewportSize
// (new Dimension(jTable.getPreferredSize().width, size.height));
// JScrollPane servicesListScrollPane = new JScrollPane(jTable);
// this.setLayout(new BorderLayout());
// this.add(servicesListScrollPane, BorderLayout.CENTER);
}
示例2: JournalTab
import ca.odell.glazedlists.swing.TableComparatorChooser; //导入方法依赖的package包/类
public JournalTab(final Program program) {
super(program, TabsJournal.get().title(), Images.TOOL_JOURNAL.getIcon(), true);
//Table Format
tableFormat = new EnumTableFormatAdaptor<JournalTableFormat, MyJournal>(JournalTableFormat.class);
//Backend
eventList = program.getProfileData().getJournalEventList();
//Sorting (per column)
eventList.getReadWriteLock().readLock().lock();
SortedList<MyJournal> sortedList = new SortedList<MyJournal>(eventList);
eventList.getReadWriteLock().readLock().unlock();
//Filter
eventList.getReadWriteLock().readLock().lock();
filterList = new FilterList<MyJournal>(sortedList);
eventList.getReadWriteLock().readLock().unlock();
//Table Model
tableModel = EventModels.createTableModel(filterList, tableFormat);
//Table
jTable = new JJournalTable(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 Panels
JScrollPane jTableScroll = new JScrollPane(jTable);
//Table Filter
filterControl = new JournalFilterControl(
tableFormat,
program.getMainWindow().getFrame(),
eventList,
sortedList,
filterList,
Settings.get().getTableFilters(NAME)
);
//Menu
installMenu(program, new JournalTableMenu(), jTable, MyJournal.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)
);
}
示例3: MarketOrdersTab
import ca.odell.glazedlists.swing.TableComparatorChooser; //导入方法依赖的package包/类
public MarketOrdersTab(final Program program) {
super(program, TabsOrders.get().market(), Images.TOOL_MARKET_ORDERS.getIcon(), true);
ListenerClass listener = new ListenerClass();
//Table Format
tableFormat = new EnumTableFormatAdaptor<MarketTableFormat, MyMarketOrder>(MarketTableFormat.class);
//Backend
eventList = program.getProfileData().getMarketOrdersEventList();
//Sorting (per column)
eventList.getReadWriteLock().readLock().lock();
SortedList<MyMarketOrder> sortedList = new SortedList<MyMarketOrder>(eventList);
eventList.getReadWriteLock().readLock().unlock();
//Filter
eventList.getReadWriteLock().readLock().lock();
filterList = new FilterList<MyMarketOrder>(sortedList);
eventList.getReadWriteLock().readLock().unlock();
filterList.addListEventListener(listener);
//Table Model
tableModel = EventModels.createTableModel(filterList, tableFormat);
//Table
jTable = new JMarketOrdersTable(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 Panels
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, MarketTableFormat.ORDER_TYPE, CompareType.EQUALS, TabsOrders.get().buy()));
filter.add(new Filter(LogicType.AND, MarketTableFormat.STATUS, CompareType.EQUALS, TabsOrders.get().statusActive()));
defaultFilters.put(TabsOrders.get().activeBuyOrders(), filter);
filter = new ArrayList<Filter>();
filter.add(new Filter(LogicType.AND, MarketTableFormat.ORDER_TYPE, CompareType.EQUALS, TabsOrders.get().sell()));
filter.add(new Filter(LogicType.AND, MarketTableFormat.STATUS, CompareType.EQUALS, TabsOrders.get().statusActive()));
defaultFilters.put(TabsOrders.get().activeSellOrders(), filter);
filterControl = new MarketOrdersFilterControl(
tableFormat,
program.getMainWindow().getFrame(),
eventList,
sortedList,
filterList,
Settings.get().getTableFilters(NAME),
defaultFilters
);
//Menu
installMenu(program, new OrdersTableMenu(), jTable, MyMarketOrder.class);
jSellOrdersTotal = StatusPanel.createLabel(TabsOrders.get().totalSellOrders(), Images.ORDERS_SELL.getIcon());
this.addStatusbarLabel(jSellOrdersTotal);
jBuyOrdersTotal = StatusPanel.createLabel(TabsOrders.get().totalBuyOrders(), Images.ORDERS_BUY.getIcon());
this.addStatusbarLabel(jBuyOrdersTotal);
jEscrowTotal = StatusPanel.createLabel(TabsOrders.get().totalEscrow(), Images.ORDERS_ESCROW.getIcon());
this.addStatusbarLabel(jEscrowTotal);
jToCoverTotal = StatusPanel.createLabel(TabsOrders.get().totalToCover(), Images.ORDERS_TO_COVER.getIcon());
this.addStatusbarLabel(jToCoverTotal);
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)
);
}
示例4: ValueTableTab
import ca.odell.glazedlists.swing.TableComparatorChooser; //导入方法依赖的package包/类
public ValueTableTab(final Program program) {
super(program, TabsValues.get().title(), Images.TOOL_VALUE_TABLE.getIcon(), true);
//Table Format
tableFormat = new EnumTableFormatAdaptor<ValueTableFormat, Value>(ValueTableFormat.class);
//Backend
eventList = new EventListManager<Value>().create();
//Sorting (per column)
eventList.getReadWriteLock().readLock().lock();
SortedList<Value> columnSortedList = new SortedList<Value>(eventList);
eventList.getReadWriteLock().readLock().unlock();
//Sorting Total
eventList.getReadWriteLock().readLock().lock();
SortedList<Value> totalSortedList = new SortedList<Value>(columnSortedList, new TotalComparator());
eventList.getReadWriteLock().readLock().unlock();
//Filter
eventList.getReadWriteLock().readLock().lock();
filterList = new FilterList<Value>(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)
);
}
示例5: AssetsTab
import ca.odell.glazedlists.swing.TableComparatorChooser; //导入方法依赖的package包/类
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 = 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)
);
}
示例6: IndustryJobsTab
import ca.odell.glazedlists.swing.TableComparatorChooser; //导入方法依赖的package包/类
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)
);
}
示例7: ItemsTab
import ca.odell.glazedlists.swing.TableComparatorChooser; //导入方法依赖的package包/类
public ItemsTab(final Program program) {
super(program, TabsItems.get().items(), Images.TOOL_ITEMS.getIcon(), true);
//Table Format
tableFormat = new EnumTableFormatAdaptor<ItemTableFormat, Item>(ItemTableFormat.class);
//Backend
eventList = new EventListManager<Item>().create();
//Sorting (per column)
eventList.getReadWriteLock().readLock().lock();
SortedList<Item> sortedList = new SortedList<Item>(eventList);
eventList.getReadWriteLock().readLock().unlock();
//Filter
eventList.getReadWriteLock().readLock().lock();
filterList = new FilterList<Item>(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();
}
}
示例8: MovieTrailerPanel
import ca.odell.glazedlists.swing.TableComparatorChooser; //导入方法依赖的package包/类
/**
* Instantiates a new movie details panel.
*
* @param model
* the model
*/
public MovieTrailerPanel(MovieSelectionModel model) {
this.movieSelectionModel = model;
setLayout(new FormLayout(new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), },
new RowSpec[] { FormFactory.RELATED_GAP_ROWSPEC, RowSpec.decode("default:grow"), }));
trailerEventList = new SortedList<>(
GlazedLists.threadSafeList(new ObservableElementList<>(new BasicEventList<MovieTrailer>(), GlazedLists.beanConnector(MovieTrailer.class))));
trailerTableModel = new DefaultEventTableModel<>(GlazedListsSwing.swingThreadProxyList(trailerEventList), new TrailerTableFormat());
table = new ZebraJTable(trailerTableModel);
table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
table.setSelectionModel(new NullSelectionModel());
TableComparatorChooser.install(table, trailerEventList, TableComparatorChooser.SINGLE_COLUMN);
JScrollPane scrollPane = ZebraJTable.createStripedJScrollPane(table);
add(scrollPane, "2, 2, fill, fill");
scrollPane.setViewportView(table);
LinkListener linkListener = new LinkListener();
table.addMouseListener(linkListener);
table.addMouseMotionListener(linkListener);
// install the propertychangelistener
PropertyChangeListener propertyChangeListener = new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent propertyChangeEvent) {
String property = propertyChangeEvent.getPropertyName();
Object source = propertyChangeEvent.getSource();
// react on selection of a movie and change of a trailer
if ((source.getClass() == MovieSelectionModel.class && "selectedMovie".equals(property))
|| (source.getClass() == Movie.class && "trailer".equals(property))) {
trailerEventList.clear();
trailerEventList.addAll(movieSelectionModel.getSelectedMovie().getTrailer());
try {
TableColumnResizer.adjustColumnPreferredWidths(table, 7);
}
catch (Exception e) {
}
}
}
};
movieSelectionModel.addPropertyChangeListener(propertyChangeListener);
}
示例9: createTableComparatorChooser
import ca.odell.glazedlists.swing.TableComparatorChooser; //导入方法依赖的package包/类
private TableComparatorChooser<BibEntry> createTableComparatorChooser(JTable table, SortedList<BibEntry> list, Object sortingStrategy) {
return TableComparatorChooser.install(table, list, sortingStrategy);
}