[jboss-svn-commits] JBL Code SVN: r7866 - in labs/jbossesb/trunk/product/console: resources/WEB-INF src/org/jboss/soa/esb/admin/console src/org/jboss/soa/esb/admin/console/exchange src/org/jboss/soa/esb/admin/console/transform view/transform

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Tue Nov 28 04:17:19 EST 2006


Author: tfennelly
Date: 2006-11-28 04:17:11 -0500 (Tue, 28 Nov 2006)
New Revision: 7866

Added:
   labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/SeamViewIdStack.java
Modified:
   labs/jbossesb/trunk/product/console/resources/WEB-INF/pages.xml
   labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/exchange/MessageExchangeSelected.java
   labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/exchange/MessageExchangeSelectedInterceptor.java
   labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/exchange/SelectMessageExchange.java
   labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/transform/ManageResources.java
   labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/transform/NewResource.java
   labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/transform/NewResourceSpec.java
   labs/jbossesb/trunk/product/console/view/transform/select-message-exchange-finish.xhtml
   labs/jbossesb/trunk/product/console/view/transform/select-message-exchange-to.xhtml
Log:
Fixed the redirect-return usability issue where clicking to e.g. the "Manage Resources" wizard redirects to the "Select Message Exchange" wizard, but doesn't return to the "Manage Resources" wizard when done.

Modified: labs/jbossesb/trunk/product/console/resources/WEB-INF/pages.xml
===================================================================
--- labs/jbossesb/trunk/product/console/resources/WEB-INF/pages.xml	2006-11-28 02:46:09 UTC (rev 7865)
+++ labs/jbossesb/trunk/product/console/resources/WEB-INF/pages.xml	2006-11-28 09:17:11 UTC (rev 7866)
@@ -2,6 +2,12 @@
 	<!-- Make sure that the Message Exchange gets initialised... -->
 	<page view-id="/transform/select-message-exchange-from.xhtml" action="#{messageExchangeSelect.initialise}"/>
 
+	<!-- Make sure newResource gets initialised... -->
+	<page view-id="/transform/new-trans-resource-select-spec.xhtml" action="#{newResource.initialise}"/>
+
+	<!-- Make sure manageResources gets initialised... -->
+	<page view-id="/transform/list-resources.xhtml" action="#{manageResources.initialise}"/>
+
 	<!-- Support GET requests for the configuration data i.e. the ESB reading the configurations... -->
 	<page view-id="/transform/smooks-config.xhtml" action="#{listAllResources.list}"/>
 </pages>
\ No newline at end of file

Added: labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/SeamViewIdStack.java
===================================================================
--- labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/SeamViewIdStack.java	2006-11-28 02:46:09 UTC (rev 7865)
+++ labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/SeamViewIdStack.java	2006-11-28 09:17:11 UTC (rev 7866)
@@ -0,0 +1,75 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated 
+ * by the @authors tag. All rights reserved. 
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors. 
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A 
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+ * MA  02110-1301, USA.
+ * 
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+
+package org.jboss.soa.esb.admin.console;
+
+import java.util.Stack;
+
+import org.jboss.seam.contexts.Contexts;
+
+/**
+ * Seam View ID stack.
+ * <p/>
+ * Used to record view Ids so we can return to a view.
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class SeamViewIdStack {
+
+	/**
+	 * View Stack.
+	 */
+	private Stack<String> viewIdStack = new Stack<String>();
+	
+	/**
+	 * Session level singleton factory method.
+	 * @return The SeamViewIdStack instance.
+	 */
+	public static SeamViewIdStack getInstance() {
+		SeamViewIdStack stack = (SeamViewIdStack) Contexts.getSessionContext().get(SeamViewIdStack.class.getName());
+		
+		if(stack == null) {
+			stack = new SeamViewIdStack();
+			Contexts.getSessionContext().set(SeamViewIdStack.class.getName(), stack);
+		}
+		
+		return stack;
+	}
+	
+	/**
+	 * Record view ID.
+	 * @param viewId View ID.
+	 */
+	public void pushViewId(String viewId) {
+		viewIdStack.push(viewId);
+	}
+	
+	/**
+	 * Pop a view ID from the stack.
+	 * @return The view ID, or "home" if the stack is empty.
+	 */
+	public String popViewId() {
+		if(viewIdStack.isEmpty()) {
+			return "home";
+		}
+		
+		return viewIdStack.pop();
+	}
+}

Modified: labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/exchange/MessageExchangeSelected.java
===================================================================
--- labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/exchange/MessageExchangeSelected.java	2006-11-28 02:46:09 UTC (rev 7865)
+++ labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/exchange/MessageExchangeSelected.java	2006-11-28 09:17:11 UTC (rev 7866)
@@ -24,7 +24,7 @@
 import static java.lang.annotation.ElementType.TYPE;
 import static java.lang.annotation.RetentionPolicy.RUNTIME;
 
