当前位置: 首页>>代码示例>>Java>>正文


Java ExpandableItemsHandler类代码示例

本文整理汇总了Java中com.intellij.ui.ExpandableItemsHandler的典型用法代码示例。如果您正苦于以下问题:Java ExpandableItemsHandler类的具体用法?Java ExpandableItemsHandler怎么用?Java ExpandableItemsHandler使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ExpandableItemsHandler类属于com.intellij.ui包,在下文中一共展示了ExpandableItemsHandler类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: customizeCellRenderer

import com.intellij.ui.ExpandableItemsHandler; //导入依赖的package包/类
@Override
public void customizeCellRenderer(@Nonnull final JTree tree,
                                  final Object value,
                                  final boolean selected,
                                  final boolean expanded,
                                  final boolean leaf,
                                  final int row,
                                  final boolean hasFocus) {
  myHaveLink = false;
  myLink.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus);
  XDebuggerTreeNode node = (XDebuggerTreeNode)value;
  node.appendToComponent(this);
  setIcon(node.getIcon());

  Rectangle treeVisibleRect = tree.getParent() instanceof JViewport ? ((JViewport)tree.getParent()).getViewRect() : tree.getVisibleRect();
  TreePath path = tree.getPathForRow(row);
  int rowX = path != null ? getRowX((BasicTreeUI)tree.getUI(), row, path.getPathCount() - 1) : 0;

  if (myHaveLink) {
    setupLinkDimensions(treeVisibleRect, rowX);
  }
  else {
    int visibleRectRightX = treeVisibleRect.x + treeVisibleRect.width;
    int notFittingWidth = rowX + super.getPreferredSize().width - visibleRectRightX;
    if (node instanceof XValueNodeImpl && notFittingWidth > 0) {
      // text does not fit visible area - show link
      String rawValue = DebuggerUIUtil.getNodeRawValue((XValueNodeImpl)node);
      if (!StringUtil.isEmpty(rawValue) && tree.isShowing()) {
        Point treeRightSideOnScreen = new Point(visibleRectRightX, 0);
        SwingUtilities.convertPointToScreen(treeRightSideOnScreen, tree);
        Rectangle screen = AbstractExpandableItemsHandler.getScreenRectangle(treeRightSideOnScreen);
        // text may fit the screen in ExpandableItemsHandler
        if (screen.x + screen.width < treeRightSideOnScreen.x + notFittingWidth) {
          myLongTextLink.setupComponent(rawValue, ((XDebuggerTree)tree).getProject());
          append(myLongTextLink.getLinkText(), myLongTextLink.getTextAttributes(), myLongTextLink);
          setupLinkDimensions(treeVisibleRect, rowX);
          myLinkWidth = 0;
        }
      }
    }
  }
  putClientProperty(ExpandableItemsHandler.RENDERER_DISABLED, myHaveLink);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:44,代码来源:XDebuggerTreeRenderer.java


注:本文中的com.intellij.ui.ExpandableItemsHandler类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。