[jboss-cvs] jboss-portal/api/src/main/org/jboss/portal ...

Julien Viet julien at jboss.com
Mon Jul 31 15:29:44 EDT 2006


  User: julien  
  Date: 06/07/31 15:29:44

  Added:       api/src/main/org/jboss/portal   Mode.java WindowState.java
  Log:
  - moved the portal api in the api module in order to have a standalone jar
  - JBPORTAL-631 : Try to move org.jboss.portlet package to the api module
  - IPC support in 2.4 (only for local portlets)
  
  Revision  Changes    Path
  1.1      date: 2006/07/31 19:29:44;  author: julien;  state: Exp;jboss-portal/api/src/main/org/jboss/portal/Mode.java
  
  Index: Mode.java
  ===================================================================
  /*
  * JBoss, Home of Professional Open Source
  * Copyright 2005, JBoss Inc., and individual contributors as indicated
  * by the @authors tag. See the copyright.txt in the distribution for a
  * full listing of individual contributors.
  *
  * This is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License as
  * published by the Free Software Foundation; either version 2.1 of
  * the License, or (at your option) any later version.
  *
  * This software is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this software; if not, write to the Free
  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  */
  package org.jboss.portal;
  
  import java.io.Serializable;
  
  /**
   * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
   * @version $Revision: 1.1 $
   */
  public class Mode implements Serializable
  {
  
     /**
      * The serialVersionUID.
      */
     private static final long serialVersionUID = 6033765240710422050L;
  
     /**
      * .
      */
     public static final Mode EDIT = new Mode("edit");
  
     /**
      * .
      */
     public static final Mode HELP = new Mode("help");
  
     /**
      * .
      */
     public static final Mode VIEW = new Mode("view");
  
     /**
      * .
      */
     public static final Mode EDIT_DEFAULTS = new Mode("edit_defaults");
  
     /**
      * .
      */
     private String name;
  
     public Mode(String name)
     {
        if (name == null)
        {
           throw new NullPointerException();
        }
        this.name = name;
     }
  
     public boolean equals(Object o)
     {
        if (o instanceof Mode)
        {
           return o == this || name.equalsIgnoreCase(((Mode)o).name);
        }
        return false;
     }
  
     public int hashCode()
     {
        return name.hashCode();
     }
  
     public String toString()
     {
        return name;
     }
  
     private Object readResolve()
     {
        if (VIEW.name.equalsIgnoreCase(name))
        {
           return VIEW;
        }
        else if (EDIT.name.equalsIgnoreCase(name))
        {
           return EDIT;
        }
        else if (HELP.name.equalsIgnoreCase(name))
        {
           return HELP;
        }
        else if (EDIT_DEFAULTS.name.equalsIgnoreCase(name))
        {
           return EDIT_DEFAULTS;
        }
        else
        {
           return this;
        }
     }
  
     public static Mode create(String s)
     {
        if (Mode.VIEW.name.equalsIgnoreCase(s))
        {
           return Mode.VIEW;
        }
        else if (Mode.EDIT.name.equalsIgnoreCase(s))
        {
           return Mode.EDIT;
        }
        else if (Mode.HELP.name.equalsIgnoreCase(s))
        {
           return Mode.HELP;
        }
        else if (Mode.EDIT_DEFAULTS.name.equalsIgnoreCase(s))
        {
           return Mode.VIEW;
        }
        else
        {
           return new Mode(s);
        }
     }
  }
  
  
  
  1.1      date: 2006/07/31 19:29:44;  author: julien;  state: Exp;jboss-portal/api/src/main/org/jboss/portal/WindowState.java
  
  Index: WindowState.java
  ===================================================================
  /*
  * JBoss, Home of Professional Open Source
  * Copyright 2005, JBoss Inc., and individual contributors as indicated
  * by the @authors tag. See the copyright.txt in the distribution for a
  * full listing of individual contributors.
  *
  * This is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License as
  * published by the Free Software Foundation; either version 2.1 of
  * the License, or (at your option) any later version.
  *
  * This software is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this software; if not, write to the Free
  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  */
  package org.jboss.portal;
  
  import java.io.Serializable;
  
  /**
   * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
   * @version $Revision: 1.1 $
   */
  public class WindowState implements Serializable
  {
  
     /**
      * The serialVersionUID
      */
     private static final long serialVersionUID = -6305311518934458562L;
     public static final WindowState NORMAL = new WindowState("normal");
     public static final WindowState MINIMIZED = new WindowState("minimized");
     public static final WindowState MAXIMIZED = new WindowState("maximized");
  
     private String name;
  
     public WindowState(String name)
     {
        if (name == null)
        {
           throw new IllegalArgumentException("Window state name cannot be null.");
        }
        this.name = name;
     }
  
     public boolean equals(Object o)
     {
        if (o instanceof WindowState)
        {
           return o == this || name.equalsIgnoreCase(((WindowState)o).name);
        }
        return false;
     }
  
     public int hashCode()
     {
        return name.hashCode();
     }
  
     public String toString()
     {
        return name;
     }
  
     private Object readResolve()
     {
        if (NORMAL.name.equalsIgnoreCase(name))
        {
           return NORMAL;
        }
        else if (MAXIMIZED.name.equalsIgnoreCase(name))
        {
           return MAXIMIZED;
        }
        else if (MINIMIZED.name.equalsIgnoreCase(name))
        {
           return MINIMIZED;
        }
        else
        {
           return this;
        }
     }
  
     public static WindowState create(String s)
     {
        if (WindowState.NORMAL.toString().equalsIgnoreCase(s))
        {
           return WindowState.NORMAL;
        }
        else if (WindowState.MINIMIZED.toString().equalsIgnoreCase(s))
        {
           return WindowState.MINIMIZED;
        }
        else if (WindowState.MAXIMIZED.toString().equalsIgnoreCase(s))
        {
           return WindowState.MAXIMIZED;
        }
        else
        {
           return new WindowState(s);
        }
     }
  }
  
  
  



More information about the jboss-cvs-commits mailing list