Package presenter

Examples of presenter.CenarioInventarioTableModel


    }

    @Override
    void doCommand() {
        ContainerArvores cenario = ((IEditorView) view).getPresenter().getContainerArvores();
        CenarioInventarioTableModel cenarioTM = ((IEditorView) view).getPresenter().getCenarioTM();
        int coluna = ((IEditorView) view).getPresenter().getColumn();
        if (cenarioTM.getColumnCount() >= 2) {
            if (coluna > 0) {
                try {
                    String nomeColuna = cenario.getHeadersNames(false).get(coluna);
                    Set<Map.Entry<String, String>> formulas = cenario.getHeaderAndFormulas();
                    for (Map.Entry<String, String> entry : formulas) {
                        String col = entry.getKey();
                        String formula = entry.getValue().toLowerCase();
                        if (formula.contains(nomeColuna.toLowerCase())) {
                            throw new Exception("A coluna " + nomeColuna.toUpperCase() + " faz parte da fórmula da coluna "
                                    + col.replace("$" + RFacade.DATAFRAMENAME, "").toUpperCase() + " e não pode ser removida.");
                        }
                    }

                    ((IEditorView) view).getPresenter().getContainerArvores().removeArvoreColumn(nomeColuna);
                    CenarioInventarioTableModel model = ((IEditorView) view).getPresenter().getCenarioTM();
                    TableColumn col = ((IEditorView) view).getGrid().getColumnModel().getColumn(coluna);
                    int columnModelIndex = col.getModelIndex();
                    Vector data = model.getDataVector();
                    Vector colIds = new Vector();
                    for (int i = 0; i < model.getColumnCount(); i++) {
                        colIds.add(model.getColumnName(i));
                    }
                    ((IEditorView) view).getGrid().removeColumn(col);
                    colIds.removeElementAt(columnModelIndex);

                    for (int r = 0; r < data.size(); r++) {
                        Vector row = (Vector) data.get(r);
                        row.removeElementAt(columnModelIndex);
                    }
                    model.setDataVector(data, colIds);

                    Enumeration enum2 = ((IEditorView) view).getGrid().getColumnModel().getColumns();
                    for (; enum2.hasMoreElements();) {
                        TableColumn c = (TableColumn) enum2.nextElement();
                        if (c.getModelIndex() >= columnModelIndex) {
                            c.setModelIndex(c.getModelIndex() - 1);
                        }
                    }
                    ((IEditorView) view).getPresenter().getContainerArvores().removeArvoreColumn(nomeColuna);
                    model.fireTableStructureChanged();
                } catch (Exception ex) {
                    Logger.getLogger(EditorPresenter.class.getName()).log(Level.SEVERE, null, ex);
                    JOptionPane.showMessageDialog(view, ex.getMessage(), "Erro", JOptionPane.ERROR_MESSAGE);
                }
            } else {
View Full Code Here

TOP

Related Classes of presenter.CenarioInventarioTableModel

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.