You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@continuum.apache.org by ol...@apache.org on 2007/09/08 21:13:00 UTC

svn commit: r573895 - in /maven/continuum/trunk/continuum-webapp/src/main: java/org/apache/maven/continuum/web/action/admin/ resources/ resources/localization/ webapp/WEB-INF/jsp/admin/ webapp/WEB-INF/jsp/navigations/

Author: olamy
Date: Sat Sep  8 12:12:59 2007
New Revision: 573895

URL: http://svn.apache.org/viewvc?rev=573895&view=rev
Log:
[CONTINUUM-1430] Split forms for environment variables and Ant/Maven/JDK installations


Added:
    maven/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/admin/installationsTypeChoice.jsp   (with props)
Modified:
    maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/admin/InstallationAction.java
    maven/continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties
    maven/continuum/trunk/continuum-webapp/src/main/resources/xwork.xml
    maven/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/admin/editInstallation.jsp
    maven/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/admin/installationsList.jsp
    maven/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/navigations/Menu.jsp

Modified: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/admin/InstallationAction.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/admin/InstallationAction.java?rev=573895&r1=573894&r2=573895&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/admin/InstallationAction.java (original)
+++ maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/admin/InstallationAction.java Sat Sep  8 12:12:59 2007
@@ -11,6 +11,7 @@
 import org.codehaus.plexus.redback.xwork.interceptor.SecureActionException;
 
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
@@ -58,22 +59,24 @@
 
     private List<String> types;
 
-    private boolean varNameUpdatable = true;
-
-    private boolean nameUpdatable = true;
-    
+    private boolean varNameUpdatable = false;
+   
     private boolean automaticProfile;
-
+   
+    private boolean varNameDisplayable = false;
+    
+    private boolean displayTypes = true;
+    
+    private String installationType;
+    
+    private Map<String, String> installationTypes;
+    
+    private static final String TOOL_TYPE_KEY = "tool";
+   
     // -----------------------------------------------------
     // Webwork methods
     // -----------------------------------------------------
 
-    public void prepare()
-        throws Exception
-    {
-        super.prepare();
-    }
-
     public String list()
         throws Exception
     {
@@ -88,12 +91,7 @@
 
         if ( this.installation != null )
         {
-            this.nameUpdatable = false;
-            // we can update env var name only with env var type
-            if ( !InstallationService.ENVVAR_TYPE.equals( this.installation.getType() ) )
-            {
-                this.varNameUpdatable = false;
-            }
+            this.configureUiFlags();
         }
         return SUCCESS;
     }
@@ -101,22 +99,40 @@
     public String input()
         throws Exception
     {
+        if ( InstallationService.ENVVAR_TYPE.equalsIgnoreCase( this.getInstallationType() ) )
+        {
+            this.installation = new Installation();
+            this.installation.setType( InstallationService.ENVVAR_TYPE );
+            this.setDisplayTypes( false );
+            this.setVarNameUpdatable( true );
+            this.setVarNameDisplayable( true );
+        }
+        else
+        {
+            this.setVarNameUpdatable( false );
+            this.setVarNameDisplayable( false );
+        }
         return INPUT;
     }
 
     public String save()
         throws Exception
     {
+        if ( InstallationService.ENVVAR_TYPE.equalsIgnoreCase( this.getInstallationType() ) )
+        {
+            this.installation.setType( InstallationService.ENVVAR_TYPE );
+        }
         if ( installation.getInstallationId() == 0 )
         {
             installationService.add( installation, this.automaticProfile );
         }
         else
         {
+            this.configureUiFlags();
             installationService.update( installation );
             return "edit";
         }
-        //this.installations = installationService.getAllInstallations();
+        this.configureUiFlags();
         return SUCCESS;
     }
 
@@ -129,6 +145,16 @@
         return SUCCESS;
     }
 
