use of org.jaffa.presentation.portlet.FormKey in project jaffa-framework by jaffa-projects.
the class FinderAction method do_Search_Clicked.
/**
* Invokes the doValidate() method and then the displayResults() method on the component.
* @return The FormKey for the Results screen.
*/
public FormKey do_Search_Clicked() {
FormKey fk = null;
FinderForm myForm = (FinderForm) form;
FinderComponent2 myComp = (FinderComponent2) myForm.getComponent();
if (myForm.doValidate(request)) {
try {
myComp.performInquiry();
fk = myComp.getResultsFormKey(true);
if (FinderComponent2.EXPORT_TYPE_XML.equals(myComp.getExportType())) {
Object dto = myComp.getFinderOutDto();
if (dto == null)
dto = "";
else
dto = dto.toString();
request.setAttribute(FinderComponent2.ATTRIBUTE_EXPORT_TYPE_XML, dto);
} else
request.removeAttribute(FinderComponent2.ATTRIBUTE_EXPORT_TYPE_XML);
} catch (ApplicationExceptions e) {
if (log.isDebugEnabled())
log.debug("Search Failed");
myForm.raiseError(request, ActionMessages.GLOBAL_MESSAGE, e);
} catch (FrameworkException e) {
log.error(null, e);
myForm.raiseError(request, ActionMessages.GLOBAL_MESSAGE, "error.framework.general");
}
}
try {
if (fk == null)
fk = myComp.displayCriteria();
} catch (ApplicationExceptions e) {
if (log.isDebugEnabled())
log.debug("Search Failed");
myForm.raiseError(request, ActionMessages.GLOBAL_MESSAGE, e);
} catch (FrameworkException e) {
log.error(null, e);
myForm.raiseError(request, ActionMessages.GLOBAL_MESSAGE, "error.framework.general");
}
if (fk == null)
fk = myComp.getCriteriaFormKey();
return fk;
}
use of org.jaffa.presentation.portlet.FormKey in project jaffa-framework by jaffa-projects.
the class FinderAction method do_SaveQuery_Clicked.
public FormKey do_SaveQuery_Clicked() {
FormKey fk = null;
FinderForm myForm = (FinderForm) form;
FinderComponent2 myComp = (FinderComponent2) myForm.getComponent();
if (myForm.doValidate(request) && myForm.doValidateForSaveQuery(request)) {
try {
myComp.saveQuery();
fk = myComp.displayCriteria();
} catch (ApplicationException e) {
if (log.isDebugEnabled())
log.debug("ModifySearch Failed");
myForm.raiseError(request, ActionMessages.GLOBAL_MESSAGE, e);
} catch (ApplicationExceptions e) {
if (log.isDebugEnabled())
log.debug("ModifySearch Failed");
myForm.raiseError(request, ActionMessages.GLOBAL_MESSAGE, e);
} catch (FrameworkException e) {
log.error(null, e);
myForm.raiseError(request, ActionMessages.GLOBAL_MESSAGE, "error.framework.general");
}
}
// Direct User back to current form
if (fk == null)
fk = myComp.getCriteriaFormKey();
return fk;
}
use of org.jaffa.presentation.portlet.FormKey in project jaffa-framework by jaffa-projects.
the class LookupAction method do_MultiSelect_Clicked.
/**
* This will generate the MultiSelectLookupEvent object comprising the DTOs for the selected rows.
* It will then invoke the performMultiSelectLookup() method on the component.
* @return The FormKey for the calling screen.
*/
public FormKey do_MultiSelect_Clicked() {
FormKey fk = null;
LookupForm myForm = (LookupForm) form;
LookupComponent2 myComp = (LookupComponent2) myForm.getComponent();
try {
// Create a collection of 'selectedRows'
// It will assume that each row in the GridModel in the form has a CheckBoxModel keyed by LookupComponent2.MULTI_SELECT_CHECKBOX
// Additionally, it'll assume that the FinderOutDto returned by the component has the method: 'public SomeDtoClass getRows(int i)'
Collection selectedRows = new LinkedList();
GridModel model = myForm.getRowsWM();
Object finderOutDto = myComp.getFinderOutDto();
if (finderOutDto != null && model != null && model.getRows() != null) {
Class finderOutDtoClass = finderOutDto.getClass();
Method method = finderOutDtoClass.getMethod("getRows", new Class[] { Integer.TYPE });
for (Iterator itr = model.getRows().iterator(); itr.hasNext(); ) {
GridModelRow row = (GridModelRow) itr.next();
CheckBoxModel checkBoxModel = (CheckBoxModel) row.get(LookupComponent2.MULTI_SELECT_CHECKBOX);
if (checkBoxModel != null && checkBoxModel.getState()) {
Object selectedRow = method.invoke(finderOutDto, new Object[] { new Integer(row.getRowId()) });
selectedRows.add(selectedRow);
}
}
}
MultiSelectLookupEvent event = new MultiSelectLookupEvent(myComp, selectedRows.toArray());
fk = myComp.performMultiSelectLookup(request, event);
} catch (ApplicationExceptions e) {
myForm.raiseError(request, ActionMessages.GLOBAL_MESSAGE, e);
} catch (Exception e) {
log.error(null, e);
myForm.raiseError(request, ActionMessages.GLOBAL_MESSAGE, "error.framework.general");
}
if (fk == null)
fk = myComp.getResultsFormKey();
return fk;
}
use of org.jaffa.presentation.portlet.FormKey in project jaffa-framework by jaffa-projects.
the class MaintAction method do_Finish_Clicked.
/**
* Invokes the create() or update() method on the component, depending on the mode. It then quits the component.
* @return The FormKey for the calling screen. A null will be returned, if no calling screen was specified.
*/
public FormKey do_Finish_Clicked() {
MaintForm myForm = (MaintForm) form;
MaintComponent2 myComp = (MaintComponent2) myForm.getComponent();
FormKey fk = do_Save_Clicked();
if (myForm.hasErrors(request))
return fk;
else
return myComp.quitAndReturnToCallingScreen();
}
use of org.jaffa.presentation.portlet.FormKey in project jaffa-framework by jaffa-projects.
the class UserTimeEntryViewerAction method do_Update_Clicked.
// .//GEN-END:_do_Close_Clicked_2_be
// .//GEN-BEGIN:_do_Update_Clicked_1_be
/**
* Invokes the updateObject() method on the component.
* @return The FormKey for the Update screen.
*/
public FormKey do_Update_Clicked() {
FormKey fk = null;
// .//GEN-END:_do_Update_Clicked_1_be
// Add custom code before processing the action //GEN-FIRST:_do_Update_Clicked_1
// .//GEN-LAST:_do_Update_Clicked_1
// .//GEN-BEGIN:_do_Update_Clicked_2_be
UserTimeEntryViewerForm myForm = (UserTimeEntryViewerForm) form;
UserTimeEntryViewerComponent myComp = (UserTimeEntryViewerComponent) myForm.getComponent();
try {
// .//GEN-END:_do_Update_Clicked_2_be
// Add custom code before invoking the component //GEN-FIRST:_do_Update_Clicked_2
// .//GEN-LAST:_do_Update_Clicked_2
// .//GEN-BEGIN:_do_Update_Clicked_3_be
fk = myComp.updateObject();
} catch (ApplicationExceptions e) {
if (log.isDebugEnabled())
log.debug("Update Failed");
myForm.raiseError(request, ActionMessages.GLOBAL_MESSAGE, e);
} catch (FrameworkException e) {
log.error(null, e);
myForm.raiseError(request, ActionMessages.GLOBAL_MESSAGE, "error.framework.general");
}
// Direct User back to current form
if (fk == null)
fk = myComp.getViewerFormKey();
return fk;
}
Aggregations