Package reportgen.prototype.entity

Examples of reportgen.prototype.entity.QEntity


        return (QEntity) path.getLastPathComponent();
    }

    private void mainTreeValueChanged(javax.swing.event.TreeSelectionEvent evt) {//GEN-FIRST:event_mainTreeValueChanged
        try {
            QEntity ren = getSelectedReportEntity();
            if(ren == null) {
                throw new IllegalStateException();
            }
            delReportEntityBtn.setEnabled(true);

            leftJoinCheck.setEnabled(ren.canBeJoined());
            leftJoinCheck.setSelected(ren.isJoined());

        } catch (IllegalStateException ex) {
            delReportEntityBtn.setEnabled(false);
            leftJoinCheck.setEnabled(false);
View Full Code Here


    private void addReportEntityBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addReportEntityBtnActionPerformed
        TreePath path = mainTree.getSelectionPath();
        TreePath newpath = null;
        ReportEntityModel model = (ReportEntityModel) mainTree.getModel();

        QEntity children[] = null;
        if(path == null) {
            if(core.getRoot() != null) {
                Message.warning(this, "Выберите элемент для связи");
                return;
            }
            children = entitySet.getAvailableEntities(core.getContextGroup());
        } else {
            QEntity ren = (QEntity) path.getLastPathComponent();
            children = ren.getAvialiableEntities();
        }

        if(children == null) {
            Message.warning(this, "У данного объекта нет связанных сущностей");
            return;
        }

        ArrayList<QEntity> childrenList = new ArrayList<QEntity>();
        ArrayList<QEntity> originalList = new ArrayList<QEntity>();
        for(QEntity child: children) {
            childrenList.add(child);
            originalList.add(child);
        }
        Collections.sort(childrenList, new Comparator<QEntity>() {
            @Override
            public int compare(QEntity o1, QEntity o2) {
                return o1.toString().compareTo(o2.toString());
            }
        });
        NewReportEntityDlg dlg = new NewReportEntityDlg(parent, childrenList);
        dlg.setVisible(true);
        if(dlg.isOK()) {
            int index = dlg.getSelectedIndex();
            QEntity selectedEntity = childrenList.get(index);

            if(path == null) {
                core.setRoot(selectedEntity);
                mainTree.setModel(new  ReportEntityModel(selectedEntity));
                newpath = new TreePath(selectedEntity);
            } else {
                QEntity parentEntity = (QEntity) path.getLastPathComponent();
                index = originalList.indexOf(selectedEntity);
                parentEntity.addSelectedEntity(index);

                ArrayList<Object> newTreePath = new ArrayList<Object>();
                for(Object obj: path.getPath()) {
                    newTreePath.add(obj);
                }
View Full Code Here

        if(path == null) {
            Message.warning(this, "Выберите объект в дереве для удаления");
            return;
        }

        QEntity ren = (QEntity) path.getLastPathComponent();
        if(ren.getSelectedEntities() != null) {
            Message.warning(this, "Можно удалять только конечные элементы");
            return;
        }

        try {
            if (path.getPathCount() == 1) {
                core.removeEntity(null, ren);
                mainTree.setModel(new ReportEntityModel(null));

            } else {
                TreePath parentPath = path.getParentPath();
                QEntity parentEnt = (QEntity) parentPath.getLastPathComponent();

                QEntity[] children = parentEnt.getSelectedEntities();
                for (int i = 0; i < children.length; i++) {
                    if (children[i] == ren) {
                        core.removeEntity(parentEnt, ren);

                        ReportEntityModel model = (ReportEntityModel) mainTree.getModel();
View Full Code Here

        if(path == null) {
            Message.warning(this, "Выберите объект в дереве");
            return;
        }

        QEntity ren = (QEntity) path.getLastPathComponent();
        if(!ren.canBeJoined()) {
            leftJoinCheck.setEnabled(false);
        } else {
            ren.setJoined(leftJoinCheck.isSelected());
        }
        mainTree.updateUI();
    }//GEN-LAST:event_leftJoinCheckActionPerformed
View Full Code Here

    }

    @Override
    public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) {
        JLabel label  = (JLabel) super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
        QEntity entity = (QEntity) value;

        if(entity.isJoinedAnywere()) {
            if(join != null) {
                label.setIcon(join);
            }
        } else if(entity.canBeJoined()) {
            if(join != null) {
                label.setIcon(canBeJoined);
            }
        }
        return label;
View Full Code Here

    private List<QEntity> children(Object parent) {
        if(parent == null) {
            return new ArrayList<QEntity>();
        }
        QEntity par = (QEntity) parent;
        List<QEntity> children = map.get(par);
        if(children == null) {
            children = new ArrayList<QEntity>();
            QEntity[] selEnts = par.getSelectedEntities();
            if(selEnts != null) {
                for(QEntity en: selEnts) {
                    children.add(en);
                }
            }
View Full Code Here

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

private void mainListValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_mainListValueChanged
    QEntity ren = (QEntity) mainList.getSelectedValue();
    if(ren != null) {
        description.setText(ren.getDescription() != null
                ? ren.getDescription() : "нет описания");

        QEntity[] availEntities = ren.getAvialiableEntities();
        if(availEntities != null) {
            itemList.setModel(new DefaultComboBoxModel(availEntities));
        } else {
            itemList.setModel(new DefaultComboBoxModel());
        }
        simpleItemList.setModel(new DefaultComboBoxModel(ren.getAvialiableProperties().toArray()));
    } else {
        description.setText("");
       
        DefaultListModel model = new DefaultListModel();
        itemList.setModel(model);
View Full Code Here

     * Возвращает список всех доступных для отчета сущностей
     * @return
     */
    @Override
    public QEntity[] getAvailableEntities(ContextGroup coreContextGroup) {
        QEntity res[] = new QEntity[reportSet.size()];
        int i=0;
        for(Class keyClass : reportSet) {
            res[i++] = new QueryEntity(keyClass, coreContextGroup);
        }
        return res;
View Full Code Here

   public MathExpressionEntityFieldRef(Element element, Context context) throws ReportException {
        super(element, context);
        String fullname = getStringAttribute(element, ATTR_VALUE);
        int aliaspos = fullname.indexOf('.');
        Atom atom = new Atom(fullname.substring(0, aliaspos));
        QEntity entity = context.getEntity(atom);
       
        String propertyName = fullname.substring(aliaspos+1);
        ContextGroup contextGroup = getContextGroup(entity.getContextGroup());
        property = context.getProperty(contextGroup, entity, propertyName);
    }
View Full Code Here

   public MathExpressionEntityMethodRef(Element element, Context context) throws ReportException {
        super(element, context);
        String fullname = getStringAttribute(element, ATTR_VALUE);
        int aliaspos = fullname.indexOf('.');
        Atom atom = new Atom(fullname.substring(0, aliaspos));
        QEntity entity =  context.getEntity(atom);

        String propertyName = fullname.substring(aliaspos+1);
        ContextGroup contextGroup = getContextGroup(entity.getContextGroup());
        property = context.getProperty(contextGroup, entity, propertyName);
    }
View Full Code Here

TOP

Related Classes of reportgen.prototype.entity.QEntity

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.