+    public String listTypes()
+    {
+        this.installationTypes = new LinkedHashMap<String, String>();
+        ResourceBundle resourceBundle = getResourceBundle();
+        this.installationTypes.put( TOOL_TYPE_KEY, resourceBundle.getString( "installationTypeChoice.tool.label" ) );
+        this.installationTypes.put( InstallationService.ENVVAR_TYPE, resourceBundle.getString( "installationTypeChoice.envar.label" ) );
+
+        return SUCCESS;
+    }
+    
     // -----------------------------------------------------
     // security
     // -----------------------------------------------------    
@@ -144,8 +170,33 @@
     }
 
     // -----------------------------------------------------
+    // utils
+    // -----------------------------------------------------    
+    private void configureUiFlags()
+    {
+        // we can update env var name only with env var type
+        if ( !InstallationService.ENVVAR_TYPE.equals( this.installation.getType() ) )
+        {
+            this.setDisplayTypes( true );
+            this.setVarNameUpdatable( false );
+        }
+        else
+        {
+            this.setDisplayTypes( false );
+            this.setVarNameUpdatable( true );
+            this.setVarNameDisplayable( true );
+        }
+        this.setInstallationType( this.getInstallation().getType() );
+    }
+    
+    
+    // -----------------------------------------------------
     // getter/setters
     // -----------------------------------------------------
+    protected ResourceBundle getResourceBundle()
+    {
+        return getTexts( "localization/Continuum" );
+    }
     public List<Installation> getInstallations()
     {
         return installations;
@@ -171,7 +222,7 @@
         if ( this.typesLabels == null )
         {
             this.typesLabels = new LinkedHashMap<String, String>();
-            ResourceBundle resourceBundle = getTexts( "localization/Continuum" );
+            ResourceBundle resourceBundle = getResourceBundle();
             this.typesLabels.put( InstallationService.JDK_TYPE, resourceBundle
                 .getString( "installation.jdk.type.label" ) );
             this.typesLabels.put( InstallationService.MAVEN2_TYPE, resourceBundle
@@ -180,8 +231,9 @@
                 .getString( "installation.maven1.type.label" ) );
             this.typesLabels.put( InstallationService.ANT_TYPE, resourceBundle
                 .getString( "installation.ant.type.label" ) );
-            this.typesLabels.put( InstallationService.ENVVAR_TYPE, resourceBundle
-                .getString( "installation.envvar.type.label" ) );
+            // CONTINUUM-1430
+            //this.typesLabels.put( InstallationService.ENVVAR_TYPE, resourceBundle
+            //    .getString( "installation.envvar.type.label" ) );
         }
         return typesLabels;
     }
@@ -210,7 +262,8 @@
             this.types.add( InstallationService.MAVEN2_TYPE );
             this.types.add( InstallationService.MAVEN1_TYPE );
             this.types.add( InstallationService.ANT_TYPE );
-            this.types.add( InstallationService.ENVVAR_TYPE );
+            // CONTINUUM-1430
+            //this.types.add( InstallationService.ENVVAR_TYPE );
 
         }
         return types;
@@ -221,24 +274,54 @@
         this.types = types;
     }
 
-    public boolean isNameUpdatable()
+    public boolean isAutomaticProfile()
+    {
+        return automaticProfile;
+    }
+
+    public void setAutomaticProfile( boolean automaticProfile )
     {
-        return nameUpdatable;
+        this.automaticProfile = automaticProfile;
     }
 
-    public void setNameUpdatable( boolean nameUpdatable )
+    public Map<String, String> getInstallationTypes()
     {
-        this.nameUpdatable = nameUpdatable;
+        return installationTypes;
     }
 
-    public boolean isAutomaticProfile()
+    public void setInstallationTypes( Map<String, String> installationTypes )
     {
-        return automaticProfile;
+        this.installationTypes = installationTypes;
     }
 
