Exemplo n.º 1
0
  public FileTableTabs(
      MainFrame mainFrame, FolderPanel folderPanel, ConfFileTableTab[] initialTabs) {
    super(
        new FileTableTabsWithoutHeadersViewerFactory(folderPanel),
        new FileTableTabsWithHeadersViewerFactory(mainFrame, folderPanel));

    this.folderPanel = folderPanel;

    defaultTabsFactory = new DefaultFileTableTabFactory(folderPanel);
    clonedTabsFactory = new ClonedFileTableTabFactory(folderPanel);

    // Register to location change events
    folderPanel.getLocationManager().addLocationListener(this);

    // Add the initial folders
    for (FileTableTab tab : initialTabs) addTab(clonedTabsFactory.createTab(tab));
  }
  public FolderChangeMonitor(FolderPanel folderPanel) {
    this.folderPanel = folderPanel;

    // Listen to folder changes to know when a folder is being / has been changed
    folderPanel.getLocationManager().addLocationListener(this);

    this.currentFolder = folderPanel.getCurrentFolder();
    this.currentFolderDate = currentFolder.getDate();

    // Folder contents is up-to-date let's wait before checking it for changes
    this.lastCheckTimestamp = System.currentTimeMillis();
    this.waitBeforeCheckTime = waitAfterRefresh;

    folderPanel.getMainFrame().addWindowListener(this);

    instances.add(this);

    // create and start the monitor thread on first FolderChangeMonitor instance
    if (monitorThread == null && checkPeriod >= 0) {
      monitorThread = new Thread(this, getClass().getName());
      monitorThread.setDaemon(true);
      monitorThread.start();
    }
  }