List of usage examples for com.vaadin.ui HorizontalLayout setExpandRatio
public void setExpandRatio(Component component, float ratio)
This method is used to control how excess space in layout is distributed among components.
From source file:org.escidoc.browser.ui.maincontent.OrgUnitView.java
License:Open Source License
private HorizontalLayout bindProperties() { HorizontalLayout hlProperties = new HorizontalLayout(); hlProperties.setWidth("100%"); vlLeft = new VerticalLayout(); VerticalLayout vlRight = new VerticalLayout(); final Label descMetadata1 = new Label("ID: " + resourceProxy.getId()); status = resourceProxy.getType().getLabel() + " is "; lblStatus = new Label(status + resourceProxy.getStatus(), Label.CONTENT_RAW); if (orgUnitController.hasAccess()) { lblStatus.setDescription(ViewConstants.DESC_STATUS); lblStatus.setStyleName("inset"); }//from w w w.ja va 2s.c o m lblStatus.setDescription(ViewConstants.DESC_STATUS); vlLeft.addComponent(descMetadata1); vlLeft.addComponent(lblStatus); // RIGHT SIDE final Label descMetadata2 = new Label(ViewConstants.CREATED_BY + " " + resourceProxy.getCreator() + " on " + resourceProxy.getCreatedOn() + "<br/>" + ViewConstants.LAST_MODIFIED_BY + " " + resourceProxy.getModifier() + " on " + resourceProxy.getModifiedOn(), Label.CONTENT_XHTML); descMetadata2.setStyleName("floatright columnheight50"); descMetadata2.setWidth("65%"); vlRight.addComponent(descMetadata2); hlProperties.addComponent(vlLeft); hlProperties.setExpandRatio(vlLeft, 0.4f); hlProperties.addComponent(vlRight); hlProperties.setExpandRatio(vlRight, 0.6f); return hlProperties; }
From source file:org.escidoc.browser.ui.tools.BulkTasksView.java
License:Open Source License
private void addResult() { final HorizontalLayout horizontalLayout = new HorizontalLayout(); horizontalLayout.setWidth("100%"); horizontalLayout.setSpacing(true);//from w w w.j a v a2 s .c o m textField.setWidth("100%"); createResourceOptions(); final Button filterButton = new Button(ViewConstants.FILTER); filterButton.setStyleName(Reindeer.BUTTON_SMALL); filterButton.addListener(new FilterButtonListener(this, router.getMainWindow(), repositories)); horizontalLayout.addComponent(resourceOption); horizontalLayout.addComponent(createHelpView()); horizontalLayout.addComponent(textField); horizontalLayout.addComponent(filterButton); horizontalLayout.setExpandRatio(textField, 1.0f); addComponent(horizontalLayout); }
From source file:org.freakz.hokan_ng_springboot.bot.MainScreen.java
License:Apache License
@Autowired public MainScreen(final VaadinSecurity vaadinSecurity, SpringViewProvider springViewProvider, ValoSideBar sideBar) {/*from ww w. j a va2 s . c o m*/ HorizontalLayout layout = new HorizontalLayout(); layout.setSizeFull(); setCompositionRoot(layout); setSizeFull(); // By adding a security item filter, only views that are accessible to the user will show up in the side bar. sideBar.setItemFilter(new VaadinSecurityItemFilter(vaadinSecurity)); layout.addComponent(sideBar); CssLayout viewContainer = new CssLayout(); viewContainer.setSizeFull(); layout.addComponent(viewContainer); layout.setExpandRatio(viewContainer, 1f); Navigator navigator = new Navigator(UI.getCurrent(), viewContainer); // Without an AccessDeniedView, the view provider would act like the restricted views did not exist at all. springViewProvider.setAccessDeniedViewClass(AccessDeniedView.class); navigator.addProvider(springViewProvider); navigator.setErrorView(ErrorView.class); navigator.navigateTo(navigator.getState()); }
From source file:org.gpstouch.account.AccountGridView.java
public HorizontalLayout createTopBar() { TextField filter = new TextField(); filter.setStyleName("filter-textfield"); filter.setInputPrompt("Filter"); ResetButtonForTextField.extend(filter); filter.setImmediate(true);/* ww w . ja va 2 s. c o m*/ filter.addTextChangeListener(new FieldEvents.TextChangeListener() { @Override public void textChange(FieldEvents.TextChangeEvent event) { grid.setFilter(event.getText()); } }); bnewAccount = new Button("New Account"); bnewAccount.addStyleName(ValoTheme.BUTTON_PRIMARY); bnewAccount.setIcon(FontAwesome.PLUS_CIRCLE); bnewAccount.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { viewLogic.newAccount(); } }); HorizontalLayout topLayout = new HorizontalLayout(); topLayout.setSpacing(true); topLayout.setWidth("100%"); topLayout.addComponent(filter); topLayout.addComponent(bnewAccount); topLayout.setComponentAlignment(filter, Alignment.MIDDLE_LEFT); topLayout.setExpandRatio(filter, 1); topLayout.setStyleName("top-bar"); return topLayout; }
From source file:org.hip.vif.admin.groupadmin.ui.AbstractContributionView.java
License:Open Source License
private Component createBibliography(final GeneralDomainObject inBibliography, final AbstractAdminTask inTask, final IMessages inMessages) throws VException { final HorizontalLayout out = new HorizontalLayout(); out.setWidth("100%"); //$NON-NLS-1$ out.setStyleName("vif-bibliography"); //$NON-NLS-1$ final Long lBiblioID = BeanWrapperHelper.getLong(TextHome.KEY_ID, inBibliography); final Button lRemove = new Button(inMessages.getMessage("ui.bibliography.link.button.remove")); //$NON-NLS-1$ lRemove.addClickListener(new Button.ClickListener() { @Override//from w w w . j ava 2s.co m public void buttonClick(final ClickEvent inEvent) { if (!inTask.unlinkBibliography(lBiblioID)) { Notification.show(inMessages.getMessage("errmsg.biblio.remove"), Type.WARNING_MESSAGE); //$NON-NLS-1$ } } }); out.addComponent(lRemove); final Button lLink = LinkButtonHelper.createLinkButton( BeanWrapperHelper.getString(TextHome.KEY_REFERENCE, inBibliography), LinkButtonHelper.LookupType.BIBLIOGRAPHY, lBiblioID, inTask); lLink.setStyleName(BaseTheme.BUTTON_LINK); out.addComponent(lLink); final BibliographyFormatter lFormatter = new BibliographyFormatter( new BibliographyAdapter(inBibliography, TextHome.KEY_BIBLIO_TYPE)); final Label lLabel = new Label(lFormatter.renderHtml(), ContentMode.HTML); lLabel.setWidth("100%"); //$NON-NLS-1$ out.addComponent(lLabel); out.setExpandRatio(lLabel, 1.0f); return out; }
From source file:org.hip.vif.admin.groupadmin.ui.QuestionView.java
License:Open Source License
private Component createQuestionActionButtons(final AdminQuestionShowTask inTask, final IMessages inMessages) { final AbstractDialogWindow lDialogPublish = Dialog.openQuestion( inMessages.getMessage("ui.discussion.dialog.title"), //$NON-NLS-1$ inMessages.getMessage("ui.discussion.dialog.question.publish"), new Dialog.ICommand() { //$NON-NLS-1$ @Override/*from w ww . j a v a 2s. c o m*/ public void execute() { if (!inTask.publish()) { Notification.show(inMessages.getMessage("errmsg.contribution.publish"), //$NON-NLS-1$ Type.WARNING_MESSAGE); } } }); final AbstractDialogWindow lDialogDelete = Dialog.openQuestion( inMessages.getMessage("ui.discussion.dialog.title"), //$NON-NLS-1$ inMessages.getMessage("ui.discussion.dialog.question.delete"), new Dialog.ICommand() { //$NON-NLS-1$ @Override public void execute() { if (!inTask.delete()) { Notification.show(inMessages.getMessage("errmsg.contribution.delete"), //$NON-NLS-1$ Type.WARNING_MESSAGE); } } }); final HorizontalLayout outButtons = new HorizontalLayout(); outButtons.setSpacing(true); outButtons.setWidth("100%"); //$NON-NLS-1$ final Button lEdit = new Button(inMessages.getMessage("ui.discussion.question.button.edit")); //$NON-NLS-1$ lEdit.addClickListener(new Button.ClickListener() { @Override public void buttonClick(final ClickEvent inEvent) { inTask.editQuestion(); } }); outButtons.addComponent(lEdit); final Button lPublish = new Button(inMessages.getMessage("ui.discussion.contribution.button.publish")); //$NON-NLS-1$ lPublish.addClickListener(Dialog.createClickListener(lDialogPublish, this)); outButtons.addComponent(lPublish); final Button lDelete = new Button(inMessages.getMessage("ui.discussion.contribution.button.delete")); //$NON-NLS-1$ lDelete.addClickListener(Dialog.createClickListener(lDialogDelete, this)); outButtons.addComponent(lDelete); outButtons.setExpandRatio(lEdit, 1); outButtons.setComponentAlignment(lEdit, Alignment.MIDDLE_RIGHT); return outButtons; }
From source file:org.hip.vif.forum.groups.ui.AbstractQuestionView.java
License:Open Source License
private VerticalLayout createQuestionLayout(final Question inQuestion, final String inTitle, final HorizontalLayout inTitleView, final CodeList inCodeList, final IMessages inMessages) { final VerticalLayout outLayout = new VerticalLayout(); outLayout.setWidth("100%"); //$NON-NLS-1$ // question title and state inTitleView.setStyleName("vif-title-bar"); //$NON-NLS-1$ final Label lLabel = new Label(String.format(VIFViewHelper.TMPL_TITLE, "vif-title", inTitle), //$NON-NLS-1$ ContentMode.HTML);// ww w .j a v a 2 s . c o m inTitleView.addComponent(RiplaViewHelper.makeUndefinedWidth(lLabel)); //$NON-NLS-1$ final String lState = getState(BeanWrapperHelper.getString(QuestionHome.KEY_STATE, inQuestion), inCodeList, inMessages); final Label lNote = new Label(String.format(VIFViewHelper.TMPL_TITLE, "vif-note", lState), //$NON-NLS-1$ ContentMode.HTML); lNote.setWidth("100%"); //$NON-NLS-1$ inTitleView.addComponent(RiplaViewHelper.makeUndefinedWidth(lNote)); inTitleView.setComponentAlignment(lNote, Alignment.BOTTOM_LEFT); inTitleView.setExpandRatio(lLabel, 1); inTitleView.setExpandRatio(lNote, 6); outLayout.addComponent(inTitleView); addProperQuestion(inQuestion, inMessages, outLayout); return outLayout; }
From source file:org.hip.vif.forum.groups.ui.AbstractQuestionView.java
License:Open Source License
private void addBibliographyText(final GeneralDomainObject inBibliography, final HorizontalLayout inLayout) throws VException { final BibliographyFormatter lFormatter = new BibliographyFormatter( new BibliographyAdapter(inBibliography, TextHome.KEY_BIBLIO_TYPE)); final Label lLabel = new Label(lFormatter.renderHtml(), ContentMode.HTML); lLabel.setWidth("100%"); //$NON-NLS-1$ inLayout.addComponent(lLabel);/*w w w. jav a 2 s . co m*/ inLayout.setExpandRatio(lLabel, 1.0f); }
From source file:org.hip.vif.forum.groups.ui.QuestionView.java
License:Open Source License
/** Buttons to subscribe and bookmark. * * @param inQuestion//from ww w . j av a 2 s . c o m * @param inSwitchHelper * @param inMessages * @param inLayout * @param inTask */ private void createSubscribeBookmarkButtons(final Question inQuestion, final SwitchHelper inSwitchHelper, final IMessages inMessages, final VerticalLayout inLayout, final QuestionShowTask inTask) { final HorizontalLayout lButtons = new HorizontalLayout(); lButtons.setSpacing(true); lButtons.setWidth("100%"); //$NON-NLS-1$ subscribe = new Button(inSwitchHelper.getSubscriptionCaption()); final SubscribeDialog lSubscribeDialog = new SubscribeDialog(inMessages); lSubscribeDialog.setStoreClickListener(new Button.ClickListener() { @Override public void buttonClick(final ClickEvent inEvent) { handleSwitchAction(inSwitchHelper.createSubscription(lSubscribeDialog.getCheckBoxValue()), subscribe, inSwitchHelper.getSubscriptionCaption(), inMessages.getMessage("ui.question.view.subscription.msg1"), //$NON-NLS-1$ inMessages.getMessage("ui.question.view.subscription.msg2")); //$NON-NLS-1$ lSubscribeDialog.close(); } }); subscribe.addClickListener(new Button.ClickListener() { @Override public void buttonClick(final ClickEvent inEvent) { if (inSwitchHelper.hasSubscription()) { handleSwitchAction(inSwitchHelper.deleteSubscription(), subscribe, inSwitchHelper.getSubscriptionCaption(), inMessages.getMessage("ui.question.view.subscription.msg3"), //$NON-NLS-1$ inMessages.getMessage("ui.question.view.subscription.msg4")); //$NON-NLS-1$ } else { showDialog(lSubscribeDialog); } } }); lButtons.addComponent(subscribe); lButtons.setExpandRatio(subscribe, 1); lButtons.setComponentAlignment(subscribe, Alignment.MIDDLE_RIGHT); bookmark = new Button(inSwitchHelper.getBookmarkCaption()); final BookmarkDialog lBookmarkDialog = new BookmarkDialog(inMessages, String.format("%s - %s", //$NON-NLS-1$ BeanWrapperHelper.getString(QuestionHome.KEY_QUESTION_DECIMAL, inQuestion), BeanWrapperHelper.getPlain(QuestionHome.KEY_QUESTION, inQuestion))); lBookmarkDialog.setStoreClickListener(new Button.ClickListener() { @Override public void buttonClick(final ClickEvent inEvent) { handleSwitchAction(inSwitchHelper.createBookmark(lBookmarkDialog.getFieldValue()), bookmark, inSwitchHelper.getBookmarkCaption(), inMessages.getMessage("ui.question.view.bookmark.msg1"), //$NON-NLS-1$ inMessages.getMessage("ui.question.view.bookmark.msg2")); //$NON-NLS-1$ lBookmarkDialog.close(); } }); bookmark.addClickListener(new Button.ClickListener() { @Override public void buttonClick(final ClickEvent inEvent) { if (inSwitchHelper.hasBookmark()) { handleSwitchAction(inSwitchHelper.deleteBookmark(), bookmark, inSwitchHelper.getBookmarkCaption(), inMessages.getMessage("ui.question.view.bookmark.msg3"), //$NON-NLS-1$ inMessages.getMessage("ui.question.view.bookmark.msg4")); //$NON-NLS-1$ } else { showDialog(lBookmarkDialog); } } }); lButtons.addComponent(bookmark); inLayout.addComponent(lButtons); }
From source file:org.hip.vif.skin.dflt.Skin.java
License:Open Source License
@Override public Component getHeader(final String inAppName) { final HorizontalLayout outLayout = new HorizontalLayout(); outLayout.setStyleName("vif-head"); outLayout.setMargin(false);//from w w w. ja v a2 s .c o m outLayout.setWidth("100%"); outLayout.setHeight(80, Unit.PIXELS); final Embedded lImage = new Embedded(); lImage.setSource(new ThemeResource("images/vifLogo.gif")); outLayout.addComponent(lImage); outLayout.setComponentAlignment(lImage, Alignment.TOP_LEFT); outLayout.setExpandRatio(lImage, 0.42f); final Label lTitle = LabelHelper.createLabel("VIF Forum", "vif-head-title"); lTitle.setSizeUndefined(); outLayout.addComponent(lTitle); outLayout.setComponentAlignment(lTitle, Alignment.MIDDLE_LEFT); outLayout.setExpandRatio(lTitle, 0.58f); return outLayout; }