示例#1
0
  public Caracteristicas() {
    buildMainLayout();
    setCompositionRoot(mainLayout);

    // TODO add user code here
    // Variables
    datos = new Datos();
    listaAvance = new LinkedList<LinkedList<Object>>();
    // Textfields
    txtNoAvance.setEnabled(false);
    // Comboboxes
    cmbEtapa.setNullSelectionAllowed(false);
    llenarLista(datos.getEtapaFenologica(), cmbEtapa);
    // Timefields
    tmfAvance.set24HourClock(false);
    tmfRecesion.set24HourClock(false);
    // Tables
    tblAvance.addContainerProperty("Núm.", Object.class, null);
    tblAvance.addContainerProperty("Distancia (m)", Object.class, null);
    tblAvance.addContainerProperty("Avance (tiempo)", Object.class, null);
    tblAvance.addContainerProperty("Recesión (tiempo)", Object.class, null);
    tblAvance.setSelectable(true);
    tblAvance.setSortEnabled(true);
    tblAvance.addItemClickListener(cargarAvanceListener);
    // Buttons
    btnAdd.addClickListener(addAvanceListener);
    btnCancel.addClickListener(cancelarListener);

    limpiarAvance();
    setValidaciones();
  }
示例#2
0
 private LinkedList<Object> getRow() {
   LinkedList<Object> avance = new LinkedList<Object>();
   avance.add(0);
   avance.add(txtDistancia.getValue());
   avance.add(setFormato(tmfAvance.getHours()) + ":" + setFormato(tmfAvance.getMinutes()));
   avance.add(setFormato(tmfRecesion.getHours()) + ":" + setFormato(tmfRecesion.getMinutes()));
   return avance;
 }
示例#3
0
  private void limpiarAvance() {
    txtNoAvance.setValue(listaAvance.size() + 1 + "");
    txtDistancia.setValue("");
    tmfAvance.setValue(null);
    tmfRecesion.setValue(null);

    btnAdd.setCaption("Agregar");
    btnCancel.setVisible(false);
    absLAvance.setVisible(false);
    absLAvanceRecesion.setHeight("265px");
  }
示例#4
0
  @AutoGenerated
  private AbsoluteLayout buildAbsLAvance() {
    // common part: create layout
    absLAvance = new AbsoluteLayout();
    absLAvance.setImmediate(false);
    absLAvance.setWidth("100.0%");
    absLAvance.setHeight("55px");

    // txtNoAvance
    txtNoAvance = new TextField();
    txtNoAvance.setCaption("Núm.");
    txtNoAvance.setImmediate(false);
    txtNoAvance.setWidth("60px");
    txtNoAvance.setHeight("25px");
    absLAvance.addComponent(txtNoAvance, "top:28.0px;left:10.0px;");

    // txtDistancia
    txtDistancia = new TextField();
    txtDistancia.setCaption("Distancia");
    txtDistancia.setImmediate(false);
    txtDistancia.setWidth("100px");
    txtDistancia.setHeight("25px");
    absLAvance.addComponent(txtDistancia, "top:28.0px;left:85.0px;");

    // lblDistancia
    lblDistancia = new Label();
    lblDistancia.setImmediate(false);
    lblDistancia.setWidth("-1px");
    lblDistancia.setHeight("-1px");
    lblDistancia.setValue("m");
    absLAvance.addComponent(lblDistancia, "top:32.0px;left:190.0px;");

    // tmfAvance
    tmfAvance = new TimeField();
    tmfAvance.setCaption("Avance");
    tmfAvance.setImmediate(false);
    tmfAvance.setWidth("-1px");
    tmfAvance.setHeight("25px");
    absLAvance.addComponent(tmfAvance, "top:28.0px;left:215.0px;");

    // tmfRecesion
    tmfRecesion = new TimeField();
    tmfRecesion.setCaption("Recesión");
    tmfRecesion.setImmediate(false);
    tmfRecesion.setWidth("-1px");
    tmfRecesion.setHeight("25px");
    absLAvance.addComponent(tmfRecesion, "top:28.0px;left:330.0px;");

    return absLAvance;
  }
示例#5
0
  private boolean validarAvance() {
    if (txtDistancia.getValue().isEmpty() || !txtDistancia.isValid())
      return notificar(
          "Se requiere especificar un valor estríctamente numérico para la distancia",
          txtDistancia);
    if (tmfAvance.getValue() == null)
      return notificar("Se requiere especificar la hora de avance", tmfAvance);
    if (tmfRecesion.getValue() == null)
      return notificar("Se requiere especificar la hora de recesión", tmfRecesion);
    if (tmfAvance.getValue().equals(tmfRecesion.getValue())
        || tmfAvance.getValue().after(tmfRecesion.getValue()))
      return notificar("La hora de recesión debe ser mayor que la de avance", tmfRecesion);

    return true;
  }
示例#6
0
 private void setHora(TimeField tmf, String hora) {
   String[] horaAux = hora.split(":");
   tmf.setHours(Integer.parseInt(horaAux[0]));
   tmf.setMinutes(Integer.parseInt(horaAux[1]));
 }