예제 #1
0
 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);
 }
  @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);
  }