List of usage examples for com.vaadin.ui Alignment TOP_LEFT
Alignment TOP_LEFT
To view the source code for com.vaadin.ui Alignment TOP_LEFT.
Click Source Link
From source file:com.mycollab.vaadin.web.ui.AddViewLayout.java
License:Open Source License
public void addHeaderTitle(Component headerContainer) { header.addComponent(headerContainer, 0); header.withAlign(headerContainer, Alignment.TOP_LEFT).expand(headerContainer); }
From source file:com.mycollab.vaadin.web.ui.AddViewLayout2.java
License:Open Source License
public AddViewLayout2(String title, Resource icon) { this.setMargin(new MarginInfo(false, false, true, false)); setStyleName("addview-layout"); this.viewIcon = icon; header = new MHorizontalLayout().withMargin(new MarginInfo(true, false, true, false)).withFullWidth(); header.setDefaultComponentAlignment(Alignment.TOP_LEFT); if (!(icon instanceof FontAwesome)) { Image iconEmbed = new Image(); iconEmbed.setSource(icon);//w w w. j a v a2 s.co m header.with(iconEmbed); } titleLbl = ELabel.h2(""); header.with(titleLbl).expand(titleLbl); if (title == null) { if (icon != null) { this.setTitle(UserUIContext.getMessage(GenericI18Enum.OPT_UNDEFINED)); } } else { this.setTitle(title); } this.addComponent(header); body = new MVerticalLayout().withSpacing(false).withMargin(false).withStyleName("addview-layout-body"); this.addComponent(body); }
From source file:com.mycollab.vaadin.web.ui.BuildCriterionComponent.java
License:Open Source License
public BuildCriterionComponent(SearchLayout<S> searchLayout, Param[] paramFields, String searchCategory) { this.hostSearchLayout = searchLayout; this.paramFields = paramFields; this.searchCategory = searchCategory; MHorizontalLayout headerBox = new MHorizontalLayout().withMargin(new MarginInfo(true, false, true, true)); headerBox.setDefaultComponentAlignment(Alignment.TOP_LEFT); addComponent(headerBox);/*from w w w.j a v a 2 s . c o m*/ Label filterLbl = new Label(UserUIContext.getMessage(GenericI18Enum.OPT_SAVED_FILTER)); headerBox.with(filterLbl).withAlign(filterLbl, Alignment.TOP_LEFT); filterBox = new MHorizontalLayout(); headerBox.with(filterBox).withAlign(filterBox, Alignment.TOP_LEFT); buildFilterBox(null); searchContainer = new MVerticalLayout().withMargin(false); searchContainer.setDefaultComponentAlignment(Alignment.TOP_LEFT); MButton addCriteriaBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_ADD_CRITERIA), clickEvent -> { CriteriaSelectionLayout newCriteriaBar = new CriteriaSelectionLayout( searchContainer.getComponentCount() + 1); searchContainer.addComponent(newCriteriaBar); }).withIcon(FontAwesome.PLUS).withStyleName(WebThemes.BUTTON_ACTION); this.with(searchContainer, new MHorizontalLayout(addCriteriaBtn).withMargin(true)); }
From source file:com.mycollab.vaadin.web.ui.DefaultDynaFormLayout.java
License:Open Source License
@Override public AbstractComponent getLayout() { FormContainer layout = new FormContainer(); int sectionCount = dynaForm.getSectionCount(); sectionMappings = new HashMap<>(); for (int i = 0; i < sectionCount; i++) { DynaSection section = dynaForm.getSection(i); if (section.isDeletedSection()) { continue; }//from w ww. ja va 2 s . c om if (section.getHeader() != null) { Label header = new Label(UserUIContext.getMessage(section.getHeader())); MCssLayout formSection = new MCssLayout(header).withStyleName(WebThemes.FORM_SECTION) .withFullWidth(); formSection.addStyleName(WebThemes.HOVER_EFFECT_NOT_BOX); layout.addComponent(formSection); } GridFormLayoutHelper gridLayout; if (section.isDeletedSection() || section.getFieldCount() == 0) { continue; } if (section.getLayoutType() == LayoutType.ONE_COLUMN) { gridLayout = GridFormLayoutHelper.defaultFormLayoutHelper(2, 1); for (int j = 0; j < section.getFieldCount(); j++) { AbstractDynaField dynaField = section.getField(j); if (!excludeFields.contains(dynaField.getFieldName())) { gridLayout.buildCell(UserUIContext.getMessage(dynaField.getDisplayName()), UserUIContext.getMessage(dynaField.getContextHelp()), 0, gridLayout.getRows() - 1, 2, "100%", Alignment.TOP_LEFT); if (j < section.getFieldCount() - 1) { gridLayout.appendRow(); } if (dynaField.isCustom()) { fieldMappings.put("customfield." + dynaField.getFieldName(), dynaField); } else { fieldMappings.put(dynaField.getFieldName(), dynaField); } } } } else if (section.getLayoutType() == LayoutType.TWO_COLUMN) { gridLayout = GridFormLayoutHelper.defaultFormLayoutHelper(2, 1); int columnIndex = 0; for (int j = 0; j < section.getFieldCount(); j++) { AbstractDynaField dynaField = section.getField(j); if (!excludeFields.contains(dynaField.getFieldName())) { if (dynaField.isColSpan()) { if (columnIndex > 0) { gridLayout.appendRow(); } gridLayout.buildCell(UserUIContext.getMessage(dynaField.getDisplayName()), UserUIContext.getMessage(dynaField.getContextHelp()), 0, gridLayout.getRows() - 1, 2, "100%", Alignment.TOP_LEFT); columnIndex = 0; if (j < section.getFieldCount() - 1) { gridLayout.appendRow(); } } else { gridLayout.buildCell(UserUIContext.getMessage(dynaField.getDisplayName()), UserUIContext.getMessage(dynaField.getContextHelp()), columnIndex, gridLayout.getRows() - 1); columnIndex++; if (columnIndex == 2) { columnIndex = 0; if (j < section.getFieldCount() - 1) { gridLayout.appendRow(); } } } if (dynaField.isCustom()) { fieldMappings.put("customfield." + dynaField.getFieldName(), dynaField); } else { fieldMappings.put(dynaField.getFieldName(), dynaField); } } } } else { throw new MyCollabException("Does not support attachForm layout except 1 or 2 columns"); } layout.addComponent(gridLayout.getLayout()); sectionMappings.put(section, gridLayout); } return layout; }
From source file:com.mycollab.vaadin.web.ui.grid.GridFormLayoutHelper.java
License:Open Source License
public static GridFormLayoutHelper defaultFormLayoutHelper(int columns, int rows, String controlWidth) { GridFormLayoutHelper helper = new GridFormLayoutHelper(columns, rows, "100%", controlWidth, Alignment.TOP_LEFT); helper.getLayout().setWidth("100%"); helper.getLayout().setSpacing(false); helper.getLayout().setMargin(false); helper.getLayout().addStyleName(WebThemes.GRIDFORM_STANDARD); return helper; }
From source file:com.mycollab.vaadin.web.ui.MultiSelectComp.java
License:Open Source License
@Override protected Component initContent() { MHorizontalLayout content = new MHorizontalLayout().withSpacing(true).withWidth(widthVal) .with(componentsText).withAlign(componentsText, Alignment.MIDDLE_LEFT); componentPopupSelection.addStyleName(WebThemes.MULTI_SELECT_BG); componentPopupSelection.setDirection(Alignment.TOP_LEFT); MHorizontalLayout multiSelectComp = new MHorizontalLayout().withSpacing(false) .with(componentsText, componentPopupSelection).expand(componentsText); content.with(multiSelectComp);/*ww w . ja va 2 s .c o m*/ if (canAddNew) { MButton newBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_ADD), clickEvent -> requestAddNewComp()).withStyleName(WebThemes.BUTTON_LINK); content.with(newBtn); } content.expand(multiSelectComp); return content; }
From source file:com.mycollab.vaadin.web.ui.NotificationComponent.java
License:Open Source License
private Component buildComponentFromNotification(AbstractNotification item) { final MHorizontalLayout wrapper = new MHorizontalLayout(); wrapper.setData(item);/*w w w .ja v a 2 s .c om*/ wrapper.setDefaultComponentAlignment(Alignment.TOP_LEFT); if (item instanceof NewUpdateAvailableNotification) { final NewUpdateAvailableNotification notification = (NewUpdateAvailableNotification) item; Span spanEl = new Span(); spanEl.appendText( UserUIContext.getMessage(ShellI18nEnum.OPT_HAVING_NEW_VERSION, notification.getVersion())); ELabel lbl = ELabel.html(FontAwesome.INFO_CIRCLE.getHtml() + " " + spanEl.write()).withFullWidth(); CssLayout lblWrapper = new CssLayout(); lblWrapper.addComponent(lbl); wrapper.addComponent(lblWrapper); wrapper.expand(lblWrapper); if (UserUIContext.isAdmin()) { MButton upgradeBtn = new MButton(UserUIContext.getMessage(ShellI18nEnum.ACTION_UPGRADE), clickEvent -> { UI.getCurrent().addWindow(new UpgradeConfirmWindow(notification.getVersion(), notification.getManualDownloadLink(), notification.getInstallerFile())); NotificationComponent.this.setPopupVisible(false); }).withStyleName(UIConstants.BLOCK); wrapper.addComponent(upgradeBtn); } } else if (item instanceof RequestUploadAvatarNotification) { wrapper.addComponent(new Label(FontAwesome.EXCLAMATION_TRIANGLE.getHtml() + " " + UserUIContext.getMessage(ShellI18nEnum.OPT_REQUEST_UPLOAD_AVATAR), ContentMode.HTML)); MButton uploadAvatarBtn = new MButton(UserUIContext.getMessage(ShellI18nEnum.ACTION_UPLOAD_AVATAR), clickEvent -> { EventBusFactory.getInstance() .post(new ShellEvent.GotoUserAccountModule(this, new String[] { "preview" })); NotificationComponent.this.setPopupVisible(false); }).withStyleName(UIConstants.BLOCK); wrapper.add(uploadAvatarBtn); } else if (item instanceof SmtpSetupNotification) { MButton smtpBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.ACTION_SETUP), clickEvent -> { EventBusFactory.getInstance() .post(new ShellEvent.GotoUserAccountModule(this, new String[] { "setup" })); NotificationComponent.this.setPopupVisible(false); }).withStyleName(UIConstants.BLOCK); Label lbl = ELabel.html(FontAwesome.EXCLAMATION_TRIANGLE.getHtml() + " " + UserUIContext.getMessage(ShellI18nEnum.ERROR_NO_SMTP_SETTING)); MCssLayout lblWrapper = new MCssLayout(lbl); wrapper.with(lblWrapper, smtpBtn).expand(lblWrapper); } else { LOG.error("Do not render notification " + item); } return wrapper; }
From source file:com.mycollab.vaadin.web.ui.SavedFilterComboBox.java
License:Open Source License
@Override protected Component initContent() { componentsText = new TextField(); componentsText.setNullRepresentation(""); componentsText.setReadOnly(true);/*from w w w .j a v a 2 s. com*/ componentsText.addStyleName("noBorderRight"); componentsText.setWidth("100%"); componentPopupSelection = new PopupButton(); componentPopupSelection.addStyleName(WebThemes.MULTI_SELECT_BG); componentPopupSelection.setDirection(Alignment.TOP_LEFT); componentPopupSelection.addClickListener(clickEvent -> initContentPopup()); popupContent = new OptionPopupContent(); componentPopupSelection.setContent(popupContent); MHorizontalLayout content = new MHorizontalLayout(componentsText).withAlign(componentsText, Alignment.MIDDLE_LEFT); MHorizontalLayout multiSelectComp = new MHorizontalLayout(componentsText, componentPopupSelection) .withSpacing(false).expand(componentsText); content.with(multiSelectComp); return content; }
From source file:com.peergreen.example.webconsole.extensions.ConfirmDialogExtension.java
License:Open Source License
public ConfirmDialogExtension() { setSizeFull();/*from ww w . ja v a2 s . c o m*/ setSpacing(true); setMargin(true); Link showCodeSource = new Link("Show code source", new ExternalResource(GitHubClassURL.getURL(ConfirmDialogExtension.class))); showCodeSource.setTargetName("_blank"); addComponent(showCodeSource); setComponentAlignment(showCodeSource, Alignment.TOP_RIGHT); Label title = new Label("Drag and drop components from a panel to another"); title.addStyleName("h1"); addComponent(title); setComponentAlignment(title, Alignment.MIDDLE_CENTER); HorizontalLayout row = new HorizontalLayout(); row.setSizeFull(); row.setSpacing(true); row.setMargin(true); VerticalLayout leftPanel = new VerticalLayout(); leftPanel.setSpacing(true); leftPanel.addStyleName("dashed-area"); leftPanel.addComponent(getDraggableComponent(new Label("Label"))); leftPanel.addComponent(getDraggableComponent(new Button("Button"))); DragAndDropWrapper leftPanelWrapper = new DragAndDropWrapper(leftPanel); row.addComponent(leftPanelWrapper); row.setComponentAlignment(leftPanelWrapper, Alignment.TOP_LEFT); VerticalLayout rightPanel = new VerticalLayout(); rightPanel.setSpacing(true); rightPanel.addStyleName("dashed-area"); DragAndDropWrapper rightPanelWrapper = new DragAndDropWrapper(rightPanel); row.addComponent(rightPanelWrapper); row.setComponentAlignment(rightPanelWrapper, Alignment.TOP_RIGHT); leftPanelWrapper.setDropHandler(new ConfirmDialogExtensionDropHandler(rightPanel, leftPanel)); rightPanelWrapper.setDropHandler(new ConfirmDialogExtensionDropHandler(leftPanel, rightPanel)); addComponent(row); setExpandRatio(row, 1.5f); }
From source file:com.peergreen.webconsole.scope.deployment.internal.components.ExceptionView.java
License:Open Source License
private void showDefaultView() { if (messageView == null) { messageView = new HorizontalLayout(); messageView.setWidth("100%"); StringBuilder sb = new StringBuilder(); sb.append("<span style=\"color:red\">"); sb.append(artifactErrorDetail.getMessage()); sb.append("</span>"); Label message = new Label(sb.toString(), ContentMode.HTML); messageView.addComponent(message); messageView.setComponentAlignment(message, Alignment.TOP_LEFT); Button details = new Button("Details"); details.addStyleName("link"); details.addClickListener(new Button.ClickListener() { @Override/*w w w . j a v a 2s.c o m*/ public void buttonClick(Button.ClickEvent event) { showDetailsView(); } }); messageView.addComponent(details); messageView.setComponentAlignment(details, Alignment.TOP_RIGHT); } removeAllComponents(); addComponent(messageView); }