Package org.zkoss.json

Examples of org.zkoss.json.JSONArray


  }

  /** Creates an instance of {@link Event} based on the specified request.
   */
  public static CalendarsEvent getCreateEvent(AuRequest request) {
    final JSONArray data = (JSONArray) request.getData().get("data");
    final Calendars cmp = verifyEvent(request, data, 6);
    TimeZone tz = cmp.getDefaultTimeZone();
    Date eventBegin = Util.fixDSTTime(tz, new Date(getLong(data.get(0))));
    Date eventEnd = Util.fixDSTTime(tz, new Date(getLong(data.get(1))));
   
    return new CalendarsEvent(ON_EVENT_CREATE, cmp, null,
        eventBegin, eventEnd,
        getInt(data.get(2)), getInt(data.get(3)),
        getInt(data.get(4)),getInt(data.get(5)));
  }
View Full Code Here


        getInt(data.get(2)), getInt(data.get(3)),
        getInt(data.get(4)),getInt(data.get(5)));
  }
 
  public static CalendarsEvent getEditEvent(AuRequest request) {
    final JSONArray data = (JSONArray) request.getData().get("data");
    final Calendars cmp = verifyEvent(request, data, 5);
   
    CalendarEvent ce = cmp.getCalendarEventById(String.valueOf(data.get(0)));
   
    if (ce == null) return null;
   
    return new CalendarsEvent(ON_EVENT_EDIT, cmp, ce, null, null,
        getInt(data.get(1)), getInt(data.get(2)),
        getInt(data.get(3)), getInt(data.get(4)));
 
View Full Code Here

        getInt(data.get(1)), getInt(data.get(2)),
        getInt(data.get(3)), getInt(data.get(4)));
 
 
  public static CalendarsEvent getUpdateEvent(AuRequest request) {
    final JSONArray data = (JSONArray) request.getData().get("data");
    final Calendars cmp = verifyEvent(request, data, 7);
   
    CalendarEvent ce = cmp.getCalendarEventById(String.valueOf(data.get(0)));
   
    if (ce == null) return null;
    TimeZone tz = cmp.getDefaultTimeZone();
    Date eventBegin = Util.fixDSTTime(tz, new Date(getLong(data.get(1))));
    Date eventEnd = Util.fixDSTTime(tz, new Date(getLong(data.get(2))));

    return new CalendarsEvent(ON_EVENT_UPDATE, cmp, ce,
        eventBegin, eventEnd,
        getInt(data.get(3)), getInt(data.get(4)),
        getInt(data.get(5)),getInt(data.get(6)));
  }
View Full Code Here

        getInt(data.get(3)), getInt(data.get(4)),
        getInt(data.get(5)),getInt(data.get(6)));
  }
 
  public static Event getClickEvent(AuRequest request, String cmd) {
    final JSONArray data = (JSONArray) request.getData().get("data");
    final Calendars cmp = verifyEvent(request, data, 1);   
   
    return new Event(cmd, cmp, Util.fixDSTTime(cmp.getDefaultTimeZone(), new Date(getLong(data.get(0)))));
  }
View Full Code Here

   
    return new Event(cmd, cmp, Util.fixDSTTime(cmp.getDefaultTimeZone(), new Date(getLong(data.get(0)))));
  }
 
  public static Event getEventIconClickEvent(AuRequest request) {
    final JSONArray data = (JSONArray) request.getData().get("data");
    final Calendars cmp = verifyEvent(request, data, 5);
   
    CalendarEvent ce = cmp.getCalendarEventById(String.valueOf(data.get(0)));
   
    if (ce == null) return null;
   
    return new CalendarsEvent(ON_EVENT_ICON_CLICK, cmp, ce, null, null,
        getInt(data.get(1)), getInt(data.get(2)),
        getInt(data.get(3)), getInt(data.get(4)));
  }
