-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
13 changed files
with
337 additions
and
319 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
src/main/java/org/sagebionetworks/web/client/jsinterop/EntityViewScopeEditorModalProps.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package org.sagebionetworks.web.client.jsinterop; | ||
|
||
import jsinterop.annotations.JsFunction; | ||
import jsinterop.annotations.JsNullable; | ||
import jsinterop.annotations.JsOverlay; | ||
import jsinterop.annotations.JsPackage; | ||
import jsinterop.annotations.JsType; | ||
|
||
@JsType(isNative = true, namespace = JsPackage.GLOBAL, name = "Object") | ||
public class EntityViewScopeEditorModalProps extends ReactComponentProps { | ||
|
||
@FunctionalInterface | ||
@JsFunction | ||
public interface Callback { | ||
void run(); | ||
} | ||
|
||
public String entityId; | ||
|
||
@JsNullable | ||
public Callback onUpdate; | ||
|
||
@JsNullable | ||
public Callback onCancel; | ||
|
||
public boolean open; | ||
|
||
@JsOverlay | ||
public static EntityViewScopeEditorModalProps create( | ||
String entityId, | ||
Callback onUpdate, | ||
Callback onCancel, | ||
boolean open | ||
) { | ||
EntityViewScopeEditorModalProps props = | ||
new EntityViewScopeEditorModalProps(); | ||
props.entityId = entityId; | ||
props.onUpdate = onUpdate; | ||
props.onCancel = onCancel; | ||
props.open = open; | ||
return props; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
...n/java/org/sagebionetworks/web/client/widget/entity/EntityViewScopeEditorModalWidget.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
package org.sagebionetworks.web.client.widget.entity; | ||
|
||
import com.google.gwt.user.client.ui.IsWidget; | ||
import com.google.gwt.user.client.ui.Widget; | ||
import com.google.inject.Inject; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
import org.sagebionetworks.repo.model.Reference; | ||
import org.sagebionetworks.web.client.GlobalApplicationState; | ||
import org.sagebionetworks.web.client.jsinterop.EntityViewScopeEditorModalProps; | ||
import org.sagebionetworks.web.client.jsinterop.SqlDefinedTableEditorModalProps; | ||
import org.sagebionetworks.web.client.widget.table.modal.fileview.TableType; | ||
|
||
public class EntityViewScopeEditorModalWidget implements IsWidget { | ||
|
||
private final GlobalApplicationState globalApplicationState; | ||
private final EntityViewScopeEditorModalWidgetView view; | ||
|
||
private String entityId; | ||
private EntityViewScopeEditorModalProps.Callback onCancel; | ||
private EntityViewScopeEditorModalProps.Callback onUpdate; | ||
|
||
@Inject | ||
public EntityViewScopeEditorModalWidget( | ||
EntityViewScopeEditorModalWidgetView view, | ||
GlobalApplicationState globalApplicationState | ||
) { | ||
super(); | ||
this.view = view; | ||
this.globalApplicationState = globalApplicationState; | ||
} | ||
|
||
public void configure( | ||
String entityId, | ||
EntityViewScopeEditorModalProps.Callback onUpdate, | ||
EntityViewScopeEditorModalProps.Callback onCancel | ||
) { | ||
this.entityId = entityId; | ||
this.onUpdate = onUpdate; | ||
this.onCancel = onCancel; | ||
EntityViewScopeEditorModalProps props = | ||
EntityViewScopeEditorModalProps.create( | ||
entityId, | ||
onUpdate, | ||
onCancel, | ||
false | ||
); | ||
view.renderComponent(props); | ||
} | ||
|
||
public void setOpen(boolean open) { | ||
globalApplicationState.setIsEditing(open); | ||
EntityViewScopeEditorModalProps props = | ||
EntityViewScopeEditorModalProps.create( | ||
entityId, | ||
onUpdate, | ||
onCancel, | ||
open | ||
); | ||
view.renderComponent(props); | ||
} | ||
|
||
@Override | ||
public Widget asWidget() { | ||
return view.asWidget(); | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
...va/org/sagebionetworks/web/client/widget/entity/EntityViewScopeEditorModalWidgetView.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package org.sagebionetworks.web.client.widget.entity; | ||
|
||
import com.google.gwt.user.client.ui.IsWidget; | ||
import org.sagebionetworks.web.client.jsinterop.EntityViewScopeEditorModalProps; | ||
|
||
public interface EntityViewScopeEditorModalWidgetView extends IsWidget { | ||
void renderComponent(EntityViewScopeEditorModalProps props); | ||
} |
41 changes: 41 additions & 0 deletions
41
...rg/sagebionetworks/web/client/widget/entity/EntityViewScopeEditorModalWidgetViewImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package org.sagebionetworks.web.client.widget.entity; | ||
|
||
import com.google.gwt.user.client.ui.Widget; | ||
import com.google.inject.Inject; | ||
import org.sagebionetworks.web.client.context.SynapseReactClientFullContextPropsProvider; | ||
import org.sagebionetworks.web.client.jsinterop.EntityViewScopeEditorModalProps; | ||
import org.sagebionetworks.web.client.jsinterop.React; | ||
import org.sagebionetworks.web.client.jsinterop.ReactNode; | ||
import org.sagebionetworks.web.client.jsinterop.SRC; | ||
import org.sagebionetworks.web.client.widget.ReactComponentDiv; | ||
|
||
public class EntityViewScopeEditorModalWidgetViewImpl | ||
implements EntityViewScopeEditorModalWidgetView { | ||
|
||
private final SynapseReactClientFullContextPropsProvider propsProvider; | ||
private final ReactComponentDiv reactComponentDiv; | ||
|
||
@Inject | ||
public EntityViewScopeEditorModalWidgetViewImpl( | ||
SynapseReactClientFullContextPropsProvider propsProvider | ||
) { | ||
super(); | ||
this.propsProvider = propsProvider; | ||
reactComponentDiv = new ReactComponentDiv(); | ||
} | ||
|
||
@Override | ||
public void renderComponent(EntityViewScopeEditorModalProps props) { | ||
ReactNode reactNode = React.createElementWithSynapseContext( | ||
SRC.SynapseComponents.EntityViewScopeEditorModal, | ||
props, | ||
propsProvider.getJsInteropContextProps() | ||
); | ||
reactComponentDiv.render(reactNode); | ||
} | ||
|
||
@Override | ||
public Widget asWidget() { | ||
return reactComponentDiv.asWidget(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.