-    public void setAutomaticProfile( boolean automaticProfile )
+    public boolean isVarNameDisplayable()
     {
-        this.automaticProfile = automaticProfile;
+        return varNameDisplayable;
+    }
+
+    public void setVarNameDisplayable( boolean varNameDisplayable )
+    {
+        this.varNameDisplayable = varNameDisplayable;
+    }
+
+    public boolean isDisplayTypes()
+    {
+        return displayTypes;
+    }
+
+    public void setDisplayTypes( boolean displayTypes )
+    {
+        this.displayTypes = displayTypes;
+    }
+
+    public String getInstallationType()
+    {
+        return installationType;
+    }
+
+    public void setInstallationType( String installationType )
+    {
+        this.installationType = installationType;
     }
 
 }

Modified: maven/continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties?rev=573895&r1=573894&r2=573895&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties (original)
+++ maven/continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties Sat Sep  8 12:12:59 2007
@@ -622,6 +622,7 @@
 profile.jdk.path.label = Jdk path
 profile.jdk.path.message = The JDK Path (JAVA_HOME value)
 profile.no.installations = No installations available
+
 # ----------------------------------------------------------------------
 # Page: Installations List
 # ----------------------------------------------------------------------
@@ -636,7 +637,7 @@
 installation.name.label = Name
 installation.type.label = Type
 installation.value.label = Value/Path
-installation.varName.label = Environment Variable Name (only needed for type Environment Variable)
+installation.varName.label = Environment Variable Name
 installation.jdk.type.label = JDK
 installation.maven2.type.label = Maven 2
 installation.maven1.type.label = Maven 1
@@ -644,9 +645,14 @@
 installation.ant.type.label = ANT
 installation.automaticProfile.label=Create a Profile with the installation name
 
-
-
-
+# ----------------------------------------------------------------------
+# Page: Installations Type Choice
+# ----------------------------------------------------------------------
+installationTypeChoice.page.title =  Continuum - Installation Type Choice
+installationTypeChoice.section.title = Installation Type Choice
+installationTypeChoice.action.label = Installation Type
+installationTypeChoice.tool.label = Tool
+installationTypeChoice.envar.label = Environment Variable 
 
 
 

Modified: maven/continuum/trunk/continuum-webapp/src/main/resources/xwork.xml
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/resources/xwork.xml?rev=573895&r1=573894&r2=573895&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/resources/xwork.xml (original)
+++ maven/continuum/trunk/continuum-webapp/src/main/resources/xwork.xml Sat Sep  8 12:12:59 2007
@@ -573,6 +573,10 @@
     <!--
        Installation actions 
     -->  
+    <action name="installationsTypeChoice" class="installation" method="listTypes">
+      <result name="success">/WEB-INF/jsp/admin/installationsTypeChoice.jsp</result>
+    </action>
+    
     <action name="installationsList" class="installation" method="list">
       <result name="success">/WEB-INF/jsp/admin/installationsList.jsp</result>
     </action>   
@@ -583,7 +587,7 @@
       
     <action name="editInstallation" class="installation" method="edit">
       <result name="success">/WEB-INF/jsp/admin/editInstallation.jsp</result>
-        <result name="input">/WEB-INF/jsp/admin/editInstallation.jsp</result>    
+      <result name="input">/WEB-INF/jsp/admin/editInstallation.jsp</result>    
     </action>
       
     <action name="saveInstallation" class="installation" method="save">

Modified: maven/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/admin/editInstallation.jsp
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/admin/editInstallation.jsp?rev=573895&r1=573894&r2=573895&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/admin/editInstallation.jsp (original)
+++ maven/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/admin/editInstallation.jsp Sat Sep  8 12:12:59 2007
@@ -46,17 +46,22 @@
 
         <table>
           <tbody>
-            <ww:hidden name="installation.installationId" />         
+            <ww:hidden name="installation.installationId" />
+            <ww:hidden name="installationType" />
             <ww:textfield label="%{getText('installation.name.label')}" name="installation.name"
                             required="true"/>
