Exemple #1
0
  /**
   * creates an explorer view
   *
   * @param tree
   */
  public DefaultExplorerView(TreeNode tn) {
    super(new BorderLayout());
    this.setOpaque(false);
    this.setBorder(BorderFactory.createEmptyBorder());

    this.scrlpn.setBorder(BorderFactory.createEmptyBorder());
    this.scrlpn.setOpaque(false);
    this.scrlpn.getViewport().setOpaque(false);

    this.content.setOpaque(true);
    this.content.setBackground(new Color(0, 0, 0, 0));
    this.content.setBorder(BorderFactory.createEmptyBorder(FADE, 0, 0, 0));
    this.content.add(this.scrlpn, BorderLayout.CENTER);

    this.add(this.toolBar, BorderLayout.NORTH);
    this.add(this.content, BorderLayout.CENTER);

    final ExplorerNode<?> explorernodeRoot = ExplorerController.newExplorerTree(tn);
    this.tree = new JTree(explorernodeRoot, true);

    this.tree.putClientProperty("JTree.lineStyle", "Angled");
    this.tree.setBorder(BorderFactory.createEmptyBorder(0, 5, 5, 5));
    this.tree.setBackground(Color.WHITE);
    this.tree.setRootVisible(true);
    this.tree.setShowsRootHandles(true);

    // enable drag:
    this.tree.setDragEnabled(true);
    this.tree.setTransferHandler(new DefaultTransferHandler(Main.getInstance().getMainFrame()));

    // don't expand on double click:
    this.tree.setToggleClickCount(0);

    this.tree.addKeyListener(new DefaultKeyListener(tree));
    this.tree.addMouseListener(new DefaultMouseListener(tree));

    // enable tool tips:
    ToolTipManager.sharedInstance().registerComponent(this.tree);

    this.tree.setCellRenderer(new ExplorerNodeRenderer());
    this.tree.addTreeWillExpandListener(new DefaultTreeWillExpandListener(tree));

    this.scrlpn.getViewport().add(tree, null);
  }
Exemple #2
0
 /**
  * command: show the details of the leased object represented by the given explorernode
  *
  * @param tree
  * @param loexplorernode
  */
 private void cmdShowDetails(JTree tree, final RuleExplorerNode explorerNode) {
   RuleNode ruleNode = (RuleNode) explorerNode.getTreeNode();
   RuleVO rulevo = ruleNode.getRuleVo();
   if (rulevo != null) {
     final CollectControllerFactorySingleton factory =
         CollectControllerFactorySingleton.getInstance();
     if (ruleNode.isTimeLimitRule) {
       TimelimitRuleCollectController ctl = factory.newTimelimitRuleCollectController(null);
       try {
         ctl.runViewSingleCollectableWithId(rulevo.getId());
       } catch (CommonBusinessException e) {
         Errors.getInstance().showExceptionDialog(Main.getInstance().getMainFrame(), e);
       }
     } else {
       RuleCollectController ctl = factory.newRuleCollectController(null);
       ctl.runViewSingleCollectable(new CollectableRule(rulevo));
     }
   }
 }