示例#1
0
 @Nullable
 public static Object getTagAtForRenderer(
     CheckboxTree.CheckboxTreeCellRenderer renderer, MouseEvent e) {
   JTree tree = (JTree) e.getSource();
   Object tag = null;
   final TreePath path = tree.getPathForLocation(e.getX(), e.getY());
   if (path != null) {
     final Rectangle rectangle = tree.getPathBounds(path);
     assert rectangle != null;
     int dx = e.getX() - rectangle.x;
     final TreeNode treeNode = (TreeNode) path.getLastPathComponent();
     final int row = tree.getRowForLocation(e.getX(), e.getY());
     tree.getCellRenderer()
         .getTreeCellRendererComponent(tree, treeNode, false, false, true, row, true);
     if (treeNode instanceof RepositoryNode) {
       RepositoryNode repositoryNode = (RepositoryNode) treeNode;
       int checkBoxWidth =
           repositoryNode.isCheckboxVisible() ? renderer.getCheckbox().getWidth() : 0;
       tag = renderer.getTextRenderer().getFragmentTagAt(dx - checkBoxWidth);
     } else {
       tag = renderer.getTextRenderer().getFragmentTagAt(dx);
     }
   }
   return tag;
 }
  public URL getQueryUrl() throws Exception {
    RepositoryNode repositoryNode = new RepositoryNode(this.workspace.getRepository());
    StringBuilder url = new StringBuilder(repositoryNode.getUrl().toString());

    // add workspace path
    url.append('/')
        .append(JsonUtils.encode(workspace.getName()))
        .append(IJsonConstants.QUERY_CONTEXT);
    return new URL(url.toString());
  }
 void doSizeCalc(RepositoryNode node) {
   node.getTreeContentSize(null, true);
   if (node instanceof AuNodeImpl) {
     ((AuNodeImpl) node).getDiskUsage(true);
   }
 }
 public void deactivateNode(String url) throws MalformedURLException {
   RepositoryNode node = getNode(url, false);
   if (node != null) {
     node.deactivateContent();
   }
 }
 public void deleteNode(String url) throws MalformedURLException {
   RepositoryNode node = getNode(url, false);
   if (node != null) {
     node.markAsDeleted();
   }
 }