org.netbeans.swing.outline.Outline.getLayoutCache()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(7.0k)|赞(0)|评价(0)|浏览(103)

本文整理了Java中org.netbeans.swing.outline.Outline.getLayoutCache()方法的一些代码示例,展示了Outline.getLayoutCache()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Outline.getLayoutCache()方法的具体详情如下:
包路径:org.netbeans.swing.outline.Outline
类名称:Outline
方法名:getLayoutCache

Outline.getLayoutCache介绍

[英]Get the layout cache which manages layout data for the Outline. 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 getTreePathSupport().
[中]获取布局缓存,该缓存管理大纲的布局数据。在任何情况下,都不能直接调用布局缓存上更改扩展状态的方法——此类更改不会传播到表模型中,并且会使模型及其布局处于不一致的状态。任何影响扩展状态的呼叫都必须通过getTreePathSupport()

代码示例

代码示例来源:origin: in.jlibs/org-netbeans-swing-outline

/** Is the tree root visible.  Default value is true. */
public boolean isRootVisible() {
  if (getLayoutCache() == null) {
    return cachedRootVisible != null ? 
      cachedRootVisible.booleanValue() : true;
  } else {
    return getLayoutCache().isRootVisible();
  }
}

代码示例来源:origin: in.jlibs/org-netbeans-swing-outline

/** Overridden to pass the fixed row height to the tree layout cache */
@Override
public void setRowHeight(int val) {
  super.setRowHeight(val);
  if (getLayoutCache() != null) {
    getLayoutCache().setRowHeight(val);
  }
}

代码示例来源:origin: in.jlibs/org-netbeans-swing-outline

public TreePath getClosestPathForLocation(int x, int y) {
  Insets i = getInsets();
  if (i != null) {
    return getLayoutCache().getPathClosestTo(x - i.left, y - i.top);
  } else {
    return getLayoutCache().getPathClosestTo(x,y);
  }
}

代码示例来源:origin: org.netbeans.api/org-openide-explorer

private int rowForNode(Node n) {
  TreeNode tn = Visualizer.findVisualizer(n);
  if (tn != null) {
    ArrayList<TreeNode> al = new ArrayList<TreeNode> ();
    while (tn != null) {
      al.add(tn);
      tn = tn.getParent();
    }
    Collections.reverse(al);
    TreePath tp = new TreePath(al.toArray());
    int row = outline.getLayoutCache().getRowForPath(tp);
    return row;
  }
  return -1;
}

代码示例来源:origin: in.jlibs/org-netbeans-swing-outline

public Rectangle getPathBounds(TreePath path) {
  Insets i = getInsets();
  Rectangle bounds = getLayoutCache().getBounds(path, null);
  if(bounds != null && i != null) {
    bounds.x += i.left;
    bounds.y += i.top;
  }
  return bounds;
}

代码示例来源:origin: org.netbeans.api/org-openide-explorer

public Node nodeForRow(int row) {
  int r = outline.convertRowIndexToModel(row);
  TreePath tp = outline.getLayoutCache().getPathForRow(r);
  return Visualizer.findNode(tp.getLastPathComponent());
}
public String getShortDescription(int column) {

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-dlight-visualizers

@Override
public Node nodeForRow(int row) {
  int r = outline.convertRowIndexToModel(row);
  TreePath tp = outline.getLayoutCache().getPathForRow(r);
  return Visualizer.findNode(tp.getLastPathComponent());
}

代码示例来源:origin: org.netbeans.api/org-openide-explorer

public javax.swing.Icon getIcon(Object o) {
  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);
}

代码示例来源:origin: in.jlibs/org-netbeans-swing-outline

/** Set whether or not the root is visible */
public void setRootVisible (boolean val) {
  if (getOutlineModel() == null) {
    cachedRootVisible = val ? Boolean.TRUE : Boolean.FALSE;
  }
  if (val != isRootVisible()) {
    //TODO - need to force a property change on the model,
    //the layout cache doesn't have direct listener support
    getLayoutCache().setRootVisible(val);
    firePropertyChange("rootVisible", !val, val); //NOI18N
  }
}

代码示例来源:origin: in.jlibs/org-netbeans-swing-outline

