incubator-isis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmatth...@apache.org
Subject svn commit: r1355097 - in /incubator/isis/trunk/framework/viewer/scimpi/scimpi-dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher: Dispatcher.java view/action/ActionButton.java view/simple/RemoveElement.java
Date Thu, 28 Jun 2012 18:32:34 GMT
Author: rmatthews
Date: Thu Jun 28 18:32:33 2012
New Revision: 1355097

URL: http://svn.apache.org/viewvc?rev=1355097&view=rev
Log:
ISIS-162 - Improved disabling of buttons so that button still shows, but message is available.

Modified:
    incubator/isis/trunk/framework/viewer/scimpi/scimpi-dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/Dispatcher.java
    incubator/isis/trunk/framework/viewer/scimpi/scimpi-dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/ActionButton.java
    incubator/isis/trunk/framework/viewer/scimpi/scimpi-dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/RemoveElement.java

Modified: incubator/isis/trunk/framework/viewer/scimpi/scimpi-dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/Dispatcher.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/scimpi/scimpi-dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/Dispatcher.java?rev=1355097&r1=1355096&r2=1355097&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/scimpi/scimpi-dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/Dispatcher.java
(original)
+++ incubator/isis/trunk/framework/viewer/scimpi/scimpi-dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/Dispatcher.java
Thu Jun 28 18:32:33 2012
@@ -161,7 +161,6 @@ public class Dispatcher {
         error.message(e);
         error.message(ex);
         
-        final Identifier identifier =  ((ForbiddenException) ex).getIdentifier();
         final List<String> roles = ((ForbiddenException) ex).getRoles();
         final StringBuffer roleList = new StringBuffer();
         for (final String role : roles) {
@@ -170,10 +169,13 @@ public class Dispatcher {
             }
             roleList.append(role);
         }
-        debug.appendln("Class", identifier.toClassIdentityString() + ":" + roleList);
-        debug.appendln("Member",identifier.toClassAndNameIdentityString() + ":" + roleList);

-        debug.appendln("Other",identifier.toFullIdentityString() + ":" + roleList); 
-
+        final Identifier identifier =  ((ForbiddenException) ex).getIdentifier(); 
+        if (identifier != null) {
+            debug.appendln("Class", identifier.toClassIdentityString() + ":" + roleList);
+            debug.appendln("Member",identifier.toClassAndNameIdentityString() + ":" + roleList);

+            debug.appendln("Other",identifier.toFullIdentityString() + ":" + roleList); 
+        }
+        
         error.compileError(context);
         context.raiseError(403, error);
     }

Modified: incubator/isis/trunk/framework/viewer/scimpi/scimpi-dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/ActionButton.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/scimpi/scimpi-dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/ActionButton.java?rev=1355097&r1=1355096&r2=1355097&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/scimpi/scimpi-dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/ActionButton.java
(original)
+++ incubator/isis/trunk/framework/viewer/scimpi/scimpi-dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/ActionButton.java
Thu Jun 28 18:32:33 2012
@@ -86,23 +86,15 @@ public class ActionButton extends Abstra
             if (usable.isVetoed()) {
                 final String notUsable = usable.getReason();
                 if (notUsable != null) {
-                    if (className == null) {
-                        className = "access";
-                    }
-                    request.appendHtml("<div class=\"" + className + "-message\" >");
-                    request.appendAsHtmlEncoded(notUsable);
-                    request.appendHtml("</div>");
+                    String title = buttonTitle == null ? action.getName() : buttonTitle;
+                    disabledButton(request, title, notUsable, className);
                 }
             } else {
                 final Consent valid = action.isProposedArgumentSetValid(object, objectParameters);
                 final String notValid = valid.getReason();
                 if (notValid != null) {
-                    if (className == null) {
-                        className = "access";
-                    }
-                    request.appendHtml("<div class=\"" + className + "-message\" >");
-                    request.appendAsHtmlEncoded(notValid);
-                    request.appendHtml("</div>");
+                    String title = buttonTitle == null ? action.getName() : buttonTitle;
+                    disabledButton(request, title, notValid, className);
                 }
             }
         }
@@ -110,6 +102,16 @@ public class ActionButton extends Abstra
         request.popBlockContent();
     }
 
+    private void disabledButton(final Request request, final String buttonTitle, String message,
String className) {
+        if (className == null) {
+            className = "access";
+        }
+        request.appendHtml("<div class=\"" + className + " disabled\" title=\"");
+        request.appendAsHtmlEncoded(message);
+        request.appendHtml("\" >" + buttonTitle);
+        request.appendHtml("</div>");
+    }
+
     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();

Modified: incubator/isis/trunk/framework/viewer/scimpi/scimpi-dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/RemoveElement.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/scimpi/scimpi-dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/RemoveElement.java?rev=1355097&r1=1355096&r2=1355097&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/scimpi/scimpi-dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/RemoveElement.java
(original)
+++ incubator/isis/trunk/framework/viewer/scimpi/scimpi-dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/RemoveElement.java
Thu Jun 28 18:32:33 2012
@@ -90,9 +90,15 @@ public class RemoveElement extends Abstr
         }
 
         if (usable.isVetoed()) {
+            /*
             request.appendHtml("<span class=\"veto\">");
             request.appendAsHtmlEncoded(usable.getReason());
             request.appendHtml("</span>");
+            */
+            request.appendHtml("<div class=\"" + cssClass + " disabled\" title=\"");
+            request.appendAsHtmlEncoded(usable.getReason());
+            request.appendHtml("\" >" + title);
+            request.appendHtml("</div>");
         } else {
             if (valid(request, adapter)) {
                 final String classSegment = " class=\"" + cssClass + "\"";



Mime
View raw message