1 /* 2 * ObjectExplorerInspectionResult.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 package org.rstudio.studio.client.workbench.views.source.editors.explorer.model; 16 17 import org.rstudio.core.client.JsVectorString; 18 19 import com.google.gwt.core.client.JavaScriptObject; 20 import com.google.gwt.core.client.JsArray; 21 import com.google.gwt.core.client.JsArrayString; 22 23 // NOTE: synchronize the structure of this object with the 24 // R object returned by 'explorer.createInspectionResult' 25 // defined in 'SessionObjectExplorer.R' 26 public class ObjectExplorerInspectionResult extends JavaScriptObject 27 { ObjectExplorerInspectionResult()28 protected ObjectExplorerInspectionResult() 29 { 30 } 31 getObjectAddress()32 public final native String getObjectAddress() /*-{ return this["address"]; }-*/; getObjectType()33 public final native String getObjectType() /*-{ return this["type"]; }-*/; getObjectClass()34 public final native JsArrayString getObjectClass() /*-{ return this["class"]; }-*/; getObjectLength()35 public final native int getObjectLength() /*-{ return this["length"]; }-*/; getObjectAccess()36 public final native String getObjectAccess() /*-{ return this["access"]; }-*/; 37 isRecursive()38 public final native boolean isRecursive() /*-{ return this["recursive"]; }-*/; isExpandable()39 public final native boolean isExpandable() /*-{ return this["expandable"]; }-*/; isAtomic()40 public final native boolean isAtomic() /*-{ return this["atomic"]; }-*/; isNamed()41 public final native boolean isNamed() /*-{ return this["named"]; }-*/; isS4()42 public final native boolean isS4() /*-{ return this["s4"]; }-*/; isMoreAvailable()43 public final native boolean isMoreAvailable() /*-{ return this["more"]; }-*/; 44 getDisplayName()45 public final native String getDisplayName() /*-{ return this["display"]["name"]; }-*/; getDisplayType()46 public final native String getDisplayType() /*-{ return this["display"]["type"]; }-*/; getDisplayDesc()47 public final native String getDisplayDesc() /*-{ return this["display"]["desc"]; }-*/; 48 getTags()49 public final native JsVectorString getTags() /*-{ return this["tags"] || []; }-*/; hasTag(String tag)50 public final boolean hasTag(String tag) { return getTags().indexOf(tag) != -1; } 51 getObjectAttributes()52 public final native ObjectExplorerInspectionResult getObjectAttributes() /*-{ return this["attributes"]; }-*/; setObjectAttributes(ObjectExplorerInspectionResult attributes)53 public final native void setObjectAttributes(ObjectExplorerInspectionResult attributes) /*-{ this["attributes"] = attributes; }-*/; 54 getChildren()55 public final native JsArray<ObjectExplorerInspectionResult> getChildren() /*-{ return this["children"]; }-*/; setChildren(JsArray<ObjectExplorerInspectionResult> children)56 public final native void setChildren(JsArray<ObjectExplorerInspectionResult> children) /*-{ this["children"] = children; }-*/; getNumChildren()57 public final native int getNumChildren() /*-{ return (this["children"] || []).length; }-*/; 58 } 59