示例#1
0
 private void saveProject() {
   project.setDescription(ui.txtDescription.text());
   project.setPlannedTime(ui.txtPlannedTime.value());
   project.setProjectManager(
       (Usr) ui.cmbProjectManager.itemData(ui.cmbProjectManager.currentIndex()));
   project.setActiveState(!ui.checkBox.isChecked());
   try {
     ProjectController.getInstance().updateProject(project);
   } catch (WaktuException e) {
     errorMessage.emit(e.getMessage());
   }
 }
示例#2
0
  private void setFields() {
    if (project != null) {
      if (GuiController.getInstance().canModifyProject()) {
        ui.btnAdd.setVisible(true);
        ui.btnAdd.setText(QCoreApplication.translate("ProjectDataView", "Save", null));

        ui.txtDescription.setText(project.getDescription());
        ui.txtDescription.setEnabled(true);

        ui.txtProjectnumber.setText(project.getProjectIdentifier());
        ui.txtProjectnumber.setEnabled(false);

        ui.txtPlannedTime.setValue(project.getPlannedTime());
        ui.txtPlannedTime.setEnabled(true);

        ui.txtPlannedTime.setValue(project.getPlannedTime());
        ui.txtPlannedTime.setEnabled(true);

        ui.checkBox.setChecked(!project.isActive());
        ui.checkBox.setEnabled(true);
        try {
          ComboBoxData.createProjectManagerComboBox(
              ui.cmbProjectManager, project.getProjectManager());
        } catch (WaktuException e) {
          errorMessage.emit(e.getMessage());
        }

      } else {
        ui.btnAdd.setVisible(false);

        ui.txtDescription.setText(project.getDescription());
        ui.txtDescription.setEnabled(false);

        ui.txtProjectnumber.setText(project.getProjectIdentifier());
        ui.txtProjectnumber.setEnabled(false);

        ui.txtPlannedTime.setValue(project.getPlannedTime());
        ui.txtPlannedTime.setEnabled(false);

        ui.txtPlannedTime.setValue(project.getPlannedTime());
        ui.txtPlannedTime.setEnabled(false);

        ui.checkBox.setChecked(!project.isActive());
        ui.checkBox.setEnabled(false);
        try {
          ComboBoxData.createProjectManagerComboBox(
              ui.cmbProjectManager, project.getProjectManager());
        } catch (WaktuException e) {
          errorMessage.emit(e.getMessage());
        }
        ui.cmbProjectManager.setEnabled(false);
      }
    } else {
      ui.btnAdd.setVisible(true);

      ui.txtDescription.setEnabled(true);
      ui.txtProjectnumber.setEnabled(true);
      ui.txtPlannedTime.setEnabled(true);
      ui.txtPlannedTime.setEnabled(true);
      ui.checkBox.setEnabled(true);
      ui.cmbProjectManager.setEnabled(true);
      try {
        ComboBoxData.createProjectManagerComboBox(ui.cmbProjectManager, null);
      } catch (WaktuException e) {
        errorMessage.emit(e.getMessage());
      }
    }
  }