Example #1
0
  @Override
  public void addHandler(final PTInstruction addHandler, final UIService uiService) {

    if (HANDLER.KEY_.DATE_VALUE_CHANGE_HANDLER.equals(addHandler.getString(HANDLER.KEY))) {
      final DateBox dateBox = cast();
      final TextBox textBox = dateBox.getTextBox();
      dateBox.addValueChangeHandler(
          new ValueChangeHandler<Date>() {

            @Override
            public void onValueChange(final ValueChangeEvent<Date> event) {
              triggerEvent(addHandler, uiService, dateBox);
            }
          });
      textBox.addValueChangeHandler(
          new ValueChangeHandler<String>() {

            @Override
            public void onValueChange(final ValueChangeEvent<String> event) {
              triggerEvent(addHandler, uiService, dateBox);
            }
          });
    } else {
      super.addHandler(addHandler, uiService);
    }
  }
  @UiHandler("save")
  void onSave(ClickEvent event) {

    if (!formularioValido()) return;

    //		CajaDeclarada cd = new CajaDeclarada();
    //		Caja c = new Caja();
    //		c.setSiglas("CAJADEC");
    //		cd.setCaja(c);

    // TODO falta validar TOODOOO!!!

    tiempoServicioReconocido.setEmpleador(empleador);
    //		tiempoServicioReconocido.setCajaDeclarada(cd);
    tiempoServicioReconocido.setInicio(inicio.getValue());
    tiempoServicioReconocido.setFin(fin.getValue());
    tiempoServicioReconocido.setEmpleador(empleador);

    if (listener != null) {
      listener.onChanged(tiempoServicioReconocido);
    }
    //		AppUtils.EVENT_BUS.fireEvent(new
    // PeriodoAporteDeclaradoChangedEvent(tiempoServicioDeclarado));
    close();
  }
Example #3
0
 @UiHandler("clearSessionFiltersButton")
 void handleClearSessionFiltersButtonClick(ClickEvent e) {
   sessionsTo.setValue(null, true);
   sessionsFrom.setValue(null, true);
   sessionIdsTextBox.setText(null);
   stopTypingSessionIdsTimer.schedule(10);
 }
Example #4
0
 public void setEdited(boolean enabled) {
   dateBox.setEnabled(enabled);
   if (!enabled) {
     dateBox.addStyleDependentName("disabled");
   } else {
     dateBox.removeStyleDependentName("disabled");
   }
   edited = enabled;
 }
Example #5
0
  public static DateBox getDateBox() {
    DateTimeFormat formatter = DateTimeFormat.getFormat("dd/MMM/yyyy");
    DateBox db = new DateBox();
    db.setFormat(new DateBox.DefaultFormat(formatter));
    db.setStyleName(Constants.CSS_NORMAL_TEXT);
    db.getElement().getStyle().setMargin(0, Unit.PX);

    return db;
  }
