本文整理汇总了Java中ca.odell.glazedlists.gui.TableFormat类的典型用法代码示例。如果您正苦于以下问题:Java TableFormat类的具体用法?Java TableFormat怎么用?Java TableFormat使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TableFormat类属于ca.odell.glazedlists.gui包,在下文中一共展示了TableFormat类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getEnumTableFormatAdaptor
import ca.odell.glazedlists.gui.TableFormat; //导入依赖的package包/类
private EnumTableFormatAdaptor<?, ?> getEnumTableFormatAdaptor() {
if (getEventTableModel() != null) {
TableFormat<?> tableFormat = getEventTableModel().getTableFormat();
if (tableFormat instanceof EnumTableFormatAdaptor) {
return (EnumTableFormatAdaptor) tableFormat;
}
}
return null;
}
示例2: saveSettings
import ca.odell.glazedlists.gui.TableFormat; //导入依赖的package包/类
public final void saveSettings() {
//Save Settings
if (eventTableModel != null && jTable != null && toolName != null) {
TableFormat<?> tableFormat = eventTableModel.getTableFormat();
if (tableFormat instanceof EnumTableFormatAdaptor) {
EnumTableFormatAdaptor<?, ?> formatAdaptor = (EnumTableFormatAdaptor<?, ?>) tableFormat;
Settings.get().getTableColumns().put(toolName, formatAdaptor.getColumns());
Settings.get().getTableResize().put(toolName, formatAdaptor.getResizeMode());
Settings.get().getTableColumnsWidth().put(toolName, jTable.getColumnsWidth());
}
}
}
示例3: installTable
import ca.odell.glazedlists.gui.TableFormat; //导入依赖的package包/类
/**
* Table automation
* 1. Saving table settings (TableColumns, TableResize, TableColumnsWidth)
* 2. Restore table selection after update
* 3. Restore expanded state for JSeparatorTable after update
* 4. Lock/unlock table doing update
*
* @param jTable
* @param toolName unique tool name
*/
protected final void installTable(final JAutoColumnTable jTable, String toolName) {
this.toolName = toolName;
//Table Selection
ListSelectionModel selectionModel = jTable.getSelectionModel();
if (selectionModel instanceof DefaultEventSelectionModel) {
this.eventSelectionModel = (DefaultEventSelectionModel<?>) selectionModel;
}
TableModel tableModel = jTable.getModel();
if (tableModel instanceof DefaultEventTableModel) {
this.eventTableModel = (DefaultEventTableModel<?>) tableModel;
}
//Table lock
this.jTable = jTable;
//Load Settings
if (eventTableModel != null && toolName != null) {
TableFormat<?> tableFormat = eventTableModel.getTableFormat();
if (tableFormat instanceof EnumTableFormatAdaptor) {
EnumTableFormatAdaptor<?, ?> formatAdaptor = (EnumTableFormatAdaptor<?, ?>) tableFormat;
formatAdaptor.setColumns(Settings.get().getTableColumns().get(toolName));
formatAdaptor.setResizeMode(Settings.get().getTableResize().get(toolName));
jTable.setColumnsWidth(Settings.get().getTableColumnsWidth().get(toolName));
eventTableModel.fireTableStructureChanged();
}
}
}
示例4: createTableModel
import ca.odell.glazedlists.gui.TableFormat; //导入依赖的package包/类
/**
* Construct the table model for this table. The default implementation of this creates a GlazedTableModel using an
* Advanced format.
* @param eventList on which to build the model
* @return table model
*/
protected GlazedTableModel createTableModel(EventList eventList) {
return new GlazedTableModel(eventList, getColumnPropertyNames(), modelId) {
protected TableFormat createTableFormat() {
return new DefaultAdvancedTableFormat();
}
};
}
示例5: TableColumnValueFunction
import ca.odell.glazedlists.gui.TableFormat; //导入依赖的package包/类
public TableColumnValueFunction(TableFormat<E> tableFormat, int columnIndex) {
this.tableFormat = tableFormat;
this.columnIndex = columnIndex;
}
示例6: createTableModel
import ca.odell.glazedlists.gui.TableFormat; //导入依赖的package包/类
public static <E> DefaultEventTableModel<E> createTableModel(EventList<E> source, TableFormat<E> tableFormat) {
// XXX - Workaround for java bug: https://bugs.openjdk.java.net/browse/JDK-8068824
//return new DefaultEventTableModel<E>(createSwingThreadProxyList(source), tableFormat);
return new FixedEventTableModel<E>(createSwingThreadProxyList(source), tableFormat);
}
示例7: FixedEventTableModel
import ca.odell.glazedlists.gui.TableFormat; //导入依赖的package包/类
public FixedEventTableModel(EventList<E> source, TableFormat<E> tableFormat) {
super(source, tableFormat);
}
示例8: getTableFormat
import ca.odell.glazedlists.gui.TableFormat; //导入依赖的package包/类
@Override
public TableFormat<Integer> getTableFormat() {
return null;
}
示例9: createTableModel
import ca.odell.glazedlists.gui.TableFormat; //导入依赖的package包/类
public static <E> DefaultEventTableModel<E> createTableModel(EventList<E> source, TableFormat<E> tableFormat) {
return new DefaultEventTableModel<E>(createSwingThreadProxyList(source), tableFormat);
}
示例10: TableColumnValueFunction
import ca.odell.glazedlists.gui.TableFormat; //导入依赖的package包/类
public TableColumnValueFunction(TableFormat<E> tableFormat,
int columnIndex) {
this.tableFormat = tableFormat;
this.columnIndex = columnIndex;
}
示例11: GlazedListTableWidget
import ca.odell.glazedlists.gui.TableFormat; //导入依赖的package包/类
public GlazedListTableWidget(Class dataType, List<? extends Object> rows, TableFormat format,
String[] filterProperties)
{
this(dataType, rows, format, filterProperties, null, false);
}
示例12: initModels
import ca.odell.glazedlists.gui.TableFormat; //导入依赖的package包/类
private void initModels() {
EventList<LoadProfileEntity> treeItems = GlazedLists.eventListOf();
treeModel = new EventsTreeModel(treeItems);
tree.setModel(treeModel);
TableFormat<SelectionDecorator> tableFormat = GlazedLists.tableFormat(SelectionDecorator.class, new String[] {
"selected",
"baseObject.name" },
new String[] { "Selected", "Name" }, new boolean[] { true, false });
decoratedClients = GlazedLists.eventListOf();
EventTableModel<SelectionDecorator> clientsTableModel = new EventTableModel<SelectionDecorator>(decoratedClients,
tableFormat);
tblClients.setModel(clientsTableModel);
tblClients.getColumnModel().getColumn(0).setMaxWidth(24);
decoratedTargets = GlazedLists.eventListOf();
oneTimeDecoratedTargets = GlazedLists.eventListOf();
EventTableModel<SelectionDecorator> targetsTableModel = new EventTableModel<SelectionDecorator>(decoratedTargets,
tableFormat);
targetsTableModel.addTableModelListener(new TableModelListener() {
@Override
public void tableChanged(final TableModelEvent e) {
ModelUtils.updateTargetDecorators(decoratedTargets, oneTimeDecoratedTargets,
loadProfilesController.getTargets(), true);
if (activeLoadProfileEntityPanel instanceof OneTimePanel) {
activeLoadProfileEntityPanel.repaint();
}
}
});
tblTargets.setModel(targetsTableModel);
tblTargets.getColumnModel().getColumn(0).setMaxWidth(24);
EventList<Target> targets = GlazedLists.<Target>eventListOf();
EventList<Operation> operations = GlazedLists.<Operation>eventListOf();
EventList<Client> clients = GlazedLists.<Client>eventListOf();
stairsPanel.setCboOperationModel(new EventComboBoxModel<Operation>(operations));
oneTimePanel.setCboOperationModel(new EventComboBoxModel<Operation>(operations));
loadProfilesController.setTreeItems(treeItems);
loadProfilesController.setOperations(operations);
loadProfilesController.setTargets(targets);
loadProfilesController.setClients(clients);
oneTimePanel.setTblTargetModel(new EventTableModel<SelectionDecorator>(oneTimeDecoratedTargets, tableFormat));
}
示例13: initModels
import ca.odell.glazedlists.gui.TableFormat; //导入依赖的package包/类
private void initModels() {
TableFormat<Operation> operationsTableFormat = GlazedLists.tableFormat(Operation.class, new String[] { "name",
"relativeClientLoad" },
new String[] { "Name", "Rel. Client Load" }, new boolean[] { true, true });
EventTableModel<Operation> operationsModel = new EventTableModel<Operation>(operations, operationsTableFormat);
tblOperations.setModel(operationsModel);
tblOperations.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);
tblOperations.setColumnWidths(300, 100);
tblOperations.getColumnModel().getColumn(0).setCellEditor(new StringCellEditor(tblOperations, operations));
TableColumn column = tblOperations.getColumnModel().getColumn(1);
column.setCellEditor(new DoubleCellEditor());
column.setCellRenderer(new DoubleCellRenderer());
TableFormat<Target> targetsTableFormat = GlazedLists.tableFormat(Target.class, new String[] { "name", "loadPart" },
new String[] { "Name", "Load Part" }, new boolean[] { true, true });
EventTableModel<Target> targetsModel = new EventTableModel<Target>(targets, targetsTableFormat);
tblTargets.setModel(targetsModel);
tblTargets.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);
tblTargets.setColumnWidths(300, 100);
tblTargets.getColumnModel().getColumn(0).setCellEditor(new StringCellEditor(tblTargets, targets));
column = tblTargets.getColumnModel().getColumn(1);
column.setCellEditor(new DoubleCellEditor());
column.setCellRenderer(new DoubleCellRenderer());
TableFormat<Client> clientsTableFormat = GlazedLists
.tableFormat(Client.class,
new String[] { "daemonId", "name", "numProcesses", "relativePower" },
new String[] { "Daemon ID", "Name", "# of Processes", "Rel. Power" }, new boolean[] { false, true,
true, true });
EventTableModel<Client> clientsModel = new EventTableModel<Client>(clients, clientsTableFormat);
tblClients.setModel(clientsModel);
tblClients.setColumnWidths(80, 200, 80, 60);
tblClients.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);
// tblClients.getColumnModel().getColumn(0).setCellEditor(new IntegerCellEditor());
tblClients.getColumnModel().getColumn(1).setCellEditor(new StringCellEditor(tblClients, clients));
tblClients.getColumnModel().getColumn(2).setCellEditor(new IntegerCellEditor());
column = tblClients.getColumnModel().getColumn(3);
column.setCellEditor(new DoubleCellEditor());
column.setCellRenderer(new DoubleCellRenderer());
cboConfigurationFile.setModel(new EventComboBoxModel<String>(configFiles));
cboConfigurationFile.setSelectedItem(controller.getActiveSettingsFile());
}
示例14: createTableCellEditor
import ca.odell.glazedlists.gui.TableFormat; //导入依赖的package包/类
/**
* This factory method creates and returns a {@link AutoCompleteCellEditor}
* which adapts an autocompleting {@link JComboBox} for use as a Table
* Cell Editor. The values within the table column are used as
* autocompletion terms within the {@link ComboBoxModel}.
*
* <p>This version of <code>createTableCellEditor</code> makes no
* assumption about the values stored in the TableModel at the given
* <code>columnIndex</code>. Instead, it uses the given
* <code>uniqueComparator</code> to determine which values are duplicates
* (and thus can safely be removed) and which are unique (and thus must
* remain in the {@link ComboBoxModel}).
*
* <p>Note that this factory method is only appropriate for use when the
* values in the {@link ComboBoxModel} should be the unique set of values
* in a table column. If some other list of values will be used then
* {@link #createTableCellEditor(EventList)} is the appropriate factory
* method to use.
*
* <p>If the appearance or function of the autocompleting {@link JComboBox}
* is to be customized, it can be retrieved using
* {@link AutoCompleteCellEditor#getComponent()}.
*
* @param uniqueComparator the {@link Comparator} that strips away
* duplicate elements from the {@link ComboBoxModel}
* @param tableFormat specifies how each row object within a table is
* broken apart into column values
* @param tableData the {@link EventList} backing the TableModel
* @param columnIndex the index of the column for which to return a
* {@link AutoCompleteCellEditor}
* @return a {@link AutoCompleteCellEditor} which contains an autocompleting
* combobox whose contents remain consistent with the data in the
* table column at the given <code>columnIndex</code>
*/
public static <E> AutoCompleteCellEditor<E> createTableCellEditor(Comparator uniqueComparator, TableFormat<E> tableFormat, EventList<E> tableData, int columnIndex) {
// use a function to extract all values for the column
final FunctionList.Function<E, Object> columnValueFunction = new TableColumnValueFunction<E>(tableFormat, columnIndex);
final FunctionList allColumnValues = new FunctionList<E, Object>(tableData, columnValueFunction);
// narrow the list to just unique values within the column
final EventList<E> uniqueColumnValues = new UniqueList<E>(allColumnValues, uniqueComparator);
return createTableCellEditor(uniqueColumnValues);
}
示例15: createTableCellEditor
import ca.odell.glazedlists.gui.TableFormat; //导入依赖的package包/类
/**
* This factory method creates and returns a {@link AutoCompleteCellEditor}
* which adapts an autocompleting {@link JComboBox} for use as a Table Cell
* Editor. The values within the table column are used as autocompletion
* terms within the {@link ComboBoxModel}.
* <p/>
* <p/>
* This version of <code>createTableCellEditor</code> makes no assumption
* about the values stored in the TableModel at the given
* <code>columnIndex</code>. Instead, it uses the given
* <code>uniqueComparator</code> to determine which values are duplicates
* (and thus can safely be removed) and which are unique (and thus must
* remain in the {@link ComboBoxModel}).
* <p/>
* <p/>
* Note that this factory method is only appropriate for use when the values
* in the {@link ComboBoxModel} should be the unique set of values in a
* table column. If some other list of values will be used then
* {@link #createTableCellEditor(EventList)} is the appropriate factory
* method to use.
* <p/>
* <p/>
* If the appearance or function of the autocompleting {@link JComboBox} is
* to be customized, it can be retrieved using
* {@link AutoCompleteCellEditor#getComponent()}.
*
* @param uniqueComparator the {@link Comparator} that strips away duplicate elements
* from the {@link ComboBoxModel}
* @param tableFormat specifies how each row object within a table is broken apart
* into column values
* @param tableData the {@link EventList} backing the TableModel
* @param columnIndex the index of the column for which to return a
* {@link AutoCompleteCellEditor}
* @return a {@link AutoCompleteCellEditor} which contains an autocompleting
* combobox whose contents remain consistent with the data in the
* table column at the given <code>columnIndex</code>
*/
@SuppressWarnings({"rawtypes", "unchecked"})
public static <E> AutoCompleteCellEditor<E> createTableCellEditor(
Comparator uniqueComparator, TableFormat<E> tableFormat,
EventList<E> tableData, int columnIndex) {
// use a function to extract all values for the column
final FunctionList.Function<E, Object> columnValueFunction = new TableColumnValueFunction<E>(
tableFormat, columnIndex);
final FunctionList allColumnValues = new FunctionList<E, Object>(
tableData, columnValueFunction);
// narrow the list to just unique values within the column
final EventList<E> uniqueColumnValues = new UniqueList<E>(
allColumnValues, uniqueComparator);
return createTableCellEditor(uniqueColumnValues);
}