incubator-isis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmatth...@apache.org
Subject svn commit: r1399251 - in /incubator/isis/trunk/framework/viewer/scimpi/scimpi-dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view: action/ display/ edit/ form/ logon/
Date Wed, 17 Oct 2012 13:42:51 GMT
Author: rmatthews
Date: Wed Oct 17 13:42:50 2012
New Revision: 1399251

URL: http://svn.apache.org/viewvc?rev=1399251&view=rev
Log:
ISIS-162 - Improved form layout for various elements

Modified:
    incubator/isis/trunk/framework/viewer/scimpi/scimpi-dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/ActionForm.java
    incubator/isis/trunk/framework/viewer/scimpi/scimpi-dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/CreateFormParameter.java
    incubator/isis/trunk/framework/viewer/scimpi/scimpi-dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/AbstractFormView.java
    incubator/isis/trunk/framework/viewer/scimpi/scimpi-dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/EditObject.java
    incubator/isis/trunk/framework/viewer/scimpi/scimpi-dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/form/HtmlFormBuilder.java
    incubator/isis/trunk/framework/viewer/scimpi/scimpi-dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/logon/Logon.java

Modified: incubator/isis/trunk/framework/viewer/scimpi/scimpi-dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/ActionForm.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/scimpi/scimpi-dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/ActionForm.java?rev=1399251&r1=1399250&r2=1399251&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/scimpi/scimpi-dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/ActionForm.java
(original)
+++ incubator/isis/trunk/framework/viewer/scimpi/scimpi-dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/ActionForm.java
Wed Oct 17 13:42:50 2012
@@ -58,6 +58,7 @@ public class ActionForm extends Abstract
         parameters.showIcon = request.isRequested(SHOW_ICON, showIconByDefault());
         parameters.buttonTitle = request.getOptionalProperty(BUTTON_TITLE);
         parameters.formTitle = request.getOptionalProperty(FORM_TITLE);
+        parameters.labelDelimiter = request.getOptionalProperty(LABEL_DELIMITER, ":");
         parameters.formId = request.getOptionalProperty(FORM_ID, request.nextFormId());
         parameters.resultName = request.getOptionalProperty(RESULT_NAME);
         parameters.resultOverride = request.getOptionalProperty(RESULT_OVERRIDE);
@@ -156,10 +157,8 @@ public class ActionForm extends Abstract
             buttonTitle = "Ok";
         }
 
-        final String cancelTo = parameterObject.cancelTo == null ? "_generic.shtml?_result="
+ objectId : parameterObject.cancelTo;
-
         HtmlFormBuilder.createForm(request, ActionAction.ACTION + ".app", hiddenFields, formFields,
parameterObject.className,
-                parameterObject.id, formTitle, action.getDescription(), action.getHelp(),
buttonTitle, errors, cancelTo);
+                parameterObject.id, formTitle, parameterObject.labelDelimiter, action.getDescription(),
action.getHelp(), buttonTitle, errors, parameterObject.cancelTo);
 
         request.popBlockContent();
     }

Modified: incubator/isis/trunk/framework/viewer/scimpi/scimpi-dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/CreateFormParameter.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/scimpi/scimpi-dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/CreateFormParameter.java?rev=1399251&r1=1399250&r2=1399251&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/scimpi/scimpi-dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/CreateFormParameter.java
(original)
+++ incubator/isis/trunk/framework/viewer/scimpi/scimpi-dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/CreateFormParameter.java
Wed Oct 17 13:42:50 2012
@@ -39,4 +39,5 @@ public class CreateFormParameter {
     public boolean showIcon;
     public String completionMessage;
     public String cancelTo;
+    public String labelDelimiter;
 }

