Пример #1
0
  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);
  }
Пример #2
0
    private static Div generateCompletionShade(IDatesMapper datesMapper, LimitingResourceQueueElement queueElement) {

        int workableHours = queueElement
                .getLimitingResourceQueue()
                .getResource()
                .getCalendar()
                .getCapacityOn(PartialDay.wholeDay(queueElement.getEndDate()))
                .roundToHours();

        Long shadeWidth = (24 - workableHours) *
                DatesMapperOnInterval.MILISECONDS_PER_HOUR / datesMapper.getMilisecondsPerPixel();

        Long lShadeLeft = (workableHours - queueElement.getEndHour()) *
                DatesMapperOnInterval.MILISECONDS_PER_HOUR / datesMapper.getMilisecondsPerPixel();

        int shadeLeft = lShadeLeft.intValue() + shadeWidth.intValue();

        Div notWorkableHoursShade = new Div();

        notWorkableHoursShade.setContext("");
        notWorkableHoursShade.setSclass("limiting-completion");
        notWorkableHoursShade.setStyle("left: " + shadeLeft + "px; width: " + shadeWidth.intValue() + "px;");

        return notWorkableHoursShade;
    }
Пример #3
0
 private void reload() {
   div2.getChildren().clear();
   if (session.getAttribute("user") != null) {
     Executions.createComponents("leftpanel.zul", div2, null);
     System.out.println("create leftpanel.zul");
   } else {
     div2.getChildren().clear();
     // div2.appendChild(new Label("Please login"));
   }
 }
  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();
  }
Пример #5
0
  /** Load Format */
  private void cmd_loadFormat() {
    //	clear panel
    previewPanel.getChildren().clear();

    ListItem listitem = pickFormat.getSelectedItem();

    String formatName = (String) listitem.getValue();

    if (formatName.equals(s_none)) return;

    m_format = ImpFormat.load(formatName);

    if (m_format == null) {
      FDialog.error(m_WindowNo, this, formatName);
      return;
    }

    //	pointers

    int size = m_format.getRowCount();
    m_labels = new Label[size];
    m_fields = new Textbox[size];

    for (int i = 0; i < size; i++) {
      ImpFormatRow row = m_format.getRow(i);

      m_labels[i] = new Label(row.getColumnName());

      Hbox hbox = new Hbox();
      hbox.setWidth("100%");
      hbox.setWidths("30%, 70%");
      hbox.setStyle("padding-bottom: 3px");

      hbox.appendChild(m_labels[i].rightAlign());

      int length = row.getEndNo() - row.getStartNo();

      if (length <= 5) length = 5;
      else if (length > 20) length = 20;

      m_fields[i] = new Textbox();
      m_fields[i].setStyle("margin-left: 2px");

      hbox.appendChild(m_fields[i]);

      previewPanel.appendChild(hbox);
    }
    m_record = -1;
    record.setValue("------");
    previewPanel.invalidate();
  } //	cmd_format
    protected Div createWelcomePanel() {
      final Div welcomePanel = new Div();
      welcomePanel.setStyle("text-align: left; padding: 20px 8px 20px 8px;");
      welcomePanel.setSclass("z-groupbox-hm welcome_group");

      final Div labelContainer = new Div();
      final Label label = new Label(Labels.getLabel("liveedit.choose.site"));
      label.setStyle("font-weight: bold");
      label.setParent(labelContainer);
      welcomePanel.appendChild(labelContainer);
      final Div siteContainer = new Div();
      injectSites(siteContainer);
      welcomePanel.appendChild(siteContainer);
      return welcomePanel;
    }
 @Override
 protected Div createMainArea() {
   final Div ret = new Div();
   UITools.maximize(ret);
   final BrowserModel model = getModel();
   if (model instanceof DefaultLiveEditBrowserModel) {
     final DefaultLiveEditBrowserModel liveEditBrowserModel =
         (DefaultLiveEditBrowserModel) model;
     this.liveEditView = newDefaultLiveEditView(liveEditBrowserModel);
     this.liveEditView.getViewComponent().setParent(ret);
   } else {
     ret.appendChild(new Label(Labels.getLabel(EMPTY_MESSAGE)));
   }
   return ret;
 }
  public void onMostrarModuloOrdenamiento() throws Exception {
    if (orden_servicioAction != null) orden_servicioAction.detach();
    Map parametros = new HashMap();
    parametros.put("nro_identificacion", admision_seleccionada.getNro_identificacion());
    parametros.put("nro_ingreso", admision_seleccionada.getNro_ingreso());
    parametros.put("estado", admision_seleccionada.getEstado());
    parametros.put("codigo_administradora", admision_seleccionada.getCodigo_administradora());
    parametros.put("id_plan", admision_seleccionada.getId_plan());
    parametros.put("tipo_hc", "");
    parametros.put("ocultaValor", "");
    parametros.put("admision", admision_seleccionada);
    parametros.put("opcion_formulario", tbxAccion.getValue());
    /* este parametros es para que oculte las vistas */
    parametros.put("ocultarInformacion", "_Ocultar");
    parametros.put("ocultar_consentimiento", "S");
    parametros.put("ocultarEstado", "ocultarEstado");
    orden_servicioAction =
        (Orden_servicio_internoAction)
            Executions.createComponents("/pages/orden_servicio_interno.zul", null, parametros);
    orden_servicioAction.inicializar(this);
    divModuloOrdenamiento.appendChild(orden_servicioAction);
    orden_servicioAction.obtenerBotonImprimir().setVisible(false);
    // cargo_farmacologico = true;
    // }

  }
  // Metodo para buscar //
  public void buscarDatos() throws Exception {
    try {
      Map<String, Object> parameters = new HashMap<String, Object>();
      String value = tbxValue.getValue().trim().toUpperCase();
      parameters.put("codigo_empresa", codigo_empresa);
      parameters.put("codigo_sucursal", codigo_sucursal);
      String parameter = lbxParameter.getSelectedItem().getValue().toString();

      parameters.put("parameter", parameter);
      parameters.put("value", "%" + value + "%");

      parameters.put("limite_paginado", "limit 25 offset 0");

      List<Maestro_manual> lista_datos = maestro_manualService.listar(parameters);
      listboxResultado.getItems().clear();
      divPopups.getChildren().clear();

      for (Maestro_manual maestro_manual : lista_datos) {
        listboxResultado.appendChild(crearFilas(maestro_manual, this));
      }

      listboxResultado.applyProperties();
      listboxResultado.invalidate();

    } catch (Exception e) {
      MensajesUtil.mensajeError(e, "", this);
    }
  }
