本文整理汇总了Java中org.jdesktop.swingx.table.ColumnFactory类的典型用法代码示例。如果您正苦于以下问题:Java ColumnFactory类的具体用法?Java ColumnFactory怎么用?Java ColumnFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ColumnFactory类属于org.jdesktop.swingx.table包,在下文中一共展示了ColumnFactory类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getColumnFactory
import org.jdesktop.swingx.table.ColumnFactory; //导入依赖的package包/类
/**
* Returns the ColumnFactory.
* <p>
*
* @return the columnFactory to use for column creation and configuration,
* guaranteed to not be null.
*
* @see #setColumnFactory(ColumnFactory)
* @see org.jdesktop.swingx.table.ColumnFactory
*/
public ColumnFactory getColumnFactory() {
/*
* TODO JW: think about implications of not/ copying the reference to
* the shared instance into the table's field? Better access the
* getInstance() on each call? We are on single thread anyway...
* Furthermore, we don't expect the instance to change often, typically
* it is configured on startup. So we don't really have to worry about
* changes which would destabilize column state?
*/
if (columnFactory == null) {
return ColumnFactory.getInstance();
// columnFactory = ColumnFactory.getInstance();
}
return columnFactory;
}
开发者ID:RockManJoe64,项目名称:swingx,代码行数:26,代码来源:JXTable.java
示例2: testStringValueRegistryFromColumnFactory
import org.jdesktop.swingx.table.ColumnFactory; //导入依赖的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
示例3: testSetColumnFactory
import org.jdesktop.swingx.table.ColumnFactory; //导入依赖的package包/类
/**
* Tests per-table ColumnFactory: bound property, reset to shared.
*
*/
@Test
public void testSetColumnFactory() {
PropertyChangeReport report = new PropertyChangeReport();
table.addPropertyChangeListener(report);
ColumnFactory factory = createCustomColumnFactory();
table.setColumnFactory(factory);
assertEquals(1, report.getEventCount());
assertTrue(report.hasEvents("columnFactory"));
assertSame(factory, report.getLastNewValue("columnFactory"));
assertSame(ColumnFactory.getInstance(), report.getLastOldValue("columnFactory"));
report.clear();
table.setColumnFactory(null);
assertEquals(1, report.getEventCount());
assertTrue(report.hasEvents("columnFactory"));
assertSame(factory, report.getLastOldValue("columnFactory"));
assertSame(ColumnFactory.getInstance(), report.getLastNewValue("columnFactory"));
}
开发者ID:RockManJoe64,项目名称:swingx,代码行数:22,代码来源:JXTableUnitTest.java
示例4: interactiveCustomColumnFactory
import org.jdesktop.swingx.table.ColumnFactory; //导入依赖的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
示例5: bind
import org.jdesktop.swingx.table.ColumnFactory; //导入依赖的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
示例6: getColumnFactory
import org.jdesktop.swingx.table.ColumnFactory; //导入依赖的package包/类
/**
* Returns the ColumnFactory. <p>
*
* @return the columnFactory to use for column creation and
* configuration, guaranteed to not be null.
*
* @see #setColumnFactory(ColumnFactory)
* @see org.jdesktop.swingx.table.ColumnFactory
*/
public ColumnFactory getColumnFactory() {
/*
* TODO JW: think about implications of not/ copying the reference
* to the shared instance into the table's field? Better
* access the getInstance() on each call? We are on single thread
* anyway...
* Furthermore, we don't expect the instance to change often, typically
* it is configured on startup. So we don't really have to worry about
* changes which would destabilize column state?
*/
if (columnFactory == null) {
return ColumnFactory.getInstance();
// columnFactory = ColumnFactory.getInstance();
}
return columnFactory;
}
开发者ID:sing-group,项目名称:aibench-project,代码行数:26,代码来源:JXTable.java
示例7: testColumnConfigControlledByFactory
import org.jdesktop.swingx.table.ColumnFactory; //导入依赖的package包/类
/**
* Test if default column creation and configuration is
* controlled completely by ColumnFactory.
*
*/
@Test
public void testColumnConfigControlledByFactory() {
ColumnFactory factory = new ColumnFactory() {
@Override
public void configureTableColumn(TableModel model, TableColumnExt columnExt) {
assertNull(columnExt.getHeaderValue());
}
};
table.setColumnFactory(factory);
table.setModel(new DefaultTableModel(10, 2));
assertEquals(null, table.getColumn(0).getHeaderValue());
}
开发者ID:RockManJoe64,项目名称:swingx,代码行数:20,代码来源:JXTableUnitTest.java
示例8: testUseCustomColumnFactory
import org.jdesktop.swingx.table.ColumnFactory; //导入依赖的package包/类
/**
* Tests per-table ColumnFactory: use individual.
*
*/
@Test
public void testUseCustomColumnFactory() {
PropertyChangeReport report = new PropertyChangeReport();
table.addPropertyChangeListener(report);
ColumnFactory factory = createCustomColumnFactory();
table.setColumnFactory(factory);
// sanity...
assertSame(factory, report.getLastNewValue("columnFactory"));
table.setModel(new DefaultTableModel(2, 5));
assertEquals(String.valueOf(0), table.getColumnExt(0).getTitle());
}
开发者ID:RockManJoe64,项目名称:swingx,代码行数:16,代码来源:JXTableUnitTest.java
示例9: createCustomColumnFactory
import org.jdesktop.swingx.table.ColumnFactory; //导入依赖的package包/类
/**
* Creates and returns a custom columnFactory for testing.
* Sets column title to modelIndex.
*
* @return the custom ColumnFactory.
*/
protected ColumnFactory createCustomColumnFactory() {
ColumnFactory factory = new ColumnFactory() {
@Override
public void configureTableColumn(TableModel model,
TableColumnExt columnExt) {
super.configureTableColumn(model, columnExt);
columnExt.setTitle(String.valueOf(columnExt.getModelIndex()));
}
};
return factory;
}
开发者ID:RockManJoe64,项目名称:swingx,代码行数:21,代码来源:JXTableUnitTest.java
示例10: interactiveTestExpandsToViewportWidth
import org.jdesktop.swingx.table.ColumnFactory; //导入依赖的package包/类
/**
* Issue #??-swingx: column auto-sizing support.
*
*/
public void interactiveTestExpandsToViewportWidth() {
final JXTable table = new JXTable();
ColumnFactory factory = new ColumnFactory() {
@Override
public void configureTableColumn(TableModel model, TableColumnExt columnExt) {
super.configureTableColumn(model, columnExt);
if (model.getColumnClass(columnExt.getModelIndex()) == Integer.class) {
// to see the effect: excess width is distributed relative
// to the difference between maxSize and prefSize
columnExt.setMaxWidth(200);
} else {
columnExt.setMaxWidth(1024);
}
}
};
table.setColumnFactory(factory);
table.setColumnControlVisible(true);
table.setModel(sortableTableModel);
table.setHorizontalScrollEnabled(true);
table.packAll();
JXFrame frame = wrapWithScrollingInFrame(table, "expand to width");
Action toggleModel = new AbstractAction("toggle model") {
@Override
public void actionPerformed(ActionEvent e) {
table.setModel(table.getModel() == sortableTableModel ?
new DefaultTableModel(20, 4) : sortableTableModel);
}
};
addAction(frame, toggleModel);
frame.setSize(table.getPreferredSize().width - 50, 300);
frame.setVisible(true);
LOG.info("table: " + table.getWidth());
LOG.info("Viewport: " + table.getParent().getWidth());
}
开发者ID:RockManJoe64,项目名称:swingx,代码行数:44,代码来源:JXTableVisualCheck.java
示例11: setColumnFactory
import org.jdesktop.swingx.table.ColumnFactory; //导入依赖的package包/类
/**
* Sets the <code>ColumnFactory</code> to use for column creation and
* configuration. The default value is the shared application ColumnFactory.
* <p>
*
* Note: this method has no side-effect, that is existing columns are
* <b>not</b> re-created automatically, client code must trigger it
* manually.
*
* @param columnFactory the factory to use, <code>null</code> indicates to
* use the shared application factory.
*
* @see #getColumnFactory()
* @see org.jdesktop.swingx.table.ColumnFactory
*/
public void setColumnFactory(ColumnFactory columnFactory) {
/*
*
* TODO auto-configure columns on set? or add public table api to do so?
* Mostly, this is meant to be done once in the lifetime of the table,
* preferably before a model is set ... overshoot?
*/
ColumnFactory old = getColumnFactory();
this.columnFactory = columnFactory;
firePropertyChange("columnFactory", old, getColumnFactory());
}
开发者ID:RockManJoe64,项目名称:swingx,代码行数:27,代码来源:JXTable.java
示例12: setColumnFactory
import org.jdesktop.swingx.table.ColumnFactory; //导入依赖的package包/类
/**
* Sets the <code>ColumnFactory</code> to use for column creation and
* configuration. The default value is the shared application
* ColumnFactory.<p>
*
* Note: this method has no side-effect, that is existing columns are
* <b>not</b> re-created automatically, client code must trigger it
* manually.
*
* @param columnFactory the factory to use, <code>null</code> indicates
* to use the shared application factory.
*
* @see #getColumnFactory()
* @see org.jdesktop.swingx.table.ColumnFactory
*/
public void setColumnFactory(ColumnFactory columnFactory) {
/*
*
* TODO auto-configure columns on set? or add public table api to
* do so? Mostly, this is meant to be done once in the lifetime
* of the table, preferably before a model is set ... overshoot?
*
*/
ColumnFactory old = getColumnFactory();
this.columnFactory = columnFactory;
firePropertyChange("columnFactory", old, getColumnFactory());
}
开发者ID:sing-group,项目名称:aibench-project,代码行数:28,代码来源:JXTable.java
注:本文中的org.jdesktop.swingx.table.ColumnFactory类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论