当前位置: 首页>>代码示例>>Java>>正文


Java TableColumnExt.getModelIndex方法代码示例

本文整理汇总了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));
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:27,代码来源:JXTableUnitTest.java

示例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");
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:29,代码来源:JXTreeTableVisualCheck.java

示例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>

}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:22,代码来源:TreeTableDemo.java

示例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());
    }
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:13,代码来源:JXTableUnitTest.java

示例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));
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:30,代码来源:AnnotatedTableColumnFactory.java

示例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));
	}
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:15,代码来源:SwingTerminalTable2ColumnFactory.java

示例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));
    }
}
 
开发者ID:sing-group,项目名称:aibench-project,代码行数:36,代码来源:JXTable.java

示例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);
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:15,代码来源:XProperties.java

示例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;
}
 
开发者ID:sing-group,项目名称:aibench-project,代码行数:23,代码来源:JXTable.java

示例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);
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:11,代码来源:XProperties.java


注:本文中的org.jdesktop.swingx.table.TableColumnExt.getModelIndex方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。