Exemple #1
0
  /**
   * Adds a window to the frame container.
   *
   * @param parent Parent node
   * @param window Window to add
   */
  public void addWindow(final MutableTreeNode parent, final TextFrame window) {
    UIUtilities.invokeAndWait(
        () -> {
          final NodeLabel label = new NodeLabel(window, iconManager);
          eventBus.subscribe(label);
          swingEventBus.subscribe(label);
          final TreeViewNode node = new TreeViewNode(label, window);
          synchronized (nodes) {
            nodes.put(window, node);
          }
          if (parent == null) {
            model.insertNodeInto(node, model.getRootNode());
          } else {
            model.insertNodeInto(node, parent);
          }
          tree.expandPath(new TreePath(node.getPath()).getParentPath());
          final Rectangle view =
              tree.getRowBounds(tree.getRowForPath(new TreePath(node.getPath())));
          if (view != null) {
            tree.scrollRectToVisible(new Rectangle(0, (int) view.getY(), 0, 0));
          }

          node.getLabel()
              .unreadStatusChanged(
                  new UnreadStatusChangedEvent(
                      window.getContainer(),
                      window.getContainer().getUnreadStatusManager(),
                      window.getContainer().getUnreadStatusManager().getNotificationColour(),
                      window.getContainer().getUnreadStatusManager().getUnreadLines()));
          node.getLabel()
              .iconChanged(
                  new FrameIconChangedEvent(
                      window.getContainer(), window.getContainer().getIcon()));
        });
  }
Exemple #2
0
  @Override
  public void setParent(final JComponent parent) {
    SwingUtilities.invokeLater(
        () -> {
          final JScrollPane scrollPane = new JScrollPane(tree);
          scrollPane.setAutoscrolls(true);
          scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);

          parent.setVisible(false);
          parent.setLayout(new MigLayout("ins 0, fill"));
          parent.add(scrollPane, "grow");
          parent.setFocusable(false);
          parent.setVisible(true);

          setColours();

          eventBus.subscribe(this);
          swingEventBus.subscribe(this);
          redoTreeView();
        });
  }
 /** Initialises the error manager. Must be called before logging will start. */
 public void initialise() {
   eventBus.subscribe(this);
 }