Hi, I need to customize the Basic DialogContextManager to just add some
futures in create method. What I need is create a dialog changing the
name passed when the user has some profile. What I'm doing is a
decorator (wrapper) of org.apache.shale.dialog.basic.BasicDialogManager.
My DialogContextManager (MyDialogContextManager.java ) does not extends
AbstractDialogContextManager but implements
org.apache.shale.dialog.DialogContextManager and uses a wrapped object
of org.apache.shale.dialog.basic.BasicDialogManager :

 

public class MyDialogContextManager implements DialogContextManager,

                        Serializable {

 

            private static final Log log =
LogFactory.getLog(MyDialogContextManager.class);

            

            DialogContextManager wrapped;

 

            public MyDialogContextManager() {

                        super();

                        wrapped = new BasicDialogManager();

 
FacesContext.getCurrentInstance().getExternalContext().getSessionMap().p
ut("mypipolo",wrapped);

            }

 

            public DialogContext create(FacesContext context, String
name) {

//this is what I need:

                        If (blablaba....) name="mydialogname";

 

                        return wrapped.create(context,name);

            }

 

            public DialogContext create(FacesContext context, String
name, DialogContext parent) {

                        return wrapped.create(context,name,parent);

            }

 

            public DialogContext get(String id) {

                        return wrapped.get(id);

            }

 

            public DialogContext getActiveDialogContext(FacesContext
context) {

                        return wrapped.getActiveDialogContext(context);

            }

 

            public void remove(DialogContext instance) {

                        wrapped.remove(instance);

            }

 

            public void
addDialogContextManagerListener(DialogContextManagerListener listener) {

 
wrapped.addDialogContextManagerListener(listener);

            }

 

            public DialogContextManagerListener[]
getDialogContextManagerListeners() {

                        return
wrapped.getDialogContextManagerListeners();

            }

 

            public void
removeDialogContextManagerListener(DialogContextManagerListener
listener) {

 
wrapped.removeDialogContextManagerListener(listener);

            }

 

}

 

In my faces-config I added:

      <managed-bean>

 
<managed-bean-name>org.apache.shale.dialog.MANAGER</managed-bean-name>

 
<managed-bean-class>prova.MyDialogContextManager</managed-bean-class>

            <managed-bean-scope>session</managed-bean-scope>

      </managed-bean>   

 

 

If you analyze the constructor, you find this:

 
FacesContext.getCurrentInstance().getExternalContext().getSessionMap().p
ut("mypipolo",wrapped);

 

I need this because MyDialogContextManager does not extends
AbstractDialogContextManager and doing so does not implements
HttpSessionBindingListener needed for set DialogLifecycleListener. 

 

So, doing in this way seems to work correctly but the question is:

Is this a correct way to customize the default implementation of
BasicDialogManager?

 

Regards

 

Mario Buonopane
Accenture Insurance Services & Systems 
Via C. Colombo 112, 00147 Roma
Tel:      +39 06 51566543
Mobile: +39 334 6563433 
Fax:      +39 06 51566550

 



This message is for the designated recipient only and may contain privileged, 
proprietary, or otherwise private information.  If you have received it in 
error, please notify the sender immediately and delete the original.  Any other 
use of the email by you is prohibited.

Reply via email to