Пример #10
0
  /**
   * Static Init
   *
   * @throws Exception
   */
  private void jbInit() throws Exception {
    Charset[] charsets = Ini.getAvailableCharsets();

    for (int i = 0; i < charsets.length; i++)
      fCharset.appendItem(charsets[i].displayName(), charsets[i]);

    bFile.setLabel(Msg.getMsg(Env.getCtx(), "FileImportFile"));
    bFile.setTooltiptext(Msg.getMsg(Env.getCtx(), "FileImportFileInfo"));
    bFile.addEventListener(Events.ON_CLICK, this);

    fCharset.setMold("select");
    fCharset.setRows(0);
    fCharset.setTooltiptext(Msg.getMsg(Env.getCtx(), "Charset", false));

    info.setValue("   ");

    labelFormat.setValue(Msg.translate(Env.getCtx(), "AD_ImpFormat_ID"));

    pickFormat.setMold("select");
    pickFormat.setRows(0);

    bNext.setTooltiptext(Msg.getMsg(Env.getCtx(), "Next"));
    bNext.setLabel(">");
    bNext.addEventListener(Events.ON_CLICK, this);

    record.setValue("------");

    bPrevious.setTooltiptext(Msg.getMsg(Env.getCtx(), "Previous"));
    bPrevious.setLabel("<");
    bPrevious.addEventListener(Events.ON_CLICK, this);

    northPanel.appendChild(bFile);
    northPanel.appendChild(fCharset);
    northPanel.appendChild(info);
    northPanel.appendChild(labelFormat);
    northPanel.appendChild(pickFormat);
    northPanel.appendChild(bPrevious);
    northPanel.appendChild(record);
    northPanel.appendChild(bNext);

    rawData.setWidth("100%");
    rawData.setCols(80);
    rawData.setRows(MAX_SHOWN_LINES);
    rawData.setHeight("40%");

    previewPanel.setWidth("100%");
    previewPanel.setHeight("58%");
    previewPanel.setStyle("overflow: auto");

    centerPanel.setWidth("100%"); // Elaine 2008/11/07 - fix text area is not expanded in IE7
    centerPanel.setHeight("100%");
    centerPanel.appendChild(rawData);
    centerPanel.appendChild(new Separator());
    centerPanel.appendChild(previewPanel);

    confirmPanel.addActionListener(Events.ON_CLICK, this);
  }
Пример #11
0
 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);
   }
 }
  public void lastNameSearch() {
    if (searchLastNameTb.getValue().length() < 3) {
      errLbl.setValue("Please enter at least 3 characters when searching");

      searchResult.setVisible(false);
    } else {
      errLbl.setValue("");
      this.physicians = PhysicanManager.searchByLastName(searchLastNameTb.getValue());
      if (physicians != null && physicians.size() > 0) {
        List<Physician> physicianList = (List<Physician>) searchResultLb.getModel();
        physicianList.clear();
        physicianList.addAll(physicians);
        searchResult.setVisible(true);
      } else {
        errLbl.setValue("No treatment provider found for: " + searchLastNameTb.getValue());
        searchResult.setVisible(false);
      }
    }
  }
Пример #13
0
    private static Component generateProgressBar(IDatesMapper datesMapper, LimitingResourceQueueElement queueElement) {

        DateAndHour advancementEndDate = getAdvanceEndDate(queueElement);

        if ( advancementEndDate == null ) {
            return null;
        }

        Duration durationBetween = new Duration(
                queueElement.getStartTime().toDateTime().getMillis(), advancementEndDate.toDateTime().getMillis());

        Div progressBar = new Div();

        if ( !queueElement.getStartDate().isEqual(advancementEndDate.getDate()) ) {
            progressBar.setWidth(datesMapper.toPixels(durationBetween) + "px");
            progressBar.setSclass("queue-progress-bar");
        }

        return progressBar;
    }
