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();
}
}