use of org.jaffa.presentation.portlet.component.Component in project jaffa-framework by jaffa-projects.
the class FormSelectionMaintenanceComponent method doUpdateDetail.
/**
* Show the AdditionalData Component.
* Pass the Additional Data Object if there is one.
*/
public FormKey doUpdateDetail(GridModelRow selectedRow, String actionPath) throws ApplicationExceptions, FrameworkException {
FormKey fk = null;
String additionalComponent = null;
try {
final FormSelectionMaintenanceOutRowDto rowDto = (FormSelectionMaintenanceOutRowDto) selectedRow.get("object");
additionalComponent = rowDto.getAdditionalDataComponent();
Component comp = (Component) run(additionalComponent);
BeanUtils.setProperty(comp, getKey1(), getValue1());
if (getKey2() != null) {
BeanUtils.setProperty(comp, getKey2(), getValue2());
}
if (getKey3() != null) {
BeanUtils.setProperty(comp, getKey3(), getValue3());
}
if (getKey4() != null) {
BeanUtils.setProperty(comp, getKey4(), getValue4());
}
if (getKey5() != null) {
BeanUtils.setProperty(comp, getKey5(), getValue5());
}
if (getKey6() != null) {
BeanUtils.setProperty(comp, getKey6(), getValue6());
}
// implements IAdditionalDataObject.
if (comp instanceof IAdditionalDataObject) {
((IAdditionalDataObject) comp).setAdditionalDataObject(rowDto.getAdditionalDataObject());
((IUpdateComponent) comp).addUpdateListener(new IUpdateListener() {
public void updateDone(EventObject source) {
try {
rowDto.setAdditionalDataObject(((IAdditionalDataObject) source.getSource()).getAdditionalDataObject());
} catch (Exception e) {
log.warn("Error setting the Additional Data Object after the Update", e);
}
}
});
}
comp.setReturnToFormKey(getResultsFormKey());
// Populate info to allow Web 2.0 component to return to this component
if (comp instanceof RiaWrapperComponent) {
RiaWrapperComponent c = (RiaWrapperComponent) comp;
c.getParameters().setProperty("returnToActionPath", actionPath);
c.getParameters().setProperty("returnToFormKey_componentId", comp.getReturnToFormKey().getComponentId());
}
fk = comp.display();
} catch (SecurityException se) {
log.error("SecurityException Occurred ", se);
throw new ApplicationExceptions(new FormSelectionException(FormSelectionException.SECURITY_EXCEPTION));
} catch (IllegalAccessException e) {
log.error("IllegalAccessException Occurred ", e);
} catch (InvocationTargetException e) {
log.error("InvocationTargetException Occurred ", e);
} catch (IllegalArgumentException e) {
log.error("IllegalArgumentException Occurred ", e);
} catch (ApplicationExceptions applicationException) {
throw applicationException;
} catch (FrameworkException frameworkException) {
throw frameworkException;
}
return fk;
}
use of org.jaffa.presentation.portlet.component.Component 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.component.Component in project jaffa-framework by jaffa-projects.
the class UserSession method showInfo.
/**
* Display all internal Session Info in the System.out stream.
*/
public void showInfo() {
PrintStream p = System.out;
p.println("---User Info----");
p.println("User Id: " + m_userId);
p.println("Components...");
for (Iterator i = m_components.keySet().iterator(); i.hasNext(); ) {
String key = (String) i.next();
Component c = (Component) m_components.get(key);
p.println(" Id: " + c.getComponentId());
p.println(" Name: " + c.getClass().getName());
p.println("");
}
}
use of org.jaffa.presentation.portlet.component.Component in project jaffa-framework by jaffa-projects.
the class UserSession method killAllComponents.
/**
* This function kills all related components.
*/
public void killAllComponents() {
if (m_components != null) {
// Create an array of componentIds
String[] componentIds = new String[m_components.size()];
Iterator itr = m_components.keySet().iterator();
for (int i = 0; itr.hasNext(); i++) componentIds[i] = (String) itr.next();
// Note: its quite possible that a component could have been killed by another !!!
for (int i = 0; i < componentIds.length; i++) {
Component c = (Component) m_components.get(componentIds[i]);
if (c != null) {
if (log.isDebugEnabled())
log.debug("Killing Component : " + c.getComponentId() + " - " + c.getComponentDefinition().getComponentName());
c.quit();
}
}
}
// Object[] components = m_components.values().toArray();
// for(int i = 0; i < components.length; i++) {
// Component c = (Component) components[i];
// if (log.isDebugEnabled())
// log.debug("Killing Component : " + c.getComponentId() + " - " + c.getComponentDefinition().getComponentName() );
// // Quit Component
// c.quit();
// }
}
use of org.jaffa.presentation.portlet.component.Component in project jaffa-framework by jaffa-projects.
the class ActionBase method processContainerFormKey.
/**
* Returns the ContainerFormKey, if the component specified by the input FormKey has one defined.
* For such a component a FormKeyChangeEvent will be sent to the registered FormKeyChangeListeners.
* @param fk The input FormKey.
* @return The ContainerFormKey, if exists, or just the input FormKey.
*/
protected FormKey processContainerFormKey(FormKey fk) {
// The following should probably be invoked recursively. Will do so if the need arises !!
UserSession us = UserSession.getUserSession(request);
Component component = us.getComponent(fk.getComponentId());
if (component != null && component.getContainerFormKey() != null && component.replaceWithContainerFormKey(fk)) {
FormKeyChangeListener[] listeners = component.getFormKeyChangeListeners();
if (listeners != null && listeners.length > 0) {
FormKeyChangeEvent e = new FormKeyChangeEvent(this, fk);
for (int i = 0; i < listeners.length; i++) listeners[i].formKeyChanged(e);
}
fk = component.getContainerFormKey();
if (log.isDebugEnabled())
log.debug("The component in the received form key has a ContainerFormKey. Fired the FormKeyChangeListeners on the component and using the ContainerFormKey " + fk);
}
return fk;
}
Aggregations