incubator-isis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmatth...@apache.org
Subject svn commit: r1090051 - in /incubator/isis/trunk/viewer/scimpi: dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/ dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/ dispatcher/src/main/java/org/apache/i...
Date Thu, 07 Apr 2011 22:30:37 GMT
Author: rmatthews
Date: Thu Apr  7 22:30:36 2011
New Revision: 1090051

URL: http://svn.apache.org/viewvc?rev=1090051&view=rev
Log:
Improvements to layout

Modified:
    incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/RequestContext.java
    incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/FieldFactory.java
    incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/form/HtmlFormBuilder.java
    incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/InitializeFromResult.java
    incubator/isis/trunk/viewer/scimpi/servlet/src/main/java/org/apache/isis/viewer/scimpi/servlet/DispatcherServlet.java

Modified: incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/RequestContext.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/RequestContext.java?rev=1090051&r1=1090050&r2=1090051&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/RequestContext.java
(original)
+++ incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/RequestContext.java
Thu Apr  7 22:30:36 2011
@@ -771,10 +771,8 @@ public abstract class RequestContext {
     }
 
     public boolean showDebugData() {
-     //   getDebug() == RequestContext.Debug.ON
-        
-        Object variable = getVariable("debug");
-        return variable != null && ((Boolean) variable).booleanValue();
+        String variable = (String) getVariable("debug");
+        return variable != null && "on".equalsIgnoreCase(variable);
     }
 
     

Modified: incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/FieldFactory.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/FieldFactory.java?rev=1090051&r1=1090050&r2=1090051&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/FieldFactory.java
(original)
+++ incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/FieldFactory.java
Thu Apr  7 22:30:36 2011
@@ -29,7 +29,8 @@ import org.apache.isis.core.metamodel.fa
 import org.apache.isis.core.metamodel.spec.ObjectSpecification;
 import org.apache.isis.core.metamodel.spec.feature.ObjectFeature;
 import org.apache.isis.core.metamodel.spec.feature.ObjectMember;
-import org.apache.isis.runtimes.dflt.runtime.context.IsisContext;
+import org.apache.isis.core.progmodel.facets.value.booleans.BooleanValueFacet;
+import org.apache.isis.core.progmodel.facets.value.password.PasswordValueFacet;
 import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext;
 import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext.Scope;
 import org.apache.isis.viewer.scimpi.dispatcher.view.form.InputField;