Пример #14
0
  private void cargarBuscadores() {
    List<F0005> listF0005 = servicioF0005.buscarParaUDCOrdenados("00", "02");
    buscadorClase =
        new BuscadorUDC(
            "Clase", 100, listF0005, true, false, false, "00", "02", "23%", "23%", "7%", "23%") {
          private static final long serialVersionUID = 1L;

          @Override
          protected F0005 buscar() {
            return servicioF0005.buscar("00", "02", buscadorClase.obtenerCaja());
          }
        };
    divBuscadorClase.appendChild(buscadorClase);

    listF0005 = servicioF0005.buscarParaUDCOrdenados("00", "05");
    buscadorTipo =
        new BuscadorUDC(
            "Tipo", 100, listF0005, true, false, false, "00", "05", "23%", "23%", "7%", "23%") {
          private static final long serialVersionUID = 1L;

          @Override
          protected F0005 buscar() {
            return servicioF0005.buscar("00", "05", buscadorTipo.obtenerCaja());
          }
        };
    divBuscadorTipo.appendChild(buscadorTipo);

    listF0005 = servicioF0005.buscarParaUDCOrdenados("00", "04");
    buscadorMoneda =
        new BuscadorUDC(
            "Moneda", 100, listF0005, true, false, false, "00", "04", "23%", "23%", "7%", "23%") {
          private static final long serialVersionUID = 1L;

          @Override
          protected F0005 buscar() {
            return servicioF0005.buscar("00", "04", buscadorMoneda.obtenerCaja());
          }
        };
    divBuscadorMoneda.appendChild(buscadorMoneda);
  }
Пример #15
0
  public void onClick$listarDisciplinaFiltro() {
    if (nivelCombo.getSelectedIndex() == -1
        || anoLetivoCombo.getSelectedIndex() == -1
        || serieCombo.getSelectedIndex() == -1
        || turmaCombo.getSelectedIndex() == -1) {
      alert("Existe(m) Campo(s) não selecionado(s)!");
    } else {
      turmav = ((Turma) turmaCombo.getSelectedItem().getValue());
      List<RegistroDeDisciplina> list = new ArrayList<RegistroDeDisciplina>();
      for (RegistroDeDisciplina rd :
          Facade.getInstance().listarRegistroDeDisciplinaTurma(turmav.getId())) {
        list.add(rd);
      }

      listModel = new ListModelList(list);
      ListagemDisciplina.setModel(listModel);

      JanelaFiltroParaListarDisciplina.setVisible(false);
      janelaDisciplinaAluno.setVisible(false);
      janelaDisciplina.setVisible(true);
    }
  }
Пример #16
0
 public void cerrarVentana(Div div, String id, List<Tab> tabs2, Groupbox group) {
   div.setVisible(false);
   tabs = tabs2;
   for (int i = 0; i < tabs.size(); i++) {
     if (tabs.get(i).getLabel().equals(id)) {
       if (i == (tabs.size() - 1) && tabs.size() > 1) {
         tabs.get(i - 1).setSelected(true);
       }
       tabs.get(i).onClose();
       tabs.remove(i);
     }
   }
   if (tabs.size() == 0) {
     if (group.isVisible() && !group.isOpen()) {
       group.setOpen(true);
     }
   }
 }
  @Override
  public void inicializar() throws IOException {
    HashMap<String, Object> mapa =
        (HashMap<String, Object>) Sessions.getCurrent().getAttribute("mapaGeneral");
    if (mapa != null) {
      if (mapa.get("tabsGenerales") != null) {
        tabs = (List<Tab>) mapa.get("tabsGenerales");
        nombre = (String) mapa.get("titulo");
        mapa.clear();
        mapa = null;
      }
    }
    actualizar();
    Botonera botonera =
        new Botonera() {

          @Override
          public void salir() {
            cerrarVentana(divGrupoInspectores, nombre, tabs);
          }

          @Override
          public void limpiar() {}

          @Override
          public void guardar() {
            if (validar()) {
              String nombre = txtGrupo.getValue();
              GrupoInspectores grupo = new GrupoInspectores();
              grupo.setId(1);
              grupo.setGrupo(nombre);
              servicioGrupoInspectores.guardar(grupo);
              msj.mensajeInformacion(Mensaje.guardado);
              actualizar();
            }
          }

          @Override
          public void eliminar() {}
        };

    botonera.getChildren().get(1).setVisible(false);
    botoneraGrupoInspectores.appendChild(botonera);
  }
Пример #18
0
 /**
  * 报告列表点击事件,显示自动生成的TOPN报告
  *
  * @param event
  */
 public void onSelecttopNList(Event event) {
   Listitem item = topNList.getSelectedItem();
   if (topNGenerateTime.getItemCount() > 0) {
     topNGenerateTime.getItems().clear();
   }
   if (item == null) {
     return;
   }
   String reportid = item.getId();
   IniFile iniGen = new IniFile("reportTopN." + reportid + ".ini");
   try {
     iniGen.load();
   } catch (Exception e) {
     return;
   }
   topn_time.setVisible(true);
   TopNLogListmodel model = new TopNLogListmodel(iniGen, this);
   topNGenerateTime.setModel(model);
   topNGenerateTime.setItemRenderer(model);
 }
