private TextGrid createGrid() { TextGrid grid = new TextGrid(); grid.getData().setHeaderSeparatorChar('='); grid.getData().setTitle("Sincronização de Extrato banco \"" + banco.getNome() + "\""); TextGridFormattedColumn.createFormattedColumn( grid, "", new ToStringFormatter(""), TextGridColumnAlignment.CENTER, "getStatusLinha"); TextGridFormattedColumn.createFormattedColumn( grid, "Date", TextGridFormattedColumn.DATE_FORMATTER, TextGridColumnAlignment.LEFT, "getOriginalDate"); TextGridFormattedColumn.createFormattedColumn( grid, "Original", TextGridFormattedColumn.STRING_FORMATTER, TextGridColumnAlignment.LEFT, "getLinhaOriginal"); TextGridFormattedColumn.createFormattedColumn( grid, "", new ToStringFormatter(""), TextGridColumnAlignment.CENTER, "getLancamentoStatus"); TextGridFormattedColumn.createFormattedColumn( grid, "Lancamento", TextGridFormattedColumn.STRING_FORMATTER, TextGridColumnAlignment.LEFT, "getLancamento"); return grid; }
@Override public Object run(ExtratoAnalyseSwitches switches) throws ExtratoAnalyseException { checkParamValid(switches); manualRefList = makeManualRefList(switches); banco = getConta(switches.getNomeBanco()); List<Lancamento> lancamentoSemExtratoList = getLancamentoSemExtratoList(); List<ExtratoLancamento> extratoLancamentoOrfao = getExtratoLancamentoOrfao(banco); if (extratoLancamentoOrfao.size() == 0) { System.out.println(); System.out.println( "Nenhum item de extrato órfão encontrado para o banco \"" + banco.getNome() + "\"."); return null; } TextGrid grid = createGrid(); List<ExtratoLineAnalyseResult> statuses; try { statuses = makeSync(lancamentoSemExtratoList, extratoLancamentoOrfao, switches); } catch (ExtratoLineParserException e) { throw new ExtratoAnalyseException(e); } grid.setValues(statuses); try { grid.show(); } catch (TextGridException e) { throw new ExtratoAnalyseException(e); } System.out.println(); System.out.println("Legenda:"); System.out.println(" - : Não se aplica."); System.out.println(" U : Update."); System.out.println(" * : Insert."); System.out.println(" X : Delete."); System.out.println(" ! : Conta não encontrada."); return null; }
@Override public Object run(LancamentoModeloListSwitches switches) throws TextGridException, LancamentoModeloListException { List<LancamentoModelo> lancamentoModeloList = getLancamentosPorModelo(switches); Contabilizador contabilizador = new Contabilizador(); Packer<LancamentoModeloContabilizavel, LancamentoModelo> packager = new LancamentoModeloPacker(); List<LancamentoModeloContabilizavel> lancamentoContabilizavelList = contabilizador.packageList(lancamentoModeloList, packager); contabilizador.setList(lancamentoContabilizavelList); contabilizador.contabilizar(); calcTotalLancamentos(lancamentoContabilizavelList); calcStatistics(lancamentoContabilizavelList); Map<Conta, Double> saldos = contabilizador.getSaldosPorConta(); TextGrid grid = getGrid(); grid.setValues(lancamentoContabilizavelList); grid.show(); System.out.println(); System.out.println(); System.out.println("-- Saldos: --"); System.out.println(); for (Conta conta : saldos.keySet()) { System.out.println("===> " + conta.getNome() + ": " + saldos.get(conta)); } return null; }
private static void createGrid() { LancamentoModeloListAction.grid = new TextGrid(); grid.getData().setHeaderSeparatorChar('='); grid.getData().setTitle("Lista de Lançamentos"); TextGridFormattedColumn.createFormattedColumn( grid, "id", TextGridFormattedColumn.ID_FORMATTER, TextGridColumnAlignment.RIGHT, "getId"); TextGridFormattedColumn.createFormattedColumn( grid, "Modelo", ControleFinanceiroFormatters.MODELO_FORMATTER, TextGridColumnAlignment.LEFT, "getModelo"); TextGridFormattedColumn.createFormattedColumn( grid, "Vencimento", TextGridFormattedColumn.INTEGER_FORMATTER, TextGridColumnAlignment.LEFT, "getDiaVencimento"); TextGridFormattedColumn.createFormattedColumn( grid, "Conta Origem", ControleFinanceiroFormatters.CONTA_FORMATTER, TextGridColumnAlignment.RIGHT, "getContaOrigem"); TextGridFormattedColumn.createFormattedColumn( grid, "Conta Destino", ControleFinanceiroFormatters.CONTA_FORMATTER, TextGridColumnAlignment.LEFT, "getContaDestino"); TextGridFormattedColumn.createFormattedColumn( grid, "Valor", TextGridFormattedColumn.MONEY_FORMATTER, TextGridColumnAlignment.RIGHT, "getValor"); TextGridFormattedColumn.createFormattedColumn( grid, "Observação", TextGridFormattedColumn.STRING_FORMATTER, TextGridColumnAlignment.LEFT, "getObservacao"); TextGridFormattedColumn.createFormattedColumn( grid, "% Receita", TextGridFormattedColumn.PERCENT_FORMATTER, TextGridColumnAlignment.RIGHT, "getPorcentualReceita"); TextGridFormattedColumn.createFormattedColumn( grid, "Acumulado", TextGridFormattedColumn.PERCENT_FORMATTER, TextGridColumnAlignment.RIGHT, "getPorcentualReceitaAcumulado"); TextGridFormattedColumn.createFormattedColumn( grid, "% Despesa", TextGridFormattedColumn.PERCENT_FORMATTER, TextGridColumnAlignment.RIGHT, "getPorcentualDespesa"); TextGridFormattedColumn.createFormattedColumn( grid, "Acumulado", TextGridFormattedColumn.PERCENT_FORMATTER, TextGridColumnAlignment.RIGHT, "getPorcentualDespesaAcumulado"); }