-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SWC-7064, SWC-7092 - Use Elemental2 for JsInterop models #5559
Conversation
@@ -43,10 +43,6 @@ public LayoutResult nChartlayout( | |||
|
|||
public void setPageDescription(String newDescription); | |||
|
|||
public JavaScriptObject getFileList(String fileFieldId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved these to a new SynapseJsInteropUtils
interface & class
import jsinterop.base.Js; | ||
import org.sagebionetworks.web.client.callback.MD5Callback; | ||
|
||
public class SynapseJsInteropUtilsImpl implements SynapseJsInteropUtils { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rewrote all of these from JSNI to JsInterop using the Elemental2 classes
@Override | ||
public String getWebkitRelativePath(FileList fileList, double index) { | ||
return (String) Js | ||
.asPropertyMap(fileList.item(index)) | ||
.get("webkitRelativePath"); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Elemental2's File
model does not surface the webkitRelativePath
field, but we can easily get it with Js.asPropertyMap(obj).get("key")
src/main/java/org/sagebionetworks/web/client/widget/aws/AwsSdk.java
Outdated
Show resolved
Hide resolved
src/main/java/org/sagebionetworks/web/client/SynapseJSNIUtilsImpl.java
Outdated
Show resolved
Hide resolved
src/main/java/org/sagebionetworks/web/client/GlobalApplicationStateImpl.java
Outdated
Show resolved
Hide resolved
src/main/java/org/sagebionetworks/web/client/widget/upload/CroppedImageUploadViewImpl.java
Outdated
Show resolved
Hide resolved
src/main/java/org/sagebionetworks/web/client/widget/upload/ImageUploadViewImpl.java
Outdated
Show resolved
Hide resolved
src/main/java/org/sagebionetworks/web/client/GlobalApplicationStateImpl.java
Outdated
Show resolved
Hide resolved
src/main/java/org/sagebionetworks/web/client/widget/upload/ImageUploadViewImpl.java
Outdated
Show resolved
Hide resolved
File blob = fileList.item(this.currIndex); | ||
long fileSize = blob.size; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In many cases where it was more simple, I just replaced calls on utils methods with direct calls to the new JsInterop methods
<dependency> | ||
<groupId>com.google.elemental2</groupId> | ||
<artifactId>elemental2-core</artifactId> | ||
<version>1.2.2</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>com.google.elemental2</groupId> | ||
<artifactId>elemental2-dom</artifactId> | ||
<version>1.2.2</version> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Elemental2 provides JsInterop bindings for browser APIs.
To support SWC-7064, SWC-7092, we will have to update logic related to File uploads. Instead of manipulating JSNI code, I opted to