Custom UIShell: getBinding returns null for any Tab running a taskflow

A few days ago, asked in forum that when we call a getActiveTabList for obtain a list of tabs opens at this moment, getBinding method always return null.

DynTabManager dynTabManager =(DynTabManager)JsfUtils.getManagedBeanValue("pageFlowScope.dynTabManager");
List listtabs =dynTabManager.getCurrentInstance().getActiveTabList();
for (DynTab t : listtabs) {
  System.out.println(t.getId());
  //return null
  t.getBinding()
}

It seems that the problem is that when we call t.getBinding(), the getCurrentBindingsEntry returns a bindingContainer for the current tab, instead of the BC of template

e.g: data.davelaar_demo_ui_view_UIShellPageDef.dynTabsTemplateBinding.r2.davelaar_demo_ui_view_pageDefs_
EditEmployeePageDef_WEB_INF_edit_employees_tf_xml_edit_employees

then when we do dynTabsBindings.get(getBindingKey()) in a getBinding method always return null

I added this lines in method getBingind of DynTab class

public DCTaskFlowBinding getBinding(){

 BindingContainer bc =BindingContext.getCurrent().getCurrentBindingsEntry();
 if (bc == null){
   return null;
 }
 BindingContainer dynTabsBindings =(BindingContainer) bc.get(PAGE_TEMPLATE_BINDING_KEY);
 if (dynTabsBindings == null){
   // use current bc directly
   dynTabsBindings = bc;
 }
 DCTaskFlowBinding binding = null;
 binding =(DCTaskFlowBinding) dynTabsBindings.get(getBindingKey()); // NOTRANS

 //new lines
 if (binding==null){
   BindingContext bindingCxt = BindingContext.getCurrent();
   // get uishell pagedef
   DCBindingContainer uishellBC=bindingCxt.findBindingContainer("davelaar_demo_ui_view_UIShellPageDef");
   //get template pagedef
   BindingContainer bc2= (BindingContainer)uishellBC.getExecutableBindings().get(0);
   return (DCTaskFlowBinding)bc2.get(getBindingKey());
 }
 return binding;
}

Note:This post does not talk about Oracle UI Shell, we are talking about the UI Shell that can be downloaded from here.

Responder

Introduce tus datos o haz clic en un icono para iniciar sesión:

Logo de WordPress.com

Estás comentando usando tu cuenta de WordPress.com. Cerrar sesión / Cambiar )

Imagen de Twitter

Estás comentando usando tu cuenta de Twitter. Cerrar sesión / Cambiar )

Foto de Facebook

Estás comentando usando tu cuenta de Facebook. Cerrar sesión / Cambiar )

Google+ photo

Estás comentando usando tu cuenta de Google+. Cerrar sesión / Cambiar )

Conectando a %s