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

项目: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);
    }
}
项目:SmartTokens    文件:SourceListTreeUI.java   
@Override
protected AbstractLayoutCache.NodeDimensions createNodeDimensions() {
    return new NodeDimensionsHandler() {
        @Override
        public Rectangle getNodeDimensions(
                Object value, int row, int depth, boolean expanded, Rectangle size) {

            Rectangle dimensions = super.getNodeDimensions(value, row, depth, expanded, size);
            int containerWidth = tree.getParent() instanceof JViewport
                    ? tree.getParent().getWidth() : tree.getWidth();

            dimensions.width = containerWidth - getRowX(row, depth);

            return dimensions;
        }
    };
}
项目:Zettelkasten    文件:MacSourceDesktopTree.java   
@Override
protected AbstractLayoutCache.NodeDimensions createNodeDimensions() {
    return new NodeDimensionsHandler() {
        @Override
        public Rectangle getNodeDimensions(
                Object value, int row, int depth, boolean expanded, Rectangle size) {

            Rectangle dimensions = super.getNodeDimensions(value, row, depth, expanded, size);
            int containerWidth = tree.getParent() instanceof JViewport
                    ? tree.getParent().getWidth() : tree.getWidth();

            dimensions.width = containerWidth - getRowX(row, depth);

            return dimensions;
        }
    };
}
项目:Zettelkasten    文件:MacSourceTree.java   
@Override
protected AbstractLayoutCache.NodeDimensions createNodeDimensions() {
    return new NodeDimensionsHandler() {
        @Override
        public Rectangle getNodeDimensions(
                Object value, int row, int depth, boolean expanded, Rectangle size) {

            Rectangle dimensions = super.getNodeDimensions(value, row, depth, expanded, size);
            int containerWidth = tree.getParent() instanceof JViewport
                    ? tree.getParent().getWidth() : tree.getWidth();

            dimensions.width = containerWidth - getRowX(row, depth);

            return dimensions;
        }
    };
}
项目:incubator-netbeans    文件:NodeRenderDataProvider.java   
public javax.swing.Icon getIcon(Object o) {
    if (!showIcons) {
        return emptyIcon;
    }
    Node n = Visualizer.findNode(o);
    if (n == null) {
        throw new IllegalStateException("TreeNode must be VisualizerNode but was: " + o + " of class " + o.getClass().getName());
    }
    boolean expanded = false;
    if (o instanceof TreeNode) {
        TreeNode tn = (TreeNode)o;
        ArrayList<TreeNode> al = new ArrayList<TreeNode> ();
        while (tn != null) {
            al.add(tn);
            tn = tn.getParent();
        }
        Collections.reverse(al);
        TreePath tp = new TreePath(al.toArray());
        AbstractLayoutCache layout = table.getLayoutCache();
        expanded = layout.isExpanded(tp);
    }
    java.awt.Image image = null;
    if (expanded) {
        image = n.getOpenedIcon(java.beans.BeanInfo.ICON_COLOR_16x16);
    } else {
        image = n.getIcon(java.beans.BeanInfo.ICON_COLOR_16x16);
    }
    return new ImageIcon(image);
}
项目:incubator-netbeans    文件:Outline.java   
/** Get the layout cache which manages layout data for the Outline.
 * <strong>Under no circumstances directly call the methods on the
 * layout cache which change the expanded state - such changes will not
 * be propagated into the table model, and will leave the model and
 * its layout in inconsistent states.  Any calls that affect expanded
 * state must go through <code>getTreePathSupport()</code>.</strong> */
public final AbstractLayoutCache getLayoutCache () {
    OutlineModel mdl = getOutlineModel();
    if (mdl != null) {
        return mdl.getLayout();
    } else {
        return null;
    }
}
项目:incubator-netbeans    文件:Outline.java   
/** Overridden to throw an exception if the passed model is not an instance
 * of <code>OutlineModel</code> (with the exception of calls from the 
 * superclass constructor) */
@Override
public void setModel (TableModel mdl) {
    if (initialized && (!(mdl instanceof OutlineModel))) {
        throw new IllegalArgumentException (
            "Table model for an Outline must be an instance of " +
            "OutlineModel"); //NOI18N
    }
    if (mdl instanceof OutlineModel) {
        AbstractLayoutCache layout = ((OutlineModel) mdl).getLayout();
        if (cachedRootVisible != null) {

            layout.setRootVisible(
                cachedRootVisible.booleanValue());

        }

        layout.setRowHeight(getRowHeight());

        if (((OutlineModel) mdl).isLargeModel()) {
            addComponentListener (getComponentListener());
            layout.setNodeDimensions(new ND());
        } else {
            if (componentListener != null) {
                removeComponentListener (componentListener);
                componentListener = null;
            }
        }
    }

    super.setModel(mdl);
}
项目:taxonaut    文件:LayoutCacheAligner.java   
/**
    * Sets <CODE>aligner</CODE> as the
    * <CODE>AbstractLayoutCache</CODE> to be used
    * to align nodes, or null to disable
    * node alignment
    *
    * @param aligner <CODE>AbstractLayoutCache</CODE> to be
    * used to align nodes, or null to disable node alignment
    */
   public synchronized void setAligner(AbstractLayoutCache aligner)
   {
if(this.aligner == aligner)
    return;

this.aligner = aligner;
if(aligner != null && mapper == null) {
    TreeModel model = aligner.getModel();
    if(model instanceof NodeMapper)
    setMapper((NodeMapper)model);
}
   }
