List of usage examples for com.vaadin.ui HorizontalLayout addComponent
@Override public void addComponent(Component c)
From source file:com.github.carljmosca.ui.MainUI.java
private void addHeader() { HorizontalLayout hl = new HorizontalLayout(); hl.setSpacing(true);/* w w w .jav a 2s .c o m*/ cmbWidgets = new ComboBox(); cmbWidgets.setContainerDataSource(widgets); cmbWidgets.setItemCaptionPropertyId("name"); hl.addComponent(cmbWidgets); Button btnUpdate = new Button("Update", FontAwesome.ADJUST); btnUpdate.addClickListener((Button.ClickEvent event) -> { cmbWidgets.select(widgets.getIdByIndex(0)); }); hl.addComponent(btnUpdate); Button btnShow = new Button("Show", FontAwesome.DASHBOARD); btnShow.addClickListener((Button.ClickEvent event) -> { try { fgWidget.commit(); } catch (FieldGroup.CommitException ex) { Logger.getLogger(MainUI.class.getName()).log(Level.SEVERE, null, ex); } System.out.println(demoAppData.getSelectedWidget().getName()); }); hl.addComponent(btnShow); Button btnChange = new Button("Change", FontAwesome.REFRESH); btnChange.addClickListener((Button.ClickEvent event) -> { Widget widget = (Widget) biDemoAppData.getItemProperty("selectedWidget").getValue(); widget.setName("test xxxx"); System.out.println(demoAppData.getSelectedWidget().getName()); }); hl.addComponent(btnChange); mainLayout.addComponent(hl); }
From source file:com.github.daytron.sqlcontainer.DatabaseTableScreen.java
public DatabaseTableScreen() { setMargin(true);//from w w w.j a va 2 s.c om table = new Table(); table.setPageLength(10); table.setEditable(true); table.setSizeFull(); table.addGeneratedColumn("", new RemoveItemColumnGenerator()); HorizontalLayout buttonBar = new HorizontalLayout(); buttonBar.setMargin(true); buttonBar.setSpacing(true); Button commitButton = new Button("Commit"); commitButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { try { container.commit(); Notification.show("Changes committed"); } catch (UnsupportedOperationException | SQLException ex) { Logger.getLogger(DatabaseTableScreen.class.getName()).log(Level.SEVERE, null, ex); Notification.show("Unable to commit", Notification.Type.ERROR_MESSAGE); } } }); buttonBar.addComponent(commitButton); Button rollbackButton = new Button("Rollback"); rollbackButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { try { container.rollback(); Notification.show("Changes rollback"); } catch (UnsupportedOperationException | SQLException ex) { Logger.getLogger(DatabaseTableScreen.class.getName()).log(Level.SEVERE, null, ex); Notification.show("Unable to rollback", Notification.Type.ERROR_MESSAGE); } } }); buttonBar.addComponent(rollbackButton); addComponent(table); addComponent(buttonBar); }
From source file:com.github.djabry.platform.vaadin.ui.MainUI.java
License:Open Source License
@Override protected void init(VaadinRequest request) { VerticalLayout rootLayout = new VerticalLayout(); rootLayout.setSizeFull();// w ww .j av a 2 s. com setContent(rootLayout); BannerView banner = bannerPresenter.getView(); rootLayout.addComponent(banner); HorizontalLayout mainLayout = new HorizontalLayout(); mainLayout.setSizeFull(); body = new VerticalLayout(); body.setSizeFull(); Navigator navigator = new Navigator(this, body); navigator.addProvider(vP); this.setNavigator(navigator); SideBarView sidebarView = sideBarPresenter.getView(); mainLayout.addComponent(sidebarView); mainLayout.addComponent(body); rootLayout.addComponent(mainLayout); rootLayout.setExpandRatio(mainLayout, 10); sidebarView.setWidth(150, Unit.PIXELS); mainLayout.setExpandRatio(body, 10); //rootLayout.setSplitPosition(150, Unit.PIXELS); navigator.navigateTo(LoginView.VIEW_NAME); eventBus.publish(EventScope.SESSION, this, Action.START); }
From source file:com.github.djabry.platform.vaadin.view.LoginView.java
License:Open Source License
private Component buildLoginForm() { HorizontalLayout loginPanel = new HorizontalLayout(); //loginPanel.setSizeUndefined(); loginPanel.setSpacing(true);//from www. j a v a 2 s .c o m Responsive.makeResponsive(loginPanel); //loginPanel.addStyleName("login-panel"); //loginPanel.addComponent(buildLabels()); loginPanel.addComponent(buildFields()); //loginPanel.addComponent(new CheckBox("Remember me", false)); return loginPanel; }
From source file:com.github.djabry.platform.vaadin.view.SideBarView.java
License:Open Source License
@PostConstruct public void init() { this.setSizeFull(); HorizontalLayout titleHolder = new HorizontalLayout(); titleHolder.addComponent(buildTitle()); titleHolder.addStyleName(ValoTheme.LAYOUT_WELL); //titleHolder.setMargin(true); //titleHolder.setSpacing(true); //this.addComponent(titleHolder); VerticalLayout sidebarHolder = new VerticalLayout(); //sidebarHolder.addStyleName(ValoTheme.LAYOUT_WELL); sidebarHolder.addStyleName(ValoTheme.MENU_ROOT); //sidebarHolder.addStyleName(ValoTheme.MENUBAR_BORDERLESS); this.addComponent(sidebarHolder); sidebarHolder.setSizeFull();/*from ww w. j av a2s . co m*/ sidebarHolder.addComponent(sideBar); //sideBar.setStyleName(ValoTheme.ACCORDION_BORDERLESS); sideBar.addStyleName(ValoTheme.MENU_PART); sideBar.setSizeFull(); }
From source file:com.github.fbhd.AbstractSideBarUI.java
@Override protected void init(VaadinRequest vaadinRequest) { getPage().setTitle("fbhd"); final HorizontalLayout rootLayout = new HorizontalLayout(); rootLayout.setSizeFull();/*from ww w. j a v a 2s . com*/ setContent(rootLayout); final VerticalLayout viewContainer = new VerticalLayout(); viewContainer.setSizeFull(); final Navigator navigator = new Navigator(this, viewContainer); navigator.setErrorView(new ErrorView()); navigator.addProvider(viewProvider); setNavigator(navigator); rootLayout.addComponent(getSideBar()); rootLayout.addComponent(viewContainer); rootLayout.setExpandRatio(viewContainer, 1.0f); }
From source file:com.github.lsiu.MyVaadinApplication.java
private void initTopBar(HorizontalLayout topBar) { topBar.setWidth("100%"); final CheckBox editableCheckBox = new CheckBox("Editable"); topBar.addComponent(editableCheckBox); topBar.setComponentAlignment(editableCheckBox, Alignment.BOTTOM_RIGHT); editableCheckBox.setValue(table.isEditable()); editableCheckBox.setImmediate(true); editableCheckBox.addListener(new ValueChangeListener() { @Override/*from w ww . j a va2 s .c o m*/ public void valueChange(ValueChangeEvent event) { table.setEditable((Boolean) editableCheckBox.getValue()); } }); }
From source file:com.github.mjvesa.herd.HerdIDE.java
License:Apache License
private Component constructButtons() { HorizontalLayout hl = new HorizontalLayout(); hl.setSpacing(true);//from w w w. j av a 2 s . c om hl.addComponent(createRunButton()); hl.addComponent(createClearAndExecuteButton()); hl.addComponent(createClearConsoleButton()); hl.addComponent(createLogExecutedWordsCheckBox()); hl.addComponent(createLogAddedWordCheckBox()); return hl; }
From source file:com.github.moscaville.contactsdb.AbstractSideBarUI.java
License:Apache License
@Override protected void init(VaadinRequest vaadinRequest) { getPage().setTitle("ContactsDb"); final HorizontalLayout rootLayout = new HorizontalLayout(); rootLayout.setSizeFull();/*from w ww . ja v a 2s. co m*/ setContent(rootLayout); final VerticalLayout viewContainer = new VerticalLayout(); viewContainer.setSizeFull(); final Navigator navigator = new Navigator(this, viewContainer); navigator.setErrorView(new ErrorView()); navigator.addProvider(viewProvider); setNavigator(navigator); rootLayout.addComponent(getSideBar()); rootLayout.addComponent(viewContainer); rootLayout.setExpandRatio(viewContainer, 1.0f); }
From source file:com.github.moscaville.contactsdb.main.DetailView.java
private TextField createTextField(String inputPrompt, HorizontalLayout horizontalLayout) { TextField textField = new TextField(); textField.setInputPrompt(inputPrompt); textField.setImmediate(true);/*from w w w . ja v a 2 s . c om*/ textField.setNullRepresentation(""); if (horizontalLayout != null) { horizontalLayout.addComponent(textField); } textField.addListener((Event event) -> { enableButtons(true); }); return textField; }