public void onCreate$win_reportesproductos() { buttonImprimir.setVisible(false); Calendar c1 = Calendar.getInstance(); Calendar c2 = new GregorianCalendar(); gpb_2.setVisible(false); gpb_1.setVisible(true); gpb_3.setVisible(false); gpb_anio.setVisible(false); gpb_lista.setVisible(false); cmb_tipo.setText("General"); cmb_tiempo.setText("Por Año"); cmb_demanda.setText("Mayor Demanda"); for (int i = (c1.get(Calendar.YEAR)); i >= ((c1.get(Calendar.YEAR)) - 10); i--) { cmb_anio.appendItem("" + i); cmb_anio2.appendItem("" + i); } cmb_anio.setText(Integer.toString(c1.get(Calendar.YEAR))); cmb_anio.setReadonly(true); cmb_anio2.setText(Integer.toString(c1.get(Calendar.YEAR))); cmb_anio2.setReadonly(true); buttonDeshacer.setVisible(false); cmb_demanda.setReadonly(true); cmb_tiempo.setReadonly(true); cmb_tipo.setReadonly(true); cmb_mes.setText("Enero"); cmb_mes.setReadonly(true); }
private void loadCombobox() { // Sucursal List<Sucursales> listaSucursales; try { listaSucursales = sucursalesBean.loadAllSucursal(); if (listaSucursales != null) { cmbSucursal.setModel(new ListModelList(listaSucursales)); cmbSucursal.setItemRenderer(new CatalogoItemRenderer()); } else { cmbSucursal.setValue("No existen sucursales!!"); cmbSucursal.setReadonly(true); cmbSucursal.setButtonVisible(false); cmbSucursal.setDisabled(true); } } catch (DiservBusinessException ex) { Logger.getLogger(DetalleUsuarioCtrl.class.getName()).log(Level.SEVERE, null, ex); } }
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); }
@Override public void render(final Row row, Object object) throws Exception { if (inputfmtcombo != null) { inputRateSelected = inputfmtcombo.getText(); if (!inputRateSelected.contains("VFI_")) inputRateSelected = "VFI_" + inputRateSelected; } final DefaultFormatMapEntries fmtMapEntry = (DefaultFormatMapEntries) object; final Combobox inputFormatCombo = new Combobox(); inputFormatCombo.setReadonly(true); String rateFormat = fmtMapEntry.getRateFormat(); if (rateFormat.contains("VF_")) rateFormat = rateFormat.replaceAll("VF_", ""); inputFormatCombo.setText(rateFormat); rateForamatSelected.add(rateFormat); if (fmtMapEntry.isOnEdit()) inputFormatCombo.setDisabled(true); final Collection<String> comboRateArray = new ArrayList<String>(); if (inputRateSelected.equals("VFI_480i")) { comboRateArray.add(VideoFormatT.findByValue(21).toString().replaceAll("VF_", "")); comboRateArray.add(VideoFormatT.findByValue(22).toString().replaceAll("VF_", "")); comboRateArray.add(VideoFormatT.findByValue(23).toString().replaceAll("VF_", "")); } else { comboRateArray.add(VideoFormatT.findByValue(1).toString().replaceAll("VF_", "")); comboRateArray.add(VideoFormatT.findByValue(2).toString().replaceAll("VF_", "")); comboRateArray.add(VideoFormatT.findByValue(3).toString().replaceAll("VF_", "")); comboRateArray.add(VideoFormatT.findByValue(4).toString().replaceAll("VF_", "")); comboRateArray.add(VideoFormatT.findByValue(5).toString().replaceAll("VF_", "")); } comboRateArray.removeAll(rateForamatSelected); inputFormatCombo.setModel(new ListModelList(comboRateArray)); ComboitemRenderer renderer = new ComboitemRenderer() { @Override public void render(Comboitem item, Object data) throws Exception { String audiotype = data.toString(); item.setLabel(audiotype); } }; inputFormatCombo.setItemRenderer(renderer); inputFormatCombo.addEventListener( Events.ON_OPEN, new EventListener() { public void onEvent(Event event) throws Exception { // inputFormatCombo.getModel().getSize(); comboRateArray.removeAll(rateForamatSelected); inputFormatCombo.setModel(new ListModelList(comboRateArray)); } }); inputFormatCombo.addEventListener( Events.ON_CHANGE, new EventListener() { public void onEvent(Event event) throws Exception { String rateformtname = inputFormatCombo.getText(); if (!rateformtname.contains("VF_")) rateformtname = "VF_" + rateformtname; fmtMapEntry.setRateFormat(rateformtname); System.out.println("......." + rateForamatSelected + rateformtname); rateForamatSelected.add(inputFormatCombo.getText()); inputFormatCombo.setDisabled(true); } }); inputFormatCombo.setParent(row); final Intbox bitrateIntBox = new Intbox(); bitrateIntBox.setMaxlength(5); bitrateIntBox.setConstraint(new IntValueConstraint()); bitrateIntBox.setText(fmtMapEntry.getBitRate()); bitrateIntBox.addEventListener( Events.ON_CHANGE, new EventListener() { public void onEvent(Event event) throws Exception { try { fmtMapEntry.setBitRate(bitrateIntBox.getText()); } catch (Exception e) { e.printStackTrace(); } } }); bitrateIntBox.setParent(row); final Button cancelBtn = new Button(); cancelBtn.setSclass("check_off"); cancelBtn.setTooltiptext("Delete"); cancelBtn.addEventListener( Events.ON_CLICK, new EventListener() { public void onEvent(Event event) throws Exception { if (row.getGrid().getListModel().getSize() > 1) { removeRow(row); } else { Messagebox.show( "Sorry,You will not be able to delete this row.!", "Aereo", Messagebox.OK, Messagebox.INFORMATION); } } }); cancelBtn.setParent(row); }