本文整理汇总了Java中org.jdesktop.swingx.table.TableColumnExt.setPrototypeValue方法的典型用法代码示例。如果您正苦于以下问题:Java TableColumnExt.setPrototypeValue方法的具体用法?Java TableColumnExt.setPrototypeValue怎么用?Java TableColumnExt.setPrototypeValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jdesktop.swingx.table.TableColumnExt
的用法示例。
在下文中一共展示了TableColumnExt.setPrototypeValue方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testPrefColumnsDuplicateMargin
import org.jdesktop.swingx.table.TableColumnExt; //导入方法依赖的package包/类
/**
* Issue #547-swingx: columns' pref width - added margin twice
* if has prototype.
*
* 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 testPrefColumnsDuplicateMargin() {
JXTable table = new JXTable(new AncientSwingTeam());
TableColumnExt columnExt = table.getColumnExt(0);
// force the prototype longer than the title
// to avoid that header measuring is triggered
// header renderer can have bigger fonts
columnExt.setPrototypeValue(columnExt.getTitle() + "longer");
TableCellRenderer renderer = table.getCellRenderer(0, 0);
Component comp = renderer.getTableCellRendererComponent(null, columnExt.getPrototypeValue(), false, false, -1, -1);
// make sure the column pref is initialized
table.initializeColumnWidths();
assertEquals("column margin must be added once", table.getColumnMargin(),
columnExt.getPreferredWidth() - comp.getPreferredSize().width);
}
示例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);
}
}
示例3: 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);
}
示例4: testPrefEmptyTableNPE
import org.jdesktop.swingx.table.TableColumnExt; //导入方法依赖的package包/类
/**
* Issue #547-swingx: NPE in ColumnFactory configureColumnWidth
* for empty table .. no: doesn't because
* table.getCellRenderer(row,column) does not use the row
* coordinate - so the illegal argument doesn't hurt.
*
*/
@Test
public void testPrefEmptyTableNPE() {
JXTable table = new JXTable(0, 4);
TableColumnExt columnExt = table.getColumnExt(0);
columnExt.setPrototypeValue("Jessesmariaandjosefsapperlottodundteufel");
// NPE
table.getColumnFactory().configureColumnWidths(table, columnExt);
}
示例5: 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());
}
示例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: updateColumnExtFromMetaInfo
import org.jdesktop.swingx.table.TableColumnExt; //导入方法依赖的package包/类
private static final void updateColumnExtFromMetaInfo(final TableColumnExt columnExt, final TableColumnInfo columnMetaInfo)
{
columnExt.setEditable(columnMetaInfo.isEditable());
columnExt.setVisible(columnMetaInfo.isVisible());
columnExt.setPrototypeValue(columnMetaInfo.getPrototypeValue());
}