incubator-isis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From danhayw...@apache.org
Subject svn commit: r1098951 [9/11] - in /incubator/isis/trunk/viewer: junit/src/main/java/org/apache/isis/viewer/junit/ junit/src/main/java/org/apache/isis/viewer/junit/internal/ junit/src/test/java/org/apache/isis/viewer/junit/ junit/src/test/java/org/apache...
Date Tue, 03 May 2011 07:53:11 GMT
Modified: incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/EditObject.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/EditObject.java?rev=1098951&r1=1098950&r2=1098951&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/EditObject.java (original)
+++ incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/EditObject.java Tue May  3 07:53:06 2011
@@ -17,7 +17,6 @@
  *  under the License.
  */
 
-
 package org.apache.isis.viewer.scimpi.dispatcher.view.edit;
 
 import java.util.ArrayList;
@@ -44,106 +43,109 @@ import org.apache.isis.viewer.scimpi.dis
 import org.apache.isis.viewer.scimpi.dispatcher.view.form.HtmlFormBuilder;
 import org.apache.isis.viewer.scimpi.dispatcher.view.form.InputField;
 
-
 public class EditObject extends AbstractElementProcessor {
 
     @Override
-    public void process(Request request) {
-        RequestContext context = request.getContext();
+    public void process(final Request request) {
+        final RequestContext context = request.getContext();
 
-        String objectId = request.getOptionalProperty(OBJECT);
-        String forwardEditedTo = request.getOptionalProperty(VIEW);
-        String forwardErrorTo = request.getOptionalProperty(ERRORS);
-        boolean hideNonEditableFields = request.isRequested(HIDE_UNEDITABLE, false);
-        boolean showIcon = request.isRequested(SHOW_ICON, true);
+        final String objectId = request.getOptionalProperty(OBJECT);
+        final String forwardEditedTo = request.getOptionalProperty(VIEW);
+        final String forwardErrorTo = request.getOptionalProperty(ERRORS);
+        final boolean hideNonEditableFields = request.isRequested(HIDE_UNEDITABLE, false);
+        final boolean showIcon = request.isRequested(SHOW_ICON, true);
         String buttonTitle = request.getOptionalProperty(BUTTON_TITLE);
         String formTitle = request.getOptionalProperty(FORM_TITLE);
-        String formId = request.getOptionalProperty(FORM_ID, request.nextFormId());
-        String variable = request.getOptionalProperty(RESULT_NAME);
-        String resultOverride = request.getOptionalProperty(RESULT_OVERRIDE);
-        String scope = request.getOptionalProperty(SCOPE);
-        String className = request.getOptionalProperty(CLASS, "edit full");
-        String id = request.getOptionalProperty(ID);
-        String completionMessage = request.getOptionalProperty(MESSAGE);
-
+        final String formId = request.getOptionalProperty(FORM_ID, request.nextFormId());
+        final String variable = request.getOptionalProperty(RESULT_NAME);
+        final String resultOverride = request.getOptionalProperty(RESULT_OVERRIDE);
+        final String scope = request.getOptionalProperty(SCOPE);
+        final String className = request.getOptionalProperty(CLASS, "edit full");
+        final String id = request.getOptionalProperty(ID);
+        final String completionMessage = request.getOptionalProperty(MESSAGE);
 
         final ObjectAdapter object = context.getMappedObjectOrResult(objectId);
-        String actualObjectId = context.mapObject(object, Scope.INTERACTION);
-        String version = context.mapVersion(object);
+        final String actualObjectId = context.mapObject(object, Scope.INTERACTION);
+        final String version = context.mapVersion(object);
 
         final FormState entryState = (FormState) context.getVariable(ENTRY_FIELDS);
 
         final ObjectSpecification specification = object.getSpecification();
-        FormFieldBlock containedBlock = new FormFieldBlock() {
+        final FormFieldBlock containedBlock = new FormFieldBlock() {
             @Override
-            public boolean isVisible(String name) {
-                ObjectAssociation fld = specification.getAssociation(name);
-                boolean isVisible = fld.isVisible(IsisContext.getAuthenticationSession(), object).isAllowed();
-                boolean isUseable = fld.isUsable(IsisContext.getAuthenticationSession(), object).isAllowed();
+            public boolean isVisible(final String name) {
+                final ObjectAssociation fld = specification.getAssociation(name);
+                final boolean isVisible = fld.isVisible(IsisContext.getAuthenticationSession(), object).isAllowed();
+                final boolean isUseable = fld.isUsable(IsisContext.getAuthenticationSession(), object).isAllowed();
                 return isVisible && isUseable;
             }
-            
-            public ObjectAdapter getCurrent(String name) {
+
+            @Override
+            public ObjectAdapter getCurrent(final String name) {
                 ObjectAdapter value = null;
                 if (entryState != null) {
-                    FieldEditState field2 = entryState.getField(name);
+                    final FieldEditState field2 = entryState.getField(name);
                     value = field2.getValue();
                 }
                 if (value == null) {
-                    ObjectAssociation fld = specification.getAssociation(name);
+                    final ObjectAssociation fld = specification.getAssociation(name);
                     value = fld.get(object);
                 }
                 return value;
             }
-            
-            public boolean isNullable(String name) {
-                ObjectAssociation fld = specification.getAssociation(name);
+
+            @Override
+            public boolean isNullable(final String name) {
+                final ObjectAssociation fld = specification.getAssociation(name);
                 return !fld.isMandatory();
             }
         };
-        
+
         request.setBlockContent(containedBlock);
         request.processUtilCloseTag();
-        
-        AuthenticationSession session = IsisContext.getAuthenticationSession();
-        List<ObjectAssociation> viewFields = specification.getAssociations(ObjectAssociationFilters.dynamicallyVisible(session, object));
+
+        final AuthenticationSession session = IsisContext.getAuthenticationSession();
+        List<ObjectAssociation> viewFields =
+            specification.getAssociations(ObjectAssociationFilters.dynamicallyVisible(session, object));
         viewFields = containedBlock.includedFields(viewFields);
-        InputField[] formFields = createFields(viewFields);
-        
+        final InputField[] formFields = createFields(viewFields);
+
         initializeFields(context, object, formFields, entryState, !hideNonEditableFields);
         setDefaults(context, object, formFields, entryState, showIcon);
-        
+
         copyFieldContent(context, object, formFields, showIcon);
         overrideWithHtml(context, containedBlock, formFields);
         String errors = null;
         if (entryState != null && entryState.isForForm(formId)) {
             copyEntryState(context, object, formFields, entryState);
-            errors = entryState.getError(); 
+            errors = entryState.getError();
         }
 
-        String errorView = context.fullFilePath(forwardErrorTo == null ? context.getResourceFile() : forwardErrorTo);
-        List<HiddenInputField> hiddenFields = new ArrayList<HiddenInputField>();
+        final String errorView =
+            context.fullFilePath(forwardErrorTo == null ? context.getResourceFile() : forwardErrorTo);
+        final List<HiddenInputField> hiddenFields = new ArrayList<HiddenInputField>();
         hiddenFields.add(new HiddenInputField("_" + OBJECT, actualObjectId));
         hiddenFields.add(new HiddenInputField("_" + VERSION, version));
         hiddenFields.add(new HiddenInputField("_" + FORM_ID, formId));
         hiddenFields.add(completionMessage == null ? null : new HiddenInputField("_" + MESSAGE, completionMessage));
-        hiddenFields.add(forwardEditedTo == null ? null : new HiddenInputField("_" + VIEW, context.fullFilePath(forwardEditedTo)));
+        hiddenFields.add(forwardEditedTo == null ? null : new HiddenInputField("_" + VIEW, context
+            .fullFilePath(forwardEditedTo)));
         hiddenFields.add(new HiddenInputField("_" + ERRORS, errorView));
         hiddenFields.add(variable == null ? null : new HiddenInputField("_" + RESULT_NAME, variable));
         hiddenFields.add(resultOverride == null ? null : new HiddenInputField("_" + RESULT_OVERRIDE, resultOverride));
         hiddenFields.add(scope == null ? null : new HiddenInputField("_" + SCOPE, scope));
 
         if (!object.isTransient()) {
-            // ensure all booleans are included so the pass back TRUE if set. 
-            List<ObjectAssociation> fields2 = object.getSpecification().getAssociations();
+            // ensure all booleans are included so the pass back TRUE if set.
+            final List<ObjectAssociation> fields2 = object.getSpecification().getAssociations();
             for (int i = 0; i < fields2.size(); i++) {
-                ObjectAssociation field = fields2.get(i);
+                final ObjectAssociation field = fields2.get(i);
                 if (!viewFields.contains(field) && field.getSpecification().containsFacet(BooleanValueFacet.class)) {
-                    String fieldId = field.getId();
-                    String value = getValue(context, field.get(object)); 
+                    final String fieldId = field.getId();
+                    final String value = getValue(context, field.get(object));
                     hiddenFields.add(new HiddenInputField(fieldId, value));
                 }
-            }            
+            }
         }
 
         if (formTitle == null) {
@@ -152,17 +154,18 @@ public class EditObject extends Abstract
 
         if (buttonTitle == null) {
             buttonTitle = "Save " + specification.getSingularName();
-        } else if( buttonTitle.equals("")) {
+        } else if (buttonTitle.equals("")) {
             buttonTitle = "Save";
         }
-        
-        HiddenInputField[] hiddenFieldArray = hiddenFields.toArray(new HiddenInputField[hiddenFields.size()]);
-        HtmlFormBuilder.createForm(request, EditAction.ACTION + ".app", hiddenFieldArray, formFields, className, id, formTitle, null, null, buttonTitle, errors);
+
+        final HiddenInputField[] hiddenFieldArray = hiddenFields.toArray(new HiddenInputField[hiddenFields.size()]);
+        HtmlFormBuilder.createForm(request, EditAction.ACTION + ".app", hiddenFieldArray, formFields, className, id,
+            formTitle, null, null, buttonTitle, errors);
         request.popBlockContent();
     }
 
-    private InputField[] createFields(List<ObjectAssociation> fields) {
-        InputField[] formFields = new InputField[fields.size()];
+    private InputField[] createFields(final List<ObjectAssociation> fields) {
+        final InputField[] formFields = new InputField[fields.size()];
         int length = 0;
         for (int i = 0; i < fields.size(); i++) {
             if (!fields.get(i).isOneToManyAssociation()) {
@@ -170,7 +173,7 @@ public class EditObject extends Abstract
                 length++;
             }
         }
-        InputField[] array = new InputField[length];
+        final InputField[] array = new InputField[length];
         for (int i = 0, j = 0; i < formFields.length; i++) {
             if (formFields[i] != null) {
                 array[j++] = formFields[i];
@@ -180,46 +183,45 @@ public class EditObject extends Abstract
     }
 
     // TODO duplicated in ActionForm#initializeFields
-    private void initializeFields(RequestContext context, ObjectAdapter object, InputField[] formFields, FormState entryState, boolean includeUnusableFields) {
-        for (int i = 0; i < formFields.length; i++) {
-            String fieldId = formFields[i].getName();
-            ObjectAssociation field = object.getSpecification().getAssociation(fieldId);
-            InputField formField = formFields[i];
-            
-            AuthenticationSession session = IsisContext.getAuthenticationSession();
-            Consent usable = field.isUsable(session, object);
-            ObjectAdapter[] options = field.getChoices(object);
+    private void initializeFields(final RequestContext context, final ObjectAdapter object,
+        final InputField[] formFields, final FormState entryState, final boolean includeUnusableFields) {
+        for (final InputField formField : formFields) {
+            final String fieldId = formField.getName();
+            final ObjectAssociation field = object.getSpecification().getAssociation(fieldId);
+            final AuthenticationSession session = IsisContext.getAuthenticationSession();
+            final Consent usable = field.isUsable(session, object);
+            final ObjectAdapter[] options = field.getChoices(object);
             FieldFactory.initializeField(context, object, field, options, field.isMandatory(), formField);
-            
-            boolean isEditable =  usable.isAllowed();
+
+            final boolean isEditable = usable.isAllowed();
             if (!isEditable) {
                 formField.setDescription(usable.getReason());
             }
             formField.setEditable(isEditable);
-            boolean hiddenField = field.isVisible(session, object).isVetoed();
-            boolean unusable = usable.isVetoed();
-            boolean hideAsUnusable = unusable && !includeUnusableFields;
+            final boolean hiddenField = field.isVisible(session, object).isVetoed();
+            final boolean unusable = usable.isVetoed();
+            final boolean hideAsUnusable = unusable && !includeUnusableFields;
             if (hiddenField || hideAsUnusable) {
                 formField.setHidden(true);
             }
         }
     }
 
-    private void copyFieldContent(RequestContext context, ObjectAdapter object, InputField[] formFields, boolean showIcon) {
-        for (int i = 0; i < formFields.length; i++) {
-            String fieldName = formFields[i].getName();
-            ObjectAssociation field = object.getSpecification().getAssociation(fieldName);
-            InputField inputField = formFields[i];
+    private void copyFieldContent(final RequestContext context, final ObjectAdapter object,
+        final InputField[] formFields, final boolean showIcon) {
+        for (final InputField inputField : formFields) {
+            final String fieldName = inputField.getName();
+            final ObjectAssociation field = object.getSpecification().getAssociation(fieldName);
             if (field.isVisible(IsisContext.getAuthenticationSession(), object).isAllowed()) {
                 IsisContext.getPersistenceSession().resolveField(object, field);
-                ObjectAdapter fieldValue = field.get(object);
+                final ObjectAdapter fieldValue = field.get(object);
                 if (inputField.isEditable()) {
-                    String value = getValue(context, fieldValue);
+                    final String value = getValue(context, fieldValue);
                     if (!value.equals("") || inputField.getValue() == null) {
                         inputField.setValue(value);
                     }
                 } else {
-                    String entry = getValue(context, fieldValue);
+                    final String entry = getValue(context, fieldValue);
                     inputField.setHtml(entry);
                     inputField.setType(InputField.HTML);
 
@@ -227,12 +229,13 @@ public class EditObject extends Abstract
 
                 if (field.getSpecification().getFacet(ParseableFacet.class) == null) {
                     if (fieldValue != null) {
-                        String iconSegment = showIcon ? "<img class=\"small-icon\" src=\"" + context.imagePath(field.getSpecification())
-                                                        + "\" alt=\"" + field.getSpecification().getShortIdentifier() + "\"/>" : "";
-                        String entry = iconSegment + fieldValue.titleString();
+                        final String iconSegment =
+                            showIcon ? "<img class=\"small-icon\" src=\"" + context.imagePath(field.getSpecification())
+                                + "\" alt=\"" + field.getSpecification().getShortIdentifier() + "\"/>" : "";
+                        final String entry = iconSegment + fieldValue.titleString();
                         inputField.setHtml(entry);
                     } else {
-                        String entry = "<em>none specified</em>";
+                        final String entry = "<em>none specified</em>";
                         inputField.setHtml(entry);
                     }
                 }
@@ -240,66 +243,70 @@ public class EditObject extends Abstract
         }
     }
 
-    private void setDefaults(RequestContext context, ObjectAdapter object, InputField[] formFields, FormState entryState, boolean showIcon) {
-        for (int i = 0; i < formFields.length; i++) {
-            String fieldId = formFields[i].getName();
-            ObjectAssociation field = object.getSpecification().getAssociation(fieldId);
-            ObjectAdapter defaultValue = field.getDefault(object);
+    private void setDefaults(final RequestContext context, final ObjectAdapter object, final InputField[] formFields,
+        final FormState entryState, final boolean showIcon) {
+        for (final InputField formField : formFields) {
+            final String fieldId = formField.getName();
+            final ObjectAssociation field = object.getSpecification().getAssociation(fieldId);
+            final ObjectAdapter defaultValue = field.getDefault(object);
             if (defaultValue == null) {
                 continue;
             }
 
-            String title = defaultValue.titleString();
+            final String title = defaultValue.titleString();
             if (field.getSpecification().containsFacet(ParseableFacet.class)) {
-                formFields[i].setValue(title);
+                formField.setValue(title);
             } else if (field.isOneToOneAssociation()) {
-                ObjectSpecification objectSpecification = field.getSpecification();
+                final ObjectSpecification objectSpecification = field.getSpecification();
                 if (defaultValue != null) {
-                    String iconSegment = showIcon ? "<img class=\"small-icon\" src=\"" + context.imagePath(objectSpecification) + "\" alt=\""
-                                                + objectSpecification.getShortIdentifier() + "\"/>" : "";
-                    String html = iconSegment + title;
-                    formFields[i].setHtml(html);
-                    String value = defaultValue == null ? null : context.mapObject(defaultValue, Scope.INTERACTION);
-                    formFields[i].setValue(value);
+                    final String iconSegment =
+                        showIcon ? "<img class=\"small-icon\" src=\"" + context.imagePath(objectSpecification)
+                            + "\" alt=\"" + objectSpecification.getShortIdentifier() + "\"/>" : "";
+                    final String html = iconSegment + title;
+                    formField.setHtml(html);
+                    final String value =
+                        defaultValue == null ? null : context.mapObject(defaultValue, Scope.INTERACTION);
+                    formField.setValue(value);
                 }
             }
         }
     }
 
-    private void overrideWithHtml(RequestContext context, FormFieldBlock containedBlock, InputField[] formFields) {
-        for (int i = 0; i < formFields.length; i++) {
-            String fieldId = formFields[i].getName();
+    private void overrideWithHtml(final RequestContext context, final FormFieldBlock containedBlock,
+        final InputField[] formFields) {
+        for (final InputField formField : formFields) {
+            final String fieldId = formField.getName();
             if (containedBlock.hasContent(fieldId)) {
-                String content = containedBlock.getContent(fieldId);
+                final String content = containedBlock.getContent(fieldId);
                 if (content != null) {
-                    formFields[i].setHtml(content);
-                    formFields[i].setValue(null);
-                    formFields[i].setType(InputField.HTML);
+                    formField.setHtml(content);
+                    formField.setValue(null);
+                    formField.setType(InputField.HTML);
                 }
             }
         }
     }
 
-    private void copyEntryState(RequestContext context, ObjectAdapter object, InputField[] formFields, FormState entryState) {
-        for (int i = 0; i < formFields.length; i++) {
-            String fieldId = formFields[i].getName();
-            ObjectAssociation field = object.getSpecification().getAssociation(fieldId);
-            InputField formField = formFields[i];
+    private void copyEntryState(final RequestContext context, final ObjectAdapter object,
+        final InputField[] formFields, final FormState entryState) {
+        for (final InputField formField : formFields) {
+            final String fieldId = formField.getName();
+            final ObjectAssociation field = object.getSpecification().getAssociation(fieldId);
             if (field.isVisible(IsisContext.getAuthenticationSession(), object).isAllowed() && formField.isEditable()) {
-                FieldEditState fieldState = entryState.getField(field.getId());
-                String entry = fieldState == null ? "" : fieldState.getEntry();
+                final FieldEditState fieldState = entryState.getField(field.getId());
+                final String entry = fieldState == null ? "" : fieldState.getEntry();
                 formField.setValue(entry);
-                String error =  fieldState == null ? "" : fieldState.getError();
+                final String error = fieldState == null ? "" : fieldState.getError();
                 formField.setErrorText(error);
             }
         }
     }
 
-    private String getValue(RequestContext context, ObjectAdapter field) {
+    private String getValue(final RequestContext context, final ObjectAdapter field) {
         if (field == null || field.isTransient()) {
             return "";
         }
-        ObjectSpecification specification = field.getSpecification();
+        final ObjectSpecification specification = field.getSpecification();
         if (specification.containsFacet(EnumFacet.class)) {
             return String.valueOf(field.getObject());
         } else if (specification.getFacet(ParseableFacet.class) == null) {
@@ -315,4 +322,3 @@ public class EditObject extends Abstract
     }
 
 }
-

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=1098951&r1=1098950&r2=1098951&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 Tue May  3 07:53:06 2011
@@ -17,7 +17,6 @@
  *  under the License.
  */
 
-
 package org.apache.isis.viewer.scimpi.dispatcher.view.edit;
 
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
@@ -36,49 +35,45 @@ import org.apache.isis.viewer.scimpi.dis
 import org.apache.isis.viewer.scimpi.dispatcher.view.form.InputField;
 
 public class FieldFactory {
-    
-    public static void initializeField(
-        RequestContext context,
-        ObjectAdapter object,
-        ObjectFeature param,
-        ObjectAdapter[] optionsForParameter,
-        boolean isRequired,
-        InputField field) {
+
+    public static void initializeField(final RequestContext context, final ObjectAdapter object,
+        final ObjectFeature param, final ObjectAdapter[] optionsForParameter, final boolean isRequired,
+        final InputField field) {
 
         field.setLabel(param.getName());
         field.setDescription(param.getDescription());
         if (param instanceof ObjectMember) {
             field.setHelpReference(((ObjectMember) param).getHelp());
         } else {
-            HelpFacet helpFacet = param.getFacet(HelpFacet.class);
-            String value = helpFacet.value();
+            final HelpFacet helpFacet = param.getFacet(HelpFacet.class);
+            final String value = helpFacet.value();
             field.setHelpReference(value);
         }
         field.setRequired(isRequired);
         field.setHidden(false);
-        
+
         if (param.getSpecification().getFacet(ParseableFacet.class) != null) {
             final int maxLength = param.getFacet(MaxLengthFacet.class).value();
             field.setMaxLength(maxLength);
 
-            TypicalLengthFacet typicalLengthFacet = param.getFacet(TypicalLengthFacet.class);
+            final TypicalLengthFacet typicalLengthFacet = param.getFacet(TypicalLengthFacet.class);
             if (typicalLengthFacet.isDerived() && maxLength > 0) {
                 field.setWidth(maxLength);
             } else {
                 field.setWidth(typicalLengthFacet.value());
             }
 
-            MultiLineFacet multiLineFacet = param.getFacet(MultiLineFacet.class);
+            final MultiLineFacet multiLineFacet = param.getFacet(MultiLineFacet.class);
             field.setHeight(multiLineFacet.numberOfLines());
             field.setWrapped(!multiLineFacet.preventWrapping());
 
-            ObjectSpecification spec = param.getSpecification();
+            final ObjectSpecification spec = param.getSpecification();
             if (spec.containsFacet(BooleanValueFacet.class)) {
                 field.setType(InputField.CHECKBOX);
             } else if (spec.containsFacet(PasswordValueFacet.class)) {
                 field.setType(InputField.PASSWORD);
             } else {
-                field.setType(InputField.TEXT); 
+                field.setType(InputField.TEXT);
             }
 
         } else {
@@ -86,11 +81,11 @@ public class FieldFactory {
         }
 
         if (optionsForParameter != null) {
-            int noOptions = optionsForParameter.length;
-            String[] optionValues = new String[noOptions];
-            String[] optionTitles = new String[noOptions];
+            final int noOptions = optionsForParameter.length;
+            final String[] optionValues = new String[noOptions];
+            final String[] optionTitles = new String[noOptions];
             for (int j = 0; j < optionsForParameter.length; j++) {
-                int i = j; // + (field.isRequired() ? 0 : 1);
+                final int i = j; // + (field.isRequired() ? 0 : 1);
                 optionValues[i] = getValue(context, optionsForParameter[j]);
                 optionTitles[i] = optionsForParameter[j].titleString();
             }
@@ -98,7 +93,7 @@ public class FieldFactory {
         }
     }
 
-    private static String getValue(RequestContext context, ObjectAdapter field) {
+    private static String getValue(final RequestContext context, final ObjectAdapter field) {
         if (field == null) {
             return "";
         }
@@ -109,4 +104,3 @@ public class FieldFactory {
         }
     }
 }
-

Modified: incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/FormEntry.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/FormEntry.java?rev=1098951&r1=1098950&r2=1098951&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/FormEntry.java (original)
+++ incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/FormEntry.java Tue May  3 07:53:06 2011
@@ -17,29 +17,30 @@
  *  under the License.
  */
 
-
 package org.apache.isis.viewer.scimpi.dispatcher.view.edit;
 
 import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
 import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
 
-
 public class FormEntry extends AbstractElementProcessor {
 
-    public void process(Request request) {
-        FormFieldBlock block = (FormFieldBlock) request.getBlockContent();
-        String field = request.getRequiredProperty(FIELD);
-        String value = request.getRequiredProperty(VALUE);
-        boolean isHidden =  request.isRequested(HIDDEN, true);
+    @Override
+    public void process(final Request request) {
+        final FormFieldBlock block = (FormFieldBlock) request.getBlockContent();
+        final String field = request.getRequiredProperty(FIELD);
+        final String value = request.getRequiredProperty(VALUE);
+        final boolean isHidden = request.isRequested(HIDDEN, true);
         block.exclude(field);
         // TODO this is replaced because the field is marked as hidden!
-        String content = "reference <input type=\"" + (isHidden ? "hidden" : "text") + "\" disabled=\"disabled\" name=\"" + field + "\" value=\"" + value + "\" />";
+        final String content =
+            "reference <input type=\"" + (isHidden ? "hidden" : "text") + "\" disabled=\"disabled\" name=\"" + field
+                + "\" value=\"" + value + "\" />";
         block.replaceContent(field, content);
     }
 
+    @Override
     public String getName() {
         return "form-entry";
     }
 
 }
-

Modified: incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/FormField.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/FormField.java?rev=1098951&r1=1098950&r2=1098951&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/FormField.java (original)
+++ incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/FormField.java Tue May  3 07:53:06 2011
@@ -17,29 +17,28 @@
  *  under the License.
  */
 
-
 package org.apache.isis.viewer.scimpi.dispatcher.view.edit;
 
 import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
 import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
 
-
 public class FormField extends AbstractElementProcessor {
 
-    public void process(Request request) {
-        FormFieldBlock block = (FormFieldBlock) request.getBlockContent();
-        String field = request.getRequiredProperty(FIELD);
+    @Override
+    public void process(final Request request) {
+        final FormFieldBlock block = (FormFieldBlock) request.getBlockContent();
+        final String field = request.getRequiredProperty(FIELD);
         if (block.isVisible(field)) {
             request.pushNewBuffer();
             request.processUtilCloseTag();
-            String content = request.popBuffer();
+            final String content = request.popBuffer();
             block.replaceContent(field, content);
         }
     }
 
+    @Override
     public String getName() {
         return "form-field";
     }
 
 }
-

Modified: incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/FormFieldBlock.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/FormFieldBlock.java?rev=1098951&r1=1098950&r2=1098951&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/FormFieldBlock.java (original)
+++ incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/FormFieldBlock.java Tue May  3 07:53:06 2011
@@ -17,7 +17,6 @@
  *  under the License.
  */
 
-
 package org.apache.isis.viewer.scimpi.dispatcher.view.edit;
 
 import java.util.HashMap;
@@ -28,45 +27,42 @@ import org.apache.isis.viewer.scimpi.dis
 import org.apache.isis.viewer.scimpi.dispatcher.view.form.InputField;
 
 public class FormFieldBlock extends InclusionList {
-    private Map<String, String> content = new HashMap<String, String>();
-    private Map<String, String> values = new HashMap<String, String>();
+    private final Map<String, String> content = new HashMap<String, String>();
+    private final Map<String, String> values = new HashMap<String, String>();
 
-    public void replaceContent(String field, String htmlString) {
+    public void replaceContent(final String field, final String htmlString) {
         content.put(field, htmlString);
     }
 
-    public boolean hasContent(String name) {
+    public boolean hasContent(final String name) {
         return content.containsKey(name);
     }
 
-    public String getContent(String name) {
+    public String getContent(final String name) {
         return content.get(name);
     }
 
-    public boolean isVisible(String name) {
+    public boolean isVisible(final String name) {
         return true;
     }
-    
-    public boolean isNullable(String name) {
+
+    public boolean isNullable(final String name) {
         return true;
     }
-    
-    public ObjectAdapter getCurrent(String name) {
+
+    public ObjectAdapter getCurrent(final String name) {
         return null;
     }
 
-    public void value(String field, String value) {
+    public void value(final String field, final String value) {
         values.put(field, value);
     }
-    
-    public void setUpValues(InputField[] inputFields) {
-        for (int i = 0; i < inputFields.length; i++) {
-            String name = inputFields[i].getName();
-            inputFields[i].setValue(values.get(name));
+
+    public void setUpValues(final InputField[] inputFields) {
+        for (final InputField inputField : inputFields) {
+            final String name = inputField.getName();
+            inputField.setValue(values.get(name));
         }
     }
 
-    
 }
-
-

Modified: incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/HiddenField.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/HiddenField.java?rev=1098951&r1=1098950&r2=1098951&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/HiddenField.java (original)
+++ incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/HiddenField.java Tue May  3 07:53:06 2011
@@ -17,7 +17,6 @@
  *  under the License.
  */
 
-
 package org.apache.isis.viewer.scimpi.dispatcher.view.edit;
 
 import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
@@ -25,26 +24,25 @@ import org.apache.isis.viewer.scimpi.dis
 import org.apache.isis.viewer.scimpi.dispatcher.TagOrderException;
 import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
 
-
 public class HiddenField extends AbstractElementProcessor {
 
-    public void process(Request request) {
-        BlockContent blockContent = request.getBlockContent();
+    @Override
+    public void process(final Request request) {
+        final BlockContent blockContent = request.getBlockContent();
         if (!(blockContent instanceof FormFieldBlock)) {
             throw new TagOrderException(request);
         }
 
-        String field = request.getOptionalProperty("name");
-        String value = request.getRequiredProperty("value");
-        FormFieldBlock block = (FormFieldBlock) blockContent;
+        final String field = request.getOptionalProperty("name");
+        final String value = request.getRequiredProperty("value");
+        final FormFieldBlock block = (FormFieldBlock) blockContent;
         block.value(field, value);
         block.exclude(field);
     }
-    
+
+    @Override
     public String getName() {
         return "hidden-field";
     }
 
 }
-
-

Modified: incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/RadioListField.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/RadioListField.java?rev=1098951&r1=1098950&r2=1098951&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/RadioListField.java (original)
+++ incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/RadioListField.java Tue May  3 07:53:06 2011
@@ -17,7 +17,6 @@
  *  under the License.
  */
 
-
 package org.apache.isis.viewer.scimpi.dispatcher.view.edit;
 
 import java.util.Iterator;
@@ -29,44 +28,44 @@ import org.apache.isis.viewer.scimpi.dis
 import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext.Scope;
 import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
 
-
 public class RadioListField extends AbstractElementProcessor {
 
-    public void process(Request request) {
-        FormFieldBlock block = (FormFieldBlock) request.getBlockContent();
-        String field = request.getRequiredProperty(FIELD);
+    @Override
+    public void process(final Request request) {
+        final FormFieldBlock block = (FormFieldBlock) request.getBlockContent();
+        final String field = request.getRequiredProperty(FIELD);
         if (block.isVisible(field)) {
-            String id = request.getRequiredProperty(COLLECTION);
-            String exclude = request.getOptionalProperty("exclude");
+            final String id = request.getRequiredProperty(COLLECTION);
+            final String exclude = request.getOptionalProperty("exclude");
 
-            ObjectAdapter collection = request.getContext().getMappedObjectOrResult(id);
+            final ObjectAdapter collection = request.getContext().getMappedObjectOrResult(id);
 
-            RequestContext context = request.getContext();
-            CollectionFacet facet = (CollectionFacet) collection.getSpecification().getFacet(CollectionFacet.class);
-            Iterator<ObjectAdapter> iterator = facet.iterator(collection);
+            final RequestContext context = request.getContext();
+            final CollectionFacet facet = collection.getSpecification().getFacet(CollectionFacet.class);
+            final Iterator<ObjectAdapter> iterator = facet.iterator(collection);
 
-            StringBuffer buffer = new StringBuffer();
+            final StringBuffer buffer = new StringBuffer();
 
             while (iterator.hasNext()) {
-                ObjectAdapter element = iterator.next();
-                Scope scope = Scope.INTERACTION;
-                String elementId = context.mapObject(element, scope);
+                final ObjectAdapter element = iterator.next();
+                final Scope scope = Scope.INTERACTION;
+                final String elementId = context.mapObject(element, scope);
                 if (exclude != null && context.getMappedObject(exclude) == element) {
                     continue;
                 }
-                String title = element.titleString();
-                String checked = "";
-                buffer.append("<input type=\"radio\" name=\"" + field + "\" value=\"" + elementId + "\"" + checked + " />" + title
-                        + "</input><br/>\n");
+                final String title = element.titleString();
+                final String checked = "";
+                buffer.append("<input type=\"radio\" name=\"" + field + "\" value=\"" + elementId + "\"" + checked
+                    + " />" + title + "</input><br/>\n");
             }
 
             block.replaceContent(field, buffer.toString());
         }
     }
 
+    @Override
     public String getName() {
         return "radio-list";
     }
 
 }
-

Modified: incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/Selector.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/Selector.java?rev=1098951&r1=1098950&r2=1098951&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/Selector.java (original)
+++ incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/Selector.java Tue May  3 07:53:06 2011
@@ -33,39 +33,42 @@ import org.apache.isis.viewer.scimpi.dis
 import org.apache.isis.viewer.scimpi.dispatcher.view.action.ActionForm;
 import org.apache.isis.viewer.scimpi.dispatcher.view.action.CreateFormParameter;
 
-
 public class Selector extends AbstractElementProcessor {
 
-    public void process(Request request) {
-        FormFieldBlock block = (FormFieldBlock) request.getBlockContent();
-        String field = request.getRequiredProperty(FIELD);
+    @Override
+    public void process(final Request request) {
+        final FormFieldBlock block = (FormFieldBlock) request.getBlockContent();
+        final String field = request.getRequiredProperty(FIELD);
         if (block.isVisible(field)) {
             processElement(request, block, field);
         }
         request.skipUntilClose();
     }
 
-    private void processElement(Request request, FormFieldBlock block, String field) {
-        String type = request.getOptionalProperty(TYPE, "dropdown");
+    private void processElement(final Request request, final FormFieldBlock block, final String field) {
+        final String type = request.getOptionalProperty(TYPE, "dropdown");
         if (!request.isPropertySpecified(METHOD) && request.isPropertySpecified(COLLECTION)) {
-            String id = request.getRequiredProperty(COLLECTION, Request.NO_VARIABLE_CHECKING);
-            String selector = showSelectionList(request, id, block.getCurrent(field), block.isNullable(field), type);
+            final String id = request.getRequiredProperty(COLLECTION, Request.NO_VARIABLE_CHECKING);
+            final String selector =
+                showSelectionList(request, id, block.getCurrent(field), block.isNullable(field), type);
             block.replaceContent(field, selector);
         } else {
-            String objectId = request.getOptionalProperty(OBJECT);
-            String methodName = request.getRequiredProperty(METHOD);
-            ObjectAdapter object = MethodsUtils.findObject(request.getContext(), objectId);
-            ObjectAction action = MethodsUtils.findAction(object, methodName);
+            final String objectId = request.getOptionalProperty(OBJECT);
+            final String methodName = request.getRequiredProperty(METHOD);
+            final ObjectAdapter object = MethodsUtils.findObject(request.getContext(), objectId);
+            final ObjectAction action = MethodsUtils.findAction(object, methodName);
             if (action.getParameterCount() == 0) {
-                ObjectAdapter collection = action.execute(object, new ObjectAdapter[0]);
-                String selector = showSelectionList(request, collection, block.getCurrent(field), block.isNullable(field), type);
+                final ObjectAdapter collection = action.execute(object, new ObjectAdapter[0]);
+                final String selector =
+                    showSelectionList(request, collection, block.getCurrent(field), block.isNullable(field), type);
                 block.replaceContent(field, selector);
             } else {
-                String id = "selector_options";
-                String id2 = (String) request.getContext().getVariable(id);
-                String selector = showSelectionList(request, id2, block.getCurrent(field), block.isNullable(field), type);
+                final String id = "selector_options";
+                final String id2 = (String) request.getContext().getVariable(id);
+                final String selector =
+                    showSelectionList(request, id2, block.getCurrent(field), block.isNullable(field), type);
 
-                CreateFormParameter parameters = new CreateFormParameter();
+                final CreateFormParameter parameters = new CreateFormParameter();
                 parameters.objectId = objectId;
                 parameters.methodName = methodName;
                 parameters.buttonTitle = request.getOptionalProperty(BUTTON_TITLE, "Search");
@@ -87,25 +90,27 @@ public class Selector extends AbstractEl
         }
     }
 
-    private String showSelectionList(Request request, String collectionId, ObjectAdapter selectedItem, boolean allowNotSet, String type) {
+    private String showSelectionList(final Request request, final String collectionId,
+        final ObjectAdapter selectedItem, final boolean allowNotSet, final String type) {
         if (collectionId != null && !collectionId.equals("")) {
-            ObjectAdapter collection = request.getContext().getMappedObjectOrResult(collectionId);
+            final ObjectAdapter collection = request.getContext().getMappedObjectOrResult(collectionId);
             return showSelectionList(request, collection, selectedItem, allowNotSet, type);
         } else {
             return null;
         }
     }
 
-    private String showSelectionList(Request request, ObjectAdapter collection, ObjectAdapter selectedItem, boolean allowNotSet, String type) {
-        String field = request.getRequiredProperty(FIELD);
-        CollectionFacet facet = (CollectionFacet) collection.getSpecification().getFacet(CollectionFacet.class);
-        
+    private String showSelectionList(final Request request, final ObjectAdapter collection,
+        final ObjectAdapter selectedItem, final boolean allowNotSet, final String type) {
+        final String field = request.getRequiredProperty(FIELD);
+        final CollectionFacet facet = collection.getSpecification().getFacet(CollectionFacet.class);
+
         if (facet.size(collection) == 1 && !allowNotSet) {
             return onlyItem(request, field, collection, facet);
         } else if (type.equals("radio")) {
             return radioButtonList(request, field, allowNotSet, collection, selectedItem, facet);
         } else if (type.equals("list")) {
-            String size = request.getOptionalProperty("size", "5");
+            final String size = request.getOptionalProperty("size", "5");
             return dropdownList(request, field, allowNotSet, collection, selectedItem, size, facet);
         } else if (type.equals("dropdown")) {
             return dropdownList(request, field, allowNotSet, collection, selectedItem, null, facet);
@@ -114,70 +119,61 @@ public class Selector extends AbstractEl
         }
     }
 
-    private String onlyItem(Request request, String field, ObjectAdapter collection, CollectionFacet facet) {
-        RequestContext context = request.getContext();
-        Iterator<ObjectAdapter> iterator = facet.iterator(collection);
-        StringBuffer buffer = new StringBuffer();
-        ObjectAdapter element = iterator.next();
-        String elementId = context.mapObject(element, Scope.INTERACTION);
+    private String onlyItem(final Request request, final String field, final ObjectAdapter collection,
+        final CollectionFacet facet) {
+        final RequestContext context = request.getContext();
+        final Iterator<ObjectAdapter> iterator = facet.iterator(collection);
+        final StringBuffer buffer = new StringBuffer();
+        final ObjectAdapter element = iterator.next();
+        final String elementId = context.mapObject(element, Scope.INTERACTION);
         buffer.append("<img class=\"small-icon\" src=\"" + request.getContext().imagePath(element) + "\" alt=\""
-                + element.getSpecification().getShortIdentifier() + "\"/>" + element.titleString() + "\n");
+            + element.getSpecification().getShortIdentifier() + "\"/>" + element.titleString() + "\n");
         buffer.append("<input type=\"hidden\" name=\"" + field + "\" value=\"" + elementId + "\" />\n");
         return buffer.toString();
     }
 
-    private String radioButtonList(
-            Request request,
-            String field,
-            boolean allowNotSet,
-            ObjectAdapter collection,
-            ObjectAdapter selectedItem,
-            CollectionFacet facet) {
-        RequestContext context = request.getContext();
-        Iterator<ObjectAdapter> iterator = facet.iterator(collection);
-        StringBuffer buffer = new StringBuffer();
+    private String radioButtonList(final Request request, final String field, final boolean allowNotSet,
+        final ObjectAdapter collection, final ObjectAdapter selectedItem, final CollectionFacet facet) {
+        final RequestContext context = request.getContext();
+        final Iterator<ObjectAdapter> iterator = facet.iterator(collection);
+        final StringBuffer buffer = new StringBuffer();
         if (allowNotSet) {
             buffer.append("<input type=\"radio\" name=\"" + field + "\" value=\"null\"></input><br/>\n");
         }
         while (iterator.hasNext()) {
-            ObjectAdapter element = iterator.next();
-            String elementId = context.mapObject(element, Scope.INTERACTION);
-            String title = element.titleString();
-            String checked = element == selectedItem ? "checked=\"checked\"" : "";
-            buffer.append("<input type=\"radio\" name=\"" + field + "\" value=\"" + elementId + "\"" + checked + ">" + title
-                    + "</input><br/>\n");
+            final ObjectAdapter element = iterator.next();
+            final String elementId = context.mapObject(element, Scope.INTERACTION);
+            final String title = element.titleString();
+            final String checked = element == selectedItem ? "checked=\"checked\"" : "";
+            buffer.append("<input type=\"radio\" name=\"" + field + "\" value=\"" + elementId + "\"" + checked + ">"
+                + title + "</input><br/>\n");
         }
 
         return buffer.toString();
     }
 
-    private String dropdownList(
-            Request request,
-            String field,
-            boolean allowNotSet,
-            ObjectAdapter collection,
-            ObjectAdapter selectedItem,
-            String size,
-            CollectionFacet facet) {
-        RequestContext context = request.getContext();
-        Iterator<ObjectAdapter> iterator = facet.iterator(collection);
-        StringBuffer buffer = new StringBuffer();
+    private String dropdownList(final Request request, final String field, final boolean allowNotSet,
+        final ObjectAdapter collection, final ObjectAdapter selectedItem, String size, final CollectionFacet facet) {
+        final RequestContext context = request.getContext();
+        final Iterator<ObjectAdapter> iterator = facet.iterator(collection);
+        final StringBuffer buffer = new StringBuffer();
         size = size == null ? "" : " size =\"" + size + "\"";
         buffer.append("<select name=\"" + field + "\"" + size + " >\n");
         if (allowNotSet) {
             buffer.append("  <option value=\"null\"></option>\n");
         }
         while (iterator.hasNext()) {
-            ObjectAdapter element = iterator.next();
-            String elementId = context.mapObject(element, Scope.INTERACTION);
-            String title = element.titleString();
-            String checked = element == selectedItem ? "selected=\"selected\"" : "";
+            final ObjectAdapter element = iterator.next();
+            final String elementId = context.mapObject(element, Scope.INTERACTION);
+            final String title = element.titleString();
+            final String checked = element == selectedItem ? "selected=\"selected\"" : "";
             buffer.append("  <option value=\"" + elementId + "\"" + checked + ">" + title + "</option>\n");
         }
         buffer.append("</select>\n");
         return buffer.toString();
     }
 
+    @Override
     public String getName() {
         return "selector";
     }

Modified: incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/ExcludeField.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/ExcludeField.java?rev=1098951&r1=1098950&r2=1098951&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/ExcludeField.java (original)
+++ incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/ExcludeField.java Tue May  3 07:53:06 2011
@@ -17,25 +17,23 @@
  *  under the License.
  */
 
-
 package org.apache.isis.viewer.scimpi.dispatcher.view.field;
 
 import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
 import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
 
-
 public class ExcludeField extends AbstractElementProcessor {
 
-    public void process(Request request) {
-        String field = request.getOptionalProperty(NAME);
-        InclusionList block = (InclusionList) request.getBlockContent();
+    @Override
+    public void process(final Request request) {
+        final String field = request.getOptionalProperty(NAME);
+        final InclusionList block = (InclusionList) request.getBlockContent();
         block.exclude(field);
     }
-    
+
+    @Override
     public String getName() {
         return "exclude";
     }
 
 }
-
-

Modified: incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/IncludeField.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/IncludeField.java?rev=1098951&r1=1098950&r2=1098951&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/IncludeField.java (original)
+++ incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/IncludeField.java Tue May  3 07:53:06 2011
@@ -17,25 +17,23 @@
  *  under the License.
  */
 
-
 package org.apache.isis.viewer.scimpi.dispatcher.view.field;
 
 import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
 import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
 
-
 public class IncludeField extends AbstractElementProcessor {
 
-    public void process(Request request) {
-        String field = request.getOptionalProperty(NAME);
-        InclusionList block = (InclusionList) request.getBlockContent();
+    @Override
+    public void process(final Request request) {
+        final String field = request.getOptionalProperty(NAME);
+        final InclusionList block = (InclusionList) request.getBlockContent();
         block.include(field);
     }
-    
+
+    @Override
     public String getName() {
         return "include";
     }
 
 }
-
-

Modified: incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/InclusionList.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/InclusionList.java?rev=1098951&r1=1098950&r2=1098951&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/InclusionList.java (original)
+++ incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/InclusionList.java Tue May  3 07:53:06 2011
@@ -17,7 +17,6 @@
  *  under the License.
  */
 
-
 package org.apache.isis.viewer.scimpi.dispatcher.view.field;
 
 import java.util.HashSet;
@@ -31,31 +30,30 @@ import org.apache.isis.viewer.scimpi.dis
 
 import com.google.common.collect.Lists;
 
-
 public class InclusionList implements BlockContent {
-    private Set<String> includedList = new HashSet<String>();
-    private Set<String> excludedList = new HashSet<String>();
+    private final Set<String> includedList = new HashSet<String>();
+    private final Set<String> excludedList = new HashSet<String>();
 
-    private boolean inIncludedList(String fieldName) {
+    private boolean inIncludedList(final String fieldName) {
         return includedList.size() == 0 || includedList.contains(fieldName) || includedList.contains("all");
     }
 
-    private boolean inExcludedList(String fieldName) {
+    private boolean inExcludedList(final String fieldName) {
         return excludedList.contains(fieldName) || excludedList.contains("all");
     }
 
-    public void include(String field) {
+    public void include(final String field) {
         includedList.add(field);
     }
 
-    public void exclude(String field) {
+    public void exclude(final String field) {
         excludedList.add(field);
     }
 
-    public List<ObjectAssociation> includedFields(List<ObjectAssociation> originalFields) {
-        List<ObjectAssociation> includedFields = Lists.newArrayList();
+    public List<ObjectAssociation> includedFields(final List<ObjectAssociation> originalFields) {
+        final List<ObjectAssociation> includedFields = Lists.newArrayList();
         for (int i = 0; i < originalFields.size(); i++) {
-            String id2 = originalFields.get(i).getId();
+            final String id2 = originalFields.get(i).getId();
             if (includes(id2)) {
                 includedFields.add(originalFields.get(i));
             }
@@ -64,23 +62,23 @@ public class InclusionList implements Bl
         return includedFields;
     }
 
-    public void hideExcludedParameters(InputField[] inputFields) {
-        for (int i = 0; i < inputFields.length; i++) {
-            String id2 = inputFields[i].getName();
+    public void hideExcludedParameters(final InputField[] inputFields) {
+        for (final InputField inputField : inputFields) {
+            final String id2 = inputField.getName();
             if (!includes(id2)) {
-                inputFields[i].setHidden(true);
+                inputField.setHidden(true);
             }
         }
     }
 
-    public boolean includes(String id) {
+    public boolean includes(final String id) {
         return inIncludedList(id) && !inExcludedList(id);
     }
 
-    public List<ObjectAction> includedActions(List<ObjectAction> originalActions) {
-        List<ObjectAction> includedActions = Lists.newArrayList();
+    public List<ObjectAction> includedActions(final List<ObjectAction> originalActions) {
+        final List<ObjectAction> includedActions = Lists.newArrayList();
         for (int i = 0; i < originalActions.size(); i++) {
-            String id2 = originalActions.get(i).getId();
+            final String id2 = originalActions.get(i).getId();
             if (includes(id2)) {
                 includedActions.add(originalActions.get(i));
             }
@@ -89,4 +87,3 @@ public class InclusionList implements Bl
         return includedActions;
     }
 }
-

Modified: incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/LinkField.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/LinkField.java?rev=1098951&r1=1098950&r2=1098951&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/LinkField.java (original)
+++ incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/LinkField.java Tue May  3 07:53:06 2011
@@ -17,7 +17,6 @@
  *  under the License.
  */
 
-
 package org.apache.isis.viewer.scimpi.dispatcher.view.field;
 
 import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
@@ -26,21 +25,21 @@ import org.apache.isis.viewer.scimpi.dis
 import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext.Scope;
 import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
 
-
 public class LinkField extends AbstractElementProcessor {
 
-    public void process(Request request) {
-        String field = request.getOptionalProperty(NAME);
-        String variable = request.getOptionalProperty(REFERENCE_NAME, RequestContext.RESULT);
-        String scope = request.getOptionalProperty(SCOPE, Scope.INTERACTION.toString());
-        String forwardView = request.getOptionalProperty(VIEW, "_generic." + Dispatcher.EXTENSION);
-        LinkedFieldsBlock tag = (LinkedFieldsBlock) request.getBlockContent();
+    @Override
+    public void process(final Request request) {
+        final String field = request.getOptionalProperty(NAME);
+        final String variable = request.getOptionalProperty(REFERENCE_NAME, RequestContext.RESULT);
+        final String scope = request.getOptionalProperty(SCOPE, Scope.INTERACTION.toString());
+        final String forwardView = request.getOptionalProperty(VIEW, "_generic." + Dispatcher.EXTENSION);
+        final LinkedFieldsBlock tag = (LinkedFieldsBlock) request.getBlockContent();
         tag.link(field, variable, scope, forwardView);
     }
-    
+
+    @Override
     public String getName() {
         return "link";
     }
 
 }
-

Modified: incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/LinkedFieldsBlock.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/LinkedFieldsBlock.java?rev=1098951&r1=1098950&r2=1098951&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/LinkedFieldsBlock.java (original)
+++ incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/LinkedFieldsBlock.java Tue May  3 07:53:06 2011
@@ -17,7 +17,6 @@
  *  under the License.
  */
 
-
 package org.apache.isis.viewer.scimpi.dispatcher.view.field;
 
 import java.util.HashMap;
@@ -26,19 +25,18 @@ import java.util.Map;
 
 import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
 
-
 public class LinkedFieldsBlock extends InclusionList {
-    private Map<String, LinkedObject> linkedFields = new HashMap<String, LinkedObject>();
+    private final Map<String, LinkedObject> linkedFields = new HashMap<String, LinkedObject>();
 
-    public void link(String field, String variable, String scope, String forwardView) {
+    public void link(final String field, final String variable, final String scope, final String forwardView) {
         include(field);
         linkedFields.put(field, new LinkedObject(variable, scope, forwardView));
     }
 
-    public LinkedObject[] linkedFields(List<ObjectAssociation> fields) {
-        LinkedObject[] includedFields = new LinkedObject[fields.size()];
+    public LinkedObject[] linkedFields(final List<ObjectAssociation> fields) {
+        final LinkedObject[] includedFields = new LinkedObject[fields.size()];
         for (int i = 0; i < fields.size(); i++) {
-            String id2 = fields.get(i).getId();
+            final String id2 = fields.get(i).getId();
             if (fields.get(i).isOneToOneAssociation() && linkedFields.containsKey(id2)) {
                 includedFields[i] = linkedFields.get(id2);
             }
@@ -47,4 +45,3 @@ public class LinkedFieldsBlock extends I
     }
 
 }
-

Modified: incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/LinkedObject.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/LinkedObject.java?rev=1098951&r1=1098950&r2=1098951&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/LinkedObject.java (original)
+++ incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/field/LinkedObject.java Tue May  3 07:53:06 2011
@@ -17,25 +17,23 @@
  *  under the License.
  */
 
-
 package org.apache.isis.viewer.scimpi.dispatcher.view.field;
 
 import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext;
 import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext.Scope;
 
-
 public class LinkedObject {
     private final String variable;
     private final String scope;
     private String forwardView;
 
-    public LinkedObject(String variable, String scope, String forwardView) {
+    public LinkedObject(final String variable, final String scope, final String forwardView) {
         this.variable = variable;
         this.scope = scope;
         this.forwardView = forwardView;
     }
 
-    public LinkedObject(String forwardView) {
+    public LinkedObject(final String forwardView) {
         this.forwardView = forwardView;
         scope = Scope.INTERACTION.toString();
         variable = RequestContext.RESULT;
@@ -53,9 +51,8 @@ public class LinkedObject {
         return forwardView;
     }
 
-    public void setForwardView(String path) {
+    public void setForwardView(final String path) {
         forwardView = path;
     }
 
 }
-

Modified: incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/form/HiddenInputField.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/form/HiddenInputField.java?rev=1098951&r1=1098950&r2=1098951&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/form/HiddenInputField.java (original)
+++ incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/form/HiddenInputField.java Tue May  3 07:53:06 2011
@@ -17,16 +17,15 @@
  *  under the License.
  */
 
-
 package org.apache.isis.viewer.scimpi.dispatcher.view.form;
 
 import org.apache.commons.lang.StringEscapeUtils;
 
 public class HiddenInputField {
-    private String value;
-    private String name;
+    private final String value;
+    private final String name;
 
-    public HiddenInputField(String name, String value) {
+    public HiddenInputField(final String name, final String value) {
         this.value = value;
         this.name = name;
     }
@@ -40,4 +39,3 @@ public class HiddenInputField {
     }
 
 }
-

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=1098951&r1=1098950&r2=1098951&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 Tue May  3 07:53:06 2011
@@ -17,75 +17,65 @@
  *  under the License.
  */
 
-
 package org.apache.isis.viewer.scimpi.dispatcher.view.form;
 
 import org.apache.isis.core.commons.exceptions.UnknownTypeException;
 import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
 import org.apache.isis.viewer.scimpi.dispatcher.view.HelpLink;
 
-
 public class HtmlFormBuilder {
 
-    public static void createForm(
-            Request request,
-            String action,
-            HiddenInputField[] hiddenFields,
-            InputField[] fields,
-            String className, 
-            String id,
-            String formTitle,
-            String description,
-            String helpReference,
-            String buttonTitle,
-            String errors) {
+    public static void createForm(final Request request, final String action, final HiddenInputField[] hiddenFields,
+        final InputField[] fields, final String className, final String id, final String formTitle,
+        final String description, final String helpReference, final String buttonTitle, final String errors) {
 
         String classSegment = " class=\"" + className + (id == null ? "\"" : "\" id=\"" + id + "\"");
-        request.appendHtml("<form " + classSegment + " action=\"" + action + "\" method=\"post\" accept-charset=\"ISO-8859-1\">\n");
+        request.appendHtml("<form " + classSegment + " action=\"" + action
+            + "\" method=\"post\" accept-charset=\"ISO-8859-1\">\n");
         if (formTitle != null && formTitle.trim().length() > 0) {
             classSegment = " class=\"title\"";
-            request.appendHtml("<div" + classSegment  +">" + formTitle + "</div>\n");
+            request.appendHtml("<div" + classSegment + ">" + formTitle + "</div>\n");
         }
-        
+
         // TODO reinstate fieldsets when we can specify them
-        //request.appendHtml("<fieldset>\n");
+        // request.appendHtml("<fieldset>\n");
 
-        String cls = "errors";
+        final String cls = "errors";
         if (errors != null) {
             request.appendHtml("<div class=\"" + cls + "\">" + errors + "</div>");
         }
-        for (int i = 0; i < hiddenFields.length; i++) {
-            HiddenInputField hiddenField = hiddenFields[i];
+        for (final HiddenInputField hiddenField : hiddenFields) {
             if (hiddenField == null) {
                 continue;
             }
-            request.appendHtml("  <input type=\"hidden\" name=\"" + hiddenField.getName() + "\" value=\"" + hiddenField.getValue()
-                    + "\" />\n");
+            request.appendHtml("  <input type=\"hidden\" name=\"" + hiddenField.getName() + "\" value=\""
+                + hiddenField.getValue() + "\" />\n");
         }
         request.appendHtml(request.getContext().interactionFields());
-        for (int i = 0; i < fields.length; i++) {
-            InputField fld = fields[i];
+        for (final InputField fld : fields) {
             if (fld.isHidden()) {
                 request.appendHtml("  <input type=\"hidden\" name=\"" + fld.getName() + "\" value=\"" + fld.getValue()
-                        + "\" />\n");
+                    + "\" />\n");
             } else {
-                String errorSegment = fld.getErrorText() == null ? "" : "<span class=\"error\">" + fld.getErrorText() + "</span>";
-                String fieldSegment = createField(fld);
-                String helpSegment = HelpLink.createHelpSegment(fld.getDescription(), fld.getHelpReference());
-                String title = fld.getDescription().equals("") ? "" : " title=\"" + fld.getDescription() + "\"";
-                request.appendHtml("  <div class=\"field\"><label" + title + ">" + fld.getLabel() + ":</label>" + fieldSegment
-                        + errorSegment + helpSegment + "</div>\n");
+                final String errorSegment =
+                    fld.getErrorText() == null ? "" : "<span class=\"error\">" + fld.getErrorText() + "</span>";
+                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" + title + ">" + fld.getLabel() + ":</label>"
+                    + fieldSegment + errorSegment + helpSegment + "</div>\n");
             }
         }
-        
-        request.appendHtml("  <input class=\"button\" type=\"submit\" value=\"" + buttonTitle + "\" name=\"execute\" />\n");
+
+        request.appendHtml("  <input class=\"button\" type=\"submit\" value=\"" + buttonTitle
+            + "\" name=\"execute\" />\n");
         HelpLink.append(request, description, helpReference);
         // TODO reinstate fieldsets when we can specify them
-        //request.appendHtml("</fieldset>\n");
+        // request.appendHtml("</fieldset>\n");
         request.appendHtml("</form>\n");
     }
 
-    private static String createField(InputField field) {
+    private static String createField(final InputField field) {
         if (field.isHidden()) {
             if (field.getType() == InputField.REFERENCE) {
                 return createObjectField(field, "hidden");
@@ -93,7 +83,7 @@ public class HtmlFormBuilder {
                 return "";
             }
         } else {
-            if (field.getType() == InputField.HTML)  {
+            if (field.getType() == InputField.HTML) {
                 return field.getHtml();
             } else if (field.getOptionsText() != null) {
                 return createOptions(field);
@@ -115,76 +105,82 @@ public class HtmlFormBuilder {
         }
     }
 
-    private static String createObjectField(InputField field, String type) {
+    private static String createObjectField(final InputField field, final String type) {
         return field.getHtml();
     }
 
-    private static String createTextArea(InputField field) {
-        String columnsSegment = field.getWidth() == 0 ? "" : " cols=\"" + field.getWidth() / field.getHeight() + "\"";
-        String rowsSegment = field.getHeight() == 0 ? "" : " rows=\"" + field.getHeight() + "\"";
-        String wrapSegment = !field.isWrapped() ? "" : " wrap=\"off\"";
-        String requiredSegment = !field.isRequired() ? "" : " <span class=\"required\">*</span>";
-        String disabled = field.isEditable() ? "" : " disabled=\"disabled\"";
-        String maxLength = field.getMaxLength() == 0 ? "" : " rows=\"" + field.getMaxLength() + "\"";
-        return "<textarea name=\"" + field.getName() + "\"" + columnsSegment + rowsSegment + wrapSegment + maxLength + disabled + ">"
-                + field.getValue() + "</textarea>" + requiredSegment;
+    private static String createTextArea(final InputField field) {
+        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 disabled = field.isEditable() ? "" : " disabled=\"disabled\"";
+        final String maxLength = field.getMaxLength() == 0 ? "" : " rows=\"" + field.getMaxLength() + "\"";
+        return "<textarea name=\"" + field.getName() + "\"" + columnsSegment + rowsSegment + wrapSegment + maxLength
+            + disabled + ">" + field.getValue() + "</textarea>" + requiredSegment;
     }
 
-    private static String createPasswordField(InputField field) {
-        String extra = " autocomplete=\"off\"";
+    private static String createPasswordField(final InputField field) {
+        final String extra = " autocomplete=\"off\"";
         return createTextField(field, "password", extra);
     }
 
-    private static String createTextField(InputField field) {
+    private static String createTextField(final InputField field) {
         return createTextField(field, "text", "");
     }
-    
-    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() + "\"";
-        String maxLengthSegment = field.getMaxLength() == 0 ? "" : " maxlength=\"" + field.getMaxLength() + "\"";
-        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 + additionalAttributes + " />" + requiredSegment;
-    }
-
-    private static String createCheckbox(InputField field) {
-        String entryText = field.getValue();
-        String valueSegment = entryText != null && entryText.toLowerCase().equals("true") ? " checked=\"checked\"" : "";
-        String disabled = field.isEditable() ? "" : " disabled=\"disabled\"";
-        return "<input type=\"checkbox\" name=\"" + field.getName() + "\" value=\"true\" " + valueSegment + disabled + " />";
-    }
-
-    private static String createOptions(InputField field) {
-        StringBuffer str = new StringBuffer();
-        String disabled = field.isEditable() ? "" : " disabled=\"disabled\"";
+
+    private static String createTextField(final InputField field, final String type, final String additionalAttributes) {
+        final String value = field.getValue();
+        final String valueSegment = value == null ? "" : " value=\"" + 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 disabled = field.isEditable() ? "" : " disabled=\"disabled\"";
+        return "<input type=\"" + type + "\" name=\"" + field.getName() + "\"" + valueSegment + lengthSegment
+            + maxLengthSegment + disabled + additionalAttributes + " />" + requiredSegment;
+    }
+
+    private static String createCheckbox(final InputField field) {
+        final String entryText = field.getValue();
+        final String valueSegment =
+            entryText != null && entryText.toLowerCase().equals("true") ? " checked=\"checked\"" : "";
+        final String disabled = field.isEditable() ? "" : " disabled=\"disabled\"";
+        return "<input type=\"checkbox\" name=\"" + field.getName() + "\" value=\"true\" " + valueSegment + disabled
+            + " />";
+    }
+
+    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");
-        String[] options = field.getOptionsText();
-        String[] ids = field.getOptionValues();
-        int length = options.length;
+        final String[] options = field.getOptionsText();
+        final String[] ids = field.getOptionValues();
+        final int length = options.length;
         boolean offerOther = false;
         for (int i = 0; i < length; i++) {
-            String selectedSegment = field.getValue() == null || ids[i].equals(field.getValue()) ? " selected=\"selected\"" : "";
-            if (field.getType() == InputField.TEXT &&  options[i].equals("__other")) {
+            final String selectedSegment =
+                field.getValue() == null || ids[i].equals(field.getValue()) ? " selected=\"selected\"" : "";
+            if (field.getType() == InputField.TEXT && options[i].equals("__other")) {
                 offerOther = true;
             } else {
                 str.append("    <option value=\"" + ids[i] + "\"" + selectedSegment + ">" + options[i] + "</option>\n");
             }
         }
         if (!field.isRequired() || length == 0) {
-            String selectedSegment = field.getValue() == null || field.getValue().equals("") ? " selected=\"selected\"" : "";
+            final 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");
         }
         str.append("  </select>");
-        if (field.getType()  == InputField.TEXT) {
-            String lengthSegment = field.getWidth() == 0 ? "" : " size=\"" + field.getWidth() + "\"";
-            String hideSegment = " style=\"display: none;\" "; // TODO only hide when JS enabled
-            str.append("  <input type=\"text\" name=\"" + field.getName() + "-other\"" + hideSegment + lengthSegment + disabled + " />");
+        if (field.getType() == InputField.TEXT) {
+            final String lengthSegment = field.getWidth() == 0 ? "" : " size=\"" + field.getWidth() + "\"";
+            final String hideSegment = " style=\"display: none;\" "; // TODO only hide when JS enabled
+            str.append("  <input type=\"text\" name=\"" + field.getName() + "-other\"" + hideSegment + lengthSegment
+                + disabled + " />");
         }
         if (field.isRequired() && length == 0) {
             str.append(" <span class=\"required\">*</span>");
@@ -194,4 +190,3 @@ public class HtmlFormBuilder {
     }
 
 }
-

Modified: incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/form/InputField.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/form/InputField.java?rev=1098951&r1=1098950&r2=1098951&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/form/InputField.java (original)
+++ incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/form/InputField.java Tue May  3 07:53:06 2011
@@ -17,26 +17,24 @@
  *  under the License.
  */
 
-
 package org.apache.isis.viewer.scimpi.dispatcher.view.form;
 
 import org.apache.isis.core.commons.lang.ToString;
 
-
 public class InputField {
     public static final int REFERENCE = 1;
     public static final int TEXT = 2;
     public static final int PASSWORD = 3;
     public static final int CHECKBOX = 4;
     public static final int HTML = 5;
-    
+
     private int type;
-    
+
     private String label;
     private String description = "";
     private String helpReference;
     private String errorText;
-    private String name;
+    private final String name;
 
     private int maxLength = 0;
     private int width;
@@ -53,10 +51,10 @@ public class InputField {
     private String value;
     private String html;
 
-    public InputField(String name) {
+    public InputField(final String name) {
         this.name = name;
     }
-    
+
     public String getErrorText() {
         return errorText;
     }
@@ -68,11 +66,11 @@ public class InputField {
     public String getHelpReference() {
         return helpReference;
     }
-    
+
     public String getLabel() {
         return label;
     }
-    
+
     public String getName() {
         return name;
     }
@@ -84,7 +82,7 @@ public class InputField {
     public String getValue() {
         return value;
     }
-    
+
     public String getHtml() {
         return html;
     }
@@ -96,7 +94,7 @@ public class InputField {
     public String[] getOptionsText() {
         return optionsText;
     }
-    
+
     public String[] getOptionValues() {
         return optionValues;
     }
@@ -125,85 +123,86 @@ public class InputField {
         return type;
     }
 
-    public void setErrorText(String errorText) {
+    public void setErrorText(final String errorText) {
         this.errorText = errorText;
     }
 
-    public void setDescription(String description) {
+    public void setDescription(final String description) {
         this.description = description;
     }
-    
-    public void setHelpReference(String helpReference) {
+
+    public void setHelpReference(final String helpReference) {
         this.helpReference = helpReference;
     }
 
-    public void setLabel(String label) {
+    public void setLabel(final String label) {
         this.label = label;
     }
 
-    public void setEditable(boolean isEditable) {
+    public void setEditable(final boolean isEditable) {
         this.isEditable = isEditable;
         isRequired = isRequired && isEditable;
     }
 
-    public void setValue(String entryText) {
+    public void setValue(final String entryText) {
         this.value = entryText;
     }
-    
-    public void setHtml(String html) {
+
+    public void setHtml(final String html) {
         this.html = html;
     }
 
-    public void setHidden(boolean isHidden) {
+    public void setHidden(final boolean isHidden) {
         this.isHidden = isHidden;
     }
 
-    public void setWidth(int width) {
+    public void setWidth(final int width) {
         this.width = width;
     }
 
-    public void setOptions(String[] optionsText, String[] optionValues) {
+    public void setOptions(final String[] optionsText, final String[] optionValues) {
         this.optionsText = optionsText;
         this.optionValues = optionValues;
     }
-    
-    public void setHeight(int height) {
+
+    public void setHeight(final int height) {
         this.height = height;
     }
 
-    public void setWrapped(boolean isWrapped) {
+    public void setWrapped(final boolean isWrapped) {
         this.isWrapped = isWrapped;
     }
 
-    public void setRequired(boolean isRequired) {
+    public void setRequired(final boolean isRequired) {
         this.isRequired = isRequired;
     }
 
-    public void setMaxLength(int maxLength) {
+    public void setMaxLength(final int maxLength) {
         this.maxLength = maxLength;
     }
 
-    public void setType(int type) {
+    public void setType(final int type) {
         this.type = type;
     }
 
+    @Override
     public String toString() {
-        ToString str = new ToString(this);
+        final ToString str = new ToString(this);
         str.append("name", name);
         String typeName;
         switch (type) {
-        case CHECKBOX:
-            typeName = "checkbox";
-            break;
-        case REFERENCE:
-            typeName = "reference";
-            break;
-        case TEXT:
-            typeName = "text";
-            break;
-        default:
-            typeName = "unset";
-            break;
+            case CHECKBOX:
+                typeName = "checkbox";
+                break;
+            case REFERENCE:
+                typeName = "reference";
+                break;
+            case TEXT:
+                typeName = "text";
+                break;
+            default:
+                typeName = "unset";
+                break;
         }
         str.append("type", typeName);
         str.append("editable", isEditable);
@@ -213,4 +212,3 @@ public class InputField {
     }
 
 }
-



Mime
View raw message