项目:taxonaut    文件:MetalAlignableTreeUI.java   
protected AbstractLayoutCache createLayoutCache()
   {
if(isLargeModel() && getRowHeight() > 0)
    return new AlignableFixedHeightLayoutCache(this);

return new AlignableVariableHeightLayoutCache(this);
   }
项目:taxonaut    文件:WindowsAlignableTreeUI.java   
protected AbstractLayoutCache createLayoutCache()
   {
if(isLargeModel() && getRowHeight() > 0)
    return new AlignableFixedHeightLayoutCache(this);

return new AlignableVariableHeightLayoutCache(this);
   }
项目:taxonaut    文件:MotifAlignableTreeUI.java   
protected AbstractLayoutCache createLayoutCache()
   {
if(isLargeModel() && getRowHeight() > 0)
    return new AlignableFixedHeightLayoutCache(this);

return new AlignableVariableHeightLayoutCache(this);
   }
项目:taxonaut    文件:BasicAlignableTreeUI.java   
protected AbstractLayoutCache createLayoutCache()
   {
if(isLargeModel() && getRowHeight() > 0) {
    return new AlignableFixedHeightLayoutCache(this);
}

return new AlignableVariableHeightLayoutCache(this);
   }
项目:intellij-ce-playground    文件:ColumnTreeBuilder.java   
@Override
protected AbstractLayoutCache.NodeDimensions createNodeDimensions() {
  return new NodeDimensionsHandler() {
    @Override
    public Rectangle getNodeDimensions(Object value, int row, int depth, boolean expanded, Rectangle size) {
      Rectangle dimensions = super.getNodeDimensions(value, row, depth, expanded, size);
      dimensions.width = tree.getWidth() - getRowX(row, depth);
      return dimensions;
    }
  };
}
项目:Stud.IP-Client    文件:TreeCellListRenderer.java   
@Override
protected AbstractLayoutCache.NodeDimensions createNodeDimensions() {
    return new NodeDimensionsHandler() {
        @Override
        public Rectangle getNodeDimensions(Object value, int row, int depth, boolean expanded, Rectangle size) {
            Rectangle dimensions = super.getNodeDimensions(value, row, depth, expanded, size);
            dimensions.width = parent.getWidth() - getRowX(row, depth);
            return dimensions;
        }
    };
}
项目:WOLFGANG    文件:PNPropertiesTreeUI.java   
@Override
/**
 * Creates an instance of NodeDimensions that is able to determine
 * the size of a given node in the tree.
 */
protected AbstractLayoutCache.NodeDimensions createNodeDimensions() {
    return new PNNodeDimensionsHandler();
}
项目:matos-profiles    文件:JClassView.java   
@Override
protected AbstractLayoutCache.NodeDimensions createNodeDimensions() {
  return new NodeDimensionsHandler() {
    @Override
    public Rectangle getNodeDimensions(Object value, int row, int depth, boolean expanded, Rectangle size) {
      Rectangle dimensions = super.getNodeDimensions(value, row, depth, expanded, size);
      Insets insets = tree.getInsets();
      dimensions.width = tree.getWidth() - getRowX(row, depth) - insets.left - insets.right;
      return dimensions;
    }
  };
}
项目:incubator-netbeans    文件:DefaultOutlineModel.java   
@Override
public final AbstractLayoutCache getLayout() {
    return layout;
}
项目:incubator-netbeans    文件:EventBroadcaster.java   
/** Convenience getter for the proxied model's layout cache */
private AbstractLayoutCache getLayout() {
    return getModel().getLayout();
}
项目:incubator-netbeans    文件:TreePathSupport.java   
/** Creates a new instance of TreePathSupport */
public TreePathSupport(OutlineModel mdl, AbstractLayoutCache layout) {
    this.layout = layout;
}
项目:cn1    文件:MetalTreeUI.java   
public AbstractLayoutCache getLayoutCache() {
    return treeState;
}
项目:cn1    文件:BasicTreeUI.java   
public AbstractLayoutCache getLayoutCache() {
    return treeState;
}
项目:cn1    文件:BasicTreeUI.java   
protected AbstractLayoutCache.NodeDimensions createNodeDimensions() {
    return new NodeDimensionsHandler();
}
项目:cn1    文件:BasicTreeUI.java   
protected AbstractLayoutCache createLayoutCache() {
    return rowHeight > 0 && largeModel ? (AbstractLayoutCache)new FixedHeightLayoutCache()
                                       : (AbstractLayoutCache)new VariableHeightLayoutCache();
}
项目:freeVM    文件:MetalTreeUI.java   
public AbstractLayoutCache getLayoutCache() {
    return treeState;
}
项目:freeVM    文件:BasicTreeUI.java   
public AbstractLayoutCache getLayoutCache() {
    return treeState;
}
项目:freeVM    文件:BasicTreeUI.java   
protected AbstractLayoutCache.NodeDimensions createNodeDimensions() {
    return new NodeDimensionsHandler();
}
项目:freeVM    文件:BasicTreeUI.java   
protected AbstractLayoutCache createLayoutCache() {
    return rowHeight > 0 && largeModel ? (AbstractLayoutCache)new FixedHeightLayoutCache()
                                       : (AbstractLayoutCache)new VariableHeightLayoutCache();
}
项目:freeVM    文件:MetalTreeUI.java   
public AbstractLayoutCache getLayoutCache() {
    return treeState;
}
项目:freeVM    文件:BasicTreeUI.java   
public AbstractLayoutCache getLayoutCache() {
    return treeState;
}
项目:freeVM    文件:BasicTreeUI.java   
protected AbstractLayoutCache.NodeDimensions createNodeDimensions() {
    return new NodeDimensionsHandler();
}
项目:freeVM    文件:BasicTreeUI.java   
protected AbstractLayoutCache createLayoutCache() {
    return rowHeight > 0 && largeModel ? (AbstractLayoutCache)new FixedHeightLayoutCache()
                                       : (AbstractLayoutCache)new VariableHeightLayoutCache();
}
项目:taxonaut    文件:LayoutCacheAligner.java   
/**
    * Constrcuts <CODE>LayoutCacheAligner</CODE> with
    * <CODE>ui</CODE>, <CODE>aligner</CODE> and
    * <CODE>mapper</CODE>
    *
    * @param ui <CODE>BasicTreeUI</CODE> to be used
    * to calcurate node position
    * @param aligner <CODE>AbstractLayoutChache</CODE> to be used
    * to calcurate node position
    * @param mapper <CODE>NodeMapper</CODE> to map nodes and paths
    */
   public LayoutCacheAligner(BasicTreeUI ui,
              AbstractLayoutCache aligner,
              NodeMapper mapper)
   {
super();
setUI(ui);
setAligner(aligner);
setMapper(mapper);
   }
