public void dynamicDisplay() { if (toolbarButton.getParent() == null) return; String displayLogic = mToolbarButton.getDisplayLogic(); if (displayLogic == null || displayLogic.trim().length() == 0) return; boolean visible = Evaluator.evaluateLogic(this, displayLogic); toolbarButton.setVisible(visible); }
// Accion del formulario si es nuevo o consultar // public void accionForm(boolean sw, String accion) throws Exception { groupboxConsulta.setVisible(!sw); groupboxEditar.setVisible(sw); if (!accion.equalsIgnoreCase("registrar")) { buscarDatos(); btGuardar.setVisible(false); } else { btGuardar.setVisible(true); // buscarDatos(); limpiarDatos(); } tbxAccion.setValue(accion); }
public Listitem crearFilas(Object objeto, Component componente) throws Exception { Listitem fila = new Listitem(); final Maestro_manual maestro_manual = (Maestro_manual) objeto; fila.appendChild(new Listcell(maestro_manual.getId_manual() + "")); fila.appendChild(new Listcell(maestro_manual.getManual() + "")); fila.appendChild( new Listcell( Utilidades.getNombreElemento( maestro_manual.getTipo_manual(), "tipo_manual", getServiceLocator()))); fila.appendChild( new Listcell( Utilidades.getNombreElemento( maestro_manual.getTipo_moneda(), "tipo_moneda", getServiceLocator()))); Hlayout hlayout = new Hlayout(); fila.setStyle("text-align: justify;nowrap:nowrap"); Toolbarbutton toolbarbutton = new Toolbarbutton("Editar"); toolbarbutton.setImage("/images/editar.gif"); toolbarbutton.setTooltiptext("Editar registro"); toolbarbutton.addEventListener( Events.ON_CLICK, new EventListener<Event>() { @Override public void onEvent(Event arg0) throws Exception { mostrarDatos(maestro_manual); } }); hlayout.appendChild(toolbarbutton); toolbarbutton = new Toolbarbutton("Eliminar"); toolbarbutton.setImage("/images/borrar.gif"); toolbarbutton.setTooltiptext("Eliminar registro"); toolbarbutton.addEventListener( Events.ON_CLICK, new EventListener<Event>() { @Override public void onEvent(Event arg0) throws Exception { Messagebox.show( "Esta seguro que desea eliminar este registro? ", "Eliminar Registro", Messagebox.YES + Messagebox.NO, Messagebox.QUESTION, new org.zkoss.zk.ui.event.EventListener<Event>() { public void onEvent(Event event) throws Exception { if ("onYes".equals(event.getName())) { eliminarDatos(maestro_manual); buscarDatos(); } } }); } }); hlayout.appendChild(toolbarbutton); Listcell listcell = new Listcell(); listcell.appendChild(hlayout); fila.appendChild(listcell); return fila; }
public ToolbarCustomButton( MToolBarButton mToolbarButton, Toolbarbutton btn, String actionId, int windowNo) { toolbarButton = btn; this.actionId = actionId; this.windowNo = windowNo; this.mToolbarButton = mToolbarButton; toolbarButton.addEventListener(Events.ON_CLICK, this); }
@Override public void setDisabled(boolean disabled) { if (disabled && isChecked()) setChecked(false); // uncheck when button is disabled super.setDisabled(disabled); if (disabled) { LayoutUtils.addSclass("disableFilter", this); this.setSclass(getSclass().intern()); } else { if (this.getSclass() != null && this.getSclass().indexOf("disableFilter") >= 0) this.setSclass(this.getSclass().replace("disableFilter", "").intern()); } }
public void onCreate$div(Event event) { user = (Usuario) execution.getSession().getAttribute("usuario"); if (user != null) { if (user.getPessoa() != null) { nomeUsuario.setValue("SEJA BEM VINDO(A) " + user.getPessoa().getNome().toUpperCase()); } else { nomeUsuario.setValue("SEJA BEM VINDO(A) ADMINISTRADOR"); } if (user.getPrivilegio() == 3) { turma.setVisible(false); matricularAluno.setVisible(false); alocarProfessor.setVisible(false); cadastroPessoa.setVisible(true); cadastrarAluno.setVisible(false); cadastroAcademico.setVisible(false); prof = (Professor) user.getPessoa(); } else if (user.getPrivilegio() == 4) { pauta.setVisible(false); cadastroAcademico.setVisible(false); turma.setVisible(false); alocarProfessor.setVisible(false); cadastroPessoa.setVisible(true); professor.setVisible(false); resultado.setVisible(false); visualizarTurmas.setVisible(false); aluno = (Aluno) user.getPessoa(); } } else { // if feito para verificar se existe algum usuario logado, se nao existir eh redirecionado // para o login Executions.sendRedirect("/"); div.detach(); } }
@Override public void setTooltiptext(String tooltiptext) { super.setTooltiptext(tooltiptext != null ? tooltiptext.replaceAll("[&]", "") : null); }
public void cari() throws Exception { Connection conn = getConn(); try { PerusahaanDAO dao = new PerusahaanDAOImpl(conn); List<Perusahaan> list = dao.gets((Kecamatan) cmbKecamatan.getSelectedItem().getValue()); lstHasil.getItems().clear(); int no = 1; for (final Perusahaan p : list) { Listitem item = new Listitem(); item.setValue(p); item.appendChild(new Listcell(p.getNamaPerusahaan())); item.appendChild(new Listcell(p.getNamaPimpinan())); item.appendChild( new Listcell( p.getAlamatJalan() + ", " + p.getKota() + " Telp: " + p.getTelp() + " Fax: " + p.getFax())); Toolbarbutton btnDetail = new Toolbarbutton(); btnDetail.setId("btnDetail" + (no++)); btnDetail.setImage("/img/detail.png"); btnDetail.setTooltiptext("Klik di sini untuk Detail dan Perubahan data"); btnDetail.addEventListener( "onClick", new EventListener() { public void onEvent(Event event) throws Exception { // panggil form edit Window win = (Window) Executions.createComponents("/zul/admin/editPerusahaan.zul", null, null); Textbox txtIdPerusahaan = (Textbox) win.getFellow("txtIdPerusahaan"); txtIdPerusahaan.setValue(p.getId()); win.doModal(); cari(); } }); Toolbarbutton btnHapus = new Toolbarbutton(); btnHapus.setId("btnHapus" + no++); btnHapus.setImage("/img/delete.png"); btnHapus.setTooltiptext("Klik untuk mengahapus Perusahaan"); btnHapus.addEventListener( "onClick", new EventListener() { public void onEvent(Event event) throws Exception { if (Messagebox.show( "Hapus?", "Konfirmasi", Messagebox.YES | Messagebox.NO, Messagebox.QUESTION) == Messagebox.YES) { Connection connDel = getConn(); try { PerusahaanDAO daoDel = new PerusahaanDAOImpl(connDel); daoDel.delete(p.getId()); cari(); } catch (Exception ex) { Messagebox.show(ex.getMessage()); } finally { connDel.close(); } } } }); Listcell cellAksi = new Listcell(); cellAksi.appendChild(btnDetail); cellAksi.appendChild(new Space()); cellAksi.appendChild(btnHapus); item.appendChild(cellAksi); lstHasil.appendChild(item); } } catch (Exception ex) { Messagebox.show(ex.getMessage()); } finally { conn.close(); } }