Commit cc80c3f8 authored by Michael J Gallagher's avatar Michael J Gallagher Committed by Evan W. Patton

Reimplement delete component confirm dialog in GWT

Close #852

Change-Id: I99e8fea50b5d0632bb935183fe90c9a1b2c7bdd4
parent 61aa36dc
......@@ -212,6 +212,44 @@ public abstract class MockComponent extends Composite implements PropertyChangeL
}
}
/**
* This class defines the dialog box for deleting a component.
*/
private class DeleteDialog extends DialogBox {
DeleteDialog() {
super(false, true);
setStylePrimaryName("ode-DialogBox");
setText(MESSAGES.deleteComponentButton());
VerticalPanel contentPanel = new VerticalPanel();
contentPanel.add(new HTML(MESSAGES.reallyDeleteComponent()));
Button cancelButton = new Button(MESSAGES.cancelButton());
cancelButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
hide();
}
});
Button okButton = new Button(MESSAGES.okButton());
okButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
hide();
MockComponent.this.delete();
}
});
HorizontalPanel buttonPanel = new HorizontalPanel();
buttonPanel.add(cancelButton);
buttonPanel.add(okButton);
buttonPanel.setSize("100%", "24px");
contentPanel.add(buttonPanel);
contentPanel.setSize("320px", "100%");
add(contentPanel);
}
}
// Component database: information about components (including their properties and events)
private final SimpleComponentDatabase COMPONENT_DATABASE;
......@@ -302,9 +340,7 @@ public abstract class MockComponent extends Composite implements PropertyChangeL
@Override
public void delete() {
if (!isForm()) {
if (Window.confirm(MESSAGES.reallyDeleteComponent())) {
MockComponent.this.delete();
}
new DeleteDialog().center();
}
}
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment