List of usage examples for com.vaadin.shared.ui.window WindowMode NORMAL
WindowMode NORMAL
To view the source code for com.vaadin.shared.ui.window WindowMode NORMAL.
Click Source Link
From source file:com.haulmont.cuba.web.exception.ExceptionDialog.java
License:Apache License
public void setStackTraceVisible(boolean visible) { isStackTraceVisible = visible;//from w ww.j ava 2 s . c o m ThemeConstants theme = App.getInstance().getThemeConstants(); if (visible) { if (copyButton != null) { copyButton.setVisible(true); } showStackTraceButton.setCaption(messages.getMainMessage("exceptionDialog.hideStackTrace")); mainLayout.addComponent(stackTraceTextArea); mainLayout.setExpandRatio(stackTraceTextArea, 1.0f); mainLayout.setHeight(100, Unit.PERCENTAGE); setWidth(theme.get("cuba.web.ExceptionDialog.expanded.width")); setHeight(theme.get("cuba.web.ExceptionDialog.expanded.height")); setResizable(true); center(); stackTraceTextArea.focus(); stackTraceTextArea.setCursorPosition(0); } else { if (copyButton != null) { copyButton.setVisible(false); } showStackTraceButton.setCaption(messages.getMainMessage("exceptionDialog.showStackTrace")); mainLayout.setHeight(-1, Unit.PIXELS); mainLayout.removeComponent(stackTraceTextArea); setWidth(theme.get("cuba.web.ExceptionDialog.width")); setHeight(-1, Unit.PERCENTAGE); setResizable(false); center(); setWindowMode(WindowMode.NORMAL); } }
From source file:com.haulmont.cuba.web.WebWindowManager.java
License:Apache License
protected Component showWindowDialog(Window window, OpenType openType, boolean forciblyDialog) { final CubaWindow vWindow = createDialogWindow(window); vWindow.setStyleName("c-app-dialog-window"); if (ui.isTestMode()) { vWindow.setCubaId("dialog_" + window.getId()); vWindow.setId(ui.getTestIdManager().getTestId("dialog_" + window.getId())); }/*from w w w . ja va 2s. c om*/ Layout layout = (Layout) WebComponentsHelper.getComposition(window); vWindow.setContent(layout); vWindow.addPreCloseListener(event -> { event.setPreventClose(true); if (!isCloseWithCloseButtonPrevented(window)) { // user has clicked on X window.close(Window.CLOSE_ACTION_ID); } }); String closeShortcut = clientConfig.getCloseShortcut(); KeyCombination closeCombination = KeyCombination.create(closeShortcut); ShortcutAction exitAction = new ShortcutAction("closeShortcutAction", closeCombination.getKey().getCode(), KeyCombination.Modifier.codes(closeCombination.getModifiers())); Map<com.vaadin.event.Action, Runnable> actions = singletonMap(exitAction, () -> { if (openType.getOpenMode() != OpenMode.DIALOG || BooleanUtils.isNotFalse(window.getDialogOptions().getCloseable())) { if (isCloseWithShortcutPrevented(window)) { return; } window.close(Window.CLOSE_ACTION_ID); } }); WebComponentsHelper.setActions(vWindow, actions); boolean dialogParamsSizeUndefined = openType.getHeight() == null && openType.getWidth() == null; ThemeConstants theme = app.getThemeConstants(); if (forciblyDialog && dialogParamsSizeUndefined) { layout.setHeight(100, Unit.PERCENTAGE); vWindow.setWidth(theme.getInt("cuba.web.WebWindowManager.forciblyDialog.width"), Unit.PIXELS); vWindow.setHeight(theme.getInt("cuba.web.WebWindowManager.forciblyDialog.height"), Unit.PIXELS); // resizable by default, but may be overridden in dialog params vWindow.setResizable(BooleanUtils.isNotFalse(openType.getResizable())); window.setHeightFull(); } else { if (openType.getWidth() == null) { vWindow.setWidth(theme.getInt("cuba.web.WebWindowManager.dialog.width"), Unit.PIXELS); } else if (openType.getWidth() == AUTO_SIZE_PX) { vWindow.setWidthUndefined(); layout.setWidthUndefined(); window.setWidthAuto(); } else { vWindow.setWidth(openType.getWidth(), openType.getWidthUnit() != null ? WebWrapperUtils.toVaadinUnit(openType.getWidthUnit()) : Unit.PIXELS); } if (openType.getHeight() != null && openType.getHeight() != AUTO_SIZE_PX) { vWindow.setHeight(openType.getHeight(), openType.getHeightUnit() != null ? WebWrapperUtils.toVaadinUnit(openType.getHeightUnit()) : Unit.PIXELS); layout.setHeight("100%"); window.setHeightFull(); } else { window.setHeightAuto(); } // non resizable by default vWindow.setResizable(BooleanUtils.isTrue(openType.getResizable())); } if (openType.getCloseable() != null) { vWindow.setClosable(openType.getCloseable()); } boolean modal = true; if (!hasModalWindow() && openType.getModal() != null) { modal = openType.getModal(); } vWindow.setModal(modal); if (vWindow.isModal()) { boolean informationDialog = false; if (openType.getCloseOnClickOutside() != null) { informationDialog = openType.getCloseOnClickOutside(); } vWindow.setCloseOnClickOutside(informationDialog); } if (openType.getMaximized() != null) { if (openType.getMaximized()) { vWindow.setWindowMode(WindowMode.MAXIMIZED); } else { vWindow.setWindowMode(WindowMode.NORMAL); } } if (openType.getPositionX() == null && openType.getPositionY() == null) { vWindow.center(); } else { if (openType.getPositionX() != null) { vWindow.setPositionX(openType.getPositionX()); } if (openType.getPositionY() != null) { vWindow.setPositionY(openType.getPositionY()); } } getDialogParams().reset(); ui.addWindow(vWindow); return vWindow; }
From source file:com.haulmont.cuba.web.WebWindowManager.java
License:Apache License
@Override public void showMessageDialog(String title, String message, MessageType messageType) { backgroundWorker.checkUIAccess();//ww w . ja va 2 s . c o m final com.vaadin.ui.Window vWindow = new CubaWindow(title); if (ui.isTestMode()) { vWindow.setCubaId("messageDialog"); vWindow.setId(ui.getTestIdManager().getTestId("messageDialog")); } String closeShortcut = clientConfig.getCloseShortcut(); KeyCombination closeCombination = KeyCombination.create(closeShortcut); vWindow.addAction(new ShortcutListener("Esc", closeCombination.getKey().getCode(), KeyCombination.Modifier.codes(closeCombination.getModifiers())) { @Override public void handleAction(Object sender, Object target) { vWindow.close(); } }); vWindow.addAction(new ShortcutListener("Enter", ShortcutAction.KeyCode.ENTER, null) { @Override public void handleAction(Object sender, Object target) { vWindow.close(); } }); VerticalLayout layout = new VerticalLayout(); layout.setStyleName("c-app-message-dialog"); layout.setSpacing(true); if (messageType.getWidth() != null && messageType.getWidth() == AUTO_SIZE_PX) { layout.setWidthUndefined(); } vWindow.setContent(layout); Label messageLab = new CubaLabel(); messageLab.setValue(message); if (MessageType.isHTML(messageType)) { messageLab.setContentMode(ContentMode.HTML); } else { messageLab.setContentMode(ContentMode.TEXT); } if (messageType.getWidth() != null && messageType.getWidth() == AUTO_SIZE_PX) { messageLab.setWidthUndefined(); } layout.addComponent(messageLab); DialogAction action = new DialogAction(Type.OK); Button button = WebComponentsHelper.createButton(); button.setCaption(action.getCaption()); button.setIcon(WebComponentsHelper.getIcon(action.getIcon())); button.addStyleName(WebButton.ICON_STYLE); button.addClickListener(event -> vWindow.close()); button.focus(); layout.addComponent(button); layout.setComponentAlignment(button, Alignment.BOTTOM_RIGHT); float width; SizeUnit unit; DialogParams dialogParams = getDialogParams(); if (messageType.getWidth() != null) { width = messageType.getWidth(); unit = messageType.getWidthUnit(); } else if (dialogParams.getWidth() != null) { width = dialogParams.getWidth(); unit = dialogParams.getWidthUnit(); } else { SizeWithUnit size = SizeWithUnit .parseStringSize(app.getThemeConstants().get("cuba.web.WebWindowManager.messageDialog.width")); width = size.getSize(); unit = size.getUnit(); } vWindow.setWidth(width, unit != null ? WebWrapperUtils.toVaadinUnit(unit) : Unit.PIXELS); vWindow.setResizable(false); boolean modal = true; if (!hasModalWindow()) { if (messageType.getModal() != null) { modal = messageType.getModal(); } else if (dialogParams.getModal() != null) { modal = dialogParams.getModal(); } } vWindow.setModal(modal); boolean closeOnClickOutside = false; if (vWindow.isModal()) { if (messageType.getCloseOnClickOutside() != null) { closeOnClickOutside = messageType.getCloseOnClickOutside(); } } ((CubaWindow) vWindow).setCloseOnClickOutside(closeOnClickOutside); if (messageType.getMaximized() != null) { if (messageType.getMaximized()) { vWindow.setWindowMode(WindowMode.MAXIMIZED); } else { vWindow.setWindowMode(WindowMode.NORMAL); } } dialogParams.reset(); ui.addWindow(vWindow); vWindow.center(); vWindow.focus(); }
From source file:com.haulmont.cuba.web.WebWindowManager.java
License:Apache License
@Override public void showOptionDialog(String title, String message, MessageType messageType, Action[] actions) { backgroundWorker.checkUIAccess();/*from www .j a va2 s. co m*/ final com.vaadin.ui.Window window = new CubaWindow(title); if (ui.isTestMode()) { window.setCubaId("optionDialog"); window.setId(ui.getTestIdManager().getTestId("optionDialog")); } window.setClosable(false); Label messageLab = new CubaLabel(); messageLab.setValue(message); if (MessageType.isHTML(messageType)) { messageLab.setContentMode(ContentMode.HTML); } else { messageLab.setContentMode(ContentMode.TEXT); } if (messageType.getWidth() != null && messageType.getWidth() == AUTO_SIZE_PX) { messageLab.setWidthUndefined(); } float width; SizeUnit unit; if (messageType.getWidth() != null) { width = messageType.getWidth(); unit = messageType.getWidthUnit(); } else if (getDialogParams().getWidth() != null) { width = getDialogParams().getWidth(); unit = getDialogParams().getWidthUnit(); } else { SizeWithUnit size = SizeWithUnit .parseStringSize(app.getThemeConstants().get("cuba.web.WebWindowManager.optionDialog.width")); width = size.getSize(); unit = size.getUnit(); } if (messageType.getModal() != null) { log.warn("MessageType.modal is not supported for showOptionDialog"); } getDialogParams().reset(); window.setWidth(width, unit != null ? WebWrapperUtils.toVaadinUnit(unit) : Unit.PIXELS); window.setResizable(false); window.setModal(true); boolean closeOnClickOutside = false; if (window.isModal()) { if (messageType.getCloseOnClickOutside() != null) { closeOnClickOutside = messageType.getCloseOnClickOutside(); } } ((CubaWindow) window).setCloseOnClickOutside(closeOnClickOutside); if (messageType.getMaximized() != null) { if (messageType.getMaximized()) { window.setWindowMode(WindowMode.MAXIMIZED); } else { window.setWindowMode(WindowMode.NORMAL); } } VerticalLayout layout = new VerticalLayout(); layout.setStyleName("c-app-option-dialog"); layout.setSpacing(true); if (messageType.getWidth() != null && messageType.getWidth() == AUTO_SIZE_PX) { layout.setWidthUndefined(); } window.setContent(layout); HorizontalLayout buttonsContainer = new HorizontalLayout(); buttonsContainer.setSpacing(true); boolean hasPrimaryAction = false; Map<Action, Button> buttonMap = new HashMap<>(); for (Action action : actions) { Button button = WebComponentsHelper.createButton(); button.setCaption(action.getCaption()); button.addClickListener(event -> { try { action.actionPerform(null); } finally { ui.removeWindow(window); } }); if (StringUtils.isNotEmpty(action.getIcon())) { button.setIcon(WebComponentsHelper.getIcon(action.getIcon())); button.addStyleName(WebButton.ICON_STYLE); } if (action instanceof AbstractAction && ((AbstractAction) action).isPrimary()) { button.addStyleName("c-primary-action"); button.focus(); hasPrimaryAction = true; } if (ui.isTestMode()) { button.setCubaId("optionDialog_" + action.getId()); button.setId(ui.getTestIdManager().getTestId("optionDialog_" + action.getId())); } buttonsContainer.addComponent(button); buttonMap.put(action, button); } assignDialogShortcuts(buttonMap); if (!hasPrimaryAction && actions.length > 0) { ((Button) buttonsContainer.getComponent(0)).focus(); } layout.addComponent(messageLab); layout.addComponent(buttonsContainer); layout.setExpandRatio(messageLab, 1); layout.setComponentAlignment(buttonsContainer, Alignment.BOTTOM_RIGHT); ui.addWindow(window); window.center(); }
From source file:com.wintindustries.pfserver.interfaces.container.components.PFUpload.UploadCenter.java
public UploadCenter() { this.setCaption("Upload Center"); this.setDraggable(true); this.setWindowMode(WindowMode.NORMAL); }
From source file:org.eclipse.hawkbit.ui.artifacts.upload.UploadProgressInfoWindow.java
License:Open Source License
private void closeWindow() { setWindowMode(WindowMode.NORMAL); setColumnWidth(); setPopupSizeInMinMode(); this.close(); }
From source file:org.eclipse.hawkbit.ui.artifacts.upload.UploadStatusInfoWindow.java
License:Open Source License
protected void clearWindow() { errorOccured = false;/*ww w. j a v a2s. c om*/ uploads.removeAllItems(); setWindowMode(WindowMode.NORMAL); setColumnWidth(); setPopupSizeInMinMode(); resizeButton.setIcon(FontAwesome.EXPAND); this.close(); artifactUploadState.getUploadedFileStatusList().clear(); artifactUploadState.getNumberOfFileUploadsFailed().set(0); }
From source file:org.eclipse.hawkbit.ui.artifacts.upload.UploadStatusInfoWindow.java
License:Open Source License
private void resizeWindow(final ClickEvent event) { if (FontAwesome.EXPAND.equals(event.getButton().getIcon())) { event.getButton().setIcon(FontAwesome.COMPRESS); setWindowMode(WindowMode.MAXIMIZED); resetColumnWidth();// ww w . jav a 2 s . co m grid.getColumn(STATUS).setExpandRatio(0); grid.getColumn(PROGRESS).setExpandRatio(1); grid.getColumn(FILE_NAME).setExpandRatio(2); grid.getColumn(REASON).setExpandRatio(3); grid.getColumn(SPUILabelDefinitions.NAME_VERSION).setExpandRatio(4); mainLayout.setSizeFull(); } else { event.getButton().setIcon(FontAwesome.EXPAND); setWindowMode(WindowMode.NORMAL); setColumnWidth(); setPopupSizeInMinMode(); } }
From source file:org.eclipse.hawkbit.ui.distributions.smtable.SwModuleDetails.java
License:Open Source License
private void showArtifactDetailsWindow(final SoftwareModule softwareModule) { final Window artifactDtlsWindow = new Window(); artifactDtlsWindow.setCaption(HawkbitCommonUtil.getArtifactoryDetailsLabelId( softwareModule.getName() + "." + softwareModule.getVersion(), getI18n())); artifactDtlsWindow.setCaptionAsHtml(true); artifactDtlsWindow.setClosable(true); artifactDtlsWindow.setResizable(true); artifactDtlsWindow.setImmediate(true); artifactDtlsWindow.setWindowMode(WindowMode.NORMAL); artifactDtlsWindow.setModal(true);/*from w w w. ja v a 2s .c o m*/ artifactDtlsWindow.addStyleName(SPUIStyleDefinitions.CONFIRMATION_WINDOW_CAPTION); artifactDetailsLayout.setFullWindowMode(false); artifactDetailsLayout.populateArtifactDetails(softwareModule); artifactDetailsLayout.getArtifactDetailsTable().setWidth(700, Unit.PIXELS); artifactDetailsLayout.getArtifactDetailsTable().setHeight(500, Unit.PIXELS); artifactDtlsWindow.setContent(artifactDetailsLayout.getArtifactDetailsTable()); artifactDtlsWindow.addWindowModeChangeListener(event -> { if (event.getWindowMode() == WindowMode.MAXIMIZED) { artifactDtlsWindow.setSizeFull(); artifactDetailsLayout.setFullWindowMode(true); artifactDetailsLayout.createMaxArtifactDetailsTable(); artifactDetailsLayout.getMaxArtifactDetailsTable().setWidth(100, Unit.PERCENTAGE); artifactDetailsLayout.getMaxArtifactDetailsTable().setHeight(100, Unit.PERCENTAGE); artifactDtlsWindow.setContent(artifactDetailsLayout.getMaxArtifactDetailsTable()); } else { artifactDtlsWindow.setSizeUndefined(); artifactDtlsWindow.setContent(artifactDetailsLayout.getArtifactDetailsTable()); } }); UI.getCurrent().addWindow(artifactDtlsWindow); }
From source file:org.jumpmind.vaadin.ui.common.ResizableWindow.java
License:Open Source License
public ResizableWindow(String caption) { setCaption(caption);/*from w w w .ja va 2s . co m*/ setModal(true); setResizable(true); content = new VerticalLayout(); content.setSizeFull(); setContent(content); addShortcutListener(new ShortcutListener("Maximize", KeyCode.M, new int[] { ModifierKey.CTRL }) { private static final long serialVersionUID = 1L; @Override public void handleAction(Object sender, Object target) { if (ResizableWindow.this.getWindowMode() != WindowMode.MAXIMIZED) { ResizableWindow.this.setWindowMode(WindowMode.MAXIMIZED); } else { ResizableWindow.this.setWindowMode(WindowMode.NORMAL); } } }); addShortcutListener(new ShortcutListener("Close", KeyCode.ESCAPE, null) { private static final long serialVersionUID = 1L; @Override public void handleAction(Object sender, Object target) { close(); } }); }