コード例 #1
0
  private void jButtonQueryActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_jButtonQueryActionPerformed

    ReportQueryDialog rqd = new ReportQueryDialog(MainFrame.getMainInstance(), true);
    rqd.setSubDataset(this.getSubDataset());
    rqd.setVisible(true);
    jRTextExpressionAreaFilterExpression.setText(rqd.getSubDataset().getFilterExpression());
  } // GEN-LAST:event_jButtonQueryActionPerformed
コード例 #2
0
  public String designQuery(
      IReportConnection con, String query, ReportQueryDialog reportQueryDialog)
      throws JRException, UnsupportedOperationException {
    // Start FREE QUERY BUILDER....
    QueryBuilderDialog qbd =
        new QueryBuilderDialog(
            (reportQueryDialog != null) ? reportQueryDialog : new JDialog(), true);

    if (con.isJDBCConnection()) {
      qbd.setConnection(con.getConnection());
    }

    try {

      if (query != null && query.length() > 0) {
        qbd.setQuery(query);
      }
    } catch (Throwable ex) {
      if (reportQueryDialog != null) {
        reportQueryDialog
            .getJLabelStatusSQL()
            .setText("I'm sorry, I'm unable to parse the query...");
        ex.printStackTrace();
      }
      ex.printStackTrace();
      return null;
    }
    qbd.setVisible(true);

    if (qbd.getDialogResult() == JOptionPane.OK_OPTION) {
      return qbd.getQuery();
    }
    return null;
  }