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


Java Window类代码示例

本文整理汇总了Java中com.vaadin.ui.Window的典型用法代码示例。如果您正苦于以下问题:Java Window类的具体用法?Java Window怎么用?Java Window使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Window类属于com.vaadin.ui包,在下文中一共展示了Window类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: showBadgesInBrowser

import com.vaadin.ui.Window; //导入依赖的package包/类
public void showBadgesInBrowser(List<Attendee> attendeeList) {
    if (attendeeList.size() > 0) {
        StreamResource.StreamSource source = handler.getBadgeFormatter(this, attendeeList);
        String filename = "testbadge" + System.currentTimeMillis() + ".pdf";
        StreamResource resource = new StreamResource(source, filename);

        resource.setMIMEType("application/pdf");
        resource.getStream().setParameter("Content-Disposition", "attachment; filename="+filename);

        Window window = new Window();
        window.setWidth(800, Sizeable.Unit.PIXELS);
        window.setHeight(600, Sizeable.Unit.PIXELS);
        window.setModal(true);
        window.center();
        BrowserFrame pdf = new BrowserFrame("test", resource);
        pdf.setSizeFull();

        window.setContent(pdf);
        getUI().addWindow(window);
    } else {
        Notification.show("No attendees selected");
    }
}
 
开发者ID:kumoregdev,项目名称:kumoreg,代码行数:24,代码来源:PrintBadgeWindow.java

示例2: closeAllViewWindows

import com.vaadin.ui.Window; //导入依赖的package包/类
/**
 * Close all opened Windows displaying Views
 */
protected void closeAllViewWindows() {
	for (Entry<String, WeakReference<Window>> entry : viewWindows.entrySet()) {

		// remove Window
		WeakReference<Window> windowRef = viewWindows.get(entry.getKey());
		if (windowRef != null && windowRef.get() != null && windowRef.get().getParent() != null) {
			// if was displayed in Window, close the Window
			try {
				navigateBackOnWindowClose = false;
				windowRef.get().close();
			} finally {
				navigateBackOnWindowClose = true;
			}
		}
		viewWindows.remove(entry.getKey());

		// remove from history
		if (!getNavigationHistory().isEmpty()) {
			getNavigationHistory().remove(entry.getKey());
		}

	}
}
 
开发者ID:holon-platform,项目名称:holon-vaadin7,代码行数:27,代码来源:NavigatorActuator.java

示例3: closeCurrentViewWindow

import com.vaadin.ui.Window; //导入依赖的package包/类
/**
 * If current View is displayed in a Window, close the Window and removes navigation state from history
 * @return <code>true</code> if current View was displayed in a Window and it was closed
 */
protected boolean closeCurrentViewWindow() {
	// check current View is displayed in Window
	if (!getNavigationHistory().isEmpty() && viewWindows.containsKey(getNavigationHistory().peek())) {

		// remove from history
		String navigationState = getNavigationHistory().pop();

		WeakReference<Window> windowRef = viewWindows.get(navigationState);
		if (windowRef != null && windowRef.get() != null && windowRef.get().getParent() != null) {
			// if was displayed in Window, close the Window
			try {
				navigateBackOnWindowClose = false;
				windowRef.get().close();
			} finally {
				navigateBackOnWindowClose = true;
			}
		}
		viewWindows.remove(navigationState);

		// closed and removed from history
		return true;

	}
	return false;
}
 
开发者ID:holon-platform,项目名称:holon-vaadin7,代码行数:30,代码来源:NavigatorActuator.java

示例4: closeCurrentViewWindow

import com.vaadin.ui.Window; //导入依赖的package包/类
/**
 * If current View is displayed in a Window, close the Window
 */
protected void closeCurrentViewWindow() {
	final String currentState = navigator.getState();
	if (currentState != null && viewWindows.containsKey(currentState)) {
		synchronized (viewWindows) {
			final WeakReference<Window> windowRef = viewWindows.get(currentState);
			if (windowRef != null && windowRef.get() != null && windowRef.get().getParent() != null) {
				// if was displayed in Window, close the Window
				try {
					navigateBackOnWindowClose = false;
					windowRef.get().close();
				} finally {
					navigateBackOnWindowClose = true;
				}
			}
			viewWindows.remove(currentState);
		}
	}
}
 
