List of usage examples for com.vaadin.ui Alignment BOTTOM_RIGHT
Alignment BOTTOM_RIGHT
To view the source code for com.vaadin.ui Alignment BOTTOM_RIGHT.
Click Source Link
From source file:com.haulmont.cuba.web.exception.NoUserSessionHandler.java
License:Apache License
protected void showNoUserSessionDialog(App app) { Messages messages = AppBeans.get(Messages.NAME); Window dialog = new NoUserSessionExceptionDialog(); dialog.setStyleName("c-nousersession-dialog"); dialog.setCaption(messages.getMainMessage("dialogs.Information", locale)); dialog.setClosable(false);/*ww w . ja v a2 s . c o m*/ dialog.setResizable(false); dialog.setModal(true); AppUI ui = app.getAppUI(); if (ui.isTestMode()) { dialog.setCubaId("optionDialog"); dialog.setId(ui.getTestIdManager().getTestId("optionDialog")); } Label messageLab = new CubaLabel(); messageLab.setWidthUndefined(); messageLab.setValue(messages.getMainMessage("noUserSession.message", locale)); VerticalLayout layout = new VerticalLayout(); layout.setSpacing(true); layout.setWidthUndefined(); layout.setStyleName("c-nousersession-dialog-layout"); layout.setSpacing(true); dialog.setContent(layout); Button reloginBtn = new Button(); if (ui.isTestMode()) { reloginBtn.setCubaId("reloginBtn"); reloginBtn.setId(ui.getTestIdManager().getTestId("reloginBtn")); } reloginBtn.addStyleName(WebButton.ICON_STYLE); reloginBtn.addStyleName("c-primary-action"); reloginBtn.addClickListener(event -> relogin()); reloginBtn.setCaption(messages.getMainMessage(Type.OK.getMsgKey())); String iconName = AppBeans.get(Icons.class).get(Type.OK.getIconKey()); reloginBtn.setIcon(WebComponentsHelper.getIcon(iconName)); ClientConfig clientConfig = AppBeans.get(Configuration.class).getConfig(ClientConfig.class); setClickShortcut(reloginBtn, clientConfig.getCommitShortcut()); reloginBtn.focus(); layout.addComponent(messageLab); layout.addComponent(reloginBtn); layout.setComponentAlignment(reloginBtn, Alignment.BOTTOM_RIGHT); ui.addWindow(dialog); dialog.center(); }
From source file:com.haulmont.cuba.web.gui.components.WebAbstractTable.java
License:Apache License
@Override public void setRowsCount(RowsCount rowsCount) { if (this.rowsCount != null && topPanel != null) { topPanel.removeComponent(WebComponentsHelper.unwrap(this.rowsCount)); }/*from w w w . j av a 2s. c o m*/ this.rowsCount = rowsCount; if (rowsCount != null) { if (topPanel == null) { topPanel = createTopPanel(); topPanel.setWidth("100%"); componentComposition.addComponentAsFirst(topPanel); } com.vaadin.ui.Component rc = WebComponentsHelper.unwrap(rowsCount); topPanel.addComponent(rc); topPanel.setExpandRatio(rc, 1); topPanel.setComponentAlignment(rc, com.vaadin.ui.Alignment.BOTTOM_RIGHT); if (rowsCount instanceof VisibilityChangeNotifier) { ((VisibilityChangeNotifier) rowsCount) .addVisibilityChangeListener(event -> updateCompositionStylesTopPanelVisible()); } } updateCompositionStylesTopPanelVisible(); }
From source file:com.haulmont.cuba.web.gui.components.WebDataGrid.java
License:Apache License
@Override public void setRowsCount(RowsCount rowsCount) { if (this.rowsCount != null && topPanel != null) { topPanel.removeComponent(WebComponentsHelper.unwrap(this.rowsCount)); this.rowsCount.setParent(null); }//from ww w .j a v a2s.co m this.rowsCount = rowsCount; if (rowsCount != null) { if (rowsCount.getParent() != null && rowsCount.getParent() != this) { throw new IllegalStateException("Component already has parent"); } if (topPanel == null) { topPanel = createTopPanel(); topPanel.setWidth("100%"); componentComposition.addComponentAsFirst(topPanel); } com.vaadin.ui.Component rc = WebComponentsHelper.unwrap(rowsCount); topPanel.addComponent(rc); topPanel.setExpandRatio(rc, 1); topPanel.setComponentAlignment(rc, com.vaadin.ui.Alignment.BOTTOM_RIGHT); if (rowsCount instanceof VisibilityChangeNotifier) { ((VisibilityChangeNotifier) rowsCount) .addVisibilityChangeListener(event -> updateCompositionStylesTopPanelVisible()); } } updateCompositionStylesTopPanelVisible(); }
From source file:com.haulmont.cuba.web.WebWindowManager.java
License:Apache License
@Override public void showMessageDialog(String title, String message, MessageType messageType) { backgroundWorker.checkUIAccess();/* w w w . j a v a 2s. com*/ 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 va 2s .c o 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.haulmont.cuba.web.widgets.addons.popupbutton.PopupButton.java
License:Apache License
public PopupButton() { registerRpc(rpc); setDirection(Alignment.BOTTOM_RIGHT); }
From source file:com.haulmont.cuba.web.widgets.addons.popupbutton.PopupButton.java
License:Apache License
public PopupButton(String caption) { super(caption); registerRpc(rpc); setDirection(Alignment.BOTTOM_RIGHT); }
From source file:com.hybridbpm.ui.component.adaptive.AdaptiveTaskEditor.java
License:Apache License
@Override public void buttonClick(Button.ClickEvent event) { if (event.getButton().equals(btnSend)) { } else if (event.getButton().equals(btnProcess)) { adaptiveLayout.setVisible(false); templateLayout.removeAllComponents(); templateLayout.setVisible(true); for (StartProcess startProcess : HybridbpmUI.getBpmAPI().getMyProcessToStart()) { String startTaskTitle = startProcess.getProcessModel() .getTaskModelByName(startProcess.getTaskName()).getTitle(); String processTitle = startProcess.getProcessModel().getTitle() .getValue(HybridbpmUI.getCurrent().getLocale()); Button button = new Button(processTitle + " (" + startTaskTitle + ")"); button.setData(startProcess); button.addClickListener(this); button.setStyleName(ValoTheme.BUTTON_LINK); button.addStyleName(ValoTheme.BUTTON_SMALL); button.setIcon(FontAwesome.valueOf(startProcess.getIcon())); templateLayout.addComponent(button); }//from w w w . j a v a 2s . c om templateLayout.addComponent(btnBack); templateLayout.setComponentAlignment(btnBack, Alignment.BOTTOM_RIGHT); } else if (event.getButton().getData() instanceof StartProcess) { StartProcess spd = (StartProcess) event.getButton().getData(); if (taskLayout != null && card.getComponentIndex(taskLayout) > -1) { card.removeComponent(taskLayout); } taskLayout = new TaskLayout(null, spd.getProcessModel().getName(), spd.getTaskName(), true); card.addComponents(taskLayout); card.setExpandRatio(taskLayout, 1f); card.setSizeFull(); topLayout.setVisible(false); // panelView.toggleMaximized(this, true); } else if (event.getButton().equals(btnBack)) { adaptiveLayout.setVisible(true); templateLayout.setVisible(false); } }
From source file:com.hybridbpm.ui.component.bpm.window.FormConfigureWindow.java
License:Apache License
public FormConfigureWindow(Module module) { this.module = module; formModel = HybridbpmCoreUtil.jsonToObject(module.getModel(), FormModel.class); parametersLayout.setFormModel(formModel); parametersLayout.initUI(!Module.MODULE_SUBTYPE.TASK_FORM.equals(module.getSubType())); toolbar.setSpacing(true);//www . j a v a 2 s .c om toolbar.addStyleName("toolbar"); btnOk.addStyleName(ValoTheme.BUTTON_PRIMARY); btnOk.setCaption("OK"); toolbar.addComponent(btnOk); toolbar.setComponentAlignment(btnOk, Alignment.MIDDLE_RIGHT); btnClose.setCaption("Close"); toolbar.addComponent(btnClose); toolbar.setComponentAlignment(btnClose, Alignment.MIDDLE_RIGHT); cssLayout.addComponent(parametersLayout); cssLayout.setSizeFull(); cssLayout.addStyleName("scrollable"); layout.setSizeFull(); layout.setMargin(true); layout.addComponent(cssLayout); layout.setExpandRatio(cssLayout, 1f); layout.addComponent(toolbar); layout.setComponentAlignment(toolbar, Alignment.BOTTOM_RIGHT); setCaption("Form parameters"); center(); setResizable(false); // setClosable(false); setModal(true); addStyleName("no-vertical-drag-hints"); addStyleName("no-horizontal-drag-hints"); setContent(layout); setWidth(80, Unit.PERCENTAGE); setHeight(80, Unit.PERCENTAGE); }
From source file:com.hybridbpm.ui.component.bpm.window.ProcessConfigureWindow.java
License:Apache License
public void initUI(ProcessModelLayout processModelLayout) { this.processModelLayout = processModelLayout; variableEditorLayout.setProcessModel(processModelLayout.getProcessModel()); variableEditorLayout.initUI();/*from w ww .j a va2s . c o m*/ fileEditorLayout.setProcessModel(processModelLayout.getProcessModel()); fileEditorLayout.initUI(); toolbar.setSpacing(true); toolbar.addStyleName("toolbar"); btnOk.addStyleName(ValoTheme.BUTTON_PRIMARY); btnOk.setCaption("OK"); toolbar.addComponent(btnOk); toolbar.setComponentAlignment(btnOk, Alignment.MIDDLE_RIGHT); btnClose.setCaption("Close"); toolbar.addComponent(btnClose); toolbar.setComponentAlignment(btnClose, Alignment.MIDDLE_RIGHT); // cssLayout.addComponent(variableEditorLayout); // cssLayout.setSizeFull(); // cssLayout.addStyleName("scrollable"); tabSheet.setSizeFull(); tabSheet.addTab(variableEditorLayout, "Data"); tabSheet.addTab(fileEditorLayout, "Files"); layout.setSizeFull(); layout.setMargin(true); layout.addComponent(tabSheet); layout.setExpandRatio(tabSheet, 1f); layout.addComponent(toolbar); layout.setComponentAlignment(toolbar, Alignment.BOTTOM_RIGHT); setCaption("Process data"); center(); setResizable(false); // setClosable(false); setModal(true); addStyleName("no-vertical-drag-hints"); addStyleName("no-horizontal-drag-hints"); setContent(layout); setWidth(80, Unit.PERCENTAGE); setHeight(80, Unit.PERCENTAGE); }