use of net.sourceforge.processdash.data.SimpleData in project processdash by dtuma.
the class ResultSet method format.
/** Format an object from the result set for display.
* Data rows and columns are numbered starting with 1 and ending with
* numRows() or numCols(), respectively. Row 0 and column 0 contain
* header information. Null values in the ResultSet will be formatted as
* the empty string. */
public String format(int row, int col) {
// row and column headers are strings
if (row == 0)
return getColName(col);
if (col == 0)
return getRowName(row);
SimpleData d = getData(row, col);
if (d == null || !d.isDefined())
return "";
String result = d.format();
if (result.startsWith("#") || result.startsWith("ERR"))
return result;
int fmt = useRowFormats ? row : col;
return prefix[fmt] + result + suffix[fmt];
}
use of net.sourceforge.processdash.data.SimpleData in project processdash by dtuma.
the class HierarchicalCompletionStatusCalculator method handleEvent.
private boolean handleEvent(DataEvent e) {
String dataName = e.getName();
if (dataName.endsWith(COMPLETED)) {
String path = dataName.substring(0, dataName.length() - COMPLETED.length());
SimpleData dataValue = e.getValue();
Date newValue = null;
if (dataValue instanceof DateData && dataValue.test())
newValue = ((DateData) dataValue).getValue();
Date oldValue = statusIn.put(path, newValue);
if (NullSafeObjectUtils.EQ(oldValue, newValue) == false)
return true;
}
return false;
}
use of net.sourceforge.processdash.data.SimpleData in project processdash by dtuma.
the class EditSubprojectList method getSimpleValue.
/** Get a value from the data repository. */
protected SimpleData getSimpleValue(String name) {
DataRepository data = getDataRepository();
String prefix = getPrefix();
if (prefix == null)
prefix = "";
String dataName = DataRepository.createDataName(prefix, name);
SimpleData d = data.getSimpleValue(dataName);
return d;
}
use of net.sourceforge.processdash.data.SimpleData in project processdash by dtuma.
the class EditSubprojectList method updateEVSchedule.
private void updateEVSchedule(Map subprojects) {
String teamScheduleName = getValue("Project_Schedule_Name");
logger.log(Level.FINE, "Master project {0} updating master schedule \"{1}\"", new Object[] { getPrefix(), teamScheduleName });
// open the master schedule
EVTaskList schedule = EVTaskList.openExisting(teamScheduleName, getDataRepository(), getPSPProperties(), getObjectCache(), false);
if (!(schedule instanceof EVTaskListRollup)) {
logger.log(Level.WARNING, "could not find a rollup schedule named \"{0}\"", teamScheduleName);
return;
}
// empty all the children from the current master schedule.
EVTaskListRollup master = (EVTaskListRollup) schedule;
for (int i = master.getChildCount(master.getRoot()); i-- > 0; ) {
EVTask task = (EVTask) master.getChild(master.getRoot(), i);
master.removeTask(new TreePath(task.getPath()));
}
// now add the schedules of all the subprojects.
for (Iterator i = subprojects.values().iterator(); i.hasNext(); ) {
Subproject proj = (Subproject) i.next();
String dataName = DataRepository.createDataName(proj.path, "Project_Schedule_Name");
SimpleData d = getDataRepository().getSimpleValue(dataName);
if (d == null) {
logger.warning("Could not find schedule for subproject " + proj.path);
continue;
}
String subscheduleName = d.format();
if (!master.addTask(subscheduleName, getDataRepository(), getPSPProperties(), getObjectCache(), false)) {
logger.warning("Could not add schedule for subproject " + proj.path);
}
}
master.save();
logger.fine("saved changed task list");
}
use of net.sourceforge.processdash.data.SimpleData in project processdash by dtuma.
the class PercentSpentIndicator method showEditEstimateDialog.
private void showEditEstimateDialog() {
if (currentTaskPath == null || estTimeDataName == null || estTimeEditable == false)
return;
ToolTipManager.sharedInstance().mouseExited(new MouseEvent(this, MouseEvent.MOUSE_EXITED, System.currentTimeMillis(), 0, 0, -1, 0, false));
final JTextField estimate = new JTextField();
if (estTime > 0 && !Double.isInfinite(estTime))
estimate.setText(FormatUtil.formatTime(estTime));
String prompt = resources.format("Edit_Dialog.Prompt_FMT", currentTaskPath);
JPanel p = new JPanel(new GridLayout(2, 2, 10, 2));
p.add(new JLabel(resources.getString("Actual_Time_Label"), JLabel.TRAILING));
p.add(new JLabel(FormatUtil.formatTime(actTime)));
p.add(new JLabel(resources.getString("Estimated_Time_Label"), JLabel.TRAILING));
p.add(estimate);
String title = resources.getString("Edit_Dialog.Title");
Object message = new Object[] { prompt, p, new JOptionPaneTweaker.GrabFocus(estimate) };
while (true) {
if (JOptionPane.showConfirmDialog(this, message, title, JOptionPane.OK_CANCEL_OPTION) != JOptionPane.OK_OPTION)
return;
SimpleData newEstimate;
String userInput = estimate.getText();
if (userInput == null || userInput.trim().length() == 0) {
newEstimate = null;
} else {
long l = FormatUtil.parseTime(userInput.trim());
if (l < 0) {
estimate.setBackground(new Color(255, 200, 200));
estimate.setToolTipText(resources.getString("Edit_Dialog.Invalid_Time"));
continue;
}
newEstimate = new DoubleData(l, true);
}
dashCtx.getData().userPutValue(estTimeDataName, newEstimate);
EST_TIME_JANITOR.cleanup(dashCtx);
return;
}
}
Aggregations