List of usage examples for com.vaadin.ui HorizontalLayout setMargin
@Override public void setMargin(boolean enabled)
From source file:org.bubblecloud.ilves.ui.user.AccountFlowlet.java
License:Apache License
@Override public void initialize() { final GridLayout gridLayout = new GridLayout(1, 6); gridLayout.setRowExpandRatio(0, 0.0f); gridLayout.setRowExpandRatio(1, 0.0f); gridLayout.setRowExpandRatio(2, 0.0f); gridLayout.setRowExpandRatio(3, 0.0f); gridLayout.setRowExpandRatio(4, 0.0f); gridLayout.setRowExpandRatio(5, 1.0f); gridLayout.setSizeFull();//from w w w . j ava 2s . c om gridLayout.setMargin(false); gridLayout.setSpacing(true); gridLayout.setRowExpandRatio(4, 1f); setViewContent(gridLayout); final HorizontalLayout userAccountTitle = new HorizontalLayout(); userAccountTitle.setMargin(new MarginInfo(false, false, false, false)); userAccountTitle.setSpacing(true); final Embedded userAccountTitleIcon = new Embedded(null, getSite().getIcon("view-icon-user")); userAccountTitleIcon.setWidth(32, Unit.PIXELS); userAccountTitleIcon.setHeight(32, Unit.PIXELS); userAccountTitle.addComponent(userAccountTitleIcon); final Label userAccountTitleLabel = new Label("<h2>User Account</h2>", ContentMode.HTML); userAccountTitle.addComponent(userAccountTitleLabel); gridLayout.addComponent(userAccountTitle, 0, 0); final Button editUserButton = new Button("Edit User Account"); editUserButton.setIcon(getSite().getIcon("button-icon-edit")); gridLayout.addComponent(editUserButton, 0, 2); editUserButton.addClickListener(new ClickListener() { /** Serial version UID. */ private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { final User entity = ((SecurityProviderSessionImpl) getSite().getSecurityProvider()) .getUserFromSession(); final UserAccountFlowlet customerView = getFlow().getFlowlet(UserAccountFlowlet.class); customerView.edit(entity, false); getFlow().forward(UserAccountFlowlet.class); } }); final Company company = getSite().getSiteContext().getObject(Company.class); if (company.isOpenIdLogin()) { final VerticalLayout mainPanel = new VerticalLayout(); mainPanel.setCaption("Choose OpenID Provider:"); gridLayout.addComponent(mainPanel, 0, 1); final HorizontalLayout openIdLayout = new HorizontalLayout(); mainPanel.addComponent(openIdLayout); openIdLayout.setMargin(new MarginInfo(false, false, true, false)); openIdLayout.setSpacing(true); final String returnViewName = "openidlink"; final Map<String, String> urlIconMap = OpenIdUtil.getOpenIdProviderUrlIconMap(); for (final String url : urlIconMap.keySet()) { openIdLayout.addComponent(OpenIdUtil.getLoginButton(url, urlIconMap.get(url), returnViewName)); } } if (SiteModuleManager.isModuleInitialized(CustomerModule.class)) { final List<FieldDescriptor> fieldDefinitions = SiteFields.getFieldDescriptors(Customer.class); final List<FilterDescriptor> filterDefinitions = new ArrayList<FilterDescriptor>(); filterDefinitions.add(new FilterDescriptor("companyName", "companyName", "Company Name", new TextField(), 101, "=", String.class, "")); filterDefinitions.add(new FilterDescriptor("lastName", "lastName", "Last Name", new TextField(), 101, "=", String.class, "")); final EntityManager entityManager = getSite().getSiteContext().getObject(EntityManager.class); entityContainer = new EntityContainer<Customer>(entityManager, true, false, false, Customer.class, 1000, new String[] { "companyName", "lastName" }, new boolean[] { false, false }, "customerId"); for (final FieldDescriptor fieldDefinition : fieldDefinitions) { entityContainer.addContainerProperty(fieldDefinition.getId(), fieldDefinition.getValueType(), fieldDefinition.getDefaultValue(), fieldDefinition.isReadOnly(), fieldDefinition.isSortable()); } final HorizontalLayout titleLayout = new HorizontalLayout(); titleLayout.setMargin(new MarginInfo(true, false, false, false)); titleLayout.setSpacing(true); final Embedded titleIcon = new Embedded(null, getSite().getIcon("view-icon-customer")); titleIcon.setWidth(32, Unit.PIXELS); titleIcon.setHeight(32, Unit.PIXELS); titleLayout.addComponent(titleIcon); final Label titleLabel = new Label("<h2>Customer Accounts</h2>", ContentMode.HTML); titleLayout.addComponent(titleLabel); gridLayout.addComponent(titleLayout, 0, 3); final Table table = new Table(); table.setPageLength(5); entityGrid = new Grid(table, entityContainer); entityGrid.setFields(fieldDefinitions); entityGrid.setFilters(filterDefinitions); //entityGrid.setFixedWhereCriteria("e.owner.companyId=:companyId"); table.setColumnCollapsed("created", true); table.setColumnCollapsed("modified", true); table.setColumnCollapsed("company", true); gridLayout.addComponent(entityGrid, 0, 5); final HorizontalLayout customerButtonsLayout = new HorizontalLayout(); gridLayout.addComponent(customerButtonsLayout, 0, 4); customerButtonsLayout.setMargin(false); customerButtonsLayout.setSpacing(true); final Button editCustomerDetailsButton = new Button("Edit Customer Details"); customerButtonsLayout.addComponent(editCustomerDetailsButton); editCustomerDetailsButton.setEnabled(false); editCustomerDetailsButton.setIcon(getSite().getIcon("button-icon-edit")); editCustomerDetailsButton.addClickListener(new ClickListener() { /** * Serial version UID. */ private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { if (entityGrid.getSelectedItemId() == null) { return; } final Customer entity = entityContainer.getEntity(entityGrid.getSelectedItemId()); final CustomerFlowlet customerView = getFlow().forward(CustomerFlowlet.class); customerView.edit(entity, false); } }); final Button editCustomerMembersButton = new Button("Edit Customer Members"); customerButtonsLayout.addComponent(editCustomerMembersButton); editCustomerMembersButton.setEnabled(false); editCustomerMembersButton.setIcon(getSite().getIcon("button-icon-edit")); editCustomerMembersButton.addClickListener(new ClickListener() { /** * Serial version UID. */ private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { if (entityGrid.getSelectedItemId() == null) { return; } final Customer entity = entityContainer.getEntity(entityGrid.getSelectedItemId()); final GroupFlowlet view = getFlow().forward(GroupFlowlet.class); view.edit(entity.getMemberGroup(), false); } }); final Button editCustomerAdminsButton = new Button("Edit Customer Admins"); customerButtonsLayout.addComponent(editCustomerAdminsButton); editCustomerAdminsButton.setEnabled(false); editCustomerAdminsButton.setIcon(getSite().getIcon("button-icon-edit")); editCustomerAdminsButton.addClickListener(new ClickListener() { /** * Serial version UID. */ private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { if (entityGrid.getSelectedItemId() == null) { return; } final Customer entity = entityContainer.getEntity(entityGrid.getSelectedItemId()); final GroupFlowlet view = getFlow().forward(GroupFlowlet.class); view.edit(entity.getAdminGroup(), false); } }); table.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(final Property.ValueChangeEvent event) { editCustomerDetailsButton.setEnabled(table.getValue() != null); editCustomerMembersButton.setEnabled(table.getValue() != null); editCustomerAdminsButton.setEnabled(table.getValue() != null); } }); } }
From source file:org.bubblecloud.ilves.ui.user.privilege.PrivilegesFlowlet.java
License:Apache License
@Override protected void initialize() { final HorizontalLayout titleLayout = new HorizontalLayout(); titleLayout.setMargin(new MarginInfo(true, false, true, false)); titleLayout.setSpacing(true);/* w w w. j a v a 2s.c om*/ final Embedded titleIcon = new Embedded(null, getSite().getIcon("view-icon-privileges")); titleIcon.setWidth(32, Unit.PIXELS); titleIcon.setHeight(32, Unit.PIXELS); titleLayout.addComponent(titleIcon); titleLabel = new Label("<h1>" + getSite().localize("view-privileges") + "</h1>", ContentMode.HTML); titleLayout.addComponent(titleLabel); matrixLayout = new VerticalLayout(); matrixLayout.setSpacing(true); matrixLayout.setMargin(false); final HorizontalLayout buttonLayout = new HorizontalLayout(); buttonLayout.setSpacing(true); saveButton = getSite().getButton("save"); buttonLayout.addComponent(saveButton); saveButton.addClickListener(new Button.ClickListener() { /** Serial version UID. */ private static final long serialVersionUID = 1L; @Override public void buttonClick(final Button.ClickEvent event) { saveGroupMatrix(); saveUserMatrix(); PrivilegeCache.flush((Company) Site.getCurrent().getSiteContext().getObject(Company.class)); } }); discardButton = getSite().getButton("discard"); buttonLayout.addComponent(discardButton); discardButton.addClickListener(new Button.ClickListener() { /** Serial version UID. */ private static final long serialVersionUID = 1L; @Override public void buttonClick(final Button.ClickEvent event) { refreshGroupMatrix(); refreshUserMatrix(); } }); final CssLayout panel = new CssLayout(); panel.addComponent(titleLayout); panel.addComponent(matrixLayout); panel.addComponent(buttonLayout); setCompositionRoot(panel); }
From source file:org.eclipse.hawkbit.ui.artifacts.details.ArtifactDetailsLayout.java
License:Open Source License
private void buildLayout() { final HorizontalLayout header = new HorizontalLayout(); header.addStyleName("artifact-details-header"); header.addStyleName("bordered-layout"); header.addStyleName("no-border-bottom"); header.setSpacing(false);/*www. java 2 s .co m*/ header.setMargin(false); header.setSizeFull(); header.setHeightUndefined(); header.setImmediate(true); header.addComponents(titleOfArtifactDetails, maxMinButton); header.setComponentAlignment(titleOfArtifactDetails, Alignment.TOP_LEFT); header.setComponentAlignment(maxMinButton, Alignment.TOP_RIGHT); header.setExpandRatio(titleOfArtifactDetails, 1.0F); setSizeFull(); setImmediate(true); addStyleName("artifact-table"); addStyleName("table-layout"); addComponent(header); setComponentAlignment(header, Alignment.MIDDLE_CENTER); addComponent(artifactDetailsTable); setComponentAlignment(artifactDetailsTable, Alignment.MIDDLE_CENTER); setExpandRatio(artifactDetailsTable, 1.0F); }
From source file:org.eclipse.hawkbit.ui.artifacts.upload.UploadConfirmationWindow.java
License:Open Source License
private HorizontalLayout getFooterLayout() { final HorizontalLayout footer = new HorizontalLayout(); footer.setSizeUndefined();/*from ww w . jav a 2 s . co m*/ footer.addStyleName("confirmation-window-footer"); footer.setSpacing(true); footer.setMargin(false); footer.addComponents(uploadBtn, cancelBtn); footer.setComponentAlignment(uploadBtn, Alignment.TOP_LEFT); footer.setComponentAlignment(cancelBtn, Alignment.TOP_RIGHT); return footer; }
From source file:org.eclipse.hawkbit.ui.artifacts.upload.UploadResultWindow.java
License:Open Source License
private void createLayout() { final HorizontalLayout footer = new HorizontalLayout(); footer.setSizeUndefined();/* www .j a v a 2 s . c o m*/ footer.addStyleName("confirmation-window-footer"); footer.setSpacing(true); footer.setMargin(false); footer.addComponents(closeBtn); footer.setComponentAlignment(closeBtn, Alignment.TOP_CENTER); final VerticalLayout uploadResultDetails = new VerticalLayout(); uploadResultDetails.setWidth(SPUIDefinitions.MIN_UPLOAD_CONFIRMATION_POPUP_WIDTH + "px"); uploadResultDetails.addStyleName("confirmation-popup"); uploadResultDetails.addComponent(uploadResultTable); uploadResultDetails.setComponentAlignment(uploadResultTable, Alignment.MIDDLE_CENTER); uploadResultDetails.addComponent(footer); uploadResultDetails.setComponentAlignment(footer, Alignment.MIDDLE_CENTER); uploadResultsWindow = new Window(); uploadResultsWindow.setContent(uploadResultDetails); uploadResultsWindow.setResizable(Boolean.FALSE); uploadResultsWindow.setClosable(Boolean.FALSE); uploadResultsWindow.setDraggable(Boolean.TRUE); uploadResultsWindow.setModal(true); uploadResultsWindow.setCaption(SPUILabelDefinitions.UPLOAD_RESULT); uploadResultsWindow.addStyleName(SPUIStyleDefinitions.CONFIRMATION_WINDOW_CAPTION); }
From source file:org.eclipse.hawkbit.ui.common.AbstractMetadataPopupLayout.java
License:Open Source License
private void buildLayout() { final HorizontalLayout headerLayout = new HorizontalLayout(); headerLayout.addStyleName(SPUIStyleDefinitions.WIDGET_TITLE); headerLayout.setSpacing(false);/*from ww w .ja v a 2s . c om*/ headerLayout.setMargin(false); headerLayout.setSizeFull(); headerLayout.addComponent(headerCaption); if (hasCreatePermission()) { headerLayout.addComponents(addIcon); headerLayout.setComponentAlignment(addIcon, Alignment.MIDDLE_RIGHT); } headerLayout.setExpandRatio(headerCaption, 1.0F); final HorizontalLayout headerWrapperLayout = new HorizontalLayout(); headerWrapperLayout .addStyleName("bordered-layout" + " " + "no-border-bottom" + " " + "metadata-table-margin"); headerWrapperLayout.addComponent(headerLayout); headerWrapperLayout.setWidth("100%"); headerLayout.setHeight("30px"); final VerticalLayout tableLayout = new VerticalLayout(); tableLayout.setSizeFull(); tableLayout.setHeight("100%"); tableLayout.addComponent(headerWrapperLayout); tableLayout.addComponent(metaDataGrid); tableLayout.addStyleName("table-layout"); tableLayout.setExpandRatio(metaDataGrid, 1.0F); final VerticalLayout metadataFieldsLayout = createMetadataFieldsLayout(); mainLayout = new HorizontalLayout(); mainLayout.addComponent(tableLayout); mainLayout.addComponent(metadataFieldsLayout); mainLayout.setExpandRatio(tableLayout, 0.5F); mainLayout.setExpandRatio(metadataFieldsLayout, 0.5F); mainLayout.setSizeFull(); mainLayout.setSpacing(true); setCompositionRoot(mainLayout); setSizeFull(); }
From source file:org.eclipse.hawkbit.ui.common.grid.AbstractGridHeader.java
License:Open Source License
private static HorizontalLayout createHeaderFilterIconLayout() { final HorizontalLayout titleFilterIconsLayout = new HorizontalLayout(); titleFilterIconsLayout.addStyleName(SPUIStyleDefinitions.WIDGET_TITLE); titleFilterIconsLayout.setSpacing(false); titleFilterIconsLayout.setMargin(false); titleFilterIconsLayout.setSizeFull(); return titleFilterIconsLayout; }
From source file:org.eclipse.hawkbit.ui.layouts.AbstractCreateUpdateTagLayout.java
License:Open Source License
protected void buildLayout() { mainLayout = new GridLayout(3, 2); mainLayout.setSpacing(true);/*from www.j a v a 2 s . c o m*/ comboLayout = new VerticalLayout(); colorPickerLayout = new ColorPickerLayout(); ColorPickerHelper.setRgbSliderValues(colorPickerLayout); contentLayout = new VerticalLayout(); final HorizontalLayout colorLabelLayout = new HorizontalLayout(); colorLabelLayout.setMargin(false); colorLabelLayout.addComponents(colorLabel, tagColorPreviewBtn); formLayout.addComponent(optiongroup); formLayout.addComponent(comboLayout); formLayout.addComponent(tagName); formLayout.addComponent(tagDesc); formLayout.addStyleName("form-lastrow"); formLayout.setSizeFull(); contentLayout.addComponent(formLayout); contentLayout.addComponent(colorLabelLayout); contentLayout.setComponentAlignment(formLayout, Alignment.MIDDLE_CENTER); contentLayout.setComponentAlignment(colorLabelLayout, Alignment.MIDDLE_LEFT); contentLayout.setSizeUndefined(); mainLayout.setSizeFull(); mainLayout.addComponent(contentLayout, 0, 0); colorPickerLayout.setVisible(false); mainLayout.addComponent(colorPickerLayout, 1, 0); mainLayout.setComponentAlignment(colorPickerLayout, Alignment.MIDDLE_CENTER); setCompositionRoot(mainLayout); tagName.focus(); }
From source file:org.eclipse.hawkbit.ui.management.actionhistory.ActionHistoryHeader.java
License:Open Source License
private void buildLayout() { final HorizontalLayout titleMaxIconsLayout = new HorizontalLayout(); titleMaxIconsLayout.addStyleName(SPUIStyleDefinitions.WIDGET_TITLE); titleMaxIconsLayout.setSpacing(false); titleMaxIconsLayout.setMargin(false); titleMaxIconsLayout.setSizeFull();/*from w w w . j a v a2 s . c om*/ titleMaxIconsLayout.addComponents(titleOfActionHistory, maxMinButton); titleMaxIconsLayout.setComponentAlignment(titleOfActionHistory, Alignment.TOP_LEFT); titleMaxIconsLayout.setComponentAlignment(maxMinButton, Alignment.TOP_RIGHT); titleMaxIconsLayout.setExpandRatio(titleOfActionHistory, 0.8f); titleMaxIconsLayout.setExpandRatio(maxMinButton, 0.2f); // Note: here the only purpose of adding drop hints to the layout is to // maintain consistent // height for all widgets headers. addComponent(titleMaxIconsLayout); setComponentAlignment(titleMaxIconsLayout, Alignment.TOP_LEFT); setWidth(100, Unit.PERCENTAGE); setImmediate(true); addStyleName("action-history-header"); addStyleName("bordered-layout"); addStyleName("no-border-bottom"); }
From source file:org.escidoc.browser.controller.ContentModelView.java
License:Open Source License
private HorizontalLayout buildHlMetaViews() { // common part: create layout HorizontalLayout hlMetaViews = new HorizontalLayout(); hlMetaViews.setImmediate(false);/*from www .j a va 2 s .com*/ hlMetaViews.setWidth("100.0%"); hlMetaViews.setHeight("100.0%"); hlMetaViews.setMargin(false); // leftPanel Panel leftPanel = buildLeftPanel(); hlMetaViews.addComponent(leftPanel); hlMetaViews.setExpandRatio(leftPanel, 4.5f); // rightPanel Panel rightPanel = buildRightPanel(); hlMetaViews.addComponent(rightPanel); hlMetaViews.setExpandRatio(rightPanel, 5.5f); return hlMetaViews; }