Пример #19
0
  public void onCreate$div(Event event) {
    user = (Usuario) execution.getSession().getAttribute("usuario");

    if (user != null) {
      if (user.getPessoa() != null) {
        nomeUsuario.setValue("SEJA BEM VINDO(A) " + user.getPessoa().getNome().toUpperCase());
      } else {
        nomeUsuario.setValue("SEJA BEM VINDO(A) ADMINISTRADOR");
      }

      if (user.getPrivilegio() == 3) {
        turma.setVisible(false);
        matricularAluno.setVisible(false);
        alocarProfessor.setVisible(false);

        cadastroPessoa.setVisible(true);
        cadastrarAluno.setVisible(false);

        cadastroAcademico.setVisible(false);
        prof = (Professor) user.getPessoa();
      } else if (user.getPrivilegio() == 4) {
        pauta.setVisible(false);
        cadastroAcademico.setVisible(false);
        turma.setVisible(false);
        alocarProfessor.setVisible(false);

        cadastroPessoa.setVisible(true);
        professor.setVisible(false);

        resultado.setVisible(false);
        visualizarTurmas.setVisible(false);
        aluno = (Aluno) user.getPessoa();
      }
    } else {
      // if feito para verificar se existe algum usuario logado, se nao existir eh redirecionado
      // para o login
      Executions.sendRedirect("/");
      div.detach();
    }
  }
Пример #20
0
  @Override
  public void inicializar() throws IOException {
    HashMap<String, Object> map =
        (HashMap<String, Object>) Sessions.getCurrent().getAttribute("mapaGeneral");
    if (map != null) {
      if (map.get("tabsGenerales") != null) {
        tabs = (List<Tab>) map.get("tabsGenerales");
        titulo = (String) map.get("titulo");
        map.clear();
        map = null;
      }
    }
    txtSYF0005.setFocus(true);
    mostrarCatalogo();

    botonera =
        new Botonera() {

          @Override
          public void seleccionar() {
            if (validarSeleccion()) {
              if (catalogo.obtenerSeleccionados().size() == 1) {
                mostrarBotones(false);
                F0005 f05 = catalogo.objetoSeleccionadoDelCatalogo();
                clave = f05.getId();
                abrirRegistro();
                F0004 f04 = servicioF0004.buscar(f05.getId().getDrsy(), f05.getId().getDrrt());
                txtRTF0005.setValue(f05.getId().getDrrt());
                txtRTF0005.setDisabled(true);
                txtSYF0005.setValue(f05.getId().getDrsy());
                txtSYF0005.setDisabled(true);
                txtKYF0005.setValue(f05.getId().getDrky());
                txtKYF0005.setDisabled(true);
                txtDL01F0005.setValue(f05.getDrdl01());
                txtSPHDF0005.setValue(f05.getDrsphd());
                txtHRDCF0005.setValue(f05.getDrhrdc());
                txtDL02F0005.setValue(f05.getDrdl02());
                lblDescripcionF0004.setValue(f04.getDtdl01());
                txtDL01F0005.setFocus(true);
              } else msj.mensajeAlerta(Mensaje.editarSoloUno);
            }
          }

          @Override
          public void salir() {
            cerrarVentana(divVF0005, titulo, tabs);
          }

          @Override
          public void reporte() {}

          @Override
          public void limpiar() {
            clave = null;
            mostrarBotones(false);
            limpiarCampos();
            habilitarTextClave();
          }

          @Override
          public void guardar() {
            boolean guardar = true;
            if (clave == null && (claveSYExiste() || claveRTExiste())) guardar = false;
            else guardar = validar();

            if (guardar) {
              String rt = txtRTF0005.getValue();
              String sy = txtSYF0005.getValue();
              String ky = txtKYF0005.getValue();
              String dl01 = txtDL01F0005.getValue();
              String sphd = txtSPHDF0005.getValue();
              String dl02 = txtDL02F0005.getValue();
              String hrdc = txtHRDCF0005.getValue();
              F0005PK clave = new F0005PK();
              clave.setDrrt(rt);
              clave.setDrsy(sy);
              clave.setDrky(ky);
              F0005 fooo5 = new F0005();
              fooo5.setId(clave);
              fooo5.setDrdl01(dl01);
              fooo5.setDrdl02(dl02);
              fooo5.setDrhrdc(hrdc);
              fooo5.setDrsphd(sphd);
              fooo5.setDruser("user");
              // fooo5.setDrupmj(""); //Fecha
              fooo5.setDrupmt(Double.parseDouble(horaAuditoria));
              servicioF0005.guardar(fooo5);
              msj.mensajeInformacion(Mensaje.guardado);
              limpiar();
              listaGeneral = servicioF0005.buscarTodosOrdenados();
              catalogo.actualizarLista(listaGeneral);
            }
          }

          @Override
          public void eliminar() {}

          @Override
          public void buscar() {

            abrirCatalogo();
          }

          @Override
          public void ayuda() {}

          @Override
          public void annadir() {
            abrirRegistro();
            mostrarBotones(false);
          }
        };
    botonera.getChildren().get(6).setVisible(false);
    botonera.getChildren().get(8).setVisible(false);
    botonera.getChildren().get(1).setVisible(false);
    botonera.getChildren().get(3).setVisible(false);
    botonera.getChildren().get(5).setVisible(false);
    botonera.getChildren().get(4).setVisible(false);
    botoneraF0005.appendChild(botonera);
  }
Пример #21
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);
  }