Example #6
0
    @Override
    public void showDatePicker() {
      if (!getTextBox().getText().trim().isEmpty() || defaultMonth == null) {
        super.showDatePicker();
        return;
      }

      super.showDatePicker();
      getDatePicker().setCurrentMonth(defaultMonth);
    }
  public EditProblemInterview(JSONObject interview) {

    this.setSpacing(20);

    this.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);

    String companyUniqueID = ConvertJson.convertToString(interview.get("company"));
    if (companyUniqueID == null) {

      companyUniqueID =
          ConvertJson.convertToString(UniqueIDGlobalVariables.companyUniqueID.get("ID"));

      ConvertJson.setStringValue(interview, companyUniqueID, "company");
    }

    String interviewerUniqueID = ConvertJson.convertToString(interview.get("interviewer"));
    if (interviewerUniqueID == null && UniqueIDGlobalVariables.uniqueID != null) {

      interviewerUniqueID = ConvertJson.convertToString(UniqueIDGlobalVariables.uniqueID.get("ID"));

      ConvertJson.setStringValue(interview, interviewerUniqueID, "interviewer");
    }
    this.add(FormField.getStringField("Interviewer", interviewerUniqueID));

    String date = ConvertJson.convertToString(interview.get("datetime"));
    if (date == null) {
      dateTime.setValue(new Date());
    } else {
      dateTime.setValue(new Date(new Long(date)));
    }

    this.add(FormField.getFormField("<font color=red>*</font> Date", dateTime));

    String problem = ConvertJson.convertToString(interview.get("problem"));
    problemField = new ProblemsListbox(problem);
    this.add(FormField.getFormField("<font color=red>*</font> Problem", problemField));

    String customerName = ConvertJson.convertToString(interview.get("customerName"));
    customerNameField.setValue(customerName);
    this.add(FormField.getFormField("<font color=red>*</font> Customer Name", customerNameField));

    String customerUniqueID = ConvertJson.convertToString(interview.get("customerUniqueID"));
    customerUniqueIDField.setValue(customerUniqueID);
    this.add(FormField.getFormField("Customer UniqueID", customerUniqueIDField));

    String videoURLValue = ConvertJson.convertToString(interview.get("videoURL"));
    videoURLField.setValue(videoURLValue);
    this.add(FormField.getFormField("Video URL", videoURLField));
    videoURLField.setWidth("300px");

    String notesValue = ConvertJson.convertToString(interview.get("notes"));
    notes.setHTML(notesValue);
    this.add(FormField.getFormField("Notes", notes));
    notes.setSize("300px", "100px");
  }
  @Override
  public void createFilterWidgets() {

    castb_patient_identifiantBox = new TextBox();
    castb_patient_identifiantFilterBox = new ImogFilterBox(castb_patient_identifiantBox);
    castb_patient_identifiantFilterBox.setFilterLabel(NLS.constants().patient_field_identifiant());
    addTableFilter(castb_patient_identifiantFilterBox);
    castb_patient_nomBox = new TextBox();
    castb_patient_nomFilterBox = new ImogFilterBox(castb_patient_nomBox);
    castb_patient_nomFilterBox.setFilterLabel(NLS.constants().patient_field_nom());
    addTableFilter(castb_patient_nomFilterBox);

    dateExamenAfterBox = new DateBox();
    dateExamenAfterBox.setFormat(new SimpleImogDateFormat(DateUtil.getDateFormater()));
    dateExamenAfterFilterBox = new ImogFilterBox(dateExamenAfterBox);
    dateExamenAfterFilterBox.setFilterLabel(
        NLS.constants().examenATB_field_dateExamen()
            + BaseNLS.constants().search_operator_superior());
    addTableFilter(dateExamenAfterFilterBox);

    dateExamenBeforeBox = new DateBox();
    dateExamenBeforeBox.setFormat(new SimpleImogDateFormat(DateUtil.getDateFormater()));
    dateExamenBeforeFilterBox = new ImogFilterBox(dateExamenBeforeBox);
    dateExamenBeforeFilterBox.setFilterLabel(
        NLS.constants().examenATB_field_dateExamen()
            + BaseNLS.constants().search_operator_inferior());
    addTableFilter(dateExamenBeforeFilterBox);

    raisonDepistageBox = new ListBox();
    raisonDepistageBox.addItem("", BaseNLS.constants().enumeration_unknown());
    raisonDepistageBox.setSelectedIndex(0);
    raisonDepistageBox.addItem(
        NLS.constants().examenATB_raisonDepistage_diagnostic_option(),
        EpicamEnumConstants.EXAMENATB_RAISONDEPISTAGE_DIAGNOSTIC);
    raisonDepistageBox.addItem(
        NLS.constants().examenATB_raisonDepistage_suivi_option(),
        EpicamEnumConstants.EXAMENATB_RAISONDEPISTAGE_SUIVI);
    raisonDepistageFilterBox = new ImogFilterBox(raisonDepistageBox);
    raisonDepistageFilterBox.setFilterLabel(NLS.constants().examenATB_field_raisonDepistage());
    addTableFilter(raisonDepistageFilterBox);

    resultatBox = new TextBox();
    resultatFilterBox = new ImogFilterBox(resultatBox);
    resultatFilterBox.setFilterLabel(NLS.constants().examenATB_field_resultat());
    addTableFilter(resultatFilterBox);

    deletedEntityBox = new ImogBooleanAsRadio();
    deletedEntityBox.isStrict(true);
    deletedEntityBox.setEnabled(true);
    deletedEntityBox.setValue(false);
    deletedEntityBoxFilterBox = new ImogFilterBox(deletedEntityBox);
    deletedEntityBoxFilterBox.setFilterLabel(BaseNLS.constants().entity_field_deleted());
    addTableFilter(deletedEntityBoxFilterBox);
  }
  @Override
  public void resetFilterWidgets() {

    castb_patient_identifiantBox.setValue(null);
    castb_patient_nomBox.setValue(null);
    dateExamenBeforeBox.setValue(null);
    dateExamenAfterBox.setValue(null);
    raisonDepistageBox.setSelectedIndex(0);
    resultatBox.setValue(null);

    deletedEntityBox.setValue(false);
  }
Example #10
0
 private void addDatePanel() {
   Grid datePanel = new Grid(2, 2);
   datePanel.setText(0, 0, "Departure Date:");
   DateBox departureBox = new DateBox();
   Date departureDate = new Date();
   departureBox.setValue(departureDate);
   datePanel.setWidget(0, 1, departureBox);
   datePanel.setText(1, 0, "Return Date:");
   DateBox returnBox = new DateBox();
   Date returnDate = DateUtils.datePlusWeek(departureDate);
   returnBox.setValue(returnDate);
   datePanel.setWidget(1, 1, returnBox);
   RootPanel.get("date-panel").add(datePanel);
 }
