Package reportgen.ren.executer

Examples of reportgen.ren.executer.QueryExecuterSub


                continue;
            }

            ItemSelectorEditable<QueryExecuterSub> usedSubreports = superReport.getSubReports();
            for(int i=0; i<usedSubreports.size(); i++) {
                QueryExecuterSub col = usedSubreports.get(i);
                if(col.getReportId() == entity.getId()) {
                    throw new ClipsServerException("Отчет '" + col.getReportTitle()
                            + "' не может быть удален, поскольку его использует отчет '"
                            + superReportQuery.getTitle() + "'");
                }
            }
        }
View Full Code Here


            throws ReportException {

        //проверим, что все подотчеты рассчитаны
        ItemSelectorEditable<QueryExecuterSub> subreports = query.getQuery().getSubReports();
        for(int i=0; i<subreports.size(); i++) {
            QueryExecuterSub subquery = subreports.get(i);
            if(subquery.isConstant() || subquery.isResultsIsSet()) {
                //не трогать отчет, который является константой или уже рассчитан
                continue;
            }
            //РЕКУРСИВНО рассчитываем подотчет
            Object result = executeQuery(subquery.getReport());
            if(result instanceof  QueryResults) {
                QueryResults queryResults = (QueryResults) result;
                subquery.setResults(queryResults);
                result = new QueryResultsData(query.getId(), subquery, queryResults);
            }
            //либо подотчет рассчитан, и вернем данные об этом клиенту
            // либо требуется пользовательский ввод
            return result;
View Full Code Here

            return true;
        }

        ItemSelectorEditable<QueryExecuterSub> subreports = query.getQuery().getSubReports();
        for(int i=0; i<subreports.size(); i++) {
            QueryExecuterSub subquery = subreports.get(i);
            if(subquery.isConstant()) {
                //не трогать отчет, который является константой
                continue;
            }

            if(!inputUsed) {
                inputUsed = setInput(subquery.getReport(), input);
            } else {
                // для всех последующих отчетов, кроме данного, корректровать
                // ввод пользователя не обязательно
                // (флаг корректируется при назначении результатов отчета)
                //subquery.getReport().setUserInputIsDone(false);
            }

            if(inputUsed) {
                //для всех последующих отчетов, включая данный, очищаем результаты расчета
                subquery.clearResults();
            }
        }
        return inputUsed;
    }
View Full Code Here

            ed = null;
        }

        JComboBox combo =  (JComboBox) getComponent();
        SubReportTableModel model = (SubReportTableModel) table.getModel();
        final QueryExecuterSub field = model.getField(row);
        ed = new RowCountComboEditor(combo, field.getActiveRows(), true) {
            @Override
            protected void setRowCount(RowCount rowCount) {
                field.setActiveRows(rowCount);
            }
        };
        return combo;
    }
View Full Code Here

    @Override
    public Component getTableCellEditorComponent(JTable table, Object value,
            boolean isSelected, int row, int column) {

        combo.removeAllItems();
        QueryExecuterSub query = subreports.get(row);
        for(int i=0; i<query.getColumnCount(); i++) {
            combo.addItem(query.getColTitle(i));
        }
        combo.setSelectedItem(value);
       
        return super.getTableCellEditorComponent(table, value, isSelected, row, column);
    }
View Full Code Here



    @Override
    public Object getValueAt(int rowIndex, int columnIndex) {
        QueryExecuterSub report = reports.get(rowIndex);
        switch(columnIndex) {
            case COL_TITLE: {
                return report.getReportTitle();
            }
            case COL_SELECTROWS: {
                return report.getActiveRows();
            }
            case COL_SELTITLE: {
                return report.getSelectTitle();
            }
            case COL_SELCOLUMN: {
                return report.getColTitle(report.getSelectColumn());
            }
            case COL_SELDESCRIPTION: {
                return report.getSelectDescription();
            }
            case COL_DEFAULTCHOICE: {
                try {
                    return report.getDefaultValue(report.getSelectColumn());
                } catch (ReportException ex) {
                    return "нет";
                }
            }
            case COL_CONSTANT: {
                return report.isConstant();
            }
            case COL_CANBEOMITTED: {
                return report.isCanBeOmitted();
            }
        }
        return null;
    }
