Package org.apache.wicket.ajax

Examples of org.apache.wicket.ajax.AbstractDefaultAjaxBehavior


  {
    super(id, model);

    setOutputMarkupId(true);

    add(new AbstractDefaultAjaxBehavior()
    {
      private static final long serialVersionUID = 1L;

      @Override
      protected void respond(AjaxRequestTarget target)
View Full Code Here


  protected void onBind()
  {
    // add empty AbstractDefaultAjaxBehavior to the component, to force
    // rendering wicket-ajax.js reference if no other ajax behavior is on
    // page
    getComponent().add(new AbstractDefaultAjaxBehavior()
    {
      private static final long serialVersionUID = 1L;

      @Override
      protected void respond(AjaxRequestTarget target)
View Full Code Here

  {
    super(id, model);

    setOutputMarkupId(true);

    add(new AbstractDefaultAjaxBehavior()
    {
      private static final long serialVersionUID = 1L;

      @Override
      protected void respond(AjaxRequestTarget target)
View Full Code Here

   
    final CalendarForm form = new CalendarForm("appointment", new CompoundPropertyModel<Appointment>(new Appointment()));
    add(form);
   
    //fetchEvents
    add(new AbstractDefaultAjaxBehavior() {
      private static final long serialVersionUID = 6880514947331946407L;

      @Override
      protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
        super.updateAjaxAttributes(attributes);
        attributes.setDataType("json");
        attributes.setWicketAjaxResponse(false);
        attributes.getAjaxCallListeners().add(new AjaxCallListener().onSuccess("callback(data);"));
      }
     
      @Override
      public void renderHead(Component component, IHeaderResponse response) {
        super.renderHead(component, response);
        response.render(JavaScriptHeaderItem.forScript(
          "var fetchEventsFunc = "
            + this.getCallbackFunction(
              context("start")
              , context("end")
              , context("callback")
              , resolved("_start", "start.getTime()")
              , resolved("_end", "end.getTime()")) + ";"
          , "fetchEventsFunc"));
      }

      @Override
      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
    add(new DropResizeBehavior(false, "resizeEventFunc"));
    //create on click-and-drag
    add(new AbstractDefaultAjaxBehavior() {
      private static final long serialVersionUID = 6880514947331946407L;

      @Override
      protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
        super.updateAjaxAttributes(attributes);
        attributes.getAjaxCallListeners().add(new AjaxCallListener().onSuccess("$('#appointment').dialog('open');"));
      }
     
      @Override
      public void renderHead(Component component, IHeaderResponse response) {
        super.renderHead(component, response);
        response.render(JavaScriptHeaderItem.forScript(
          "var selectFunc = "
            + this.getCallbackFunction(
              context("start")
              , context("end")
              , context("allDay")
              , context("jsEvent")
              , context("view")
              , resolved("_start", "start.getTime()")
              , resolved("_end", "end.getTime()")) + ";"
          , "selectFunc"));
      }

      @Override
      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());
       
        if (start.equals(end)) {
          end.add(Calendar.HOUR_OF_DAY, 1);
        }
        Appointment a = new Appointment();
        a.setAppointmentStarttime(start.getTime());
        a.setAppointmentEndtime(end.getTime());
        form.setModelObject(a);
       
        target.add(form);
      }
    });
    //eventClick
    add(new AbstractDefaultAjaxBehavior() {
      private static final long serialVersionUID = 6880514947331946407L;

      @Override
      protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
        super.updateAjaxAttributes(attributes);
View Full Code Here

  {
    super(id, model);

    setOutputMarkupId(true);

    add(new AbstractDefaultAjaxBehavior()
    {
      private static final long serialVersionUID = 1L;

      @Override
      protected void respond(AjaxRequestTarget target)
View Full Code Here

    };
    updateContacts(null);
    add(d, contacts.add(dw, pendingContacts, allContacts).setOutputMarkupId(true));//TODO update
   
    //hack to add FixedHeaderTable after Tabs.
    add(new AbstractDefaultAjaxBehavior() {
      private static final long serialVersionUID = 1L;

      @Override
      protected void respond(AjaxRequestTarget target) {
        selectFolder(inbox, INBOX_FOLDER_ID, target);
View Full Code Here

    };
    updateContacts(null);
    add(d, contacts.add(dw, pendingContacts, allContacts).setOutputMarkupId(true));//TODO update
   
    //hack to add FixedHeaderTable after Tabs.
    add(new AbstractDefaultAjaxBehavior() {
      private static final long serialVersionUID = 1L;

      @Override
      protected void respond(AjaxRequestTarget target) {
        selectFolder(inbox, INBOX_FOLDER_ID, target);
View Full Code Here

  protected void onBind()
  {
    // add empty AbstractDefaultAjaxBehavior to the component, to force
    // rendering wicket-ajax.js reference if no other ajax behavior is on
    // page
    getComponent().add(new AbstractDefaultAjaxBehavior()
    {
      private static final long serialVersionUID = 1L;


      protected void respond(AjaxRequestTarget target)
View Full Code Here

  {
    super(id, model);

    setOutputMarkupId(true);

    add(new AbstractDefaultAjaxBehavior()
    {
      private static final long serialVersionUID = 1L;

      @Override
      protected void respond(AjaxRequestTarget target)
View Full Code Here

  protected void onBind()
  {
    // add empty AbstractDefaultAjaxBehavior to the component, to force
    // rendering wicket-ajax.js reference if no other ajax behavior is on
    // page
    getComponent().add(new AbstractDefaultAjaxBehavior()
    {
      private static final long serialVersionUID = 1L;

      @Override
      protected void respond(AjaxRequestTarget target)
View Full Code Here

TOP

Related Classes of org.apache.wicket.ajax.AbstractDefaultAjaxBehavior

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.