1 /*
2  * RenderRmdEvent.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 org.rstudio.core.client.js.JavaScriptSerializable;
19 import org.rstudio.studio.client.application.events.CrossWindowEvent;
20 
21 import com.google.gwt.event.shared.EventHandler;
22 
23 @JavaScriptSerializable
24 public class RenderRmdEvent extends CrossWindowEvent<RenderRmdEvent.Handler>
25 {
26    public interface Handler extends EventHandler
27    {
onRenderRmd(RenderRmdEvent event)28       void onRenderRmd(RenderRmdEvent event);
29    }
30 
RenderRmdEvent()31    public RenderRmdEvent()
32    {
33    }
34 
RenderRmdEvent(String sourceFile, int sourceLine, String format, String encoding, String paramsFile, boolean asTempfile, int type, String existingOutputFile, String workingDirectory, String viewerType)35    public RenderRmdEvent(String sourceFile,
36                          int sourceLine,
37                          String format,
38                          String encoding,
39                          String paramsFile,
40                          boolean asTempfile,
41                          int type,
42                          String existingOutputFile,
43                          String workingDirectory,
44                          String viewerType)
45    {
46       sourceFile_ = sourceFile;
47       sourceLine_ = sourceLine;
48       format_ = format;
49       encoding_ = encoding;
50       paramsFile_ = paramsFile;
51       asTempfile_ = asTempfile;
52       type_ = type;
53       existingOutputFile_ = existingOutputFile;
54       workingDirectory_ = workingDirectory;
55       viewerType_ = viewerType;
56    }
57 
getSourceFile()58    public String getSourceFile()
59    {
60       return sourceFile_;
61    }
62 
getSourceLine()63    public int getSourceLine()
64    {
65       return sourceLine_;
66    }
67 
getFormat()68    public String getFormat()
69    {
70       return format_;
71    }
72 
getEncoding()73    public String getEncoding()
74    {
75       return encoding_;
76    }
77 
getParamsFile()78    public String getParamsFile()
79    {
80       return paramsFile_;
81    }
82 
asTempfile()83    public boolean asTempfile()
84    {
85       return asTempfile_;
86    }
87 
getType()88    public int getType()
89    {
90       return type_;
91    }
92 
getExistingOutputFile()93    public String getExistingOutputFile()
94    {
95       return existingOutputFile_;
96    }
97 
getWorkingDir()98    public String getWorkingDir()
99    {
100       return workingDirectory_;
101    }
102 
getViewerType()103    public String getViewerType()
104    {
105       return viewerType_;
106    }
107 
108    @Override
getAssociatedType()109    public Type<Handler> getAssociatedType()
110    {
111       return TYPE;
112    }
113 
114    @Override
dispatch(Handler handler)115    protected void dispatch(Handler handler)
116    {
117       handler.onRenderRmd(this);
118    }
119 
120    private String sourceFile_;
121    private int sourceLine_;
122    private String format_;
123    private String encoding_;
124    private String paramsFile_;
125    private boolean asTempfile_;
126    private int type_;
127    private String existingOutputFile_;
128    private String workingDirectory_;
129    private String viewerType_;
130 
131    public final static String WORKING_DIR_PROP = "working_dir";
132 
133    public static final Type<Handler> TYPE = new Type<>();
134 }
135