public int getDownloadTaskNumber() { int i = 0; for (ExplorerTask explorerTask : tasks) { if (explorerTask.isSubTask()) { i++; } } return i; }
public boolean addTask(ExplorerTask task) { boolean update = false; if (task != null && !tasks.contains(task)) { tasks.add(task); if (task.isSubTask()) { if (getComponentZOrder(globalDownloadTask) == -1) { this.add(globalDownloadTask); update = true; } globalDownloadTask.setMessage(task.getMessage()); } else { JPanel taskPanel = new LoadingTaskPanel(task); this.add(taskPanel); update = true; } } return update; }
public boolean removeTask(ExplorerTask task) { boolean update = false; if (task != null) { tasks.remove(task); if (task.isSubTask()) { if (getDownloadTaskNumber() == 0) { this.remove(globalDownloadTask); update = true; } } else { for (Component c : getComponents()) { if (c instanceof LoadingTaskPanel && task.equals(((LoadingTaskPanel) c).getTask())) { remove(c); update = true; } } } } return update; }