List of usage examples for org.apache.wicket.ajax AjaxRequestTarget add
void add(Component... components);
From source file:au.org.theark.core.web.form.AbstractArchiveDetailForm.java
License:Open Source License
protected void onCancelPostProcess(AjaxRequestTarget target) { crudVO.getDetailPanelContainer().setVisible(false); crudVO.getSearchResultPanelContainer().setVisible(true); crudVO.getSearchPanelContainer().setVisible(true); target.add(feedBackPanel); target.add(crudVO.getSearchPanelContainer()); target.add(crudVO.getSearchResultPanelContainer()); target.add(crudVO.getDetailPanelContainer()); target.add(crudVO.getDetailPanelFormContainer()); target.add(crudVO.getEditButtonContainer()); onCancel(target);/*from w w w .j a v a 2s. co m*/ }
From source file:au.org.theark.core.web.form.AbstractArchiveDetailForm.java
License:Open Source License
protected void initialiseForm() { cancelButton = new AjaxButton(Constants.CANCEL) { private static final long serialVersionUID = 1L; @Override//from w w w.ja v a 2s.c o m protected void onSubmit(AjaxRequestTarget target, Form<?> form) { if (isNew()) { editCancelProcess(target); } else { crudVO.getSearchResultPanelContainer().setVisible(true);// Hide the Search Result List Panel via the WebMarkupContainer crudVO.getDetailPanelContainer().setVisible(false);// Hide the Detail Panle via the WebMarkupContainer target.add(crudVO.getDetailPanelContainer()); target.add(crudVO.getSearchResultPanelContainer());// Attach the resultListContainer WebMarkupContainer to be re-rendered onCancelPostProcess(target); } } @Override protected void onError(AjaxRequestTarget arg0, Form<?> arg1) { } }; saveButton = new AjaxButton(Constants.SAVE) { private static final long serialVersionUID = 1L; @Override public boolean isVisible() { return ArkPermissionHelper.isActionPermitted(Constants.SAVE); } public void onSubmit(AjaxRequestTarget target, Form<?> form) { onSave(containerForm, target); target.add(crudVO.getDetailPanelContainer()); } @SuppressWarnings("unchecked") public void onError(AjaxRequestTarget target, Form<?> form) { boolean setFocusError = false; WebMarkupContainer wmc = (WebMarkupContainer) form.get("detailFormContainer"); for (Iterator iterator = wmc.iterator(); iterator.hasNext();) { Component component = (Component) iterator.next(); if (component instanceof FormComponent) { FormComponent formComponent = (FormComponent) component; if (!formComponent.isValid()) { if (!setFocusError) { // Place focus on field in error (for the first field in error) target.focusComponent(formComponent); setFocusError = true; } } } } processErrors(target); } }; addComponentsToForm(); }
From source file:au.org.theark.core.web.form.AbstractArchiveDetailForm.java
License:Open Source License
protected void editCancelProcess(AjaxRequestTarget target) { crudVO.getSearchResultPanelContainer().setVisible(true);// Hide the Search Result List Panel via the WebMarkupContainer crudVO.getDetailPanelContainer().setVisible(false);// Hide the Detail Panle via the WebMarkupContainer crudVO.getSearchPanelContainer().setVisible(true); target.add(feedBackPanel); target.add(crudVO.getSearchPanelContainer()); target.add(crudVO.getDetailPanelContainer()); target.add(crudVO.getSearchResultPanelContainer()); onCancel(target);//w w w. j a va 2 s . c om }
From source file:au.org.theark.core.web.form.AbstractArchiveDetailForm.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 ww w . ja va 2s .co m * * @param target */ protected void onSavePostProcess(AjaxRequestTarget target, ArkCrudContainerVO crudVO) { // Visibility crudVO.getDetailPanelContainer().setVisible(true); crudVO.getSearchResultPanelContainer().setVisible(false); crudVO.getSearchPanelContainer().setVisible(false); // Enable crudVO.getDetailPanelFormContainer().setEnabled(true); target.add(crudVO.getSearchResultPanelContainer()); target.add(crudVO.getDetailPanelContainer()); target.add(crudVO.getDetailPanelFormContainer()); target.add(crudVO.getSearchPanelContainer()); target.add(crudVO.getEditButtonContainer()); target.add(feedBackPanel); }
From source file:au.org.theark.core.web.form.AbstractDetailForm.java
License:Open Source License
/** * Initialise method that is specific to classes that follow the CrudContainerVO Pattern. The code related to each function has been modularised * into protected methods, this is to provide the subclasses to refer to the protected methods without having to re-create/duplicate them when they * extend the classes.// w ww .j a v a 2 s. com * * @param isArkCrudContainerVOPattern */ protected void initialiseForm() { cancelButton = new AjaxButton(Constants.CANCEL, new StringResourceModel("page.cancel", this, null)) { private static final long serialVersionUID = 1684005199059571017L; @Override protected void onSubmit(AjaxRequestTarget target, Form<?> form) { if (isNew()) { editCancelProcess(target); } else { editCancelProcessForUpdate(target); } } @Override protected void onError(AjaxRequestTarget arg0, Form<?> arg1) { } }; saveButton = new AjaxButton(Constants.SAVE, new StringResourceModel("page.save", this, null)) { private static final long serialVersionUID = -423605230448635419L; @Override public boolean isVisible() { // calling super.isVisible() will allow an external setVisible() to override visibility return super.isVisible() && ArkPermissionHelper.isActionPermitted(Constants.SAVE); } public void onSubmit(AjaxRequestTarget target, Form<?> form) { onSave(containerForm, target); target.add(arkCrudContainerVO.getDetailPanelContainer()); } @Override protected void onError(AjaxRequestTarget target, Form<?> arg1) { saveOnErrorProcess(target); } }; deleteButton = new AjaxDeleteButton(Constants.DELETE, new StringResourceModel("confirmDelete", this, null), new StringResourceModel(Constants.DELETE, this, null)) { private static final long serialVersionUID = 4005032637149080009L; @Override protected void onSubmit(AjaxRequestTarget target, Form<?> form) { onDeleteConfirmed(target, null); } @Override public boolean isVisible() { // calling super.isVisible() will allow an external setVisible() to override visibility return super.isVisible() && ArkPermissionHelper.isActionPermitted(Constants.DELETE); } @Override protected void onError(AjaxRequestTarget arg0, Form<?> arg1) { } }; addComponentsToForm(); }
From source file:au.org.theark.core.web.form.AbstractDetailForm.java
License:Open Source License
protected void editCancelProcessForUpdate(AjaxRequestTarget target) { arkCrudContainerVO.getSearchResultPanelContainer().setVisible(false); arkCrudContainerVO.getDetailPanelContainer().setVisible(false); target.add(arkCrudContainerVO.getSearchResultPanelContainer()); target.add(arkCrudContainerVO.getDetailPanelContainer()); onCancelPostProcess(target);/*w w w . j av a 2 s . co m*/ }
From source file:au.org.theark.core.web.form.AbstractDetailForm.java
License:Open Source License
/** * Method to handle Edit action, enabling the Detail form, and hiding the "view" button container * //from w ww. ja v a 2 s . c o m * @param target */ protected void editButtonProcess(AjaxRequestTarget target) { deleteButton.setEnabled(true); // 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) // deleteButton.setVisible(true); arkCrudContainerVO.getViewButtonContainer().setVisible(false); arkCrudContainerVO.getEditButtonContainer().setVisible(true); arkCrudContainerVO.getDetailPanelFormContainer().setEnabled(true); target.add(arkCrudContainerVO.getViewButtonContainer()); target.add(arkCrudContainerVO.getEditButtonContainer()); target.add(arkCrudContainerVO.getDetailPanelFormContainer()); }
From source file:au.org.theark.core.web.form.AbstractDetailForm.java
License:Open Source License
/** * Method to handle Cancel action when in Edit mode, disabling the Detail form, and hiding the "edit" button container Overloaded * onCancelPostProcess. Use this when you use the ArkCrudContainerVO to manage the WebMarkupContainers. * //ww w. jav a 2 s .c o m * @param target * @param isArkCrudContainerVOPattern */ protected void onCancelPostProcess(AjaxRequestTarget target) { arkCrudContainerVO.getDetailPanelContainer().setVisible(false);//Go to search page/results arkCrudContainerVO.getSearchResultPanelContainer().setVisible(true); arkCrudContainerVO.getSearchPanelContainer().setVisible(true); target.add(feedBackPanel); target.add(arkCrudContainerVO.getSearchPanelContainer()); target.add(arkCrudContainerVO.getSearchResultPanelContainer()); target.add(arkCrudContainerVO.getDetailPanelContainer()); target.add(arkCrudContainerVO.getDetailPanelFormContainer()); target.add(arkCrudContainerVO.getEditButtonContainer()); onCancel(target); }
From source file:au.org.theark.core.web.form.AbstractDetailForm.java
License:Open Source License
/** * Method to handle the EditCancel/New Search action, hiding the Detail form/panel and showing the Search/Results panels Overloaded method for * sub-classes that implement the ArkCrudContainerVO pattern * /* w ww . ja v a 2 s . c o m*/ * @param target */ protected void editCancelProcess(AjaxRequestTarget target) { arkCrudContainerVO.getSearchResultPanelContainer().setVisible(true); arkCrudContainerVO.getDetailPanelContainer().setVisible(false); arkCrudContainerVO.getSearchPanelContainer().setVisible(true); target.add(feedBackPanel); target.add(arkCrudContainerVO.getSearchPanelContainer()); target.add(arkCrudContainerVO.getDetailPanelContainer()); target.add(arkCrudContainerVO.getSearchResultPanelContainer()); onCancel(target); }
From source file:au.org.theark.core.web.form.AbstractDetailForm.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. Overloaded method for sub-classes that implement the ArkCrudContainerVO pattern * @param target/*from w w w . j a va2s. c o m*/ */ protected void onSavePostProcess(AjaxRequestTarget target) { if (ArkPermissionHelper.isActionPermitted(Constants.DELETE)) { AjaxButton ajaxButton = (AjaxButton) arkCrudContainerVO.getEditButtonContainer().get("delete"); if (ajaxButton != null) { ajaxButton.setEnabled(true); target.add(ajaxButton); } } // Visibility arkCrudContainerVO.getDetailPanelContainer().setVisible(true); arkCrudContainerVO.getSearchResultPanelContainer().setVisible(false); arkCrudContainerVO.getSearchPanelContainer().setVisible(false); arkCrudContainerVO.getEditButtonContainer().setVisible(false); // Enable arkCrudContainerVO.getDetailPanelFormContainer().setEnabled(false); target.add(arkCrudContainerVO.getSearchResultPanelContainer()); target.add(arkCrudContainerVO.getDetailPanelContainer()); target.add(arkCrudContainerVO.getDetailPanelFormContainer()); target.add(arkCrudContainerVO.getSearchPanelContainer()); target.add(arkCrudContainerVO.getEditButtonContainer()); target.add(feedBackPanel); }