Example #11
0
  private Widget addWidget(AddRecord recordTable) {
    Widget widget = new Widget();
    if (recordTable.getFieldType().equals(SQL_TYPE_STRING)) {
      widget = new TextBox();
      if (recordTable.getFieldType() != null) {
        ((TextBox) widget).setValue(recordTable.getFieldValue());
        ((TextBox) widget).setEnabled(recordTable.isEditable());
      }
    } else if (recordTable.getFieldType().equals(SQL_TYPE_DATE)) {
      widget = new DateBox();
      ((DateBox) widget).setEnabled(recordTable.isEditable());
    } else if (recordTable.getFieldType().equals(SQL_TYPE_LIST_STRING)) {
      final ListBox listBox = new ListBox();
      listBox.setEnabled(recordTable.isEditable());
      for (RefRecord rec : recordTable.getListRefRecord()) {
        listBox.addItem(rec.getValue(), String.valueOf(rec.getKey()));
      }

      widget = listBox;
    } else {
      widget = new TextBox();
      if (recordTable.getFieldValue() != null) {
        ((TextBox) widget).setValue(recordTable.getFieldValue());
        ((TextBox) widget).setEnabled(recordTable.isEditable());
      }
    }
    return widget;
  }
Example #12
0
 public FlowSearch() {
   initWidget(sUiBinder.createAndBindUi(this));
   // TODO Replace this hack with a changeTitleEvent
   Window.setTitle("Flow search");
   beginDate.setFormat(new DateBox.DefaultFormat(DateTimeFormat.getFormat("dd/MM/yy")));
   beginDate.getTextBox().setVisibleLength(8);
   beginDate.getTextBox().setMaxLength(8);
   beginDate
       .getTextBox()
       .addKeyPressHandler(
           new KeyPressHandler() {
             public void onKeyPress(KeyPressEvent pEvent) {
               presenter.filterData(FlowSearch.this, pEvent);
             }
           });
   table = new FlowSearchTableModel(service).getTable();
   searchResult.add(table);
 }
 public MethodCallSearch() {
   initWidget(uiBinder.createAndBindUi(this));
   Window.setTitle("Method call search");
   flowBeginDate.setFormat(new DateBox.DefaultFormat(DateTimeFormat.getFormat("dd/MM/yy")));
   flowBeginDate.getTextBox().setVisibleLength(8);
   flowBeginDate.getTextBox().setMaxLength(8);
   flowBeginDate
       .getTextBox()
       .addKeyPressHandler(
           new KeyPressHandler() {
             public void onKeyPress(KeyPressEvent pEvent) {
               presenter.filterData(MethodCallSearch.this, pEvent);
             }
           });
   tableModel = new MetodCallSearchTableModel(service);
   table = tableModel.getTable();
   searchResult.add(table);
 }
Example #14
0
  protected void triggerEvent(
      final PTInstruction addHandler, final UIService uiService, final DateBox dateBox) {
    final PTInstruction instruction = new PTInstruction();
    instruction.setObjectID(addHandler.getObjectID());
    instruction.put(TYPE.KEY, TYPE.KEY_.EVENT);
    instruction.put(HANDLER.KEY, HANDLER.KEY_.DATE_VALUE_CHANGE_HANDLER);
    instruction.put(PROPERTY.VALUE, dateBox.getTextBox().getText());

    uiService.sendDataToServer(dateBox, instruction);
  }
  public void setCustomer(CustomerModel c) {
    customer = c;

    if (customer != null) {
      // Display the fields
      firstname.setText(customer.getFirstname());
      lastname.setText(customer.getLastname());
      birthdate.setValue(customer.getBirthdate());
    }
  }
Example #16
0
 /**
  * Defines that the field shall notify value changes
  *
  * @param eventBus the event bus that will be used to fire the value change events
  */
 public void notifyChanges(final EventBus eventBus) {
   if (eventBus != null) {
     dateBox.addValueChangeHandler(
         new ValueChangeHandler<Date>() {
           @Override
           public void onValueChange(ValueChangeEvent<Date> arg0) {
             eventBus.fireEvent(new FieldValueChangeEvent(ImogDateBox.this));
           }
         });
   }
 }
 @EventHandler("updateButton")
 public void updateTaskButton(ClickEvent e) {
   presenter.updateTask(
       Long.parseLong(taskIdText.getText()),
       taskNameText.getText(),
       taskDescriptionTextArea.getText(),
       userText.getText(),
       subTaskStrategyListBox.getItemText(subTaskStrategyListBox.getSelectedIndex()),
       dueDate.getValue(),
       taskPriorityListBox.getSelectedIndex());
 }
  @UiHandler("valider_affectation")
  void onValider_affectationClick(ClickEvent event) {

    Affectation af = new Affectation();

    af.setDateFin(date_fin.getValue());
    af.setDateDebut(date_debut.getValue());
    Terminal t = new Terminal();
    AdresseIp a = new AdresseIp();
    // af.adresseIp.setIdAdresse(Integer.parseInt(valider_affectation.getTitle()));
    a.setIdplage(id_plage);
    a.setChamp1(Integer.parseInt(adresse_selectione.getText()));
    a.setChamp2(Integer.parseInt(adresse_selectione2.getText()));
    a.setChamp3(Integer.parseInt(adresse_selectione3.getText()));
    a.setChamp4(Integer.parseInt(adresse_selectione5.getText()));
    a.setIdAdresse(Integer.parseInt(valider_affectation.getTitle()));
    t.setIdTerminal(Integer.parseInt(mes_terminaux.getValue(mes_terminaux.getSelectedIndex())));
    af.setTerminal(t);
    af.setAdresseIp(a);

    greetingService.ajouter_affectation(
        af,
        new AsyncCallback() {

          @Override
          public void onFailure(Throwable caught) {
            // TODO Auto-generated method stub

          }

          @Override
          public void onSuccess(Object result) {
            Window.alert("l affectation s est deroule avec succes");
          }
        });

    RootPanel.get().clear();
    adresses_dispo p_a = new adresses_dispo();
    RootPanel.get().add(p_a);
  }