View Full Code Here

        return null;
    }

    @Override
    public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
        QueryExecuterSub report = reports.get(rowIndex);
        switch(columnIndex) {
            case COL_SELECTROWS: {
                //@TODO
                break;
            }
            case COL_SELTITLE: {
                report.setSelectTitle(aValue.toString());
                break;
            }
            case COL_SELCOLUMN: {
                int index = -1;
                try {
                    index = report.getColumnIndex(aValue.toString());
                } catch (ReportException ex) {
                    index = -1;
                }
                if(index != -1) {
                    report.setSelectColumn(index);
                }
                break;
            }
            case COL_SELDESCRIPTION: {
                report.setSelectDescription(aValue.toString());
                break;
            }
            case COL_CONSTANT: {
                try {
                    report.setConstant((Boolean) aValue);
                } catch (ReportException ex) {
                    Message.warning(table, ex);
                }
                break;
            }
            case COL_CANBEOMITTED: {
                report.setCanBeOmitted((Boolean)aValue);
                break;
            }
        }
    }
View Full Code Here

                SubReportChooseDlg dlg = new SubReportChooseDlg(parent, lst);
                dlg.setVisible(true);
                if(dlg.isOK()) {
                    Report selected = dlg.getSelectedReport();
                    ItemSelectorEditable<QueryExecuterSub> subreports = reportQuery.getSubReports();
                    QueryExecuterSub srq = new QueryExecuterSub(
                            selected.getID(), selected.getQuery(), selected.getTitle(),
                            selected.getDescription(), "", "", 1, RowCount.SINGLE);
                    subreports.add(srq);
                    subreportTable.setModel(new SubReportTableModel(subreportTable, subreports));
                    subreportTable.getColumnModel().getColumn(SubReportTableModel.COL_SELCOLUMN)
View Full Code Here

                || subreportTable.getSelectedColumn() != SubReportTableModel.COL_DEFAULTCHOICE) {
            return;
        }

        ItemSelectorEditable<QueryExecuterSub> subreports = reportQuery.getSubReports();
        QueryExecuterSub subreport = subreports.get(subreportTable.getSelectedRow());
        try {
            Report report = queryManager.get(subreport.getReportId());
            Object res = report.execute();
            ReportExecuteDialog dlg = new ReportExecuteDialog(parent);
            while (res instanceof UserInputChunk) {
                UserInputChunk chunk = (UserInputChunk) res;
                dlg.addPanel(new UserInputPanel(chunk));
                dlg.setVisible(true);
                if (dlg.isOK()) {
                    throw new ReportException("Генерация отчета отменена");
                }
                res = report.continueReport(chunk);
            }
            QueryResults results = (QueryResults) res;
            UserChoiceDlg userChoiceDlg = new UserChoiceDlg(parent, results,
                    subreport.getActiveRows(),
                    subreport.getReport().getQuery().getColumns().getList());
            userChoiceDlg.setVisible(true);
            if(userChoiceDlg.isOK()) {
                ArrayList<Integer> selection = userChoiceDlg.getResult();
                if(selection.size() > 0 ) {
                    results.shrinkTo(selection);
                    subreport.setDefaultResults(results);
                } else {
                    subreport.clearDefaultResults();
                }
                subreportTable.updateUI();
            }
        } catch (ReportException ex) {
            Message.warning(this, ex);
View Full Code Here

            public void actionPerformed(ActionEvent e) {
                Object selValue = crossReportCombo.getSelectedItem();
                if(selValue == NOTUSED) {
                    selValue = null;
                }
                QueryExecuterSub newValue = (QueryExecuterSub) selValue;
                QueryExecuterSub oldValue = range.getCrossReport() == null
                        ? null : range.getCrossReport().getSubReport();
                if(oldValue == newValue
                        || (oldValue != null && oldValue.equals(newValue))) {
                    return;
                }
                if(oldValue != null && !range.canRemoveCrossReport(range.getCrossReport())) {
                    crossReportCombo.setSelectedItem(oldValue);
                    Message.warning(parent, "Кросс-отчет иcпользуется и не может быть сменен");
View Full Code Here

TOP

Related Classes of reportgen.ren.executer.QueryExecuterSub

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.