isis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From danhayw...@apache.org
Subject svn commit: r1098951 [6/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/processor/HtmlFileParser.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/HtmlFileParser.java?rev=1098951&r1=1098950&r2=1098951&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/HtmlFileParser.java (original)
+++ incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/HtmlFileParser.java Tue May  3 07:53:06 2011
@@ -17,7 +17,6 @@
  *  under the License.
  */
 
-
 package org.apache.isis.viewer.scimpi.dispatcher.processor;
 
 import java.io.File;
@@ -26,13 +25,6 @@ import java.io.InputStream;
 import java.io.UnsupportedEncodingException;
 import java.util.Stack;
 
-import org.apache.log4j.Logger;
-import org.htmlparser.Node;
-import org.htmlparser.Remark;
-import org.htmlparser.lexer.Lexer;
-import org.htmlparser.lexer.Page;
-import org.htmlparser.nodes.TagNode;
-import org.htmlparser.util.ParserException;
 import org.apache.isis.viewer.scimpi.dispatcher.ElementProcessor;
 import org.apache.isis.viewer.scimpi.dispatcher.ScimpiException;
 import org.apache.isis.viewer.scimpi.dispatcher.action.Attributes;
@@ -40,39 +32,45 @@ import org.apache.isis.viewer.scimpi.dis
 import org.apache.isis.viewer.scimpi.dispatcher.view.HtmlSnippet;
 import org.apache.isis.viewer.scimpi.dispatcher.view.Snippet;
 import org.apache.isis.viewer.scimpi.dispatcher.view.SwfTag;
-
+import org.apache.log4j.Logger;
+import org.htmlparser.Node;
+import org.htmlparser.Remark;
+import org.htmlparser.lexer.Lexer;
+import org.htmlparser.lexer.Page;
+import org.htmlparser.nodes.TagNode;
+import org.htmlparser.util.ParserException;
 
 public class HtmlFileParser {
     private static final Logger LOG = Logger.getLogger(HtmlFileParser.class);
     private final ProcessorLookup processors;
 
-    public HtmlFileParser(ProcessorLookup processors) {
+    public HtmlFileParser(final ProcessorLookup processors) {
         this.processors = processors;
     }
 
-    public Stack<Snippet> parseHtmlFile(String filePath, RequestContext context) {
-        Stack<Snippet> tagsBeforeContent = new Stack<Snippet>();
-        Stack<Snippet> tagsAfterContent = new Stack<Snippet>();
+    public Stack<Snippet> parseHtmlFile(final String filePath, final RequestContext context) {
+        final Stack<Snippet> tagsBeforeContent = new Stack<Snippet>();
+        final Stack<Snippet> tagsAfterContent = new Stack<Snippet>();
         parseHtmlFile("/", filePath, context, tagsBeforeContent, tagsAfterContent);
         return tagsBeforeContent;
     }
 
-    
-    public void parseHtmlFile(String parentPath, String filePath, RequestContext context, Stack<Snippet> allTags, Stack<Snippet> tagsForPreviousTemplate ) {
+    public void parseHtmlFile(final String parentPath, final String filePath, final RequestContext context,
+        final Stack<Snippet> allTags, final Stack<Snippet> tagsForPreviousTemplate) {
         LOG.debug("parent/file: " + parentPath + " & " + filePath);
-        File directory = filePath.startsWith("/") ? new File(".") : new File(parentPath);
-        File loadFile = new File(directory.getParentFile(), filePath);
-        String loadPath = loadFile.getPath().replace('\\', '/');
+        final File directory = filePath.startsWith("/") ? new File(".") : new File(parentPath);
+        final File loadFile = new File(directory.getParentFile(), filePath);
+        final String loadPath = loadFile.getPath().replace('\\', '/');
         LOG.debug("loading template '" + loadPath + "'");
-        InputStream in = context.openStream(loadPath);
+        final InputStream in = context.openStream(loadPath);
 
         Page page;
         try {
             page = new Page(in, null);
-        } catch (UnsupportedEncodingException e) {
+        } catch (final UnsupportedEncodingException e) {
             throw new ScimpiException(e);
         }
-        Lexer lexer = new Lexer(page);
+        final Lexer lexer = new Lexer(page);
 
         Node node = null;
         try {
@@ -84,36 +82,37 @@ public class HtmlFileParser {
             // NOTE done like this the tags can be cached for faster processing
             while ((node = lexer.nextNode()) != null) {
                 if (node instanceof Remark) {
-                    // TODO need to pick up on comments within tags; at the moment this splits a tag into two causing a failure later
+                    // TODO need to pick up on comments within tags; at the moment this splits a tag into two causing a
+                    // failure later
                     continue;
-                    
+
                 } else if (node instanceof TagNode && ((TagNode) node).getTagName().startsWith("SWF:")) {
-                    TagNode tagNode = (TagNode) node;
-                    String tagName = tagNode.getTagName().toUpperCase();
+                    final TagNode tagNode = (TagNode) node;
+                    final String tagName = tagNode.getTagName().toUpperCase();
                     LOG.debug(tagName);
-                   
-                    // TODO remove context & request from Attributes -- the tags will be re-used across 
-                    // requests 
-                    Attributes attributes = new Attributes(tagNode, context); 
-                    int type = 0; 
-                    if (tagNode.isEndTag()) { 
-                        type = SwfTag.END; 
-                    } else { 
-                        type = tagNode.isEmptyXmlTag() ? SwfTag.EMPTY : SwfTag.START; 
-                    } 
-                    testForProcessorForTag(lexer, tagName); 
-                    lineNumbers = lineNumbering(node); 
-                    SwfTag tag = new SwfTag(tagName, attributes, type, lineNumbers, loadFile.getCanonicalPath()); 
-                    tags.push(tag); 
+
+                    // TODO remove context & request from Attributes -- the tags will be re-used across
+                    // requests
+                    final Attributes attributes = new Attributes(tagNode, context);
+                    int type = 0;
+                    if (tagNode.isEndTag()) {
+                        type = SwfTag.END;
+                    } else {
+                        type = tagNode.isEmptyXmlTag() ? SwfTag.EMPTY : SwfTag.START;
+                    }
+                    testForProcessorForTag(lexer, tagName);
+                    lineNumbers = lineNumbering(node);
+                    final SwfTag tag = new SwfTag(tagName, attributes, type, lineNumbers, loadFile.getCanonicalPath());
+                    tags.push(tag);
 
                     if (tagName.equals("SWF:IMPORT")) {
                         if (!tagNode.isEmptyXmlTag()) {
                             throw new ScimpiException("Import tag must be empty");
                         }
                         String importFile = tagNode.getAttribute("file");
-                        if (context.isDebug()) { 
-                            context.getWriter().println("<!-- " +  "import file " + importFile + " -->"); 
-                        } 
+                        if (context.isDebug()) {
+                            context.getWriter().println("<!-- " + "import file " + importFile + " -->");
+                        }
                         importFile = context.replaceVariables(importFile);
                         parseHtmlFile(loadPath, importFile, context, tags, tagsForPreviousTemplate);
                     }
@@ -127,52 +126,52 @@ public class HtmlFileParser {
                         }
                         template = tagNode.getAttribute("file");
                         template = context.replaceVariables(template);
-                        if (context.isDebug()) { 
-                            context.getWriter().println("<!-- " +  "apply template " + template + " -->"); 
-                        } 
-                        tags =  new Stack<Snippet>();
+                        if (context.isDebug()) {
+                            context.getWriter().println("<!-- " + "apply template " + template + " -->");
+                        }
+                        tags = new Stack<Snippet>();
                     }
 
                     if (tagName.equals("SWF:CONTENT")) {
                         if (!tagNode.isEmptyXmlTag()) {
                             throw new ScimpiException("Content tag must be empty");
                         }
-                        if (context.isDebug()) { 
-                            context.getWriter().println("<!-- " +  "insert content into template -->"); 
-                        } 
+                        if (context.isDebug()) {
+                            context.getWriter().println("<!-- " + "insert content into template -->");
+                        }
                         tags.addAll(tagsForPreviousTemplate);
                     }
                 } else {
-                    Snippet snippet = tags.size() == 0 ? null : tags.peek();
+                    final Snippet snippet = tags.size() == 0 ? null : tags.peek();
                     if (snippet instanceof HtmlSnippet) {
                         ((HtmlSnippet) snippet).append(node.toHtml());
                     } else {
-                        HtmlSnippet htmlSnippet = new HtmlSnippet(lineNumbers, filePath);
+                        final HtmlSnippet htmlSnippet = new HtmlSnippet(lineNumbers, filePath);
                         htmlSnippet.append(node.toHtml());
                         tags.push(htmlSnippet);
                     }
                 }
-                
+
             }
             in.close();
-            
+
             if (template != null) {
-                String filePathRoot = loadPath.startsWith("/") ? "" : "/";
+                final String filePathRoot = loadPath.startsWith("/") ? "" : "/";
                 parseHtmlFile(filePathRoot + loadPath, template, context, allTags, tags);
             }
 
-        } catch (ParserException e) {
+        } catch (final ParserException e) {
             exception(loadPath, node, e);
-            //throw new ScimpiException(e);
-        } catch (RuntimeException e) {
+            // throw new ScimpiException(e);
+        } catch (final RuntimeException e) {
             // TODO: extend to deal with other exceptions
             exception(loadPath, node, e);
-        } catch (IOException e) {
+        } catch (final IOException e) {
             throw new ScimpiException(e);
         }
     }
 
-    private void exception(String filePath, Node node, Exception e) {
+    private void exception(final String filePath, final Node node, final Exception e) {
         String lineNumbers = "";
         String element = ("" + node).toLowerCase();
         if (node instanceof TagNode) {
@@ -182,10 +181,10 @@ public class HtmlFileParser {
         throw new ScimpiException("Error processing " + element + " in " + filePath + lineNumbers, e);
     }
 
-    private String lineNumbering(Node node) {
+    private String lineNumbering(final Node node) {
         String lineNumbers;
-        int startingLine = ((TagNode) node).getStartingLineNumber() + 1;
-        int endingLine = ((TagNode) node).getStartingLineNumber() + 1;
+        final int startingLine = ((TagNode) node).getStartingLineNumber() + 1;
+        final int endingLine = ((TagNode) node).getStartingLineNumber() + 1;
         if (startingLine == endingLine) {
             lineNumbers = "" + startingLine;
         } else {
@@ -194,11 +193,10 @@ public class HtmlFileParser {
         return lineNumbers;
     }
 
-    private void testForProcessorForTag(Lexer lexer, String tagName) {
-        ElementProcessor elementProcessor = processors.getFor(tagName);
+    private void testForProcessorForTag(final Lexer lexer, final String tagName) {
+        final ElementProcessor elementProcessor = processors.getFor(tagName);
         if (elementProcessor == null) {
             throw new ScimpiException("No processor for tag " + tagName.toLowerCase());
         }
     }
 }
-

Modified: incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/PageWriter.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/PageWriter.java?rev=1098951&r1=1098950&r2=1098951&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/PageWriter.java (original)
+++ incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/PageWriter.java Tue May  3 07:53:06 2011
@@ -17,7 +17,6 @@
  *  under the License.
  */
 
-
 package org.apache.isis.viewer.scimpi.dispatcher.processor;
 
 public interface PageWriter {
@@ -25,5 +24,3 @@ public interface PageWriter {
     void appendHtml(String string);
 
 }
-
-

Modified: incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/ProcessorLookup.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/ProcessorLookup.java?rev=1098951&r1=1098950&r2=1098951&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/ProcessorLookup.java (original)
+++ incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/ProcessorLookup.java Tue May  3 07:53:06 2011
@@ -17,7 +17,6 @@
  *  under the License.
  */
 
-
 package org.apache.isis.viewer.scimpi.dispatcher.processor;
 
 import java.util.HashMap;
@@ -114,26 +113,26 @@ import org.apache.isis.viewer.scimpi.dis
 import org.apache.isis.viewer.scimpi.dispatcher.view.value.Type;
 
 public class ProcessorLookup {
-    private Map<String, ElementProcessor> swfElementProcessors = new HashMap<String, ElementProcessor>();
+    private final Map<String, ElementProcessor> swfElementProcessors = new HashMap<String, ElementProcessor>();
 
     public void init() {
         addElementProcessor(new ActionLink());
         addElementProcessor(new ActionButton());
         addElementProcessor(new ActionForm());
-        addElementProcessor(new ActionName()); 
-        addElementProcessor(new AddMessage());  
-        addElementProcessor(new AddWarning());  
+        addElementProcessor(new ActionName());
+        addElementProcessor(new AddMessage());
+        addElementProcessor(new AddWarning());
         addElementProcessor(new BlockDefine());
         addElementProcessor(new BlockUse());
         addElementProcessor(new History());
         addElementProcessor(new Collection());
-        addElementProcessor(new Commit()); 
-        addElementProcessor(new ContentTag()); 
+        addElementProcessor(new Commit());
+        addElementProcessor(new ContentTag());
         addElementProcessor(new CountElements());
         addElementProcessor(new Diagnostics());
         addElementProcessor(new DebugAccessCheck());
         addElementProcessor(new DebuggerLink());
-        addElementProcessor(new DefaultValue()); 
+        addElementProcessor(new DefaultValue());
         addElementProcessor(new EditLink());
         addElementProcessor(new EditObject());
         addElementProcessor(new ElementType());
@@ -186,7 +185,7 @@ public class ProcessorLookup {
         addElementProcessor(new TableEmpty());
         addElementProcessor(new TableRow());
         addElementProcessor(new TableHeader());
-        addElementProcessor(new TemplateTag()); 
+        addElementProcessor(new TemplateTag());
         addElementProcessor(new Title());
         addElementProcessor(new TitleString());
         addElementProcessor(new ThrowException());
@@ -196,7 +195,7 @@ public class ProcessorLookup {
         addElementProcessor(new Variable());
         addElementProcessor(new Warnings());
         addElementProcessor(new When());
-        
+
         addElementProcessor(new StartSession());
         addElementProcessor(new EndSession());
 
@@ -205,27 +204,22 @@ public class ProcessorLookup {
         addElementProcessor(new SetCookieFromField());
         addElementProcessor(new SetFieldFromCookie());
     }
-    
 
-    public void addElementProcessor(ElementProcessor action) {
+    public void addElementProcessor(final ElementProcessor action) {
         swfElementProcessors.put("SWF:" + action.getName().toUpperCase(), action);
     }
 
-    public void debug(DebugBuilder debug) {
+    public void debug(final DebugBuilder debug) {
         debug.appendTitle("Recognised tags");
-        Iterator<String> it2 = new TreeSet<String>(swfElementProcessors.keySet()).iterator();
+        final Iterator<String> it2 = new TreeSet<String>(swfElementProcessors.keySet()).iterator();
         while (it2.hasNext()) {
-            String name = it2.next();
+            final String name = it2.next();
             debug.appendln(name.toLowerCase(), swfElementProcessors.get(name));
         }
     }
 
-    public ElementProcessor getFor(String name) {
+    public ElementProcessor getFor(final String name) {
         return swfElementProcessors.get(name);
     }
 
-
-
 }
-
-

Modified: incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/Request.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/Request.java?rev=1098951&r1=1098950&r2=1098951&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/Request.java (original)
+++ incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/Request.java Tue May  3 07:53:06 2011
@@ -17,7 +17,6 @@
  *  under the License.
  */
 
-
 package org.apache.isis.viewer.scimpi.dispatcher.processor;
 
 import java.util.Stack;
@@ -32,13 +31,12 @@ import org.apache.isis.viewer.scimpi.dis
 import org.apache.isis.viewer.scimpi.dispatcher.view.SwfTag;
 import org.apache.log4j.Logger;
 
-
 public class Request implements PageWriter {
 
     public class RepeatMarker {
         private final int index;
 
-        private RepeatMarker(int index) {
+        private RepeatMarker(final int index) {
             this.index = index;
         }
 
@@ -60,7 +58,8 @@ public class Request implements PageWrit
     private int index = -1;
     private final String path;
 
-    public Request(String path, RequestContext context, Stack<Snippet> snippets, ProcessorLookup processors) {
+    public Request(final String path, final RequestContext context, final Stack<Snippet> snippets,
+        final ProcessorLookup processors) {
         this.path = path;
         this.context = context;
         this.snippets = snippets;
@@ -74,13 +73,13 @@ public class Request implements PageWrit
     public void processNextTag() {
         while (index < snippets.size() - 1) {
             index++;
-            Snippet snippet = snippets.get(index);
+            final Snippet snippet = snippets.get(index);
             if (snippet instanceof HtmlSnippet) {
                 append((HtmlSnippet) snippet);
             } else {
-                SwfTag tag = (SwfTag) snippet;
-                String name = tag.getName();
-                ElementProcessor processor = processors.getFor(name);
+                final SwfTag tag = (SwfTag) snippet;
+                final String name = tag.getName();
+                final ElementProcessor processor = processors.getFor(name);
                 process(tag, processor);
                 if (context.isAborted()) {
                     return;
@@ -89,93 +88,97 @@ public class Request implements PageWrit
         }
     }
 
-    private void append(HtmlSnippet snippet) {
+    private void append(final HtmlSnippet snippet) {
         String html = snippet.getHtml();
         try {
             if (snippet.isContainsVariable()) {
                 html = context.replaceVariables(html);
             }
             appendHtml(html);
-        } catch (TagProcessingException e) {
+        } catch (final TagProcessingException e) {
             throw e;
-        } catch (RuntimeException e) {
-            String replace = "<";
-            String withReplacement = "&lt;";
+        } catch (final RuntimeException e) {
+            final String replace = "<";
+            final String withReplacement = "&lt;";
             html = html.replaceAll(replace, withReplacement);
 
-            throw new TagProcessingException("Error while processing html block at " + snippet.errorAt() + " - " + e.getMessage(), html, e);
+            throw new TagProcessingException("Error while processing html block at " + snippet.errorAt() + " - "
+                + e.getMessage(), html, e);
         }
     }
 
-    public void appendHtml(String html) {
-        StringBuffer buffer = buffers.peek();
+    @Override
+    public void appendHtml(final String html) {
+        final StringBuffer buffer = buffers.peek();
         buffer.append(html);
     }
 
-    public void appendTruncated(String text, int truncateTo) {
+    public void appendTruncated(String text, final int truncateTo) {
         if (truncateTo > 0 && text.length() > truncateTo) {
             text = text.substring(0, truncateTo) + "...";
         }
         appendHtml(text);
-    } 
+    }
 
-    private void process(SwfTag tag, ElementProcessor processor) {
+    private void process(final SwfTag tag, final ElementProcessor processor) {
         try {
             LOG.debug("processing " + processor.getName() + " " + tag);
-            appendDebug("\n" + tag.debug()); 
-            if (tag.getType() == SwfTag.END) { 
-                throw new TagProcessingException(tag.errorAt() + " - end tag mistaken for a start tag", tag.toString()); 
-            } 
+            appendDebug("\n" + tag.debug());
+            if (tag.getType() == SwfTag.END) {
+                throw new TagProcessingException(tag.errorAt() + " - end tag mistaken for a start tag", tag.toString());
+            }
             processor.process(this);
-        } catch (TagProcessingException e) {
+        } catch (final TagProcessingException e) {
             throw e;
-        } catch (RuntimeException e) {
-            throw new TagProcessingException( "Error while processing " + tag.getName().toLowerCase() + " element at " + tag.errorAt() + " - " + e.getMessage(), tag.toString(), e); 
+        } catch (final RuntimeException e) {
+            throw new TagProcessingException("Error while processing " + tag.getName().toLowerCase() + " element at "
+                + tag.errorAt() + " - " + e.getMessage(), tag.toString(), e);
         }
     }
 
     public void processUtilCloseTag() {
-        SwfTag tag = getTag();
+        final SwfTag tag = getTag();
         if (tag.getType() == SwfTag.EMPTY) {
             return;
         }
         while (index < snippets.size() - 1) {
             index++;
-            Snippet snippet = snippets.get(index);
+            final Snippet snippet = snippets.get(index);
             if (snippet instanceof HtmlSnippet) {
-                append((HtmlSnippet)snippet);
+                append((HtmlSnippet) snippet);
             } else {
-                SwfTag nextTag = (SwfTag) snippet;
+                final SwfTag nextTag = (SwfTag) snippet;
                 if (tag.getName().equals(nextTag.getName())) {
-                    if (nextTag.getType() == SwfTag.START) {} else {
+                    if (nextTag.getType() == SwfTag.START) {
+                    } else {
                         return;
                     }
                 }
-                String name = nextTag.getName();
-                if (nextTag.getType() == SwfTag.END && !tag.getName().equals(name)) { 
-                    throw new TagProcessingException("Expected " + nextTag.getName().toLowerCase() + " tag but found " + tag.getName().toLowerCase() +
-                            " tag at " + nextTag.errorAt(), tag.toString()); 
-                } 
-                ElementProcessor processor = processors.getFor(name);
+                final String name = nextTag.getName();
+                if (nextTag.getType() == SwfTag.END && !tag.getName().equals(name)) {
+                    throw new TagProcessingException("Expected " + nextTag.getName().toLowerCase() + " tag but found "
+                        + tag.getName().toLowerCase() + " tag at " + nextTag.errorAt(), tag.toString());
+                }
+                final ElementProcessor processor = processors.getFor(name);
                 process(nextTag, processor);
             }
         }
     }
 
     public void skipUntilClose() {
-        SwfTag tag = getTag();
+        final SwfTag tag = getTag();
         if (tag.getType() == SwfTag.EMPTY) {
-            if (context.isDebug()) { 
-                appendHtml("<!-- " +  "skipped " + tag + " -->"); 
-            } 
+            if (context.isDebug()) {
+                appendHtml("<!-- " + "skipped " + tag + " -->");
+            }
             return;
         }
         int depth = 1;
         while (index < snippets.size() - 1) {
             index++;
-            Snippet snippet = snippets.get(index);
+            final Snippet snippet = snippets.get(index);
             if (snippet instanceof SwfTag) {
-                SwfTag nextTag = (SwfTag) snippet;
+                final SwfTag nextTag = (SwfTag) snippet;
                 if (tag.getName().equals(nextTag.getName())) {
                     if (nextTag.getType() == SwfTag.START) {
                         depth++;
@@ -191,14 +194,14 @@ public class Request implements PageWrit
     }
 
     public void closeEmpty() {
-        SwfTag tag = getTag();
+        final SwfTag tag = getTag();
         if (tag.getType() == SwfTag.EMPTY) {
             return;
         }
         if (index < snippets.size()) {
-            Snippet snippet = snippets.get(index);
+            final Snippet snippet = snippets.get(index);
             if (snippet instanceof SwfTag) {
-                SwfTag nextTag = (SwfTag) snippet;
+                final SwfTag nextTag = (SwfTag) snippet;
                 if (nextTag.getType() == SwfTag.EMPTY) {
                     return;
                 }
@@ -208,12 +211,12 @@ public class Request implements PageWrit
     }
 
     public void pushNewBuffer() {
-        StringBuffer buffer = new StringBuffer();
+        final StringBuffer buffer = new StringBuffer();
         buffers.push(buffer);
     }
 
     public String popBuffer() {
-        String content = buffers.pop().toString();
+        final String content = buffers.pop().toString();
         return content;
     }
 
@@ -226,7 +229,7 @@ public class Request implements PageWrit
     }
 
     // TODO rename to pushBlock()
-    public void setBlockContent(BlockContent content) {
+    public void setBlockContent(final BlockContent content) {
         blocks.add(content);
     }
 
@@ -246,21 +249,21 @@ public class Request implements PageWrit
         return String.valueOf(nextFormId++);
     }
 
-    public String getOptionalProperty(String name, String defaultValue) {
+    public String getOptionalProperty(final String name, final String defaultValue) {
         return getOptionalProperty(name, defaultValue, true);
     }
 
-    public String getOptionalProperty(String name, String defaultValue, boolean ensureVariablesExists) {
-        Attributes attributes = getTag().getAttributes();
+    public String getOptionalProperty(final String name, final String defaultValue, final boolean ensureVariablesExists) {
+        final Attributes attributes = getTag().getAttributes();
         return attributes.getOptionalProperty(name, defaultValue, ensureVariablesExists);
     }
 
-    public String getOptionalProperty(String name) {
+    public String getOptionalProperty(final String name) {
         return getOptionalProperty(name, true);
     }
 
-    public String getOptionalProperty(String name, boolean ensureVariablesExists) {
-        Attributes attributes = getTag().getAttributes();
+    public String getOptionalProperty(final String name, final boolean ensureVariablesExists) {
+        final Attributes attributes = getTag().getAttributes();
         return attributes.getOptionalProperty(name, ensureVariablesExists);
     }
 
@@ -268,41 +271,40 @@ public class Request implements PageWrit
         return getTag().getAttributes();
     }
 
-    public String getRequiredProperty(String name) {
+    public String getRequiredProperty(final String name) {
         return getRequiredProperty(name, true);
     }
 
-    public String getRequiredProperty(String name, boolean ensureVariablesExists) {
-        Attributes attributes = getTag().getAttributes();
+    public String getRequiredProperty(final String name, final boolean ensureVariablesExists) {
+        final Attributes attributes = getTag().getAttributes();
         return attributes.getRequiredProperty(name, ensureVariablesExists);
     }
 
-    public boolean isRequested(String name) {
-        Attributes attributes = getTag().getAttributes();
+    public boolean isRequested(final String name) {
+        final Attributes attributes = getTag().getAttributes();
         return attributes.isRequested(name);
     }
 
-    public boolean isRequested(String name, boolean defaultValue) {
-        Attributes attributes = getTag().getAttributes();
+    public boolean isRequested(final String name, final boolean defaultValue) {
+        final Attributes attributes = getTag().getAttributes();
         return attributes.isRequested(name, defaultValue);
     }
 
-    public boolean isPropertySet(String name) {
-        Attributes attributes = getTag().getAttributes();
+    public boolean isPropertySet(final String name) {
+        final Attributes attributes = getTag().getAttributes();
         return attributes.isPropertySet(name);
     }
 
-    public boolean isPropertySpecified(String name) {
-        Attributes attributes = getTag().getAttributes();
+    public boolean isPropertySpecified(final String name) {
+        final Attributes attributes = getTag().getAttributes();
         return attributes.isPropertySpecified(name);
     }
-    
+
     public RepeatMarker createMarker() {
         return new RepeatMarker(index);
     }
-    
-    public void appendDebug(String line) { 
-        context.appendDebugTrace(line); 
+
+    public void appendDebug(final String line) {
+        context.appendDebugTrace(line);
     }
 }
-

Modified: incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/TagProcessingException.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/TagProcessingException.java?rev=1098951&r1=1098950&r2=1098951&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/TagProcessingException.java (original)
+++ incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/TagProcessingException.java Tue May  3 07:53:06 2011
@@ -17,7 +17,6 @@
  *  under the License.
  */
 
-
 package org.apache.isis.viewer.scimpi.dispatcher.processor;
 
 import org.apache.isis.viewer.scimpi.dispatcher.ScimpiException;
@@ -30,17 +29,17 @@ public class TagProcessingException exte
         super();
     }
 
-    public TagProcessingException(String message, String context, Throwable cause) {
+    public TagProcessingException(final String message, final String context, final Throwable cause) {
         super(message, cause);
         this.context = context;
     }
 
-    public TagProcessingException(String message, String context) {
+    public TagProcessingException(final String message, final String context) {
         super(message);
         this.context = context;
     }
 
-    public TagProcessingException(Throwable cause) {
+    public TagProcessingException(final Throwable cause) {
         super(cause);
     }
 
@@ -58,5 +57,3 @@ public class TagProcessingException exte
         return super.getMessage() + "<pre>" + getContext() + "</pre>";
     }
 }
-
-

Modified: incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/util/MethodsUtils.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/util/MethodsUtils.java?rev=1098951&r1=1098950&r2=1098951&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/util/MethodsUtils.java (original)
+++ incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/util/MethodsUtils.java Tue May  3 07:53:06 2011
@@ -17,7 +17,6 @@
  *  under the License.
  */
 
-
 package org.apache.isis.viewer.scimpi.dispatcher.util;
 
 import java.util.List;
@@ -37,57 +36,50 @@ import org.apache.isis.viewer.scimpi.dis
 import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext;
 import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext.Scope;
 
-
 public class MethodsUtils {
     public static final String SERVICE_PREFIX = "service:";
 
-
-    public static Consent canRunMethod(
-            ObjectAdapter target,
-            ObjectAction action,
-            ObjectAdapter[] parameters) {
-        Consent consent = action.isProposedArgumentSetValid(target, parameters == null ? new ObjectAdapter[0] : parameters);
+    public static Consent canRunMethod(final ObjectAdapter target, final ObjectAction action,
+        final ObjectAdapter[] parameters) {
+        final Consent consent =
+            action.isProposedArgumentSetValid(target, parameters == null ? new ObjectAdapter[0] : parameters);
         return consent;
     }
 
-    public static boolean runMethod(
-            RequestContext context,
-            ObjectAction action,
-            ObjectAdapter target,
-            ObjectAdapter[] parameters,
-            String variable,
-            Scope scope) {
+    public static boolean runMethod(final RequestContext context, final ObjectAction action,
+        final ObjectAdapter target, final ObjectAdapter[] parameters, String variable, Scope scope) {
         scope = scope == null ? Scope.REQUEST : scope;
         variable = variable == null ? RequestContext.RESULT : variable;
 
-        ObjectAdapter result = action.execute(target, parameters == null ? new ObjectAdapter[0] : parameters);
+        final ObjectAdapter result = action.execute(target, parameters == null ? new ObjectAdapter[0] : parameters);
         if (result == null) {
             return false;
         } else {
-            String mappedId = context.mapObject(result, scope);
+            final String mappedId = context.mapObject(result, scope);
             context.addVariable(variable, mappedId, scope);
             // context.addVariable(variable + "_type", action.getFacet(TypeOfFacet.class), scope);
             return true;
         }
     }
 
-    public static boolean runMethod(RequestContext context, ObjectAction action, ObjectAdapter target, ObjectAdapter[] parameters) {
+    public static boolean runMethod(final RequestContext context, final ObjectAction action,
+        final ObjectAdapter target, final ObjectAdapter[] parameters) {
         return runMethod(context, action, target, parameters, null, null);
     }
 
-    public static ObjectAction findAction(ObjectAdapter object, String methodName) {
+    public static ObjectAction findAction(final ObjectAdapter object, final String methodName) {
         if (object == null) {
             throw new ScimpiException("Object not specified when looking for " + methodName);
         }
 
-        List<ObjectAction> actions = object.getSpecification().getObjectActions(ActionType.USER,
-                ActionType.EXPLORATION, ActionType.PROTOTYPE, ActionType.DEBUG);
-        ObjectAction action = findAction(actions, methodName);
-       /* if (action == null) {
-            actions = object.getSpecification().getServiceActionsFor(ObjectActionType.USER,
-                    ObjectActionType.EXPLORATION, ObjectActionType.DEBUG);
-            action = findAction(actions, methodName);
-        }*/
+        final List<ObjectAction> actions =
+            object.getSpecification().getObjectActions(ActionType.USER, ActionType.EXPLORATION, ActionType.PROTOTYPE,
+                ActionType.DEBUG);
+        final ObjectAction action = findAction(actions, methodName);
+        /*
+         * if (action == null) { actions = object.getSpecification().getServiceActionsFor(ObjectActionType.USER,
+         * ObjectActionType.EXPLORATION, ObjectActionType.DEBUG); action = findAction(actions, methodName); }
+         */
         if (action == null) {
             throw new DispatchException("Failed to find action " + methodName + " on " + object);
         }
@@ -111,18 +103,18 @@ public class MethodsUtils {
         return null;
     }
 
-    public static ObjectAdapter findObject(RequestContext context, String objectId) {
+    public static ObjectAdapter findObject(final RequestContext context, String objectId) {
         if (objectId == null) {
             objectId = context.getStringVariable(RequestContext.RESULT);
         }
 
         if (objectId != null && objectId.startsWith(SERVICE_PREFIX)) {
-            String serviceId = objectId.substring(SERVICE_PREFIX.length());
-            List<ObjectAdapter> serviceAdapters = getPersistenceSession().getServices();
-            for (ObjectAdapter serviceAdapter : serviceAdapters) {
-                Object service = serviceAdapter.getObject();
+            final String serviceId = objectId.substring(SERVICE_PREFIX.length());
+            final List<ObjectAdapter> serviceAdapters = getPersistenceSession().getServices();
+            for (final ObjectAdapter serviceAdapter : serviceAdapters) {
+                final Object service = serviceAdapter.getObject();
                 if (ServiceUtil.id(service).equals(serviceId.trim())) {
-                    ObjectAdapter adapter = getAdapterManager().getAdapterFor(service);
+                    final ObjectAdapter adapter = getAdapterManager().getAdapterFor(service);
                     return adapter;
                 }
             }
@@ -132,20 +124,21 @@ public class MethodsUtils {
         }
     }
 
-    public static boolean isVisible(ObjectAdapter object, ObjectAction action) {
+    public static boolean isVisible(final ObjectAdapter object, final ObjectAction action) {
         return action.isVisible(getAuthenticationSession(), object).isAllowed();
     }
-    
-    public static String isUsable(ObjectAdapter object, ObjectAction action) {
-        Consent usable = action.isUsable(getAuthenticationSession(), object);
-        boolean isUsable = getSession() != null && usable.isAllowed();
+
+    public static String isUsable(final ObjectAdapter object, final ObjectAction action) {
+        final Consent usable = action.isUsable(getAuthenticationSession(), object);
+        final boolean isUsable = getSession() != null && usable.isAllowed();
         return isUsable ? null : usable.getReason();
     }
-    
-    public static boolean isVisibleAndUsable(ObjectAdapter object, ObjectAction action) {
-        boolean isVisible = action.isVisible(getAuthenticationSession(), object).isAllowed();
-        boolean isUsable = getSession() != null && action.isUsable(getAuthenticationSession(), object).isAllowed();
-        boolean isVisibleAndUsable = isVisible && isUsable;
+
+    public static boolean isVisibleAndUsable(final ObjectAdapter object, final ObjectAction action) {
+        final boolean isVisible = action.isVisible(getAuthenticationSession(), object).isAllowed();
+        final boolean isUsable =
+            getSession() != null && action.isUsable(getAuthenticationSession(), object).isAllowed();
+        final boolean isVisibleAndUsable = isVisible && isUsable;
         return isVisibleAndUsable;
     }
 
@@ -166,4 +159,3 @@ public class MethodsUtils {
     }
 
 }
-

Modified: incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/HelpLink.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/HelpLink.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/HelpLink.java (original)
+++ incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/HelpLink.java Tue May  3 07:53:06 2011
@@ -22,22 +22,22 @@ import org.apache.isis.core.commons.conf
 import org.apache.isis.runtimes.dflt.runtime.system.context.IsisContext;
 import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
 
-
 public class HelpLink {
 
     private static String site;
     private static String suffix;
 
-    public static void append(Request request, String description, String helpReference) {
+    public static void append(final Request request, final String description, final String helpReference) {
         request.appendHtml(createHelpSegment(description, helpReference));
     }
 
-    public static String createHelpSegment(String description, String helpReference) {
+    public static String createHelpSegment(final String description, final String helpReference) {
         if (site == null) {
             site = IsisContext.getConfiguration().getString(ConfigurationConstants.ROOT + "scimpi.help-site", "/help/");
         }
         if (suffix == null) {
-            suffix = IsisContext.getConfiguration().getString(ConfigurationConstants.ROOT + "scimpi.help-suffix", "shtml");
+            suffix =
+                IsisContext.getConfiguration().getString(ConfigurationConstants.ROOT + "scimpi.help-suffix", "shtml");
             if (suffix == null || suffix.equals("")) {
                 suffix = "";
             } else {
@@ -48,12 +48,12 @@ public class HelpLink {
         if (helpReference == null || helpReference.equals("No help available")) {
             return "";
         } else {
-            String elementClass = "help-link";
-            String link = site + helpReference + suffix;
-            String linkText = "Help";
-            String target = "scimpi-help";
-            return "<a class=\"" + elementClass + "\" href=\"" + link + "\" target=\"" + target + "\" title=\"" + description
-                    + "\"><img src=\"/images/help.png\" alt=\"" + linkText + "\" /></a>";
+            final String elementClass = "help-link";
+            final String link = site + helpReference + suffix;
+            final String linkText = "Help";
+            final String target = "scimpi-help";
+            return "<a class=\"" + elementClass + "\" href=\"" + link + "\" target=\"" + target + "\" title=\""
+                + description + "\"><img src=\"/images/help.png\" alt=\"" + linkText + "\" /></a>";
         }
     }
 

Modified: incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/History.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/History.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/History.java (original)
+++ incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/History.java Tue May  3 07:53:06 2011
@@ -29,7 +29,6 @@ import org.apache.isis.viewer.scimpi.dis
 import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
 import org.apache.isis.viewer.scimpi.dispatcher.util.MethodsUtils;
 
-
 public class History extends AbstractElementProcessor {
 
     private static final String _HISTORY = "_history";
@@ -42,10 +41,10 @@ public class History extends AbstractEle
     static class Crumbs implements Serializable {
         private static final long serialVersionUID = 1L;
         private static final int MAXIMUM_SIZE = 10;
-        private List<Crumb> crumbs = new ArrayList<Crumb>();
+        private final List<Crumb> crumbs = new ArrayList<Crumb>();
 
-        public void add(String name, String link) {
-            for (Crumb crumb : crumbs) {
+        public void add(final String name, final String link) {
+            for (final Crumb crumb : crumbs) {
                 if (crumb.link.equals(link)) {
                     crumbs.remove(crumb);
                     crumbs.add(crumb);
@@ -53,7 +52,7 @@ public class History extends AbstractEle
                 }
             }
 
-            Crumb crumb = new Crumb();
+            final Crumb crumb = new Crumb();
             crumb.name = name;
             crumb.link = link;
             crumbs.add(crumb);
@@ -81,23 +80,25 @@ public class History extends AbstractEle
 
     }
 
+    @Override
     public String getName() {
         return "history";
     }
 
-    public void process(Request request) {
-        String action = request.getOptionalProperty("action", "display");
-        Crumbs crumbs = getCrumbs(request);
+    @Override
+    public void process(final Request request) {
+        final String action = request.getOptionalProperty("action", "display");
+        final Crumbs crumbs = getCrumbs(request);
         if (action.equals("display") && crumbs != null) {
             write(crumbs, request);
         } else if (action.equals("link")) {
-            String name = request.getRequiredProperty(NAME);
-            String link = request.getRequiredProperty(LINK);
+            final String name = request.getRequiredProperty(NAME);
+            final String link = request.getRequiredProperty(LINK);
             crumbs.add(name, link);
         } else if (action.equals("object")) {
-            String id = request.getOptionalProperty(OBJECT);
-            ObjectAdapter object =  MethodsUtils.findObject(request.getContext(), id);
-            String name = object.titleString();
+            final String id = request.getOptionalProperty(OBJECT);
+            final ObjectAdapter object = MethodsUtils.findObject(request.getContext(), id);
+            final String name = object.titleString();
             String link = request.getRequiredProperty(LINK);
             link += "?_result=" + id;
             crumbs.add(name, link);
@@ -109,7 +110,7 @@ public class History extends AbstractEle
 
     }
 
-    public void write(Crumbs crumbs, final Request request) {
+    public void write(final Crumbs crumbs, final Request request) {
         if (crumbs.isEmpty()) {
             return;
         }
@@ -117,8 +118,8 @@ public class History extends AbstractEle
         request.appendHtml("<div id=\"history\">");
         int i = 0;
         final int length = crumbs.size();
-        for (Crumb crumb : crumbs.iterator()) {
-            String link = crumb.link;
+        for (final Crumb crumb : crumbs.iterator()) {
+            final String link = crumb.link;
             if (i > 0) {
                 request.appendHtml("<span class=\"separator\"> | </span>");
             }
@@ -136,8 +137,8 @@ public class History extends AbstractEle
         request.appendHtml("</div>");
     }
 
-    private Crumbs getCrumbs(Request request) {
-        RequestContext context = request.getContext();
+    private Crumbs getCrumbs(final Request request) {
+        final RequestContext context = request.getContext();
         Crumbs crumbs = (Crumbs) context.getVariable(_HISTORY);
         if (crumbs == null) {
             crumbs = new Crumbs();
@@ -147,5 +148,3 @@ public class History extends AbstractEle
     }
 
 }
-
-

Modified: incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/HtmlSnippet.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/HtmlSnippet.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/HtmlSnippet.java (original)
+++ incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/HtmlSnippet.java Tue May  3 07:53:06 2011
@@ -17,36 +17,35 @@
  *  under the License.
  */
 
-
 package org.apache.isis.viewer.scimpi.dispatcher.view;
 
 public class HtmlSnippet implements Snippet {
-    private StringBuffer html = new StringBuffer();
+    private final StringBuffer html = new StringBuffer();
     private boolean containsVariable;
     private final String lineNumbers;
     private final String path;
 
-    public HtmlSnippet(String lineNumbers, String path) {
+    public HtmlSnippet(final String lineNumbers, final String path) {
         this.lineNumbers = lineNumbers;
         this.path = path;
     }
-    
-    public void append(String html) {
+
+    public void append(final String html) {
         this.html.append(html);
         containsVariable |= html.indexOf("${") >= 0;
     }
 
+    @Override
     public String getHtml() {
         return html.toString();
     }
-    
+
     public boolean isContainsVariable() {
         return containsVariable;
     }
-    
+
+    @Override
     public String errorAt() {
         return path + ":" + lineNumbers;
     }
 }
-
-

Modified: incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/RevisionNumber.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/RevisionNumber.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/RevisionNumber.java (original)
+++ incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/RevisionNumber.java Tue May  3 07:53:06 2011
@@ -27,18 +27,19 @@ import org.apache.isis.viewer.scimpi.dis
 import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext;
 import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
 
-
 public class RevisionNumber extends AbstractElementProcessor {
 
     private static final String MARKER = "Implementation-Build: ";
     private static final String FILE = "/META-INF/MANIFEST.MF";
     private String revision;
 
+    @Override
     public String getName() {
         return "revision-number";
     }
 
-    public void process(Request request) {
+    @Override
+    public void process(final Request request) {
         if (revision == null) {
             revision = "0000"; // default revision number
             loadRevisonNumber(request.getContext());
@@ -47,7 +48,7 @@ public class RevisionNumber extends Abst
         request.appendHtml(revision);
     }
 
-    private void loadRevisonNumber(RequestContext context) {
+    private void loadRevisonNumber(final RequestContext context) {
         BufferedReader reader;
         try {
             String file = FILE;
@@ -62,10 +63,9 @@ public class RevisionNumber extends Abst
                 }
             }
             reader.close();
-        } catch (IOException e) {
+        } catch (final IOException e) {
             throw new ScimpiException(e);
         }
     }
 
 }
-

Modified: incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/Snippet.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/Snippet.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/Snippet.java (original)
+++ incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/Snippet.java Tue May  3 07:53:06 2011
@@ -17,14 +17,11 @@
  *  under the License.
  */
 
-
 package org.apache.isis.viewer.scimpi.dispatcher.view;
 
 public interface Snippet {
 
     String getHtml();
-    
+
     String errorAt();
 }
-
-

Modified: incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/SwfTag.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/SwfTag.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/SwfTag.java (original)
+++ incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/SwfTag.java Tue May  3 07:53:06 2011
@@ -21,7 +21,6 @@ package org.apache.isis.viewer.scimpi.di
 
 import org.apache.isis.viewer.scimpi.dispatcher.action.Attributes;
 
-
 public class SwfTag implements Snippet {
 
     public static final int END = 0;
@@ -33,7 +32,8 @@ public class SwfTag implements Snippet {
     private final String lineNumbers;
     private final String path;
 
-    public SwfTag(String tagName, Attributes attributes, int type, String lineNumbers, String path) {
+    public SwfTag(final String tagName, final Attributes attributes, final int type, final String lineNumbers,
+        final String path) {
         this.tagName = tagName;
         this.attributes = attributes;
         this.type = type;
@@ -41,6 +41,7 @@ public class SwfTag implements Snippet {
         this.path = path;
     }
 
+    @Override
     public String getHtml() {
         return tagName;
     }
@@ -57,6 +58,7 @@ public class SwfTag implements Snippet {
         return attributes;
     }
 
+    @Override
     public String errorAt() {
         return path + ":" + lineNumbers;
     }
@@ -64,19 +66,20 @@ public class SwfTag implements Snippet {
     public String debug() {
         return path + ":" + lineNumbers + " - " + getAttributes();
     }
-        
+
+    @Override
     public String toString() {
         String t = null;
         switch (type) {
-        case EMPTY:
-            t = "empty";
-            break;
-        case START:
-            t = "start";
-            break;
-        case END:
-            t = "end";
-            break;
+            case EMPTY:
+                t = "empty";
+                break;
+            case START:
+                t = "start";
+                break;
+            case END:
+                t = "end";
+                break;
         }
         return "SwfTag[name=" + tagName + ",path=" + path + ",line=" + lineNumbers + ",type=" + t + "]";
     }

Modified: incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/ActionButton.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/ActionButton.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/action/ActionButton.java (original)
+++ incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/ActionButton.java Tue May  3 07:53:06 2011
@@ -17,7 +17,6 @@
  *  under the License.
  */
 
-
 package org.apache.isis.viewer.scimpi.dispatcher.view.action;
 
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
@@ -37,37 +36,38 @@ import org.apache.log4j.Logger;
 public class ActionButton extends AbstractElementProcessor {
     private static final Logger LOG = Logger.getLogger(ActionButton.class);
 
-    public void process(Request request) {
-        String objectId = request.getOptionalProperty(OBJECT);
-        String methodName = request.getRequiredProperty(METHOD);
-        String forwardResultTo = request.getOptionalProperty(VIEW);
-        String forwardVoidTo = request.getOptionalProperty(VOID);
-        String forwardErrorTo = request.getOptionalProperty(ERRORS);
-        String variable = request.getOptionalProperty(RESULT_NAME);
-        String scope = request.getOptionalProperty(SCOPE);
-        String buttonTitle = request.getOptionalProperty(BUTTON_TITLE);
-        String resultOverride = request.getOptionalProperty(RESULT_OVERRIDE);
-        String idName = request.getOptionalProperty(ID, methodName);
-        String className = request.getOptionalProperty(CLASS);
-        boolean showMessage = request.isRequested(SHOW_MESSAGE, false);
-        String completionMessage = request.getOptionalProperty(MESSAGE);
-        
-        ObjectAdapter object = MethodsUtils.findObject(request.getContext(), objectId);
-        String version = request.getContext().mapVersion(object);
-        ObjectAction action = MethodsUtils.findAction(object, methodName);
+    @Override
+    public void process(final Request request) {
+        final String objectId = request.getOptionalProperty(OBJECT);
+        final String methodName = request.getRequiredProperty(METHOD);
+        final String forwardResultTo = request.getOptionalProperty(VIEW);
+        final String forwardVoidTo = request.getOptionalProperty(VOID);
+        final String forwardErrorTo = request.getOptionalProperty(ERRORS);
+        final String variable = request.getOptionalProperty(RESULT_NAME);
+        final String scope = request.getOptionalProperty(SCOPE);
+        final String buttonTitle = request.getOptionalProperty(BUTTON_TITLE);
+        final String resultOverride = request.getOptionalProperty(RESULT_OVERRIDE);
+        final String idName = request.getOptionalProperty(ID, methodName);
+        final String className = request.getOptionalProperty(CLASS);
+        final boolean showMessage = request.isRequested(SHOW_MESSAGE, false);
+        final String completionMessage = request.getOptionalProperty(MESSAGE);
+
+        final ObjectAdapter object = MethodsUtils.findObject(request.getContext(), objectId);
+        final String version = request.getContext().mapVersion(object);
+        final ObjectAction action = MethodsUtils.findAction(object, methodName);
 
-        ActionContent parameterBlock = new ActionContent(action);
+        final ActionContent parameterBlock = new ActionContent(action);
         request.setBlockContent(parameterBlock);
         request.processUtilCloseTag();
-        String[] parameters = parameterBlock.getParameters();
-        ObjectAdapter[] objectParameters = new ObjectAdapter[parameters.length];
+        final String[] parameters = parameterBlock.getParameters();
+        final ObjectAdapter[] objectParameters = new ObjectAdapter[parameters.length];
         int i = 0;
-        for(ObjectActionParameter spec : action.getParameters()) {
-            ObjectSpecification typ = spec.getSpecification();
+        for (final ObjectActionParameter spec : action.getParameters()) {
+            final ObjectSpecification typ = spec.getSpecification();
             if (parameters[i] == null) {
                 objectParameters[i] = null;
             } else if (typ.getFacet(ParseableFacet.class) != null) {
-                ParseableFacet facet = (ParseableFacet) typ.getFacet(ParseableFacet.class);
+                final ParseableFacet facet = typ.getFacet(ParseableFacet.class);
                 objectParameters[i] = facet.parseTextEntry(null, parameters[i]);
             } else {
                 // objectParameters[i] = request.getContext().getMappedObject(parameters[i]);
@@ -75,55 +75,41 @@ public class ActionButton extends Abstra
             }
             i++;
         }
-        
-        
-        if (MethodsUtils.isVisibleAndUsable(object, action) && MethodsUtils.canRunMethod(object, action, objectParameters).isAllowed()) {
+
+        if (MethodsUtils.isVisibleAndUsable(object, action)
+            && MethodsUtils.canRunMethod(object, action, objectParameters).isAllowed()) {
             // TODO use the form creation mechanism as used in ActionForm
-            write(request, object, action, parameters, objectId, version, forwardResultTo, forwardVoidTo, forwardErrorTo, variable, scope, buttonTitle, completionMessage, resultOverride, idName, className);
+            write(request, object, action, parameters, objectId, version, forwardResultTo, forwardVoidTo,
+                forwardErrorTo, variable, scope, buttonTitle, completionMessage, resultOverride, idName, className);
         }
-        
+
         if (showMessage) {
-            Consent usable = action.isUsable(IsisContext.getAuthenticationSession(), object);
+            final Consent usable = action.isUsable(IsisContext.getAuthenticationSession(), object);
             if (usable.isVetoed()) {
-                String notUsable = MethodsUtils.isUsable(object, action);
-    
+                final String notUsable = MethodsUtils.isUsable(object, action);
+
                 if (notUsable != null) {
                     request.appendHtml("<div class=\"" + className + "-message\" >" + notUsable + "</div>");
                 }
             }
         }
-        
-        
-        
+
         request.popBlockContent();
     }
 
-    public static void write(
-            Request request,
-            ObjectAdapter object,
-            ObjectAction action,
-            String[] parameters,
-            String objectId,
-            String version,
-            String forwardResultTo,
-            String forwardVoidTo,
-            String forwardErrorTo,
-            String variable,
-            String scope,
-            String buttonTitle, 
-            String completionMessage,
-            String resultOverride,
-            String idName,
-            String className) {
-        RequestContext context = request.getContext();
+    public static void write(final Request request, final ObjectAdapter object, final ObjectAction action,
+        final String[] parameters, final String objectId, final String version, String forwardResultTo,
+        String forwardVoidTo, String forwardErrorTo, final String variable, final String scope, String buttonTitle,
+        final String completionMessage, final String resultOverride, final String idName, final String className) {
+        final RequestContext context = request.getContext();
 
         buttonTitle = buttonTitle != null ? buttonTitle : action.getName();
-        
+
         if (action.isVisible(IsisContext.getAuthenticationSession(), object).isVetoed()) {
             LOG.info("action not visible " + action.getName());
             return;
         }
-        Consent usable = action.isUsable(IsisContext.getAuthenticationSession(), object);
+        final Consent usable = action.isUsable(IsisContext.getAuthenticationSession(), object);
         if (usable.isVetoed()) {
             LOG.info("action not available: " + usable.getReason());
             return;
@@ -131,64 +117,72 @@ public class ActionButton extends Abstra
 
         /*
          * 
-         * TODO this mechanism fails as it tries to process tags - which we dont need! Also it calls action
-         * 'edit' (not 'action'). Field[] fields = new Field[0]; HiddenField[] hiddenFields = new
-         * HiddenField[] { new HiddenField("service", serviceId), new HiddenField("method", methodName), new
-         * HiddenField("view", forwardToView), variable == null ? null : new HiddenField("variable",
-         * variable), }; Form.createForm(request, buttonTitle, fields, hiddenFields, false);
+         * TODO this mechanism fails as it tries to process tags - which we dont need! Also it calls action 'edit' (not
+         * 'action'). Field[] fields = new Field[0]; HiddenField[] hiddenFields = new HiddenField[] { new
+         * HiddenField("service", serviceId), new HiddenField("method", methodName), new HiddenField("view",
+         * forwardToView), variable == null ? null : new HiddenField("variable", variable), }; Form.createForm(request,
+         * buttonTitle, fields, hiddenFields, false);
          */
 
-        String idSegment = idName == null ? "" : ("id=\"" + idName + "\" ");
-        String classSegment = "class=\"" + (className == null ? "action in-line" : className) + "\"";
+        final String idSegment = idName == null ? "" : ("id=\"" + idName + "\" ");
+        final String classSegment = "class=\"" + (className == null ? "action in-line" : className) + "\"";
         request.appendHtml("\n<form " + idSegment + classSegment + " action=\"action.app\" method=\"post\">\n");
         if (objectId == null) {
-            request.appendHtml("  <input type=\"hidden\" name=\"" + "_" + OBJECT + "\" value=\"" + 
-                    context.getVariable(RequestContext.RESULT) + "\" />\n");
+            request.appendHtml("  <input type=\"hidden\" name=\"" + "_" + OBJECT + "\" value=\""
+                + context.getVariable(RequestContext.RESULT) + "\" />\n");
         } else {
-            request.appendHtml("  <input type=\"hidden\" name=\"" + "_" + OBJECT + "\" value=\"" + objectId + "\" />\n");
+            request
+                .appendHtml("  <input type=\"hidden\" name=\"" + "_" + OBJECT + "\" value=\"" + objectId + "\" />\n");
         }
         request.appendHtml("  <input type=\"hidden\" name=\"" + "_" + VERSION + "\" value=\"" + version + "\" />\n");
         if (scope != null) {
             request.appendHtml("  <input type=\"hidden\" name=\"" + "_" + SCOPE + "\" value=\"" + scope + "\" />\n");
         }
-        request.appendHtml("  <input type=\"hidden\" name=\"" + "_" + METHOD + "\" value=\"" + action.getId() + "\" />\n");
+        request.appendHtml("  <input type=\"hidden\" name=\"" + "_" + METHOD + "\" value=\"" + action.getId()
+            + "\" />\n");
         if (forwardResultTo != null) {
             forwardResultTo = context.fullFilePath(forwardResultTo);
-            request.appendHtml("  <input type=\"hidden\" name=\"" + "_" + VIEW + "\" value=\"" + forwardResultTo + "\" />\n");
+            request.appendHtml("  <input type=\"hidden\" name=\"" + "_" + VIEW + "\" value=\"" + forwardResultTo
+                + "\" />\n");
         }
         if (forwardErrorTo == null) {
             forwardErrorTo = request.getContext().getResourceFile();
         }
         forwardErrorTo = context.fullFilePath(forwardErrorTo);
-        request.appendHtml("  <input type=\"hidden\" name=\"" + "_" + ERRORS + "\" value=\"" + forwardErrorTo + "\" />\n");
+        request.appendHtml("  <input type=\"hidden\" name=\"" + "_" + ERRORS + "\" value=\"" + forwardErrorTo
+            + "\" />\n");
         if (forwardVoidTo == null) {
             forwardVoidTo = request.getContext().getResourceFile();
         }
         forwardVoidTo = context.fullFilePath(forwardVoidTo);
         request.appendHtml("  <input type=\"hidden\" name=\"" + "_" + VOID + "\" value=\"" + forwardVoidTo + "\" />\n");
         if (variable != null) {
-            request.appendHtml("  <input type=\"hidden\" name=\"" + "_" + RESULT_NAME + "\" value=\"" + variable + "\" />\n");
+            request.appendHtml("  <input type=\"hidden\" name=\"" + "_" + RESULT_NAME + "\" value=\"" + variable
+                + "\" />\n");
         }
         if (resultOverride != null) {
-            request.appendHtml("  <input type=\"hidden\" name=\"" + "_" + RESULT_OVERRIDE + "\" value=\"" + resultOverride + "\" />\n");            
+            request.appendHtml("  <input type=\"hidden\" name=\"" + "_" + RESULT_OVERRIDE + "\" value=\""
+                + resultOverride + "\" />\n");
         }
         if (completionMessage != null) {
-            request.appendHtml("  <input type=\"hidden\" name=\"" + "_" + MESSAGE + "\" value=\"" + completionMessage + "\" />\n");                        
+            request.appendHtml("  <input type=\"hidden\" name=\"" + "_" + MESSAGE + "\" value=\"" + completionMessage
+                + "\" />\n");
         }
 
         for (int i = 0; i < parameters.length; i++) {
-            request.appendHtml("  <input type=\"hidden\" name=\"param" + (i + 1) + "\" value=\"" + parameters[i] + "\" />\n");
+            request.appendHtml("  <input type=\"hidden\" name=\"param" + (i + 1) + "\" value=\"" + parameters[i]
+                + "\" />\n");
         }
         request.appendHtml(request.getContext().interactionFields());
-        request.appendHtml("  <input class=\"button\" type=\"submit\" value=\"" + buttonTitle + "\" name=\"execute\" title=\"" 
-                + action.getDescription() + "\" />");
+        request.appendHtml("  <input class=\"button\" type=\"submit\" value=\"" + buttonTitle
+            + "\" name=\"execute\" title=\"" + action.getDescription() + "\" />");
         HelpLink.append(request, action.getDescription(), action.getHelp());
         request.appendHtml("\n</form>\n");
     }
 
+    @Override
     public String getName() {
         return "action-button";
     }
 
 }
-

Modified: incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/ActionContent.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/ActionContent.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/action/ActionContent.java (original)
+++ incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/ActionContent.java Tue May  3 07:53:06 2011
@@ -17,7 +17,6 @@
  *  under the License.
  */
 
-
 package org.apache.isis.viewer.scimpi.dispatcher.view.action;
 
 import java.util.List;
@@ -31,18 +30,17 @@ import org.apache.isis.viewer.scimpi.dis
 import org.apache.isis.viewer.scimpi.dispatcher.ScimpiException;
 import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
 
-
 public class ActionContent implements BlockContent {
     private final ObjectAction action;
     private final String[] parameters;
     private int next;
 
-    public ActionContent(ObjectAction action) {
+    public ActionContent(final ObjectAction action) {
         this.action = action;
         this.parameters = new String[action.getParameterCount()];
     }
 
-    public void setParameter(String field, String value) {
+    public void setParameter(final String field, final String value) {
         int index;
         if (field == null) {
             index = next++;
@@ -55,13 +53,13 @@ public class ActionContent implements Bl
         parameters[index] = value;
     }
 
-    public ObjectAdapter[] getParameters(Request request) {
-        ObjectAdapter[] params = new ObjectAdapter[parameters.length];
-        List<ObjectActionParameter> pars = action.getParameters();
+    public ObjectAdapter[] getParameters(final Request request) {
+        final ObjectAdapter[] params = new ObjectAdapter[parameters.length];
+        final List<ObjectActionParameter> pars = action.getParameters();
         for (int i = 0; i < parameters.length; i++) {
-            ObjectSpecification typ = pars.get(i).getSpecification();
+            final ObjectSpecification typ = pars.get(i).getSpecification();
             if (typ.getFacet(ParseableFacet.class) != null) {
-                ParseableFacet facet = typ.getFacet(ParseableFacet.class);
+                final ParseableFacet facet = typ.getFacet(ParseableFacet.class);
                 params[i] = facet.parseTextEntry(null, parameters[i]);
             } else {
                 params[i] = request.getContext().getMappedObject(parameters[i]);
@@ -74,4 +72,3 @@ public class ActionContent implements Bl
         return parameters;
     }
 }
-

Modified: incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/ActionForm.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/ActionForm.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/action/ActionForm.java (original)
+++ incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/ActionForm.java Tue May  3 07:53:06 2011
@@ -17,7 +17,6 @@
  *  under the License.
  */
 
-
 package org.apache.isis.viewer.scimpi.dispatcher.view.action;
 
 import java.util.List;
@@ -41,12 +40,11 @@ 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 ActionForm extends AbstractElementProcessor {
 
     @Override
-    public void process(Request request) {
-        CreateFormParameter parameters = new CreateFormParameter();
+    public void process(final Request request) {
+        final CreateFormParameter parameters = new CreateFormParameter();
         parameters.objectId = request.getOptionalProperty(OBJECT);
         parameters.methodName = request.getRequiredProperty(METHOD);
         parameters.forwardResultTo = request.getOptionalProperty(VIEW);
@@ -65,15 +63,16 @@ public class ActionForm extends Abstract
         parameters.id = request.getOptionalProperty(ID, parameters.methodName);
         createForm(request, parameters);
     }
-    
-    public static void createForm(Request request, CreateFormParameter parameterObject) {
+
+    public static void createForm(final Request request, final CreateFormParameter parameterObject) {
         createForm(request, parameterObject, false);
     }
-    
-    protected static void createForm(Request request, CreateFormParameter parameterObject, boolean withoutProcessing) {
-        RequestContext context = request.getContext();
-        ObjectAdapter object = MethodsUtils.findObject(context, parameterObject.objectId);
-        String version = request.getContext().mapVersion(object);
+
+    protected static void createForm(final Request request, final CreateFormParameter parameterObject,
+        final boolean withoutProcessing) {
+        final RequestContext context = request.getContext();
+        final ObjectAdapter object = MethodsUtils.findObject(context, parameterObject.objectId);
+        final String version = request.getContext().mapVersion(object);
         final ObjectAction action = MethodsUtils.findAction(object, parameterObject.methodName);
         // TODO how do we distinguish between overloaded methods?
 
@@ -82,11 +81,11 @@ public class ActionForm extends Abstract
             throw new ScimpiException("Action form can only be used for actions with parameters");
         }
         if (parameterObject.showMessage && MethodsUtils.isVisible(object, action)) {
-            String notUsable = MethodsUtils.isUsable(object, action);
+            final String notUsable = MethodsUtils.isUsable(object, action);
             if (notUsable != null) {
                 if (!withoutProcessing) {
                     request.skipUntilClose();
-                }  
+                }
                 request.appendHtml("<div class=\"" + parameterObject.className + "-message\" >" + notUsable + "</div>");
                 return;
             }
@@ -97,32 +96,39 @@ public class ActionForm extends Abstract
             }
             return;
         }
-        String objectId = context.mapObject(object, Scope.INTERACTION);
-        String errorView = context.fullFilePath(parameterObject.forwardErrorTo == null ? context.getResourceFile()
+        final String objectId = context.mapObject(object, Scope.INTERACTION);
+        final String errorView =
+            context.fullFilePath(parameterObject.forwardErrorTo == null ? context.getResourceFile()
                 : parameterObject.forwardErrorTo);
-        String voidView = context.fullFilePath(parameterObject.forwardVoidTo == null ? context.getResourceFile()
+        final String voidView =
+            context.fullFilePath(parameterObject.forwardVoidTo == null ? context.getResourceFile()
                 : parameterObject.forwardVoidTo);
-        HiddenInputField[] hiddenFields = new HiddenInputField[] {
+        final HiddenInputField[] hiddenFields =
+            new HiddenInputField[] {
                 new HiddenInputField("_" + OBJECT, objectId),
                 new HiddenInputField("_" + VERSION, version),
                 new HiddenInputField("_" + FORM_ID, parameterObject.formId),
                 new HiddenInputField("_" + METHOD, parameterObject.methodName),
-                parameterObject.forwardResultTo == null ? null : new HiddenInputField("_" + VIEW, context
-                        .fullFilePath(parameterObject.forwardResultTo)),
+                parameterObject.forwardResultTo == null ? null : new HiddenInputField("_" + VIEW,
+                    context.fullFilePath(parameterObject.forwardResultTo)),
                 new HiddenInputField("_" + VOID, voidView),
                 new HiddenInputField("_" + ERRORS, errorView),
-                parameterObject.completionMessage == null ? null : new HiddenInputField("_" + MESSAGE, parameterObject.completionMessage),
+                parameterObject.completionMessage == null ? null : new HiddenInputField("_" + MESSAGE,
+                    parameterObject.completionMessage),
                 parameterObject.scope == null ? null : new HiddenInputField("_" + SCOPE, parameterObject.scope),
-                parameterObject.resultOverride == null ? null : new HiddenInputField("_" + RESULT_OVERRIDE, parameterObject.resultOverride),
-                parameterObject.resultName == null ? null : new HiddenInputField("_" + RESULT_NAME, parameterObject.resultName),
-                parameterObject.resultName == null ? null : new HiddenInputField(RequestContext.RESULT, (String) request
-                        .getContext().getVariable(RequestContext.RESULT)) };
+                parameterObject.resultOverride == null ? null : new HiddenInputField("_" + RESULT_OVERRIDE,
+                    parameterObject.resultOverride),
+                parameterObject.resultName == null ? null : new HiddenInputField("_" + RESULT_NAME,
+                    parameterObject.resultName),
+                parameterObject.resultName == null ? null : new HiddenInputField(RequestContext.RESULT,
+                    (String) request.getContext().getVariable(RequestContext.RESULT)) };
 
         // TODO when the block contains a selector tag it doesn't disable it if the field cannot be edited!!!
-        FormFieldBlock containedBlock = new FormFieldBlock() {
-            public boolean isNullable(String name) {
-                int index = Integer.parseInt(name.substring(5)) - 1;
-                ObjectActionParameter param = action.getParameters().get(index);
+        final FormFieldBlock containedBlock = new FormFieldBlock() {
+            @Override
+            public boolean isNullable(final String name) {
+                final int index = Integer.parseInt(name.substring(5)) - 1;
+                final ObjectActionParameter param = action.getParameters().get(index);
                 return param.isOptional();
             }
         };
@@ -131,10 +137,10 @@ public class ActionForm extends Abstract
             request.processUtilCloseTag();
         }
 
-        FormState entryState = (FormState) context.getVariable(ENTRY_FIELDS);
+        final FormState entryState = (FormState) context.getVariable(ENTRY_FIELDS);
 
         // TODO the list of included fields should be considered in the next method (see EditObject)
-        InputField[] formFields = createFields(action, object);
+        final InputField[] formFields = createFields(action, object);
         containedBlock.hideExcludedParameters(formFields);
         containedBlock.setUpValues(formFields);
         initializeFields(context, object, action, formFields);
@@ -142,7 +148,7 @@ public class ActionForm extends Abstract
         String errors = null;
         if (entryState != null && entryState.isForForm(parameterObject.formId)) {
             copyEntryState(context, object, action, formFields, entryState);
-            errors = entryState.getError(); 
+            errors = entryState.getError();
         }
         overrideWithHtml(context, containedBlock, formFields);
 
@@ -156,76 +162,70 @@ public class ActionForm extends Abstract
         String buttonTitle = parameterObject.buttonTitle;
         if (buttonTitle == null) {
             buttonTitle = action.getName();
-        } else if( buttonTitle.equals("")) {
+        } else if (buttonTitle.equals("")) {
             buttonTitle = "Ok";
         }
-        
-            
-        HtmlFormBuilder.createForm(request, ActionAction.ACTION + ".app", hiddenFields, formFields, parameterObject.className,
-                parameterObject.id, formTitle, action.getDescription(), action.getHelp(), buttonTitle, errors);
+
+        HtmlFormBuilder.createForm(request, ActionAction.ACTION + ".app", hiddenFields, formFields,
+            parameterObject.className, parameterObject.id, formTitle, action.getDescription(), action.getHelp(),
+            buttonTitle, errors);
 
         request.popBlockContent();
     }
 
-    private static InputField[] createFields(ObjectAction action, ObjectAdapter object) {
-        int parameterCount = action.getParameterCount();
-        InputField[] fields = new InputField[parameterCount];
+    private static InputField[] createFields(final ObjectAction action, final ObjectAdapter object) {
+        final int parameterCount = action.getParameterCount();
+        final InputField[] fields = new InputField[parameterCount];
         for (int i = 0; i < fields.length; i++) {
             fields[i] = new InputField(ActionAction.parameterName(i));
         }
         return fields;
     }
 
-    private static void initializeFields(
-            RequestContext context,
-            ObjectAdapter object,
-            ObjectAction action,
-            InputField[] fields) {
-        List<ObjectActionParameter> parameters = action.getParameters();
+    private static void initializeFields(final RequestContext context, final ObjectAdapter object,
+        final ObjectAction action, final InputField[] fields) {
+        final List<ObjectActionParameter> parameters = action.getParameters();
         for (int i = 0; i < fields.length; i++) {
-            InputField field = fields[i];
-            ObjectActionParameter param = parameters.get(i);
+            final InputField field = fields[i];
+            final ObjectActionParameter param = parameters.get(i);
             if (action.isContributed() && i == 0) {
-                //fields[i].setValue(context.mapObject(object, Scope.INTERACTION));
+                // fields[i].setValue(context.mapObject(object, Scope.INTERACTION));
                 fields[i].setType(InputField.REFERENCE);
                 fields[i].setHidden(true);
             } else {
-                
+
                 fields[i].setHelpReference("xxxhelp");
-                ObjectAdapter[] optionsForParameter = action.getChoices(object)[i];
+                final ObjectAdapter[] optionsForParameter = action.getChoices(object)[i];
                 FieldFactory.initializeField(context, object, param, optionsForParameter, !param.isOptional(), field);
             }
         }
     }
-    
+
     /**
      * Sets up the fields with their initial values
-     * @param showIcon 
+     * 
+     * @param showIcon
      */
-    private static void setDefaults(
-            RequestContext context,
-            ObjectAdapter object,
-            ObjectAction action,
-            InputField[] fields,
-            FormState entryState, 
-            boolean showIcon) {
-        ObjectAdapter[] defaultValues = action.getDefaults(object);
+    private static void setDefaults(final RequestContext context, final ObjectAdapter object,
+        final ObjectAction action, final InputField[] fields, final FormState entryState, final boolean showIcon) {
+        final ObjectAdapter[] defaultValues = action.getDefaults(object);
         if (defaultValues == null) {
             return;
         }
 
         for (int i = 0; i < fields.length; i++) {
-            InputField field = fields[i];
-            ObjectAdapter defaultValue = defaultValues[i];
+            final InputField field = fields[i];
+            final ObjectAdapter defaultValue = defaultValues[i];
 
-            String title = defaultValue == null ? "" : defaultValue.titleString();
+            final String title = defaultValue == null ? "" : defaultValue.titleString();
             if (field.getType() == InputField.REFERENCE) {
-                ObjectSpecification objectSpecification = action.getParameters().get(i).getSpecification();
+                final ObjectSpecification objectSpecification = action.getParameters().get(i).getSpecification();
                 if (defaultValue != null) {
-                    String imageSegment = showIcon ? "<img class=\"small-icon\" src=\"" + context.imagePath(objectSpecification) + "\" alt=\""
-                                                + objectSpecification.getShortIdentifier() + "\"/>" : "";
-                    String html = imageSegment + title;
-                    String value = context.mapObject(defaultValue, Scope.INTERACTION);
+                    final String imageSegment =
+                        showIcon ? "<img class=\"small-icon\" src=\"" + context.imagePath(objectSpecification)
+                            + "\" alt=\"" + objectSpecification.getShortIdentifier() + "\"/>" : "";
+                    final String html = imageSegment + title;
+                    final String value = context.mapObject(defaultValue, Scope.INTERACTION);
                     field.setValue(value);
                     field.setHtml(html);
                 }
@@ -235,16 +235,11 @@ public class ActionForm extends Abstract
         }
     }
 
-    private static void copyEntryState(
-            RequestContext context,
-            ObjectAdapter object,
-            ObjectAction action,
-            InputField[] fields,
-            FormState entryState) {
+    private static void copyEntryState(final RequestContext context, final ObjectAdapter object,
+        final ObjectAction action, final InputField[] fields, final FormState entryState) {
 
-        for (int i = 0; i < fields.length; i++) {
-            InputField field = fields[i];
-            FieldEditState fieldState = entryState.getField(field.getName());
+        for (final InputField field : fields) {
+            final FieldEditState fieldState = entryState.getField(field.getName());
             if (fieldState != null) {
                 if (field.isEditable()) {
                     String entry;
@@ -257,11 +252,12 @@ public class ActionForm extends Abstract
         }
     }
 
-    private static void overrideWithHtml(RequestContext context, FormFieldBlock containedBlock, InputField[] formFields) {
+    private static void overrideWithHtml(final RequestContext context, final FormFieldBlock containedBlock,
+        final InputField[] formFields) {
         for (int i = 0; i < formFields.length; i++) {
-            String id = ActionAction.parameterName(i);
+            final String id = ActionAction.parameterName(i);
             if (containedBlock.hasContent(id)) {
-                String content = containedBlock.getContent(id);
+                final String content = containedBlock.getContent(id);
                 if (content != null) {
                     formFields[i].setHtml(content);
                     formFields[i].setType(InputField.HTML);
@@ -276,4 +272,3 @@ public class ActionForm extends Abstract
     }
 
 }
-



Mime
View raw message