use of org.jaffa.presentation.portlet.FormKey in project jaffa-framework by jaffa-projects.
the class ViewerHyperlinkConfigAction method do_Refresh_Clicked.
/**
* Clicked event handler for the field Refresh.
* @return The FormKey.
*/
public FormKey do_Refresh_Clicked() {
FormKey fk = null;
ViewerHyperlinkConfigForm myForm = (ViewerHyperlinkConfigForm) form;
ViewerHyperlinkConfigComponent myComp = (ViewerHyperlinkConfigComponent) myForm.getComponent();
try {
if (myComp.getCurrentScreenCounter() == 0)
myComp.loadDomainFieldViewerComponentMappingFile();
else
myComp.loadKeyFieldPerViewerComponentFile();
} catch (ApplicationExceptions e) {
if (log.isDebugEnabled())
log.debug("Refresh Failed");
myForm.raiseError(request, ActionMessages.GLOBAL_MESSAGE, e);
}
if (fk == null)
fk = myComp.determineFormKey();
return fk;
}
use of org.jaffa.presentation.portlet.FormKey in project jaffa-framework by jaffa-projects.
the class ViewerHyperlinkConfigAction method do_Save_Clicked.
/**
* Clicked event handler for the field Save.
* @return The FormKey.
*/
public FormKey do_Save_Clicked() {
FormKey fk = null;
ViewerHyperlinkConfigForm myForm = (ViewerHyperlinkConfigForm) form;
ViewerHyperlinkConfigComponent myComp = (ViewerHyperlinkConfigComponent) myForm.getComponent();
try {
if (invokeDoValidateForScreen(myComp.getCurrentScreenCounter())) {
if (myComp.getCurrentScreenCounter() == 0)
myComp.storeDomainFieldViewerComponentMappingFile();
else
myComp.storeKeyFieldPerViewerComponentFile();
}
} catch (ApplicationExceptions e) {
if (log.isDebugEnabled())
log.debug("Save Failed");
myForm.raiseError(request, ActionMessages.GLOBAL_MESSAGE, e);
}
if (fk == null)
fk = myComp.determineFormKey();
return fk;
}
use of org.jaffa.presentation.portlet.FormKey in project jaffa-framework by jaffa-projects.
the class BusinessEventLogFinderAction method do_Rows_View_Clicked.
// .//GEN-END:_2_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
BusinessEventLogFinderForm myForm = (BusinessEventLogFinderForm) form;
BusinessEventLogFinderComponent myComp = (BusinessEventLogFinderComponent) 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("logId"));
} 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.FormKey in project jaffa-framework by jaffa-projects.
the class FormTag method renderToken.
/**
* This is the exact copy of the renderToken() method in Struts 1.1, except that it gets the token information from the component, as opposed to the session.
* Generates a hidden input field with token information, if any.
* @return A hidden input field containing the token.
*/
protected String renderToken() {
StringBuffer results = new StringBuffer();
FormKey fk = (FormKey) pageContext.getRequest().getAttribute(FormKey.class.getName());
if (fk != null && fk.getComponentId() != null) {
Component component = UserSession.getUserSession((HttpServletRequest) pageContext.getRequest()).getComponent(fk.getComponentId());
if (component != null && component.getToken() != null) {
results.append("<input type=\"hidden\" name=\"");
results.append(Constants.TOKEN_KEY);
results.append("\" value=\"");
results.append(component.getToken());
results.append("\" />");
}
}
return results.toString();
}
use of org.jaffa.presentation.portlet.FormKey in project jaffa-framework by jaffa-projects.
the class FormTag method doStartTagExt.
/**
* This method sets the component, componentId, tokenError(if found) on the FormBean
* It also invokes the initForm() method of the FormBean
*
* This has been extended so that is now set the security context for the thread
* of execution within the <xxx:form> tag.
*/
private void doStartTagExt() throws JspException {
try {
Object f = pageContext.findAttribute(getBeanName());
if (log.isDebugEnabled())
log.debug(this.NAME + ".doStartTagExt: Started FORM tag for bean " + getBeanName() + " id=" + getHtmlIdPrefix());
// Get the request stream
ServletRequest request = pageContext.getRequest();
if (!(request instanceof HttpServletRequest)) {
log.warn("Security Problem, Can't Set Thread Context Since Request is not HTTP");
} else {
try {
SecurityTag.setThreadContext((HttpServletRequest) request);
m_securityContextSet = true;
} catch (SecurityException e) {
log.error(this.NAME + ".doStartTagExt: Tag Failed, Could Not Set Security Context", e);
throw new JspException("Can't Set Security Context");
}
}
// Special handelling if this is a Jaffa Component
if (f instanceof FormBase) {
FormBase form = (FormBase) f;
// Get the UserSession so we can lookup the component
UserSession us = UserSession.getUserSession((HttpServletRequest) request);
// Set the component on the form
FormKey fk = (FormKey) request.getAttribute(FormKey.class.getName());
if (fk != null) {
String componentId = fk.getComponentId();
form.setComponent(us.getComponent(componentId));
}
// invoke the default initialization of the form-bean
if (log.isDebugEnabled())
log.debug(this.NAME + ".doStartTagExt: Invoking the initForm method of the Form");
form.initForm();
}
// -------------------------------------
// Initialize the PageContext attributes
// -------------------------------------
// The FormTag Object
pageContext.setAttribute(TagHelper.ATTRIBUTE_FORM_TAG, this, pageContext.REQUEST_SCOPE);
// The FormBean Object
pageContext.setAttribute(TagHelper.ATTRIBUTE_FORM_BASE, f, pageContext.REQUEST_SCOPE);
// The Name of the Struts Form Bean
pageContext.setAttribute(TagHelper.ATTRIBUTE_FORM_NAME, getBeanName(), pageContext.REQUEST_SCOPE);
// Inidcator that any inner tag is enclosed in a form tag
pageContext.setAttribute(TagHelper.ATTRIBUTE_ENCLOSED, Boolean.FALSE, pageContext.REQUEST_SCOPE);
// Html Id of the Form, to be appended to for inner widget id's
pageContext.setAttribute(TagHelper.ATTRIBUTE_ID_PREFIX, getHtmlIdPrefix(), pageContext.REQUEST_SCOPE);
// Jaffa Event prefix for the 'eventId' hidden field
pageContext.setAttribute(TagHelper.ATTRIBUTE_EVENT_PREFIX, "", pageContext.REQUEST_SCOPE);
// Cache previous attribute
m_oldForm = pageContext.findAttribute(TagHelper.ATTRIBUTE_EL_FORM);
// The FormBean Object for Expression Scripting
pageContext.setAttribute(TagHelper.ATTRIBUTE_EL_FORM, f, pageContext.REQUEST_SCOPE);
// write out the span tag <SPAN ID="formName_EntirePage" STYLE="display:none">
JspWriter writer = pageContext.getOut();
StringBuffer buf = new StringBuffer();
// TODO: use HeaderCache
buf.append("\n<span id='" + getHtmlIdPrefix() + ENTIRE_PAGE_SUFFIX + "' class='FormGuard'>");
writer.println(buf.toString());
} catch (IOException e) {
throw new JspException("error in FormTag: " + e);
}
}
Aggregations