protected void configureTreeCellEditor( Component editor, int row, int column ) {
  if( !(editor instanceof JComponent) ) {
    return;
  }
  TreeCellEditorBorder b = new TreeCellEditorBorder();
  TreePath path = getLayoutCache().getPathForRow(convertRowIndexToModel(row));
  Object o = getValueAt(row, column);
  RenderDataProvider rdp = getRenderDataProvider();
  b.icon = rdp.getIcon(o);
  b.nestingDepth = Math.max( 0, path.getPathCount() - (isRootVisible() ? 1 : 2) );
  b.isLeaf = getOutlineModel().isLeaf(o);
  b.isExpanded = getLayoutCache().isExpanded(path);
  
  ((JComponent)editor).setBorder(b);
}

代码示例来源:origin: in.jlibs/org-netbeans-swing-outline

public void actionPerformed(ActionEvent e) {
    if( getSelectedRowCount() == 1 && isTreeColumnIndex (getSelectedColumn()) ) {
      int selRow = getSelectedRow();
      TreePath selPath = getLayoutCache().getPathForRow(selRow);
      if( null != selPath 
          && !getOutlineModel().isLeaf(selPath.getLastPathComponent()) ) {
        boolean expanded = getLayoutCache().isExpanded(selPath);
        if( expanded && !expand ) {
          collapsePath(selPath);
          return;
        } else if( !expanded && expand ) {
          expandPath(selPath);
          return;
        }
      }
    }
    if( null != origAction )
      origAction.actionPerformed(e);
  }
}

代码示例来源:origin: in.jlibs/org-netbeans-swing-outline

return 0;
TreePath tp1 = getLayoutCache().getPathForRow(index1);
TreePath tp2 = getLayoutCache().getPathForRow(index2);
if (tp1.isDescendant(tp2)) {
  return -1;
  parent2 = tp2.getParentPath();
int r1 = getLayoutCache().getRowForPath(tp1);
int r2 = getLayoutCache().getRowForPath(tp2);

代码示例来源:origin: in.jlibs/org-netbeans-swing-outline

TreePath path = getLayoutCache().getPathForRow(convertRowIndexToModel(row));
if (!getOutlineModel().isLeaf(path.getLastPathComponent())) {
  int handleWidth = DefaultOutlineCellRenderer.getExpansionHandleWidth();
     me.getClickCount() > 1) {
    boolean expanded = getLayoutCache().isExpanded(path);
    if (!expanded) {
      getTreePathSupport().expandPath(path);
        Object lastChild = getOutlineModel().getChild(ourObject, cCount - 1);
        TreePath lastChildPath = path.pathByAddingChild(lastChild);
        int lastRow = getLayoutCache().getRowForPath(lastChildPath);
        Rectangle rect = getCellRect(lastRow, 0, true);
        scrollRectToVisible(rect);

代码示例来源:origin: org.netbeans.api/org-openide-explorer

TreePath tp = view.getOutline().getLayoutCache().getPathForRow(
        view.getOutline().convertRowIndexToModel(row));
    if (LOGABLE) {
      log("tp == " + tp); //NOI18N
    if (!view.getOutline().getLayoutCache().isExpanded(tp)) {
      log("tree path is not expanded"); // NOI18N
  TreePath path = view.getOutline().getLayoutCache().getPathForRow(
      view.getOutline().convertRowIndexToModel(row));
  if( null != path ) {
    TreePath parentPath = path.getParentPath();
    if( null != parentPath ) {
      int parentRow = view.getOutline().getLayoutCache().getRowForPath(parentPath);
      dropIndex = row-parentRow;
final TreePath path = view.getOutline().getLayoutCache().getPathForRow(
    view.getOutline().convertRowIndexToModel(row));
boolean expanded = view.getOutline().getLayoutCache().isExpanded(path);
if (
  ((timer == null) || !timer.isRunning()) && (dropNode != null) && !dropNode.isLeaf()

代码示例来源:origin: in.jlibs/org-netbeans-swing-outline

Outline tbl = (Outline) table;
if (tbl.isTreeColumnIndex(column)) {
  AbstractLayoutCache layout = tbl.getLayoutCache();
  row = tbl.convertRowIndexToModel(row);
  boolean leaf = tbl.getOutlineModel().isLeaf(value);

相关文章