private void cargarHistorialResultadosParaclinicos( Row fila, Presultados_paraclinicos presultados_paraclinicos) { if (presultados_paraclinicos == null) { fila.appendChild(Utilidades.obtenerCell("", Label.class, true, true)); fila.appendChild(Utilidades.obtenerCell("", Label.class, true, true)); } else { Pexamenes_paraclinicos pexamenes_paraclinicos = new Pexamenes_paraclinicos(); pexamenes_paraclinicos.setCodigo_empresa(presultados_paraclinicos.getCodigo_empresa()); pexamenes_paraclinicos.setCodigo_sucursal(presultados_paraclinicos.getCodigo_sucursal()); pexamenes_paraclinicos.setCodigo(presultados_paraclinicos.getCodigo_examen()); pexamenes_paraclinicos = zkWindow .getServiceLocator() .getPexamenes_paraclinicosService() .consultar(pexamenes_paraclinicos); fila.appendChild( Utilidades.obtenerCell(presultados_paraclinicos.getFecha(), Datebox.class, true, false)); Cell celda = Utilidades.obtenerCell( presultados_paraclinicos.getResultado(), Textbox.class, true, false); Textbox textbox_resultado = (Textbox) celda.getFirstChild(); textbox_resultado.setAttribute( "VALOR_NORMAL_ANORMAL", presultados_paraclinicos.getNormal_anormal()); textbox_resultado.setAttribute( "VALOR_DESCRIPCION_NA", presultados_paraclinicos.getDescripcion_na()); textbox_resultado.setPopup( generarPopupResultados(textbox_resultado, false, pexamenes_paraclinicos)); fila.appendChild(celda); } }
private Detail getDetails(Row row) { if (row.getValue() instanceof TaskQualityForm) { return ((Detail) row.getFirstChild()); } else { return ((Detail) row.getGrid().getParent()); } }
public void onClick$voltarPaginaListaFrequencia(Event e) { for (Intbox i : intbox) { i.setId(null); i.setVisible(false); } for (Row r : rowss) { r.setId(null); r.setVisible(false); } rowss.clear(); rowss = new ArrayList<Row>(); intbox.clear(); intbox = new ArrayList<Intbox>(); ListagemDisciplina.setSelectedItem(null); ListagemAluno.getItems().clear(); janelaDisciplinaAluno.setVisible(false); JanelaFiltroParaListarDisciplina.setVisible(true); binder.loadComponent(indexFrequencia); }
public Component getComponentCollectionOwner(Component comp) { if (comp instanceof Row) { final Row row = (Row) comp; return row.getGrid(); } else { throw new UiException("Unsupported type for RowCollectionItem: " + comp); } }
public Row crearFilas(Object objeto, Component componente) throws Exception { Row fila = new Row(); final Anexo3_entidad anexo3_entidad = (Anexo3_entidad) objeto; Hbox hbox = new Hbox(); Space space = new Space(); fila.setStyle("text-align: justify;nowrap:nowrap"); hbox.appendChild(space); Image img = new Image(); img.setSrc("/images/editar.gif"); img.setTooltiptext("Editar"); img.setStyle("cursor: pointer"); img.addEventListener( Events.ON_CLICK, new EventListener<Event>() { @Override public void onEvent(Event arg0) throws Exception { mostrarDatos(anexo3_entidad); } }); hbox.appendChild(img); img = new Image(); img.setSrc("/images/borrar.gif"); img.setTooltiptext("Eliminar"); img.setStyle("cursor: pointer"); img.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())) { // do the thing eliminarDatos(anexo3_entidad); buscarDatos(); } } }); } }); hbox.appendChild(space); hbox.appendChild(img); fila.appendChild(hbox); return fila; }
public void setupBindingRenderer(Component comp, DataBinder binder) { if (comp instanceof Row) { final Row row = (Row) comp; final Grid grid = row.getGrid(); if (grid.getRowRenderer() == null) { grid.setRowRenderer(new BindingRowRenderer(row, binder)); } } }
private Row findRowOfTaskQualityForm(List<Row> rows, TaskQualityForm taskQualityForm) { for (Row row : rows) { if (taskQualityForm.equals(row.getValue())) { return row; } } return null; }
/** * Renders a row * * @param row object where to place information * @param object object to be rendered * @param i index of the row * @throws Exception in case components cannot be added to the row */ @Override public void render(Row row, Object object, int i) throws Exception { CommandStat stat = (CommandStat) object; row.setStyle("padding-top: 0px; padding-bottom: 0px"); row.setHeight("24px"); // the data append to each row with simple label row.appendChild(new Label(Labels.getLabel(CommonConstants.LABEL_JOB + stat.getCommandName()))); row.appendChild(new Label(String.valueOf(stat.getCount()))); row.appendChild(new Label(DateTimeHelper.timeToString(stat.getMeanDuration()))); }
private void buildDivFieldsFromEntity(ComposerController<?> composer) { // AnnotateDataBinder binder = new AnnotateDataBinder(crudFormWindow); // binder.bindBean("controller2", composer); if (divFields.getChildren().size() == 0) { List<Component> list = new ArrayList<Component>(divFields.getChildren()); for (Component c : list) { c.detach(); } d = new Div(); g = new Grid(); d.appendChild(g); binder = new AnnotateDataBinder(g); binder.bindBean("controller2", composer); Columns c = new Columns(); Column col1 = new Column(); col1.setWidth("120px"); Column col2 = new Column(); col2.setAlign("left"); c.appendChild(col1); c.appendChild(col2); Rows r = new Rows(); Textbox t; Checkbox checkbox; for (ManagedBeanField field : composer.getListColumns()) { if (field.isVisible()) { Row row = new Row(); row.appendChild(new Label(Labels.getLabel(field.getFieldCaption()))); String fieldName = "controller2." + field.getFieldName() + ""; if (field.getFieldType().equalsIgnoreCase("boolean")) { checkbox = new Checkbox(); binder.addBinding(checkbox, "checked", fieldName); row.appendChild(checkbox); } else { t = new Textbox(); t.setWidth("98%"); binder.addBinding(t, "value", fieldName); row.appendChild(t); } r.appendChild(row); } } g.appendChild(r); d.setParent(this.divFields); // binder.loadAll(); } binder.loadComponent(g); // binder.saveAll(); }
public void onRenderComponents(final Row row) { final Component lastChild = row.getLastChild(); // image button remove final RowModel model = getModelFromComponent(row); for (int i = 0; i < DLFilterOperator.MAX_ARITY; ++i) { // remove all lastChild.getPreviousSibling().setParent(null); } for (int i = 0; i < DLFilterOperator.MAX_ARITY; ++i) { // insert all row.insertBefore(model.getPosition(i + 1), lastChild); } LOGGER.debug("Components have been rendered."); }
@Listen("onContadorEscolhe = #lb_contador") public void escolheContador(ForwardEvent event) { Map<String, Object> arg = (Map) rw_dadosLeitura.getValue(); Row rw_contador = (Row) arg.get("rw_contador"); Textbox tb_escolherContador = (Textbox) arg.get("tb_contador"); Listitem selectedItem = (Listitem) event.getOrigin().getTarget().getParent().getParent(); selectedContador = (Contador) selectedItem.getValue(); rw_contador.setValue(selectedContador); tb_escolherContador.setText("" + (selectedContador).getNumero()); winescolher.detach(); }
public void visible_conRadio(String value) { if (value.equals("N")) { rowCual_otro.setVisible(false); tbxCual_otro.setReadonly(true); tbxCual_otro.setText(""); } if (value.equals("S")) { rowCual_otro.setVisible(true); tbxCual_otro.setReadonly(false); tbxCual_otro.setText(""); tbxCual_otro.focus(); } }
@Override public void iniRowAction(Row row) { MenuLogList log = (MenuLogList) row.getValue(); SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); if (log.getDdate() != null) { BillLabel label = (BillLabel) row.getFellowIfAny("ddate"); label.setValue(dateFormat.format(log.getDdate())); } if (log.getLdate() != null) { BillLabel label = (BillLabel) row.getFellowIfAny("ldate"); label.setValue(dateFormat.format(log.getLdate())); } }
private Row findRowOfTaskQualityFormItem(Row rowTaskQualityForm, String itemName) { Grid gridItems = (Grid) rowTaskQualityForm.getFirstChild() .getFirstChild(); List<Row> rows = (List<Row>) gridItems.getRows().getChildren(); for (Row row : rows) { TaskQualityFormItem item = (TaskQualityFormItem) row.getValue(); if ((item != null) && (itemName.equals(item.getName()))) { return row; } } return null; }
@Listen("onClick = #btn_confirmar") public void alterarOperador() { Map<String, Object> arguments = (Map) rw_dadosOperador.getValue(); Operador op = (Operador) arguments.get("funAlterar"); lb_operador = (Listbox) arguments.get("lb_operador"); String pass = tb_insira_password.getText(); List<Operador> list = operadorDao.obtemPorUsername(tb_username.getText(), tb_password.getText()); if (!list.isEmpty() && op.getId() != list.get(0).getId()) { Clients.showNotification( "Um operador ja foi cadrastado com esse username", "error", null, null, 2000); } else { if (!tb_password.getText().equals(pass)) { Clients.showNotification("o password deve ser igual", "error", null, null, 2000); } else { ListModelList<Operador> lista = (ListModelList) lb_operador.getModel(); lista.remove(op); setValues(op); operadorDao.update(op); lista.add(0, op); operadorWin.detach(); ; Clients.showNotification("Dados do operador " + op.getNome() + " foram alterados"); } } }
@Command public void openMenuPopup( @BindingParam("open") boolean open, @BindingParam("referenceValue") Row referenceValue) { if (open) { this.selectedUser = referenceValue.getValue(); } }
private void appendDate(final Row row) { Datebox date = new Datebox(); date.setParent(row); final TaskQualityForm taskQualityForm = getTaskQualityFormByRow(row); final TaskQualityFormItem item = (TaskQualityFormItem) row.getValue(); Util.bind(date, new Util.Getter<Date>() { @Override public Date get() { return item.getDate(); } }, new Util.Setter<Date>() { @Override public void set(Date value) { item.setDate(value); updateAdvancesIfNeeded(); } }); date.setDisabled(assignedTaskQualityFormsToOrderElementModel .isDisabledDateItem(taskQualityForm, item)); date.setConstraint(checkConsecutiveDate(row)); }
private void removeRow(Row row) { try { if (row.getGrid().getRows() != null) { row.getGrid().renderAll(); int rowIndex = row.getGrid().getRows().getChildren().indexOf(row); ListModelList model = (ListModelList) row.getGrid().getListModel(); DefaultFormatMapEntries entries = (DefaultFormatMapEntries) model.get(rowIndex); model.remove(rowIndex); String rateformtname = entries.getRateFormat(); if (rateformtname.contains("VF_")) rateformtname = rateformtname.replaceAll("VF_", ""); rateForamatSelected.remove(rateformtname); } } catch (Exception e) { e.printStackTrace(); } }
private TaskQualityForm getTaskQualityFormByRow(final Row row) { try { return (TaskQualityForm) ((Row) row.getGrid().getParent() .getParent()).getValue(); } catch (Exception e) { return null; } }
public void onClick$adicionarFrequencias(Event e) throws InterruptedException { int id; for (Aluno a : Facade.getInstance().listarAlunoTurma(turmav.getId())) { for (Intbox i : intbox) { id = Integer.parseInt(i.getId()); if (a.getId() == id) { Frequencia fr = new Frequencia(); fr.setQtdAula(i.getValue()); fr.setRegistroDeDisciplina(di); fr.setAluno(a); fr.setPeriodo(""); Facade.getInstance().salvarFrequencia(fr); } } } Messagebox.show( "Frequências adicionadas com Sucesso!", "Sucesso!", Messagebox.OK, Messagebox.EXCLAMATION, new org.zkoss.zk.ui.event.EventListener() { public void onEvent(Event arg1) throws Exception {} }); for (Intbox i : intbox) { i.setId(null); i.setVisible(false); } for (Row r : rowss) { r.setId(null); r.setVisible(false); } rowss.clear(); rowss = new ArrayList<Row>(); intbox.clear(); intbox = new ArrayList<Intbox>(); binder.loadComponent(indexFrequencia); }
// 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(); rowId_manual.setVisible(true); lbxTipo_manual.setDisabled(true); listboxProcedimientos.setVisible(true); listboxProcedimientos.invalidate(); } else { // buscarDatos(); limpiarDatos(); rowId_manual.setVisible(false); lbxTipo_manual.setDisabled(false); listboxProcedimientos.setVisible(false); procedimientos_seleccionados.clear(); } tbxAccion.setValue(accion); }
@Override public void render(Row row, Object data) { TaskQualityFormItem item = (TaskQualityFormItem) data; row.setValue(item); appendNewLabel(row, item.getName()); appendNewLabel(row, item.getStringPosition()); appendNewLabel(row, item.getPercentage().toString()); appendCheckPassed(row); appendDate(row); }
@Override public void render(Row row, Object data) { TaskQualityForm taskQualityForm = (TaskQualityForm) data; row.setValue(taskQualityForm); appendDetails(row, taskQualityForm); appendNewLabel(row, taskQualityForm.getQualityForm().getName()); appendNewLabel(row, _(taskQualityForm.getQualityForm() .getQualityFormType().toString())); appendCheckboxReportAdvance(row, taskQualityForm); appendOperations(row); }
/// Showd Data on grid table public void showgrid() { for (Component c : find(this.getPage(), "#showsell > rows > row")) { c.detach(); } float sumallprice = 0; for (int i = 0; i < pointcount; i++) { Row r = new Row(); r.appendChild(new Label(Integer.toString(idpro.get(i)))); r.appendChild(new Label(nameproduct.get(i))); r.appendChild(new Label(Integer.toString(qty.get(i)))); r.appendChild(new Label(Integer.toString(unitprice.get(i)))); r.appendChild(new Label(Integer.toString(price.get(i)))); r.appendChild(new Label(namecus.get(i))); Button but = new Button("Delete"); but.setId("" + i); but.addEventListener( "onClick", new EventListener() { public void onEvent(Event ee) { nameproduct.remove(Integer.parseInt(ee.getTarget().getId())); qty.remove(Integer.parseInt(ee.getTarget().getId())); unitprice.remove(Integer.parseInt(ee.getTarget().getId())); price.remove(Integer.parseInt(ee.getTarget().getId())); namecus.remove(Integer.parseInt(ee.getTarget().getId())); pointcount--; txtsum.setValue("0"); txtvat.setValue("0"); idsumprice.setValue("0"); showgrid(); } }); r.appendChild(but); Component v = find(this.getPage(), "#showsell > rows").get(0); v.appendChild(r); sumallprice = sumallprice + price.get(i); float vatc1; String vatc2; for (Customereng vc : Customereng.findAllCustomerengs()) { vatc2 = vc.getTax(); vatc1 = Float.parseFloat(vatc2); float vat = (sumallprice * vatc1) / 100; float sumtotal = vat + sumallprice; txtsum.setValue(Float.toString(sumallprice)); txtvat.setValue(Float.toString(vat)); idsumprice.setValue(Float.toString(sumtotal)); } } }
@Listen("onClick = #btn_confirmarLeitor") public void alterarleitor() { Map<String, Object> arguments = (Map) rw_dadosLeitor.getValue(); Leitor leitor = (Leitor) arguments.get("funAlterar"); lb_leitor = (Listbox) arguments.get("lb_leitor"); ListModelList<Leitor> lista = (ListModelList) lb_leitor.getModel(); lista.remove(leitor); setValuesLeitor(leitor); leitorDao.update(leitor); lista.add(0, leitor); winAlterarLeitor.detach(); ; Clients.showNotification("Dados do leitor" + leitor.getNome() + " foram alterados"); }
public void render(Row row, java.lang.Object data) { if (data instanceof String[]) { String[] ary = (String[]) data; Div div = new Div(); Image icon = new Image(); icon.setStyle("padding: 0px 10px"); icon.setSrc("/img/Centigrade-Widget-Icons/EnvelopeOpen-16x16.png"); div.appendChild(icon); new Label(ary[0]).setParent(div); row.appendChild(div); new Label(ary[1]).setParent(row); new Label(ary[2]).setParent(row); new Label(ary[3]).setParent(row); } else { new Label(data.toString()).setParent(row); } }
private void appendCheckboxReportAdvance(Row row, final TaskQualityForm taskQualityForm) { final Checkbox tmpCheckbox = new Checkbox(); Checkbox checkbox = Util.bind(tmpCheckbox, new Util.Getter<Boolean>() { @Override public Boolean get() { return taskQualityForm.isReportAdvance(); } }, new Util.Setter<Boolean>() { @Override public void set(Boolean value) { try { if (value) { assignedTaskQualityFormsToOrderElementModel .addAdvanceAssignmentIfNeeded(taskQualityForm); } else { try { assignedTaskQualityFormsToOrderElementModel .removeAdvanceAssignmentIfNeeded(taskQualityForm); } catch (ValidationException e) { showInformativeMessage(e.getMessage()); return; } } taskQualityForm.setReportAdvance(value); } catch (DuplicateValueTrueReportGlobalAdvanceException e) { throw new RuntimeException(e); } catch (DuplicateAdvanceAssignmentForOrderElementException e) { messages .showMessage( Level.ERROR, _("Another task in the same branch is already reporting progress for this quality form")); tmpCheckbox.setChecked(false); } } }); if (!taskQualityForm.getQualityForm().isReportAdvance()) { checkbox.setDisabled(true); } row.appendChild(checkbox); }
private void appendCheckPassed(final Row row) { Checkbox checkbox = new Checkbox(); checkbox.setParent(row); final TaskQualityForm taskQualityForm = getTaskQualityFormByRow(row); final TaskQualityFormItem item = (TaskQualityFormItem) row.getValue(); Util.bind(checkbox, new Util.Getter<Boolean>() { @Override public Boolean get() { return item.getPassed(); } }, new Util.Setter<Boolean>() { @Override public void set(Boolean value) { item.setPassed(value); updateAdvancesIfNeeded(); } }); checkbox.setDisabled(assignedTaskQualityFormsToOrderElementModel .isDisabledPassedItem(taskQualityForm, item)); if (!taskQualityForm.isByItems()) { checkbox.addEventListener(Events.ON_CHECK, new EventListener() { @Override public void onEvent(Event event) { assignedTaskQualityFormsToOrderElementModel .updatePassedTaskQualityFormItems(taskQualityForm); Grid gridItems = row.getGrid(); gridItems.setModel(new SimpleListModel(taskQualityForm .getTaskQualityFormItems().toArray())); gridItems.invalidate(); } }); } }
/** * *********************************************************** Create * *********************************************************** */ @SuppressWarnings("rawtypes") private void onNodeTypeChanged() { ListModelList typeModel = (ListModelList) typeBox.getModel(); Set selections = typeModel.getSelection(); if (selections.isEmpty()) return; String selection = (String) selections.iterator().next(); logger.info("Node type set to: " + selection); Map<String, String> ntd = GeneralUtil.getNodeDescriptionByLabel(ntds, selection); String nodeType = ntd.get("type"); if (nodeType.equals(Constants.NODE_TYPE_USER)) { firstNameRow.setVisible(true); firstNameBox.setConstraint("no empty"); lastNameRow.setVisible(true); lastNameBox.setConstraint("no empty"); midNameRow.setVisible(true); } else { firstNameRow.setVisible(false); firstNameBox.setConstraint(""); lastNameRow.setVisible(false); lastNameBox.setConstraint(""); midNameRow.setVisible(false); } }
public Row crearFilas(Object objeto, Component componente) throws Exception { Row fila = new Row(); final Ficha_epidemiologia_n22 ficha_epidemiologia_n22 = (Ficha_epidemiologia_n22) objeto; Hbox hbox = new Hbox(); Space space = new Space(); fila.setStyle("text-align: justify;nowrap:nowrap"); fila.appendChild(new Label(ficha_epidemiologia_n22.getCodigo_ficha() + "")); fila.appendChild(new Label(ficha_epidemiologia_n22.getFecha_inicial() + "")); fila.appendChild(new Label(ficha_epidemiologia_n22.getIdentificacion() + "")); hbox.appendChild(space); Image img = new Image(); img.setSrc("/images/editar.gif"); img.setTooltiptext("Editar"); img.setStyle("cursor: pointer"); img.addEventListener( Events.ON_CLICK, new EventListener<Event>() { @Override public void onEvent(Event arg0) throws Exception { mostrarDatos(ficha_epidemiologia_n22); } }); hbox.appendChild(img); hbox.appendChild(space); hbox.appendChild(img); fila.appendChild(hbox); return fila; }