本文整理汇总了Java中com.vaadin.ui.Window.close方法的典型用法代码示例。如果您正苦于以下问题:Java Window.close方法的具体用法?Java Window.close怎么用?Java Window.close使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.vaadin.ui.Window
的用法示例。
在下文中一共展示了Window.close方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: saveAttendeeAndPrePrintBadge
import com.vaadin.ui.Window; //导入方法依赖的package包/类
public void saveAttendeeAndPrePrintBadge(Window window, Attendee attendee) {
try {
if (view.currentUserHasRight("attendee_edit")) {
attendeeValidator.validate(attendee); // Only validate fields if the user actually has the ability to edit them
}
attendee.addHistoryEntry(view.getCurrentUser(), "Pre-printed badge");
attendee.setBadgePrePrinted(true);
attendee = attendeeRepository.save(attendee);
log.info("{} saved {}", view.getCurrentUsername(), attendee);
view.refresh();
} catch (ValidationException e) {
view.notifyError(e.getMessage());
log.error("{} tried to save {} and got error {}", view.getCurrentUsername(), attendee, e.getMessage());
return;
}
window.close();
List<Attendee> attendeeList = new ArrayList<>();
attendeeList.add(attendee);
if (view.currentUserHasRight("pre_print_badges")) {
log.info("{} pre-printing badge(s) for {}", view.getCurrentUsername(), attendee);
showAttendeeBadgeWindow(view, attendeeList, true);
}
}
示例2: commit
import com.vaadin.ui.Window; //导入方法依赖的package包/类
private void commit(final Window win, final Binder<? extends AbstractStep> binder,
final NativeSelect<Step> parentStepSelect) {
AbstractStep step = binder.getBean();
gantt.markStepDirty(step);
if (parentStepSelect.isEnabled() && parentStepSelect.getValue() != null) {
SubStep subStep = addSubStep(parentStepSelect, step);
step = subStep;
}
if (step instanceof Step && !gantt.getSteps().contains(step)) {
gantt.addStep((Step) step);
}
if (ganttListener != null && step instanceof Step) {
ganttListener.stepModified((Step) step);
}
win.close();
}
示例3: delete
import com.vaadin.ui.Window; //导入方法依赖的package包/类
private void delete(final Window win, final Binder<? extends AbstractStep> binder) {
AbstractStep step = binder.getBean();
if (step instanceof SubStep) {
SubStep substep = (SubStep) step;
substep.getOwner().removeSubStep(substep);
} else {
gantt.removeStep((Step) step);
if (ganttListener != null) {
ganttListener.stepDeleted((Step) step);
}
}
win.close();
}
示例4: send
import com.vaadin.ui.Window; //导入方法依赖的package包/类
private void send(String s, Window closeThisOnSuccess) {
try {
FileUtils.write(file, "\n--- FEEDBACK ---\n\n"+s+"\n\n\n", true);
Notification.show("Thank you!");
closeThisOnSuccess.close();
} catch (IOException e) {
Notification.show("Could not send feedback :( --- " + e.getMessage(), Notification.Type.ERROR_MESSAGE);
}
}
示例5: closeOpenWindows
import com.vaadin.ui.Window; //导入方法依赖的package包/类
@Subscribe
public void closeOpenWindows(final CloseOpenWindowsEvent event) {
for (Window window : getWindows()) {
window.close();
}
}
示例6: saveAttendeeAndReprintBadge
import com.vaadin.ui.Window; //导入方法依赖的package包/类
public void saveAttendeeAndReprintBadge(Window window, Attendee attendee, User overrideUser) {
try {
if (view.currentUserHasRight("attendee_edit")) {
attendeeValidator.validate(attendee); // Only validate fields if the user actually has the ability to edit them
}
String historyMessage;
if (overrideUser != null) {
historyMessage = String.format("Badge reprinted with override by %s", overrideUser);
} else {
historyMessage = "Badge reprinted";
}
attendee.addHistoryEntry(view.getCurrentUser(), historyMessage);
attendee = attendeeRepository.save(attendee);
log.info("{} saved {}", view.getCurrentUsername(), attendee);
view.refresh();
} catch (ValidationException e) {
view.notifyError(e.getMessage());
log.error("{} tried to save {} and got error {}", view.getCurrentUsername(), attendee, e.getMessage());
return;
}
window.close();
List<Attendee> attendeeList = new ArrayList<>();
attendeeList.add(attendee);
// If no override user, check permissions on the current user
if (overrideUser == null) {
if (view.currentUserHasRight("reprint_badge")) {
log.info("{} reprinting badge(s) for {}", view.getCurrentUsername(), attendee);
showAttendeeBadgeWindow(view, attendeeList, false);
} else {
view.showOverrideRequiredWindow(this, attendeeList);
}
} else {
if (overrideUser.hasRight("reprint_badge")) {
log.info("{} reprinting badge(s) for {} with override from {}",
view.getCurrentUsername(), attendee, overrideUser);
showAttendeeBadgeWindow(view, attendeeList, false);
} else {
view.notifyError("Override user does not have the required right");
log.error("{} requested an override to reprint a badge for {} but {} did not have the reprint_badge right",
view.getCurrentUsername(), attendee, overrideUser);
view.showOverrideRequiredWindow(this, attendeeList);
}
}
}
示例7: 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;
}
示例8: cancel
import com.vaadin.ui.Window; //导入方法依赖的package包/类
private void cancel(final Window win, final Binder<? extends AbstractStep> binder) {
win.close();
}
示例9: testNavigateInWindowToDefault
import com.vaadin.ui.Window; //导入方法依赖的package包/类
@Test
public void testNavigateInWindowToDefault() {
Window wnd = navigator.navigateInWindow(VIEW_FOUR);
assertEquals(1, ui.getWindows().size());
wnd.close();
assertEquals(0, ui.getWindows().size());
assertEquals(VIEW_HOME, navigator.getCurrentViewName());
wnd = navigator.navigateInWindow(VIEW_FOUR);
assertEquals(VIEW_FOUR, navigator.getCurrentViewName());
assertEquals(1, ui.getWindows().size());
assertTrue(navigator.navigateBack());
assertEquals(0, ui.getWindows().size());
assertEquals(VIEW_HOME, navigator.getCurrentViewName());
wnd = navigator.navigateInWindow(VIEW_FOUR);
assertEquals(1, ui.getWindows().size());
navigator.navigateToDefault();
assertEquals(0, ui.getWindows().size());
}
示例10: testNavigateInWindowToDefault
import com.vaadin.ui.Window; //导入方法依赖的package包/类
@Test
public void testNavigateInWindowToDefault() {
NavigatorTestUI ui = createUi(NavigatorTestUI.class, "http://localhost");
DefaultViewProvider provider = new DefaultViewProvider();
provider.registerView(VIEW_ONE, ViewOne.class);
provider.registerView(VIEW_FOUR, ViewFour.class);
provider.registerView(VIEW_FIVE, ViewFive.class);
ViewNavigator navigator = ViewNavigator.builder().viewDisplay(viewer).addProvider(provider)
.defaultViewName(VIEW_ONE).buildAndBind(ui);
Window wnd = navigator.navigateInWindow(VIEW_FOUR);
assertEquals(1, ui.getWindows().size());
wnd.close();
assertEquals(0, ui.getWindows().size());
assertEquals(VIEW_ONE, navigator.getCurrentViewName());
wnd = navigator.navigateInWindow(VIEW_FOUR);
assertEquals(VIEW_FOUR, navigator.getCurrentViewName());
assertEquals(1, ui.getWindows().size());
assertTrue(navigator.navigateBack());
assertEquals(0, ui.getWindows().size());
assertEquals(VIEW_ONE, navigator.getCurrentViewName());
wnd = navigator.navigateInWindow(VIEW_FOUR);
assertEquals(1, ui.getWindows().size());
navigator.navigateToDefault();
assertEquals(0, ui.getWindows().size());
}