Package business

Examples of business.CenarioVolume


    public void testFindCenario() throws Exception {
        long tempoInicialT = System.currentTimeMillis();
        ProjetoDAO dao = new ProjetoDAO();
        dao.connect();
        Projeto p = dao.find(1);
        CenarioVolume c = p.getCenarioById(1);
        System.out.println(c);
        assertNotNull(c);
        dao.close();
        long tempoFinalT = System.currentTimeMillis();
        System.out.printf("Tempo: %.3f ms%n", (tempoFinalT - tempoInicialT) / 1000d);
View Full Code Here


    public void testUpdateProjeto() throws Exception {
        final ProjetoDAO dao = new ProjetoDAO();
        dao.connect();
        Projeto projeto = dao.find(1);
        projeto.setDescricao("Uma descrição");
        CenarioVolume cenario = new CenarioVolume(projeto.getNewCenarioVolumeId());
        cenario.setNome("c1");
        projeto.addCenario(cenario);
        System.out.println(projeto);
        //dao.save(projeto);
        dao.update(projeto, true, projeto.getId());
    }
View Full Code Here

        final TreeSet<CenarioVolume> cenarios = new TreeSet<>();
        db.query(new Predicate<Projeto>() {

            @Override
            public boolean match(final Projeto projeto) {
                CenarioVolume cenario = null;
                Iterator<CenarioVolume> it = projeto.getIteratorCenario();
                while (it.hasNext()) {
                    cenario = it.next();
                    if ((projeto.getId() == proj.getId()) && (cenario.getId() == idCenario)) {
                        cenarios.add(cenario);
                        return true;
                    }
                }
                return false;
            }
        });
        if (!cenarios.isEmpty()) {
            return cenarios.first();
        }
        return new CenarioVolume(proj.getNewCenarioVolumeId());
    }
View Full Code Here

        //throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void salvarCenario(Main main) throws Exception {
        CenarioVolume cenario = new CenarioVolume(main.getProjeto().getNewCenarioVolumeId());
        cenario.setNome(view.getTxtCenario().getText());

        ProjetoDAO projetoDAO = new ProjetoDAO();
        projetoDAO.connect();

        main.getProjeto().addCenario(cenario);
View Full Code Here

        IconNode volumeNode = new IconNode("Volume", true, new ImageIcon(Configuracao.getPath() + "images/cenario.png"), IconNode.NONE);

        Iterator<CenarioVolume> itCenariosVolume = view.getProjeto().getIteratorCenario();
        while (itCenariosVolume.hasNext()) {
            CenarioVolume cenarioVolume = itCenariosVolume.next();
            IconNode cenarioNode = new IconNode(cenarioVolume.getNome(), true, new ImageIcon(Configuracao.getPath() + "images/cenario2.png"), IconNode.CENARIO_VOLUME, cenarioVolume.getId());
            IconNode arvoresNode = new IconNode("Árvores", false, new ImageIcon(Configuracao.getPath() + "images/arvores.png"), IconNode.ARVORES, cenarioVolume.getId());
            cenarioNode.add(arvoresNode);
            volumeNode.add(cenarioNode);
        }

        IconNode indiceLocalNode = new IconNode("Índice de Local", true, new ImageIcon(Configuracao.getPath() + "images/indice.png"), IconNode.NONE);
View Full Code Here

    @Override
    public void doEntry() {
        ProjetoDAO dao = new ProjetoDAO();
        dao.connect();
        Projeto projeto = dao.find(idProjeto);
        CenarioVolume cenario = projeto.getCenarioById(idCenario);

        view.getTxtCenario().setText(cenario.getNome());

        dao.close();
        projeto = null;
        cenario = null;
        view.setTitle("Alterar dados básicos do cenário");
View Full Code Here

    }

    private void duplicaColecao() throws Exception {
        if (view.getCmbCenarioOrigem().getSelectedIndex() >= 0) {
            projetoDAO.connect();
            CenarioVolume from = main.getProjeto().getCenarioByName((view.getCmbCenarioOrigem().getSelectedItem().toString()));
            if (from.getTotalArvores() == 0) {
                projetoDAO.close();
                throw new Exception("Não existem árvores no cenário de origem.");
            } else {
                if (main.getProjeto().contains(view.getTxtCenarioDestino().getText())) {
                    view.getTxtCenarioDestino().setText(null);
                    projetoDAO.close();
                    throw new Exception("Existe um cenário com este nome. Selecione outro.");
                } else {
                    CenarioVolume novoCenario = new CenarioVolume(main.getProjeto().getNewCenarioVolumeId());
                    novoCenario.addArvores(new ArrayList<>(from.getArvores()));
                    novoCenario.setNome(view.getTxtCenarioDestino().getText());
                    Projeto projeto = projetoDAO.find(main.getProjeto().getId());
                    projeto.addCenario(novoCenario);
                    projetoDAO.update(projeto, false, projeto.getId());
                    projetoDAO.close();
                    main.setProjeto(projeto);
View Full Code Here

                                if (noSelecionado.equals("Projeto")) {
                                    ProjetoPresenter projetoPresenter = new ProjetoPresenter(Main.this);
                                    projetoPresenter.setStrategy(new EdicaoProjeto(projeto.getId(), projetoPresenter.getView()));
                                    activePanel(projetoPresenter.getView());
                                } else if ((((ImageIcon) no.getIcon()).getDescription().contains("cenario2.png"))) {
                                    CenarioVolume cenario = projeto.getCenarioById(no.getId());
                                    CenarioVolumePresenter presenterEditaCenario = new CenarioVolumePresenter(Main.this);
                                    removeFrameVolume();
                                    presenterEditaCenario.setStrategy(new EdicaoCenario(projeto.getId(), cenario.getId(), presenterEditaCenario.getView()));
                                    activePanel(presenterEditaCenario.getView());
                                } else {
                                    desktop.removeAll();
                                    desktop.updateUI();
                                }
View Full Code Here

TOP

Related Classes of business.CenarioVolume

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.