Example #19
0
  @Override
  public void clear() {
    rewardsName.setTitle("");
    /* 增加请选择下拉选项 */
    // rewardsType.setSelectedIndex(0);
    rewardsDefinition.setText("");
    standard.setText("");
    startTime.setValue(null);

    peopleSizeLimit.setValue("");
    frequency = null;
    settingText.setText("");
    autoCbx.setValue(false, true);
    specialCbx.setValue(false, true);
    birthRadio.setValue(false, true);

    // nextPublicTime.setValue(null);
    nextRewardsTime.setValue(null);
    // lastRewardsTime.setText("");
    // 清空设定规则为为设定
    // setIsAmountLevel("未设定");
  }
  @UiHandler("save")
  void saveCustomer(ClickEvent event) {
    if (customer == null) {
      customer = new CustomerModel();
    }

    // Update the fields
    customer.setFirstname(firstname.getText());
    customer.setLastname(lastname.getText());
    customer.setBirthdate(birthdate.getValue());

    // Call the presenter
    presenter.saveCustomer(customer);
  }
 @DoNotRunWith(Platform.HtmlUnitBug)
 public void testAccessors() {
   DateBox db = new DateBox();
   assertFalse(db.isDatePickerShowing());
   db.showDatePicker();
   assertTrue(db.isDatePickerShowing());
   db.hideDatePicker();
   assertFalse(db.isDatePickerShowing());
 }
  public boolean formularioValido() {

    Date hoy = LoginService.Util.currentUser.getFechaLogin();

    UIValidarFormulario vf =
        new UIValidarFormulario(
            "Favor complete las siguientes informaciones solicitadas para agregar tiempo de servicio");

    if (empleador == null) {
      vf.addError("Seleccione un empleador");
    }

    if (!AppUtils.esFecha(inicio)) {
      vf.addError("Fecha de inicio no valida");
    } else {
      if (inicio.getValue().after(hoy)) {
        vf.addError("Fecha de inicio no puede ser posterior a la fecha de hoy");
      }
    }

    if (!AppUtils.esFecha(fin)) {
      vf.addError("Fecha fin no valida");
    } else {
      if (fin.getValue().after(hoy)) {
        vf.addError("Fecha fin no puede ser posterior a la fecha de hoy");
      }
    }

    if (AppUtils.esFecha(inicio) && AppUtils.esFecha(fin)) {
      if (fin.getValue().before(inicio.getValue())) {
        vf.addError("Rango de fecha del inicio al fin no valido");
      }
    }

    return vf.esValido();
  }
Example #23
0
 @SuppressWarnings("deprecation")
 public Date parse(DateBox dateBox, String dateText, boolean reportError) {
   Date date = null;
   try {
     if (dateText.length() > 0) {
       date = dateTimeFormat.parse(dateText);
     }
   } catch (IllegalArgumentException exception) {
     try {
       date = new Date(dateText);
     } catch (IllegalArgumentException e) {
       if (reportError) {
         dateBox.addStyleName(DATE_BOX_FORMAT_ERROR);
       }
       return null;
     }
   }
   return date;
 }
