Beispiel #1
0
 public void neuesGutachten(
     String berid,
     String bertype,
     String verfasser,
     String erstellt,
     String empfang,
     String patintern,
     String bertitel) {
   Vector<String> xvec = new Vector<String>();
   xvec.add(berid);
   xvec.add(bertype);
   xvec.add(verfasser);
   xvec.add(erstellt);
   xvec.add(empfang);
   xvec.add("");
   xvec.add("0");
   xvec.add(patintern);
   if (Reha.thisClass.patpanel.aktPatID.equals(patintern)) {
     dtblm.addRow((Vector<?>) xvec.clone());
     tabbericht.setRowSelectionInterval(
         tabbericht.getRowCount() - 1, tabbericht.getRowCount() - 1);
   }
   Reha.thisClass
       .patpanel
       .getTab()
       .setTitleAt(4, macheHtmlTitel(tabbericht.getRowCount(), "Gutachten"));
   anzahlGutachten.setText("Anzahl Gutachten: " + Integer.toString(tabbericht.getRowCount()));
 }
  public void EVENT_moveTop(ActionEvent e) {
    int selection[] = table.getSelectedRows();
    int offset = 0;
    if (selection != null && selection.length > 0) {
      for (int j = selection.length - 1; j >= 0; j--) {
        int i = selection[j];
        DownloadWrapper dw = rows.get(i + offset);
        final Download d = dw.download;
        ui.getCore()
            .invokeLater(
                new Runnable() {

                  @Override
                  public void run() {
                    ui.getCore().getNetworkManager().getDownloadManager().moveTop(d);
                  }
                });
        moveTop(i + offset, dw);
        offset++;
      }
      model.fireTableStructureChanged();
      // for(int i : selection) if (i>0) table.getSelectionModel().addSelectionInterval(i-1,i-1);
      table.getSelectionModel().addSelectionInterval(0, selection.length - 1);
    }
  }
  @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;
  }
Beispiel #4
0
 private void doPdfStarten(int art) {
   int row = tabbericht.getSelectedRow();
   if (row < 0) {
     JOptionPane.showMessageDialog(null, "Kein Bericht für Datenübernahme ausgewählt");
     return;
   }
   new LadeProg(
       Reha.proghome
           + "PDFLoader.jar "
           + Integer.toString(art)
           + " "
           + tabbericht.getValueAt(row, 0).toString()
           + " "
           + SystemConfig.PDFformularPfad
           + " "
           + Reha.proghome
           + "ini/"
           + Reha.aktIK
           + "/fremdprog.ini"
           + " "
           + Reha.thisClass.patpanel.patDaten.get(29)
           + " "
           + Reha.proghome
           + "ini/"
           + Reha.aktIK
           + "/rehajava.ini");
 }
  public void EVENT_moveUp(ActionEvent e) {
    int selection[] = table.getSelectedRows();
    if (selection != null && selection.length > 0) {
      for (int i : selection) {
        DownloadWrapper dw = rows.get(i);
        final Download d = dw.download;
        ui.getCore()
            .invokeLater(
                new Runnable() {

                  @Override
                  public void run() {
                    ui.getCore().getNetworkManager().getDownloadManager().moveUp(d);
                  }
                });
        moveUp(i, dw);
      }
      model.fireTableStructureChanged();
      for (int i : selection) {
        if (i > 0) {
          table.getSelectionModel().addSelectionInterval(i - 1, i - 1);
        }
      }
    }
  }
