Пример #1
0
  @Action
  public Task remove() {
    ConfirmationDialog dialog = module.objectBuilderFactory().newObject(ConfirmationDialog.class);
    dialog.setRemovalMessage(
        i18n.text(
            attachments.getSelectedRows().length > 1
                ? WorkspaceResources.attachments
                : WorkspaceResources.attachment));
    dialogs.showOkCancelHelpDialog(this, dialog, i18n.text(StreamflowResources.confirmation));

    if (dialog.isConfirmed()) {
      final List<AttachmentDTO> removedAttachments = new ArrayList<AttachmentDTO>();
      for (int i : attachments.getSelectedRows()) {
        removedAttachments.add(
            attachmentsModel.getEventList().get(attachments.convertRowIndexToModel(i)));
      }

      return new CommandTask() {
        @Override
        public void command() throws Exception {

          for (AttachmentDTO removedAttachment : removedAttachments) {
            attachmentsModel.removeAttachment(removedAttachment);
          }
        }
      };
    } else return null;
  }
Пример #2
0
 /**
  * Henter selektert import
  *
  * @return import
  */
 public AvdelingAvregningBelop getSelectedImport() {
   int index = deductImportSelectionList.getSelectionIndex();
   if (index != -1) {
     index = table.convertRowIndexToModel(index);
     return (AvdelingAvregningBelop) deductImportSelectionList.getElementAt(index);
   }
   return null;
 }
