本文整理汇总了Java中org.jdesktop.swingx.table.TableColumnExt.getModelIndex方法的典型用法代码示例。如果您正苦于以下问题:Java TableColumnExt.getModelIndex方法的具体用法?Java TableColumnExt.getModelIndex怎么用?Java TableColumnExt.getModelIndex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jdesktop.swingx.table.TableColumnExt
的用法示例。
在下文中一共展示了TableColumnExt.getModelIndex方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testStringValueRegistryFromColumnFactory
import org.jdesktop.swingx.table.TableColumnExt; //导入方法依赖的package包/类
/**
* Issue 1145-swingx: re-enable filter to use string representation.
* Here: test that cell-location StringValue look up initial per-column renderer
*
*/
@Test
public void testStringValueRegistryFromColumnFactory() {
JXTable table = new JXTable();
final int column = 2;
// custom column factory which sets per-column renderer
ColumnFactory factory = new ColumnFactory() {
@Override
public void configureTableColumn(TableModel model,
TableColumnExt columnExt) {
super.configureTableColumn(model, columnExt);
if (columnExt.getModelIndex() == column)
columnExt.setCellRenderer(new DefaultTableRenderer());
}
};
table.setColumnFactory(factory);
table.setModel(createModelDefaultColumnClasses(4));
StringValueRegistry provider = table.getStringValueRegistry();
assertEquals(table.getCellRenderer(0, column), provider.getStringValue(0, column));
}
示例2: interactiveCustomColumnFactory
import org.jdesktop.swingx.table.TableColumnExt; //导入方法依赖的package包/类
/**
* Issue #1379-swingx: support access to underlying treeTableModel of TreeTableModelAdapter.
*
* Needed f.i. in a custom ColumnFactory to configure the hierarchical column specifically.
*/
public void interactiveCustomColumnFactory() {
JXTreeTable table = new JXTreeTable();
ColumnFactory factory = new ColumnFactory() {
/**
* @inherited <p>
*/
@Override
public void configureTableColumn(TableModel model,
TableColumnExt columnExt) {
super.configureTableColumn(model, columnExt);
if (model instanceof TreeTableModelProvider) {
TreeTableModel treeTableModel = ((TreeTableModelProvider) model).getTreeTableModel();
if (treeTableModel.getHierarchicalColumn() == columnExt.getModelIndex()) {
columnExt.setTitle("Hierarchical: " + columnExt.getTitle());
}
}
}
};
table.setColumnFactory(factory);
table.setTreeTableModel(new FileSystemModel());
showWithScrollingInFrame(table, "custom columnFactory");
}
示例3: bind
import org.jdesktop.swingx.table.TableColumnExt; //导入方法依赖的package包/类
private void bind() {
// <snip>JXTreeTable column customization
// configure and install a custom columnFactory, arguably data related ;-)
ColumnFactory factory = new ColumnFactory() {
String[] columnNameKeys = { "componentType", "componentName", "componentLocation", "componentSize" };
@Override
public void configureTableColumn(TableModel model,
TableColumnExt columnExt) {
super.configureTableColumn(model, columnExt);
if (columnExt.getModelIndex() < columnNameKeys.length) {
columnExt.setTitle(DemoUtils.getResourceString(TreeTableDemo.class,
columnNameKeys[columnExt.getModelIndex()]));
}
}
};
treeTable.setColumnFactory(factory);
// </snip>
}
示例4: configureTableColumn
import org.jdesktop.swingx.table.TableColumnExt; //导入方法依赖的package包/类
@Override
public void configureTableColumn(TableModel model,
TableColumnExt columnExt) {
super.configureTableColumn(model, columnExt);
if (columnExt.getModelIndex() % 2 != 0) {
// make odd columns not-sortable
columnExt.setSortable(false);
} else {
// set per-column comparator for even columns
columnExt.setComparator(Collator.getInstance());
}
}
示例5: configureTableColumn
import org.jdesktop.swingx.table.TableColumnExt; //导入方法依赖的package包/类
@Override
public void configureTableColumn(final TableModel model, final TableColumnExt columnExt)
{
super.configureTableColumn(model, columnExt);
final TableModelMetaInfo<?> modelMetaInfo = getTableModelMetaInfoOrNull(model);
if (modelMetaInfo == null)
{
return;
}
final int columnIndex = columnExt.getModelIndex();
final TableColumnInfo columnMetaInfo = modelMetaInfo.getTableColumnInfo(columnIndex);
columnExt.setCellRenderer(createTableCellRenderer(columnMetaInfo));
columnExt.setCellEditor(createTableCellEditor(columnMetaInfo));
if (columnMetaInfo.isSelectionColumn())
{
columnExt.setMaxWidth(25);
columnExt.putClientProperty(AnnotatedColumnControlButton.PROPERTY_DisableColumnControl, true);
}
updateColumnExtFromMetaInfo(columnExt, columnMetaInfo);
//
// Synchronize: columnMetaInfo -> columnExt
columnMetaInfo.addPropertyChangeListener(new TableColumnInfo2TableColumnExtSynchronizer(columnExt));
}
示例6: configureTableColumn
import org.jdesktop.swingx.table.TableColumnExt; //导入方法依赖的package包/类
@Override
public void configureTableColumn(final TableModel model, final TableColumnExt columnExt)
{
super.configureTableColumn(model, columnExt);
//
// Set TableColumn properties from underlying model adapter (if any)
final SwingTerminalTableModelAdapter<?> tableModelAdapter = SwingTerminalTableModelAdapter.castOrNull(model);
if (tableModelAdapter != null)
{
final int columnIndex = columnExt.getModelIndex();
columnExt.setPrototypeValue(tableModelAdapter.getPrototypeValue(columnIndex));
}
}
示例7: setSortOrder
import org.jdesktop.swingx.table.TableColumnExt; //导入方法依赖的package包/类
/**
* Sorts the table by the given column using the SortOrder.
*
*
* Respects the tableColumnExt's sortable and comparator
* properties: routes the column's comparator to the SortController
* and does nothing if !isSortable(column).
* <p>
*
* PENDING: JW - define the behaviour if the identifier is not found.
* This can happen if either there's no column at all with the identifier
* or if there's no column of type TableColumnExt.
* Currently does nothing, that is does not change sort state.
*
* @param identifier the column's identifier.
* @param sortOrder the sort order to use. If null or SortOrder.UNSORTED,
* this method has the same effect as resetSortOrder();
*
*/
public void setSortOrder(Object identifier, SortOrder sortOrder) {
if ((sortOrder == null) || !sortOrder.isSorted()) {
resetSortOrder();
return;
}
if (!isSortable(identifier)) return;
SortController sortController = getSortController();
if (sortController != null) {
TableColumnExt columnExt = getColumnExt(identifier);
if (columnExt == null) return;
SortKey sortKey = new SortKey(sortOrder,
columnExt.getModelIndex(),
columnExt.getComparator());
sortController.setSortKeys(Collections.singletonList(sortKey));
}
}
示例8: configureColumn
import org.jdesktop.swingx.table.TableColumnExt; //导入方法依赖的package包/类
/**
* Restores column properties if the model index is the same as the
* column's model index. Does nothing otherwise. <p>
*
* Here the properties are: width, preferredWidth, visible.
*
* @param columnExt the column to configure
*/
public void configureColumn(TableColumnExt columnExt) {
if (modelIndex != columnExt.getModelIndex()) return;
columnExt.setPreferredWidth(preferredWidth);
columnExt.setWidth(width);
columnExt.setVisible(visible);
}
示例9: getSortOrder
import org.jdesktop.swingx.table.TableColumnExt; //导入方法依赖的package包/类
/**
* Returns the SortOrder of the given column.
*
* PENDING: JW - define the behaviour if the identifier is not found.
* This can happen if either there's no column at all with the identifier
* or if there's no column of type TableColumnExt.
* Currently returns SortOrder.UNSORTED.
*
* @param identifier the column's identifier.
* @return the interactive sorter's SortOrder if matches the column
* or SortOrder.UNSORTED
*/
public SortOrder getSortOrder(Object identifier) {
SortController sortController = getSortController();
if (sortController == null) return SortOrder.UNSORTED;
TableColumnExt columnExt = getColumnExt(identifier);
if (columnExt == null) return SortOrder.UNSORTED;
int modelIndex = columnExt.getModelIndex();
SortKey sortKey = SortKey.getFirstSortKeyForColumn(sortController.getSortKeys(),
modelIndex);
return sortKey != null ? sortKey.getSortOrder() : SortOrder.UNSORTED;
}
示例10: ColumnState
import org.jdesktop.swingx.table.TableColumnExt; //导入方法依赖的package包/类
/**
* Constructor used by the Property.
*
* @param columnExt
* @param viewIndex
*/
public ColumnState(TableColumnExt columnExt, int viewIndex) {
this(columnExt.getWidth(), columnExt.getPreferredWidth(),
columnExt.getModelIndex(), columnExt.isVisible(), viewIndex);
}