-import java.lang.annotation.Documented;
+import java.lang.annotation.Inherited;
 import java.lang.annotation.Retention;
 import java.lang.annotation.Target;
 
@@ -37,6 +37,13 @@
  */
 @Target(TYPE)
 @Retention(RUNTIME)
- at Documented
+ at Inherited
 @Interceptors(MessageExchangeSelectedInterceptor.class)
-public @interface MessageExchangeSelected {}
+public @interface MessageExchangeSelected {
+	
+	/**
+	 * The view Id to be retuened to after making the message exchange selection.
+	 * @return View Id to be retuened to.
+	 */
+	String returnId() default "home";
+}

Modified: labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/exchange/MessageExchangeSelectedInterceptor.java
===================================================================
--- labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/exchange/MessageExchangeSelectedInterceptor.java	2006-11-28 02:46:09 UTC (rev 7865)
+++ labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/exchange/MessageExchangeSelectedInterceptor.java	2006-11-28 09:17:11 UTC (rev 7866)
@@ -29,6 +29,7 @@
 import org.jboss.seam.interceptors.BusinessProcessInterceptor;
 import org.jboss.seam.interceptors.ConversationInterceptor;
 import org.jboss.seam.interceptors.ValidationInterceptor;
+import org.jboss.soa.esb.admin.console.SeamViewIdStack;
 
 /**
  * Interceptor to enforce Message exchange selection.
@@ -44,6 +45,14 @@
 		if (isExchangeSelected) {
 			return invocation.proceed();
 		} else {
+			MessageExchangeSelected annotation = invocation.getTarget().getClass().getAnnotation(MessageExchangeSelected.class);
+			
+			if(annotation != null) {
+				SeamViewIdStack.getInstance().pushViewId(annotation.returnId());
+			} else {
+				SeamViewIdStack.getInstance().pushViewId("home");
+			}
+			
 			return "select-message-exchange";
 		}
 	}

Modified: labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/exchange/SelectMessageExchange.java
===================================================================
--- labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/exchange/SelectMessageExchange.java	2006-11-28 02:46:09 UTC (rev 7865)
+++ labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/exchange/SelectMessageExchange.java	2006-11-28 09:17:11 UTC (rev 7866)
@@ -34,6 +34,8 @@
 import org.jboss.seam.annotations.datamodel.DataModel;
 import org.jboss.seam.annotations.datamodel.DataModelSelectionIndex;
 import org.jboss.seam.contexts.Contexts;
+import org.jboss.seam.core.Manager;
+import org.jboss.soa.esb.admin.console.SeamViewIdStack;
 import org.jboss.soa.esb.admin.console.contract.MessageContract;
 import org.jboss.soa.esb.admin.console.exchange.participant.Participant;
 
@@ -106,6 +108,10 @@
 	public String showFinish() {
 		return "select-message-exchange-finish";
 	}
+	
+	public String finish() {
+		return SeamViewIdStack.getInstance().popViewId();
+	}
 
 	/**
 	 * Select the "from" {@link Participant} action listener method.

Modified: labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/transform/ManageResources.java
===================================================================
--- labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/transform/ManageResources.java	2006-11-28 02:46:09 UTC (rev 7865)
+++ labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/transform/ManageResources.java	2006-11-28 09:17:11 UTC (rev 7866)
@@ -48,13 +48,13 @@
 @Name("manageResources")
 @Scope(CONVERSATION)
 @Conversational(ifNotBegunOutcome="home")
- at MessageExchangeSelected
+ at MessageExchangeSelected(returnId="list-resources")
 public class ManageResources implements Serializable {
 
 	@In(create=true)
 	private Session esbDatabase;
 
-	@In
+	@In(required=false)
 	private MessageExchange messageExchange;
 	
 	@DataModel 
@@ -62,7 +62,7 @@
 	@DataModelSelectionIndex("messageExchangeConfigs")
 	int messageExchangeConfigIndex = 0;
 	
-	@In(required=false) @Out(scope=CONVERSATION)
+	@In(required=false) @Out(required=false,scope=CONVERSATION)
 	private Toggle showAll;
 	
 	@In(required=false) @Out(required=false,scope=CONVERSATION)
@@ -73,11 +73,8 @@
 	
 	@Begin(join=true)
 	public String list() {
-		if(showAll == null) {
-			showAll = new Toggle();
-		}
 		initialise();
-		
+				
 		return "list-resources";
 	}
 	
@@ -112,9 +109,14 @@
 	/**
 	 * Initialise the message exchange configurations list.
 	 */
