List of usage examples for com.vaadin.ui VerticalLayout setMargin
@Override public void setMargin(boolean enabled)
From source file:com.lst.deploymentautomation.vaadin.popup.TodoRejection.java
License:Open Source License
@Override public void attach() { super.attach(); LspsUI ui = (LspsUI) getUI();/*from ww w . j av a2 s . com*/ setCaption(ui.getMessage("todo.rejectionTitle")); VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); layout.setSpacing(true); layout.setSizeFull(); setContent(layout); Label help = new Label(ui.getMessage("todo.rejectionHelp")); help.setStyleName("form-help"); layout.addComponent(help); reason = new TextArea(ui.getMessage("todo.rejectionReason")); reason.setMaxLength(1024); reason.setRequired(true); reason.setSizeFull(); layout.addComponent(reason); layout.setExpandRatio(reason, 1); HorizontalLayout buttons = new HorizontalLayout(); buttons.setSpacing(true); layout.addComponent(buttons); @SuppressWarnings("serial") Button rejectButton = new Button(ui.getMessage("action.reject"), new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { reject(); } }); buttons.addComponent(rejectButton); @SuppressWarnings("serial") Button cancelButton = new Button(ui.getMessage("action.cancel"), new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { close(); } }); buttons.addComponent(cancelButton); }
From source file:com.m1kah.ui.MyVaadinUI.java
License:Open Source License
@Override protected void init(VaadinRequest request) { final VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); setContent(layout);/*from w w w. j a v a2 s. c o m*/ Button button = new Button("Click Me"); button.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { layout.addComponent(new Label(messageService.getMessage())); } }); layout.addComponent(button); }
From source file:com.m4gik.views.component.LibraryScreen.java
/** * @param audioFile/* ww w .ja v a2 s.c om*/ */ protected void buildInformationPanel(AudioFile audioFile) { if (bottom == null) { this.bottom = new HorizontalLayout(); bottom.setWidth("100%"); content.addComponent(bottom); VerticalLayout side = new VerticalLayout(); side.setMargin(true); side.setSpacing(true); side.setWidth("170px"); bottom.addComponent(side); CssLayout musicFile = new CssLayout(); musicFile.addStyleName(Runo.CSSLAYOUT_SHADOW); musicFile.addComponent(createPlayImage(audioFile, audioFile.getCover())); side.addComponent(musicFile); side.addComponent(setFavorite()); side.addComponent(setRate()); Component details = addDetails(audioFile); bottom.addComponent(details); bottom.setExpandRatio(details, 1); } else { bottom.removeAllComponents(); content.removeComponent(bottom); this.bottom = null; buildInformationPanel(audioFile); } }
From source file:com.m4gik.views.MainView.java
/** * Initial layout for {@link MainView}/*w w w. java 2 s.c om*/ */ private void initLayout() { VerticalLayout root = new VerticalLayout(); root.setMargin(true); root.setSizeFull(); VerticalLayout main = new VerticalLayout(); main.setSizeFull(); main.addComponent(root); playerLayout = new VerticalLayout(); main.addComponent(playerLayout); if (MusicPlayerPanel.isRunning()) { MusicPlayerPanel.setPlayerLayout(playerLayout); MusicPlayerPanel.runDefaultSetup(); } setContent(main); addTitle(root); addSpace(root); addSplitPanel(root); // setSizeFull(); // VerticalLayout layout = new VerticalLayout(); // layout.setSpacing(true); // layout.setMargin(true); // // HorizontalLayout usernameLayout = new HorizontalLayout(); // usernameLayout.setSpacing(true); // usernameLayout.addComponent(new Label("Username:")); // usernameLayout.addComponent(usernameLabel); // // //HorizontalLayout userRolesLayout = new HorizontalLayout(); // //userRolesLayout.setSpacing(true); // //userRolesLayout.addComponent(new Label("Roles:")); // //userRolesLayout.addComponent(rolesLabel); // // layout.addComponent(usernameLayout); // //addComponent(userRolesLayout); // // Link roleUserView = new // Link("Role \"user\" View (disabled, if user doesn't have access)", // new ExternalResource("#!" + RoleUserView.NAME)); // Link roleAdminView = new // Link("Role \"admin\" View (disabled, if user doesn't have access)", // new ExternalResource("#!" + RoleAdminView.NAME)); // Link authenticatedView = new // Link("@RequiresAuthentication View (disabled, if user doesn't have access)", // new ExternalResource("#!" + AuthenticatedView.NAME)); // Link guestView = new // Link("@RequiresGuest View (disabled, if user doesn't have access)", // new ExternalResource("#!" + GuestView.NAME)); // Link userView = new // Link("@RequiresUser View (disabled, if user doesn't have access)", // new ExternalResource("#!" + UserView.NAME)); // // roleUserView.setEnabled(ShiroSecurityNavigator.hasAccess(RoleUserView.class)); // roleAdminView.setEnabled(ShiroSecurityNavigator.hasAccess(RoleAdminView.class)); // authenticatedView.setEnabled(ShiroSecurityNavigator.hasAccess(AuthenticatedView.class)); // guestView.setEnabled(ShiroSecurityNavigator.hasAccess(GuestView.class)); // userView.setEnabled(ShiroSecurityNavigator.hasAccess(UserView.class)); // // layout.addComponent(roleUserView); // layout.addComponent(roleAdminView); // layout.addComponent(authenticatedView); // layout.addComponent(guestView); // layout.addComponent(userView); // layout.addComponent(new // Link("Role \"admin\" View (throw exception, if user doesn't have access)", // new ExternalResource("#!" + RoleAdminView.NAME))); // // layout.addComponent(new Link("Logout", new // ExternalResource("/logout/"))); // // setContent(layout); }
From source file:com.mcparland.john.vaadin_mvn_arch.samples.crud.SampleCrudView.java
License:Apache License
public SampleCrudView() { setSizeFull();//from www .j a v a 2 s.co m addStyleName("crud-view"); HorizontalLayout topLayout = createTopBar(); table = new ProductTable(); table.addValueChangeListener(new ValueChangeListener() { /** * The serialVersionUID. */ private static final long serialVersionUID = 1L; @Override public void valueChange(ValueChangeEvent event) { viewLogic.rowSelected(table.getValue()); } }); form = new ProductForm(viewLogic); form.setCategories(DataService.get().getAllCategories()); VerticalLayout barAndTableLayout = new VerticalLayout(); barAndTableLayout.addComponent(topLayout); barAndTableLayout.addComponent(table); barAndTableLayout.setMargin(true); barAndTableLayout.setSpacing(true); barAndTableLayout.setSizeFull(); barAndTableLayout.setExpandRatio(table, 1); barAndTableLayout.setStyleName("crud-main-layout"); addComponent(barAndTableLayout); addComponent(form); viewLogic.init(); }
From source file:com.mechanicshop.components.TableLayout.java
public void createCustomMessage() { final TextArea textArea = new TextArea(); textArea.setImmediate(true);/* ww w .jav a 2s . c o m*/ textArea.setColumns(30); textArea.setRows(10); textArea.addStyleName(ValoTheme.TEXTAREA_SMALL); textArea.setRequired(true); final Window subWindow = new Window(); subWindow.setModal(true); subWindow.setHeight("350px"); subWindow.setWidth("500px"); subWindow.setCaption("Insert Message"); subWindow.setStyleName(ValoTheme.WINDOW_TOP_TOOLBAR); subWindow.setClosable(false); subWindow.setResizable(false); HorizontalLayout layoutButtons = new HorizontalLayout(); layoutButtons.setMargin(false); Button sendBtn = new Button("Send"); sendBtn.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { try { textArea.validate(); String message = textArea.getValue(); smsSenderService.sendMessageMassive(message); subWindow.close(); Notification.show("Message Sent"); } catch (Exception e) { } } }); sendBtn.setImmediate(true); sendBtn.setStyleName(ValoTheme.BUTTON_TINY); sendBtn.addStyleName(ValoTheme.BUTTON_FRIENDLY); Button cancelBtn = new Button("Cancel"); cancelBtn.setStyleName(ValoTheme.BUTTON_TINY); cancelBtn.addStyleName(ValoTheme.BUTTON_DANGER); cancelBtn.setImmediate(true); cancelBtn.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { subWindow.close(); } }); layoutButtons.setSizeUndefined(); layoutButtons.setSpacing(true); layoutButtons.addComponents(cancelBtn, sendBtn); VerticalLayout layout = new VerticalLayout(); layout.setSpacing(true); layout.setMargin(true); layout.addComponent(textArea); layout.addComponent(layoutButtons); layout.setComponentAlignment(textArea, Alignment.MIDDLE_CENTER); layout.setComponentAlignment(layoutButtons, Alignment.MIDDLE_RIGHT); layout.setExpandRatio(textArea, 3); layout.setSizeFull(); subWindow.setContent(layout); subWindow.center(); getUI().addWindow(subWindow); }
From source file:com.mic.springvaadin.ui.AspectJManagedUI.java
License:Apache License
@Override protected void init(VaadinRequest vaadinRequest) { VerticalLayout layout = new VerticalLayout(); layout.setSizeFull();//from w w w. j a v a 2s . com layout.setSpacing(true); layout.setMargin(true); defaultLabel = new Label("Default View 1"); defaultLabel.setImmediate(true); layout.addComponent(defaultLabel); viewContainer = new Panel(); viewContainer.setSizeFull(); layout.addComponent(viewContainer); layout.setExpandRatio(viewContainer, 1f); setContent(layout); Navigator navigator = new Navigator(this, viewContainer); navigator.addView("default", new DefaultView()); navigator.addView("default2", new DefaultView2()); if (navigator.getState().isEmpty()) { navigator.navigateTo("default"); } }
From source file:com.morevaadin.vaadin.theming.ThemingContent.java
License:Apache License
public ThemingContent() { CustomLayout layout = new CustomLayout("layout"); setCompositionRoot(layout);/* w ww . j ava 2s . c om*/ layout.addComponent(menuBar, "top"); layout.addComponent(new Button("Does nothing"), "bottom"); VerticalLayout vLayout = new VerticalLayout(); vLayout.addComponent(new InlineDateField()); vLayout.addComponent(new TextField("", "Nothing to put in here")); vLayout.setSpacing(true); vLayout.setMargin(true); layout.addComponent(vLayout, "left"); }
From source file:com.morevaadin.vaadin7.custom.CustomComponentView.java
License:Apache License
public CustomComponentView() { VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); layout.setSpacing(true);/*from w w w . j a v a 2 s .co m*/ setCompositionRoot(layout); Button button = new Button("Vaadin"); button.addListener(ClickEvent.class, this, "showClick"); layout.addComponent(button); BootstrapButton customButton = new BootstrapButton("Default"); customButton.addListener(BootstrapClickEvent.class, this, "showClick"); layout.addComponent(customButton); layout.addComponent(new BootstrapButton("Large", Size.LARGE)); layout.addComponent(new BootstrapButton("Small", Size.SMALL)); layout.addComponent(new BootstrapButton("Mini", Size.MINI)); layout.addComponent(new BootstrapButton("Primary", Type.PRIMARY)); layout.addComponent(new BootstrapButton("Info", Type.INFO)); layout.addComponent(new BootstrapButton("Success", Type.SUCCESS)); layout.addComponent(new BootstrapButton("Warning", Type.WARNING)); layout.addComponent(new BootstrapButton("Danger", Type.DANGER)); layout.addComponent(new BootstrapButton("Inverse", Type.INVERSE)); }
From source file:com.mycollab.mobile.module.project.ui.TimeLogEditView.java
License:Open Source License
private void constructSpentTimeEntryPanel() { final VerticalLayout totalLayout = new VerticalLayout(); totalLayout.setMargin(new MarginInfo(false, true, false, true)); totalLayout.setWidth("100%"); final Label lbTimeInstructTotal = new Label( UserUIContext.getMessage(TimeTrackingI18nEnum.OPT_TOTAL_SPENT_HOURS)); totalLayout.addComponent(lbTimeInstructTotal); this.totalSpentTimeLbl = new ELabel("_").withStyleName("h2"); totalLayout.addComponent(this.totalSpentTimeLbl); headerPanel.addComponent(totalLayout); }