Package main.states

Source Code of main.states.ProjetoFechado

package main.states;

import javax.swing.tree.DefaultTreeModel;
import main.Main;
import view.helpers.IconNode;

public class ProjetoFechado extends AbstractMainState {

    public ProjetoFechado(Main view) {
        super(view);
    }

    @Override
    public void doEntry() {

        view.getBtnVolumeNovoCenario().setEnabled(false);
        view.getBtnVolumeDuplicarCenario().setEnabled(false);
        view.getBtnIndLocalNovoCenario().setEnabled(false);
        view.getBtnFecharProjeto().setEnabled(false);
        view.getBtnAbrirProjeto().setEnabled(true);
        view.getBtnNovoProjeto().setEnabled(true);
        view.getTreeNavigator().setEnabled(false);
        super.removeItemSb();
    }

    @Override
    public void abrirProjeto() {
        view.setViewState(new ProjetoAberto(view));
        view.getViewState().abrirProjeto();
    }

    @Override
    public void fecharProjeto() {
        if (view.getProjetoDAO().isConnected()) {
            view.getProjetoDAO().close();
        }
        this.updateTreeModel();
        view.getTreeNavigator().expandPath(view.getTreeNavigator().getLeadSelectionPath());
        view.getDesktop().closeAll();
    }

    @Override
    public void updateTreeModel() {
        IconNode projetoNode = new IconNode("", false, null, 0);
        DefaultTreeModel model = new DefaultTreeModel(projetoNode);

        view.getTreeNavigator().setModel(model);
        view.getTreeNavigator().updateUI();
    }
}
TOP

Related Classes of main.states.ProjetoFechado

TOP
Copyright © 2018 www.massapi.com. 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.