@@ -71,12 +72,10 @@ public class FieldFactory {
             field.setHeight(multiLineFacet.numberOfLines());
             field.setWrapped(!multiLineFacet.preventWrapping());
 
-            // TODO figure out a better way to determine if boolean or a password
             ObjectSpecification spec = param.getSpecification();
-            if (spec.isOfType(IsisContext.getSpecificationLoader().loadSpecification(boolean.class))
-                    || spec.isOfType(IsisContext.getSpecificationLoader().loadSpecification(Boolean.class.getName())))
{
+            if (spec.containsFacet(BooleanValueFacet.class)) {
                 field.setType(InputField.CHECKBOX);
-            } else if (spec.getFullIdentifier().endsWith(".Password")) {
+            } else if (spec.containsFacet(PasswordValueFacet.class)) {
                 field.setType(InputField.PASSWORD);
             } else {
                 field.setType(InputField.TEXT); 
@@ -91,7 +90,7 @@ public class FieldFactory {
             String[] optionValues = new String[noOptions];
             String[] optionTitles = new String[noOptions];
             for (int j = 0; j < optionsForParameter.length; j++) {
-                int i = j + (field.isRequired() ? 0 : 1);
+                int i = j; // + (field.isRequired() ? 0 : 1);
                 optionValues[i] = getValue(context, optionsForParameter[j]);
                 optionTitles[i] = optionsForParameter[j].titleString();
             }

Modified: incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/form/HtmlFormBuilder.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/form/HtmlFormBuilder.java?rev=1090051&r1=1090050&r2=1090051&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/form/HtmlFormBuilder.java
(original)
+++ incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/form/HtmlFormBuilder.java
Thu Apr  7 22:30:36 2011
@@ -116,7 +116,6 @@ public class HtmlFormBuilder {
     }
 
     private static String createObjectField(InputField field, String type) {
-        String value = field.getValue();
         return field.getHtml();
     }
 
@@ -132,14 +131,15 @@ public class HtmlFormBuilder {
     }
 
     private static String createPasswordField(InputField field) {
-        return createTextField(field, "password");
+        String extra = " autocomplete=\"off\"";
+        return createTextField(field, "password", extra);
     }
 
     private static String createTextField(InputField field) {
-        return createTextField(field, "text");
+        return createTextField(field, "text", "");
     }
     
-    private static String createTextField(InputField field, String type) {
+    private static String createTextField(InputField field, String type, String additionalAttributes)
{
         String value = field.getValue();
         String valueSegment = value == null ? "" : " value=\"" + value + "\"";
         String lengthSegment = field.getWidth() == 0 ? "" : " size=\"" + field.getWidth()
+ "\"";
@@ -147,7 +147,7 @@ public class HtmlFormBuilder {
         String requiredSegment = !field.isRequired() ? "" : " <span class=\"required\">*</span>";
         String disabled = field.isEditable() ? "" : " disabled=\"disabled\"";
         return "<input type=\"" + type + "\" name=\"" + field.getName() + "\"" + valueSegment
+ lengthSegment + 
-            maxLengthSegment + disabled + " />" + requiredSegment;
+            maxLengthSegment + disabled + additionalAttributes + " />" + requiredSegment;
     }
 
     private static String createCheckbox(InputField field) {
@@ -174,7 +174,8 @@ public class HtmlFormBuilder {
             }
         }
         if (!field.isRequired() || length == 0) {
-            str.append("    <option value=\"null\"></option>\n");
+            String selectedSegment = field.getValue() == null || field.getValue().equals("")
? " selected=\"selected\"" : "";
+            str.append("    <option value=\"null\"" + selectedSegment + "></option>\n");
         }
         if (offerOther) {
             str.append("    <option value=\"-OTHER-\">Other:</option>\n");

Modified: incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/InitializeFromResult.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/InitializeFromResult.java?rev=1090051&r1=1090050&r2=1090051&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/InitializeFromResult.java
(original)
+++ incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/InitializeFromResult.java
Thu Apr  7 22:30:36 2011
@@ -35,7 +35,7 @@ public class InitializeFromResult extend
         String sourceObjectId = objectOrResult(request); 
         Class<?> cls = forClass(request); 
         String variableName = request.getRequiredProperty(NAME); 
-        //        String defaultObjectId = request.getOptionalProperty(DEFAULT);        

+        String defaultObjectId = request.getOptionalProperty(DEFAULT);         
         String scopeName = request.getOptionalProperty(SCOPE);
         Scope scope = RequestContext.scope(scopeName, Scope.REQUEST);
 
@@ -47,7 +47,10 @@ public class InitializeFromResult extend
             request.appendDebug("     " + variableName + " set to " + sourceObjectId + "
(" + scope + ")"); 
             context.addVariable(variableName, sourceObjectId, scope); 
         } else { 
-            request.appendDebug("     " + variableName + " set to " + sourceObjectId + "
(" + scope + ")"); 
+            request.appendDebug("     " + variableName + " set to " + sourceObjectId + "
(" + scope + ")");
+            if (defaultObjectId != null) {
+                context.addVariable(variableName, defaultObjectId, scope);
+            }
             context.changeScope(variableName, scope); 
         } 
     } 

Modified: incubator/isis/trunk/viewer/scimpi/servlet/src/main/java/org/apache/isis/viewer/scimpi/servlet/DispatcherServlet.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/scimpi/servlet/src/main/java/org/apache/isis/viewer/scimpi/servlet/DispatcherServlet.java?rev=1090051&r1=1090050&r2=1090051&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/scimpi/servlet/src/main/java/org/apache/isis/viewer/scimpi/servlet/DispatcherServlet.java
(original)
+++ incubator/isis/trunk/viewer/scimpi/servlet/src/main/java/org/apache/isis/viewer/scimpi/servlet/DispatcherServlet.java
Thu Apr  7 22:30:36 2011
@@ -56,6 +56,7 @@ public class DispatcherServlet extends H
         try {
             ServletRequestContext context = new ServletRequestContext();
             HttpSession httpSession = request.getSession(false);
+            // TODO when using version 3.0 of Servlet API use the HttpOnly setting for improved
security
             if (httpSession != null) {
                 HashMap<String, Object> data = (HashMap<String, Object>) httpSession.getAttribute("scimpi-context");
                 if (data != null) {



Mime
View raw message