Beispiel #6
0
  public void refresh() {
    Iterable<Property> properties = Collections.emptyList();

    if (beanHelper != null) {
      Image icon = beanHelper.getIcon(BeanInfo.ICON_COLOR_32x32);
      if (icon == null) {
        remove(top);
      } else {
        JXImageView logo = new JXImageView();
        logo.setImage(icon);
        add(logo, BorderLayout.NORTH);
      }
      properties =
          filter(
              beanHelper.getProperties(),
              new Predicate<Property>() {
                @Override
                public boolean apply(Property input) {
                  return !input.isHidden();
                }
              });
    }

    table.setModel(new MyTableModel(properties));

    // should we expose minimum row/column sizes as a user property?
    table.setRowHeight(18); // essentially the minimum row height
    table.getColumnModel().getColumn(0).setMinWidth(1);
    table.getColumnModel().getColumn(0).setMaxWidth(1);
    table.getColumnModel().getColumn(1).setMinWidth(1);

    table.packAll();
    revalidate();
  }
  // Initialize JTable
  private void initTable() {
    DialogTableModel tblModel = new DialogTableModel(students);
    studentsTbl.setModel(tblModel);

    studentsTbl.setAutoCreateRowSorter(true);
    studentsTbl.setRowSelectionAllowed(true);
    studentsTbl.getRowSorter().toggleSortOrder(1);
    studentsTbl.setGridColor(Color.gray);
    studentsTbl.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
    studentsTbl.setRowHeight(22);

    TableColumn tc = studentsTbl.getColumnModel().getColumn(0);
    tc.setCellEditor(studentsTbl.getDefaultEditor(Boolean.class));
    tc.setCellRenderer(studentsTbl.getDefaultRenderer(Boolean.class));
    tc.setHeaderRenderer(
        new CheckBoxTableHeader(
            new ItemListener() {
              @Override
              public void itemStateChanged(ItemEvent e) {
                Object source = e.getSource();
                if (source instanceof AbstractButton == false) {
                  return;
                }
                boolean checked = e.getStateChange() == ItemEvent.SELECTED;
                for (int x = 0, y = studentsTbl.getRowCount(); x < y; x++) {
                  studentsTbl.setValueAt(new Boolean(checked), x, 0);
                }
              }
            }));
  }
