Example usage for org.apache.wicket.ajax AjaxRequestTarget getPage

List of usage examples for org.apache.wicket.ajax AjaxRequestTarget getPage

Introduction

In this page you can find the example usage for org.apache.wicket.ajax AjaxRequestTarget getPage.

Prototype

@Override
Page getPage();

Source Link

Document

Returns the page.

Usage

From source file:org.sakaiproject.gradebookng.tool.actions.ViewRubricGradeAction.java

License:Educational Community License

@Override
public ActionResponse handleEvent(final JsonNode params, final AjaxRequestTarget target) {
    final String assignmentId = params.get("assignmentId").asText();
    final String studentUuid = params.get("studentId").asText();

    final Map<String, Object> model = new HashMap<>();
    model.put("assignmentId", Long.valueOf(assignmentId));
    model.put("studentUuid", studentUuid);

    final GradebookPage gradebookPage = (GradebookPage) target.getPage();
    final GbModalWindow window = gradebookPage.getRubricGradeWindow();

    window.setAssignmentToReturnFocusTo(assignmentId);
    window.setStudentToReturnFocusTo(studentUuid);
    window.setContent(new RubricGradePanel(window.getContentId(), Model.ofMap(model), window));
    window.show(target);/*from   w w w .j av a2 s .c  o m*/

    return new EmptyOkResponse();
}

From source file:org.wicketopia.listener.ajax.AutoFeedbackListener.java

License:Apache License

@Override
public void onBeforeRespond(Map<String, Component> map, final AjaxRequestTarget target) {
    target.getPage().visitChildren(IFeedback.class, new IVisitor<Component, Void>() {
        @Override//from w  w  w . j a va 2  s .  c o m
        public void component(Component component, IVisit<Void> visit) {
            if (component.getOutputMarkupId()) {
                target.add(component);
            }
            visit.dontGoDeeper();
        }
    });

}

From source file:org.wicketstuff.jamon.component.JamonAdminForm.java

License:Apache License

private void replaceJamonMonitorTable(final TextField<?> monitorLabel, AjaxRequestTarget target,
        MonitorSpecification specification) {
    JamonMonitorTable toBeReplaced = (JamonMonitorTable) target.getPage().get(PATH_TO_STATISTICS_TABLE);
    JamonMonitorTable replacement = new JamonMonitorTable(PATH_TO_STATISTICS_TABLE, specification,
            toBeReplaced.getItemsPerPage());
    toBeReplaced.replaceWith(replacement);
    target.add(replacement);/*from  w  ww. j  a  v  a2 s .  c  om*/
}

From source file:org.wicketstuff.jamon.component.JamonAdminForm.java

License:Apache License

private void replaceMonitorDetailsPanel(AjaxRequestTarget target) {
    EmptyMarkupContainer emptyMarkupContainer = new EmptyMarkupContainer(PATH_TO_MONITOR_DETAILS);
    target.getPage().get(PATH_TO_MONITOR_DETAILS).replaceWith(emptyMarkupContainer);
    target.add(emptyMarkupContainer);/*from  www.j  av a 2s .co  m*/
}

From source file:org.wicketstuff.push.timer.TimerPushBehavior.java

License:Apache License

/**
 * {@inheritDoc}//from  ww w.  j a v  a 2 s  .  co m
 */
@Override
protected void onTimer(final AjaxRequestTarget target) {
    if (isStopped()) {
        getComponent().remove(this);
        return;
    }

    final TimerPushService pushService = TimerPushService.get(target.getPage().getApplication());

    final WebRequest request = (WebRequest) RequestCycle.get().getRequest();

    if (!request.getRequestParameters().getParameterValue("unload").isNull())
        // if the page is unloaded notify the pushService to disconnect all push nodes
        for (final TimerPushNode<?> node : handlers.keySet())
            pushService.onDisconnect(node);

    else
        // retrieve all collected events and process them
        for (final Entry<TimerPushNode, IPushEventHandler> entry : handlers.entrySet()) {
            final TimerPushNode node = entry.getKey();
            for (final IPushEventContext<?> ctx : (List<IPushEventContext<?>>) pushService.pollEvents(node))
                try {
                    entry.getValue().onEvent(target, ctx.getEvent(), node, ctx);
                } catch (final RuntimeException ex) {
                    LOG.error("Failed while processing event", ex);
                }
        }
}