public GraphSpentWorkDialog(JFrame owner) { super(owner); Models m = Scrummer.getModels(); _metricModel = m.getMetricModel(); _metricModel.addMetricListener(this); setTitle(i18n.tr("Sprint burndown chart")); }
public class GraphSpentWorkDialog extends SprintDialog implements MetricListener { public GraphSpentWorkDialog(JFrame owner) { super(owner); Models m = Scrummer.getModels(); _metricModel = m.getMetricModel(); _metricModel.addMetricListener(this); setTitle(i18n.tr("Sprint burndown chart")); } @Override public void actionPerformed(ActionEvent e) { String cmd = e.getActionCommand(); if (cmd.equals("StandardDialog.OK")) { _metricModel.calculateSprintWorkSpent(_sprintInput.getSelectedId()); } else { super.actionPerformed(e); } } @Override public void operationSucceeded(DataOperation type, MetricOperation identifier, String message) { if ((type == DataOperation.Custom) && (identifier == MetricOperation.Graph)) { setVisible(false); } } @Override public void operationFailed(DataOperation type, MetricOperation identifier, String message) { if ((type == DataOperation.Custom) && (identifier == MetricOperation.Graph)) { Util.showError( this, i18n.tr("Error occurred while calculating sprint burndown information: ") + message, i18n.tr("Error")); } } @Override public void setVisible(boolean b) { if (!b) { _metricModel.removeMetricListener(this); } super.setVisible(b); } /// metric model private MetricModel _metricModel; /// translation class field private I18n i18n = Scrummer.getI18n(getClass()); }
public ImpedimentStatusRemove(JFrame parent) { super(parent); setTitle(i18n.tr("Remove Impediment Status")); Models m = Scrummer.getModels(); _impedimentModel = m.getImpedimentModel(); _impedimentModel.addImpedimentListener(this); int k = 10; Panel.setBorder( Util.createSpacedTitleBorder(k, k, k, k, i18n.tr("Impediment Status"), 0, k, k, k)); FormBuilder fb = new FormBuilder(Panel); _impedimentStatusInput = fb.addComboBoxInput(i18n.tr("Status") + ":"); _impedimentStatusInput.setIVModel(_impedimentModel.getImpedimentStatusComboBoxModel()); BottomPanel.setBorder(BorderFactory.createEmptyBorder(0, k, k, k - 3)); OK.setText(i18n.tr("Remove")); setSize(320, 150); }
/** * Constructor * * @param owner parent frame */ public TaskTypeRemoveDialog(Frame owner) { super(owner, ModalityType.APPLICATION_MODAL); setTitle(i18n.tr("Remove task type")); _tasktypeModel = Scrummer.getModels().getTaskTypeModel(); _tasktypeComboBoxModel = _tasktypeModel.getTaskTypeComboBoxModel(); _tasktypeModel.addTaskTypeListener(this); int k = 10; Panel.setBorder( Util.createSpacedTitleBorder(k, k, k, k, i18n.tr("Select task type"), 0, k, k, k)); _formBuilder = new FormBuilder(Panel); _tasktypeInput = _formBuilder.addComboBoxInput(i18n.tr("Task type") + ":"); _tasktypeInput.setIVModel(_tasktypeComboBoxModel); BottomPanel.setBorder(BorderFactory.createEmptyBorder(0, k, k, k)); setSize(new Dimension(320, 150)); Util.centre(this); }
/** Add measure dialog */ public class MeasureAddDialog extends MeasureDialog { /** * Constructor * * @param parent parent control * @param metricType metric type * @param metricId which metric is being added * @param objectId object id(task id, sprint id, ...) */ public MeasureAddDialog( JFrame parent, MetricTableModel.MetricType metricType, int metricId, int objectId) { super(parent, objectId); _metricType = metricType; _metricId = metricId; _objectId = objectId; switch (_metricType) { case Sprint: setTitle(i18n.tr("Add Sprint Measurement")); break; case Task: setTitle(i18n.tr("Add Task Measurement")); break; case PBI: setTitle(i18n.tr("Add PBI Measurement")); break; case Release: setTitle(i18n.tr("Add Release Measurement")); break; } _dateInput.setText(Util.today()); _resultInput.setSelectedItem("0"); } @Override public void actionPerformed(ActionEvent e) { String cmd = e.getActionCommand(); if (cmd.equals("StandardDialog.OK")) { if (!Validate.empty(_dateInput, this)) return; Date d = Validate.date(_dateInput, i18n.tr("Wrong date format."), this); if (d == null) return; // convert to date BigDecimal num = BigDecimal.ZERO; try { num = new BigDecimal(_resultInput.getEditor().getItem().toString()); } catch (NumberFormatException ex) { } switch (_metricType) { case Sprint: _metricModel.addSprintMeasurement(_metricId, _objectId, d, num); break; case Task: _metricModel.addTaskMeasurement(_metricId, _objectId, d, num); break; case PBI: _metricModel.addPBIMeasurement(_metricId, _objectId, d, num); break; case Release: _metricModel.addReleaseMeasurement(_metricId, _objectId, d, num); break; } } else if (cmd.equals("Calculate")) { } else { super.actionPerformed(e); } } @Override public void operationSucceeded(DataOperation type, MetricOperation identifier, String message) { if ((type == DataOperation.Custom) && ((identifier == MetricOperation.WorkEffectivenessCalculated) || (identifier == MetricOperation.EarnedValueCalculated))) { _resultInput.setSelectedItem(message); } else if ((type == DataOperation.Insert) && ((identifier == MetricOperation.ReleaseMeasure) || (identifier == MetricOperation.SprintMeasure) || (identifier == MetricOperation.TaskMeasure) || (identifier == MetricOperation.PBIMeasure))) { setVisible(false); } } @Override public void operationFailed(DataOperation type, MetricOperation identifier, String message) { if ((type == DataOperation.Custom) && ((identifier == MetricOperation.WorkEffectivenessCalculated) || (identifier == MetricOperation.EarnedValueCalculated))) { _resultInput.setSelectedItem(_previous.toEngineeringString()); OK.requestFocus(); } else if ((type == DataOperation.Insert) && ((identifier == MetricOperation.ReleaseMeasure) || (identifier == MetricOperation.SprintMeasure) || (identifier == MetricOperation.TaskMeasure) || (identifier == MetricOperation.PBIMeasure))) { Util.showError(this, i18n.tr("Error while adding new measure: ") + message, i18n.tr("Error")); } } /// metric type private MetricTableModel.MetricType _metricType; /// metric kind private int _metricId; /// object id private int _objectId; /// translation class field private I18n i18n = Scrummer.getI18n(getClass()); /// serialization id private static final long serialVersionUID = 2322146297584720409L; }
/** Dialog for removing impediment status */ public class ImpedimentStatusRemove extends TwoButtonDialog implements ImpedimentListener { public ImpedimentStatusRemove(JFrame parent) { super(parent); setTitle(i18n.tr("Remove Impediment Status")); Models m = Scrummer.getModels(); _impedimentModel = m.getImpedimentModel(); _impedimentModel.addImpedimentListener(this); int k = 10; Panel.setBorder( Util.createSpacedTitleBorder(k, k, k, k, i18n.tr("Impediment Status"), 0, k, k, k)); FormBuilder fb = new FormBuilder(Panel); _impedimentStatusInput = fb.addComboBoxInput(i18n.tr("Status") + ":"); _impedimentStatusInput.setIVModel(_impedimentModel.getImpedimentStatusComboBoxModel()); BottomPanel.setBorder(BorderFactory.createEmptyBorder(0, k, k, k - 3)); OK.setText(i18n.tr("Remove")); setSize(320, 150); } @Override public void operationSucceeded( DataOperation type, ImpedimentOperation identifier, String message) { if ((type == DataOperation.Remove) && (identifier == ImpedimentOperation.ImpedimentStatus)) { setVisible(false); } } @Override public void operationFailed(DataOperation type, ImpedimentOperation identifier, String message) { if ((type == DataOperation.Remove) && (identifier == ImpedimentOperation.ImpedimentStatus)) { Util.showError( this, i18n.tr("Could not remove impediment status: " + message), i18n.tr("Error")); } } @Override public void actionPerformed(ActionEvent e) { String cmd = e.getActionCommand(); if (cmd.equals("StandardDialog.OK")) { _impedimentModel.removeStatus(_impedimentStatusInput.getSelectedId()); } else { super.actionPerformed(e); } } @Override public void setVisible(boolean b) { if (!b) { _impedimentModel.removeImpedimentListener(this); } super.setVisible(b); } /// impediment model protected ImpedimentModel _impedimentModel; /// impediment status type protected StandardComboBox _impedimentStatusInput; /// translation class field private I18n i18n = Scrummer.getI18n(getClass()); /// serialization id private static final long serialVersionUID = 7309576750188068023L; }
/** Remove task type dialog */ public class TaskTypeRemoveDialog extends TwoButtonDialog implements TaskTypeListener { /** * Constructor * * @param owner parent frame */ public TaskTypeRemoveDialog(Frame owner) { super(owner, ModalityType.APPLICATION_MODAL); setTitle(i18n.tr("Remove task type")); _tasktypeModel = Scrummer.getModels().getTaskTypeModel(); _tasktypeComboBoxModel = _tasktypeModel.getTaskTypeComboBoxModel(); _tasktypeModel.addTaskTypeListener(this); int k = 10; Panel.setBorder( Util.createSpacedTitleBorder(k, k, k, k, i18n.tr("Select task type"), 0, k, k, k)); _formBuilder = new FormBuilder(Panel); _tasktypeInput = _formBuilder.addComboBoxInput(i18n.tr("Task type") + ":"); _tasktypeInput.setIVModel(_tasktypeComboBoxModel); BottomPanel.setBorder(BorderFactory.createEmptyBorder(0, k, k, k)); setSize(new Dimension(320, 150)); Util.centre(this); } @Override public void actionPerformed(ActionEvent e) { String cmd = e.getActionCommand(); if (cmd == "StandardDialog.OK") { if (_tasktypeInput.isSelected()) { Integer id = _tasktypeInput.getSelectedId(); _tasktypeModel.removeTaskType(id.toString()); _tasktypeComboBoxModel.refresh(); } else { Util.showError( this, i18n.tr( "Could not delete task type. Select one task type first, " + "then click on Remove button."), i18n.tr("Error")); } } else { super.actionPerformed(e); } } @Override public void operationSucceeded(DataOperation type, TaskTypeOperation identifier, String message) { switch (type) { case Remove: switch (identifier) { case TaskType: setVisible(false); break; } break; } } @Override public void operationFailed(DataOperation type, TaskTypeOperation identifier, String message) { Util.showError(this, i18n.tr("Could not remove task type: " + message), i18n.tr("Error")); } @Override public void setVisible(boolean b) { if (!b) { _tasktypeModel.removeTaskTypeListener(this); } super.setVisible(b); } /// task type input combo box private StandardComboBox _tasktypeInput; /// task type model private TaskTypeModel _tasktypeModel; /// task type combo box model private TaskTypeComboBoxModel _tasktypeComboBoxModel; /// form building class private FormBuilder _formBuilder; /// translation class field private I18n i18n = Scrummer.getI18n(getClass()); /// serialization id private static final long serialVersionUID = 4206239821521998017L; }