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);
    }
  }
 /**
  * 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 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 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;
  }
Esempio n. 6
0
  /// 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));
      }
    }
  }
 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);
        }
Esempio n. 9
0
  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);
  }
  public CreateProcessController(
      final MainController mainC, final HashMap<String, String> formats_ext)
      throws SuspendNotAllowedException, InterruptedException, ExceptionAllUsers, ExceptionDomains {
    this.mainC = mainC;

    this.createProcessW =
        (Window) Executions.createComponents("macros/editprocessdata.zul", null, null);
    this.createProcessW.setTitle("Create new process ");
    Rows rows =
        (Rows) this.createProcessW.getFirstChild().getFirstChild().getFirstChild().getNextSibling();
    Row processNameR = (Row) rows.getFirstChild();
    this.processNameT = (Textbox) processNameR.getFirstChild().getNextSibling();
    Row versionNameR = (Row) processNameR.getNextSibling();
    this.versionNumberT = (Textbox) versionNameR.getFirstChild().getNextSibling();
    Row domainR = (Row) versionNameR.getNextSibling();
    Row ownerR = (Row) domainR.getNextSibling();

    Row nativeTypesR = (Row) ownerR.getNextSibling();
    this.nativeTypesLB = (Listbox) nativeTypesR.getFirstChild().getNextSibling();

    Row rankingR = (Row) nativeTypesR.getNextSibling();
    Radiogroup rankingRG = (Radiogroup) rankingR.getFirstChild().getNextSibling();

    Row publicR = (Row) rankingR.getNextSibling();
    this.makePublicCb = (Checkbox) publicR.getFirstChild().getNextSibling();

    Row buttonsR = (Row) publicR.getNextSibling().getNextSibling();
    Div buttonsD = (Div) buttonsR.getFirstChild();
    Button okB = (Button) buttonsD.getFirstChild();
    Button cancelB = (Button) okB.getNextSibling();
    Button resetB = (Button) cancelB.getNextSibling();
    List<String> domains = this.mainC.getDomains();
    this.domainCB = new SelectDynamicListController(domains);
    this.domainCB.setReference(domains);
    this.domainCB.setAutodrop(true);
    this.domainCB.setWidth("85%");
    this.domainCB.setHeight("100%");
    this.domainCB.setAttribute("hflex", "1");
    domainR.appendChild(domainCB);
    List<String> usernames = this.mainC.getUsers();
    SelectDynamicListController ownerCB = new SelectDynamicListController(usernames);
    ownerCB.setReference(usernames);
    ownerCB.setAutodrop(true);
    ownerCB.setWidth("85%");
    ownerCB.setHeight("100%");
    ownerCB.setAttribute("hflex", "1");
    ownerR.appendChild(ownerCB);

    // set row visibility at creation time
    nativeTypesR.setVisible(true);
    versionNameR.setVisible(false);
    rankingR.setVisible(false);

    // default values
    ownerCB.setValue(UserSessionManager.getCurrentUser().getUsername());

    Set<String> extensions = formats_ext.keySet();
    List<String> sorted = CollectionUtil.asSortedList(extensions);

    Iterator<String> it = sorted.iterator();
    Listitem cbi;
    while (it.hasNext()) {
      cbi = new Listitem();
      this.nativeTypesLB.appendChild(cbi);
      cbi.setLabel(formats_ext.get(it.next()));

      if ("BPMN 2.0".compareTo(cbi.getLabel()) == 0) {
        cbi.setSelected(true);
      }
    }
    // empty fields
    reset();

    okB.addEventListener(
        "onClick",
        new EventListener<Event>() {
          @Override
          public void onEvent(final Event event) throws Exception {
            createProcess();
          }
        });
    this.createProcessW.addEventListener(
        "onOK",
        new EventListener<Event>() {
          @Override
          public void onEvent(final Event event) throws Exception {
            createProcess();
          }
        });
    cancelB.addEventListener(
        "onClick",
        new EventListener<Event>() {
          @Override
          public void onEvent(final Event event) throws Exception {
            cancel();
          }
        });
    resetB.addEventListener(
        "onClick",
        new EventListener<Event>() {
          @Override
          public void onEvent(final Event event) throws Exception {
            reset();
          }
        });
    this.createProcessW.doModal();
  }
  public void addField(MBrowseField field, Row row, String name, String title) {
    GridFieldVO voBase =
        GridFieldVO.createStdField(field.getCtx(), p_WindowNo, 0, 0, 0, false, false, false);

    String uniqueName = field.getAD_View_Column().getColumnSQL();

    voBase.isProcess = true;
    voBase.IsDisplayed = true;
    voBase.IsReadOnly = false;
    voBase.IsUpdateable = true;
    voBase.WindowNo = p_WindowNo;

    voBase.AD_Column_ID = field.getAD_View_Column().getAD_Column_ID();
    voBase.AD_Table_ID = field.getAD_View_Column().getAD_Column().getAD_Table_ID();
    voBase.ColumnName = field.getAD_View_Column().getAD_Column().getColumnName();
    voBase.displayType = field.getAD_Reference_ID();
    voBase.AD_Reference_Value_ID = field.getAD_Reference_Value_ID();
    voBase.IsMandatory = field.isMandatory();
    voBase.IsAlwaysUpdateable = false;
    voBase.IsKey = field.isKey();

    voBase.DefaultValue = field.getDefaultValue();
    voBase.DefaultValue2 = field.getDefaultValue2();
    voBase.InfoFactoryClass = field.getInfoFactoryClass();
    voBase.FieldLength = field.getFieldLength();
    voBase.ReadOnlyLogic = field.getReadOnlyLogic();
    voBase.DisplayLogic = field.getDisplayLogic();
    voBase.VFormat = field.getVFormat();
    voBase.ValueMin = field.getValueMin();
    voBase.ValueMax = field.getValueMax();
    voBase.ValidationCode = field.getAD_Val_Rule().getCode();

    voBase.isRange = field.isRange();
    voBase.Description = field.getDescription();
    voBase.Help = uniqueName;
    voBase.Header = title;

    GridField gField = new GridField(GridFieldVO.createParameter(voBase));
    GridField gField2 = null;

    WEditor editor = WebEditorFactory.getEditor(gField, false);
    editor.setReadWrite(true);
    editor.addValueChangeListener(this);
    editor.dynamicDisplay();
    gField.addPropertyChangeListener(editor);

    Object defaultObject = null;
    Object defaultObject2 = null;

    //  Set Default
    if (field.getAD_View_Column().getAD_Column_ID() > 0) {
      defaultObject = gField.getDefault();
      if (defaultObject != null && field.getDefaultValue() != null) {
        gField.setValue(defaultObject, true);
        editor.setValue(defaultObject);
      }
    }

    gField.lookupLoadComplete();
    m_mFields.add(gField);
    m_wEditors.add(editor);

    if (DisplayType.YesNo != field.getAD_Reference_ID()) {
      Div div = new Div();
      div.setAlign("right");
      org.adempiere.webui.component.Label label = editor.getLabel();
      label.setValue(title);
      div.appendChild(label);
      if (label.getDecorator() != null) div.appendChild(label.getDecorator());
      row.appendChild(div);
    }
    row.appendChild(editor.getComponent());
    setParameter(name, editor);

    if (field.isRange()) {
      title = Msg.getMsg(Env.getCtx(), "To");
      name = name + "_To";
      voBase.Header = title;
      voBase.DefaultValue = field.getDefaultValue2();
      gField2 = new GridField(GridFieldVO.createParameter(voBase));
      gField2.lookupLoadComplete();

      WEditor editor2 = WebEditorFactory.getEditor(gField2, false);
      editor2.setReadWrite(true);
      editor2.addValueChangeListener(this);
      editor2.dynamicDisplay();
      //  Set Default
      if (field.getAD_View_Column().getAD_Column_ID() > 0) {
        defaultObject2 = gField2.getDefault();
        if (defaultObject2 != null && field.getDefaultValue2() != null) {
          gField2.setValue(defaultObject2, true);
          editor2.setValue(defaultObject2);
        }
      }
      m_mFields2.add(gField2);
      m_wEditors2.add(editor2);

      Div div = new Div();
      div.setAlign("right");
      org.adempiere.webui.component.Label label = editor2.getLabel();
      label.setValue(title);
      div.appendChild(label);
      if (label.getDecorator() != null) div.appendChild(label.getDecorator());
      row.appendChild(div);

      row.appendChild(editor2.getComponent());
      setParameter(name, editor2);
    } else {
      m_mFields2.add(null);
      m_wEditors2.add(null);
    }

    if (gField != null) processNewValue(defaultObject, gField.getVO().Help);
    if (gField2 != null) processNewValue(defaultObject2, gField2.getVO().Help);
  }
  public ProcessMergeController(
      MainController mainC,
      Map<ProcessSummaryType, List<VersionSummaryType>> selectedProcessVersions)
      throws SuspendNotAllowedException, InterruptedException, ExceptionAllUsers, ExceptionDomains {
    this.mainC = mainC;

    this.processMergeW =
        (Window) Executions.createComponents("macros/processmerge.zul", null, null);
    this.processMergeW.setTitle("Merge processes.");

    Row processNameR = (Row) this.processMergeW.getFellow("mergednamep");
    this.processNameT = (Textbox) processNameR.getFirstChild().getNextSibling();

    Row versionNameR = (Row) this.processMergeW.getFellow("mergednamev");
    this.versionNameT = (Textbox) versionNameR.getFirstChild().getNextSibling();
    this.versionNameT.setValue(Constants.INITIAL_VERSION);

    Row mergeDomainR = (Row) this.processMergeW.getFellow("mergeddomainR");
    List<String> domains = this.mainC.getDomains();
    this.domainCB = new SelectDynamicListController(domains);
    this.domainCB.setReference(domains);
    this.domainCB.setAutodrop(true);
    this.domainCB.setWidth("85%");
    this.domainCB.setHeight("100%");
    this.domainCB.setAttribute("hflex", "1");
    mergeDomainR.appendChild(domainCB);

    Row removeEntR = (Row) this.processMergeW.getFellow("removeEnt");
    Row makePubicR = (Row) this.processMergeW.getFellow("makePublic");
    Row algoChoiceR = (Row) this.processMergeW.getFellow("mergeAlgoChoice");

    this.OKbutton = (Button) this.processMergeW.getFellow("mergeOKButton");
    Button cancelButton = (Button) this.processMergeW.getFellow("mergeCancelButton");

    this.selectedProcessVersions = selectedProcessVersions;
    this.removeEnt = (Checkbox) removeEntR.getFirstChild().getNextSibling();
    this.makePublic = (Checkbox) makePubicR.getFirstChild().getNextSibling();
    this.mergethreshold = (Row) this.processMergeW.getFellow("mergethreshold");
    this.labelthreshold = (Row) this.processMergeW.getFellow("labelthreshold");
    this.contextthreshold = (Row) this.processMergeW.getFellow("contextthreshold");
    this.skipeweight = (Row) this.processMergeW.getFellow("skipeweight");
    this.skipnweight = (Row) this.processMergeW.getFellow("skipnweight");
    this.subnweight = (Row) this.processMergeW.getFellow("subnweight");

    this.algosLB = (Listbox) algoChoiceR.getFirstChild().getNextSibling();
    Listitem listItem = new Listitem();
    listItem.setLabel("Greedy");
    this.algosLB.appendChild(listItem);
    listItem.setSelected(true);
    listItem = new Listitem();
    listItem.setLabel("Hungarian");
    this.algosLB.appendChild(listItem);

    updateActions();

    this.processNameT.addEventListener(
        "onChange",
        new EventListener<Event>() {
          public void onEvent(Event event) throws Exception {
            updateActions();
          }
        });
    this.versionNameT.addEventListener(
        "onChange",
        new EventListener<Event>() {
          public void onEvent(Event event) throws Exception {
            updateActions();
          }
        });
    this.algosLB.addEventListener(
        "onSelect",
        new EventListener<Event>() {
          public void onEvent(Event event) throws Exception {
            updateActions();
          }
        });
    this.OKbutton.addEventListener(
        "onClick",
        new EventListener<Event>() {
          public void onEvent(Event event) throws Exception {
            mergeProcesses();
          }
        });
    this.OKbutton.addEventListener(
        "onOK",
        new EventListener<Event>() {
          public void onEvent(Event event) throws Exception {
            mergeProcesses();
          }
        });
    cancelButton.addEventListener(
        "onClick",
        new EventListener<Event>() {
          public void onEvent(Event event) throws Exception {
            cancel();
          }
        });

    this.processMergeW.doModal();
  }
Esempio n. 13
0
  private void createStateGrid() throws Exception {
    try {
      View view = Toolkit.getToolkit().getSvdbView(getDesktop());
      INode node = this.getSelectedNode();
      if (node == null) {
        Messagebox.show(ErrorMessage.UNSELECT_MONITOR, "提示", Messagebox.OK, Messagebox.INFORMATION);
        return;
      }
      if (getBeginDatabox().getValue().after(getEndDatabox().getValue())) {
        Messagebox.show(ErrorMessage.TIME_ERROR, "提示", Messagebox.OK, Messagebox.INFORMATION);
        return;
      }
      Date begin_date = getBeginDatabox().getValue();
      Date end_date = getEndDatabox().getValue();
      getBeginLabel().setValue(Toolkit.getToolkit().formatDate(begin_date));
      getEndLabel().setValue(Toolkit.getToolkit().formatDate(end_date));
      Report report = new Report(node, begin_date, end_date);
      report.load();

      Map<Date, DstrItem> dstrMap = report.getDstr();
      if (dstrMap == null || dstrMap.size() == 0) {
        this.getBeginLabel().setValue("");
        this.getEndLabel().setValue("");
        ChartUtil.clearComponent(getStatePercentRows());
        getStatusImage().setSrc("");
        getSpectrumImage().setSrc("");
        ChartUtil.clearComponent(getStatePeriodRow());
        //				Messagebox.show("没有您要显示的数据!", "提示", Messagebox.OK,
        //						Messagebox.INFORMATION);
        return;
      }
      int ok = 0, warn = 0, error = 0, disable = 0, bad = 0;
      double size = dstrMap.size(); // 提高精度
      if (colorlist.size() > 0) colorlist.clear();
      if (stateItems.size() > 0) stateItems.clear();
      for (Date keyDate : dstrMap.keySet()) {
        DstrItem dstrItem = dstrMap.get(keyDate);
        if ("ok".equals(dstrItem.status)) {
          ok++;
          colorlist.add(MonitorType.getColor(MonitorType.OK));
        } else if ("warning".equals(dstrItem.status)) {
          warn++;
          colorlist.add(MonitorType.getColor(MonitorType.WARN));
        } else if ("error".equals(dstrItem.status)) {
          error++;
          colorlist.add(MonitorType.getColor(MonitorType.ERROR));
        } else if ("disable".equals(dstrItem.status)) {
          disable++;
          colorlist.add(MonitorType.getColor(MonitorType.DISABLE));
        } else {
          bad++;
          colorlist.add(MonitorType.getColor(MonitorType.BAD));
        }
      }
      stateBean =
          new StateBean(
              node.getSvId(),
              node.getName(),
              Toolkit.getToolkit().formatDate(begin_date),
              Toolkit.getToolkit().formatDate(end_date),
              ok / size * 100,
              warn / size * 100,
              error / size * 100,
              disable / size * 100,
              bad / size * 100);
      Row row =
          addRow(
              new Row(),
              stateBean,
              stateBean.getPercentOk(),
              stateBean.getPercentWarn(),
              stateBean.getPercentError(),
              stateBean.getPercentDisable(),
              stateBean.getPercentBad());
      ChartUtil.clearComponent(getStatePercentRows());
      getStatePercentRows().appendChild(row);
      getDesktop().getSession().setAttribute("colorlist", colorlist);
      getSpectrumImage().setSrc("/main/report/SpectrumImage?Id" + new Random().nextDouble());
      PieDataset dataSet = createDataset(stateBean);
      Image image = ChartUtil.create3DPieChart(node.getName(), dataSet, 600, 300);
      getStatusImage().setSrc(image.getSrc());

      int index = 0;
      List<Date> aliasKey = new ArrayList<Date>(dstrMap.keySet());
      ChartUtil.clearComponent(getStatePeriodRow());
      while (index < size) {
        Date startTime = null;
        Date endTime = null;
        String status = null;
        int count = 0;
        for (; index < size; index++) {
          DstrItem dstrItem = dstrMap.get(aliasKey.get(index));
          //					if (!"ok".equals(dstrItem.status) && !"error".equals(dstrItem.status))	continue;
          if (status == null) status = dstrItem.status;
          if (!status.equals(dstrItem.status)) break;
          if (startTime == null) startTime = aliasKey.get(index);
          count++;
          endTime = aliasKey.get(index);
        }
        if (startTime == null || endTime == null) {
          Row blankRow = new Row();
          blankRow.appendChild(new Label("无数据!"));
          getStatePeriodRow().appendChild(blankRow);
          continue;
        }
        String strTime = subtract2Date(startTime, endTime);
        StateItem sitem =
            new StateItem(
                Toolkit.getToolkit().formatDate(startTime), status, String.valueOf(count), strTime);
        stateItems.add(sitem);
        Row generatetime =
            addRow(
                new Row(),
                null,
                sitem.getBeginTime(),
                ChartUtil.getImage(sitem.getStatus()),
                sitem.getCount(),
                sitem.getPersistTime());
        getStatePeriodRow().appendChild(generatetime);
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
  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);
  }