Skip to content

Commit

Permalink
#6945: display plot in output widget (#7001)
Browse files Browse the repository at this point in the history
  • Loading branch information
jaroslawmalekcodete authored and scottdraves committed Mar 21, 2018
1 parent 094ebb4 commit 39ac4d3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,6 @@ protected void sendModelUpdate() {
this.updateModel.update(MODEL_UPDATE, serializeToJsonObject());
}

@Override
public void display() {
beforeDisplay();
super.display();
}

private void enableModelUpdate() {
updateModel = (action, item) -> sendUpdate(action, item);
}
Expand All @@ -89,7 +83,8 @@ public void activateWidgetInContainer() {
super.activateWidgetInContainer();
}

private void beforeDisplay() {
@Override
public void beforeDisplay() {
enableModelUpdate();
sendModel();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ public void display(MIMEContainer mimeContainer) {
}

public void display(Widget widget) {
widget.beforeDisplay();
HashMap<String, Serializable> content = new HashMap<>();
HashMap<String, Serializable> vendor = new HashMap<>();
vendor.put(MODEL_ID, widget.getComm().getCommId());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,13 @@ public void close() {

@Override
public void display() {
beforeDisplay();
sendDisplay();
}

protected void beforeDisplay() {
}

private void sendDisplay() {
HashMap<String, Serializable> content = new HashMap<>();
HashMap<String, Serializable> data = new HashMap<>();
Expand All @@ -96,7 +100,7 @@ private void sendDisplay() {
data.put(MODEL_ID, getComm().getCommId());
content.put(METHOD, DISPLAY);
content.put(APPLICATION_VND_JUPYTER_WIDGET_VIEW_JSON, data);
getComm().send(DISPLAY_DATA,new Comm.Data(content));
getComm().send(DISPLAY_DATA, new Comm.Data(content));
}

private HashMap<String, Serializable> createContent() {
Expand Down

0 comments on commit 39ac4d3

Please sign in to comment.