use of org.jaffa.presentation.portlet.widgets.model.GridModel in project jaffa-framework by jaffa-projects.
the class UserTimeEntryFinderAction method do_Rows_Update_Clicked.
// .//GEN-END:_do_Rows_View_Clicked_4_be
// .//GEN-BEGIN:_do_Rows_Update_Clicked_1_be
/**
* Invokes the updateObject() method on the component.
* @param rowNum The selected row on the Results screen.
* @return The FormKey for the Update screen.
*/
public FormKey do_Rows_Update_Clicked(String rowNum) {
FormKey fk = null;
// .//GEN-END:_do_Rows_Update_Clicked_1_be
// Add custom code before processing the action //GEN-FIRST:_do_Rows_Update_Clicked_1
// .//GEN-LAST:_do_Rows_Update_Clicked_1
// .//GEN-BEGIN:_do_Rows_Update_Clicked_2_be
UserTimeEntryFinderForm myForm = (UserTimeEntryFinderForm) form;
UserTimeEntryFinderComponent myComp = (UserTimeEntryFinderComponent) myForm.getComponent();
GridModel model = (GridModel) myForm.getRowsWM();
GridModelRow selectedRow = model.getRow(Integer.parseInt(rowNum));
if (selectedRow != null) {
try {
// .//GEN-END:_do_Rows_Update_Clicked_2_be
// Add custom code before invoking the component //GEN-FIRST:_do_Rows_Update_Clicked_2
// .//GEN-LAST:_do_Rows_Update_Clicked_2
// .//GEN-BEGIN:_do_Rows_Update_Clicked_3_be
fk = myComp.updateObject((java.lang.String) selectedRow.get("userName"), (java.lang.String) selectedRow.get("projectCode"), (java.lang.String) selectedRow.get("task"), (org.jaffa.datatypes.DateTime) selectedRow.get("periodStart"), (org.jaffa.datatypes.DateTime) selectedRow.get("periodEnd"));
} 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.getResultsFormKey();
return fk;
}
use of org.jaffa.presentation.portlet.widgets.model.GridModel in project jaffa-framework by jaffa-projects.
the class UserTimeEntryLookupAction method do_Rows_View_Clicked.
// .//GEN-END:_do_CreateFromResults_Clicked_4_be
// .//GEN-BEGIN:_do_Rows_View_Clicked_1_be
/**
* Invokes the viewObject() method on the component.
* @param rowNum The selected row on the Results screen.
* @return The FormKey for the View screen.
*/
public FormKey do_Rows_View_Clicked(String rowNum) {
FormKey fk = null;
// .//GEN-END:_do_Rows_View_Clicked_1_be
// Add custom code before processing the action //GEN-FIRST:_do_Rows_View_Clicked_1
// .//GEN-LAST:_do_Rows_View_Clicked_1
// .//GEN-BEGIN:_do_Rows_View_Clicked_2_be
UserTimeEntryLookupForm myForm = (UserTimeEntryLookupForm) form;
UserTimeEntryLookupComponent myComp = (UserTimeEntryLookupComponent) myForm.getComponent();
GridModel model = (GridModel) myForm.getRowsWM();
GridModelRow selectedRow = model.getRow(Integer.parseInt(rowNum));
if (selectedRow != null) {
try {
// .//GEN-END:_do_Rows_View_Clicked_2_be
// Add custom code before invoking the component //GEN-FIRST:_do_Rows_View_Clicked_2
// .//GEN-LAST:_do_Rows_View_Clicked_2
// .//GEN-BEGIN:_do_Rows_View_Clicked_3_be
fk = myComp.viewObject((java.lang.String) selectedRow.get("userName"), (java.lang.String) selectedRow.get("projectCode"), (java.lang.String) selectedRow.get("task"), (org.jaffa.datatypes.DateTime) selectedRow.get("periodStart"), (org.jaffa.datatypes.DateTime) selectedRow.get("periodEnd"));
} catch (ApplicationExceptions e) {
if (log.isDebugEnabled())
log.debug("Viewer Failed");
myForm.raiseError(request, ActionMessages.GLOBAL_MESSAGE, e);
} catch (FrameworkException e) {
log.error(null, e);
myForm.raiseError(request, ActionMessages.GLOBAL_MESSAGE, "error.framework.general");
}
}
// .//GEN-END:_do_Rows_View_Clicked_3_be
// Add custom code after returning from the component //GEN-FIRST:_do_Rows_View_Clicked_3
// .//GEN-LAST:_do_Rows_View_Clicked_3
// .//GEN-BEGIN:_do_Rows_View_Clicked_4_be
// The Viewer will be rendered in a new window
// We don't want to see the existing HistoryNav in that window
// Hence, initialize the HistoryNav
HistoryNav.initializeHistoryNav(request);
// Direct User back to current form
if (fk == null)
fk = myComp.getResultsFormKey();
return fk;
}
use of org.jaffa.presentation.portlet.widgets.model.GridModel in project jaffa-framework by jaffa-projects.
the class LookupAction method do_Rows_Select_Clicked.
/**
* This will add the 'lookup' attribute on the request stream, with a Map containing the fieldnames (from the targetFields property) and values (from the selectedRow).
* It will then invoke the quit() method on the component.
* Finally it will return a FormKey object for the generic lookup jsp.
* @param rowNum The selected row on the Results screen.
* @return The FormKey for the generic lookup jsp.
*/
public FormKey do_Rows_Select_Clicked(String rowNum) {
FormKey fk = null;
LookupForm myForm = (LookupForm) form;
LookupComponent2 myComp = (LookupComponent2) myForm.getComponent();
GridModel model = myForm.getRowsWM();
GridModelRow selectedRow = model.getRow(Integer.parseInt(rowNum));
if (myComp.isInSelectLookupMode()) {
try {
Object finderOutDto = myComp.getFinderOutDto();
Class finderOutDtoClass = finderOutDto.getClass();
Method method = finderOutDtoClass.getMethod("getRows", new Class[] { Integer.TYPE });
Object selectedRowDto = method.invoke(finderOutDto, new Object[] { new Integer(selectedRow.getRowId()) });
SelectLookupEvent event = new SelectLookupEvent(myComp, selectedRowDto);
fk = myComp.performSelectLookup(request, event);
} catch (ApplicationExceptions e) {
myForm.raiseError(request, ActionMessages.GLOBAL_MESSAGE, e);
// This could only be caused by the listeners throwing and error, so we want to quit the component and return
fk = myComp.quitLookup(request);
} catch (Exception e) {
log.error(null, e);
myForm.raiseError(request, ActionMessages.GLOBAL_MESSAGE, "error.framework.general");
}
} else
fk = myComp.performLookup(request, selectedRow);
if (fk == null)
fk = myComp.getResultsFormKey();
return fk;
}
use of org.jaffa.presentation.portlet.widgets.model.GridModel in project jaffa-framework by jaffa-projects.
the class AttachmentFinderAction method do_Rows_Delete_Clicked.
// .//GEN-END:_do_Rows_Update_Clicked_4_be
// .//GEN-BEGIN:_do_Rows_Delete_Clicked_1_be
/**
* Invokes the deleteObject() method on the component.
* @param rowNum The selected row on the Results screen.
* @return The FormKey for the Delete screen.
*/
public FormKey do_Rows_Delete_Clicked(String rowNum) {
FormKey fk = null;
// .//GEN-END:_do_Rows_Delete_Clicked_1_be
// Add custom code before processing the action//GEN-FIRST:_do_Rows_Delete_Clicked_1
// .//GEN-LAST:_do_Rows_Delete_Clicked_1
// .//GEN-BEGIN:_do_Rows_Delete_Clicked_2_be
AttachmentFinderForm myForm = (AttachmentFinderForm) form;
AttachmentFinderComponent myComp = (AttachmentFinderComponent) myForm.getComponent();
try {
// This will stop double submits
performTokenValidation(request);
GridModel model = (GridModel) myForm.getRowsWM();
GridModelRow selectedRow = model.getRow(Integer.parseInt(rowNum));
if (selectedRow != null) {
// .//GEN-END:_do_Rows_Delete_Clicked_2_be
// Add custom code before invoking the component//GEN-FIRST:_do_Rows_Delete_Clicked_2
// .//GEN-LAST:_do_Rows_Delete_Clicked_2
// .//GEN-BEGIN:_do_Rows_Delete_Clicked_3_be
fk = myComp.deleteObject((java.lang.String) selectedRow.get("attachmentId"));
}
} catch (ApplicationExceptions e) {
if (log.isDebugEnabled())
log.debug("Delete 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.getResultsFormKey();
return fk;
}
use of org.jaffa.presentation.portlet.widgets.model.GridModel in project jaffa-framework by jaffa-projects.
the class AttachmentFinderAction method do_Rows_ViewAttachmentData_Clicked.
// .//GEN-END:_do_Rows_Delete_Clicked_4_be
// All the custom code goes here//GEN-FIRST:_custom
/**
* Creates a temporary file with the attachment data and adds it as an attribute to the request stream.
* Returns a FormKey pointing to Jaffa's FileExplorer servlet which downloads the temporary file.
* @param rowNum The selected row on the Results screen.
* @return the FormKey for the FileExplorer servlet. A null is returned if the input data is null.
*/
public FormKey do_Rows_ViewAttachmentData_Clicked(String rowNum) {
FormKey fk = null;
AttachmentFinderForm myForm = (AttachmentFinderForm) form;
AttachmentFinderComponent myComp = (AttachmentFinderComponent) myForm.getComponent();
GridModel model = (GridModel) myForm.getRowsWM();
GridModelRow selectedRow = model.getRow(Integer.parseInt(rowNum));
if (selectedRow != null)
fk = AttachmentComponentHelper.loadAttachmentData(myForm, request, (String) selectedRow.get("originalFileName"), (byte[]) selectedRow.get("data"));
if (fk == null)
fk = myComp.getResultsFormKey();
return fk;
}
Aggregations