Skip to content
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

#7461 fix for displaying EasyForm in OutputContainer for JVM kernels #7691

Merged
merged 2 commits into from
Jul 17, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
import com.twosigma.beakerx.easyform.formitem.widgets.ComboBoxWidget;
import com.twosigma.beakerx.easyform.formitem.widgets.DatePickerComponentWidget;
import com.twosigma.beakerx.easyform.formitem.widgets.PasswordWidget;
import com.twosigma.beakerx.easyform.formitem.widgets.RadioButtonComponentWidget;
import com.twosigma.beakerx.easyform.formitem.widgets.SelectMultipleSingleWidget;
import com.twosigma.beakerx.easyform.formitem.widgets.SelectMultipleWidget;
import com.twosigma.beakerx.easyform.formitem.widgets.RadioButtonComponentWidget;
import com.twosigma.beakerx.easyform.formitem.widgets.TextAreaWidget;
import com.twosigma.beakerx.easyform.formitem.widgets.TextFieldWidget;
import com.twosigma.beakerx.widget.DOMWidget;
Expand Down Expand Up @@ -375,12 +375,16 @@ public void setNotReady() {
this.ready = Boolean.FALSE;
}

public EasyFormView getView(){
EasyFormView easyFormView = new EasyFormView(this.getCommFunctionalities());
easyFormView.setEasyFormName(this.getCaption());
return easyFormView;
}

@Override
public void display() {
this.setReady();
EasyFormView easyFormView = new EasyFormView(this.getCommFunctionalities());
easyFormView.setEasyFormName(this.getCaption());
easyFormView.display();
this.getView().display();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@
package com.twosigma.beakerx.jvm.object;

import com.twosigma.beakerx.MIMEContainerFactory;
import com.twosigma.beakerx.easyform.EasyForm;
import com.twosigma.beakerx.mimetype.MIMEContainer;
import com.twosigma.beakerx.widget.Widget;
import com.twosigma.beakerx.widget.HTML;
import com.twosigma.beakerx.widget.HTMLPre;
import com.twosigma.beakerx.widget.Widget;

import java.util.List;
import java.util.Optional;
Expand Down Expand Up @@ -54,6 +55,9 @@ private Optional<Widget> toWidget(Object item) {
if (item == null) {
return handleNull();
}
if (item instanceof EasyForm) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest create an interface "WidgetItem" with getAsWIdget() method,
then EasyForm and Widget should implement the interface.
This will allow us to get rid of "if statement" for Widget and EasyForm.

return of(((EasyForm) item).getView());
}
Widget widget = MIMEContainerFactory.getTableDisplay(item);
if (widget != null) {
return of(widget);
Expand Down