View Full Code Here

    if (_model != null) initDataListener();
 
 
  public void service(org.zkoss.zk.au.AuRequest request, boolean everError) {
    final String cmd = request.getCommand();
    final JSONArray data = (JSONArray) request.getData().get("data");
    boolean onEvtCreate = cmd.equals("onEventCreate");

    if (onEvtCreate || cmd.equals("onEventEdit") || cmd.equals("onEventUpdate")) {

      int fieldNum = 6;

      if (cmd.equals("onEventEdit")) fieldNum--;
      if (cmd.equals("onEventUpdate")) fieldNum++;     
      final Calendars cmp = Util.verifyEvent(this, request, data, fieldNum);

      CalendarEvent ce = null;

      if (!cmd.equals("onEventCreate"))
        ce = cmp.getCalendarEventById(String.valueOf(data.get(0)));

      if (onEvtCreate || ce != null)
        Events.postEvent(Util.createCalendarsEvent(cmd, cmp, ce, data));

    } else if (cmd.equals("onDayClick") || cmd.equals("onWeekClick")) {
     
      final Calendars cmp = Util.verifyEvent(this, request, data, 1);
      Events.postEvent(new Event(cmd, cmp, new Date(Long.parseLong(String.valueOf(data.get(0))))));
     
    } else super.service(request, everError);
 
View Full Code Here

  }

  /** Creates an instance of {@link Event} based on the specified request.
   */
  public static CalendarsEvent getCreateEvent(AuRequest request) {
    final JSONArray data = (JSONArray) request.getData().get("data");
    final Calendars cmp = verifyEvent(request, data, 6);
    TimeZone tz = cmp.getDefaultTimeZone();
    Date eventBegin = Util.fixDSTTime(tz, new Date(getLong(data.get(0))));
    Date eventEnd = Util.fixDSTTime(tz, new Date(getLong(data.get(1))));
   
    return new CalendarsEvent(ON_EVENT_CREATE, cmp, null,
        eventBegin, eventEnd,
        getInt(data.get(2)), getInt(data.get(3)),
        getInt(data.get(4)),getInt(data.get(5)));
  }
View Full Code Here

        getInt(data.get(2)), getInt(data.get(3)),
        getInt(data.get(4)),getInt(data.get(5)));
  }
 
  public static CalendarsEvent getEditEvent(AuRequest request) {
    final JSONArray data = (JSONArray) request.getData().get("data");
    final Calendars cmp = verifyEvent(request, data, 5);
   
    CalendarEvent ce = cmp.getCalendarEventById(String.valueOf(data.get(0)));
   
    if (ce == null) return null;
   
    return new CalendarsEvent(ON_EVENT_EDIT, cmp, ce, null, null,
        getInt(data.get(1)), getInt(data.get(2)),
        getInt(data.get(3)), getInt(data.get(4)));
 
View Full Code Here

        getInt(data.get(1)), getInt(data.get(2)),
        getInt(data.get(3)), getInt(data.get(4)));
 
 
  public static CalendarsEvent getUpdateEvent(AuRequest request) {
    final JSONArray data = (JSONArray) request.getData().get("data");
    final Calendars cmp = verifyEvent(request, data, 7);
   
    CalendarEvent ce = cmp.getCalendarEventById(String.valueOf(data.get(0)));
   
    if (ce == null) return null;
    TimeZone tz = cmp.getDefaultTimeZone();
    Date eventBegin = Util.fixDSTTime(tz, new Date(getLong(data.get(1))));
    Date eventEnd = Util.fixDSTTime(tz, new Date(getLong(data.get(2))));

    return new CalendarsEvent(ON_EVENT_UPDATE, cmp, ce,
        eventBegin, eventEnd,
        getInt(data.get(3)), getInt(data.get(4)),
        getInt(data.get(5)),getInt(data.get(6)));
  }
View Full Code Here

        getInt(data.get(3)), getInt(data.get(4)),
        getInt(data.get(5)),getInt(data.get(6)));
  }
 
  public static Event getClickEvent(AuRequest request, String cmd) {
    final JSONArray data = (JSONArray) request.getData().get("data");
    final Calendars cmp = verifyEvent(request, data, 1);   
   
    return new Event(cmd, cmp, Util.fixDSTTime(cmp.getDefaultTimeZone(), new Date(getLong(data.get(0)))));
  }
View Full Code Here

TOP

Related Classes of org.zkoss.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.