/*
 * ProjectUserChangedEvent.java
 *
 * Copyright (C) 2009-15 by RStudio, Inc.
 *
 * Unless you have received this program directly from RStudio pursuant
 * to the terms of a commercial license agreement with RStudio, then
 * this program is licensed to you under the terms of version 3 of the
 * GNU Affero General Public License. This program is distributed WITHOUT
 * ANY EXPRESS OR IMPLIED WARRANTY, INCLUDING THOSE OF NON-INFRINGEMENT,
 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Please refer to the
 * AGPL (http://www.gnu.org/licenses/agpl-3.0.txt) for more details.
 *
 */

package org.rstudio.studio.client.projects.events;

import org.rstudio.studio.client.projects.model.ProjectUser;

import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.GwtEvent;

public class ProjectUserChangedEvent 
   extends GwtEvent<ProjectUserChangedEvent.Handler>
{
   public static class Data extends JavaScriptObject
   {
      protected Data()
      {
      }
      
      public final native String getChangeType() /*-{
         return this.change_type;
      }-*/;
      
      public final native ProjectUser getUser() /*-{
         return this.user;
      }-*/;
   }

   public interface Handler extends EventHandler
   {
      void onProjectUserChanged(ProjectUserChangedEvent event);
   }
   
   public ProjectUserChangedEvent(Data data)
   {
      data_ = data;
   }
   
   public String getChangeType()
   {
      return data_.getChangeType();
   }

   public ProjectUser getUser()
   {
      return data_.getUser();
   }

   @Override
   public Type<Handler> getAssociatedType()
   {
      return TYPE;
   }

   @Override
   protected void dispatch(Handler handler)
   {
      handler.onProjectUserChanged(this);
   }
   
   private final Data data_;
   
   public static final String JOINED = "joined";
   public static final String LEFT = "left";

   public static final Type<Handler> TYPE = new Type<Handler>();
}
@@ -754,16 +754,59 @@
 Object;%0A
+import com.google.gwt.core.client.JsArray;%0A
 import c
@@ -1222,16 +1222,24 @@
  native 
+JsArray%3C
 ProjectU
@@ -1241,24 +1241,25 @@
 jectUser
+%3E
  getUser
 () /*-%7B%0A
@@ -1250,16 +1250,17 @@
  getUser
+s
 () /*-%7B%0A
@@ -1284,16 +1284,17 @@
 his.user
+s
 ;%0A      
@@ -1593,32 +1593,40 @@
    %7D%0A%0A   public 
+JsArray%3C
 ProjectUser getU
@@ -1620,24 +1620,25 @@
 jectUser
+%3E
  getUser
 ()%0A   %7B%0A
@@ -1629,16 +1629,17 @@
  getUser
+s
 ()%0A   %7B%0A
@@ -1664,16 +1664,17 @@
 .getUser
+s
 ();%0A   %7D
@@ -1945,16 +1945,18 @@
  JOINED 
+  
 = %22joine
@@ -1994,16 +1994,20 @@
 ng LEFT 
+    
 = %22left%22
@@ -2007,16 +2007,69 @@
  %22left%22;
+%0A   public static final String REPLACED = %22replaced%22;
 %0A%0A   pub

prepare for batched project user status events