示例#1
0
  public void addRow(String name, java.util.Date modified, String base64) {
    logger.debug("addRow(" + name + ")");
    Vector row;
    try {
      Vector params = new Vector(6);
      params.add(name);
      params.add(modified);
      params.add(base64);
      params.add(id_obj);
      row = (Vector) xmlClient.execute("DateiHandler.insertDatei", params);
    } catch (XmlRpcException e) {
      MsgBox.error(e.getMessage());
      return;
    }

    Integer id = (Integer) row.elementAt(0);
    String thumb = (String) row.elementAt(1);

    Vector rowData = new Vector();
    if (thumb != null) {

      rowData.add(new ImageIcon(Base64.decode(thumb.getBytes())));

    } else {
      rowData.add(new ImageIcon());
    }

    rowData.add(name);
    rowData.add("");
    rowData.add(modified);
    rowData.add(id);
    rows.addElement(rowData);
    fireTableDataChanged();
  }
示例#2
0
  public boolean loadData(Integer id) {
    try {
      Vector params = new Vector(1);
      params.add(id);
      rows = (Vector) xmlClient.execute("DateiHandler.getDateien", params);
      rows.trimToSize();
      Iterator it = rows.iterator();
      while (it.hasNext()) {
        Vector row = (Vector) it.next();
        String thumb = (String) row.elementAt(0);
        if (thumb != null) {
          ImageIcon i = new ImageIcon(Base64.decode(thumb.getBytes()));
          row.setElementAt(i, 0);
        }
      }
      logger.debug("DateiTableModel filled with " + getRowCount() + " records.");
      this.id_obj = id;
      return true;

    } catch (XmlRpcException e) {
      MsgBox.error(e.getMessage());
      return false;
    }
  }