Java Code Examples for com.vaadin.ui.VerticalLayout#setWidthUndefined()
The following examples show how to use
com.vaadin.ui.VerticalLayout#setWidthUndefined() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WebTableFieldFactory.java From cuba with Apache License 2.0 | 6 votes |
protected Component getComponentImplementation(com.haulmont.cuba.gui.components.Component columnComponent) { com.vaadin.ui.Component composition = columnComponent.unwrapComposition(com.vaadin.ui.Component.class); Component componentImpl = composition; if (composition instanceof com.vaadin.v7.ui.Field && ((com.vaadin.v7.ui.Field) composition).isRequired()) { VerticalLayout layout = new VerticalLayout(); // vaadin8 replace with CssLayout layout.setMargin(false); layout.setSpacing(false); layout.addComponent(composition); if (composition.getWidth() < 0) { layout.setWidthUndefined(); } componentImpl = layout; } return componentImpl; }
Example 2
Source File: MismatchedUserSessionHandler.java From cuba with Apache License 2.0 | 4 votes |
protected void showMismatchedSessionDialog(AppUI ui) { Messages messages = beanLocator.get(Messages.class); Connection connection = ui.getApp().getConnection(); //noinspection ConstantConditions Locale locale = connection.getSession().getLocale(); Window dialog = new MismatchedUserSessionExceptionDialog(); dialog.setStyleName("c-sessionchanged-dialog"); dialog.setCaption(messages.getMainMessage("dialogs.Information", locale)); dialog.setClosable(false); dialog.setResizable(false); dialog.setModal(true); CubaLabel messageLab = new CubaLabel(); messageLab.setWidthUndefined(); messageLab.setValue(messages.getMainMessage("sessionChangedMsg", locale)); VerticalLayout layout = new VerticalLayout(); layout.setSpacing(true); layout.setMargin(false); layout.setWidthUndefined(); layout.setStyleName("c-sessionchanged-dialog-layout"); layout.setSpacing(true); dialog.setContent(layout); CubaButton reloginBtn = new CubaButton(); reloginBtn.addStyleName(WebButton.PRIMARY_ACTION_STYLENAME); reloginBtn.setCaption(messages.getMainMessage(DialogAction.Type.OK.getMsgKey(), locale)); reloginBtn.addClickListener(event -> ui.getApp().recreateUi(ui)); String iconName = beanLocator.get(Icons.class) .get(DialogAction.Type.OK.getIconKey()); reloginBtn.setIcon(beanLocator.get(IconResolver.class) .getIconResource(iconName)); ClientConfig clientConfig = beanLocator.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(); if (ui.isTestMode()) { dialog.setCubaId("optionDialog"); reloginBtn.setCubaId("reloginBtn"); } if (ui.isPerformanceTestMode()) { dialog.setId(ui.getTestIdManager().getTestId("optionDialog")); reloginBtn.setId(ui.getTestIdManager().getTestId("reloginBtn")); } }
Example 3
Source File: NoUserSessionHandler.java From cuba with Apache License 2.0 | 4 votes |
protected void showNoUserSessionDialog(AppUI ui) { Messages messages = beanLocator.get(Messages.class); Connection connection = ui.getApp().getConnection(); //noinspection ConstantConditions Locale locale = connection.getSession().getLocale(); Window dialog = new NoUserSessionExceptionDialog(); dialog.setStyleName("c-nousersession-dialog"); dialog.setCaption(messages.getMainMessage("dialogs.Information", locale)); dialog.setClosable(false); dialog.setResizable(false); dialog.setModal(true); CubaLabel messageLab = new CubaLabel(); messageLab.setWidthUndefined(); messageLab.setValue(messages.getMainMessage("noUserSession.message", locale)); VerticalLayout layout = new VerticalLayout(); layout.setSpacing(true); layout.setMargin(false); layout.setWidthUndefined(); layout.setStyleName("c-nousersession-dialog-layout"); layout.setSpacing(true); dialog.setContent(layout); CubaButton reloginBtn = new CubaButton(); reloginBtn.addStyleName(WebButton.PRIMARY_ACTION_STYLENAME); reloginBtn.addClickListener(event -> relogin()); reloginBtn.setCaption(messages.getMainMessage(Type.OK.getMsgKey())); String iconName = beanLocator.get(Icons.class) .get(Type.OK.getIconKey()); reloginBtn.setIcon(beanLocator.get(IconResolver.class) .getIconResource(iconName)); ClientConfig clientConfig = beanLocator.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(); if (ui.isTestMode()) { dialog.setCubaId("optionDialog"); reloginBtn.setCubaId("reloginBtn"); } if (ui.isPerformanceTestMode()) { dialog.setId(ui.getTestIdManager().getTestId("optionDialog")); reloginBtn.setId(ui.getTestIdManager().getTestId("reloginBtn")); } }
Example 4
Source File: AbbreviatedCellClickListener.java From cuba with Apache License 2.0 | 4 votes |
@SuppressWarnings("unchecked") @Override public void onClick(Entity item, String columnId) { Table.Column column = table.getColumn(columnId); MetaProperty metaProperty; String value; if (DynamicAttributesUtils.isDynamicAttribute(columnId)) { metaProperty = dynamicAttributesTools.getMetaPropertyPath(item.getMetaClass(), columnId).getMetaProperty(); value = dynamicAttributesTools.getDynamicAttributeValueAsString(metaProperty, item.getValueEx(columnId)); } else { value = item.getValueEx(columnId); } if (column.getMaxTextLength() != null) { boolean isMultiLineCell = StringUtils.contains(value, "\n"); if (value == null || (value.length() <= column.getMaxTextLength() + MAX_TEXT_LENGTH_GAP && !isMultiLineCell)) { // todo artamonov if we click with CTRL and Table is multiselect then we lose previous selected items if (!table.getSelected().contains(item)) { table.setSelected(item); } // do not show popup view return; } } VerticalLayout layout = new VerticalLayout(); layout.setMargin(false); layout.setSpacing(false); layout.setWidthUndefined(); layout.setStyleName("c-table-view-textcut"); CubaTextArea textArea = new CubaTextArea(); textArea.setValue(Strings.nullToEmpty(value)); textArea.setReadOnly(true); CubaResizableTextAreaWrapper content = new CubaResizableTextAreaWrapper(textArea); content.setResizableDirection(ResizeDirection.BOTH); // todo implement injection for ThemeConstains in components ThemeConstants theme = App.getInstance().getThemeConstants(); if (theme != null) { content.setWidth(theme.get("cuba.web.Table.abbreviatedPopupWidth")); content.setHeight(theme.get("cuba.web.Table.abbreviatedPopupHeight")); } else { content.setWidth("320px"); content.setHeight("200px"); } layout.addComponent(content); table.withUnwrapped(CubaEnhancedTable.class, enhancedTable -> { enhancedTable.showCustomPopup(layout); enhancedTable.setCustomPopupAutoClose(false); }); }