Пример #22
0
  /**
   * Static Init
   *
   * @throws Exception
   */
  private void init() throws Exception {
    fResource.setMold("select");
    fResource.addEventListener(Events.ON_SELECT, this);
    delete.addEventListener(Events.ON_CLICK, this);
    confirmPanel.addComponentsLeft(delete);
    confirmPanel.addActionListener(Events.ON_CLICK, this);
    //
    this.appendChild(mainPanel);
    mainPanel.makeNoStrip();
    mainPanel.setStyle("background-color: transparent");

    Rows rows = new Rows();
    mainPanel.appendChild(rows);
    Row row = new Row();
    row.appendChild(LayoutUtils.makeRightAlign(lResource));
    row.appendChild(fResource);
    row.appendChild(new Label(" "));
    rows.appendChild(row);

    row = new Row();
    row.setSpans("1, 2");
    row.appendChild(LayoutUtils.makeRightAlign(lDate));
    Div div = new Div();
    div.appendChild(fDateFrom);
    div.appendChild(fTimeFrom);
    fTimeFrom.setStyle("margin-left: 5px");
    row.appendChild(div);
    rows.appendChild(row);

    row = new Row();
    row.appendChild(LayoutUtils.makeRightAlign(lQty));
    row.appendChild(fQty);
    row.appendChild(lUOM);
    rows.appendChild(row);

    row = new Row();
    row.setSpans("1, 2");
    row.appendChild(LayoutUtils.makeRightAlign(lName));
    row.appendChild(fName);
    fName.setStyle("width: 100%");
    rows.appendChild(row);

    row = new Row();
    row.setSpans("1, 2");
    row.appendChild(LayoutUtils.makeRightAlign(lDescription));
    row.appendChild(fDescription);
    fDescription.setMultiline(true);
    fDescription.setRows(3);
    fDescription.setStyle("width: 100%");
    rows.appendChild(row);

    row = new Row();
    row.setSpans("3");
    row.appendChild(new Label(" "));
    rows.appendChild(row);

    row = new Row();
    row.setSpans("3");
    row.appendChild(confirmPanel);
    rows.appendChild(row);
    //
  } //	jbInit
