[jboss-cvs] jboss-portal/core/src/main/org/jboss/portal/core/command ...

Chris Laprun chris.laprun at jboss.com
Tue Jul 18 18:29:27 EDT 2006


  User: claprun 
  Date: 06/07/18 18:29:27

  Modified:    core/src/main/org/jboss/portal/core/command 
                        MarkupCommand.java
  Log:
  JBPORTAL-958:
  - Added Actionable and BaseActionable which WindowState and Mode extend.
  - Added support for Actions ordering so that buttons in decoration are always at the same spot.
  - Minor code improvements.
  
  Revision  Changes    Path
  1.33      +59 -30    jboss-portal/core/src/main/org/jboss/portal/core/command/MarkupCommand.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: MarkupCommand.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-portal/core/src/main/org/jboss/portal/core/command/MarkupCommand.java,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -b -r1.32 -r1.33
  --- MarkupCommand.java	9 Jul 2006 12:04:14 -0000	1.32
  +++ MarkupCommand.java	18 Jul 2006 22:29:27 -0000	1.33
  @@ -21,19 +21,18 @@
   */
   package org.jboss.portal.core.command;
   
  -import org.jboss.portal.portlet.Mode;
  -import org.jboss.portal.portlet.WindowState;
  -import org.jboss.portal.identity.User;
  -import org.jboss.portal.security.spi.auth.PortalAuthorizationManager;
  -import org.jboss.portal.security.PortalSecurityException;
   import org.jboss.portal.common.invocation.InvocationException;
   import org.jboss.portal.common.util.Exceptions;
   import org.jboss.portal.core.command.portlet.CoreInvocationContext;
   import org.jboss.portal.core.model.instance.Instance;
   import org.jboss.portal.core.model.portal.Page;
   import org.jboss.portal.core.model.portal.PortalObject;
  -import org.jboss.portal.core.model.portal.Window;
   import org.jboss.portal.core.model.portal.PortalObjectPermission;
  +import org.jboss.portal.core.model.portal.Window;
  +import org.jboss.portal.identity.User;
  +import org.jboss.portal.portlet.Actionable;
  +import org.jboss.portal.portlet.Mode;
  +import org.jboss.portal.portlet.WindowState;
   import org.jboss.portal.portlet.info.ModeInfo;
   import org.jboss.portal.portlet.info.WindowStateInfo;
   import org.jboss.portal.portlet.result.ErrorResult;
  @@ -43,6 +42,8 @@
   import org.jboss.portal.portlet.result.Result;
   import org.jboss.portal.portlet.result.UnavailableResult;
   import org.jboss.portal.portlet.spi.PortalContext;
  +import org.jboss.portal.security.PortalSecurityException;
  +import org.jboss.portal.security.spi.auth.PortalAuthorizationManager;
   import org.jboss.portal.server.ServerInvocation;
   import org.jboss.portal.server.config.ServerConfig;
   import org.jboss.portal.server.navigation.NavigationalStateContext;
  @@ -80,48 +81,74 @@
    * RenderPageCommand and the RenderRegionCommand.</p>
    *
    * @author <a href="mailto:mholzner at novell.com">Martin Holzner</a>
  - * @version $Revision: 1.32 $
  + * @version $Revision: 1.33 $
    */
   public abstract class MarkupCommand extends PortalObjectCommand
   {
   
  -   /** . */
  +   /**
  +    * .
  +    */
      private static String WINDOW_ACCESS_DENIED = "core.render.window_access_denied";
   
  -   /** . */
  +   /**
  +    * .
  +    */
      private static String WINDOW_UNAVAILABLE = "core.render.window_unavailable";
   
  -   /** . */
  +   /**
  +    * .
  +    */
      private static String WINDOW_ERROR = "core.render.window_error";
   
  -   /** . */
  +   /**
  +    * .
  +    */
      private static String WINDOW_INTERNAL_ERROR = "core.render.window_internal_error";
   
  -   /** . */
  +   /**
  +    * .
  +    */
      private static String WINDOW_NOT_FOUND = "core.render.window_not_found";
   
  -   /** . */
  +   /**
  +    * .
  +    */
      private static String HIDE = "hide";
   
  -   /** . */
  +   /**
  +    * .
  +    */
      private static String SHOW = "show";
   
  -   /** . */
  +   /**
  +    * .
  +    */
      private static final CommandInfo info = new CommandInfo(false, "view", true);
   
  -   /** . */
  +   /**
  +    * .
  +    */
      private final String pageRef;
   
  -   /** . */
  +   /**
  +    * .
  +    */
      private final MarkupContainer markupContainer;
   
  -   /** . */
  +   /**
  +    * .
  +    */
      private Page page;
   
  -   /** . */
  +   /**
  +    * .
  +    */
      private PortalLayout layout;
   
  -   /** . */
  +   /**
  +    * .
  +    */
      private boolean personalizable;
   
      /**
  @@ -548,8 +575,8 @@
                  windowTitle = "Portlet unavailable";
                  contentChars = "Portlet unavailable";
                  actionMap = new HashMap();
  -               actionMap.put("mode", Collections.EMPTY_LIST);
  -               actionMap.put("windowstate", Collections.EMPTY_LIST);
  +               actionMap.put(Actionable.MODES_KEY, Collections.EMPTY_LIST);
  +               actionMap.put(Actionable.WINDOWSTATES_KEY, Collections.EMPTY_LIST);
                  responseProps = new Properties();
                  return new ModifiableWindowResult(windowTitle, contentChars, actionMap, windowProps, responseProps, headerChars);
               }
  @@ -573,8 +600,8 @@
            }
            if (SHOW.equals(cfg.getProperty(WINDOW_ACCESS_DENIED)))
            {
  -            actionMap.put("mode", Collections.EMPTY_LIST);
  -            actionMap.put("windowstate", Collections.EMPTY_LIST);
  +            actionMap.put(Actionable.MODES_KEY, Collections.EMPTY_LIST);
  +            actionMap.put(Actionable.WINDOWSTATES_KEY, Collections.EMPTY_LIST);
               windowTitle = "Access denied";
               contentChars = "Access denied";
               responseProps = new Properties();
  @@ -589,8 +616,8 @@
            }
            if (SHOW.equals(cfg.getProperty(WINDOW_NOT_FOUND)))
            {
  -            actionMap.put("mode", Collections.EMPTY_LIST);
  -            actionMap.put("windowstate", Collections.EMPTY_LIST);
  +            actionMap.put(Actionable.MODES_KEY, Collections.EMPTY_LIST);
  +            actionMap.put(Actionable.WINDOWSTATES_KEY, Collections.EMPTY_LIST);
               windowTitle = "Cannot render";
               contentChars = "Object not found " + e.getRef();
               responseProps = new Properties();
  @@ -657,10 +684,11 @@
            WindowState windowState = (WindowState)j.next();
            String url = invCtx.createUpdateNavigationalStateURL(null, windowState);
            boolean disabled = windowState.equals(currentWindowState);
  -         WindowResult.Action action = new WindowResult.Action(windowState.toString(), url, !disabled);
  +         WindowResult.Action action = new WindowResult.Action(windowState, url, !disabled);
            windowStates.add(action);
         }
  -      actionMap.put("windowstate", windowStates);
  +      Collections.sort(windowStates);
  +      actionMap.put(Actionable.WINDOWSTATES_KEY, windowStates);
      }
   
      /**
  @@ -679,10 +707,11 @@
            Mode mode = (Mode)j.next();
            String url = invCtx.createUpdateNavigationalStateURL(mode, null);
            boolean disabled = mode.equals(currentMode);
  -         WindowResult.Action action = new WindowResult.Action(mode.toString(), url, !disabled);
  +         WindowResult.Action action = new WindowResult.Action(mode, url, !disabled);
            modes.add(action);
         }
  -      actionMap.put("mode", modes);
  +      Collections.sort(modes);
  +      actionMap.put(Actionable.MODES_KEY, modes);
      }
   
   /*
  
  
  



More information about the jboss-cvs-commits mailing list