@Override public void salvar() { try { if (this.criterioController.salvar(criterioForm.getCriterio())) { removeComponent(getComponent()); addComponent(modoLayoutTable); setComponent(modoLayoutTable); MessageBox mb = new MessageBox( getWindow(), "Cadastrar", MessageBox.Icon.INFO, "Criterio Cadastrado", new MessageBox.ButtonConfig(ButtonType.OK, "Ok")); mb.show(); buttonAdicionar.setVisible(true); buttonDeletar.setVisible(false); buttonClonar.setVisible(false); buttonEditar.setVisible(false); buttonSalvar.setVisible(false); buttonVoltar.setVisible(false); } else { } } catch (Exception e) { System.out.println("ERRO SALVAR"); msg("Erro ao salvar " + e.getMessage(), MessageBox.Icon.ERROR); } }
@Override public void editar() { try { if (this.criterioController.alterar(criterioForm.getCriterio())) { removeComponent(getComponent()); addComponent(modoLayoutTable); setComponent(modoLayoutTable); isRemover = true; MessageBox mb = new MessageBox( getWindow(), "Alterar", MessageBox.Icon.INFO, "Criterio Alterado", new MessageBox.ButtonConfig(ButtonType.OK, "Ok")); mb.show(); buttonAdicionar.setVisible(true); buttonDeletar.setVisible(false); buttonClonar.setVisible(false); buttonEditar.setVisible(false); buttonSalvar.setVisible(false); buttonVoltar.setVisible(false); } else { } } catch (Exception e) { msg(e.getMessage(), MessageBox.Icon.ERROR); } }
@Override public void remover(Object target) { if (isRemover) { Criterio topico = (Criterio) target; System.out.println("remover target" + " " + topico.getId()); this.criterioController.remover(topico.getId()); } else { try { MessageBox mb = new MessageBox( getWindow(), "Remover", MessageBox.Icon.QUESTION, "Remover Criterio?", new MessageBox.ButtonConfig(MessageBox.ButtonType.YES, "Sim"), new MessageBox.ButtonConfig(MessageBox.ButtonType.NO, "Nao")); mb.show( new MessageBox.EventListener() { public void buttonClicked(ButtonType buttonType) { if (buttonType.equals(buttonType.YES)) { criterioController.removerButton(criterioForm.getCriterio()); removeComponent(getComponent()); addComponent(modoLayoutTable); setComponent(modoLayoutTable); isRemover = true; buttonAdicionar.setVisible(true); buttonDeletar.setVisible(false); buttonClonar.setVisible(false); buttonEditar.setVisible(false); buttonSalvar.setVisible(false); buttonVoltar.setVisible(false); MessageBox mb = new MessageBox( getWindow(), "Remover", MessageBox.Icon.INFO, "Criterio Removido", new MessageBox.ButtonConfig(ButtonType.OK, "Ok")); mb.show(); } else { } } }); } catch (Exception e) { msg("remover.view.button: " + e.getMessage(), MessageBox.Icon.ERROR); } } }
public void msg(String e, Icon icon) { MessageBox mb = new MessageBox( getWindow(), "Erro", icon, e, new MessageBox.ButtonConfig(ButtonType.OK, "Ok")); mb.show(); }