1 /* 2 * RmdParamsEditEvent.java 3 * 4 * Copyright (C) 2021 by RStudio, PBC 5 * 6 * Unless you have received this program directly from RStudio pursuant 7 * to the terms of a commercial license agreement with RStudio, then 8 * this program is licensed to you under the terms of version 3 of the 9 * GNU Affero General Public License. This program is distributed WITHOUT 10 * ANY EXPRESS OR IMPLIED WARRANTY, INCLUDING THOSE OF NON-INFRINGEMENT, 11 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Please refer to the 12 * AGPL (http://www.gnu.org/licenses/agpl-3.0.txt) for more details. 13 * 14 */ 15 16 package org.rstudio.studio.client.rmarkdown.events; 17 18 import com.google.gwt.core.client.JavaScriptObject; 19 import com.google.gwt.event.shared.EventHandler; 20 import com.google.gwt.event.shared.GwtEvent; 21 22 public class ShinyGadgetDialogEvent extends GwtEvent<ShinyGadgetDialogEvent.Handler> 23 { 24 25 public static class Data extends JavaScriptObject 26 { Data()27 protected Data() 28 { 29 } 30 getCaption()31 public final native String getCaption() /*-{ 32 return this.caption; 33 }-*/; 34 getUrl()35 public final native String getUrl() /*-{ 36 return this.url; 37 }-*/; 38 getPreferredWidth()39 public final native int getPreferredWidth() /*-{ 40 return this.width; 41 }-*/; 42 getPreferredHeight()43 public final native int getPreferredHeight() /*-{ 44 return this.height; 45 }-*/; 46 } 47 48 public interface Handler extends EventHandler 49 { onShinyGadgetDialog(ShinyGadgetDialogEvent event)50 void onShinyGadgetDialog(ShinyGadgetDialogEvent event); 51 } 52 ShinyGadgetDialogEvent(Data data)53 public ShinyGadgetDialogEvent(Data data) 54 { 55 data_ = data; 56 } 57 getCaption()58 public String getCaption() 59 { 60 return data_.getCaption(); 61 } 62 getUrl()63 public String getUrl() 64 { 65 return data_.getUrl(); 66 } 67 getPreferredWidth()68 public int getPreferredWidth() 69 { 70 return data_.getPreferredWidth(); 71 } 72 getPreferredHeight()73 public int getPreferredHeight() 74 { 75 return data_.getPreferredHeight(); 76 } 77 78 @Override getAssociatedType()79 public Type<Handler> getAssociatedType() 80 { 81 return TYPE; 82 } 83 84 @Override dispatch(Handler handler)85 protected void dispatch(Handler handler) 86 { 87 handler.onShinyGadgetDialog(this); 88 } 89 90 private final Data data_; 91 92 public static final Type<Handler> TYPE = new Type<>(); 93 } 94