use of edu.cmu.tetradapp.app.hpc.task.PendingHpcJobUpdaterTask in project tetrad by cmu-phil.
the class HpcJobActivityEditor method buildActivityContent.
private void buildActivityContent(final JPanel activityPanel, final TetradDesktop desktop) throws Exception {
jobsTable = new JTable();
jobsTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
final JScrollPane scrollTablePane = new JScrollPane(jobsTable);
tabbedPane = new JTabbedPane();
final JPanel activeJobsPanel = new JPanel(new BorderLayout());
activeJobsPanel.add(scrollTablePane, BorderLayout.CENTER);
tabbedPane.add("Active Jobs", activeJobsPanel);
final KillHpcJobAction killJobAction = new KillHpcJobAction(this);
final JPanel finishedJobsPanel = new JPanel(new BorderLayout());
tabbedPane.add("Finished Jobs", finishedJobsPanel);
final DeleteHpcJobInfoAction deleteJobAction = new DeleteHpcJobInfoAction(this);
ChangeListener changeListener = new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
JTabbedPane sourceTabbedPane = (JTabbedPane) e.getSource();
int index = sourceTabbedPane.getSelectedIndex();
if (index == 0) {
finishedJobsPanel.remove(scrollTablePane);
activeJobsPanel.add(scrollTablePane, BorderLayout.CENTER);
try {
final Vector<String> activeColumnNames = genActiveJobColumnNames();
final Vector<Vector<String>> activeRowData = getActiveRowData(desktop, checkedHpcAccountList);
final DefaultTableModel activeJobTableModel = new HpcJobInfoTableModel(activeRowData, activeColumnNames, KILL_BUTTON_COLUMN);
jobsTable.setModel(activeJobTableModel);
if (activeRowData.size() > 0) {
new ButtonColumn(jobsTable, killJobAction, KILL_BUTTON_COLUMN);
}
adjustActiveJobsWidthColumns(jobsTable);
jobsTable.updateUI();
} catch (Exception e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
} else if (index == 1) {
activeJobsPanel.remove(scrollTablePane);
finishedJobsPanel.add(scrollTablePane, BorderLayout.CENTER);
try {
final Vector<String> finishedColumnNames = genFinishedJobColumnNames();
final Vector<Vector<String>> finishedRowData = getFinishedRowData(desktop, checkedHpcAccountList);
final DefaultTableModel finishedJobTableModel = new HpcJobInfoTableModel(finishedRowData, finishedColumnNames, DELETE_BUTTON_COLUMN);
jobsTable.setModel(finishedJobTableModel);
if (finishedRowData.size() > 0) {
new ButtonColumn(jobsTable, deleteJobAction, DELETE_BUTTON_COLUMN);
}
adjustFinishedJobsWidthColumns(jobsTable);
jobsTable.updateUI();
} catch (Exception e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
}
};
tabbedPane.addChangeListener(changeListener);
activityPanel.add(tabbedPane, BorderLayout.CENTER);
final HpcJobManager hpcJobManager = desktop.getHpcJobManager();
// Start active job updater
pendingJobUpdater = new PendingHpcJobUpdaterTask(hpcJobManager, this);
submittedJobUpdater = new SubmittedHpcJobUpdaterTask(hpcJobManager, this);
tabbedPane.setSelectedIndex(-1);
tabbedPane.setSelectedIndex(0);
startUpdaters();
}
Aggregations