Пример #23
0
  @Override
  public void inicializar() throws IOException {
    HashMap<String, Object> mapa =
        (HashMap<String, Object>) Sessions.getCurrent().getAttribute("mapaGeneral");
    if (mapa != null) {
      if (mapa.get("tabsGenerales") != null) {
        tabs = (List<Tab>) mapa.get("tabsGenerales");
        nombre = (String) mapa.get("titulo");
        mapa.clear();
        mapa = null;
      }
    }
    Botonera botonera =
        new Botonera() {

          @Override
          public void salir() {
            cerrarVentana(divEvaluar, nombre, tabs);
          }

          @Override
          public void limpiar() {
            lblCedula.setValue("");
            lblCodigo.setValue("");
            lblDescripcion.setValue("");
            lblFicha.setValue("");
            lblNombre.setValue("");
            lblTipo.setValue("");
            dtbFecha.setValue(null);
            codigoInforme = null;
            ltbAcciones.getItems().clear();
            ltbAccionesInspector.getItems().clear();
            lblOrdenamientos.setValue("");
            lblFuncionario.setValue("");
            lblFechaVisita.setValue("");
          }

          @Override
          public void guardar() {
            if (codigoInforme == null) Mensaje.mensajeError(Mensaje.camposVacios);
            else {
              ltbAcciones.renderAll();
              ltbAccionesInspector.renderAll();
              if (validarLista() && validarLista2()) {
                List<PlanAccion> planes = new ArrayList<PlanAccion>();
                if (ltbAcciones.getItemCount() != 0) {
                  for (int i = 0; i < ltbAcciones.getItemCount(); i++) {
                    Listitem listItem = ltbAcciones.getItemAtIndex(i);
                    PlanAccion plan = listItem.getValue();
                    if (listItem.isSelected()) {
                      Textbox text = (Textbox) listItem.getChildren().get(6).getChildren().get(0);
                      String observacion = text.getValue();
                      Datebox date = (Datebox) listItem.getChildren().get(5).getChildren().get(0);
                      Date fecha = date.getValue();
                      plan.setEstado("Finalizado");
                      plan.setObservacion(observacion);
                      plan.setFechaCumplido(new Timestamp(fecha.getTime()));
                    } else {
                      plan.setEstado("Programado");
                      plan.setObservacion(null);
                      plan.setFechaCumplido(null);
                    }
                    plan.setFechaAuditoria(fechaHora);
                    plan.setHoraAuditoria(horaAuditoria);
                    plan.setUsuarioAuditoria(nombreUsuarioSesion());
                    planes.add(plan);
                  }
                  servicioPlanAccion.guardarVarios(planes);
                }

                List<PlanAccion> planes2 = new ArrayList<PlanAccion>();
                if (ltbAccionesInspector.getItemCount() != 0) {
                  for (int i = 0; i < ltbAccionesInspector.getItemCount(); i++) {
                    Listitem listItem = ltbAccionesInspector.getItemAtIndex(i);
                    PlanAccion plan = listItem.getValue();
                    if (listItem.isSelected()) {
                      Textbox text = (Textbox) listItem.getChildren().get(6).getChildren().get(0);
                      String observacion = text.getValue();
                      Datebox date = (Datebox) listItem.getChildren().get(5).getChildren().get(0);
                      Date fecha = date.getValue();
                      plan.setEstado("Finalizado");
                      plan.setObservacion(observacion);
                      plan.setFechaCumplido(new Timestamp(fecha.getTime()));
                    } else {
                      plan.setEstado("Programado");
                      plan.setObservacion(null);
                      plan.setFechaCumplido(null);
                    }
                    plan.setFechaAuditoria(fechaHora);
                    plan.setHoraAuditoria(horaAuditoria);
                    plan.setUsuarioAuditoria(nombreUsuarioSesion());
                    planes2.add(plan);
                  }
                  servicioPlanAccion.guardarVarios(planes2);
                }
                Mensaje.mensajeInformacion(Mensaje.guardado);
                limpiar();
              } else
                Mensaje.mensajeError(
                    "Debe indicar la fecha en que se cumplieron las Acciones "
                        + "que ha seleccionado como cumplidas");
            }
          }

          @Override
          public void eliminar() {}
        };
    botonera.getChildren().get(1).setVisible(false);
    botoneraEvaluar.appendChild(botonera);
  }
    private Component createEditor(
        final TypedObject object,
        final EditorRowConfiguration rowConfig,
        final ObjectValueContainer valueContainer) {
      final Div editorContainer = new Div();
      editorContainer.setStyle(
          "float: left; position: relative; padding-left: 25px; padding-top: 8px; padding-bottom: 5px; padding-right: 3px;");

      final Div labelDiv = new Div();
      // labelDiv.setStyle("width: 145px; overflow: hidden; text-align: right; position: relative;
      // top: 3px;");
      labelDiv.setStyle("overflow: hidden; text-align: left; padding: 3px;");
      final PropertyDescriptor propDesc = rowConfig.getPropertyDescriptor();

      String label = propDesc.getName();
      if (StringUtils.isBlank(label)) {
        label = propDesc.getQualifier();
      }
      final Label labelComp = new Label(label);
      labelComp.setStyle("font-weight: bold; color: #666;");
      labelDiv.appendChild(labelComp);
      editorContainer.appendChild(labelDiv);

      final Div editorDiv = new Div();
      editorDiv.setStyle("width: 150px; position: relative;");
      editorContainer.appendChild(editorDiv);

      final Collection<PropertyEditorDescriptor> matchingEditorDescriptors =
          getEditorFactory().getMatchingEditorDescriptors(propDesc.getEditorType());
      if (!matchingEditorDescriptors.isEmpty()) {
        final ObjectValueContainer.ObjectValueHolder valueHolder =
            valueContainer.getValue(propDesc, null);

        final PropertyEditorDescriptor ped = matchingEditorDescriptors.iterator().next();
        final UIEditor editor =
            org.apache.commons.lang.StringUtils.isNotBlank(rowConfig.getEditor())
                ? ped.createUIEditor(rowConfig.getEditor())
                : ped.createUIEditor(TypeTools.getMultiplicityString(propDesc));
        editor.setEditable(true);

        CreateContext createContext = null;
        if (editor instanceof ReferenceUIEditor) {
          SearchType rootType = getRootSearchType(propDesc);

          if (rootType != null
              && rootType.isAssignableFrom(
                  UISessionUtils.getCurrentSession()
                      .getTypeService()
                      .getObjectType(UserModel._TYPECODE))) {
            rootType =
                UISessionUtils.getCurrentSession()
                    .getSearchService()
                    .getSearchType(CustomerModel._TYPECODE);
          }

          if (rootType != null) {
            ((ReferenceUIEditor) editor).setRootType(rootType);
          }
          // final SearchType rootType = getRootSearchType(propDesc);
          createContext =
              new CreateContext(
                  rootType,
                  UISessionUtils.getCurrentSession()
                      .getTypeService()
                      .wrapItem(valueContainer.getObject()),
                  propDesc,
                  UISessionUtils.getCurrentSession().getLanguageIso());
        }

        final Map<String, Object> customParameters =
            new HashMap<String, Object>(rowConfig.getParameters());
        customParameters.put(AbstractUIEditor.ATTRIBUTE_QUALIFIER_PARAM, propDesc.getQualifier());
        customParameters.put("languageIso", UISessionUtils.getCurrentSession().getLanguageIso());
        final CMSSiteModel cmsSiteModel = getCmsAdminSiteService().getActiveSite();
        final CatalogVersionModel catalogVersionModel =
            getCmsAdminSiteService().getActiveCatalogVersion();
        if (cmsSiteModel != null) {
          customParameters.put(
              "availableItems",
              getCmsPreviewService().getEditableCatalogs(cmsSiteModel, catalogVersionModel));
        }

        if (createContext != null) {
          try {
            customParameters.put("createContext", createContext.clone());
          } catch (final CloneNotSupportedException e) {
            LOG.error("Clone not support for preview data!", e);
          }
        }

        final HtmlBasedComponent viewComponent =
            editor.createViewComponent(
                valueHolder.getCurrentValue(),
                customParameters,
                new EditorListener() {
                  @Override
                  public void valueChanged(final Object value) {
                    valueHolder.setLocalValue(value);

                    for (final ObjectValueHandler valueHandler :
                        UISessionUtils.getCurrentSession()
                            .getValueHandlerRegistry()
                            .getValueHandlerChain(object.getType())) {
                      try {
                        valueHandler.storeValues(valueContainer);
                      } catch (final ValueHandlerException e) {
                        if (LOG.isDebugEnabled()) {
                          LOG.error(e.getMessage(), e);
                        }
                      }
                    }
                  }

                  @Override
                  public void actionPerformed(final String actionCode) {
                    // nop
                  }
                });
        editorDiv.appendChild(viewComponent);
      }

      return editorContainer;
    }
  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();
  }
    @Override
    protected HtmlBasedComponent createAdvancedArea() {
      final Div previewDataAreaDiv = new Div();

      previewDataAreaDiv.setStyle(
          "min-height: 40px; width: 100%; background: white; border-bottom: 1px solid #ccc");

      final Div attributesDiv = new Div();
      attributesDiv.setSclass("clearfix");
      attributesDiv.setStyle("text-align: left; width: 100%; ");
      renderEditors(attributesDiv);

      final Div attrContainerDiv = new Div();
      attrContainerDiv.setStyle("max-height: 265px; overflow-y: auto;");
      attrContainerDiv.appendChild(attributesDiv);
      previewDataAreaDiv.appendChild(attrContainerDiv);

      final Div buttonDiv = new Div();
      buttonDiv.setStyle(
          "padding: 3px 20px 3px 24px; text-align:left; height: 26px; position:relative");

      final Button applyButton = new Button(Labels.getLabel("general.apply"));
      applyButton.setStyle("position:absolute; right:20px; top: 4px");
      applyButton.addEventListener(
          Events.ON_CLICK,
          new org.zkoss.zk.ui.event.EventListener() {
            @Override
            public void onEvent(final Event event) throws Exception // NOPMD: ZK Specific
                {

              updatePreviewData();
            }
          });
      buttonDiv.appendChild(applyButton);
      previewDataAreaDiv.appendChild(buttonDiv);

      return previewDataAreaDiv;
    }
