當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。