开发者ID:holon-platform,项目名称:holon-vaadin,代码行数:22,代码来源:NavigatorActuator.java

示例5: 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

示例6: getSpellWindow

import com.vaadin.ui.Window; //导入依赖的package包/类
private void getSpellWindow(Spell spell) {
    Messages messages = Messages.getInstance();
    Window window = new Window(spell.getName());
    window.setModal(true);
    window.setWidth("60%");

    CollectionToStringConverter converter = new CollectionToStringConverter();

    FormLayout layout = new FormLayout();
    DSLabel componentType = new DSLabel(messages.getMessage("spellStep.component.label"),
            converter.convertToPresentation(spell.getComponentTypes(), new ValueContext()));
    DSLabel text = new DSLabel(messages.getMessage("spellStep.description.label"), spell.getDescription());
    layout.addComponents(componentType, text);

    //TODO : other useful info

    window.setContent(layout);
    UI.getCurrent().addWindow(window);
}
 
开发者ID:viydaag,项目名称:dungeonstory-java,代码行数:20,代码来源:SpellChoiceForm.java

示例7: addEntity

import com.vaadin.ui.Window; //导入依赖的package包/类
protected void addEntity(String input) {

        ET newInstance = instantiator.apply(input);

        if (newInstanceForm != null) {
            String caption = "Add new " + elementType.getSimpleName();
            newInstanceForm.setEntity(newInstance);
            newInstanceForm.setSavedHandler(this);
            newInstanceForm.setResetHandler(this);
            Window w = newInstanceForm.openInModalPopup();
            w.setWidth("70%");
            w.setCaption(caption);
        } else {
            onSave(newInstance);
        }
    }
 
开发者ID:viydaag,项目名称:dungeonstory-java,代码行数:17,代码来源:SubSetSelector.java

示例8: showDialog

import com.vaadin.ui.Window; //导入依赖的package包/类
protected void showDialog(App app, Throwable exception) {
    Throwable rootCause = ExceptionUtils.getRootCause(exception);
    if (rootCause == null) {
        rootCause = exception;
    }
    ExceptionDialog dialog = new ExceptionDialog(rootCause);
    AppUI ui = app.getAppUI();
    for (Window window : ui.getWindows()) {
        if (window.isModal()) {
            dialog.setModal(true);
            break;
        }
    }
    ui.addWindow(dialog);
    dialog.focus();
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:17,代码来源:DefaultExceptionHandler.java

示例9: openModule

import com.vaadin.ui.Window; //导入依赖的package包/类
public static void openModule(Module Module, Window.CloseListener closeListener) {
    final ModuleLayout moduleLayout = new ModuleLayout(Module);
    final ConfigureWindow configureWindow = new ConfigureWindow(moduleLayout, "New Module");
    Button.ClickListener clickListener = new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            try {
            if (event.getButton().equals(configureWindow.btnClose)) {

            } else if (event.getButton().equals(configureWindow.btnOk)) {
                moduleLayout.save();
            }
            configureWindow.close();
            } catch (RuntimeException re){
                logger.log(Level.SEVERE, re.getMessage(), re);
                Notification.show("Error", re.getMessage(), Notification.Type.ERROR_MESSAGE);
            }
        }
    };
    configureWindow.setClickListener(clickListener);
    configureWindow.addCloseListener(closeListener);
    HybridbpmUI.getCurrent().addWindow(configureWindow);
}
 
开发者ID:hybridbpm,项目名称:hybridbpm,代码行数:25,代码来源:DevelopmentView.java

示例10: buttonClick

