[Carbon-dev] svn commit r31290 - in trunk/carbon-components/jar-services/org.wso2.carbon.jarservices.ui/src/main/resources/web/jarservices: . js

azeez at wso2.com azeez at wso2.com
Mon Feb 23 01:00:27 PST 2009


Author: azeez
Date: Mon Feb 23 01:00:18 2009
New Revision: 31290
URL: http://wso2.org/svn/browse/wso2?view=rev&revision=31290

Log:
Adding a data structure

Added:
   trunk/carbon-components/jar-services/org.wso2.carbon.jarservices.ui/src/main/resources/web/jarservices/js/
   trunk/carbon-components/jar-services/org.wso2.carbon.jarservices.ui/src/main/resources/web/jarservices/js/jarservices.js
Modified:
   trunk/carbon-components/jar-services/org.wso2.carbon.jarservices.ui/src/main/resources/web/jarservices/list_methods.jsp

Added: trunk/carbon-components/jar-services/org.wso2.carbon.jarservices.ui/src/main/resources/web/jarservices/js/jarservices.js
URL: http://wso2.org/svn/browse/wso2/trunk/carbon-components/jar-services/org.wso2.carbon.jarservices.ui/src/main/resources/web/jarservices/js/jarservices.js?pathrev=31290
==============================================================================
--- (empty file)
+++ trunk/carbon-components/jar-services/org.wso2.carbon.jarservices.ui/src/main/resources/web/jarservices/js/jarservices.js	Mon Feb 23 01:00:18 2009
@@ -0,0 +1,38 @@
+
+function CarbonClass(){
+    this.methods = new Array();
+    this.setClassName = setClassName;
+    this.addMethod = addMethod;
+    this.getMethod = getMethod;
+}
+
+function setClassName(className){
+    this.className = className;
+}
+
+function addMethod(method){
+    this.methods.push(method);
+}
+
+function getMethod(methodName){
+    for (var j = 0; j < this.methods.length; j++) {
+        if (this.methods[j].methodName == methodName) {
+            return this.methods[j];
+        }
+    }
+    return null;
+}
+
+function CarbonMethod(){
+    this.selected = true;
+    this.setSelected = setSelected;
+    this.setMethodName = setMethodName;
+}
+
+function setSelected(selected){
+    this.selected = selected;
+}
+
+function setMethodName(methodName){
+    this.methodName = methodName;
+}

Modified: trunk/carbon-components/jar-services/org.wso2.carbon.jarservices.ui/src/main/resources/web/jarservices/list_methods.jsp
URL: http://wso2.org/svn/browse/wso2/trunk/carbon-components/jar-services/org.wso2.carbon.jarservices.ui/src/main/resources/web/jarservices/list_methods.jsp?rev=31290&r1=31289&r2=31290&view=diff
==============================================================================
--- trunk/carbon-components/jar-services/org.wso2.carbon.jarservices.ui/src/main/resources/web/jarservices/list_methods.jsp	(original)
+++ trunk/carbon-components/jar-services/org.wso2.carbon.jarservices.ui/src/main/resources/web/jarservices/list_methods.jsp	Mon Feb 23 01:00:18 2009
@@ -10,6 +10,8 @@
 <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
 <%@ taglib uri="http://wso2.org/projects/carbon/taglibs/carbontags.jar" prefix="carbon" %>
 
+<script src="js/jarservices.js" type="text/javascript"></script>
+
 <!-- This page is included to display messages which are set to request scope or session scope -->
 <jsp:include page="../dialog/display_messages.jsp"/>
 
@@ -39,10 +41,21 @@
 %>
 <fmt:bundle basename="org.wso2.carbon.jarservices.ui.i18n.Resources">
     <script type="text/javascript">
+       var classes = new Array();
+       
        function validate(){
            return true;
        }
 
+       function selectMethod(className, methodName, checked){
+           for (var i = 0; i < classes.length; i++) {
+               if(classes[i].className == className){
+                   classes[i].getMethod(methodName).setSelected(checked);
+                   break;
+               }
+           }
+       }
+
        function submitForm() {
            var selected;
            var atLeastOneSelected = false;
@@ -103,6 +116,11 @@
                     <%
                         for (ClassMethodsData methods : classMethods) {
                     %>
+                    <script type="text/javascript">
+                        var clazz = new CarbonClass();
+                        clazz.setClassName('<%= methods.getClassName()%>');
+                        classes.push(clazz);
+                    </script>
                     <tr>
                         <td class="formRow">
                             <input type="hidden" name="clazz" value="<%= methods.getClassName()%>"/>
@@ -116,9 +134,14 @@
                                 <%
                                     for (MethodData method : methods.getMethods()) {
                                 %>
+                                <script type="text/javascript">
+                                    var method = new CarbonMethod();
+                                    method.setMethodName('<%= method.getMethodName()%>');
+                                    clazz.addMethod(method);
+                                </script>
                                 <tr>
                                     <td width="15px">
-                                        <input type="checkbox" name="methodChk" value="<%= methods.getClassName() + "#" + method.getMethodName()%>" checked="true"/>
+                                        <input type="checkbox" name="methodChk" value="<%= methods.getClassName() + "#" + method.getMethodName()%>" checked="true" onclick="selectMethod('<%= methods.getClassName()%>', '<%= method.getMethodName()%>', this.checked);"/>
                                         <input type="hidden" name="method" value="<%= methods.getClassName()%>"/>
                                     </td>
                                     <td>



More information about the Carbon-dev mailing list