示例#1
0
 public String getStoredValue() {
   String storedValue = null;
   try {
     JsonUtil.debug(
         "CustomDatePicker.getStoredValue: " + getValue() != null
             ? dateFormat.format(getValue())
             : null);
     storedValue = dateFormat.format(getValue());
   } catch (Exception e) {
     JsonUtil.debug("CustomDatePicker.getStoredValue:" + e.getMessage());
   }
   return storedValue;
 }
示例#2
0
 @Override
 public Date parse(DateBox dateBox, String text, boolean reportError) {
   // Try default parser
   DateBox.Format f = new DateBox.DefaultFormat();
   Date p = importSqlDate(text); // f.parse(dateBox, text, false);
   if (p == null) {
     JsonUtil.debug("CustomDatePicker.parse: " + importSqlDate(text));
     return f.parse(dateBox, text, false); // importSqlDate(text);
   } else {
     JsonUtil.debug("CustomDatePicker.parse: " + p);
     return p;
   }
 }
示例#3
0
 public void setValue(String s, boolean fireEvent) {
   if (s == null || s.equalsIgnoreCase("") /*|| s.equalsIgnoreCase("0000-00-00")*/) {
     setValue(new Date(), fireEvent);
   } else {
     Date dt = importSqlDate(s);
     JsonUtil.debug("CustomDatePicker.setValue: " + dt);
     setValue(dt, fireEvent);
   }
 }
示例#4
0
 @Override
 public String format(DateBox dateBox, Date date) {
   try {
     return dateFormat.format(date);
   } catch (Exception ex) {
     JsonUtil.debug("CustomDatePicker.format: " + ex.toString());
     return new DateBox.DefaultFormat().format(dateBox, date);
   }
 }
示例#5
0
 @Override
 public void reset(DateBox dateBox, boolean abandon) {
   // Just do whatever the superclass would do
   try {
     DateBox.Format f = new DateBox.DefaultFormat();
     f.reset(dateBox, abandon);
   } catch (Exception ex) {
     JsonUtil.debug("CustomDatePicker.reset: " + ex.toString());
   }
 }
示例#6
0
	public void postCheck(HashMap<String, String>[] maps) {
		final PostCheckWidget pcw = this;
		if (Util.getProgramMode() == ProgramMode.STUBBED) {

		} else if (Util.getProgramMode() == ProgramMode.JSONRPC) {
			// String[] params = { "" + payerWidget.getStoredValue(),
			// JsonUtil.jsonify(tbCheckNo.getText()),
			// JsonUtil.jsonify(maps) };
			String[] params = { "", JsonUtil.jsonify(tbCheckNo.getText()),
					JsonUtil.jsonify(maps) };
			RequestBuilder builder = new RequestBuilder(RequestBuilder.POST,
					URL.encode(Util.getJsonRequest(
							"org.freemedsoftware.api.ClaimLog.post_check",
							params)));
			try {
				builder.sendRequest(null, new RequestCallback() {
					public void onError(Request request, Throwable ex) {
						Window.alert(ex.toString());
					}

					public void onResponseReceived(Request request,
							Response response) {

						if (Util.checkValidSessionResponse(response.getText())) {
							if (200 == response.getStatusCode()) {
								pcw.removeFromParent();
								callback.jsonifiedData("update");
							} else {
							}
						}
					}
				});
			} catch (RequestException e) {
				Window.alert(e.toString());
			}

		} else {
		}
	}
示例#7
0
 public Date importSqlDate(String date) {
   if (date == null) {
     return null; // new Date();
   } else if (date.equalsIgnoreCase("")
       || date.equalsIgnoreCase("0000-00-00")
       || date.equalsIgnoreCase("0000-00-00 00:00:00")) {
     return null; // new Date();
   } else if (date.indexOf("-") != -1) {
     Calendar calendar = new GregorianCalendar();
     calendar.set(Calendar.YEAR, Integer.parseInt(date.substring(0, 4)));
     calendar.set(Calendar.MONTH, Integer.parseInt(date.substring(5, 7)) - 1);
     calendar.set(Calendar.DATE, Integer.parseInt(date.substring(8, 10)));
     /*
     calendar.set(Calendar.HOUR, 0);
     calendar.set(Calendar.MINUTE, 0);
     calendar.set(Calendar.SECOND, 0);
     calendar.set(Calendar.MILLISECOND, 0);
     */
     JsonUtil.debug("CustomDatePicker.importSqlDate: " + new Date(calendar.getTime().getTime()));
     return new Date(calendar.getTime().getTime());
   } else return null;
 }