Beispiel #8
0
 /**
  * Metodo para construir el grid. Subclaseses recomendable que ejecuten super.buildGrid antes de
  * iniciar una personalizacion de este metodo
  *
  * @return
  */
 protected JXTable buildGrid() {
   final EventTableModel<T> tm = new EventTableModel<T>(sortedSource, getTableFormat());
   selectionModel = new EventSelectionModel(sortedSource);
   selectionModel.setSelectionMode(getSelectionMode());
   final JXTable grid = ComponentUtils.getStandardTable();
   grid.setModel(tm);
   grid.setSelectionModel(selectionModel);
   final Action select =
       new AbstractAction() {
         public void actionPerformed(ActionEvent e) {
           doSelect();
         }
       };
   ComponentUtils.addEnterAction(grid, select);
   grid.addMouseListener(
       new MouseAdapter() {
         @Override
         public void mouseClicked(MouseEvent e) {
           if (e.getClickCount() == 2) doSelect();
         }
       });
   // new TableComparatorChooser(grid,sortedSource,true);
   TableComparatorChooser.install(
       grid, sortedSource, TableComparatorChooser.MULTIPLE_COLUMN_MOUSE);
   grid.packAll();
   return grid;
 }
  @SuppressWarnings({"rawtypes", "unchecked"})
  private void ladeTabelle() {
    String test = Reha.thisClass.patpanel.patDaten.get(63);
    if (test.trim().equals("")) {
      JOptionPane.showMessageDialog(
          null, "Mit der Arztliste dieses Patienten läuft etwas schief....");
    } else {
      String[] arztid = test.split("\n");

      for (int i = 0; i < arztid.length; i++) {
        String[] arzt = arztid[i].split("@");
        Vector<Vector<String>> vec =
            SqlInfo.holeFelder(
                "select nachname,vorname,strasse,ort,arztnum,bsnr,id from arzt where id = '"
                    + arzt[1]
                    + "' LIMIT 1");
        if (vec.size() >= 1) {
          Vector vec2 = (Vector) ((Vector) vec.get(0)).clone();
          vec2.insertElementAt(Boolean.valueOf(false), 0);
          atblm.addRow((Vector) vec2.clone());
        }
      }
      if (atblm.getRowCount() > 0) {
        arzttbl.setRowSelectionInterval(0, 0);
      }
      arzttbl.revalidate();
    }
  }
  public void EVENT_moveBottom(ActionEvent e) {
    int selection[] = table.getSelectedRows();

    int offset = 0;
    if (selection != null && selection.length > 0) {
      for (int i : selection) {
        DownloadWrapper dw = rows.get(i - offset);
        final Download d = dw.download;
        ui.getCore()
            .invokeLater(
                new Runnable() {

                  @Override
                  public void run() {
                    ui.getCore().getNetworkManager().getDownloadManager().moveBottom(d);
                  }
                });
        moveBottom(i - offset, dw);
        offset++;
      }
      model.fireTableStructureChanged();
      // for(int i : selection) if (i<rows.size()-1)
      // table.getSelectionModel().addSelectionInterval(i+1,i+1);
      ListSelectionModel sm = table.getSelectionModel();
      sm.addSelectionInterval(rows.size() - selection.length, rows.size() - 1);
    }
  }
 private void createTable() {
   model = new ParametersTableModel();
   table = new JXTable(model);
   table.setSortable(false);
   // table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
   table.setRolloverEnabled(true);
   table.addHighlighter(new ColorHighlighter(HighlightPredicate.ROLLOVER_ROW, null, Color.RED));
 }
 protected void adjustMainGrid(final JXTable grid) {
   grid.getColumnExt("Salida")
       .setCellRenderer(new DefaultTableRenderer(new Renderers.ToHourConverter()));
   // grid.getColumnExt("Cerrado").setCellRenderer(new DefaultTableRenderer(new
   // Renderers.ToHourConverter()));
   grid.getColumnExt("Regreso")
       .setCellRenderer(new DefaultTableRenderer(new Renderers.ToHourConverter()));
 }
 private void forwardEventToButton(MouseEvent e) {
   if (e.getID() == e.MOUSE_CLICKED) {
     JXTable table = ((JXTable) e.getSource());
     Integer row = table.rowAtPoint(e.getPoint());
     table.getColumnExt("Parameter Object").setVisible(true);
     this.parent.actionHandler.goToParameter((Parameter) table.getValueAt(row, 5));
   }
   return;
 }
  public MenuItemExplorer() {
    tableModel = new BeanTableModel<MenuItem>(MenuItem.class);
    tableModel.addColumn(POSConstants.ID.toUpperCase(), "id"); // $NON-NLS-1$
    tableModel.addColumn(POSConstants.NAME.toUpperCase(), "name"); // $NON-NLS-1$
    tableModel.addColumn(
        POSConstants.TRANSLATED_NAME.toUpperCase(), "translatedName"); // $NON-NLS-1$
    tableModel.addColumn(
        POSConstants.PRICE.toUpperCase() + " (" + Application.getCurrencySymbol() + ")",
        "price"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    tableModel.addColumn(POSConstants.VISIBLE.toUpperCase(), "visible"); // $NON-NLS-1$
    tableModel.addColumn(
        POSConstants.DISCOUNT.toUpperCase() + "(%)", "discountRate"); // $NON-NLS-1$ //$NON-NLS-2$
    tableModel.addColumn(POSConstants.FOOD_GROUP.toUpperCase(), "parent"); // $NON-NLS-1$
    tableModel.addColumn(POSConstants.TAX.toUpperCase(), "tax"); // $NON-NLS-1$
    tableModel.addColumn(POSConstants.SORT_ORDER.toUpperCase(), "sortOrder"); // $NON-NLS-1$
    tableModel.addColumn(POSConstants.BUTTON_COLOR.toUpperCase(), "buttonColor"); // $NON-NLS-1$
    tableModel.addColumn(POSConstants.TEXT_COLOR.toUpperCase(), "textColor"); // $NON-NLS-1$
    tableModel.addColumn(POSConstants.IMAGE.toUpperCase(), "imageData"); // $NON-NLS-1$

    tableModel.addRows(MenuItemDAO.getInstance().findAll());

    table = new JXTable(tableModel);
    table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    table.setRowHeight(30);

    table.setDefaultRenderer(Object.class, new CustomCellRenderer());
    table
        .getColumnModel()
        .getColumn(10)
        .setCellRenderer(
            new DefaultTableCellRenderer() {
              @Override
              public Component getTableCellRendererComponent(
                  JTable table,
                  Object value,
                  boolean isSelected,
                  boolean hasFocus,
                  int row,
                  int column) {
                if (value instanceof Color) {
                  JLabel lblColor = new JLabel("TEXT COLOR", JLabel.CENTER);
                  lblColor.setForeground((Color) value);
                  return lblColor;
                }
                return super.getTableCellRendererComponent(
                    table, value, isSelected, hasFocus, row, column);
              }
            });

    setLayout(new BorderLayout(5, 5));
    add(new JScrollPane(table));

    add(createButtonPanel(), BorderLayout.SOUTH);
    add(buildSearchForm(), BorderLayout.NORTH);
  }
  private void lookupUsersAndGroups() {
    PermissionsEntityType pEntityType;

    if (theentity instanceof TridasObject) {
      pEntityType = PermissionsEntityType.OBJECT;
    } else if (theentity instanceof TridasElement) {
      pEntityType = PermissionsEntityType.ELEMENT;
    } else if (theentity instanceof TridasMeasurementSeries) {
      pEntityType = PermissionsEntityType.MEASUREMENT_SERIES;
    } else if (theentity instanceof TridasDerivedSeries) {
      pEntityType = PermissionsEntityType.DERIVED_SERIES;
    } else {
      Alert.error(
          "Error", "Permissions information is only available for objects, elements and series");
      return;
    }

    PermissionsResource resource = new PermissionsResource();

    for (WSISecurityUser user :
        (ArrayList<WSISecurityUser>)
            Dictionary.getDictionaryAsArrayList("securityUserDictionary")) {
      if (!user.isIsActive()) continue;

      resource.addPermission(pEntityType, theentity.getIdentifier().getValue(), user);
    }

    for (WSISecurityGroup grp :
        (ArrayList<WSISecurityGroup>)
            Dictionary.getDictionaryAsArrayList("securityGroupDictionary")) {
      resource.addPermission(pEntityType, theentity.getIdentifier().getValue(), grp);
    }

    // Query db
    TellervoResourceAccessDialog dialog = new TellervoResourceAccessDialog(resource);
    resource.query();
    dialog.setVisible(true);

    if (!dialog.isSuccessful()) {
      log.error("Error getting permissions info");
      Alert.error("Error", "Error getting permissions info");
      return;
    }

    permsList = resource.getAssociatedResult();

    if (tblGroupPerms != null) tblGroupPerms.repaint();
    if (tblUserPerms != null) tblUserPerms.repaint();

    if (permsList.size() == 0) {
      Alert.error("Error", "No records found");
      return;
    }
  }
  @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;
  }