Example #24
0
  private void setupSessionsDateRange() {
    DateTimeFormat format =
        DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.YEAR_MONTH_NUM_DAY);

    sessionsFrom.setFormat(new DateBox.DefaultFormat(format));
    sessionsTo.setFormat(new DateBox.DefaultFormat(format));

    sessionsFrom
        .getTextBox()
        .addValueChangeHandler(new EmptyDateBoxValueChangePropagator(sessionsFrom));
    sessionsTo
        .getTextBox()
        .addValueChangeHandler(new EmptyDateBoxValueChangePropagator(sessionsTo));

    final ValueChangeHandler<Date> valueChangeHandler =
        new ValueChangeHandler<Date>() {

          @Override
          public void onValueChange(ValueChangeEvent<Date> dateValueChangeEvent) {
            sessionIdsTextBox.setValue(null);
            Date fromDate = sessionsFrom.getValue();
            Date toDate = sessionsTo.getValue();

            if (fromDate == null || toDate == null) {
              sessionDataProvider.addDataDisplayIfNotExists(sessionsDataGrid);
              sessionDataForDatePeriodAsyncProvider.removeDataDisplayIfNotExists(sessionsDataGrid);

              return;
            }

            sessionDataForDatePeriodAsyncProvider.setDateRange(fromDate, toDate);

            sessionDataProvider.removeDataDisplayIfNotExists(sessionsDataGrid);
            sessionDataForSessionIdsAsyncProvider.removeDataDisplayIfNotExists(sessionsDataGrid);
            sessionDataForDatePeriodAsyncProvider.addDataDisplayIfNotExists(sessionsDataGrid);
          }
        };

    sessionsTo.addValueChangeHandler(valueChangeHandler);
    sessionsFrom.addValueChangeHandler(valueChangeHandler);
  }
  public TiempoServicioReconocidoEditor(TiempoServicioReconocido periodoAporteReconocidoEdit) {

    this.tiempoServicioReconocido = periodoAporteReconocidoEdit;

    initWidget(GWT.<Binder>create(Binder.class).createAndBindUi(this));

    if (tiempoServicioReconocido == null) {
      tiempoServicioReconocido = new TiempoServicioReconocido();
    } else {
      inicio.setValue(tiempoServicioReconocido.getInicio());
      fin.setValue(tiempoServicioReconocido.getFin());
      empleador = tiempoServicioReconocido.getEmpleador();
      empleadorNombre.setText(tiempoServicioReconocido.getEmpleador().getNombre());
    }

    DateTimeFormat dateFormat = DateTimeFormat.getFormat("dd/MM/yyyy");
    inicio.setFormat(new DateBox.DefaultFormat(dateFormat));
    inicio.getDatePicker().setYearAndMonthDropdownVisible(true);
    inicio.getDatePicker().setVisibleYearCount(99);

    fin.setFormat(new DateBox.DefaultFormat(dateFormat));
    fin.getDatePicker().setYearAndMonthDropdownVisible(true);
    fin.getDatePicker().setVisibleYearCount(99);
  }
Example #26
0
  public void Configure_start_time() {

    final DialogBox dialogBox = new DialogBox();
    dialogBox.addStyleName("g-DialogBox");
    DOM.setStyleAttribute(dialogBox.getElement(), "border", "0px");
    dialogBox.setText("Set Time");
    dialogBox.setSize("294", "207");

    final AbsolutePanel absolutePanel = new AbsolutePanel();
    dialogBox.setWidget(absolutePanel);
    absolutePanel.setSize("294px", "187px");

    // 自定义datebox的输出格式,在这里采用了简洁的输出格式"M/d/yy H:mm"
    final DateBox dateBox = new DateBox();
    DateTimeFormat dateTimeFormat =
        DateTimeFormat.getFormat(
            "M/d/yy H:mm"); // DateTimeFormat只能通过函数getFormat来生成满足特定pattern的对象,因为其构造函数为protected
    DateBox.DefaultFormat defaultFormat = new DateBox.DefaultFormat(dateTimeFormat);
    dateBox.setFormat(defaultFormat);
    absolutePanel.add(dateBox, 109, 35);
    dateBox.setWidth("150px");

    final Label dateLabel = new Label("Date:");
    absolutePanel.add(dateLabel, 36, 35);
    dateLabel.setSize("38px", "18px");

    final Label dateLabel_1 = new Label("Time:");
    absolutePanel.add(dateLabel_1, 36, 80);
    dateLabel_1.setSize("38px", "18px");

    final ListBox listBox = new ListBox();
    absolutePanel.add(listBox, 109, 77);
    listBox.setSize("150px", "21px");
    String[] minutes = {"00", "15", "30", "45"};
    String[] hours = {
      "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16",
      "17", "18", "19", "20", "21", "22", "23"
    };
    String[] times = new String[96];
    // System.out.println(minutes.length+"  "+hours.length+"  "+times.length);
    for (int i = 0; i < 24; i++) {
      for (int j = 0; j < 4; j++) {
        times[4 * i + j] = hours[i] + ":" + minutes[j];
      }
    }
    for (int i = 0; i < 96; i++) {
      listBox.addItem(times[i]);
    }

    final Button okButton = new Button();
    DOM.setStyleAttribute(okButton.getElement(), "fontSize", "10pt");
    okButton.removeStyleName("gwt-Button");
    okButton.addClickHandler(
        new ClickHandler() {

          public void onClick(ClickEvent event) {
            // TODO Auto-generated method stub
            TextBox inner_textBox = dateBox.getTextBox();
            if (inner_textBox.getText() == null || inner_textBox.getText().equals("")) {
              dateBox.addStyleName("dateBoxFormatError"); // 如果用户没编辑日期,则datebox框变红,等待用户更正
            } else {
              String dateString = inner_textBox.getText();
              int index = listBox.getSelectedIndex();
              String timeString = listBox.getValue(index);
              if (timeString != null) {
                String[] date_and_time = dateString.split(" ");
                date_and_time[1] = timeString;
                dateString = date_and_time[0] + " " + date_and_time[1];
                start_time = dateString;
              }
              dialogBox.hide();
            }
            System.out.println(start_time);
          }
        });

    absolutePanel.add(okButton, 93, 129);
    okButton.setSize("105px", "21px");
    okButton.setText("OK");

    dialogBox.center();
  }
  /**
   * Die onLoad-Methode wird verwendet um in der Seite die verschiedenen Panels anzuordnen. Sie
   * startet beim Ausführen der Seite, da sie das Pendant zur <code>main()</code>-Methode einer
   * normalen Java Applikation darstellt
   */
  public void onLoad() {
    vonDateBox.setFormat(new DateBox.DefaultFormat(dF));
    bisDateBox.setFormat(new DateBox.DefaultFormat(dF));
    final HTML headline =
        new HTML(
            " <div class='"
                + "subline"
                + "'><h2>Reportgenerator 2: Alle Nachrichten je Zeitraum anzeigen </h2></div> ");
    // final HTML subtext = new HTML(" <div class='"+ "subtext"+ "'><h4> Der Report 2 gibt alle
    // Nachrichten in einen bestimmten Zeitraum aus  </h4></div> ");

    // Die Panels werden anschaulich angeordnet

    reportPanel.add(ueberSchrift2);
    reportPanel2.add(reportPanel2_left);
    reportPanel2.add(reportPanel2_right);
    reportPanel2_left.add(subSchrift2);
    reportPanel2_left.add(vonDateBox);
    reportPanel2_left.add(bisDateBox);
    reportPanel2_left.add(report2Generieren);
    report2Generieren.setStylePrimaryName("neueNchrichtBtn");

    reportPanel2_right.add(headline);
    //	reportPanel2_right.add(subtext);

    reportPanel2_right.add(beschreibung2);
    reportPanel.add(reportPanel2);

    /*
     * Das RootPanel wird gesäubert und die verschiedenen Elemente für
     * Report 2 zugeordnet.
     */
    RootPanel.get("content").clear();
    RootPanel.get("content_left").clear();
    RootPanel.get("content_right").clear();
    RootPanel.get("content_right").add(reportPanel2_right);
    RootPanel.get("content_left").add(reportPanel2_left);

    /*
     * Der jeweilige Zeitraum wird ausgewählt.
     */
    vonDateBox.addValueChangeHandler(
        new ValueChangeHandler<Date>() {
          @Override
          public void onValueChange(ValueChangeEvent<Date> event) {}
        });

    bisDateBox.addValueChangeHandler(
        new ValueChangeHandler<Date>() {
          @Override
          public void onValueChange(ValueChangeEvent<Date> event) {}
        });
    /*
     * Der Button <code>report2Generieren</code> bekommt eine Funktion,
     * damit der Report 2 generiert werden kann.
     */
    report2Generieren.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            if (vonDateBox.getValue() == null || bisDateBox.getValue() == null) {
              Window.alert("Bitte beide Datumfelder befüllen");
            } else {

              RootPanel.get("content_left").clear();
              RootPanel.get("content_right").clear();

              VerticalPanel ladenPanel = new VerticalPanel();
              ladenPanel.setStylePrimaryName("ladenPanel");

              Image ladenImg = new Image("laden.gif");
              ladenImg.setStylePrimaryName("ladenImg");
              ladenPanel.add(ladenImg);

              HTML ladenLabel =
                  new HTML(
                      "<h1> Bitte warten <h1><br /><h3>Bitte warte einen Augenblick bis der Report generiert wurde. Vielen Dank.</h3>");
              ladenPanel.add(ladenLabel);

              RootPanel.get("content").add(ladenPanel);

              nutzer = TellMeReport.gibEingeloggterBenutzer().getUser();
              NutzerDataProvider.gib(1)
                  .report2Generieren(
                      nutzer,
                      new Timestamp(vonDateBox.getValue().getTime()),
                      new Timestamp(bisDateBox.getValue().getTime()));
            }
          }
        });
  }