-          
-            <ww:select label="%{getText('installation.type.label')}" name="installation.type" list="typesLabels" />
-
+            <ww:if test="displayTypes">
+              <ww:select label="%{getText('installation.type.label')}" name="installation.type" list="typesLabels" />
+            </ww:if>
             <ww:if test="varNameUpdatable">
-              <ww:textfield label="%{getText('installation.varName.label')}" name="installation.varName" required="true" />
+              <ww:if test="varNameDisplayable">
+                <ww:textfield label="%{getText('installation.varName.label')}" name="installation.varName" required="${varNameUpdatable}" />
+              </ww:if>
             </ww:if>
             <ww:else>
-              <ww:textfield label="%{getText('installation.varName.label')}" name="installation.varName" required="true" readonly="true"/>
+              <ww:if test="varNameDisplayable">
+                <ww:textfield label="%{getText('installation.varName.label')}" name="installation.varName" required="true" readonly="true"/>
+              </ww:if>
             </ww:else>
             <ww:textfield label="%{getText('installation.value.label')}" name="installation.varValue"
                           required="true"/>

Modified: maven/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/admin/installationsList.jsp
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/admin/installationsList.jsp?rev=573895&r1=573894&r2=573895&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/admin/installationsList.jsp (original)
+++ maven/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/admin/installationsList.jsp Sat Sep  8 12:12:59 2007
@@ -61,7 +61,7 @@
     </ec:table>
     </ww:if>
     <div class="functnbar3">
-      <ww:form action="addInstallation!input.action" method="post">
+      <ww:form action="installationsTypeChoice!listTypes.action" method="post">
         <ww:submit value="%{getText('add')}"/>
       </ww:form>
     </div>  

Added: maven/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/admin/installationsTypeChoice.jsp
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/admin/installationsTypeChoice.jsp?rev=573895&view=auto
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/admin/installationsTypeChoice.jsp (added)
+++ maven/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/admin/installationsTypeChoice.jsp Sat Sep  8 12:12:59 2007
@@ -0,0 +1,51 @@
+<%--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~   http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  --%>
+
+<%@ taglib uri='http://java.sun.com/jsp/jstl/core' prefix='c'%>
+<%@ taglib uri="/webwork" prefix="ww" %>
+<%@ taglib uri="continuum" prefix="c1" %>
+<%@ taglib uri="http://www.extremecomponents.org" prefix="ec" %>
+
+<html>
+<ww:i18n name="localization.Continuum">
+  <head>
+    <title><ww:text name="installationTypeChoice.page.title"/></title>
+  </head>
+  
+  <div id="h3">
+    <h3>
+      <ww:text name="installationTypeChoice.section.title"/>
+    </h3>  
+    <form action="editInstallation!input.action">
+      <div class="axial">
+
+        <table>
+          <tbody>    
+            <ww:select name="installationType" list="installationTypes" 
+                       label="%{getText('installationTypeChoice.action.label')}" />
+          </tbody>
+        </table>
+        <div class="functnbar3">
+          <c1:submitcancel value="%{getText('add')}" cancel="%{getText('cancel')}"/>
+        </div>        
+      </div>
+  
+  </div>
+  
+</ww:i18n>

Propchange: maven/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/admin/installationsTypeChoice.jsp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/admin/installationsTypeChoice.jsp
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Modified: maven/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/navigations/Menu.jsp
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/navigations/Menu.jsp?rev=573895&r1=573894&r2=573895&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/navigations/Menu.jsp (original)
+++ maven/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/navigations/Menu.jsp Sat Sep  8 12:12:59 2007
@@ -96,7 +96,7 @@
             </ww:a>
           </div>
         </redback:ifAuthorized>
-        <redback:ifAuthorized permission="continuum-manage-installations">   
+        <redback:ifAuthorized permission="continuum-manage-installations">
           <ww:url id="configurationUrl" action="installationsList" namespace="/admin" method="list" includeParams="none"/>
           <div class="body">
             <ww:a href="%{configurationUrl}">