本文整理匯總了Java中com.vaadin.ui.Window.addCloseListener方法的典型用法代碼示例。如果您正苦於以下問題:Java Window.addCloseListener方法的具體用法?Java Window.addCloseListener怎麽用?Java Window.addCloseListener使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.vaadin.ui.Window
的用法示例。
在下文中一共展示了Window.addCloseListener方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: buildLayout
import com.vaadin.ui.Window; //導入方法依賴的package包/類
private void buildLayout() {
final HorizontalLayout footer = getFooterLayout();
uploadArtifactDetails = new VerticalLayout();
uploadArtifactDetails.setWidth(SPUIDefinitions.MIN_UPLOAD_CONFIRMATION_POPUP_WIDTH + "px");
uploadArtifactDetails.addStyleName("confirmation-popup");
uploadArtifactDetails.addComponent(uploadDetailsTable);
uploadArtifactDetails.setComponentAlignment(uploadDetailsTable, Alignment.MIDDLE_CENTER);
uploadArtifactDetails.addComponent(footer);
uploadArtifactDetails.setComponentAlignment(footer, Alignment.MIDDLE_CENTER);
window = new Window();
window.setContent(uploadArtifactDetails);
window.setResizable(Boolean.FALSE);
window.setClosable(Boolean.TRUE);
window.setDraggable(Boolean.TRUE);
window.setModal(true);
window.addCloseListener(event -> onPopupClose());
window.setCaption(i18n.getMessage("header.caption.upload.details"));
window.addStyleName(SPUIStyleDefinitions.CONFIRMATION_WINDOW_CAPTION);
}
示例2: showModalWin
import com.vaadin.ui.Window; //導入方法依賴的package包/類
public static void showModalWin(final ExtaEditForm<?> editWin) {
final Window window = new Window(editWin.getCaption(), editWin);
window.setClosable(true);
window.setModal(true);
if (editWin.getWinHeight() != Sizeable.SIZE_UNDEFINED)
window.setHeight(editWin.getWinHeight(), editWin.getWinHeightUnit());
if (editWin.getWinWidth() != Sizeable.SIZE_UNDEFINED)
window.setWidth(editWin.getWinWidth(), editWin.getWinWidthUnit());
window.addCloseListener(event -> editWin.fireCloseForm());
editWin.addCloseFormListener(event -> window.close());
if (editWin.getWinHeight() != Sizeable.SIZE_UNDEFINED && editWin.getWinWidth() != Sizeable.SIZE_UNDEFINED)
editWin.addAttachListener(e -> editWin.adjustSize());
else
new WinSizeAdjuster(editWin, window);
UI.getCurrent().addWindow(window);
}
示例3: openLogWindow
import com.vaadin.ui.Window; //導入方法依賴的package包/類
private void openLogWindow() {
Window w = new Window("Log");
w.center();
w.setWidth("80%");
w.setHeight("80%");
w.setContent(logView);
logView.setSizeFull();
UI.getCurrent().addWindow(w);
setEnabled(false);
w.addCloseListener(new CloseListener() {
@Override
public void windowClose(CloseEvent e) {
ShowLogButton.this.setEnabled(true);
}
});
}
示例4: createNotificationWindow
import com.vaadin.ui.Window; //導入方法依賴的package包/類
private void createNotificationWindow() {
notificationsWindow = new Window();
notificationsWindow.setWidth(300.0F, Unit.PIXELS);
notificationsWindow.addStyleName(STYLE_POPUP);
notificationsWindow.addStyleName(STYLE_NO_CLOSEBOX);
notificationsWindow.setClosable(true);
notificationsWindow.setResizable(false);
notificationsWindow.setDraggable(false);
notificationsWindow.setId(UIComponentIdProvider.NOTIFICATION_UNREAD_POPUP_ID);
notificationsWindow.addCloseListener(event -> refreshCaption());
notificationsWindow.addBlurListener(this::closeWindow);
}
示例5: getDeleteConfirmWindow
import com.vaadin.ui.Window; //導入方法依賴的package包/類
private Window getDeleteConfirmWindow(DeviceDTO deviceDTO) {
final String[] exportFileName = {""};
Window confirmWindow = new Window("Delete");
confirmWindow.setResizable(false);
confirmWindow.setModal(true);
confirmWindow.setDraggable(false);
confirmWindow.setClosable(true);
confirmWindow.addCloseListener(e -> {
if (!exportFileName[0].isEmpty()) {
new File(exportFileName[0]).delete();
}
});
Label areYouSureLabel = new Label("Are you sure you want to delete the device?");
Label ifWantExport = new Label("If you wish, you can export all recorded data for the device.");
VerticalLayout contentLayout = new VerticalLayout(areYouSureLabel, ifWantExport);
Button saveAndDeleteButton = new Button("Export and Delete", event -> {
exportFileName[0] =
statisticDeviceDataService
.exportDataToCsv(deviceDTO.getDevId(), deviceDTO.getType(), deviceDTO.getName());
if (!exportFileName[0].isEmpty()) {
contentLayout.addComponent(new Link("Download export, click before exiting!",
new FileResource(new File(exportFileName[0]))));
deleteDevice(deviceDTO);
} else {
contentLayout.addComponent(
new Label("Export failed, please try again! The device has not been deleted."));
}
});
Button deleteOnly = new Button("Delete only", event -> {
deleteDevice(deviceDTO);
confirmWindow.close();
});
confirmWindow.setContent(
new VerticalLayout(contentLayout, new HorizontalLayout(saveAndDeleteButton, deleteOnly)));
return confirmWindow;
}
示例6: getExportWindow
import com.vaadin.ui.Window; //導入方法依賴的package包/類
private Window getExportWindow() {
final String[] fileName = {""};
Window selectWindow = new Window("Export data");
selectWindow.setClosable(true);
selectWindow.setDraggable(false);
selectWindow.setModal(true);
selectWindow.setResizable(false);
selectWindow.setWidth(300, Unit.PIXELS);
selectWindow.addCloseListener(e -> {
if (!fileName[0].isEmpty()) {
new File(fileName[0]).delete();
}
});
VerticalLayout windowRoot = new VerticalLayout();
ComboBox devicesComboBox = new ComboBox("Devices");
devicesComboBox.setWidth(100, Unit.PERCENTAGE);
devicesComboBox.setNullSelectionItemId(false);
devicesComboBox.setContainerDataSource(
new BeanItemContainer<>(
DeviceViewDTO.class,
deviceSetupService.getAllDeviceDtos().stream()
.map(deviceDTO ->
new DeviceViewDTO(deviceDTO.getDevId(), deviceDTO.getType(),
deviceDTO.getName()))
.collect(Collectors.toList())
)
);
windowRoot.addComponent(devicesComboBox);
Button toExportButton = new Button("Export", event -> {
DeviceViewDTO selectedDto = (DeviceViewDTO) devicesComboBox.getValue();
fileName[0] =
statisticDeviceDataService.exportDataToCsv(selectedDto.getDevId(), selectedDto.getType(),
selectedDto.getName());
if (!fileName[0].isEmpty()) {
windowRoot
.addComponent(new Link("Download CSV", new FileResource(new File(fileName[0]))));
} else {
windowRoot.addComponent(new Label("Export failed! Please Try again!"));
}
});
windowRoot.addComponent(toExportButton);
selectWindow.setContent(windowRoot);
return selectWindow;
}
示例7: showEditFilterPopup
import com.vaadin.ui.Window; //導入方法依賴的package包/類
private void showEditFilterPopup() {
final Window popup = new Window();
popup.setWidth("400px");
popup.setHeight("400px");
popup.center();
popup.setModal(true);
VerticalLayout cont = new VerticalLayout();
cont.setMargin(true);
cont.setSpacing(true);
final FilterEditor<B> editCopy = theEditor.getCopy();
cont.addComponent(editCopy.getFilterEditView());
popup.setContent(cont);
popup.addCloseListener(new CloseListener() {
/**
*
*/
private static final long serialVersionUID = 8568957374426173040L;
@Override
public void windowClose(CloseEvent e) {
updateLayout();
}
});
// edit's are committed only if OK-button is clicked and
// editor's checkAndNotify returns true;
// closing the popup with other methods effectively cancel
// any edits done
Button okButton = StandardUIFactory.getOKButton(localizer);
okButton.addClickListener(new ClickListener() {
/**
*
*/
private static final long serialVersionUID = -6979725003624509202L;
@Override
public void buttonClick(ClickEvent event) {
if (editCopy.checkAndNotify()) {
UI.getCurrent().removeWindow(popup);
updateBackingEditor(editCopy);
}
}
});
cont.addComponent(okButton);
UI.getCurrent().addWindow(popup);
}
示例8: getRTableWindow
import com.vaadin.ui.Window; //導入方法依賴的package包/類
/**
* Generate a preview Window of R data.frame with Excel download option.
*
* @param rs
* R string which evaluates into R data.frame
* @param caption
* Window caption
* @param maxRows
* Maximum number of rows shown in the window. Value null uses
* the internal default.
* @param width
* Explicit width of the table, or null for automatic width.
* @return Vaadin Window
*/
public Window getRTableWindow(String rs, String caption, Integer maxRows,
String width) {
final Integer DEFAULT_MAX_ROWS = 15;
/* Initiate a new SpreadSheetFacotry, if it does not exist already */
if (ssf == null) {
ssf = new SpreadSheetFactory();
}
/* Initiate the Table showing the data.frame */
RTable table = getRTable(rs);
/* Show only part of large tables */
if (maxRows == null) {
maxRows = DEFAULT_MAX_ROWS;
}
if (table.getDataFrame().nrow() >= maxRows) {
table.setPageLength(maxRows);
table.setCacheRate(2.0);
}
if (width != null) {
table.setWidth(width);
}
DataFrame df = table.getDataFrame();
String[] columnNames = table.getColumnNames();
/* The element with XLSX download button */
final SpreadSheetDownload ssd = new SpreadSheetDownload(df,
columnNames, null, null, ssf);
HorizontalLayout ssdBox = new HorizontalLayout();
ssdBox.setHeight("23px");
ssdBox.addComponent(ssd);
Window window = new Window(caption);
VerticalLayout root = new VerticalLayout();
root.setSpacing(true);
root.setMargin(true);
window.setContent(root);
root.addComponent(ssdBox);
root.addComponent(table);
@SuppressWarnings("serial")
Window.CloseListener windowListener = new Window.CloseListener() {
@Override
public void windowClose(CloseEvent e) {
/* Delete the XLSX file, if it was generated */
ssd.clear();
}
};
window.addCloseListener(windowListener);
return window;
}