4 Replies Latest reply on Jul 3, 2007 5:52 AM by Dennis

    Workspace switcher

    Dennis Newbie

      Hello!

      I build the little conversation / workspaces switch.
      Everything works fine, I can switch and destroy workspaces without any problem.

      The only exception:
      If I destroy the current workspace I'm not going to be redirect in any kind...
      The old site stays alive, but if I refresh manual all data is gone, cause the backing (conversation scope) is destroyed.

      So, I don't know how to implement the navigation rule in this case...

      Has anybody a running example?

        • 1. Re: Workspace switcher
          Pete Muir Master

          Post some of the code you are using to achieve this.

          • 2. Re: Workspace switcher
            Dennis Newbie

            Here we go:

            <rich:modalPanel xmlns:h="http://java.sun.com/jsf/html"
            
             xmlns:f="http://java.sun.com/jsf/core"
            
             xmlns:s="http://jboss.com/products/seam/taglib"
            
             xmlns:rich="http://richfaces.ajax4jsf.org/rich"
            
             id="workspaces" minHeight="200" minWidth="450" height="200" width="500">
            
             <f:facet name="header">
            
             <h:outputText value="Workspaces" />
            
             </f:facet>
            
             <f:facet name="controls">
            
             <h:graphicImage value="/resource/close.png" style="cursor:pointer" onclick="Richfaces.hideModalPanel('workspaces')" />
            
             </f:facet>
            
             <h:form>
            
             <h:dataTable value="#{conversationList}" var="item" rendered="#{not empty conversationList}">
            
             <h:column>
            
             <h:outputText value="#{item.startDatetime}">
            
             <s:convertDateTime pattern="hh:mm - dd.MM.yy" />
            
             </h:outputText>
            
             -
            
             <h:outputText value="#{item.lastDatetime}">
            
             <s:convertDateTime pattern="hh:mm - dd.MM.yy" />
            
             </h:outputText>
            
             </h:column>
            
             <h:column>
            
             <h:commandLink value="#{item.description}" action="#{item.select}" />
            
             </h:column>
            
             <h:column>
            
             <h:outputText value="current" rendered="#{item.current}" />
            
             </h:column>
            
             <h:column>
            
             <h:commandLink value="Select" action="#{item.select}" />
            
             </h:column>
            
             <h:column>
            
             <h:commandLink value="Destroy" action="#{item.destroy}" />
            
             </h:column>
            
             </h:dataTable>
            
             </h:form>
            
            </rich:modalPanel>
            

            These part of my site is always included into the menubar!
            So, if I'm in a conversation (example editing a user or something else) you can destroy these conversation, but I'm still on the same site (looks to the user like nothing have changed). The user doesn't see that the backing components are destroyed and so believes he could go on. The nice thing is that their are no exceptions thrown by seam in this case. ;)

            Preferred solution:

            I would like now to user a navigation rule to move after destroy method is called to the main page, but only if I destroyed the current conversation.

            Have you any idea?

            Another workaround would be to disable the destroy link for the current conversation.

            • 3. Re: Workspace switcher
              Pete Muir Master

               

              <page view-id="*">
               <navigation from-action="#{item.destroy}">
               <rule>
               <redirect view-id="/boo.xhtml"/>
               </rule>
               </navigation>
              </page>


              might work (I'm not sure how JSF constructs from-action), or, you could set a property when calling destroy, and check it in the rule?

              • 4. Re: Workspace switcher
                Dennis Newbie

                I see what you mean, but the solution is not working.
                Their is no effect, I believe cause theirs is no #{item.destroy} is not the direct name of the seam component?