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


Java TableColumnExt.setVisible方法代码示例

本文整理汇总了Java中org.jdesktop.swingx.table.TableColumnExt.setVisible方法的典型用法代码示例。如果您正苦于以下问题:Java TableColumnExt.setVisible方法的具体用法?Java TableColumnExt.setVisible怎么用?Java TableColumnExt.setVisible使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jdesktop.swingx.table.TableColumnExt的用法示例。


在下文中一共展示了TableColumnExt.setVisible方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testSetColumnSequence

import org.jdesktop.swingx.table.TableColumnExt; //导入方法依赖的package包/类
/**
 * Issue #1422-swingx: setColumnSequence works incorrectly
 */
@Test
public void testSetColumnSequence() {
    int numColumns = 5;
    JXTable table = new JXTable(10, numColumns);
    //hide first column
    TableColumnExt columnExt = table.getColumnExt(0);
    columnExt.setVisible(false);
    List<TableColumn> allColumns = table.getColumns(true);
    List<Object> identifiers = new ArrayList<Object>();
    for (TableColumn tableColumn : allColumns) {
        identifiers.add(tableColumn.getIdentifier());
    }
    Collections.reverse(identifiers);
    table.setColumnSequence(identifiers.toArray());
    assertEquals(numColumns, table.getColumnCount(true));
    assertEquals(false, columnExt.isVisible());
    assertEquals(numColumns -1, table.getColumnCount());
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:22,代码来源:JXTableUnitTest.java

示例2: configureTableColumn

import org.jdesktop.swingx.table.TableColumnExt; //导入方法依赖的package包/类
/**
 * {@inheritDoc} <p>
 * 
 * Overridden to set the column's identifier, lookup the title 
 */
@Override
public void configureTableColumn(TableModel model,
        TableColumnExt columnExt) {
    super.configureTableColumn(model, columnExt);
    columnExt.setIdentifier(model.getColumnName(columnExt.getModelIndex()));
    configureTitle(columnExt);
    ComponentProvider<?> provider = getComponentProvider(columnExt.getIdentifier());
    if (provider != null) {
        columnExt.setCellRenderer(new DefaultTableRenderer(provider));
    }
    Highlighter highlighter = getHighlighter(columnExt.getIdentifier());
    if (highlighter != null) {
        columnExt.setHighlighters(highlighter);
    }
    columnExt.setComparator(getComparator(columnExt.getIdentifier()));
    columnExt.setPrototypeValue(getPrototypeValue(columnExt.getIdentifier()));
    if (getHiddenNames().contains(columnExt.getIdentifier())) {
        columnExt.setVisible(false);
    }
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:26,代码来源:CustomColumnFactory.java

示例3: testSortedColumnIndex

import org.jdesktop.swingx.table.TableColumnExt; //导入方法依赖的package包/类
@Test
public void testSortedColumnIndex() {
    table.setModel(sortableTableModel);
    assertEquals(-1, table.getSortedColumnIndex());
    table.toggleSortOrder(0);
    assertEquals(0, table.getSortedColumnIndex());
    TableColumnExt columnExt = table.getColumnExt(0);
    columnExt.setVisible(false);
    assertEquals(-1, table.getSortedColumnIndex());
    columnExt.setVisible(true);
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:12,代码来源:JXTableUnitTest.java

示例4: testSorterAfterColumnHidden

import org.jdesktop.swingx.table.TableColumnExt; //导入方法依赖的package包/类
/**
 * Interactive sorter must be active if column is hidden.
 */
@Test
public void testSorterAfterColumnHidden() {
    JXTable table = new JXTable(sortableTableModel);
    TableColumnExt columnX = table.getColumnExt(0);
    table.toggleSortOrder(0);
    columnX.setVisible(false);
    assertEquals("interactive sorter must be same as sorter in column", 
            columnX, table.getSortedColumn());
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:13,代码来源:JXTableUnitTest.java

示例5: testSetSortOrderHiddenColumn

import org.jdesktop.swingx.table.TableColumnExt; //导入方法依赖的package包/类
/**
 * Programmatic sorting of hidden column (through table api).
 * 
 */
@Test
public void testSetSortOrderHiddenColumn() {
    // hidden only defined for TableColumnExt
    JXTable table = new JXTable(sortableTableModel);
    Object identifier = "Last Name";
    TableColumnExt columnExt = table.getColumnExt(identifier);
    columnExt.setVisible(false);
    table.setSortOrder(identifier, SortOrder.ASCENDING);
    assertEquals("sorted column must be at " + identifier, columnExt, table.getSortedColumn());
    assertEquals("column must be sorted after setting sortOrder on " + identifier, SortOrder.ASCENDING, table.getSortOrder(identifier));
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:16,代码来源:JXTableUnitTest.java

示例6: testPrefHiddenColumnNPE

import org.jdesktop.swingx.table.TableColumnExt; //导入方法依赖的package包/类
/**
 * Issue #547-swingx: NPE in ColumnFactory configureColumnWidth 
 *    for hidden column
 *
 */
@Test
public void testPrefHiddenColumnNPE() {
    JXTable table = new JXTable(new AncientSwingTeam());
    TableColumnExt columnExt = table.getColumnExt(0);
    columnExt.setPrototypeValue("Jessesmariaandjosefsapperlottodundteufel");
    columnExt.setVisible(false);
    // NPE
    table.getColumnFactory().configureColumnWidths(table, columnExt);
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:15,代码来源:JXTableUnitTest.java

示例7: testPrefHiddenColumn

import org.jdesktop.swingx.table.TableColumnExt; //导入方法依赖的package包/类
/**
 * Issue #547-swingx: hidden columns' pref width not initialized.
 *
 * PENDING: the default initialize is working as expected only
 *  if the config is done before setting the model, that is 
 *  in the ColumnFactory. Need public api to programatically
 *  trigger the init after the fact? 
 */
@Test
public void testPrefHiddenColumn() {
    JXTable table = new JXTable(new AncientSwingTeam());
    TableColumnExt columnExt = table.getColumnExt(0);
  columnExt.setPrototypeValue("Jessesmariaandjosefsapperlottodundteufel");
    TableCellRenderer renderer = table.getCellRenderer(0, 0);
    Component comp = renderer.getTableCellRendererComponent(null, columnExt.getPrototypeValue(), false, false, -1, -1);
    columnExt.setVisible(false);
    // make sure the column pref is initialized
    table.initializeColumnWidths();
    assertEquals("hidden column's pref must be set", 
            comp.getPreferredSize().width + table.getColumnMargin(), columnExt.getPreferredWidth());
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:22,代码来源:JXTableUnitTest.java

示例8: testTableEditingOnHiddenColumnEditableChange

import org.jdesktop.swingx.table.TableColumnExt; //导入方法依赖的package包/类
/**
 * Issue 372-swingx: table must cancel edit if column property 
 *   changes to not editable.
 * Here we test if the table is still editing after the editability 
 * change of a non-edited column, special case of hidden column. <p>
 * NOTE: doesn't really test, the columnModel doesn't
 * fire propertyChanges for hidden columns (see Issue #??-swingx)
 * 
 */
@Test
public void testTableEditingOnHiddenColumnEditableChange() {
    JXTable table = new JXTable(10, 2);
    int hiddenNotEditingColumn = 1;
    TableColumnExt columnExt = table.getColumnExt(hiddenNotEditingColumn);
    columnExt.setVisible(false);
    table.editCellAt(0, 0);
    // sanity
    assertTrue(table.isEditing());
    assertEquals(0, table.getEditingColumn());
    columnExt.setEditable(false);
    assertTrue("table must still be editing", table.isEditing());
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:23,代码来源:JXTableUnitTest.java

示例9: testRemoveAllColumsAfterModelChanged

import org.jdesktop.swingx.table.TableColumnExt; //导入方法依赖的package包/类
/**
 * Issue #54: hidden columns not removed on setModel.
 *
 */
@Test
public void testRemoveAllColumsAfterModelChanged() {
    JXTable table = new JXTable(sortableTableModel);
    TableColumnExt columnX = table.getColumnExt(0);
    columnX.setVisible(false);
    table.setModel(new DefaultTableModel());
    assertEquals("all columns must have been removed", 0, table.getColumnCount(true));
    assertEquals("all columns must have been removed", 
            table.getColumnCount(), table.getColumnCount(true));
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:15,代码来源:JXTableUnitTest.java

示例10: testHideShowLastColumns

import org.jdesktop.swingx.table.TableColumnExt; //导入方法依赖的package包/类
/**
 * Issue #165-swingx: IllegalArgumentException when
 * hiding/reshowing columns "at end" of column model.
 *
 */
@Test
public void testHideShowLastColumns() {
    JXTable table = new JXTable(10, 3);
    TableColumnExt ext = table.getColumnExt(2);
    for (int i = table.getModel().getColumnCount() - 1; i > 0; i--) {
       table.getColumnExt(i).setVisible(false); 
    }
    ext.setVisible(true);
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:15,代码来源:JXTableUnitTest.java

示例11: testRemoveAllColumns

import org.jdesktop.swingx.table.TableColumnExt; //导入方法依赖的package包/类
/**
 * Issue #54-swingx: hidden columns not removed.
 *
 */
@Test
public void testRemoveAllColumns() {
    JXTable table = new JXTable(sortableTableModel);
    TableColumnExt columnX = table.getColumnExt(0);
    columnX.setVisible(false);
    // set empty model
    table.setModel(new DefaultTableModel(0, 0));
    assertEquals("all columns must have been removed", 
            table.getColumnCount(), table.getColumnCount(true));
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:15,代码来源:JXTableUnitTest.java

示例12: testDraggedColumnVisible

import org.jdesktop.swingx.table.TableColumnExt; //导入方法依赖的package包/类
/**
 * Issue #390-swingx: JXTableHeader: throws AIOOB on removing dragged column.
 * Test that getDraggedColumn is visible or null.
 * 
 * Problem was reported on mac:
 * http://forums.java.net/jive/thread.jspa?threadID=18368&tstart=0
 * when hiding column while drag(?) is in process.
 */
@Test
public void testDraggedColumnVisible() {
    JXTable table = new JXTable(10, 2);
    TableColumnExt columnExt = table.getColumnExt(0);
    table.getTableHeader().setDraggedColumn(columnExt);
    // sanity assert
    assertEquals(columnExt, table.getTableHeader().getDraggedColumn());
    columnExt.setVisible(false);
    assertNull("dragged column must visible or null", table.getTableHeader().getDraggedColumn());
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:19,代码来源:JXTableHeaderTest.java

示例13: testTableNotEditingOnColumnVisibleChange

import org.jdesktop.swingx.table.TableColumnExt; //导入方法依赖的package包/类
/**
 * Not defined: what should happen if the edited column is hidden? 
 * For sure, editing must be terminated - but canceled or stopped?
 * 
 * Here we test if the table is not editing after editable property
 * of the currently edited column is changed to false.
 */
public void testTableNotEditingOnColumnVisibleChange() {
    JXTable table = new JXTable(10, 2);
    TableColumnExt columnExt = table.getColumnExt(0);
    table.editCellAt(0, 0);
    // sanity
    assertTrue(table.isEditing());
    assertEquals(0, table.getEditingColumn());
    columnExt.setVisible(false);
    assertFalse("table must have terminated edit",table.isEditing());
    fail("forcing a fail - cancel editing is a side-effect of removal notification");
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:19,代码来源:JXTableIssues.java

示例14: testRemoveAllColumsAfterModelChanged

import org.jdesktop.swingx.table.TableColumnExt; //导入方法依赖的package包/类
/**
 * Issue #54: hidden columns not removed on setModel.
 * sanity test (make sure nothing evil introduced in treeTable as 
 * compared to table)
 */
@Test
public void testRemoveAllColumsAfterModelChanged() {
    JXTreeTable table = new JXTreeTable(new FileSystemModel());
    TableColumnExt columnX = table.getColumnExt(1);
    columnX.setVisible(false);
    int columnCount = table.getColumnCount(true);
    assertEquals("total column count must be same as model", table.getModel().getColumnCount(), columnCount);
    assertEquals("visible column count must one less as total", columnCount - 1, table.getColumnCount());
    table.setTreeTableModel(new FileSystemModel());
    assertEquals("visible columns must be same as total", 
            table.getColumnCount(), table.getColumnCount(true));
  }
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:18,代码来源:JXTreeTableUnitTest.java

示例15: configureTableColumn

import org.jdesktop.swingx.table.TableColumnExt; //导入方法依赖的package包/类
/**
 * {@inheritDoc} <p>
 * 
 * Overridden to set the column's identifier, beautify the display title.
 */
@Override
public void configureTableColumn(TableModel model,
        TableColumnExt columnExt) {
    super.configureTableColumn(model, columnExt);
    columnExt.setIdentifier(model.getColumnName(columnExt.getModelIndex()));
    beautifyColumnTitle(columnExt);
    if (getHiddenNames().contains(columnExt.getIdentifier())) {
        columnExt.setVisible(false);
    }
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:16,代码来源:CustomColumnFactory.java


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