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

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

Introduction

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

Prototype

void add(Component... components);

Source Link

Document

Adds components to the list of components to be rendered.

Usage

From source file:au.org.theark.core.web.form.AbstractModalDetailForm.java

License:Open Source License

/**
 * A helper method that will allow the toggle of panels and buttons. This method can be invoked by sub-classes as part of the onSave()
 * implementation.Once the user has pressed Save either to create a new entity or update, invoking this method will place the new/edited record
 * panel in View/Read only mode.//from w  ww . j a  v  a 2s . co m
 * 
 * @param target
 */
protected void onSavePostProcess(AjaxRequestTarget target) {
    arkCrudContainerVo.getDetailPanelContainer().setVisible(true);
    arkCrudContainerVo.getDetailPanelFormContainer().setEnabled(true);
    initialiseEditButtonsPanel(false); // restore the Delete button
    target.add(buttonsPanelWMC);
    target.add(arkCrudContainerVo.getDetailPanelContainer());
    target.add(arkCrudContainerVo.getDetailPanelFormContainer());
}

From source file:au.org.theark.core.web.form.AbstractModalDetailForm.java

License:Open Source License

public void onEditSave(AjaxRequestTarget target, Form<?> form) {
    onSave(target);// w ww  .  ja v a2  s  .c o m
    target.add(arkCrudContainerVo.getDetailPanelContainer());
    String s = "jQuery('form#" + form.getMarkupId() + "').cleanDirty();";
    target.appendJavaScript(s);
    target.focusComponent(feedbackPanel);
}

From source file:au.org.theark.core.web.form.AbstractModalDetailForm.java

License:Open Source License

public void onViewEdit(AjaxRequestTarget target, Form<?> form) {
    // switch from View mode buttons to Edit mode buttons 
    initialiseEditButtonsPanel(false);//  w  w  w  .  java 2  s.com
    arkCrudContainerVo.getDetailPanelFormContainer().setEnabled(true);

    target.add(arkCrudContainerVo.getDetailPanelFormContainer());
    target.add(buttonsPanelWMC);
}

From source file:au.org.theark.core.web.form.AbstractSearchForm.java

License:Open Source License

protected void onReset(AjaxRequestTarget target, Form<?> form) {
    clearInput();//from   w w  w .j a  v a 2 s.co m
    updateFormComponentModels();
    target.add(form);
    target.add(feedbackPanel);
}

From source file:au.org.theark.core.web.form.AbstractSearchForm.java

License:Open Source License

/**
 * Initialise the form, utilising the common ArkCrudContainerVO object
 * //ww w  . jav  a  2 s .co  m
 * @param arkCrudContainerVO
 */
protected void initialiseForm() {
    searchButton = new ArkBusyAjaxButton(Constants.SEARCH) {

        private static final long serialVersionUID = -8096410123770458109L;

        @Override
        protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
            // Make the details panel visible
            onSearch(target);
        }

        @Override
        protected void onError(final AjaxRequestTarget target, Form<?> form) {
            target.add(feedbackPanel);
        }
    };

    resetButton = new AjaxButton(Constants.RESET) {

        private static final long serialVersionUID = 5818909400695185935L;

        @Override
        protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
            onReset(target, form);
        }

        @Override
        protected void onError(final AjaxRequestTarget target, Form<?> form1) {
            target.add(feedbackPanel);
        }
    };

    newButton = new ArkBusyAjaxButton(Constants.NEW) {

        private static final long serialVersionUID = 1666656098281624401L;

        @Override
        protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
            // Make the details panel visible, disabling delete button (if found)
            // AjaxButton ajaxButton = (AjaxButton) editButtonContainer.get("delete");
            AjaxButton ajaxButton = (AjaxButton) arkCrudContainerVO.getEditButtonContainer().get("delete");
            if (ajaxButton != null) {
                ajaxButton.setEnabled(false);
                target.add(ajaxButton);
            }
            // Call abstract method
            onNew(target);
        }

        @Override
        public boolean isVisible() {
            return ArkPermissionHelper.isActionPermitted(Constants.NEW);
        }

        @Override
        protected void onError(final AjaxRequestTarget target, Form<?> form) {
            target.add(feedbackPanel);
        }
    };

    addComponentsToForm();
}

