List of usage examples for com.vaadin.ui CustomLayout CustomLayout
public CustomLayout(String template)
From source file:com.klwork.explorer.ui.custom.TaskListHeader.java
License:Apache License
protected void initInputField() { // Csslayout is used to style inputtext as rounded //CssLayout csslayout2 = new CssLayout(); CustomLayout csslayout = new CustomLayout("circularButton"); csslayout.setHeight(24, Unit.PIXELS); csslayout.setWidth(100, Unit.PERCENTAGE); layout.addComponent(csslayout);/* w w w .ja v a 2s . c o m*/ inputField = new TextField(); inputField.setWidth(100, Unit.PERCENTAGE); inputField.addStyleName(ExplorerLayout.STYLE_SEARCHBOX); inputField.setInputPrompt(i18nManager.getMessage(Messages.TASK_CREATE_NEW)); inputField.focus(); csslayout.addComponent(inputField, "searchInput"); layout.setComponentAlignment(csslayout, Alignment.MIDDLE_LEFT); layout.setExpandRatio(csslayout, 1.0f); }
From source file:com.lst.deploymentautomation.vaadin.core.AppLayout.java
License:Open Source License
private void initLayout() { addStyleName("app-layout"); setSizeFull();//from w w w . j a va 2s.c om //main page layout layout = new CustomLayout("page"); layout.setSizeFull(); setCompositionRoot(layout); //navigation menu VerticalLayout navLayout = new VerticalLayout(); navLayout.setSizeFull(); layout.addComponent(navLayout, "usermenu"); navigation = new NavigationMenu(); navigation.addStyleName("navigation-menu"); layout.addComponent(navigation, "navigation"); final UserInfo user = ((LspsUI) UI.getCurrent()).getUser(); LspsUI ui = (LspsUI) UI.getCurrent(); if (user.hasRight(HumanRights.READ_ALL_TODO) || user.hasRight(HumanRights.READ_OWN_TODO)) { addViewItem(navigation, TodoListView.TITLE, TodoListView.ID, FontAwesome.LIST); } /*if (user.hasRight(HumanRights.ACCESS_DOCUMENTS)) { addViewItem(navigation, DocumentsView.TITLE, DocumentsView.ID, FontAwesome.FILE_TEXT_O); } if (user.hasRight(EngineRights.READ_MODEL) && user.hasRight(EngineRights.CREATE_MODEL_INSTANCE)) { addViewItem(navigation, RunModelView.TITLE, RunModelView.ID, FontAwesome.CARET_SQUARE_O_RIGHT); }*/ addNavigationCommandItem(navigation, "Initialize deployment", new NavigationMenu.OpenDocumentCommand(ui, "", "'deployment-automation-ui'::InitiateDeploymentDoc", null), FontAwesome.PLAY); addNavigationCommandItem(navigation, "Deployments list", new NavigationMenu.OpenDocumentCommand(ui, "", "'deployment-automation-ui'::DeploymentsList", null), FontAwesome.LIST_OL); //user menu userMenu = new NavigationMenu(); userMenu.addStyleName("navigation-menu"); navLayout.addComponent(userMenu); addViewItem(userMenu, SettingsView.TITLE, SettingsView.ID, FontAwesome.COG); NavigationCommand logoutCmd = new LogoutCommand((LspsUI) getUI()); MenuItem logout = addNavigationCommandItem(userMenu, logoutCmd.getTitle(), logoutCmd, FontAwesome.POWER_OFF); String fullName = user.getPerson().getFullName(); logout.setDescription(ui.getMessage("nav.logout", fullName)); boolean collapsed = user.getSettingBoolean("collapsedMenu", false); if (collapsed == true) { UI.getCurrent().addStyleName("l-menu-collapsed"); } Button button = new Button(""); button.addStyleName("l-menu-expander"); button.addStyleName("link"); navLayout.addComponent(button); button.addClickListener(new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { boolean collapsed = user.getSettingBoolean("collapsedMenu", false); if (collapsed) { UI.getCurrent().removeStyleName("l-menu-collapsed"); } else { UI.getCurrent().addStyleName("l-menu-collapsed"); } user.setSetting("collapsedMenu", !collapsed); } }); }
From source file:com.lst.deploymentautomation.vaadin.core.AppView.java
License:Open Source License
@Override public void attach() { super.attach(); if (title.getParent() == null) { try {/*from w w w . ja va2 s .c o m*/ CustomLayout titleWrapper = new CustomLayout( new ByteArrayInputStream("<h1 location='title'></h1>".getBytes("UTF-8"))); titleWrapper.addComponent(title, "title"); Component header = createHeader(titleWrapper); header.addStyleName("view-header"); layout.addComponent(header); } catch (IOException e) { //should not happen; rethrow throw new RuntimeException(e); } } }
From source file:com.mcparland.john.Demo.java
License:Apache License
@Override protected void init(VaadinRequest request) { CustomLayout layout = new CustomLayout("mylayout"); setContent(layout);// w ww .ja v a 2s . c o m Label header = new Label("Custom layout"); header.addStyleName("header"); layout.addComponent(header, "header"); Label menu = new Label("menu"); layout.addComponent(menu, "menu"); Label content = new Label("This is content of page."); layout.addComponent(content, "content"); Label footer = new Label("Created by Vaadin, 2013"); layout.addComponent(footer, "footer"); }
From source file:com.mcparland.john.vaadin_mvn_arch.samples.about.AboutView.java
License:Apache License
public AboutView() { CustomLayout aboutContent = new CustomLayout("aboutview"); aboutContent.setStyleName("about-content"); // you can add Vaadin components in predefined slots in the custom // layout/*w w w . ja v a 2s .c o m*/ aboutContent.addComponent(new Label( FontAwesome.INFO_CIRCLE.getHtml() + " This application is using Vaadin " + Version.getFullVersion(), ContentMode.HTML), "info"); setSizeFull(); setStyleName("about-view"); addComponent(aboutContent); setComponentAlignment(aboutContent, Alignment.MIDDLE_CENTER); }
From source file:com.morevaadin.vaadin.theming.ThemingContent.java
License:Apache License
public ThemingContent() { CustomLayout layout = new CustomLayout("layout"); setCompositionRoot(layout);/*from ww w . j a va2s .c o m*/ 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:cz.zcu.pia.social.network.frontend.components.login.ComponentLogin.java
/** * PostConstruct//from ww w . ja va 2 s . c om */ @PostConstruct public void postConstruct() { CustomLayout content = new CustomLayout("login"); content.setSizeUndefined(); this.addComponent(content); nickname.setCaption(msgs.getMessage(INFO_USERNAME)); password.setCaption(msgs.getMessage(INFO_PASSWORD)); Button login = createLoginButton(); Button infoRegister = createRegisterButton(); content.addComponent(infoRegister, "register-button"); content.addComponent(nickname, "username"); content.addComponent(password, "password"); content.addComponent(login, "okbutton"); }
From source file:cz.zcu.pia.social.network.frontend.components.login.ComponentRegister.java
/** * Constructor/*from www. j a v a2s . c o m*/ */ public ComponentRegister() { this.setSpacing(true); this.setSizeUndefined(); layout = new CustomLayout("register"); }
From source file:cz.zcu.pia.social.network.frontend.components.posts.ComponentPost.java
/** * Adds click listeners to the buttons//w w w .java2s. c o m */ private void addClickListeners() { this.likes.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { Post post = componentPostService.updateLikeRating(postId); numberOfLikes = post.getLikeCount(); numberOfDisagrees = post.getHateCount(); updateHateLike(); } }); this.disagrees.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { Post post = componentPostService.updateDisagreeRating(postId); numberOfLikes = post.getLikeCount(); numberOfDisagrees = post.getHateCount(); updateHateLike(); } }); this.tags.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { Window subWindow = new Window(msgs.getMessage("post.tags")); subWindow.setModal(true); subWindow.center(); subWindow.setWidth(400, Unit.PIXELS); subWindow.setHeight(110, Unit.PIXELS); subWindow.setResizable(false); Panel panel = new Panel(); panel.setSizeFull(); HorizontalLayout tagsWrapper = new HorizontalLayout(); tagsWrapper.setStyleName("margin-left-big"); panel.setContent(tagsWrapper); tagsWrapper.setSpacing(true); tagsWrapper.setMargin(true); tagsWrapper.setSizeUndefined(); for (Tag t : postService.getPostTags(postId)) { CustomLayout tag = new CustomLayout("tag"); Button tagLabel = new Button(t.getTagName()); tag.addComponent(tagLabel, "button"); tagsWrapper.addComponent(tag); } subWindow.setContent(panel); UI.getCurrent().addWindow(subWindow); } }); this.comments.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { Window subWindow = new Window(msgs.getMessage("post.comments")); subWindow.setModal(true); subWindow.center(); subWindow.setWidth(400, Unit.PIXELS); subWindow.setHeight(600, Unit.PIXELS); subWindow.setResizable(true); ComponentPostComments componentPostComments = applicationContext .getBean(ComponentPostComments.class, postId); subWindow.setContent(componentPostComments); UI.getCurrent().addWindow(subWindow); } }); this.name.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { Window subWindow = new Window(msgs.getMessage("header.profile") + "- " + name.getCaption()); subWindow.setModal(true); subWindow.center(); subWindow.setWidth(400, Unit.PIXELS); subWindow.setHeight(350, Unit.PIXELS); subWindow.setResizable(true); Users user = postService.getPostById(postId).getUser(); ComponentProfilePost profilePost = applicationContext.getBean(ComponentProfilePost.class, user); subWindow.setContent(profilePost); UI.getCurrent().addWindow(subWindow); } }); }
From source file:cz.zcu.pia.social.network.frontend.components.posts.ComponentPostAdd.java
/** * Constructor//w w w. j av a2 s . c o m */ public ComponentPostAdd() { this.setSpacing(true); message.setWidth(100, Unit.PERCENTAGE); message.setHeight(100, Unit.PIXELS); message.setMaxLength(1000); tags = new HorizontalLayout(); tags.setSpacing(true); tags.setSizeUndefined(); newTag = new TextField(); newTag.setImmediate(true); OnEnterKeyHandler onEnterHandler = new OnEnterKeyHandler() { @Override public void onEnterKeyPressed() { CustomLayout tag = new CustomLayout("tag"); Button tagsButton = new Button(newTag.getValue()); taglist.add(tagsButton); newTag.setValue(""); newTag.focus(); tagsButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { tags.removeComponent(event.getButton().getParent()); taglist.remove(event.getButton()); } }); tag.addComponent(tagsButton, "button"); tags.addComponent(tag); } }; onEnterHandler.installOn(newTag); }