Пример #27
0
    private static QueueTask createDivForElement(IDatesMapper datesMapper, LimitingResourceQueueElement queueElement) {

        final Task task = queueElement.getResourceAllocation().getTask();
        final OrderElement order = getRootOrder(task);

        QueueTask result = new QueueTask(queueElement);
        String cssClass = "queue-element";
        result.setTooltiptext(createTooltiptext(queueElement));

        int startPixels = getStartPixels(datesMapper, queueElement);
        result.setLeft(forCSS(startPixels));

        if ( startPixels < 0 ) {
            cssClass += " truncated-start ";
        }

        int taskWidth = getWidthPixels(datesMapper, queueElement);

        if ( (startPixels + taskWidth) > datesMapper.getHorizontalSize() ) {
            taskWidth = datesMapper.getHorizontalSize() - startPixels;
            cssClass += " truncated-end ";
        } else {
            result.appendChild(generateNonWorkableShade(datesMapper, queueElement));
        }
        result.setWidth(forCSS(taskWidth));

        LocalDate deadlineDate = task.getDeadline();
        boolean isOrderDeadline = false;

        if ( deadlineDate == null ) {

            Date orderDate = order.getDeadline();

            if ( orderDate != null ) {

                deadlineDate = LocalDate.fromDateFields(orderDate);
                isOrderDeadline = true;

            }
        }

        if ( deadlineDate != null ) {

            int deadlinePosition = getDeadlinePixels(datesMapper, deadlineDate);

            if ( deadlinePosition < datesMapper.getHorizontalSize() ) {
                Div deadline = new Div();
                deadline.setSclass(isOrderDeadline ? "deadline order-deadline" : "deadline");
                deadline.setLeft((deadlinePosition - startPixels - DEADLINE_MARK_HALF_WIDTH) + "px");
                result.appendChild(deadline);
                result.appendChild(generateNonWorkableShade(datesMapper, queueElement));
            }

            if ( deadlineDate.isBefore(queueElement.getEndDate()) ) {
                cssClass += " unmet-deadline ";
            }
        }

        result.setClass(cssClass);
        result.appendChild(generateCompletionShade(datesMapper, queueElement));
        Component progressBar = generateProgressBar(datesMapper, queueElement);

        if ( progressBar != null ) {
            result.appendChild(progressBar);
        }

        return result;
    }
  /** Creates the components..<br> */
  private void createComponents() {

    /**
     * !! Windows as NameSpaceContainer to prevent not unique id's error from other dashboard module
     * buttons or other used components.
     */
    Window win = new Window();
    win.setBorder("none");
    win.setParent(this);

    Groupbox gb = new Groupbox();
    gb.setMold("3d");
    gb.setClosable(false);
    gb.setParent(win);
    Caption cap = new Caption();
    cap.setImage("/images/icons/new_icons_10.gif");
    cap.setLabel(Labels.getLabel("common.Application.History"));
    cap.setStyle("padding: 0px;");
    cap.setParent(gb);

    // Buttons Toolbar/Timer
    Div div = new Div();
    div.setSclass("z-toolbar");
    div.setStyle("padding: 0px");
    div.setParent(cap);
    Hbox hbox = new Hbox();
    hbox.setPack("stretch");
    hbox.setSclass("hboxRemoveWhiteStrips");
    hbox.setWidth("100%");
    hbox.setParent(div);
    Toolbar toolbarRight = new Toolbar();
    toolbarRight.setAlign("end");
    toolbarRight.setStyle("float:right; border-style: none;");
    toolbarRight.setParent(hbox);

    Hbox hboxBtn = new Hbox();
    hboxBtn.setSclass("hboxRemoveWhiteStrips");
    hboxBtn.setWidth("100%");
    hboxBtn.setParent(toolbarRight);

    //		Paging paging = new Paging();
    //		paging.setParent(hboxBtn);
    //		paging.setDetailed(true);

    if (isTimerControl()) {
      Button btnTimer = new Button();
      btnTimer.setId("btnTimer");
      btnTimer.setHeight("22px");
      btnTimer.setImage("/images/icons/clock1_16x16.gif");

      // convert to seconds
      int seconds = (int) Math.round(getDelay() / 1000);

      if (seconds > 60) {
        // convert to minutes and set localization to minutes
        int minutes = (int) Math.round((getDelay() / 1000) / 60);
        btnTimer.setTooltiptext(
            Labels.getLabel("btnTimer.tooltiptext")
                + " "
                + minutes
                + " "
                + Labels.getLabel("common.Minutes"));
      } else
        // set localization to seconds
        btnTimer.setTooltiptext(
            Labels.getLabel("btnTimer.tooltiptext")
                + " "
                + seconds
                + " "
                + Labels.getLabel("common.Seconds"));

      btnTimer.addEventListener("onClick", new BtnClickListener());
      btnTimer.setParent(hboxBtn);
    }

    Button btnRefresh = new Button();
    btnRefresh.setId("btnRefresh");
    btnRefresh.setHeight("22px");
    btnRefresh.setLabel("!");
    btnRefresh.setTooltiptext(Labels.getLabel("btnRefresh.tooltiptext"));
    btnRefresh.addEventListener("onClick", new BtnClickListener());
    btnRefresh.setParent(hboxBtn);
    // END Buttons Toolbar/Timer

    // body
    Borderlayout bl = new Borderlayout();
    bl.setHeight(getModulHeight() + "px");
    bl.setParent(gb);
    Center ct = new Center();
    ct.setSclass("FDCenterNoBorder");
    ct.setStyle("background-color: white");
    ct.setFlex(true);
    ct.setParent(bl);

    // Listbox
    listbox = new Listbox();
    listbox.setStyle("border: none;");
    listbox.setHeight("100%");
    listbox.setVisible(true);
    listbox.setParent(ct);
    listbox.setItemRenderer(new ItemRenderer());

    Listhead listhead = new Listhead();
    listhead.setParent(listbox);

    Listheader listheader1 = new Listheader();
    listheader1.setWidth("100px");
    listheader1.setHeight("0px");
    listheader1.setParent(listhead);

    Listheader listheader2 = new Listheader();
    listheader2.setWidth("100%");
    listheader1.setHeight("0px");
    listheader2.setParent(listhead);

    doReadData();
  }
