2020-11-20 18:10:43 +01:00
|
|
|
package org.gcube.portlets.user.geoportaldataviewer.client.ui;
|
|
|
|
|
|
|
|
import com.github.gwtbootstrap.client.ui.Button;
|
|
|
|
import com.github.gwtbootstrap.client.ui.Modal;
|
|
|
|
import com.github.gwtbootstrap.client.ui.ModalFooter;
|
|
|
|
import com.google.gwt.event.dom.client.ClickEvent;
|
|
|
|
import com.google.gwt.event.dom.client.ClickHandler;
|
|
|
|
import com.google.gwt.user.client.ui.Widget;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The Class ModalWindow.
|
|
|
|
*
|
|
|
|
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
|
|
|
*
|
|
|
|
* Nov 20, 2020
|
|
|
|
*/
|
|
|
|
public class ModalWindow {
|
|
|
|
|
|
|
|
private Modal modal;
|
|
|
|
private Object caller;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Instantiates a new modal window.
|
|
|
|
*
|
|
|
|
* @param title the title
|
2020-12-28 17:55:06 +01:00
|
|
|
* @param width the width
|
|
|
|
* @param maxHeight the max height
|
2020-11-20 18:10:43 +01:00
|
|
|
*/
|
2020-12-28 17:55:06 +01:00
|
|
|
public ModalWindow(String title, int width, int maxHeight) {
|
2020-11-20 18:10:43 +01:00
|
|
|
|
|
|
|
modal = new Modal(false);
|
|
|
|
modal.hide(false);
|
|
|
|
modal.setTitle(title);
|
|
|
|
modal.setCloseVisible(true);
|
2020-12-28 17:55:06 +01:00
|
|
|
modal.setWidth(width);
|
|
|
|
modal.setMaxHeigth(maxHeight+"px");
|
2020-11-20 18:10:43 +01:00
|
|
|
|
|
|
|
ModalFooter modalFooter = new ModalFooter();
|
|
|
|
final Button buttClose = new Button("Close");
|
|
|
|
modalFooter.add(buttClose);
|
|
|
|
|
|
|
|
buttClose.addClickHandler(new ClickHandler() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onClick(ClickEvent event) {
|
|
|
|
modal.hide();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
modal.add(modalFooter);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
public void add(Widget toAdd) {
|
|
|
|
modal.add(toAdd);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setCaller(Object caller) {
|
|
|
|
this.caller = caller;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void show() {
|
|
|
|
modal.show();
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setWidth(int width) {
|
|
|
|
modal.setWidth(width);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|