-	private void initialise() {
+	@Begin(join=true)
+	public void initialise() {
 		List<TransformationResource> allResourceConfigs;
 		
+		if(showAll == null) {
+			showAll = new Toggle();
+		}
+
 		// Read all resources configs from the DB...
 		allResourceConfigs = esbDatabase.createQuery("from TransformationResource").list();
 		

Modified: labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/transform/NewResource.java
===================================================================
--- labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/transform/NewResource.java	2006-11-28 02:46:09 UTC (rev 7865)
+++ labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/transform/NewResource.java	2006-11-28 09:17:11 UTC (rev 7866)
@@ -24,7 +24,6 @@
 import static org.jboss.seam.ScopeType.CONVERSATION;
 
 import java.io.Serializable;
-import java.util.ArrayList;
 import java.util.List;
 
 import org.hibernate.Session;
@@ -49,13 +48,13 @@
 @Name("newResource")
 @Scope(CONVERSATION)
 @Conversational(ifNotBegunOutcome="home")
- at MessageExchangeSelected
+ at MessageExchangeSelected(returnId="new-trans-resource-select-spec")
 public class NewResource implements Serializable {
 
 	@In(create=true)
 	private Session esbDatabase;
 
-	@In
+	@In(required=false)
 	private MessageExchange messageExchange;
 	
 	@DataModel 
@@ -82,10 +81,15 @@
 	
 	@DataModel 
 	private List<TransformationResourceParameter> parameterList;
+
+	@Begin(join=true)
+	public void initialise() {
+		configurationSpecs = esbDatabase.createQuery("from TransformationResourceSpec order by name").list();
+	}
 	
 	@Begin(join=true)
 	public String selectResourceSpec() {
-		configurationSpecs = esbDatabase.createQuery("from TransformationResourceSpec order by name").list();
+		initialise();
 		return "new-trans-resource-select-spec";
 	}
 	

Modified: labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/transform/NewResourceSpec.java
===================================================================
--- labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/transform/NewResourceSpec.java	2006-11-28 02:46:09 UTC (rev 7865)
+++ labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/transform/NewResourceSpec.java	2006-11-28 09:17:11 UTC (rev 7866)
@@ -37,8 +37,6 @@
 import org.jboss.seam.annotations.Scope;
 import org.jboss.seam.annotations.datamodel.DataModel;
 import org.jboss.soa.esb.admin.console.SeamUtils;
-import org.jboss.soa.esb.admin.console.exchange.MessageExchange;
-import org.jboss.soa.esb.admin.console.exchange.MessageExchangeSelected;
 
 /**
  * Add Transformation Resource Specification action handler.

Modified: labs/jbossesb/trunk/product/console/view/transform/select-message-exchange-finish.xhtml
===================================================================
--- labs/jbossesb/trunk/product/console/view/transform/select-message-exchange-finish.xhtml	2006-11-28 02:46:09 UTC (rev 7865)
+++ labs/jbossesb/trunk/product/console/view/transform/select-message-exchange-finish.xhtml	2006-11-28 09:17:11 UTC (rev 7866)
@@ -11,7 +11,11 @@
 	<h:form>
 		<h2>Select Message Exchange : <i>Finished...</i></h2>
 		
-		<div class="section">			
+		<div class="section">
+			An "active" <a href="../about.jsf#message-exchange">Message Exchange</a> is now selected.  Check the selected exchange and
+			press "Continue..." to continue making transformation configurations.
+		</div>
+		<div class="section">
 			<div class="entry">
 				<div class="label"><h:outputLabel for="MessageExchange">Selected Message Exchange:</h:outputLabel></div>
 				<div class="output">
@@ -21,7 +25,7 @@
 		</div>
 
 		<div class="section">
-			<s:link action="#{transConfigRejoin.rejoin}" value="Done" linkStyle="button" buttonClass="button" />
+			<s:link action="#{messageExchangeSelect.finish}" value="Continue..." linkStyle="button" buttonClass="button" />
 		</div>
 
 	</h:form>

Modified: labs/jbossesb/trunk/product/console/view/transform/select-message-exchange-to.xhtml
===================================================================
--- labs/jbossesb/trunk/product/console/view/transform/select-message-exchange-to.xhtml	2006-11-28 02:46:09 UTC (rev 7865)
+++ labs/jbossesb/trunk/product/console/view/transform/select-message-exchange-to.xhtml	2006-11-28 09:17:11 UTC (rev 7866)
@@ -39,7 +39,7 @@
 		</div>
 
 		<div class="section">
-			<h:commandButton value="Finish..." action="#{messageExchangeSelect.showFinish}" class="button" />
+			<h:commandButton value="Continue..." action="#{messageExchangeSelect.showFinish}" class="button" />
 		</div>
 		<div class="section">
 			<h:commandButton value="Cancel" action="#{messageExchangeSelect.cancel}" class="button" />




More information about the jboss-svn-commits mailing list