Modified: incubator/isis/trunk/framework/viewer/scimpi/scimpi-dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/AbstractFormView.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/scimpi/scimpi-dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/AbstractFormView.java?rev=1399251&r1=1399250&r2=1399251&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/scimpi/scimpi-dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/AbstractFormView.java
(original)
+++ incubator/isis/trunk/framework/viewer/scimpi/scimpi-dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/AbstractFormView.java
Wed Oct 17 13:42:50 2012
@@ -52,6 +52,7 @@ public abstract class AbstractFormView e
             String title = request.getOptionalProperty(FORM_TITLE);
             final String oddRowClass = request.getOptionalProperty(ODD_ROW_CLASS);
             final String evenRowClass = request.getOptionalProperty(EVEN_ROW_CLASS);
+            final String labelDelimiter = request.getOptionalProperty(LABEL_DELIMITER, ":");
             final boolean showIcons = request.isRequested(SHOW_ICON, showIconByDefault());

 
             request.setBlockContent(tag);
@@ -78,13 +79,23 @@ public abstract class AbstractFormView e
                 title = null;
             }
 
-            write(request, object, fields, linkFields, classString, title, oddRowClass, evenRowClass,
showIcons);
+            write(request, object, fields, linkFields, classString, title, labelDelimiter,
oddRowClass, evenRowClass, showIcons);
         } else {
             request.skipUntilClose(); 
         }
     }
 
-    private void write(final Request request, final ObjectAdapter object, final List<ObjectAssociation>
fields, final LinkedObject[] linkFields, final String classString, final String title, final
String oddRowClass, final String evenRowClass, final boolean showIcons) {
+    private void write(
+            final Request request,
+            final ObjectAdapter object,
+            final List<ObjectAssociation> fields,
+            final LinkedObject[] linkFields,
+            final String classString,
+            final String title,
+            final String labelDelimiter,
+            final String oddRowClass,
+            final String evenRowClass,
+            final boolean showIcons) {
         request.appendHtml("<div" + classString + ">");
         if (title != null) {
             request.appendHtml("<div class=\"title\">");
@@ -111,7 +122,7 @@ public abstract class AbstractFormView e
             }
             request.appendHtml("<div " + cls + description + "><span class=\"label\">");
             request.appendAsHtmlEncoded(field.getName());
-            request.appendHtml(":</span>");
+            request.appendHtml(labelDelimiter + "</span>");
             final LinkedObject linkedObject = linkFields[i];
             addField(request, object, field, linkedObject, showIcons);
             HelpLink.append(request, field.getDescription(), field.getHelp());

Modified: incubator/isis/trunk/framework/viewer/scimpi/scimpi-dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/EditObject.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/scimpi/scimpi-dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/EditObject.java?rev=1399251&r1=1399250&r2=1399251&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/scimpi/scimpi-dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/EditObject.java
(original)
+++ incubator/isis/trunk/framework/viewer/scimpi/scimpi-dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/EditObject.java
Wed Oct 17 13:42:50 2012
@@ -59,6 +59,7 @@ public class EditObject extends Abstract
         final String cancelTo = request.getOptionalProperty(CANCEL_TO); 
         final boolean hideNonEditableFields = request.isRequested(HIDE_UNEDITABLE, false);
         final boolean showIcon = request.isRequested(SHOW_ICON, showIconByDefault());
+        final String labelDelimiter = request.getOptionalProperty(LABEL_DELIMITER, ":");
         String buttonTitle = request.getOptionalProperty(BUTTON_TITLE);
         String formTitle = request.getOptionalProperty(FORM_TITLE);
         final String formId = request.getOptionalProperty(FORM_ID, request.nextFormId());
@@ -163,7 +164,7 @@ public class EditObject extends Abstract
 
         final HiddenInputField[] hiddenFieldArray = hiddenFields.toArray(new HiddenInputField[hiddenFields.size()]);
         HtmlFormBuilder.createForm(request, EditAction.ACTION + ".app", hiddenFieldArray,
formFields, className, id, formTitle,
-                null, null, buttonTitle, errors, cancelTo);
+                labelDelimiter, null, null, buttonTitle, errors, cancelTo);
      request.popBlockContent();
     }
 

