public static void showPopup(String clientId)
{
FacesContext context = FacesContext.getCurrentInstance();
StringBuilder script = new StringBuilder();
script.append("var popup = AdfPage.PAGE.findComponent('")
.append(clientId)
.append("'); ")
.append("if (!popup.isPopupVisible()) { ")
.append("popup.show();}");
ExtendedRenderKitService erks = Service.getService(context.getRenderKit(),
ExtendedRenderKitService.class);
erks.addScript(context, script.toString());
}
clientId - The component id of the pop up.
Sunday, November 14, 2010
Evaluating EL expression in Manage Bean
public static Object evaluateEL(String el) {
FacesContext facesContext = FacesContext.getCurrentInstance();
ELContext elContext = facesContext.getELContext();
ExpressionFactory expressionFactory =
facesContext.getApplication().getExpressionFactory();
ValueExpression exp =
expressionFactory.createValueExpression(elContext, el,
Object.class);
return exp.getValue(elContext);
}
FacesContext facesContext = FacesContext.getCurrentInstance();
ELContext elContext = facesContext.getELContext();
ExpressionFactory expressionFactory =
facesContext.getApplication().getExpressionFactory();
ValueExpression exp =
expressionFactory.createValueExpression(elContext, el,
Object.class);
return exp.getValue(elContext);
}
Get/Set pageFlowScope variable from manage bean
Set pageFlowScope variable:
AdfFacesContext.getCurrentInstance().getPageFlowScope().put("key", "value");
Get pageFlowScope:
Map map = AdfFacesContext.getCurrentInstance().getPageFlowScope();
AdfFacesContext.getCurrentInstance().getPageFlowScope().put("key", "value");
Get pageFlowScope:
Map map = AdfFacesContext.getCurrentInstance().getPageFlowScope();
Sunday, September 19, 2010
Saturday, September 4, 2010
Refreshing a task flow in ADF
Add the following code to refresh a taskflow from a managed bean.
BindingContext bctx = BindingContext.getCurrent();
BindingContainer bindings = bctx.getCurrentBindingsEntry();
DCTaskFlowBinding taskflowBinding = null;
taskflowBinding = (DCTaskFlowBinding) bindings.get("--taskflow id here");
taskflowBinding.refresh();
BindingContext bctx = BindingContext.getCurrent();
BindingContainer bindings = bctx.getCurrentBindingsEntry();
DCTaskFlowBinding taskflowBinding = null;
taskflowBinding = (DCTaskFlowBinding) bindings.get("--taskflow id here");
taskflowBinding.refresh();
CSV file displays on IE instead of Excel
In order to display the CSV file in excel, add the following MIME mapping to web.xml.
<mime-mapping>
<extension>csv</extension>
<mime-type>application/octet-stream</mime-type>
<mime-mapping>
<mime-mapping>
<extension>CSV</extension>
<mime-type>application/octet-stream</mime-type>
<mime-mapping>
<mime-mapping>
<extension>csv</extension>
<mime-type>application/octet-stream</mime-type>
<mime-mapping>
<mime-mapping>
<extension>CSV</extension>
<mime-type>application/octet-stream</mime-type>
<mime-mapping>
Activating Taskflow in ADF
Taskflow can be activated by setting the following properties.
activation = conditional
active = EL expression which returns true.
If there are multiple taskflows dropped as regions in the same jsff page as tabs. The page needs to be refreshed for every tab click.
Refresh Taskflow
protected void refreshPage(){
FacesContext fc = FacesContext.getCurrentInstance();
String refreshPage = fc.getViewRoot().getViewId();
ViewHandler ViewH = fc.getApplication().getViewHandler();
UIViewRoot UIV = ViewH.createView(fc,refreshPage);
UIV.setViewId(refreshPage);
fc.setViewRoot(UIV);
}
activation = conditional
active = EL expression which returns true.
If there are multiple taskflows dropped as regions in the same jsff page as tabs. The page needs to be refreshed for every tab click.
Refresh Taskflow
protected void refreshPage(){
FacesContext fc = FacesContext.getCurrentInstance();
String refreshPage = fc.getViewRoot().getViewId();
ViewHandler ViewH = fc.getApplication().getViewHandler();
UIViewRoot UIV = ViewH.createView(fc,refreshPage);
UIV.setViewId(refreshPage);
fc.setViewRoot(UIV);
}
Subscribe to:
Posts (Atom)