Beispiel #17
0
 private JComponent buildGridPanel() {
   final String[] props = {
     "clave",
     "factura.numero",
     "factura.fecha",
     "factura.tipo",
     "factura.total",
     "factura.pagos",
     "factura.devolucionesCred",
     "factura.saldo",
     "factura.descuentoPactado",
     "factura.cargo",
     "importe"
   };
   final String[] cols = {
     "Cliente",
     "Factura",
     "Fecha",
     "T",
     "Total",
     "Pagos",
     "Devoluciones",
     "Saldo",
     "Desc",
     "Cargo",
     "Importe"
   };
   final TableFormat<NotasDeCreditoDet> tf =
       GlazedLists.tableFormat(NotasDeCreditoDet.class, props, cols);
   final SortedList<NotasDeCreditoDet> sortedList =
       new SortedList<NotasDeCreditoDet>(model.getPartidas(), null);
   final EventTableModel<NotasDeCreditoDet> tm =
       new EventTableModel<NotasDeCreditoDet>(sortedList, tf);
   final EventSelectionModel<NotasDeCreditoDet> selectionModel =
       new EventSelectionModel<NotasDeCreditoDet>(sortedList);
   selectionModel.setSelectionMode(ListSelection.SINGLE_SELECTION);
   final Action deleteAction =
       new AbstractAction() {
         public void actionPerformed(ActionEvent e) {
           if (!selectionModel.getSelected().isEmpty()) {
             selectionModel.getSelected().remove(0);
             if (sortedList.isEmpty()) getOKAction().setEnabled(false);
           }
         }
       };
   grid = ComponentUtils.getStandardTable();
   grid.setModel(tm);
   grid.packAll();
   grid.setSelectionModel(selectionModel);
   ComponentUtils.addDeleteAction(grid, deleteAction);
   JScrollPane sp = new JScrollPane(grid);
   return sp;
 }
  public static void main(String[] args) {
    TranslationTableModel model = new TranslationTableModel(new File("conf/localization/pt"));
    JXTable table = new JXTable(model);
    table.setRowSelectionAllowed(true);
    JScrollPane scroll = new JScrollPane(table);
    GuiUtils.testFrame(scroll);

    Vector<Integer> searchResults = model.search("PLUGINNAME");

    for (int i : searchResults) {
      table.getSelectionModel().addSelectionInterval(i, i);
    }
  }
  public void repopulateTable() {
    populateTable();
    iProductsTable.scrollRowToVisible(0);
    TableRowSorter<DefaultTableModel> sorter =
        new TableRowSorter<>((DefaultTableModel) iProductsTable.getModel());
    iProductsTable.setRowSorter(sorter);
    List<RowSorter.SortKey> sortKeys = new ArrayList<>();

    int columnIndexToSort = 0;
    sortKeys.add(new RowSorter.SortKey(columnIndexToSort, SortOrder.ASCENDING));

    sorter.setSortKeys(sortKeys);
    sorter.sort();
  }
  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);
  }
 /**
  * DOCUMENT ME!
  *
  * @param evt DOCUMENT ME!
  */
 private void cbxAbgearbeitetActionPerformed(final java.awt.event.ActionEvent evt) {
   try {
     final int displayedIndex = jXTable1.getSelectedRow();
     final int modelIndex = jXTable1.getFilters().convertRowIndexToModel(displayedIndex);
     final CidsBean selectedFortfuehrungBean =
         ((FortfuehrungenTableModel) jXTable1.getModel()).getCidsBeanByIndex(modelIndex);
     selectedFortfuehrungBean.setProperty(
         FortfuehrungPropertyConstants.PROP__IST_ABGEARBEITET, cbxAbgearbeitet.isSelected());
     selectedFortfuehrungBean.persist();
     jXTable1.repaint();
   } catch (Exception ex) {
     LOG.error("fehler beim setzen von ist_abgearbeitet", ex);
   }
 }
  @Override
  public void valueChanged(ListSelectionEvent arg) {

    if (!arg.getValueIsAdjusting() && this.acceptListEvents) {
      int col = combinedRulesTable.getSelectedColumn();
      int row = combinedRulesTable.getSelectedRow();
      consoleLogger.debug("Selected ROW: " + row + " - COL: " + col);
      String rule =
          String.valueOf(
              combinedRulesTable.getValueAt(row, CombinedRulesTableColumns.RULE_NUMBER.ordinal()));
      //   System.out.println("rule:::::"+rule);
      this.firePropertyChange(FIRING_PROPERTY, this.selectedCombinedRule, rule);
      this.selectedCombinedRule = rule;
    }
  }
 private static void testJXTable(JXTable table, int iterations) {
   for (int i = 0; i < iterations; i++) {
     long time = System.currentTimeMillis();
     table.toggleSortOrder(0);
     System.err.println(System.currentTimeMillis() - time + " ms");
   }
 }
