Package org.apache.wicket.ajax.json

Examples of org.apache.wicket.ajax.json.JSONArray


      protected void respond(AjaxRequestTarget target) {
        Calendar start = WebSession.getCalendar();
        start.setTimeInMillis(getRequestCycle().getRequest().getRequestParameters().getParameterValue("_start").toLong());
        Calendar end = WebSession.getCalendar();
        end.setTimeInMillis(getRequestCycle().getRequest().getRequestParameters().getParameterValue("_end").toLong());
        JSONArray events = new JSONArray();
        for (Appointment a : Application.getBean(AppointmentDao.class).getAppointmentsByRange(WebSession.getUserId(),
            start.getTime(), end.getTime())) {
          try {
            events.put(new JSONObject()
              .put("id", a.getAppointmentId())
              .put("title", a.getAppointmentName())
              .put("description", a.getAppointmentDescription())
              .put("start", WebSession.getDateFormat().format(a.getAppointmentStarttime()))
              .put("end", WebSession.getDateFormat().format(a.getAppointmentEndtime()))
              .put("allDay", false));
          } catch (JSONException e) {
            e.printStackTrace();
          }
        }
              getRequestCycle().scheduleRequestHandlerAfterCurrent(
                new TextRequestHandler("application/json", "UTF-8", events.toString()));
      }
    });
    //dropEvent
    add(new DropResizeBehavior(true, "dropEventFunc"));
    //resizeEvent
View Full Code Here


                "', week: '" + WebSession.getString(800) +
                "', day: '"  + WebSession.getString(799) +
                "', today: '"  + WebSession.getString(1555) +
                "'}");

    JSONArray monthes = new JSONArray();
    JSONArray shortMonthes = new JSONArray();
    JSONArray days = new JSONArray();
    JSONArray shortDays = new JSONArray();
    try {
      // first week day must be Sunday
      days.put(0, WebSession.getString(466));
      shortDays.put(0, WebSession.getString(459));
      for (int i=0; i < 12; i++){
        monthes.put(i, WebSession.getString(469 + i));
        shortMonthes.put(i, WebSession.getString(1556 + i));
        if (i+1 < 7){
          days.put(i+1, WebSession.getString(460 + i));
          shortDays.put(i+1, WebSession.getString(453 + i));         
        }
      }
    } catch (JSONException e) {
      log.error("Unexpected error while creating label lists", e);
    }
    options.set("monthNames", monthes.toString());
    options.set("monthNamesShort", shortMonthes.toString());
    options.set("dayNames", days.toString());
    options.set("dayNamesShort", shortDays.toString());
   
    calendar = new Calendar("calendar", new AppointmentModel(), options) {
      private static final long serialVersionUID = 8442068089963449950L;
     
      @Override
View Full Code Here

          appendListenerHandler(precondition, attributesJson, "pre",
            PRECONDITION_FUNCTION_TEMPLATE);
        }
      }

      JSONArray extraParameters = JsonUtils.asArray(attributes.getExtraParameters());

      if (extraParameters.length() > 0)
      {
        attributesJson.put("ep", extraParameters);
      }

      List<CharSequence> dynamicExtraParameters = attributes.getDynamicExtraParameters();
View Full Code Here

          appendListenerHandler(precondition, attributesJson,
            AjaxAttributeName.PRECONDITION.jsonName(), PRECONDITION_FUNCTION_TEMPLATE);
        }
      }

      JSONArray extraParameters = JsonUtils.asArray(attributes.getExtraParameters());

      if (extraParameters.length() > 0)
      {
        attributesJson.put(AjaxAttributeName.EXTRA_PARAMETERS.jsonName(), extraParameters);
      }

      List<CharSequence> dynamicExtraParameters = attributes.getDynamicExtraParameters();
View Full Code Here

          appendListenerHandler(precondition, attributesJson,
            AjaxAttributeName.PRECONDITION.jsonName(), PRECONDITION_FUNCTION_TEMPLATE);
        }
      }

      JSONArray extraParameters = JsonUtils.asArray(attributes.getExtraParameters());

      if (extraParameters.length() > 0)
      {
        attributesJson.put(AjaxAttributeName.EXTRA_PARAMETERS.jsonName(), extraParameters);
      }

      List<CharSequence> dynamicExtraParameters = attributes.getDynamicExtraParameters();
View Full Code Here

          CharSequence precondition = ajaxCallListener.getPrecondition(component);
          appendListenerHandler(precondition, attributesJson, "pre", PRECONDITION_FUNCTION_TEMPLATE);
        }
      }

      JSONArray extraParameters = JsonUtils.asArray(attributes.getExtraParameters());

      if (extraParameters.length() > 0)
      {
        attributesJson.put("ep", extraParameters);
      }

      List<CharSequence> dynamicExtraParameters = attributes.getDynamicExtraParameters();
View Full Code Here

   */
  public void buildResourceStream()
  {
    JSONObject json;
    String cmd = null, id = null;
    JSONArray paramArray = null;

    HttpServletRequest req = ((ServletWebRequest)RequestCycle.get().getRequest()).getContainerRequest();
    BufferedReader reader = null;
    try
    {
View Full Code Here

      {
        errors.add(event.getInvalidWord());
      }
    });

    JSONArray words = paramArray.optJSONArray(1);
    checker.checkSpelling(new StringWordTokenizer(words.toString()));
    respond(errors.iterator(), cmd, id);
  }
View Full Code Here

    respond(errors.iterator(), cmd, id);
  }

  private void respond(Iterator<String> words, String cmd, String id)
  {
    JSONArray array = new JSONArray();
    if (words != null)
    {
      while (words.hasNext())
        array.put(words.next());
    }

    JSONObject response = new JSONObject();
    try
    {
View Full Code Here

      whiteboardMap.get(whiteboardObjectId).setLoadedContent(loadedContent);
      if (whiteboardContent != null && !whiteboardContent.equals("")) {
        try {
          JSONObject savedContent = new JSONObject(whiteboardContent);

          JSONArray elementList = (JSONArray) savedContent.get("elements");
          snapShot = new ArrayList<Element>();
          snapShotCreation = new ArrayList<Boolean>();

          for (int i = 0; i < elementList.length(); i++) {
            JSONObject jElement = (JSONObject) elementList.get(i);

            Element element = getElementObject(jElement);

            if (element != null) {
              elementMap.put(element.getId(), element);
View Full Code Here

TOP

Related Classes of org.apache.wicket.ajax.json.JSONArray

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.