It works!
Thanks in advance ..!

Fidel Chavarria wrote:
> 
> Hi, I 've a list of filter components to make the user experience more
> confortable when he is looking at a list of issues in my app. I use
> Tapestry radiogroup component technique to enclose those filtters in a
> FilterGroup component, It works ..! but it's not stateless. when I login
> to my application as another user with a new instance of another web
> browser (to avoid browser session ) it keeps all filters applyed from a
> previous user. 
> 
> Environment services are not stateless ...?
> How can I avoid this behaviour ..?
> 
> public class FilterGroup {
> 
>       private FilterContainer container = new FilterContainer() ;
>       
>       @Inject
>       private Environment environment ;
>       
>       void setupRender() {
>               environment.push(FilterContainer.class, container) ;
>       }
>       
>       void afterRender() {
>               environment.pop(FilterContainer.class) ;
>       }    
> 
>          public void onAction(Object[] ctx) {
>               if (container.getActiveFilters().contains((String) ctx[0]))
>                       container.getActiveFilters().remove(ctx[0]) ;
>               else {
>                       container.getActiveFilters().clear() ;
>                       container.getActiveFilters().add((String) ctx[0]) ;
>               }
>       }
>       
>       public Collection<Filter<BacklogItem>> getFilters() {
>               List<Filter<BacklogItem>> filters = new 
> ArrayList<Filter<BacklogItem>>()
> ;
>               for (String activeFilter : container.getActiveFilters())
>                               
> filters.add(container.getAvailableFilters().get(activeFilter)) ;
>               return filters ;
>       }
> }
> **********************************************************************************
> public abstract class AbstractFilter {
> 
>       @Inject
>       private ComponentResources resources ;
> 
>       @Parameter(defaultPrefix = TapestryConstants.LITERAL_BINDING_PREFIX,
> required=true)
>       private String label ;
>       
>       @Environmental
>       private FilterContainer container ;
>       
>       protected abstract String getFilterName() ;
>       
>       protected abstract Filter<BacklogItem> getFilter() ;
>       
>       @SetupRender
>       void setupRender() {
>               container.getAvailableFilters().put(getFilterName(), 
> getFilter()) ;
>       }
>       
>       void beginRender(MarkupWriter writer) {
>               Link link = 
> resources.createActionLink(TapestryConstants.ACTION_EVENT,
> false, getFilterName()) ;
>               
>               writer.writeRaw("<li>") ;
>               writer.element("a", "href", link.toURI()) ;
>               writer.write( container.getFilterState(getFilterName()) ) ;
>               writer.write(label) ;
>               writer.end() ;
>               writer.writeRaw("</li>") ;
>       }
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Environment-services-are-not-stateless-...---tp16733862p16734946.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to