Beispiel #24
0
 private void initMasterTable() {
   EntityTableModel etm = new EntityTableModel();
   etm.addColumn("Nombre", "nombre");
   etm.addColumn("Descripcion", "descripcion");
   etm.addColumn("Costo", "costo");
   masterTable.setModel(etm);
 }
Beispiel #25
0
 private void doBerichtEdit() {
   int row = tabbericht.getSelectedRow();
   // System.out.println("in doBerichtEdit");
   if (row < 0) {
     // System.out.println("keine Zeile vorhanden also return");
     return;
   }
   String bertyp = (String) tabbericht.getValueAt(row, 1);
   int berid = Integer.parseInt(tabbericht.getValueAt(row, 0).toString());
   String berempfaenger = (String) tabbericht.getValueAt(row, 4);
   Reha.thisClass.progLoader.GutachenFenster(
       1, Reha.thisClass.patpanel.aktPatID, berid, bertyp, false, berempfaenger, -1);
   // ProgLoader.GutachenFenster(1,Reha.thisClass.patpanel.aktPatID
   // ,berid,bertyp,false,berempfaenger );
   // ProgLoader.InternalGut2();
 }
  public void EVENT_openfile(ActionEvent e) {
    int selection[] = table.getSelectedRows();

    if (selection == null || selection.length == 0) {
      return;
    }
    if (selection.length > 1) {
      OptionDialog.showErrorDialog(ui.getMainWindow(), "You can only open one folder or file");
      return;
    }

    Download d = rows.get(selection[0]).download;
    if (d.isComplete() == true) {
      String path =
          ui.getCore().getSettings().getInternal().getDownloadfolder()
              + "\\"
              + d.getAuxInfoFilename();
      try {
        Desktop.getDesktop().open(new File(path));
      } catch (IOException ex) {
        OptionDialog.showErrorDialog(
            ui.getMainWindow(), "This type of file hasn't been associated with any program");
      } catch (IllegalArgumentException ex) {
        OptionDialog.showErrorDialog(
            ui.getMainWindow(), "This type of file hasn't been associated with any program");
      } catch (UnsupportedOperationException ex) {
        OptionDialog.showErrorDialog(
            ui.getMainWindow(), "This operation is not supported on this architecture");
      }
    } else {
      OptionDialog.showErrorDialog(ui.getMainWindow(), "File hasn't been downloaded yet");
    }
  }