Пример #29
0
  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);
  }
Пример #30
0
  /**
   * Static Setup - add fields to parameterPanel.
   *
   * <pre>
   * 		ResourceType	Resource	DateTimeFrom	DateTimeTo	New
   *  </pre>
   */
  private void statInit() {
    fieldFrom.setWidth("180px");
    fieldTo.setWidth("180px");

    bNew.addEventListener(Events.ON_CLICK, this);

    Grid grid = GridFactory.newGridLayout();

    Rows rows = new Rows();
    grid.appendChild(rows);

    Row row = new Row();
    rows.appendChild(row);
    row.appendChild(fieldResourceType.getLabel().rightAlign());
    row.appendChild(fieldResource.getLabel().rightAlign());
    row.appendChild(labelFrom.rightAlign());
    row.appendChild(labelTo.rightAlign());
    row.appendChild(new Label());

    row = new Row();
    rows.appendChild(row);
    row.appendChild(fieldResourceType.getComponent());
    row.appendChild(fieldResource.getComponent());
    Div div = new Div();
    div.setStyle("text-align: right;");
    div.appendChild(fieldFrom);
    row.appendChild(div);
    div = new Div();
    div.setStyle("text-align: right;");
    div.appendChild(fieldTo);
    row.appendChild(div);
    row.appendChild(bNew);

    layout = new Borderlayout();
    layout.setWidth("100%");
    layout.setHeight("100%");
    if (!isLookup()) {
      layout.setStyle("position: absolute");
    }
    this.appendChild(layout);

    North north = new North();
    layout.appendChild(north);
    north.appendChild(grid);

    Center center = new Center();
    layout.appendChild(center);
    div = new Div();
    div.appendChild(contentPanel);
    if (isLookup()) contentPanel.setWidth("99%");
    else contentPanel.setStyle("width: 99%; margin: 0px auto;");
    contentPanel.setVflex(true);
    div.setStyle("width :100%; height: 100%");
    center.appendChild(div);
    div.setVflex("1");
    div.setHflex("1");

    South south = new South();
    layout.appendChild(south);
    southBody = new Vbox();
    southBody.setWidth("100%");
    south.appendChild(southBody);
    southBody.appendChild(confirmPanel);
    southBody.appendChild(new Separator());
    southBody.appendChild(statusBar);
  }