[Logo] Enterprise Client Community
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
Limit opened pages in the workplace  XML
Forum Index -> Development
Author Message
mreich

Power User
[Avatar]

Joined: 30/01/2009 08:34:23
Messages: 750
Offline

Hi,

is there a way to set a limit for parallel opened pages in a workplace environement? e.g. setting a limit to 5, means that if a sixth page is opened the oldest page is closed automatically?
In my case I think that most of my users will not close the pages properly, instead open 'till memory death

regards
Meex
[WWW]
CaptainCasa

Power User
[Avatar]

Joined: 21/11/2007 12:23:06
Messages: 5538
Offline

Hi,

yes, there is the method IWorkpageContainer.setMaxNumberOfWorkpages. In addition there is IWorkpageContainer.setMaxNumberOfWorkpagesExceededMessage, if you want to set up an own message text.

Björn


Björn Müller, CaptainCasa GmbH
mreich

Power User
[Avatar]

Joined: 30/01/2009 08:34:23
Messages: 750
Offline

ok, I'll tried to extend the workpagecontainer and bind to my workplace, but it doesn't work, error in log:
2009:11:04 08:35:12:936 | 12 | SEVERE | Could not create managed bean for: WPContainer
.......... Stacktrace Info ..........
java.lang.InstantiationException: trimatrix.ui.WPContainer
at java.lang.Class.newInstance0(Class.java:340)
at java.lang.Class.newInstance(Class.java:30
at org.eclnt.jsfserver.managedbean.DefaultDispatcher.readObject(DefaultDispatcher.java:404)
at org.eclnt.jsfserver.managedbean.DefaultDispatcher.get(DefaultDispatcher.java:31
at com.sun.faces.el.PropertyResolverImpl.getValue(PropertyResolverImpl.java:59)
at org.eclnt.jsfserver.util.LastPropertyResolverByDelegation.getValue(LastPropertyResolverByDelegation.java:84)
at org.eclnt.jsfserver.util.StackedValueBinding.getValue(StackedValueBinding.java:174)
at javax.faces.component.UIComponentBase$AttributesMap.get(UIComponentBase.java:1375)
at org.eclnt.jsfserver.elements.BaseComponent.encodeBegin(BaseComponent.java:40
at org.eclnt.jsfserver.elements.BaseComponent.encodeSubComponent(BaseComponent.java:733)
at org.eclnt.jsfserver.elements.BaseComponent.encodeSubComponent(BaseComponent.java:742)
at org.eclnt.jsfserver.elements.BaseComponent.encodeSubComponent(BaseComponent.java:742)
at org.eclnt.jsfserver.elements.BaseComponent.encodeChildren(BaseComponent.java:583)
at org.eclnt.jsfserver.elements.impl.ROWINCLUDEComponent.encodeChildren(ROWINCLUDEComponent.java:37
at org.eclnt.jsfserver.elements.impl.ROWWORKPAGECONTAINERComponent.encodeChildren(ROWWORKPAGECONTAINERComponent.java:91)
at org.eclnt.jsfserver.elements.BaseComponent.encodeSubComponent(BaseComponent.java:736)
at org.eclnt.jsfserver.elements.BaseComponent.encodeSubComponent(BaseComponent.java:742)
at org.eclnt.jsfserver.elements.BaseComponent.encodeSubComponent(BaseComponent.java:742)
at org.eclnt.jsfserver.elements.BaseComponent.encodeSubComponent(BaseComponent.java:742)
at org.eclnt.jsfserver.elements.BaseComponent.encodeSubComponent(BaseComponent.java:742)
at org.eclnt.jsfserver.elements.BaseComponent.encodeSubComponent(BaseComponent.java:742)
at org.eclnt.jsfserver.elements.BaseComponent.encodeSubComponent(BaseComponent.java:742)
at org.eclnt.jsfserver.elements.BaseComponent.encodeChildren(BaseComponent.java:583)
at org.eclnt.jsfserver.elements.impl.ROWINCLUDEComponent.encodeChildren(ROWINCLUDEComponent.java:37
at javax.faces.webapp.UIComponentTag.encodeChildren(UIComponentTag.java:607)
at javax.faces.webapp.UIComponentTag.doEndTag(UIComponentTag.java:544)
at org.eclnt.jsfserver.elements.BaseComponentTag.doEndTag(BaseComponentTag.java:46
at org.apache.jsp.around_jsp._jspx_meth_t_005frowinclude_005f0(around_jsp.java:271)
at org.apache.jsp.around_jsp._jspx_meth_t_005fpane_005f0(around_jsp.java:245)
at org.apache.jsp.around_jsp._jspx_meth_t_005frow_005f0(around_jsp.java:214)
at org.apache.jsp.around_jsp._jspx_meth_f_005fsubview_005f0(around_jsp.java:181)
at org.apache.jsp.around_jsp._jspx_meth_h_005fform_005f0(around_jsp.java:154)
at org.apache.jsp.around_jsp._jspx_meth_f_005fview_005f0(around_jsp.java:122)
at org.apache.jsp.around_jsp._jspService(around_jsp.java:8
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:630)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)
at com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:322)
at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:130)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:19
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.eclnt.jsfserver.util.ThreadingFilter.doFilter(ThreadingFilter.java:192)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.eclnt.jsfserver.util.CompressionFilter.doFilter(CompressionFilter.java:33)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:12
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)
2009:11:04 08:35:12:936 | 12 | INFO | No property value available for: Dispatcher #{d}/WPContainer



My class WPContainer:

Code:
 package trimatrix.ui;
 
 import org.eclnt.workplace.IWorkpageDispatcher;
 import org.eclnt.workplace.WorkpageContainer;
 
 public class WPContainer extends WorkpageContainer {
 
 	public WPContainer(IWorkpageDispatcher owner) {
 		super(owner);
 		setMaxNumberOfWorkpages(5);
 	}
 
 }
 
[WWW]
CaptainCasa

Power User
[Avatar]

Joined: 21/11/2007 12:23:06
Messages: 5538
Offline

Hi,

before talking about how to create an own workpage container implementation...: I would do it the following way:

Code:
     public Dispatcher()
     {
         super();
         ...
         ...
         getWorkpageContainer().setMaxNumberOfWorkpages(5);
         getWorkpageContainer().setMaxNumberOfWorkpagesExceededMessage("No sooooo many!!");
         ...
         ...
     }
 


The Dispatcher constructor (without parameters) is the one called by the faces-config.xml managed bean resolution, this means it is a good starting point for initializations.

Björn

Björn Müller, CaptainCasa GmbH
mreich

Power User
[Avatar]

Joined: 30/01/2009 08:34:23
Messages: 750
Offline

ok, works perfect, would it be possible to add the functionality to auto. close the oldest page? I would further implement the onWorkpageClose mehtod of some pages, to bring up a popup if data is changed and not saved?

Markus
[WWW]
CaptainCasa

Power User
[Avatar]

Joined: 21/11/2007 12:23:06
Messages: 5538
Offline

...hmm, I do not like this approach toooo much, because the "stupid UI framework" should never close an application page.

But: the application is controlling the wokrplace, i.e. you could as first step warn the user when opening the "n-1"-page, that he/she will run out of pages, if not cleaning up. Or you could explicitly remove a workpage (now it's under your application's control...!) via workplace API.

APIs are part of IWorkpageContainer:

getAllWorkpages() ==> current workpage instances
closeWorkpage(), closeWorkpageForced() ==> close workpage

Björn

Björn Müller, CaptainCasa GmbH
mreich

Power User
[Avatar]

Joined: 30/01/2009 08:34:23
Messages: 750
Offline

ok, but this means that I have to use my own WorkpageContainer implementation?
[WWW]
CaptainCasa

Power User
[Avatar]

Joined: 21/11/2007 12:23:06
Messages: 5538
Offline

...not necessarily:

you could use the Dispatcher as trigger for some admin functions around the workpage container. The dispatcher (with IWorkpageContainer as parameter) is created as "starting point" for newly created workpages.

The "#{d}" is the starting point for the whole application, the "#{d.d_1}"-level is the starting point for workpages.

Björn

Björn Müller, CaptainCasa GmbH
mreich

Power User
[Avatar]

Joined: 30/01/2009 08:34:23
Messages: 750
Offline

Thank you, everything works fine, by the way I could learn many new stuff ;-)

I will add a these stuff as code snippet too

Markus
[WWW]
 
Forum Index -> Development
Go to:   
Powered by JForum 2.1.6 © JForum Team