/** Creates a new instance of DefaultOutlineModel. <strong><b>Note</b>
* Do not fire table structure changes from the wrapped TableModel (value
* changes are okay). Changes that affect the number of rows must come
* from the TreeModel.
* @param treeModel The tree model
* @param tableModel The table model
* @param largeModel <code>true</code> if it's a large model tree, <code>false</code> otherwise.
* @param nodesColumnLabel Label of the node's column
*/
protected DefaultOutlineModel(TreeModel treeModel, TableModel tableModel, boolean largeModel, String nodesColumnLabel) {
this.treeModel = treeModel;
this.tableModel = tableModel;
if (nodesColumnLabel != null) {
this.nodesColumnLabel = nodesColumnLabel;
}
layout = largeModel ? (AbstractLayoutCache) new FixedHeightLayoutCache()
: (AbstractLayoutCache) new VariableHeightLayoutCache();
broadcaster = new EventBroadcaster (this);
layout.setRootVisible(true);
layout.setModel(this);
treePathSupport = new TreePathSupport(this, layout);
treePathSupport.addTreeExpansionListener(broadcaster);
treePathSupport.addTreeWillExpandListener(broadcaster);
treeModel.addTreeModelListener(broadcaster);
tableModel.addTableModelListener(broadcaster);
if (tableModel instanceof ProxyTableModel) {
((ProxyTableModel) tableModel).setOutlineModel(this);
}
}
java类javax.swing.tree.FixedHeightLayoutCache的实例源码
DefaultOutlineModel.java 文件源码
项目:incubator-netbeans
阅读 22
收藏 0
点赞 0
评论 0
BasicTreeUITest.java 文件源码
项目:cn1
阅读 25
收藏 0
点赞 0
评论 0
public void testCreateLayoutCache() {
tree.setRowHeight(0);
assertNotNull(ui.createLayoutCache());
assertNotSame(ui.createLayoutCache(), ui.createLayoutCache());
assertTrue(ui.createLayoutCache() instanceof VariableHeightLayoutCache);
assertTrue(ui.treeState instanceof VariableHeightLayoutCache);
tree.setRowHeight(10);
assertTrue(ui.createLayoutCache() instanceof VariableHeightLayoutCache);
assertTrue(ui.treeState instanceof VariableHeightLayoutCache);
tree.setRowHeight(0);
tree.setLargeModel(true);
assertTrue(ui.createLayoutCache() instanceof VariableHeightLayoutCache);
assertTrue(ui.treeState instanceof VariableHeightLayoutCache);
tree.setRowHeight(10);
assertTrue(ui.createLayoutCache() instanceof FixedHeightLayoutCache);
assertTrue(ui.treeState instanceof FixedHeightLayoutCache);
}
BasicTreeUITest.java 文件源码
项目:freeVM
阅读 22
收藏 0
点赞 0
评论 0
public void testCreateLayoutCache() {
tree.setRowHeight(0);
assertNotNull(ui.createLayoutCache());
assertNotSame(ui.createLayoutCache(), ui.createLayoutCache());
assertTrue(ui.createLayoutCache() instanceof VariableHeightLayoutCache);
assertTrue(ui.treeState instanceof VariableHeightLayoutCache);
tree.setRowHeight(10);
assertTrue(ui.createLayoutCache() instanceof VariableHeightLayoutCache);
assertTrue(ui.treeState instanceof VariableHeightLayoutCache);
tree.setRowHeight(0);
tree.setLargeModel(true);
assertTrue(ui.createLayoutCache() instanceof VariableHeightLayoutCache);
assertTrue(ui.treeState instanceof VariableHeightLayoutCache);
tree.setRowHeight(10);
assertTrue(ui.createLayoutCache() instanceof FixedHeightLayoutCache);
assertTrue(ui.treeState instanceof FixedHeightLayoutCache);
}
BasicTreeUITest.java 文件源码
项目:freeVM
阅读 25
收藏 0
点赞 0
评论 0
public void testCreateLayoutCache() {
tree.setRowHeight(0);
assertNotNull(ui.createLayoutCache());
assertNotSame(ui.createLayoutCache(), ui.createLayoutCache());
assertTrue(ui.createLayoutCache() instanceof VariableHeightLayoutCache);
assertTrue(ui.treeState instanceof VariableHeightLayoutCache);
tree.setRowHeight(10);
assertTrue(ui.createLayoutCache() instanceof VariableHeightLayoutCache);
assertTrue(ui.treeState instanceof VariableHeightLayoutCache);
tree.setRowHeight(0);
tree.setLargeModel(true);
assertTrue(ui.createLayoutCache() instanceof VariableHeightLayoutCache);
assertTrue(ui.treeState instanceof VariableHeightLayoutCache);
tree.setRowHeight(10);
assertTrue(ui.createLayoutCache() instanceof FixedHeightLayoutCache);
assertTrue(ui.treeState instanceof FixedHeightLayoutCache);
}
DebugTreeView.java 文件源码
项目:incubator-netbeans
阅读 21
收藏 0
点赞 0
评论 0
private static void clearSelectionCache(RowMapper rm) {
if (rm instanceof FixedHeightLayoutCache) {
try {
Field infoField = rm.getClass().getDeclaredField("info");
infoField.setAccessible(true);
Object searchInfo = infoField.get(rm);
if (searchInfo != null) {
Field nodeField = searchInfo.getClass().getDeclaredField("node");
nodeField.setAccessible(true);
nodeField.set(searchInfo, null);
}
} catch (Exception ex) {}
}
}
DefaultOutlineModel.java 文件源码
项目:incubator-netbeans
阅读 20
收藏 0
点赞 0
评论 0
@Override
public boolean isLargeModel() {
return layout instanceof FixedHeightLayoutCache;
}
BasicTreeUI.java 文件源码
项目:cn1
阅读 22
收藏 0
点赞 0
评论 0
protected AbstractLayoutCache createLayoutCache() {
return rowHeight > 0 && largeModel ? (AbstractLayoutCache)new FixedHeightLayoutCache()
: (AbstractLayoutCache)new VariableHeightLayoutCache();
}
BasicTreeUI.java 文件源码
项目:freeVM
阅读 23
收藏 0
点赞 0
评论 0
protected AbstractLayoutCache createLayoutCache() {
return rowHeight > 0 && largeModel ? (AbstractLayoutCache)new FixedHeightLayoutCache()
: (AbstractLayoutCache)new VariableHeightLayoutCache();
}
BasicTreeUI.java 文件源码
项目:freeVM
阅读 29
收藏 0
点赞 0
评论 0
protected AbstractLayoutCache createLayoutCache() {
return rowHeight > 0 && largeModel ? (AbstractLayoutCache)new FixedHeightLayoutCache()
: (AbstractLayoutCache)new VariableHeightLayoutCache();
}