Example #28
0
  public void showRewardsItem(RewardsItemClient rewardsItem, boolean isItemStore) {
    if (rewardsItem.getFrequency() != null) {
      // 显示出下次颁奖时间
      nextRewardsTime
          .getElement()
          .getParentElement()
          .getParentElement()
          .removeClassName(CssStyleConstants.hidden);
      // 把开始时间设成只读
      // startTime.setEnabled(false);

    }
    if (isItemStore == false) { // 维护按钮的状态
      saveStore.setVisible(false);
      backStore.setVisible(false);
      save.setVisible(true);
      back.setVisible(true);
    } else {
      backStore.setVisible(true);
      saveStore.setVisible(true);
      save.setVisible(false);
      back.setVisible(false);
    }
    rewardsName.setText(rewardsItem.getName());
    rewardsDefinition.setText(rewardsItem.getDefinition());
    standard.setText(rewardsItem.getStandard());
    rewardsUnit = rewardsItem.getRewardsUnit();

    showJudgeInfo(rewardsItem); // 显示要修改的提名人
    startTime.setValue(rewardsItem.getStartTime());
    nextRewardsTime.setValue(rewardsItem.getNextTime());
    nextPublicTime.setValue(rewardsItem.getNextPublishTime());
    peopleSizeLimit.setValue(StringUtil.valueOf(rewardsItem.getSizeLimit()));
    rewardsFrom.setValue(StringUtil.valueOf(rewardsItem.getRewardsFrom()));
    tmday.setValue(StringUtil.valueOf(rewardsItem.getTmdays()));
    tmdays.setValue(StringUtil.valueOf(rewardsItem.getTmdays()));
    totalJF.setValue(StringUtil.valueOf(rewardsItem.getTotalJF()));
    expectTime.setValue(rewardsItem.getNextTime());
    nextPublicTime.setValue(rewardsItem.getNextPublishTime());
    showFrequencyInfo(rewardsItem.getFrequency());
    autoCbx.setValue(rewardsItem.isAuto(), true);
    if (rewardsItem.isAuto() == false) // 隐藏提名
    chooseBtns
          .getElement()
          .getParentElement()
          .getParentElement()
          .removeClassName(CssStyleConstants.hidden);
    else
      chooseBtns
          .getElement()
          .getParentElement()
          .getParentElement()
          .addClassName(CssStyleConstants.hidden);
    specialCbx.setValue(rewardsItem.isHasSpecialCondition(), true);
    if (SpecialCondition.birth == rewardsItem.getCondition()) {
      birthRadio.setValue(true);
    } else {
      birthRadio.setValue(false);
    }
    if (rewardsItem.isPeriodEnable() == true) {
      moretimes.setValue(true, true);
    } else {
      onetimes.setValue(true, true);
    }
  }
