Java 类javax.swing.tree.FixedHeightLayoutCache 实例源码

项目:incubator-netbeans    文件:DefaultOutlineModel.java   
/** 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);
    }
}
项目:cn1    文件:BasicTreeUITest.java   
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);
}
项目:freeVM    文件:BasicTreeUITest.java   
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);
}
项目:freeVM    文件:BasicTreeUITest.java   
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);
}
项目:incubator-netbeans    文件:DebugTreeView.java   
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) {}
    }
}
项目:incubator-netbeans    文件:DefaultOutlineModel.java   
@Override
public boolean isLargeModel() {
    return layout instanceof FixedHeightLayoutCache;
}
项目:cn1    文件:BasicTreeUI.java   
protected AbstractLayoutCache createLayoutCache() {
    return rowHeight > 0 && largeModel ? (AbstractLayoutCache)new FixedHeightLayoutCache()
                                       : (AbstractLayoutCache)new VariableHeightLayoutCache();
}
项目:freeVM    文件:BasicTreeUI.java   
protected AbstractLayoutCache createLayoutCache() {
    return rowHeight > 0 && largeModel ? (AbstractLayoutCache)new FixedHeightLayoutCache()
                                       : (AbstractLayoutCache)new VariableHeightLayoutCache();
}
项目:freeVM    文件:BasicTreeUI.java   
protected AbstractLayoutCache createLayoutCache() {
    return rowHeight > 0 && largeModel ? (AbstractLayoutCache)new FixedHeightLayoutCache()
                                       : (AbstractLayoutCache)new VariableHeightLayoutCache();
}