import com.vaadin.ui.Window; //导入依赖的package包/类
@Override
public void buttonClick(Button.ClickEvent event) {
    try {
        if (event.getButton().equals(btnSave)) {
            processModel.setName(Module.getName());
            Module.setModel(HybridbpmCoreUtil.objectToJson(processModel));
            Module = HybridbpmUI.getDevelopmentAPI().saveModule(Module);
            binder.setItemDataSource(Module);
        } else if (event.getButton().equals(btnData)) {
            ProcessConfigureWindow pcw = new ProcessConfigureWindow();
            pcw.initUI(processModelLayout);
            pcw.addCloseListener(new Window.CloseListener() {

                @Override
                public void windowClose(Window.CloseEvent e) {
                    setProcessModel(processModelLayout.getProcessModel());
                }
            });
            HybridbpmUI.getCurrent().addWindow(pcw);
        }
    } catch (IllegalArgumentException | NullPointerException ex) {
        logger.log(Level.SEVERE, ex.getMessage(), ex);
    }
}
 
开发者ID:hybridbpm,项目名称:hybridbpm,代码行数:25,代码来源:ProcessEditor.java

示例11: openUserEditor

import com.vaadin.ui.Window; //导入依赖的package包/类
public static void openUserEditor(User user, Window.CloseListener closeListener) {
    final UserLayout userLayout = new UserLayout(user);
    final ConfigureWindow configureWindow = new ConfigureWindow(userLayout, "User");
    Button.ClickListener clickListener = new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            if (event.getButton().equals(configureWindow.btnClose)) {
                configureWindow.close();
            } else if (event.getButton().equals(configureWindow.btnOk)) {
                userLayout.save();
            }
        }
    };
    configureWindow.setClickListener(clickListener);
    configureWindow.addCloseListener(closeListener);
    configureWindow.setSizeUndefined();
    HybridbpmUI.getCurrent().addWindow(configureWindow);
}
 
开发者ID:hybridbpm,项目名称:hybridbpm,代码行数:20,代码来源:UsersLayout.java

示例12: 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);
}
 
开发者ID:eclipse,项目名称:hawkbit,代码行数:27,代码来源:UploadResultWindow.java

示例13: 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);
}
 
开发者ID:eclipse,项目名称:hawkbit,代码行数:22,代码来源:UploadConfirmationWindow.java

示例14: 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;
}
 
开发者ID:eclipse,项目名称:hawkbit,代码行数:21,代码来源:WindowBuilder.java

示例15: createOldWaySourceWindow

import com.vaadin.ui.Window; //导入依赖的package包/类
private Window createOldWaySourceWindow() {
    Window sourceWindow = new Window("Example");
    VerticalLayout content = new VerticalLayout();
    content.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER);
    Label sourceCode = new Label("<pre><code>" + "        final TextArea anotherArea = new TextArea();\n"
            + "        anotherArea.setId(\"clipboardTarget\");\n"
            + "        anotherArea.setValue(\"Another example to copy to clipboard\");\n" + "\n"
            + "        ClipboardButton clipboardButton = new ClipboardButton(\"clipboardTarget\");\n"
            + "        clipboardButton.addSuccessListener(new ClipboardButton.SuccessListener() {\n" + "\n"
            + "            @Override\n" + "            public void onSuccess() {\n"
            + "                Notification.show(\"Copy to clipboard successful\");\n" + "            }\n"
            + "        });\n" + "        clipboardButton.addErrorListener(new ClipboardButton.ErrorListener() {\n"
            + "\n" + "            @Override\n" + "            public void onError() {\n"
            + "                Notification.show(\"Copy to clipboard unsuccessful\", Notification.Type.ERROR_MESSAGE);\n"
            + "            }\n" + "        });</code></pre>", ContentMode.HTML);

    content.addComponent(new HorizontalLayout(sourceCode));
    sourceWindow.setContent(content);
    sourceWindow.setHeight("400px");
    return sourceWindow;
}
 
开发者ID:vaadin4qbanos,项目名称:vaadin-jsclipboard-addon,代码行数:22,代码来源:DeprecatedWayView.java


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