// Metodo para buscar // public void buscarDatos() throws Exception { try { String parameter = lbxParameter.getSelectedItem().getValue().toString(); String value = tbxValue.getValue().toUpperCase().trim(); Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("parameter", parameter); parameters.put("value", "%" + value + "%"); anexo3_entidadService.setLimit("limit 25 offset 0"); List<Anexo3_entidad> lista_datos = anexo3_entidadService.listar(parameters); rowsResultado.getChildren().clear(); for (Anexo3_entidad anexo3_entidad : lista_datos) { rowsResultado.appendChild(crearFilas(anexo3_entidad, this)); } gridResultado.setVisible(true); gridResultado.setMold("paging"); gridResultado.setPageSize(20); gridResultado.applyProperties(); gridResultado.invalidate(); } catch (Exception e) { MensajesUtil.mensajeError(e, "", this); } }
public ListModel getModelByOwner(Component comp) { if (comp instanceof Grid) { final Grid grid = (Grid) comp; return grid.getModel(); } else { throw new UiException("Unsupported type for RowCollectionItem: " + comp); } }
public List getItems(Component comp) { if (comp instanceof Grid) { final Grid grid = (Grid) comp; return grid.getRows().getChildren(); } else { throw new UiException("Unsupported type for RowCollectionItem: " + comp); } }
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)); } } }
public List<Presultados_paraclinicos> obtenerResultados_paraclinicos() { // log.info("ejecutando metodo @obtenerResultados_paraclinicos() ===> " // + nro_documento); List<Presultados_paraclinicos> listado = new ArrayList<Presultados_paraclinicos>(); for (Component row_fila : rowsResultado.getChildren()) { Phistorias_paraclinicos phistorias_paraclinicos = (Phistorias_paraclinicos) ((Row) row_fila).getValue(); Datebox datebox_fecha = (Datebox) gridResultados.getFellow( "datebox_fecha_" + tipo_examen + "_" + pcodigo_historia + "_" + phistorias_paraclinicos.getCodigo_examen()); Textbox textbox_resultado = (Textbox) gridResultados.getFellow( "textbox_resultado_" + tipo_examen + "_" + pcodigo_historia + "_" + phistorias_paraclinicos.getCodigo_examen()); if (!datebox_fecha.getText().isEmpty() && !textbox_resultado.getText().isEmpty()) { Presultados_paraclinicos presultados_paraclinicos = new Presultados_paraclinicos(); presultados_paraclinicos.setCodigo_empresa(zkWindow.codigo_empresa); presultados_paraclinicos.setCodigo_sucursal(zkWindow.codigo_sucursal); presultados_paraclinicos.setCodigo_examen(phistorias_paraclinicos.getCodigo_examen()); presultados_paraclinicos.setFecha(datebox_fecha.getText()); presultados_paraclinicos.setResultado(textbox_resultado.getValue()); presultados_paraclinicos.setNro_documento(nro_documento); Object valor_na = textbox_resultado.getAttribute("VALOR_NORMAL_ANORMAL"); Object valor_descripcion_na = textbox_resultado.getAttribute("VALOR_DESCRIPCION_NA"); if (valor_na != null) { if (valor_na.toString().equals("A")) { valor_descripcion_na = ""; } } presultados_paraclinicos.setNormal_anormal(valor_na != null ? valor_na.toString() : "N"); presultados_paraclinicos.setDescripcion_na( valor_descripcion_na != null ? valor_descripcion_na.toString() : ""); listado.add(presultados_paraclinicos); } } return listado; }
public String validarResultados_paraclinicos() { String mensaje = ""; for (Component row_fila : rowsResultado.getChildren()) { Phistorias_paraclinicos phistorias_paraclinicos = (Phistorias_paraclinicos) ((Row) row_fila).getValue(); Datebox datebox_fecha = (Datebox) gridResultados.getFellow( "datebox_fecha_" + tipo_examen + "_" + pcodigo_historia + "_" + phistorias_paraclinicos.getCodigo_examen()); Textbox textbox_resultado = (Textbox) gridResultados.getFellow( "textbox_resultado_" + tipo_examen + "_" + pcodigo_historia + "_" + phistorias_paraclinicos.getCodigo_examen()); if (!datebox_fecha.getText().isEmpty() && textbox_resultado.getText().isEmpty()) { mensaje = "Para registrar " + (tipo_examen.equals(TIPO_PARACLINICO) ? "el resultado paraclinico" : tipo_examen.equals(TIPO_VALORACION_OBSTETRICA) ? "la valoracion obstetrica" : "") + phistorias_paraclinicos.getPexamenes_paraclinicos().getNombre() + "' debe " + "ingresar la descripcion del resultado"; break; } else if (datebox_fecha.getText().isEmpty() && !textbox_resultado.getText().isEmpty()) { mensaje = "Para registrar " + (tipo_examen.equals(TIPO_PARACLINICO) ? "el resultado paraclinico" : tipo_examen.equals(TIPO_VALORACION_OBSTETRICA) ? "la valoracion obstetrica" : "") + phistorias_paraclinicos.getPexamenes_paraclinicos().getNombre() + "' debe " + "ingresar la fecha del resultado"; break; } } return mensaje; }
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; }
/** * @Class ActionStandar * * @name limpiarHistoricoMensajes * @return void * @desc Este m�todo se encarga de limpiar la grilla que contiene el historico de mensajes el * parametro es utilizado en el metodo setMensajehistorico para que limpie la grilla antes de * escribir en ella. */ private void limpiarHistoricoMensajes(String idGridHistorico, String idGroupHistorico) { if (idGridHistorico != null && idGroupHistorico != null) { if (this.hasFellow(idGridHistorico)) { Grid grilla = (Grid) this.getFellow(idGridHistorico); // ocultamos el groupbox que contiene // la grilla Groupbox groupinformacion = (Groupbox) this.getFellow(idGroupHistorico); groupinformacion.setVisible(false); grilla.getRows().getChildren().clear(); } } }
private void showInvalidValue(InvalidValue invalidValue, TaskQualityForm taskQualityForm) { if (assignedTaskQualityForms != null) { // Find which row contains TaskQualityForm inside grid Row row = findRowOfTaskQualityForm(assignedTaskQualityForms .getRows().getChildren(), taskQualityForm); if (row != null && invalidValue.getInvalidValue() instanceof String) { String itemName = (String) invalidValue.getInvalidValue(); String propertyName = invalidValue.getPropertyPath(); Row rowItem = findRowOfTaskQualityFormItem(row, itemName); if (rowItem != null) { if (TaskQualityFormItem.propertyDate.equals(propertyName)) { openDetails(rowItem); Datebox datebox = getDatebox(rowItem); throw new WrongValueException(datebox, _(invalidValue.getMessage())); } if (TaskQualityFormItem.propertyPassed.equals(propertyName)) { openDetails(rowItem); Checkbox checkbox = getCheckbox(rowItem); throw new WrongValueException(checkbox, _(invalidValue.getMessage())); } } } } }
public void limpiarResultados_paraclinicos() { auxheadResultados.detach(); columnsResultados.detach(); rowsResultado.detach(); gridResultados.detach(); inicializar(); }
public void createResourceForm(Long categoryId) { resourceCategorySelected = this.projectMgmtService.getResourceCategoryById(categoryId); this.clearResourceForm(); SelectedResource selectedResource; ResourceRow resourceRow; ProjectResource projectResourceFound = getProjectResource(categoryId); for (Resource resource : resourceCategorySelected.getResourceList()) { resourceRow = new ResourceRow(resource); rowsResourceList.getChildren().add(resourceRow); // Sets selected recources if (projectResourceFound == null) { continue; } else { for (int j = 0; j < projectResourceFound.getSelectedResourceList().size(); j++) { selectedResource = projectResourceFound.getSelectedResourceList().get(j); if (selectedResource.getResource().getId().compareTo(resource.getId()) == 0) { resourceRow.selectedResource(); resourceRow.setSelectedValue(selectedResource.getSelectedValue()); } } } } // Sets selected recources grdEditResource.setVisible(true); btnSaveResource.setVisible(true); }
public void onClick$btnSaveResource() { List componenttList = rowsResourceList.getChildren(); /// List<SelectedResource> selectedResourceList; // Valida si hay lista de recursos en el formulario if (componenttList.size() > 0) { ResourceRow resourceRow; int projectResourceIndex = -1; ProjectResource projectResource = new ProjectResource(); projectResource.setResourceCategoryId(this.resourceCategorySelected.getId()); projectResource.setSelectedResourceList(new ArrayList<SelectedResource>()); // Valida si hay recursos seleccionados en el proyecto que corresponden a la categoria // seleccionada // para eliminarlos if (this.project.getProjectResourceList() != null) { projectResourceIndex = getProjectResourceIndex(this.resourceCategorySelected.getId()); if (projectResourceIndex >= 0) { ProjectResource resource = (ProjectResource) this.project.getProjectResourceList().get(projectResourceIndex); this.project.getProjectResourceList().remove(projectResourceIndex); this.projectMgmtService.projectUpdate(this.project); this.projectMgmtService.deleteprojectResource(resource); } } saveProjectResources(componenttList, projectResource); desktop.removeAttribute("currentProject"); desktop.setAttribute("currentProject", this.project); grdEditResource.setVisible(false); btnSaveResource.setVisible(false); } }
private void openDetails(Row row) { Detail details = getDetails(row); if (details != null) { details.setOpen(true); details.invalidate(); assignedTaskQualityForms.invalidate(); } }
@Override public void doAfterCompose(Div comp) throws Exception { super.doAfterCompose(comp); List<Product> prods = DAOs.getProductDAO().findAll(); ListModelList<Product> prodModel = new ListModelList<Product>(prods); prodGrid.setModel(prodModel); }
private void initModel() { // Available events // It is just for showing message, event is always listened in this demo. eventFilterModel.setMultiple(true); addEventFilter(Events.ON_START_EDITING, true); addEventFilter(Events.ON_EDITBOX_EDITING, true); addEventFilter(Events.ON_STOP_EDITING, true); addEventFilter(Events.ON_AFTER_CELL_CHANGE, true); addEventFilter(Events.ON_CTRL_KEY, true); addEventFilter(Events.ON_CELL_CLICK, false); addEventFilter(Events.ON_CELL_DOUBLE_CLICK, true); addEventFilter(Events.ON_CELL_RIGHT_CLICK, true); addEventFilter(Events.ON_HEADER_UPDATE, true); addEventFilter(Events.ON_HEADER_CLICK, true); addEventFilter(Events.ON_HEADER_RIGHT_CLICK, true); addEventFilter(Events.ON_HEADER_DOUBLE_CLICK, true); addEventFilter(Events.ON_AUX_ACTION, true); addEventFilter(Events.ON_CELL_FOUCS, false); addEventFilter(Events.ON_CELL_SELECTION, false); addEventFilter(Events.ON_CELL_SELECTION_UPDATE, true); addEventFilter(Events.ON_CELL_FILTER, true); // useless addEventFilter(Events.ON_CELL_VALIDATOR, true); // useless addEventFilter(Events.ON_WIDGET_UPDATE, true); addEventFilter(Events.ON_WIDGET_CTRL_KEY, true); addEventFilter(Events.ON_AFTER_SHEET_CREATE, true); addEventFilter(Events.ON_AFTER_SHEET_DELETE, true); addEventFilter(Events.ON_AFTER_SHEET_NAME_CHANGE, true); addEventFilter(Events.ON_AFTER_SHEET_ORDER_CHANGE, true); addEventFilter(Events.ON_SHEET_SELECT, true); addEventFilter(Events.ON_CELL_HYPERLINK, true); eventFilterList.setModel(eventFilterModel); // add default show only infoList.setModel(infoModel); addInfo("Spreadsheet initialized"); // hint for special cells // D1 Ranges.range(ss.getSelectedSheet(), 0, 3).setCellEditText("Edit Me"); // E1 Ranges.range(ss.getSelectedSheet(), 0, 4).setCellEditText("Edit Me"); // D3 Ranges.range(ss.getSelectedSheet(), 2, 3).setCellEditText("Edit Me"); // E3 Ranges.range(ss.getSelectedSheet(), 2, 4).setCellEditText("Edit Me"); }
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 sortTaskQualityForms() { Column columnName = (Column) assignedTaskQualityForms.getColumns() .getChildren().get(1); if (columnName != null) { if (columnName.getSortDirection().equals("ascending")) { columnName.sort(false, false); columnName.setSortDirection("ascending"); } else if (columnName.getSortDirection().equals("descending")) { columnName.sort(true, false); columnName.setSortDirection("descending"); } } }
public void doAfterCompose(Component comp) throws Exception { super.doAfterCompose(comp); Session session = ServiceLocator.getNeracaDenormalHome().getSessionFactory().getCurrentSession(); session.beginTransaction(); List<hibernate.homendomain.NeracaDenormal> dnhbm = session.createQuery("from hibernate.homendomain.NeracaDenormal").list(); session.getTransaction().commit(); // System.out.println(ServiceLocator.getNeracaDenormalHome().findById(1)); final Component parent = comp; List<NeracaDenormal> l = new ArrayList<NeracaDenormal>(); for (hibernate.homendomain.NeracaDenormal dnn : dnhbm) { l.add( new NeracaDenormal( dnn.getDaerah(), dnn.getTahun(), dnn.getLaporan(), dnn.getId0(), dnn.getId1(), dnn.getId2(), dnn.getId3(), dnn.getId4(), dnn.getUraian(), dnn.getRupiah(), dnn.getTipeInput())); } // l.addAll(NeracaDao.getNeracas()); final List<Integer> idxParentAdd = Arrays.asList(2, 6, 11, 15); final List<Integer> idxLastDetail = Arrays.asList(4, 8, 13, 17); final ListModelList<NeracaDenormal> listModel = new ListModelList<NeracaDenormal>(l); grid1.setModel(listModel); NeracaRowRenderer nrr = new NeracaRowRenderer(listModel, grid1, idxParentAdd, idxLastDetail, btnSave); grid1.setRowRenderer(nrr); }
private void renderColumns(Grid gridItems) { Columns columns = gridItems.getColumns(); // Create listhead first time is rendered if (columns == null) { columns = new Columns(); } // Delete all headers columns.getChildren().clear(); columns.setSizable(true); // Add static headers Column columnName = new Column(); columnName.setLabel(_("Name")); Util.setSort(columnName, "auto=(name)"); columnName.setSortDirection("ascending"); columns.appendChild(columnName); Column columnPosition = new Column(); columnPosition.setLabel(_("Position")); columns.appendChild(columnPosition); Column columnPercentage = new Column(); columnPercentage.setLabel(_("Percentage")); columns.appendChild(columnPercentage); Column columnPassed = new Column(); columnPassed.setLabel(_("Checked")); columns.appendChild(columnPassed); Column columnDate = new Column(); columnDate.setLabel(_("Date")); columns.appendChild(columnDate); columns.setParent(gridItems); }
private void reloadTaskQualityForms() { Util.reloadBindings(bdQualityForms); Util.reloadBindings(assignedTaskQualityForms); assignedTaskQualityForms.invalidate(); }
public void clearResourceForm() { // gridResourceContainer.getChildren().clear(); grdEditResource.setVisible(false); rowsResourceList.getChildren().clear(); btnSaveResource.setVisible(false); }
private void inicializar() { contenedor.getChildren().clear(); gridResultados = new Grid(); gridResultados.setMold("paging"); gridResultados.setPageSize(20); auxheadResultados = new Auxhead(); columnsResultados = new Columns(); Auxheader auxheader = new Auxheader(); auxheader.setAlign("center"); if (tipo_examen.equals(TIPO_PARACLINICO)) { auxheader.setLabel("REGISTROS DE RESULTADOS PARACLINICOS"); } else if (tipo_examen.equals(TIPO_VALORACION_OBSTETRICA)) { auxheader.setLabel("REGISTROS DE VALORACION OBSTETRICA"); } auxheader.setColspan(3); auxheadResultados.appendChild(auxheader); gridResultados.appendChild(auxheadResultados); Column column = new Column(""); if (tipo_examen.equals(TIPO_PARACLINICO)) { column.setLabel("Paraclinico"); } else if (tipo_examen.equals(TIPO_VALORACION_OBSTETRICA)) { column.setLabel("V. obstetrica"); } column.setWidth("170px"); columnsResultados.appendChild(column); column = new Column("Fecha"); column.setWidth("120px"); columnsResultados.appendChild(column); column = new Column("Resultado"); column.setWidth("120px"); columnsResultados.appendChild(column); gridResultados.appendChild(columnsResultados); Frozen frozen = new Frozen(); frozen.appendChild(new Div()); frozen.setColumns(3); gridResultados.appendChild(frozen); rowsResultado = new Rows(); Map<String, Object> parametros = new HashMap<String, Object>(); parametros.put("codigo_empresa", zkWindow.codigo_empresa); parametros.put("codigo_sucursal", zkWindow.codigo_sucursal); parametros.put("codigo_historia", pcodigo_historia); parametros.put("tipo_examen", tipo_examen); List<Phistorias_paraclinicos> listado = zkWindow.getServiceLocator().getPhistorias_paraclinicosService().listar(parametros); for (Phistorias_paraclinicos phistorias_paraclinicos : listado) { Row row_fila = new Row(); Cell celda = Utilidades.obtenerCell( phistorias_paraclinicos.getPexamenes_paraclinicos().getNombre(), Textbox.class, true, true); row_fila.appendChild(celda); celda = Utilidades.obtenerCell(null, Datebox.class, false, false); Datebox datebox_fecha = (Datebox) celda.getFirstChild(); datebox_fecha.setId( "datebox_fecha_" + tipo_examen + "_" + pcodigo_historia + "_" + phistorias_paraclinicos.getCodigo_examen()); row_fila.appendChild(celda); celda = Utilidades.obtenerCell("", Textbox.class, true, false); Textbox textbox_resultado = (Textbox) celda.getFirstChild(); textbox_resultado.setId( "textbox_resultado_" + tipo_examen + "_" + pcodigo_historia + "_" + phistorias_paraclinicos.getCodigo_examen()); final Popup popupResultados = generarPopupResultados( textbox_resultado, false, phistorias_paraclinicos.getPexamenes_paraclinicos()); textbox_resultado.setPopup(popupResultados); row_fila.appendChild(celda); row_fila.setValue(phistorias_paraclinicos); rowsResultado.appendChild(row_fila); } gridResultados.appendChild(rowsResultado); contenedor.appendChild(gridResultados); }
public ProfileComponent() { super(); final PlayerProfileData player = getPlayerFacade().getCurrentPlayer(); final Grid profileGrid = new Grid(); profileGrid.setSclass("profileGrid"); final Rows profileRows = new Rows(); profileGrid.appendChild(profileRows); final Row idRow = new Row(); idRow.setSclass("profileRow"); idRow.appendChild(new Label(Labels.getLabel("profile.id"))); idRow.appendChild(new Label(player.getId())); profileRows.appendChild(idRow); final Row nameRow = new Row(); nameRow.setSclass("profileRow"); nameRow.appendChild(new Label(Labels.getLabel("profile.name"))); final Textbox nameBox = new Textbox(player.getName()); nameBox.setConstraint( new SimpleConstraint(SimpleConstraint.NO_EMPTY, Labels.getLabel("register.error.noname"))); nameRow.appendChild(nameBox); profileRows.appendChild(nameRow); final Row mailRow = new Row(); mailRow.setSclass("profileRow"); mailRow.appendChild(new Label(Labels.getLabel("profile.email"))); final Textbox mailBox = new Textbox(player.getEMail()); mailBox.setConstraint("/.+@.+\\.[a-z]+/: " + Labels.getLabel("register.error.noemail")); mailRow.appendChild(mailBox); profileRows.appendChild(mailRow); final Row pwdRow = new Row(); pwdRow.setSclass("profileRow"); pwdRow.appendChild(new Label(Labels.getLabel("profile.password"))); final Textbox pwdBox = new Textbox(player.getPassword()); // pwdBox.setConstraint(new SimpleConstraint(SimpleConstraint.NO_EMPTY, // Labels.getLabel("register.error.nopassword"))); pwdBox.setType("password"); pwdRow.appendChild(pwdBox); profileRows.appendChild(pwdRow); final Row pwd2Row = new Row(); pwd2Row.setSclass("profileRow"); pwd2Row.appendChild(new Label(Labels.getLabel("profile.passwordagain"))); final Textbox pwd2Box = new Textbox(player.getPassword()); pwd2Box.setConstraint( new Constraint() { @Override public void validate(final Component comp, final Object value) throws WrongValueException { if (!(pwdBox.getValue().equals(value))) { throw new WrongValueException( comp, Labels.getLabel("register.error.unequalpassword")); } } }); pwd2Box.setType("password"); pwd2Row.appendChild(pwd2Box); profileRows.appendChild(pwd2Row); final Row countryRow = new Row(); countryRow.setSclass("profileRow"); countryRow.appendChild(new Label(Labels.getLabel("profile.country"))); final Combobox countryBox = new Combobox(); countryBox.setConstraint( new SimpleConstraint( SimpleConstraint.NO_EMPTY, Labels.getLabel("register.error.nocountry"))); countryBox.setAutodrop(true); countryBox.setReadonly(true); fillCombo(countryBox, player.getLocale()); countryRow.appendChild(countryBox); profileRows.appendChild(countryRow); final Row avCompetitionsRow = new Row(); avCompetitionsRow.setSclass("competitionsRow"); avCompetitionsRow.appendChild(new Label(Labels.getLabel("profile.availableCompetitions"))); final Listbox listbox = new Listbox(); listbox.setSclass("competitionsListbox"); avCompetitionsRow.appendChild(listbox); listbox.setCheckmark(true); listbox.setMultiple(true); final List<CompetitionData> comps = getPlayerFacade().getAllCompetitions(); for (final CompetitionData cmpData : comps) { final Listitem listItem = new Listitem(cmpData.getName()); listItem.setValue(cmpData); listItem.setSelected(cmpData.isActive()); listItem.setDisabled( !cmpData.isDeactivatable() || (cmpData.isCurrentCompetition() && comps.size() != 1)); listbox.appendChild(listItem); } profileRows.appendChild(avCompetitionsRow); final Row buttonRow = new Row(); buttonRow.setSclass("profileRow"); final Button button = new Button(Labels.getLabel("profile.submit")); button.addEventListener( Events.ON_CLICK, new EventListener() { @Override public void onEvent(final Event event) { player.setEMail(mailBox.getValue()); player.setName(nameBox.getValue()); if (StringUtils.isNotBlank(pwdBox.getValue()) && pwdBox.getValue().equals(pwd2Box.getValue())) { player.setPassword(pwdBox.getValue()); } player.setLocale((Locale) countryBox.getSelectedItem().getValue()); final List<CompetitionData> cmps = new ArrayList<CompetitionData>(); for (final Object listItem : listbox.getSelectedItems()) { if (listItem instanceof Listitem) { final Object value = ((Listitem) listItem).getValue(); if (value instanceof CompetitionData) { cmps.add((CompetitionData) value); } } } getPlayerFacade().setActiveCompetitions(cmps); getPlayerFacade().updatePlayer(player); try { Messagebox.show(Labels.getLabel("profile.update.success")); // TODO proper update mechanism Executions.sendRedirect("/"); } catch (final InterruptedException e) { LOG.warn("Error while showing messagebox: ", e); } } }); buttonRow.appendChild(button); profileRows.appendChild(buttonRow); this.appendChild(profileGrid); final Div detailsDiv = new Div(); detailsDiv.setSclass("rankingUserDetails"); final Img img = new Img(); final Div imgCnt = new Div(); imgCnt.appendChild(img); imgCnt.setSclass("rankingUserDetailsImg"); img.setDynamicProperty("src", player.getPictureUrl()); detailsDiv.appendChild(imgCnt); final Button uploadButton = new Button(Labels.getLabel("profile.upload")); uploadButton.setSclass("btngreen profileUserDetailsUpload"); detailsDiv.appendChild(uploadButton); uploadButton.addEventListener( Events.ON_CLICK, new EventListener() { @Override public void onEvent(final Event event) throws InterruptedException { final Object media = Fileupload.get(); if (media instanceof Image) { final Image image = (Image) media; player.setPictureUrl( getPlayerFacade().uploadProfilePicture(image.getByteData(), image.getName())); img.setDynamicProperty("src", player.getPictureUrl()); } else if (media != null) { Messagebox.show("Not an image: " + media, "Error", Messagebox.OK, Messagebox.ERROR); } } }); this.appendChild(detailsDiv); }
@GlobalCommand("resetGridClientes") @NotifyChange({"clientes", "cantidadRegistros"}) public void resetGrid() { clientes = getAllClientes(); clientesGrid.invalidate(); }
private Grid appendGridItems(Row row, TaskQualityForm taskQualityForm) { Grid gridItems = new Grid(); gridItems.setMold("paging"); gridItems.setPageSize(5); gridItems.setFixedLayout(true); renderColumns(gridItems); gridItems.setRowRenderer(getTaskQualityFormItemsRowRenderer()); gridItems.setModel(new SimpleListModel(taskQualityForm .getTaskQualityFormItems().toArray())); return gridItems; }