项目:incubator-netbeans    文件:OutlineModel.java   
/** Get the layout cache which is used to track the visual state of nodes.
 * This is typically one of the standard JDK layout cache classes, such
 * as <code>VariableHeightLayoutCache</code> or <code>
 * FixedHeightLayoutCache</code>.  */
public AbstractLayoutCache getLayout ();
项目:taxonaut    文件:LayoutCacheAligner.java   
/**
    * Constrcuts <CODE>LayoutCacheAligner</CODE> with
    * <CODE>ui</CODE> and <CODE>aligner</CODE> 
    *
    * @param ui <CODE>BasicTreeUI</CODE> to be used
    * to calcurate node position
    * @param aligner <CODE>AbstractLayoutChache</CODE> to be used
    * to calcurate node position
    */
   public LayoutCacheAligner(BasicTreeUI ui,
              AbstractLayoutCache aligner)
   {
this(ui, aligner, null);
   }
项目:taxonaut    文件:LayoutCacheAligner.java   
/**
    * Returns <CODE>AbstractLayoutCache</CODE> used
    * to align nodes, or null if node alignment is
    * disabled
    *
    * @return <CODE>AbstractLayoutCache</CODE> used
    * to align nodes, or null if node alignment is
    * disabled
    */
   public AbstractLayoutCache getAligner()
   {
return aligner;
   }
项目:javify    文件:BasicTreeUI.java   
/**
 * Creates an instance of NodeDimensions that is able to determine the size of
 * a given node in the tree. The node dimensions must be created before
 * configuring the layout cache.
 *
 * @return the NodeDimensions of a given node in the tree
 */
protected AbstractLayoutCache.NodeDimensions createNodeDimensions()
{
  return new NodeDimensionsHandler();
}
项目:javify    文件:BasicTreeUI.java   
/**
 * Creates the object responsible for managing what is expanded, as well as
 * the size of nodes.
 *
 * @return the object responsible for managing what is expanded.
 */
protected AbstractLayoutCache createLayoutCache()
{
  return new VariableHeightLayoutCache();
}
项目:jvm-stm    文件:BasicTreeUI.java   
/**
 * Creates an instance of NodeDimensions that is able to determine the size of
 * a given node in the tree. The node dimensions must be created before
 * configuring the layout cache.
 * 
 * @return the NodeDimensions of a given node in the tree
 */
protected AbstractLayoutCache.NodeDimensions createNodeDimensions()
{
  return new NodeDimensionsHandler();
}
项目:jvm-stm    文件:BasicTreeUI.java   
/**
 * Creates the object responsible for managing what is expanded, as well as
 * the size of nodes.
 * 
 * @return the object responsible for managing what is expanded.
 */
protected AbstractLayoutCache createLayoutCache()
{
  return new VariableHeightLayoutCache();
}
项目:cn1    文件:TreeCommons.java   
/**
 * @return Layout cache used by the tree UI
 */
AbstractLayoutCache getLayoutCache();