Example #29
0
  private void init() {
    staffArea = new OrganizationSpecialTextArea();
    staffAreaPanel.add(staffArea); // 提名人面板
    startTime.setFormat(new DateBox.DefaultFormat(dateFormat));
    // 隐藏周期性
    expectTime.setEnabled(true);
    tmdays.setEnabled(true);
    nextRewardsTime.setEnabled(false);
    tmday.setEnabled(false);
    setting.setEnabled(false);
    autoCbx.setEnabled(false);
    nextPublicTime.setEnabled(false);
    specialCbx.setEnabled(false);
    birthRadio.setEnabled(false);
    backStore.setVisible(false);
    //	settingText.getElement().getParentElement().getParentElement().getParentElement().addClassName(CssStyleConstants.hidden);
    nextRewardsTime.setFormat(new DateBox.DefaultFormat(dateFormat));
    nextPublicTime.setFormat(new DateBox.DefaultFormat(dateFormat));
    expectTime.setFormat(new DateBox.DefaultFormat(dateFormat));
    // sub.setText("我的奖项");
    // title.setText("创建奖项");
    // settingText.setText("每1天一次");
    birthRadio.getElement().addClassName(CssStyleConstants.hidden);
    // 周期性选择
    onetimes.addValueChangeHandler(
        new ValueChangeHandler<Boolean>() {
          @Override
          public void onValueChange(ValueChangeEvent<Boolean> event) {
            if (event.getValue()) {
              // settingText.getElement().getParentElement().getParentElement().getParentElement().addClassName(CssStyleConstants.hidden);
              // expectTime.getElement().getParentElement().getParentElement().getParentElement().removeClassName(CssStyleConstants.hidden);
              expectTime.setEnabled(true);
              tmdays.setEnabled(true);

              nextRewardsTime.setEnabled(false);
              tmday.setEnabled(false);
              setting.setEnabled(false);
              autoCbx.setEnabled(false);
              nextPublicTime.setEnabled(false);
              specialCbx.setEnabled(false);
              birthRadio.setEnabled(false);

              nextRewardsTime.setValue(null);
              tmday.setValue(null);
              autoCbx.setValue(null);
              nextPublicTime.setValue(null);
              specialCbx.setValue(null);
              birthRadio.setValue(null);
              settingText.setText("");
              frequency = null;
            } else {
              // settingText.getElement().getParentElement().getParentElement().getParentElement().removeClassName(CssStyleConstants.hidden);
              // expectTime.getElement().getParentElement().getParentElement().getParentElement().addClassName(CssStyleConstants.hidden);
              expectTime.setEnabled(false);
              tmdays.setEnabled(false);
              expectTime.setValue(null);
              tmdays.setValue(null);

              nextRewardsTime.setEnabled(true);
              tmday.setEnabled(true);
              setting.setEnabled(true);
              autoCbx.setEnabled(true);
              nextPublicTime.setEnabled(true);
              specialCbx.setEnabled(true);
              birthRadio.setEnabled(true);
            }
          }
        });
    moretimes.addValueChangeHandler(
        new ValueChangeHandler<Boolean>() {
          @Override
          public void onValueChange(ValueChangeEvent<Boolean> event) {
            if (event.getValue()) {
              expectTime.setEnabled(false);
              tmdays.setEnabled(false);
              expectTime.setValue(null);
              tmdays.setValue(null);

              nextRewardsTime.setEnabled(true);
              tmday.setEnabled(true);
              setting.setEnabled(true);
              autoCbx.setEnabled(true);
              nextPublicTime.setEnabled(true);
              specialCbx.setEnabled(true);
              birthRadio.setEnabled(true);
              // settingText.getElement().getParentElement().getParentElement().getParentElement().removeClassName(CssStyleConstants.hidden);
              // expectTime.getElement().getParentElement().getParentElement().getParentElement().addClassName(CssStyleConstants.hidden);
            } else {
              expectTime.setEnabled(true);
              tmdays.setEnabled(true);

              nextRewardsTime.setEnabled(false);
              tmday.setEnabled(false);
              setting.setEnabled(false);
              autoCbx.setEnabled(false);
              nextPublicTime.setEnabled(false);
              specialCbx.setEnabled(false);
              birthRadio.setEnabled(false);
              nextRewardsTime.setValue(null);
              tmday.setValue(null);
              autoCbx.setValue(null);
              nextPublicTime.setValue(null);
              specialCbx.setValue(null);
              birthRadio.setValue(null);
              settingText.setText("");
              // settingText.getElement().getParentElement().getParentElement().getParentElement().addClassName(CssStyleConstants.hidden);
              // expectTime.getElement().getParentElement().getParentElement().getParentElement().removeClassName(CssStyleConstants.hidden);
            }
          }
        });
    // 特殊条件
    specialCbx.addValueChangeHandler(
        new ValueChangeHandler<Boolean>() {

          @Override
          public void onValueChange(ValueChangeEvent<Boolean> event) {
            if (event.getValue()) {
              birthRadio.setValue(true, true);
              birthRadio.getElement().removeClassName(CssStyleConstants.hidden);
            } else {
              birthRadio.setValue(false, true);
              birthRadio.getElement().addClassName(CssStyleConstants.hidden);
            }
          }
        });

    // 生日奖
    birthRadio.addValueChangeHandler(
        new ValueChangeHandler<Boolean>() {
          @Override
          public void onValueChange(ValueChangeEvent<Boolean> event) {
            if (event.getValue()) {
              FrequencyClient frequecny = getFrequencyObj();
              if (frequecny == null
                  || frequecny instanceof WeekFrequencyClient
                  || frequecny instanceof YearFrequencyClient) {
                Window.alert("生日奖必须为每日或每月,已重设为每天一次");
                DayFrequencyClient daily = new DayFrequencyClient();
                daily.setInterval(1);
                showFrequencyInfo(daily);
              }
            } else {
              showFrequencyInfo(null);
            }
          }
        });

    // 自动颁奖
    autoCbx.addValueChangeHandler(
        new ValueChangeHandler<Boolean>() {

          @Override
          public void onValueChange(ValueChangeEvent<Boolean> event) {
            if (event.getValue()) {
              nextPublicTime.setEnabled(false);
              chooseBtns.setEnabled(false);
              //					chooseBtns.getElement().getParentElement()//隐藏提名
              //					.getParentElement()
              //					.addClassName(CssStyleConstants.hidden);
              //					nextPublicTime.getElement().getParentElement()
              //							.getParentElement()
              //							.addClassName(CssStyleConstants.hidden);
            } else {
              //					chooseBtns.getElement().getParentElement()//隐藏提名
              //					.getParentElement()
              //					.removeClassName(CssStyleConstants.hidden);
              //					nextPublicTime.getElement().getParentElement()
              //							.getParentElement()
              //							.removeClassName(CssStyleConstants.hidden);
              nextPublicTime.setEnabled(true);
              chooseBtns.setEnabled(true);
            }
          }
        });
    // 只能输入数字
    peopleSizeLimit.addValueChangeHandler(
        new ValueChangeHandler<String>() {
          @Override
          public void onValueChange(ValueChangeEvent<String> event) {
            if (event.getValue() != null && !event.getValue().equals("")) {
              try {
                Integer.parseInt(event.getValue());
              } catch (Exception e) {
                peopleSizeLimit.setValue("");
              }
            }
          }
        });
    totalJF.addValueChangeHandler(
        new ValueChangeHandler<String>() {
          @Override
          public void onValueChange(ValueChangeEvent<String> event) {
            if (event.getValue() != null && !event.getValue().equals("")) {
              try {
                Integer.parseInt(event.getValue());
              } catch (Exception e) {
                totalJF.setValue("");
              }
            }
          }
        });
    rewardsFrom.addValueChangeHandler(
        new ValueChangeHandler<String>() {
          @Override
          public void onValueChange(ValueChangeEvent<String> event) {
            if (event.getValue() != null && !event.getValue().equals("")) {
              try {
                Integer.parseInt(event.getValue());
              } catch (Exception e) {
                rewardsFrom.setValue("");
              }
            }
          }
        });
    tmdays.addValueChangeHandler(
        new ValueChangeHandler<String>() {
          @Override
          public void onValueChange(ValueChangeEvent<String> event) {
            if (event.getValue() != null && !event.getValue().equals("")) {
              try {
                Integer.parseInt(event.getValue());
              } catch (Exception e) {
                tmdays.setValue("");
              }
            }
          }
        });
    tmday.addValueChangeHandler(
        new ValueChangeHandler<String>() {
          @Override
          public void onValueChange(ValueChangeEvent<String> event) {
            if (event.getValue() != null && !event.getValue().equals("")) {
              try {
                Integer.parseInt(event.getValue());
              } catch (Exception e) {
                tmday.setValue("");
              }
            }
          }
        });
  }
Example #30
0
 public void reset(DateBox dateBox, boolean abandon) {
   dateBox.removeStyleName(DATE_BOX_FORMAT_ERROR);
 }