Пример #3
0
  @Action(block = Task.BlockingScope.APPLICATION)
  public Task open() throws IOException {
    for (int i : attachments.getSelectedRows()) {
      AttachmentDTO attachment =
          attachmentsModel.getEventList().get(attachments.convertRowIndexToModel(i));

      return new OpenAttachmentTask(
          attachment.text().get(), attachment.href().get(), this, attachmentsModel, dialogs);
    }

    return null;
  }
  private void delete_branch_locations() {
    int row = tbl_branch_locations.getSelectedRow();
    if (row < 0) {
      return;
    }
    final to_branch_locations to =
        (to_branch_locations)
            tbl_branch_locations_ALM.get(tbl_branch_locations.convertRowIndexToModel(row));
    if (to.status == 1) {
      Alert.set(0, "Cannot Delete Default Location");
      return;
    }
    Window p = (Window) this;
    Dlg_auth nd = Dlg_auth.create(p, true);
    nd.setTitle("");
    nd.setCallback(
        new Dlg_auth.Callback() {

          @Override
          public void ok(CloseDialog closeDialog, Dlg_auth.OutputData data) {
            closeDialog.ok();
            jProgressBar1.setString("Loading...Please wait...");
            jProgressBar1.setIndeterminate(true);
            btn_new.setEnabled(false);
            btn_add.setEnabled(false);
            btn_edit.setEnabled(false);
            btn_delete.setEnabled(false);
            Thread t =
                new Thread(
                    new Runnable() {
                      @Override
                      public void run() {
                        S1_branch_locations.delete_branch_locations(to);
                        data_cols();
                        clear_branch_locations();
                        Alert.set(3, "");
                        jProgressBar1.setString("Finished...");
                        jProgressBar1.setIndeterminate(false);
                        btn_new.setEnabled(true);
                        btn_add.setEnabled(true);
                        btn_edit.setEnabled(true);
                        btn_delete.setEnabled(true);
                      }
                    });
            t.start();
          }
        });
    nd.setLocationRelativeTo(jScrollPane2);
    nd.setVisible(true);
  }
  private void okActionPerformed(java.awt.event.ActionEvent evt) {
    if (smtp.getText().trim().isEmpty()) {
      CommonFunctions.showErrorMessage(this, "You must enter a SMTP server.");
      return;
    } else if (smtpUsername.getText().trim().isEmpty()) {
      CommonFunctions.showErrorMessage(this, "You must enter the SMTP username.");
      return;
    } else {
      try {
        int port = Integer.parseInt(smtpPort.getText());
        if (port <= 0) throw new NumberFormatException();

        new InternetAddress(email.getText()).validate();
      } catch (NumberFormatException e) {
        CommonFunctions.showErrorMessage(this, "You must enter a valid SMTP port.");
        return;
      } catch (AddressException e) {
        CommonFunctions.showErrorMessage(this, "You must enter a valid source email address.");
        return;
      }
    }

    retval = 0;

    List<Student> selectedStudents = new ArrayList();
    for (int i = 0; i < studentsTbl.getRowCount(); i++) {
      if ((boolean) studentsTbl.getValueAt(i, 0)) {
        selectedStudents.add(students.get(studentsTbl.convertRowIndexToModel(i)));
      }
    }

    output =
        new Object[] {
          email.getText(),
          smtp.getText(),
          smtpPort.getText(),
          smtpUsername.getText(),
          new String(smtpPassword.getPassword()),
          selectedStudents
        };

    setVisible(false);
  }
  /**
   * DOCUMENT ME!
   *
   * @param e DOCUMENT ME!
   */
  private void fortfuehrungsTableListSelectionChanged(final ListSelectionEvent e) {
    final int selectedIndex = jXTable1.getSelectedRow();
    final CidsBean selectedFortfuehrungBean;
    if (selectedIndex >= 0) {
      final int rowIndex = jXTable1.convertRowIndexToModel(selectedIndex);
      selectedFortfuehrungBean =
          ((FortfuehrungenTableModel) jXTable1.getModel()).getCidsBeanByIndex(rowIndex);
    } else {
      selectedFortfuehrungBean = null;
    }
    if (selectedFortfuehrungBean != null) {
      new SwingWorker<Set<Integer>, Void>() {

        @Override
        protected Set<Integer> doInBackground() throws Exception {
          lstKassenzeichen.setEnabled(false);
          cbxAbgearbeitet.setEnabled(false);
          jProgressBar1.setVisible(true);
          final List<CidsBean> geomBeans =
              (List<CidsBean>)
                  selectedFortfuehrungBean.getBeanCollectionProperty(
                      FortfuehrungPropertyConstants.PROP__GEOMETRIEN);
          final KassenzeichenGeomSearch geomSearch = new KassenzeichenGeomSearch();
          final Set<Integer> kassenzeichennummern = new HashSet<Integer>();
          for (final CidsBean geomBean : geomBeans) {
            if (geomBean != null) {
              try {
                final Geometry geom =
                    (Geometry) geomBean.getProperty(GeomPropertyConstants.PROP__GEO_FIELD);
                geomSearch.setGeometry(geom.buffer(FLURSTUECKBUFFER_FOR_KASSENZEICHEN_GEOMSEARCH));
                kassenzeichennummern.addAll(
                    (Collection<Integer>)
                        SessionManager.getProxy()
                            .customServerSearch(SessionManager.getSession().getUser(), geomSearch));
              } catch (final Exception ex) {
                LOG.error("fehler beim suchen von kassenzeichen über eine geometrie", ex);
              }
            }
          }
          return kassenzeichennummern;
        }

        @Override
        protected void done() {
          try {
            final Set<Integer> kassenzeichennummern = get();
            setDetailEnabled(true);
            setKassenzeichenNummern(kassenzeichennummern);
            cbxAbgearbeitet.setSelected(
                (Boolean)
                    selectedFortfuehrungBean.getProperty(
                        FortfuehrungPropertyConstants.PROP__IST_ABGEARBEITET));

            final CidsBean urlBean =
                (CidsBean)
                    selectedFortfuehrungBean.getProperty(
                        FortfuehrungPropertyConstants.PROP__DOKUMENTURL);
            final String protPrefix = (String) urlBean.getProperty("url_base_id.prot_prefix");
            final String server = (String) urlBean.getProperty("url_base_id.server");
            final String path = (String) urlBean.getProperty("url_base_id.path");
            final String objectName = (String) urlBean.getProperty("object_name");
            final String urlString = protPrefix + server + path + objectName;
            setDokumentLink(urlString);
          } catch (final Exception ex) {
            setKassenzeichenNummern(null);
            cbxAbgearbeitet.setSelected(false);
            LOG.fatal("", ex);
          }
          lstKassenzeichen.setEnabled(true);
          cbxAbgearbeitet.setEnabled(true);
          jProgressBar1.setVisible(false);
        }
      }.execute();
    } else {
      setDetailEnabled(false);
      setKassenzeichenNummern(null);
      cbxAbgearbeitet.setSelected(false);
      setDokumentLink(null);
    }
  }