List of usage examples for com.vaadin.ui Window setContent
@Override public void setContent(Component content)
From source file:org.investovator.ui.main.AdminGameConfigLayout.java
License:Open Source License
private void startDailySummaryAddGameWizard() { // Create a sub-window and set the content Window subWindow = new Window("Create New Game"); VerticalLayout subContent = new VerticalLayout(); subContent.setMargin(true);/*from w ww . ja va2 s . c om*/ subWindow.setContent(subContent); // Put some components in it subContent.addComponent(new NewDataPlaybackGameWizard(subWindow)); // set window characteristics subWindow.center(); subWindow.setClosable(false); subWindow.setDraggable(false); subWindow.setResizable(false); subWindow.setModal(true); subWindow.addCloseListener(new Window.CloseListener() { @Override public void windowClose(Window.CloseEvent closeEvent) { //getUI().getNavigator().navigateTo(UIConstants.MAINVIEW); getUI().getPage().reload(); } }); // Add it to the root component UI.getCurrent().addWindow(subWindow); }
From source file:org.investovator.ui.main.components.AdminGameCreateView.java
License:Open Source License
private void startDailySummaryAddGameWizard() { // Create a sub-window and set the content Window subWindow = new Window("Create New Game"); VerticalLayout subContent = new VerticalLayout(); subContent.setMargin(true);/*ww w . ja v a2 s . c o m*/ subWindow.setContent(subContent); // Put some components in it subContent.addComponent(new NewDataPlaybackGameWizard(subWindow)); // set window characteristics subWindow.center(); subWindow.setClosable(false); subWindow.setDraggable(false); subWindow.setResizable(false); subWindow.setModal(true); subWindow.addCloseListener(new Window.CloseListener() { @Override public void windowClose(Window.CloseEvent closeEvent) { getUI().getNavigator().navigateTo(UIConstants.MAINVIEW); // getUI().getPage().reload(); } }); // Add it to the root component UI.getCurrent().addWindow(subWindow); }
From source file:org.jdal.vaadin.ui.FormUtils.java
License:Apache License
/** * Show a YES/NO confirm dialog/*from ww w. ja va 2 s. c om*/ * @param window Window to attach the dialog * @param msg the msg */ public static void showConfirmDialog(UI ui, final Command command, String msg) { final Window dlg = new Window("Please Confirm"); VerticalLayout vl = new VerticalLayout(); vl.setSizeFull(); vl.setSpacing(true); vl.setMargin(true); Label label = new Label(msg, Label.CONTENT_XHTML); vl.addComponent(label); HorizontalLayout hl = new HorizontalLayout(); hl.setSpacing(true); Button ok = new Button(StaticMessageSource.getMessage("yes")); ok.addClickListener(new ClickListener() { public void buttonClick(ClickEvent event) { command.execute(null); closeWindow(dlg); } }); Button cancel = new Button(StaticMessageSource.getMessage("no")); cancel.addClickListener(new ClickListener() { public void buttonClick(ClickEvent event) { closeWindow(dlg); } }); hl.setSpacing(true); hl.addComponent(ok); hl.addComponent(cancel); hl.setSizeFull(); vl.addComponent(hl); vl.setComponentAlignment(hl, Alignment.TOP_CENTER); dlg.setContent(vl); dlg.setModal(true); vl.setSizeUndefined(); ui.addWindow(dlg); }
From source file:org.opencms.ui.actions.CmsUserInfoDialogAction.java
License:Open Source License
/** * @see org.opencms.ui.actions.I_CmsWorkplaceAction#executeAction(org.opencms.ui.I_CmsDialogContext) *///from w w w . jav a 2s.com public void executeAction(final I_CmsDialogContext context) { CmsUserInfo dialog = new CmsUserInfo(new I_UploadListener() { public void onUploadFinished(List<String> uploadedFiles) { handleUpload(uploadedFiles, context); } }, context); Multimap<String, String> params = A_CmsUI.get().getParameters(); int top = 55; int left = 0; if (params.containsKey("left")) { String buttonLeft = params.get("left").iterator().next(); left = Integer.parseInt(buttonLeft) - 290; } final Window window = new Window(); window.setModal(false); window.setClosable(true); window.setResizable(false); window.setContent(dialog); context.setWindow(window); window.addStyleName(OpenCmsTheme.DROPDOWN); UI.getCurrent().addWindow(window); window.setPosition(left, top); }
From source file:org.opencms.ui.A_CmsUI.java
License:Open Source License
/** * Replaces the ui content with a single dialog.<p> * * @param caption the caption/*w w w . j ava 2s . com*/ * @param dialog the dialog content */ public void setContentToDialog(String caption, CmsBasicDialog dialog) { setContent(new Label()); Window window = CmsBasicDialog.prepareWindow(DialogWidth.narrow); window.setContent(dialog); window.setCaption(caption); window.setClosable(false); addWindow(window); window.center(); }
From source file:org.opencms.ui.A_CmsUI.java
License:Open Source License
/** * Replaces the ui content with a single dialog.<p> * * TODO: In the future this should only handle window creation, refactor dialog contents to CmsBasicDialog * * @param caption the caption/* w w w . j av a 2 s .c om*/ * @param component the dialog content */ public void setContentToDialog(String caption, Component component) { setContent(new Label()); Window window = CmsBasicDialog.prepareWindow(DialogWidth.narrow); CmsBasicDialog dialog = new CmsBasicDialog(); VerticalLayout result = new VerticalLayout(); dialog.setContent(result); window.setContent(dialog); window.setCaption(caption); window.setClosable(false); addWindow(window); window.center(); if (component instanceof I_CmsHasButtons) { I_CmsHasButtons hasButtons = (I_CmsHasButtons) component; for (Button button : hasButtons.getButtons()) { dialog.addButton(button); } } result.addComponent(component); }
From source file:org.opencms.ui.CmsVaadinUtils.java
License:Open Source License
/** * Shows an alert box to the user with the given information, which will perform the given action after the user clicks on OK.<p> * * @param title the title/*from w w w .j av a 2s.c om*/ * @param message the message * * @param callback the callback to execute after clicking OK */ public static void showAlert(String title, String message, final Runnable callback) { final Window window = new Window(); window.setModal(true); Panel panel = new Panel(); panel.setCaption(title); panel.setWidth("500px"); VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); panel.setContent(layout); layout.addComponent(new Label(message)); Button okButton = new Button(); okButton.addClickListener(new ClickListener() { /** The serial version id. */ private static final long serialVersionUID = 1L; public void buttonClick(ClickEvent event) { window.close(); if (callback != null) { callback.run(); } } }); layout.addComponent(okButton); layout.setComponentAlignment(okButton, Alignment.BOTTOM_RIGHT); okButton.setCaption(org.opencms.workplace.Messages.get().getBundle(A_CmsUI.get().getLocale()) .key(org.opencms.workplace.Messages.GUI_DIALOG_BUTTON_OK_0)); window.setContent(panel); window.setClosable(false); window.setResizable(false); A_CmsUI.get().addWindow(window); }
From source file:org.opencms.ui.components.CmsConfirmationDialog.java
License:Open Source License
/** * Shows the confirmation dialog in a window.<p> * * @param title the window title/*w w w .j a va 2s .c om*/ * @param message the message to display in the dialog * @param okAction the action to execute when the user clicks OK * @param cancelAction the action for the cancel case */ public static void show(String title, String message, final Runnable okAction, final Runnable cancelAction) { final Window window = CmsBasicDialog.prepareWindow(); window.setCaption(title); CmsConfirmationDialog dialog = new CmsConfirmationDialog(message, new Runnable() { public void run() { window.close(); okAction.run(); } }, new Runnable() { public void run() { if (cancelAction != null) { cancelAction.run(); } window.close(); } }); window.setContent(dialog); UI.getCurrent().addWindow(window); }
From source file:org.opencms.ui.components.CmsErrorDialog.java
License:Open Source License
/** * Shows the error dialog.<p>/* w w w . j a v a 2 s.c o m*/ * * @param message the error message * @param t the error to be displayed * @param onClose executed on close */ public static void showErrorDialog(String message, Throwable t, Runnable onClose) { Window window = prepareWindow(DialogWidth.wide); window.setCaption(Messages.get().getBundle(A_CmsUI.get().getLocale()).key(Messages.GUI_ERROR_0)); window.setContent(new CmsErrorDialog(message, t, onClose, window)); A_CmsUI.get().addWindow(window); }
From source file:org.opencms.ui.components.fileselect.A_CmsFileSelectField.java
License:Open Source License
/** * Opens the file selector dialog.<p> */// w w w . j av a2s .c o m protected void openFileSelector() { try { final Window window = CmsBasicDialog.prepareWindow(); window.setCaption(m_fileSelectCaption != null ? m_fileSelectCaption : CmsVaadinUtils.getMessageText(org.opencms.ui.components.Messages.GUI_FILE_SELECT_CAPTION_0)); A_CmsUI.get().addWindow(window); CmsResourceSelectDialog fileSelect = new CmsResourceSelectDialog(m_filter); fileSelect.showSitemapView(m_startWithSitemapView); T value = getValue(); if (value instanceof CmsResource) { fileSelect.showStartResource((CmsResource) value); } else if (value instanceof String) { fileSelect.openPath((String) value); } window.setContent(fileSelect); fileSelect.addSelectionHandler(new I_CmsSelectionHandler<CmsResource>() { public void onSelection(CmsResource selected) { setResourceValue(selected); window.close(); } }); } catch (CmsException e) { LOG.error(e.getLocalizedMessage(), e); CmsErrorDialog.showErrorDialog(e); } }