Example #1
0
 @Handler(invocation = EdtHandlerInvocation.class, delivery = Invoke.Asynchronously)
 public void unreadStatusChanged(final UnreadStatusChangedEvent event) {
   synchronized (nodes) {
     final TreeViewNode node = nodes.get(windowFactory.getSwingWindow(event.getSource()));
     if (node != null) {
       final NodeLabel label = node.getLabel();
       if (label != null) {
         label.unreadStatusChanged(event);
         tree.repaint();
       }
     }
   }
 }
Example #2
0
  /** Sets treeview colours. */
  private void setColours() {
    tree.setBackground(
        UIUtilities.convertColour(
            colourManager.getColourFromString(
                config.getOptionString("treeview", "backgroundcolour", "ui", "backgroundcolour"),
                null)));
    tree.setForeground(
        UIUtilities.convertColour(
            colourManager.getColourFromString(
                config.getOptionString("treeview", "foregroundcolour", "ui", "foregroundcolour"),
                null)));

    tree.repaint();
  }
Example #3
0
  /**
   * Checks for and sets a rollover node.
   *
   * @param event event to check
   */
  protected void checkRollover(final MouseEvent event) {
    NodeLabel node = null;

    if (event != null && tree.getNodeForLocation(event.getX(), event.getY()) != null) {
      node = tree.getNodeForLocation(event.getX(), event.getY()).getLabel();
    }

    synchronized (nodes) {
      for (TreeViewNode treeNode : nodes.values()) {
        final NodeLabel label = treeNode.getLabel();
        label.setRollover(label == node);
      }
    }
    tree.repaint();
  }
Example #4
0
 @Handler(invocation = EdtHandlerInvocation.class)
 public void selectionChanged(final SwingWindowSelectedEvent event) {
   if (event.getWindow().isPresent()) {
     UIUtilities.invokeLater(
         () -> {
           final TreeNode[] treePath =
               ((DefaultTreeModel) tree.getModel())
                   .getPathToRoot(nodes.get(event.getWindow().get()));
           if (treePath != null && treePath.length > 0) {
             final TreePath path = new TreePath(treePath);
             tree.setTreePath(path);
             tree.scrollPathToVisible(path);
             tree.repaint();
           }
         });
   }
 }