private void checkResponse(AjaxRequestTarget target) {
    // Show cancel
    if (response.isCancelVisible()) {
      cancelDiv.setVisible(true);
      target.addComponent(cancelDiv);
    }
    // Show retry
    if (response.isRetryVisible()) {
      retryDiv.setVisible(true);
      target.addComponent(retryDiv);
    }

    // Show error Text
    if (PortalUtils.exists(response.getErrorMessage())) {
      errorMsg.setVisible(true);
      target.addComponent(errorMsg);
    }

    // Return to URL
    if (PortalUtils.exists(response.getReturnUrl()) && response.isRedirect())
      try {
        getWebRequestCycle()
            .getWebResponse()
            .getHttpServletResponse()
            .sendRedirect(response.getReturnUrl());
        isRedirected = true;
      } catch (IOException e) {
        LOG.error(
            "#An error occurred while redirecting to the return url["
                + response.getReturnUrl()
                + "]",
            e);
        return;
      }
  }
示例#2
0
  private void updateValidZoomRanges(
      final ZoomLevelDropDownChoice zoomStart,
      final ZoomLevelDropDownChoice zoomStop,
      final ZoomLevelDropDownChoice minCachedLevel,
      final ZoomLevelDropDownChoice maxCachedLevel,
      AjaxRequestTarget target) {

    // zoomStart.processInput();
    Integer min = zoomStart.getModelObject();
    if (min != null) {
      zoomStop.setAllowedMin(min.intValue());
      minCachedLevel.setAllowedMin(min.intValue());
      maxCachedLevel.setAllowedMin(min.intValue());
    }

    Integer max = zoomStop.getModelObject();
    if (max != null) {
      minCachedLevel.setAllowedMax(max.intValue());
      maxCachedLevel.setAllowedMax(max.intValue());
    }

    Integer minCached = minCachedLevel.getModelObject();
    if (minCached != null) {
      maxCachedLevel.setAllowedMin(minCached.intValue());
    }

    if (null != target) {
      target.addComponent(zoomStop);
      target.addComponent(minCachedLevel);
      target.addComponent(maxCachedLevel);
    }
  }
 /**
  * Called if this panel is uses Ajax.
  *
  * @param target
  */
 protected void defaultReturnAction(AjaxRequestTarget target) {
   ModalWindow modal = (ModalWindow) findParent(ModalWindow.class);
   if (modal != null) {
     Component refreshParent = WicketResourceUtils.findOutputMarkupIdParent(modal);
     ModalWindow.closeCurrent(target);
     if (refreshParent != null) {
       target.addComponent(refreshParent);
     }
   } else {
     Component refreshParent = WicketResourceUtils.findOutputMarkupIdParent(this);
     if (refreshParent != null) {
       this.replaceWith(newReturnComponent(getId()));
       target.addComponent(refreshParent);
     }
   }
 }
  /**
   * Parses the keywords and sets them into the data provider, forces update of the components that
   * need to as a result of the different filtering
   */
  private void updateFilter(AjaxRequestTarget target, String flatKeywords) {
    if ("".equals(flatKeywords)) {
      dataProvider.setKeywords(null);
      filter.setModelObject("");
      dataView.setCurrentPage(0);
    } else {
      String[] keywords = flatKeywords.split("\\s+");
      dataProvider.setKeywords(keywords);
      dataView.setCurrentPage(0);
    }
    pagerDelegate.updateMatched();
    navigatorTop.updateMatched();
    navigatorBottom.updateMatched();
    setSelection(false);

    target.addComponent(listContainer);
    target.addComponent(navigatorTop);
    target.addComponent(navigatorBottom);
  }
示例#5
0
  @Override
  public void handleWizardState(WizardForm form, AjaxRequestTarget target) {

    form.getNextLink().setVisible(isEnableNextLink(form));

    // Disable previous button when not needed.
    WizardStepPanel previousStep = this.getPreviousStep();
    if (previousStep == null || previousStep.equals(this)) {
      form.getPreviousLink().setVisible(false);
    } else {
      form.getPreviousLink().setVisible(true);
    }

    form.getFinishLink().setVisible(false);
    if (target != null) {
      target.addComponent(form.getNextLink());
      target.addComponent(form.getPreviousLink());
      target.addComponent(form.getFinishLink());
    }
  }
示例#6
0
 @Override
 protected void addComponent(AjaxRequestTarget target, Component component) {
   if (component == this) {
     // can't refresh this component directly because of setRenderBodyOnly(true) that's set
     // in
     // constructor
     target.addComponent(findParent(TreeGrid.class));
   } else {
     super.addComponent(target, component);
   }
 }
  @Override
  public void onClick(final AjaxRequestTarget _target) {

    final UIFormCellCmd uiObject = (UIFormCellCmd) getDefaultModelObject();
    final StringBuilder snip = new StringBuilder();
    try {
      final List<Return> returns = uiObject.executeEvents(null);
      for (final Return oneReturn : returns) {
        if (oneReturn.contains(ReturnValues.SNIPLETT)) {
          snip.append(oneReturn.get(ReturnValues.SNIPLETT));
        }
      }
    } catch (final EFapsException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    final CommandCellPanel cmdCell = this.findParent(CommandCellPanel.class);
    cmdCell.addOrReplace(new LabelComponent("targetBottom", snip.toString()));
    _target.addComponent(cmdCell);

    System.out.println("cklick");
  }
示例#8
0
 public void updateCommentCount(AjaxRequestTarget target) {
   InterviewPage.this.updateCommentsCount();
   target.addComponent(InterviewPage.this.commentsCount);
 }
示例#9
0
 public void refreshList(AjaxRequestTarget target) {
   target.addComponent(listContainer);
 }
 public void onSectionCompleteChange(AjaxRequestTarget target, String location) {
   // refresh on section complete change for any section
   // TODO: We really should only have to refresh the icon and link for the changed section, not
   // the whole navbar.
   target.addComponent(this);
 }