Beispiel #27
0
 public void aktualisiereGutachten(
     String editdat, String bertype, String empf, String verfasser, int berid, String patintern) {
   String cmd =
       "update berhist set berichttyp='"
           + bertype
           + "', empfaenger='"
           + empf
           + "', editdat='"
           + DatFunk.sDatInSQL(editdat)
           + "', verfasser='"
           + verfasser
           + "' where berichtid='"
           + berid
           + "'";
   SqlInfo.sqlAusfuehren(cmd);
   int row = tabbericht.getSelectedRow();
   if (!Reha.thisClass.patpanel.aktPatID.equals(patintern)) {
     JOptionPane.showMessageDialog(
         null, "Der aktuelle Patient und das zu speichernde Gutachten passen nicht zusammen...");
     return;
   }
   if (dtblm.getValueAt(row, 0).equals(Integer.toString(berid))) {
     dtblm.setValueAt(bertype, row, 1);
     dtblm.setValueAt(verfasser, row, 2);
     dtblm.setValueAt(empf, row, 4);
     dtblm.setValueAt(editdat, row, 5);
   }
 }
Beispiel #28
0
  /**
   * Static function for exporting a JXTable to a CSV text file
   *
   * @param table - table to export
   * @param file - file to export to
   */
  public static void exportToCSV(JXTable table, File file) {

    int i = 0;
    int j = 0;

    try {
      TableModel model = table.getModel();
      FileWriter csv = new FileWriter(file);

      for (i = 0; i < model.getColumnCount(); i++) {
        csv.write(model.getColumnName(i) + ",");
      }

      csv.write(System.getProperty("line.separator"));

      for (i = 0; i < model.getRowCount(); i++) {
        for (j = 0; j < (model.getColumnCount()); j++) {
          if (model.getValueAt(i, j) == null) {
            csv.write("" + ",");
          } else {
            csv.write(model.getValueAt(i, j).toString() + ",");
          }
        }
        csv.write(System.getProperty("line.separator"));
      }
      csv.close();
    } catch (IOException e) {
      JOptionPane.showMessageDialog(
          App.mainFrame, "Error saving file '" + file.getName() + "'\n" + e.getLocalizedMessage());
      e.printStackTrace();
    }
  }
  public InventoryController(App view, final Connection connection) {
    this.view = view;
    model = new InventoryModel(connection);
    addItem = new AddItem();

    iSupplierList = addItem.getiSupplierList();
    iProductLineList = addItem.getiProductLineList();
    iSupplierCodeText = addItem.getiSupplierCodeText();
    iUnitPriceText = addItem.getiUnitPriceText();
    iSellingPriceText = addItem.getiSellingPriceText();
    iQtyText = addItem.getiQtyText();
    iThresholdText = addItem.getiThresholdText();
    iCharacteristics = addItem.getiCharacteristicsText();
    iModelText = addItem.getiModelText();
    iDescriptionText = addItem.getiDescriptionText();
    iSearchField = view.getiSearchField();
    iProductsTable = view.getiProductsTable();
    tableModel = (DefaultTableModel) iProductsTable.getModel();
    selectionModel = (ListSelectionModel) iProductsTable.getSelectionModel();
    iProductName = view.getiProductName();
    iItemNumber = view.getiItemNo();
    iAddMotoCode = view.getiAddMotoCode();
    iProductLine = view.getiProductLine();
    iItemDescription = view.getiItemDescription();
    iOnHandQuantity = view.getiOnHandQuantity();
    iStatus = view.getiStatus();
    iSupplier = view.getiSupplier();
    iShowHistory = view.getiShowHistory();
    iEditUpdateRSP = view.getiEditUpdateRSP();
    iEditUpdateUC = view.getiEditUpdateUC();
    iEditUpdateQT = view.getiEditUpdateQT();
    iCancelRSP = view.getiCancelRSP();
    iCancelUC = view.getiCancelUC();
    iCancelQT = view.getiCancelQT();
    iSellingPrice = view.getiSellingPrice();
    iSellingPrice.setDisabledTextColor(Color.BLACK);
    iUnitCost = view.getiUnitCost();
    iUnitCost.setDisabledTextColor(Color.BLACK);
    iQtyThreshold = view.getiThreshold();
    iQtyThreshold.setDisabledTextColor(Color.BLACK);
    iAddNew = view.getiAddNew();
    iAddNewPLine = view.getiAddNewPLine();

    setDefaultViews();
    populate();
    setListeners();
  }
 /**
  * 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;
 }