Beispiel #1
0
  @Inject
  public TreeFrameManager(
      final WindowManager windowManager,
      @GlobalConfig final AggregateConfigProvider globalConfig,
      @GlobalConfig final ColourManager colourManager,
      final ActiveFrameManager activeFrameManager,
      final SwingWindowFactory windowFactory,
      @PluginDomain(SwingController.class) final String domain,
      final EventBus eventBus,
      final SwingEventBus swingEventBus,
      final IconManager iconManager) {
    this.windowFactory = windowFactory;
    this.windowManager = windowManager;
    this.nodes = new HashMap<>();
    this.config = globalConfig;
    this.colourManager = colourManager;
    this.activeFrameManager = activeFrameManager;
    this.eventBus = eventBus;
    this.swingEventBus = swingEventBus;
    this.iconManager = iconManager;

    UIUtilities.invokeLater(
        () -> {
          model = new TreeViewModel(config, new TreeViewNode(null, null));
          tree = new Tree(this, model, swingEventBus, globalConfig, domain);
          tree.setCellRenderer(new TreeViewTreeCellRenderer(config, colourManager, this));
          tree.setVisible(true);

          config.addChangeListener("treeview", this);
          config.addChangeListener("ui", "sortrootwindows", this);
          config.addChangeListener("ui", "sortchildwindows", this);
          config.addChangeListener("ui", "backgroundcolour", this);
          config.addChangeListener("ui", "foregroundcolour", this);
        });
  }
Beispiel #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();
  }
Beispiel #3
0
 public void onLoad() {
   config.addChangeListener(domain, this);
   userConfig.setOption(domain, "general.icon", filesHelper.getFilesDirString() + "icon.png");
   setCachedSettings();
   // Extract the files needed
   try {
     filesHelper.extractResourcesEndingWith(".py");
     filesHelper.extractResourcesEndingWith(".png");
   } catch (IOException ex) {
     LOG.warn(
         USER_ERROR,
         "Unable to extract files for Free desktop notifications: {}",
         ex.getMessage(),
         ex);
   }
 }
Beispiel #4
0
 public void onUnLoad() {
   config.removeListener(this);
 }
Beispiel #5
0
 private void setCachedSettings() {
   timeout = config.getOptionInt(domain, "general.timeout");
   icon = config.getOption(domain, "general.icon");
   escapehtml = config.getOptionBool(domain, "advanced.escapehtml");
   stripcodes = config.getOptionBool(domain, "advanced.stripcodes");
 }