Package reportgen.prototype.columns

Examples of reportgen.prototype.columns.QueryResultColumn


    @Override
    public Component getTableCellEditorComponent(JTable table, Object value,
            boolean isSelected, int row, int column) {
        ColumnsTableModel model = (ColumnsTableModel) table.getModel();
        QueryResultColumn field = model.getField(row);

        combo.setSelectedItem(new ColumnPriority(field.getOrderPriority()));
        return combo;
    }
View Full Code Here


    @Override
    public Component getTableCellEditorComponent(JTable table, Object value,
            boolean isSelected, int row, int column) {
        ColumnsTableModel model = (ColumnsTableModel) table.getModel();
        QueryResultColumn field = model.getField(row);

        try {
            Object[] options = field.getContext().getAggregFunctions(field.getCls()).toArray();
            combo.setModel(new DefaultComboBoxModel(options));
            combo.setSelectedItem(field.getFunction());
        } catch (ReportException ex) {
            combo.addItem(AggregateFunction.ASIS);
            Message.warning(combo, "Выражение некорректно", ex);
        }
       
View Full Code Here

                .addContainerGap())
        );
    }// </editor-fold>//GEN-END:initComponents

    private void addResultColBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addResultColBtnActionPerformed
        QueryResultColumn exp = new QueryResultColumn(core.getResultContext());
        ComplexExpressionDialog dlg = new ComplexExpressionDialog(parent, exp.getExpression());

        dlg.setVisible(true);
        if(dlg.isOK()) {
            ItemSelectorEditable<QueryResultColumn> cols = core.getColumns();
            cols.add(exp);
View Full Code Here

            ItemSelectorEditable<QueryResultColumn> fields = core.getColumns();
            int index = resultColTable.getSelectionModel().getLeadSelectionIndex();
            if(index == -1) {
                return;
            }
            QueryResultColumn exp = fields.get(index);
            ComplexExpressionDialog dlg = new ComplexExpressionDialog(parent, exp.getExpression());

            dlg.setVisible(true);
            if(dlg.isOK()) {
                resultColTable.updateUI();
            }
View Full Code Here

        List<QEntity> options = context.getEntities(groupContext);
        for (QEntity entity : options) {
            for(QEntityProperty prop: context.getProperties(MathExpressionEntityMethodRef.GROUP, entity)) {
                boolean alreadyContains = false;
                for(int i=0; i<cols.size() && !alreadyContains; i++) {
                    QueryResultColumn mec = cols.get(i);
                    if(isContainProperty(mec.getExpression(), prop)) {
                        alreadyContains = true;
                        break;
                    }
                }
                if (alreadyContains) {
                    continue;
                }

                QueryResultColumn col = new QueryResultColumn(context);
                col.setColTitle(prop.toString());
                col.getExpression().getChildren().add(new MathExpressionEntityMethodRef(prop, context)
                );

                cols.add(col);
            }
        }
View Full Code Here

        return true;
    }
   
    @Override
    public Object getValueAt(int row, int col) {
        QueryResultColumn ren = properties.get(row);
        switch(col) {
            case COL_OPERATOR: {
                 return ren.getFunction();
            }
            case COL_TITLE: {
                Object val = ren.getColTitle();
                if(val != null) {
                    return val;
                }
                break;
            }
            case COL_ORDERPRIORITY: {
                return new ColumnPriority(ren.getOrderPriority());
            }
        }
        return null;
    }
View Full Code Here

        return null;
    }

    @Override
    public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
        QueryResultColumn ren = properties.get(rowIndex);
        switch(columnIndex) {
            case COL_OPERATOR: {
                ren.setFunction((AggregateFunction) aValue);
                break;
            }
            case COL_TITLE: {
                String newTitle = aValue.toString().trim();
                for(int i=0; i<properties.size(); ) {
                    if(i == rowIndex) {
                        i++;
                        continue;
                    }
                    if(newTitle.equals(properties.get(i).getColTitle())) {
                        newTitle += " (копия)";
                        i=0;
                    } else {
                        i++;
                    }
                }
                ren.setColTitle(newTitle);
                break;
            }
            case COL_ORDERPRIORITY: {
                if(aValue instanceof ColumnPriority) {
                    ColumnPriority cp = (ColumnPriority) aValue;
                    ren.setOrderPriority(cp.getValue());
                }
                break;
            }
        }
    }
View Full Code Here

                throw new ReportException("Результаты выборки '" + core.getTitle()
                    + "' не соответствуют результатам отчета");
            }

            for(int j=0; j<coreColumns.size(); j++) {
                QueryResultColumn coreCol = coreColumns.get(j);
                ReportResultColumn resultCol = results.get(j);
                Class coreCls = coreCol.getCls();
                Class resCls = resultCol.getCls();
                if(resCls == null) {
                    throw new ReportException("Результаты выборки '" + coreCol.getColTitle()
                        + "' не может быть равен null");
                } else if (coreCls != null && !coreCls.equals(resCls)) {
                    throw new ReportException("Результаты выборки '" + coreCol.getColTitle()
                        + "' не соответствует результату отчета по типу ("
                        + coreCol.getCls().getSimpleName() + " != "
                        + resultCol.getCls().getSimpleName() + ")");
                }
            }
        }
    }
View Full Code Here

                    throw new ReportException("Выборки отличаются количеством результатов");
                }
            }
            ResultColumnList results = query.getColumns();
            for(int j=0; j<cols.size(); j++) {
                QueryResultColumn col = cols.get(j);
                if(results.size() <= j) {
                    ReportResultColumn result = new ReportResultColumn(query.getUnionContext(new NoNeedAtom()));
                    result.setColClass(col.getCls());
                    result.setTitle(col.getColTitle());
                    results.add(result);
                } else {
                    ReportResultColumn result = results.get(j);
                    Class colClass = col.getCls();
                    Class resClass = result.getCls();
                    if(colClass != null &&
                            (resClass == null || !colClass.equals(resClass))) {
                        int res = JOptionPane.showConfirmDialog(this, "Класс результата №" + j
                                + "отличается от результата выборки. Заменить?",
View Full Code Here

TOP

Related Classes of reportgen.prototype.columns.QueryResultColumn

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.