Java Reference
In-Depth Information
12.
// do nothing
13.
}
14.
return lDescription;
15.
case 2:
16.
return mModelConnection.
17.
getCreationDate(lMiningObject, mModelNamedObject);
18.
default:
19.
throw new IllegalArgumentException("Bad Column Index");
20.
}
21.
} catch (JDMException lExce) {
22.
JOptionPane.showMessageDialog(null,
23.
"JDMException Occured: "
24.
lExce.getMessage());
25.
return null;
26.
}
27.
}
To retrieve task duration and status, we provide a specific TaskTa-
bleModel class that inherits from the MiningObjectsTableModel and
retrieves the duration and status by extending the getValueAt method
shown here:
1.
public Object getValueAt(int iRowIndex, int iColumnIndex) {
2.
if (iColumnIndex < super.getColumnCount()) {
3.
return super.getValueAt(iRowIndex, iColumnIndex);
4.
}
5.
int lColumn iColumnIndex super.getColumnCount();
6.
try {
7.
Task lTask mTaskArray[iRowIndex];
8.
ExecutionHandle lExecutionHandle lTask.getExecutionHandle();
9.
switch (lColumn) {
10.
case 0:
11.
return lExecutionHandle.getDurationInSeconds();
12.
case 1:
13.
return lExecutionHandle.getLatestStatus().getState().name();
14.
default:
15.
throw new IllegalArgumentException(
16.
"BadColumn Number: " iColumnIndex);
17.
}
18.
} catch (JDMException lException) {
19.
JOptionPane.showMessageDialog(null,
20.
"JDMException Occured: " lExce.getMessage());
21.
return "JDMException Occured";
22.
}
This code will work even if we later add new columns to the
parent class.
Search WWH ::




Custom Search