本文整理匯總了Java中com.vaadin.ui.Window.setClosable方法的典型用法代碼示例。如果您正苦於以下問題:Java Window.setClosable方法的具體用法?Java Window.setClosable怎麽用?Java Window.setClosable使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.vaadin.ui.Window
的用法示例。
在下文中一共展示了Window.setClosable方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createLayout
import com.vaadin.ui.Window; //導入方法依賴的package包/類
private void createLayout() {
final HorizontalLayout footer = new HorizontalLayout();
footer.setSizeUndefined();
footer.addStyleName("confirmation-window-footer");
footer.setSpacing(true);
footer.setMargin(false);
footer.addComponents(closeBtn);
footer.setComponentAlignment(closeBtn, Alignment.TOP_CENTER);
final VerticalLayout uploadResultDetails = new VerticalLayout();
uploadResultDetails.setWidth(SPUIDefinitions.MIN_UPLOAD_CONFIRMATION_POPUP_WIDTH + "px");
uploadResultDetails.addStyleName("confirmation-popup");
uploadResultDetails.addComponent(uploadResultTable);
uploadResultDetails.setComponentAlignment(uploadResultTable, Alignment.MIDDLE_CENTER);
uploadResultDetails.addComponent(footer);
uploadResultDetails.setComponentAlignment(footer, Alignment.MIDDLE_CENTER);
uploadResultsWindow = new Window();
uploadResultsWindow.setContent(uploadResultDetails);
uploadResultsWindow.setResizable(Boolean.FALSE);
uploadResultsWindow.setClosable(Boolean.FALSE);
uploadResultsWindow.setDraggable(Boolean.TRUE);
uploadResultsWindow.setModal(true);
uploadResultsWindow.setCaption(SPUILabelDefinitions.UPLOAD_RESULT);
uploadResultsWindow.addStyleName(SPUIStyleDefinitions.CONFIRMATION_WINDOW_CAPTION);
}
示例2: 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);
}
示例3: buildWindow
import com.vaadin.ui.Window; //導入方法依賴的package包/類
/**
* Build window based on type.
*
* @return Window
*/
public Window buildWindow() {
final Window window = new Window(caption);
window.setContent(content);
window.setSizeUndefined();
window.setModal(true);
window.setResizable(false);
decorateWindow(window);
if (SPUIDefinitions.CREATE_UPDATE_WINDOW.equals(type)) {
window.setClosable(false);
}
return window;
}
示例4: 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);
}
示例5: attach
import com.vaadin.ui.Window; //導入方法依賴的package包/類
@Override
public void attach() {
super.attach();
loginWindow = new Window();
// create view bound form
VerticalLayout content = buildMainLayout();
content.setMargin(false);
loginWindow.setContent(content);
loginWindow.center();
loginWindow.setCaption(getI18N().getMessage("com.thingtrack.konekti.view.web.workbench.SecurityAccessView.loginWindow.caption"));
loginWindow.setModal(true);
loginWindow.setResizable(false);
loginWindow.setClosable(false);
User loginUser = new User();
BeanItem<User> userBean = new BeanItem<User>(loginUser);
viewBoundForm.setItemDataSource(userBean);
getWindow().addWindow(loginWindow);
}
示例6: showArtifactDetailsWindow
import com.vaadin.ui.Window; //導入方法依賴的package包/類
private void showArtifactDetailsWindow(final Long itemId, final String nameVersionStr) {
final Window artifactDtlsWindow = new Window();
artifactDtlsWindow.setCaption(HawkbitCommonUtil.getArtifactoryDetailsLabelId(nameVersionStr));
artifactDtlsWindow.setCaptionAsHtml(true);
artifactDtlsWindow.setClosable(true);
artifactDtlsWindow.setResizable(true);
artifactDtlsWindow.setImmediate(true);
artifactDtlsWindow.setWindowMode(WindowMode.NORMAL);
artifactDtlsWindow.setModal(true);
artifactDtlsWindow.addStyleName(SPUIStyleDefinitions.CONFIRMATION_WINDOW_CAPTION);
artifactDetailsLayout.setFullWindowMode(false);
artifactDetailsLayout.populateArtifactDetails(itemId, nameVersionStr);
/* Now add table to the window */
artifactDetailsLayout.getArtifactDetailsTable().setWidth(700, Unit.PIXELS);
artifactDetailsLayout.getArtifactDetailsTable().setHeight(500, Unit.PIXELS);
artifactDtlsWindow.setContent(artifactDetailsLayout.getArtifactDetailsTable());
/* Create maximized view of the table */
artifactDtlsWindow.addWindowModeChangeListener(
event -> {
if (event.getWindowMode() == WindowMode.MAXIMIZED) {
artifactDtlsWindow.setSizeFull();
artifactDetailsLayout.setFullWindowMode(true);
artifactDetailsLayout.createMaxArtifactDetailsTable();
artifactDetailsLayout.getMaxArtifactDetailsTable().setWidth(100, Unit.PERCENTAGE);
artifactDetailsLayout.getMaxArtifactDetailsTable().setHeight(100, Unit.PERCENTAGE);
artifactDtlsWindow.setContent(artifactDetailsLayout.getMaxArtifactDetailsTable());
} else {
artifactDtlsWindow.setSizeUndefined();
artifactDtlsWindow.setContent(artifactDetailsLayout.getArtifactDetailsTable());
}
});
/* display the window */
UI.getCurrent().addWindow(artifactDtlsWindow);
}
示例7: decorateWindow
import com.vaadin.ui.Window; //導入方法依賴的package包/類
private void decorateWindow(final Window window) {
if (id != null) {
window.setId(id);
}
if (SPUIDefinitions.CONFIRMATION_WINDOW.equals(type)) {
window.setDraggable(false);
window.setClosable(true);
window.addStyleName(SPUIStyleDefinitions.CONFIRMATION_WINDOW_CAPTION);
} else if (SPUIDefinitions.CREATE_UPDATE_WINDOW.equals(type)) {
window.setDraggable(true);
window.setClosable(true);
}
}
示例8: 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);
}
示例9: shapeFileUploadedEvent
import com.vaadin.ui.Window; //導入方法依賴的package包/類
@Override
public void shapeFileUploadedEvent(final String filename, final ByteArrayInputStream input) {
final Window modal = new Window("Wait");
final Window mainWindow = (ExpressZipWindow) setupMapView.getApplication().getMainWindow();
final SetupMapPresenter presenter = this;
Thread spinner = new Thread(new Runnable() {
public void run() {
ProgressIndicator pi = new ProgressIndicator();
pi.setCaption("Processing Shapefile...");
modal.setModal(true);
modal.setClosable(false);
modal.setResizable(false);
modal.getContent().setSizeUndefined(); // trick to size around content
modal.getContent().addComponent(pi);
modal.setWidth(modal.getWidth(), modal.getWidthUnits());
mainWindow.addWindow(modal);
VectorLayer uploadedShapeFile = setupMapModel.shapeFileUploaded(filename, input);
if (uploadedShapeFile != null) {
shapeFileLayer = uploadedShapeFile;
mapModel.addVectorLayer(shapeFileLayer);
setupMapView.updateShapeLayer(shapeFileLayer);
mapModel.updateOpenLayersMap();
Bounds shpFileBounds = shapeFileLayer.getBoundsForLayer(mapModel.getCurrentProjection());
resetExtentLayer(shpFileBounds, presenter);
map.addLayer(boundingBoxLayer);
}
mainWindow.removeWindow(modal);
}
});
spinner.start();
}
示例10: startProcessor
import com.vaadin.ui.Window; //導入方法依賴的package包/類
protected void startProcessor() {
final ProgressBar progressBar = new ProgressBar();
progressBar.setWidth(400, Unit.PIXELS);
final Window progressWindow = new Window("Progress", progressBar);
progressWindow.setClosable(false);
progressWindow.setResizable(false);
progressWindow.center();
new Thread(new Runnable() {
@Override
public void run() {
new Processor(new ProgressListener() {
@Override
public void onProgress(final long progress) {
UI.getCurrent().access(new Runnable() {
@Override
public void run() {
// 0 .. 1
final float progressBarValue = (float) progress / Processor.MAX_PROGRESS;
progressBar.setValue(progressBarValue);
if (progress == Processor.MAX_PROGRESS) {
UI.getCurrent().setPollInterval(-1);
UI.getCurrent().removeWindow(progressWindow);
}
}
});
}
}).run();
}
}).start();
UI.getCurrent().setPollInterval(250);
UI.getCurrent().addWindow(progressWindow);
}
示例11: addWorkbenchContent
import com.vaadin.ui.Window; //導入方法依賴的package包/類
/**
* Adds the given component as a tab or window acordingly to current visualizacion settings.
* @param component component to add.
* @param caption Tab or Window caption.
* @param icon Tab or Window icon.
* @param closable true if the user can close the tab or window.
* @param confirmClosing true to show a confirmation dialog before closing the tab or window.
*/
public void addWorkbenchContent(Component component, String caption, Resource icon, boolean closable, boolean confirmClosing) {
component.setSizeFull();
if(windowsMenuItem != null && !windowsMenuItem.isVisible()) {
VerticalLayout layout = new VerticalLayout();
layout.setSizeFull();
layout.setMargin(false);
layout.addComponent(component);
Window window = new Window(caption);
window.setIcon(icon);
window.setClosable(closable);
window.setContent(layout);
window.setWidth("80%");
window.setHeight("80%");
window.getContent().setSizeFull();
placeWindow(window);
UI.getCurrent().addWindow(window);
} else {
Tab tab = tabsheet.addTab(component, caption, icon);
tab.setClosable(closable);
tabsheet.setSelectedTab(component);
}
if(confirmClosing) {
confirmClosingComponents.add(component);
}
}
示例12: displayVaadinErrorWindow
import com.vaadin.ui.Window; //導入方法依賴的package包/類
private void displayVaadinErrorWindow(final String causeClass, final String id, final Date time,
final String finalId, final String finalTrace, final String reference)
{
// generate screen shot!
final Window window = new Window();
final Screenshot screenshot = Screenshot.newBuilder().withLogging(true).withMimeType(ScreenshotMimeType.PNG)
.build();
screenshot.addScreenshotListener(new ScreenshotListener()
{
@Override
public void screenshotComplete(ScreenshotImage image)
{
image.getImageData();
showWindow(causeClass, id, time, finalId, finalTrace, reference, image.getImageData());
window.close();
}
});
window.setContent(screenshot);
window.setClosable(false);
window.setResizable(false);
UI.getCurrent().addWindow(window);
screenshot.setTargetComponent(null);
screenshot.takeScreenshot();
}
示例13: 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;
}
示例14: 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;
}
示例15: check
import com.vaadin.ui.Window; //導入方法依賴的package包/類
public void check() {
steps[currentStep].answered = true;
steps[currentStep].correct = exec.isCorrect(currentStep);
navigator.setCheckButtonEnabled(retriable);
if (currentStep < steps.length - 1) {
navigator.setNextButtonEnabled(true);
navigator.focusNext();
} else {
final Window confirm = new Window(localizer
.getUIText(UIConstants.SUBMIT_QUESTION));
confirm.setModal(true);
confirm.setWidth("600px");
confirm.setHeight("330px");
confirm.setCaption("");
confirm.setStyleName("opaque");
confirm.addStyleName("unclosable-window");
confirm.setClosable(false);
confirm.addStyleName("submit-window");
VerticalLayout content = new VerticalLayout();
content.setSizeFull();
content.setMargin(true);
Label question = new Label(localizer
.getUIText(UIConstants.SUBMIT_QUESTION));
question.setContentMode(ContentMode.HTML);
question.addStyleName("big-text-white");
question.setSizeUndefined();
content.addComponent(question);
content.setComponentAlignment(question,
Alignment.TOP_CENTER);
confirm.setContent(content);
// Button holder (back to round, replay, next)
HorizontalLayout buttons = new HorizontalLayout();
buttons.addStyleName("submit-buttons-container");
buttons.setWidth("100%");
buttons.setSpacing(true);
content.addComponent(buttons);
content.setComponentAlignment(buttons,
Alignment.TOP_CENTER);
Button submit = StandardUIFactory
.getRoundButton(Icon.SUBMIT);
submit.setDescription(
localizer.getUIText(UIConstants.SUBMIT));
Button cancel = StandardUIFactory
.getRoundButton(Icon.CLOSE);
cancel.setDescription(
localizer.getUIText(UIConstants.CLOSE));
buttons.addComponents(submit, cancel);
buttons.setComponentAlignment(submit,
Alignment.MIDDLE_CENTER);
buttons.setComponentAlignment(cancel,
Alignment.MIDDLE_CENTER);
submit.addClickListener(e -> {
exec.askSubmit(StandardSubmissionType.NORMAL);
confirm.close();
});
cancel.addClickListener(e -> confirm.close());
UI.getCurrent().addWindow(confirm);
}
}