From source file:au.org.theark.core.web.form.AbstractSearchForm.java

License:Open Source License

/**
 * Overloaded Method that uses the VO to set the WMC's
 * /*from  ww  w  .  j a  va  2 s. c om*/
 * @param target
 * @param flag
 */
protected void preProcessDetailPanel(AjaxRequestTarget target) {
    arkCrudContainerVO.getDetailPanelContainer().setVisible(true);
    arkCrudContainerVO.getDetailPanelFormContainer().setVisible(true);
    arkCrudContainerVO.getDetailPanelFormContainer().setEnabled(true);

    arkCrudContainerVO.getSearchResultPanelContainer().setVisible(false);
    arkCrudContainerVO.getEditButtonContainer().setVisible(true);
    arkCrudContainerVO.getViewButtonContainer().setVisible(false);
    arkCrudContainerVO.getSearchPanelContainer().setVisible(false);

    target.add(arkCrudContainerVO.getDetailPanelFormContainer());
    target.add(arkCrudContainerVO.getDetailPanelContainer());

    target.add(arkCrudContainerVO.getSearchResultPanelContainer());
    target.add(arkCrudContainerVO.getSearchPanelContainer());
    target.add(arkCrudContainerVO.getViewButtonContainer());
    target.add(arkCrudContainerVO.getEditButtonContainer());
}

From source file:au.org.theark.core.web.form.AbstractUserDetailForm.java

License:Open Source License

protected void editButtonProcess(AjaxRequestTarget target) {
    //Set the deleteButton to enabled true only if the user is attached to the study.
    enableOrDisableRemoveButton();//w  w  w.  j  a  v  a  2s . c o m
    // The visibility of the delete button should not be changed from
    // any of the abstract classes. This allows the implementation
    // to control the visibility of the delete button.
    // NB: SearchForm onNew has the Delete button's setEnabled(false)
    arkCrudContainerVO.getEditButtonContainer().setVisible(true);
    arkCrudContainerVO.getDetailPanelFormContainer().setEnabled(true);

    target.add(arkCrudContainerVO.getEditButtonContainer());
    target.add(arkCrudContainerVO.getDetailPanelFormContainer());
}

From source file:au.org.theark.core.web.form.AbstractWizardForm.java

License:Open Source License

protected void onCancelPostProcess(AjaxRequestTarget target) {
    initialiseGridView();//from w  ww  .j  ava2 s  .co  m
    wizardPanelContainer.setVisible(true);
    resultListContainer.setVisible(true);

    target.add(feedBackPanel);
    target.add(wizardPanelContainer);
    target.add(wizardPanelFormContainer);
    target.add(resultListContainer);
}

From source file:au.org.theark.core.web.form.AbstractWizardForm.java

License:Open Source License

protected void onFinishSubmit(AjaxRequestTarget target, Form<?> form) {
    log.debug("finish.onSubmit");
    previousLink.setVisible(false);/*from  w  ww. j av  a  2s .  c om*/
    nextButton.setVisible(true);
    nextButton.setEnabled(true);
    cancelLink.setVisible(true);
    cancelLink.setEnabled(true);
    finishButton.setVisible(true);
    finishButton.setEnabled(false);

    searchPanelContainer.setVisible(true);
    target.add(wizardButtonContainer);
    target.add(resultListContainer);
    onFinish(target, form);
}

From source file:au.org.theark.core.web.form.AbstractWizardForm.java

License:Open Source License

protected void onNextSubmit(AjaxRequestTarget target, Form<?> form) {
    log.debug("next.onSubmit");
    HistoryAjaxBehavior historyAjaxBehavior = getHistoryAjaxBehavior();
    if (historyAjaxBehavior != null) {
        historyAjaxBehavior.registerAjaxEvent(target, this);
    }//from ww  w  .  j a  v  a 2s  .co m

    // Make search results hidden until finish or cancel
    resultListContainer.setVisible(false);
    target.add(resultListContainer);

    AbstractWizardForm.this.gotoNext(target);
}