当前位置: 首页>>代码示例>>Java>>正文


Java Window.close方法代码示例

本文整理汇总了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);
    }
}
 
开发者ID:kumoregdev,项目名称:kumoreg,代码行数:26,代码来源:AttendeeSearchPresenter.java

示例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();
}
 
开发者ID:tltv,项目名称:gantt,代码行数:17,代码来源:DemoUI.java

示例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();
}
 
开发者ID:tltv,项目名称:gantt,代码行数:14,代码来源:DemoUI.java

示例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);
	}
}
 
开发者ID:ahn,项目名称:mideaas,代码行数:10,代码来源:FeedbackPlugin.java

示例5: closeOpenWindows

import com.vaadin.ui.Window; //导入方法依赖的package包/类
@Subscribe
public void closeOpenWindows(final CloseOpenWindowsEvent event) {
    for (Window window : getWindows()) {
        window.close();
    }
}
 
开发者ID:imotSpot,项目名称:imotSpot,代码行数:7,代码来源:DashboardUI.java

示例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);
        }
    }
}
 
开发者ID:kumoregdev,项目名称:kumoreg,代码行数:47,代码来源:AttendeeSearchPresenter.java

示例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;
}
 
开发者ID:daergoth,项目名称:HomeWire-Server,代码行数:46,代码来源:SetupView.java

示例8: cancel

import com.vaadin.ui.Window; //导入方法依赖的package包/类
private void cancel(final Window win, final Binder<? extends AbstractStep> binder) {
    win.close();
}
 
开发者ID:tltv,项目名称:gantt,代码行数:4,代码来源:DemoUI.java

示例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());
}
 
开发者ID:holon-platform,项目名称:holon-vaadin,代码行数:34,代码来源:TestNavigator.java

示例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());
}
 
开发者ID:holon-platform,项目名称:holon-vaadin,代码行数:44,代码来源:TestViewNavigator.java


注:本文中的com.vaadin.ui.Window.close方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。