Modified: incubator/isis/trunk/framework/viewer/scimpi/scimpi-dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/form/HtmlFormBuilder.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/scimpi/scimpi-dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/form/HtmlFormBuilder.java?rev=1399251&r1=1399250&r2=1399251&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/scimpi/scimpi-dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/form/HtmlFormBuilder.java
(original)
+++ incubator/isis/trunk/framework/viewer/scimpi/scimpi-dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/form/HtmlFormBuilder.java
Wed Oct 17 13:42:50 2012
@@ -33,6 +33,7 @@ public class HtmlFormBuilder {
             final String className,
             final String id,
             final String formTitle,
+            final String labelDelimiter,
             final String description,
             final String helpReference,
             final String buttonTitle,
@@ -76,9 +77,9 @@ public class HtmlFormBuilder {
                 final String fieldSegment = createField(fld);
                 final String helpSegment = HelpLink.createHelpSegment(fld.getDescription(),
fld.getHelpReference());
                 final String title = fld.getDescription().equals("") ? "" : " title=\"" +
fld.getDescription() + "\"";
-                request.appendHtml("  <div class=\"field\"><label class=\"label\"
" + title + ">");
+                request.appendHtml("  <div class=\"field " + fld.getName() + "\"><label
class=\"label\" " + title + ">");
                 request.appendAsHtmlEncoded(fld.getLabel());
-                request.appendHtml(":</label>" + fieldSegment + errorSegment + helpSegment
+ "</div>\n");
+                request.appendHtml(labelDelimiter + "</label>" + fieldSegment + errorSegment
+ helpSegment + "</div>\n");
             }
         }
 
@@ -138,10 +139,11 @@ public class HtmlFormBuilder {
         final String columnsSegment = field.getWidth() == 0 ? "" : " cols=\"" + field.getWidth()
/ field.getHeight() + "\"";
         final String rowsSegment = field.getHeight() == 0 ? "" : " rows=\"" + field.getHeight()
+ "\"";
         final String wrapSegment = !field.isWrapped() ? "" : " wrap=\"off\"";
-        final String requiredSegment = !field.isRequired() ? "" : " <span class=\"required\">*</span>";
+        final String requiredSegment = !field.isRequired() ? "" : " class=\"required\"";
         final String disabled = field.isEditable() ? "" : " disabled=\"disabled\"";
-        final String maxLength = field.getMaxLength() == 0 ? "" : " rows=\"" + field.getMaxLength()
+ "\"";
-        return "<textarea name=\"" + field.getName() + "\"" + columnsSegment + rowsSegment
+ wrapSegment + maxLength + disabled + ">" + Request.getEncoder().encoder(field.getValue())
+ "</textarea>" + requiredSegment;
+        final String maxLength = field.getMaxLength() == 0 ? "" : " maxlength=\"" + field.getMaxLength()
+ "\"";
+        return "<textarea" + requiredSegment + " name=\"" + field.getName() + "\"" + columnsSegment
+ rowsSegment + wrapSegment
+                + maxLength + disabled + ">" + Request.getEncoder().encoder(field.getValue())
+ "</textarea>";
     }
 
     private static String createPasswordField(final InputField field) {
@@ -158,10 +160,10 @@ public class HtmlFormBuilder {
         final String valueSegment = value == null ? "" : " value=\"" + Request.getEncoder().encoder(value)
+ "\"";
         final String lengthSegment = field.getWidth() == 0 ? "" : " size=\"" + field.getWidth()
+ "\"";
         final String maxLengthSegment = field.getMaxLength() == 0 ? "" : " maxlength=\""
+ field.getMaxLength() + "\"";
-        final String requiredSegment = !field.isRequired() ? "" : " <span class=\"required\">*</span>";
+        final String requiredSegment = !field.isRequired() ? "" : " required";
         final String disabled = field.isEditable() ? "" : " disabled=\"disabled\"";
-        return "<input class=\"" + field.getDataType() + "\" + type=\"" + type + "\" name=\""
+ field.getName() + "\"" + 
-                valueSegment + lengthSegment + maxLengthSegment + disabled + additionalAttributes
+ " />" + requiredSegment;
+        return "<input class=\"" + field.getDataType() + requiredSegment + "\" type=\""
+ type + "\" name=\"" + field.getName() + "\"" + 
+                valueSegment + lengthSegment + maxLengthSegment + disabled + additionalAttributes
+ " />";
     }
 
     private static String createCheckbox(final InputField field) {
@@ -172,12 +174,13 @@ public class HtmlFormBuilder {
     }
 
     private static String createOptions(final InputField field) {
-        final StringBuffer str = new StringBuffer();
-        final String disabled = field.isEditable() ? "" : " disabled=\"disabled\"";
-        str.append("\n  <select name=\"" + field.getName() + "\"" + disabled + ">\n");
         final String[] options = field.getOptionsText();
         final String[] ids = field.getOptionValues();
         final int length = options.length;
+        final String classSegment = field.isRequired() && length == 0 ? " class=\"required\""
: "";
+        final String disabled = field.isEditable() ? "" : " disabled=\"disabled\"";
+        final StringBuffer str = new StringBuffer();
+        str.append("\n  <select name=\"" + field.getName() + "\"" + disabled  + classSegment
+ ">\n");
         boolean offerOther = false;
         for (int i = 0; i < length; i++) {
             final String selectedSegment = field.getValue() == null || ids[i].equals(field.getValue())
? " selected=\"selected\"" : "";
@@ -204,9 +207,6 @@ public class HtmlFormBuilder {
                                                                      // enabled
             str.append("  <input type=\"text\" name=\"" + field.getName() + "-other\""
+ hideSegment + lengthSegment + disabled + " />");
         }
-        if (field.isRequired() && length == 0) {
-            str.append(" <span class=\"required\">*</span>");
-        }
         str.append("\n");
         return str.toString();
     }

Modified: incubator/isis/trunk/framework/viewer/scimpi/scimpi-dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/logon/Logon.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/scimpi/scimpi-dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/logon/Logon.java?rev=1399251&r1=1399250&r2=1399251&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/scimpi/scimpi-dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/logon/Logon.java
(original)
+++ incubator/isis/trunk/framework/viewer/scimpi/scimpi-dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/logon/Logon.java
Wed Oct 17 13:42:50 2012
@@ -51,12 +51,13 @@ public class Logon extends AbstractEleme
     }
 
     public static void loginForm(final Request request, final String view) {
-        String object = request.getOptionalProperty(OBJECT);
-        String method = request.getOptionalProperty(METHOD, "logon");
-        String result = request.getOptionalProperty(RESULT_NAME, "_user");
-        String resultScope = request.getOptionalProperty(SCOPE, Scope.SESSION.name());
-        String isisUser = request.getOptionalProperty("isis-user", "_web_default");
-        String formId = request.getOptionalProperty(FORM_ID, request.nextFormId());
+        final String object = request.getOptionalProperty(OBJECT);
+        final String method = request.getOptionalProperty(METHOD, "logon");
+        final String result = request.getOptionalProperty(RESULT_NAME, "_user");
+        final String resultScope = request.getOptionalProperty(SCOPE, Scope.SESSION.name());
+        final String isisUser = request.getOptionalProperty("isis-user", "_web_default");
+        final String formId = request.getOptionalProperty(FORM_ID, request.nextFormId());
+        final String labelDelimiter = request.getOptionalProperty(LABEL_DELIMITER, ":");
 
         // TODO error if all values are not set (not if use type is not set and all others
are still defaults);
 
@@ -97,7 +98,7 @@ public class Logon extends AbstractEleme
         final String id = request.getOptionalProperty(ID, "logon");
 
         HtmlFormBuilder.createForm(request, "logon.app", hiddenFields.toArray(new HiddenInputField[hiddenFields.size()]),
fields,
-                className, id, formTitle, null, null, loginButtonTitle,
+                className, id, formTitle, labelDelimiter, null, null, loginButtonTitle,
                 isforThisForm && entryState != null ? entryState.getError() : null
, null);        
     }
 



Mime
View raw message