コード例 #1
0
  /**
   * Diese Methode liefert den Inhalt einer Zelle zurück.
   *
   * @param int Reihe der Zelle.
   * @param int Spalte der Zelle.
   * @return Object Wert der Zelle.
   * @author Alpay Firato
   */
  public Object getValueAt(int row, int col) {
    Termin ter = (Termin) objects.get(row);

    if (ter == null) return null;
    else if (col == 0) return ter.getSecondaryTitle();
    else if (col == 1) return ter.getDescription();
    else if (col == 2) return ter.getDate();
    else if (col == 3) return ter.getDuration();
    else return null;
  }
コード例 #2
0
  /**
   * Diese Methode liest die Daten von der lokalen Datenbank mit Hilfe des Generic-DAO aus. Danach
   * werden alle Objekte, die aus der Datenbank ausgelwsen worden sind, in eine Liste gespeichert.
   * Die Datensätze werden nach order geordnet.
   *
   * @author Alpay Firato
   */
  private void readData() {
    String query =
        "select * from TERMIN as t, ATTACHABLE_OBJECT_KATEGORIE as ok, TERMIN_KATEGORIE as kat where t.TERMIN_KATEGORIE_ID = kat.id AND t.GROUP_ID = ok.id";
    try {
      GenericDAO gdo = new GenericDAO();
      if (searchObject != null) {
        if (searchObject.getSecondaryTitle() != null) {
          query +=
              " AND LOWER(t.SECONDARY_TITLE) LIKE '%"
                  + searchObject.getSecondaryTitle().toLowerCase()
                  + "%'";
        }
        if (searchObject.getDescription() != null) {
          query +=
              " AND LOWER(t.DESCRIPTION) LIKE '%"
                  + searchObject.getDescription().toLowerCase()
                  + "%'";
        }
        if (this.datum != null) {
          query += " AND t.DATE LIKE '%" + this.datum + "%'";
        }
        if (this.type != null && !this.type.equals("-")) {
          query += " AND kat.NAME = '" + this.type + "'";
        }
        if (this.group != null && !this.group.equals("-")) {
          query += " AND ok.TITLE = '" + this.group + "'";
        }
        if (this.order != null) {
          query += " ORDER BY " + columnDBName[this.order];
        }

        this.objects = gdo.unsafeQuery(query, searchObject);
      }
    } catch (Exception e) {
      JOptionPane.showMessageDialog(
          null, "Error: " + e.toString(), "Error!", JOptionPane.ERROR_MESSAGE);
    }
  }