List of usage examples for com.vaadin.ui HorizontalLayout setSpacing
@Override public void setSpacing(boolean spacing)
From source file:com.wintindustries.pfserver.interfaces.view.dashboard.LoginView.java
private Component buildFields() { HorizontalLayout fields = new HorizontalLayout(); fields.setSpacing(true); fields.addStyleName("fields"); final TextField username = new TextField("Username"); username.setIcon(FontAwesome.USER);//from w ww. ja va2 s . c om username.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON); final PasswordField password = new PasswordField("Password"); password.setIcon(FontAwesome.LOCK); password.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON); final Button signin = new Button("Sign In"); signin.addStyleName(ValoTheme.BUTTON_PRIMARY); signin.setClickShortcut(KeyCode.ENTER); signin.focus(); fields.addComponents(username, password, signin); fields.setComponentAlignment(signin, Alignment.BOTTOM_LEFT); signin.addClickListener(new ClickListener() { @Override public void buttonClick(final ClickEvent event) { System.out.println("TRIGGER LOGIN"); DashboardEventBus.post(new UserLoginRequestedEvent(username.getValue(), password.getValue())); } }); return fields; }
From source file:cz.zcu.pia.social.network.frontend.components.posts.ComponentPost.java
/** * Adds click listeners to the buttons/* w w w. j a v a 2 s .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.profile.friends.ComponentManageFriendRequest.java
/** * Adds content/*from www . j av a 2 s . c o m*/ */ private void addContent() { Long userId = securityHelper.getLogedInUser().getId(); List<FriendRequest> friendRequestList = friendRequestService.getFriendRequests(userId); for (FriendRequest fr : friendRequestList) { Button accept = new Button(msgs.getMessage("request.accept")); accept.setData(fr); accept.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { FriendRequest fr = (FriendRequest) event.getButton().getData(); friendRequestService.confirmFriendRequest(fr); table.removeItem(fr.getId()); parentReference.reload(); } }); Button deny = new Button(msgs.getMessage("request.deny")); HorizontalLayout wrapper = new HorizontalLayout(); wrapper.setSpacing(true); wrapper.addComponent(accept); wrapper.addComponent(deny); if (fr.isDenyed()) { deny.setEnabled(false); } else { deny.setData(fr); deny.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { FriendRequest fr = (FriendRequest) event.getButton().getData(); friendRequestService.denyFriendRequest(fr); event.getButton().setEnabled(false); } }); } table.addItem(new Object[] { fr.getUserSender().getName(), fr.getUserSender().getSurname(), getTimeStamp(fr.getDateSent()), wrapper }, fr.getId()); } }
From source file:cz.zcu.pia.social.network.frontend.components.profile.profile.ComponentEditProfile.java
@Override protected HorizontalLayout getRegisterButton() { HorizontalLayout wrapper = new HorizontalLayout(); confirm = new Button(msgs.getMessage("save")); confirm.setClickShortcut(ShortcutAction.KeyCode.ENTER); confirm.addClickListener(new Button.ClickListener() { @Override/* w w w.j a va 2 s . co m*/ public void buttonClick(Button.ClickEvent event) { confirmButtonFunction(event); } }); Button swapButton = new Button(msgs.getMessage("back")); swapButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { resetValues(); parentReference.swapComponents(); } }); wrapper.addComponent(swapButton); wrapper.addComponent(confirm); wrapper.setSpacing(true); return wrapper; }
From source file:cz.zcu.pia.social.network.frontend.components.profile.profile.ComponentProfilePost.java
/** * Create buttons add friend and add follower * @return wrapper with buttons/*from w ww.j av a2s . c o m*/ */ private com.vaadin.ui.Component createButtons() { HorizontalLayout wrapper = new HorizontalLayout(); wrapper.setSpacing(true); if (!securityHelper.isAuthenticated() || securityHelper.getLogedInUser().equals(this.user)) { return wrapper; } Button addFriend = getAddFriendButton(); Button addFollower = getFollowerButton(); wrapper.addComponent(addFriend); wrapper.addComponent(addFollower); return wrapper; }
From source file:de.catma.CatmaApplication.java
License:Open Source License
@Override public void init() { Properties properties = loadProperties(); backgroundService = new BackgroundService(this); final Window mainWindow = new Window("CATMA 4.1 - CLA " + VERSION); mainWindow.addParameterHandler(this); HorizontalLayout mainLayout = new HorizontalLayout(); mainLayout.setSizeUndefined();//from w ww.j a va 2 s . c o m mainLayout.setMargin(true); mainLayout.setSpacing(true); mainWindow.addStyleName("catma-mainwindow"); mainWindow.setContent(mainLayout); MenuFactory menuFactory = new MenuFactory(); try { initTempDirectory(properties); tagManager = new TagManager(); repositoryManagerView = new RepositoryManagerView(new RepositoryManager(this, tagManager, properties)); tagManagerView = new TagManagerView(tagManager); taggerManagerView = new TaggerManagerView(); analyzerManagerView = new AnalyzerManagerView(); visualizationManagerView = new VisualizationManagerView(); defaultProgressIndicator = new ProgressIndicator(); defaultProgressIndicator.setIndeterminate(true); defaultProgressIndicator.setEnabled(false); defaultProgressIndicator.setPollingInterval(500); progressWindow = new ProgressWindow(defaultProgressIndicator); menu = menuFactory.createMenu(mainLayout, new MenuFactory.MenuEntryDefinition("Repository Manager", new RepositoryManagerWindow(repositoryManagerView)), new MenuFactory.MenuEntryDefinition("Tag Manager", new TagManagerWindow(tagManagerView)), new MenuFactory.MenuEntryDefinition("Tagger", new TaggerManagerWindow(taggerManagerView)), new MenuFactory.MenuEntryDefinition("Analyzer", new AnalyzerManagerWindow(analyzerManagerView)), new MenuFactory.MenuEntryDefinition("Visualizer", new VisualizationManagerWindow(visualizationManagerView))); Link aboutLink = new Link("About", new ExternalResource("http://www.catma.de")); aboutLink.setTargetName("_blank"); mainLayout.addComponent(aboutLink); mainLayout.setComponentAlignment(aboutLink, Alignment.TOP_RIGHT); mainLayout.setExpandRatio(aboutLink, 1.0f); Link helpLink = new Link("Help", new ExternalResource(getURL() + "manual/")); helpLink.setTargetName("_blank"); mainLayout.addComponent(helpLink); mainLayout.setComponentAlignment(helpLink, Alignment.TOP_RIGHT); Label helpLabel = new Label(); helpLabel.setIcon(new ClassResource("ui/resources/icon-help.gif", this)); helpLabel.setWidth("20px"); helpLabel.setDescription( "<h3>Hints</h3>" + "<p>Watch out for these little question mark icons while navigating " + "through CATMA. They provide useful hints for managing the first " + "steps within a CATMA component.</p>" + "<h4>Login</h4>" + "Once you're logged in, you will see the Repository Manager, " + "which will explain the first steps to you. " + "Just hover your mouse over the question mark icons!"); VerticalLayout helpWrapper = new VerticalLayout(); helpWrapper.addComponent(helpLabel); helpWrapper.setComponentAlignment(helpLabel, Alignment.TOP_RIGHT); Animator helpAnimator = new Animator(helpWrapper); helpAnimator.setFadedOut(true); mainLayout.addComponent(helpAnimator); mainLayout.setComponentAlignment(helpAnimator, Alignment.TOP_RIGHT); helpAnimator.fadeIn(2000, 300); MenuBar loginLogoutMenu = new MenuBar(); LoginLogoutCommand loginLogoutCommand = new LoginLogoutCommand(menu, repositoryManagerView, this); MenuItem loginLogoutitem = loginLogoutMenu.addItem("Login", loginLogoutCommand); loginLogoutCommand.setLoginLogoutItem(loginLogoutitem); mainLayout.addComponent(loginLogoutMenu); mainLayout.setComponentAlignment(loginLogoutMenu, Alignment.TOP_RIGHT); mainLayout.setWidth("100%"); } catch (Exception e) { showAndLogError("The system could not be initialized!", e); } setMainWindow(mainWindow); setTheme("cleatheme"); }
From source file:de.catma.ui.analyzer.AnalyzerView.java
License:Open Source License
private Component createConvenienceButtonPanel() { HorizontalLayout convenienceButtonPanel = new HorizontalLayout(); convenienceButtonPanel.setSpacing(true); btQueryBuilder = new Button("Query Builder"); convenienceButtonPanel.addComponent(btQueryBuilder); btWordList = new Button("Wordlist"); convenienceButtonPanel.addComponent(btWordList); helpLabel = new Label(); helpLabel.setWidth("20px"); helpLabel.setDescription("<h3>Hints</h3>" + "<h4>Using the wordlist</h4>" + "Click on the \"Wordlist\"-Button to get a list of all words of your document together with their frequencies." + " You can now sort the list by phrase, i. e. the word, or by frequency." + "<h4>Building queries</h4>" + "You are free to hack your query directly into the Query box, but a large part of all possible queries can be generated with the Query Builder more conveniently." + "<h4>Keywords in Context (KWIC)</h4>" + "To see your search results in the context of its surrounding text, tick the \"Visible in Kwic\"-check box " + "of the desired results." + "<h4>Results by Markup</h4>" + "When building Tag Queries where you look for occurrences of certain Tags, sometimes you " + "want the results grouped by Tags (especially Subtags) and sometimes you want the results " + "grouped by the tagged phrase. The \"Results by markup\" and \"Results by phrase\" tabs give you this choice for Tag Queries."); convenienceButtonPanel.addComponent(helpLabel); return convenienceButtonPanel; }
From source file:de.catma.ui.analyzer.AnalyzerView.java
License:Open Source License
private Component createSearchPanel() { HorizontalLayout searchPanel = new HorizontalLayout(); searchPanel.setSpacing(true); searchPanel.setWidth("100%"); searchInput = new TextField(); searchInput.setCaption("Query"); searchInput.setWidth("100%"); searchInput.setImmediate(true);//from w ww .j a v a 2 s . c om searchPanel.addComponent(searchInput); searchPanel.setExpandRatio(searchInput, 1.0f); btExecSearch = new Button("Execute Query"); searchPanel.addComponent(btExecSearch); searchPanel.setComponentAlignment(btExecSearch, Alignment.BOTTOM_CENTER); return searchPanel; }
From source file:de.catma.ui.analyzer.MarkupResultPanel.java
License:Open Source License
private void initComponents() { setSizeFull();//w ww . j ava 2 s.co m HorizontalSplitPanel splitPanel = new HorizontalSplitPanel(); splitPanel.setSizeFull(); VerticalLayout leftComponent = new VerticalLayout(); leftComponent.setSpacing(true); leftComponent.setSizeFull(); resultTable = new TreeTable(); resultTable.setSelectable(true); resultTable.setMultiSelect(true); HierarchicalContainer container = new HierarchicalContainer(); container.setItemSorter(new PropertyDependentItemSorter(TreePropertyName.caption, new PropertyToTrimmedStringCIComparator())); resultTable.setContainerDataSource(container); resultTable.addContainerProperty(TreePropertyName.caption, String.class, null); resultTable.setColumnHeader(TreePropertyName.caption, "Tag Definition"); resultTable.addContainerProperty(TreePropertyName.sourcedocument, String.class, null); resultTable.setColumnHeader(TreePropertyName.sourcedocument, "Source Document"); resultTable.addContainerProperty(TreePropertyName.markupcollection, String.class, null); resultTable.setColumnHeader(TreePropertyName.markupcollection, "Markup Collection"); resultTable.addContainerProperty(TreePropertyName.phrase, String.class, null); resultTable.setColumnHeader(TreePropertyName.phrase, "Phrase"); resultTable.addContainerProperty(TreePropertyName.propertyname, String.class, null); resultTable.setColumnHeader(TreePropertyName.propertyname, "Property"); resultTable.addContainerProperty(TreePropertyName.propertyvalue, String.class, null); resultTable.setColumnHeader(TreePropertyName.propertyvalue, "Property value"); resultTable.addContainerProperty(TreePropertyName.frequency, Integer.class, null); resultTable.setColumnHeader(TreePropertyName.frequency, "Frequency"); resultTable.addContainerProperty(TreePropertyName.visible, AbstractComponent.class, null); resultTable.setColumnHeader(TreePropertyName.visible, "Visible in Kwic"); resultTable.setItemCaptionPropertyId(TreePropertyName.caption); resultTable.setPageLength(10); //TODO: config resultTable.setSizeFull(); resultTable.setColumnCollapsingAllowed(true); resultTable.setColumnCollapsible(TreePropertyName.caption, false); resultTable.setColumnCollapsible(TreePropertyName.sourcedocument, true); resultTable.setColumnCollapsible(TreePropertyName.markupcollection, true); resultTable.setColumnCollapsible(TreePropertyName.phrase, true); resultTable.setColumnCollapsible(TreePropertyName.propertyname, true); resultTable.setColumnCollapsible(TreePropertyName.propertyvalue, true); resultTable.setColumnCollapsible(TreePropertyName.frequency, false); resultTable.setColumnCollapsible(TreePropertyName.visible, false); //TODO: a description generator that shows the version of a Tag // resultTable.setItemDescriptionGenerator(generator); leftComponent.addComponent(resultTable); leftComponent.setExpandRatio(resultTable, 1.0f); HorizontalLayout buttonPanel = new HorizontalLayout(); buttonPanel.setSpacing(true); buttonPanel.setWidth("100%"); btDist = new Button(); btDist.setIcon(new ClassResource("ui/analyzer/resources/chart.gif", getApplication())); buttonPanel.addComponent(btDist); btResultExcelExport = new Button(); btResultExcelExport.setIcon(new ThemeResource("../images/table-excel.png")); btResultExcelExport.setDescription("Export all Query result data as an Excel spreadsheet."); buttonPanel.addComponent(btResultExcelExport); cbFlatTable = new CheckBox("flat table", false); cbFlatTable.setImmediate(true); buttonPanel.addComponent(cbFlatTable); buttonPanel.setComponentAlignment(cbFlatTable, Alignment.MIDDLE_RIGHT); buttonPanel.setExpandRatio(cbFlatTable, 1f); btSelectAll = new Button("Select all for Kwic"); buttonPanel.addComponent(btSelectAll); buttonPanel.setComponentAlignment(btSelectAll, Alignment.MIDDLE_RIGHT); // buttonPanel.setExpandRatio(btSelectAll, 1f); btDeselectAll = new Button("Deselect all for Kwic"); buttonPanel.addComponent(btDeselectAll); buttonPanel.setComponentAlignment(btDeselectAll, Alignment.MIDDLE_RIGHT); leftComponent.addComponent(buttonPanel); splitPanel.addComponent(leftComponent); VerticalLayout rightComponent = new VerticalLayout(); rightComponent.setSpacing(true); rightComponent.setSizeFull(); this.kwicPanel = new KwicPanel(repository, relevantUserMarkupCollectionProvider, true); rightComponent.addComponent(kwicPanel); rightComponent.setExpandRatio(kwicPanel, 1f); HorizontalLayout kwicButtonPanel = new HorizontalLayout(); kwicButtonPanel.setSpacing(true); kwicButtonPanel.setWidth("100%"); btKwicExcelExport = new Button(); btKwicExcelExport.setIcon(new ThemeResource("../images/table-excel.png")); btKwicExcelExport.setDescription("Export all Query result data as an Excel spreadsheet."); kwicButtonPanel.addComponent(btKwicExcelExport); kwicButtonPanel.setComponentAlignment(btKwicExcelExport, Alignment.MIDDLE_LEFT); btUntagResults = new Button("Untag selected Kwics"); kwicButtonPanel.addComponent(btUntagResults); kwicButtonPanel.setComponentAlignment(btUntagResults, Alignment.MIDDLE_RIGHT); kwicButtonPanel.setExpandRatio(btUntagResults, 1f); Label helpLabel = new Label(); helpLabel.setIcon(new ClassResource("ui/resources/icon-help.gif", getApplication())); helpLabel.setWidth("20px"); helpLabel.setDescription("<h3>Hints</h3>" + "<h4>Tagging search results</h4>" + "You can tag the search results in the Kwic-view: " + "<p>First select one or more rows and then drag the desired " + "Tag from the Tag Manager over the Kwic-results.</p>" + "<h4>Take a closer look</h4>" + "You can jump to the location in the full text by double " + "clicking on a row in the Kwic-view."); kwicButtonPanel.addComponent(helpLabel); kwicButtonPanel.setComponentAlignment(helpLabel, Alignment.MIDDLE_RIGHT); rightComponent.addComponent(kwicButtonPanel); rightComponent.setComponentAlignment(kwicButtonPanel, Alignment.MIDDLE_RIGHT); splitPanel.addComponent(rightComponent); addComponent(splitPanel); }
From source file:de.catma.ui.analyzer.PhraseResultPanel.java
License:Open Source License
private void initComponents() { setSizeFull();/*from www.ja v a2s.co m*/ HorizontalSplitPanel splitPanel = new HorizontalSplitPanel(); splitPanel.setSizeFull(); VerticalLayout leftComponent = new VerticalLayout(); leftComponent.setSpacing(true); leftComponent.setSizeFull(); resultTable = new TreeTable(); resultTable.setSelectable(true); resultTable.setMultiSelect(true); HierarchicalContainer container = new HierarchicalContainer(); container.setItemSorter(new PropertyDependentItemSorter(TreePropertyName.caption, new PropertyToTrimmedStringCIComparator())); resultTable.setContainerDataSource(container); resultTable.addContainerProperty(TreePropertyName.caption, String.class, null); resultTable.setColumnHeader(TreePropertyName.caption, "Phrase"); resultTable.addContainerProperty(TreePropertyName.frequency, Integer.class, null); resultTable.setColumnHeader(TreePropertyName.frequency, "Frequency"); resultTable.addContainerProperty(TreePropertyName.visibleInKwic, AbstractComponent.class, null); resultTable.setColumnHeader(TreePropertyName.visibleInKwic, "Visible in Kwic"); resultTable.setItemCaptionPropertyId(TreePropertyName.caption); resultTable.setPageLength(10); //TODO: config resultTable.setSizeFull(); leftComponent.addComponent(resultTable); leftComponent.setExpandRatio(resultTable, 1.0f); HorizontalLayout buttonPanel = new HorizontalLayout(); buttonPanel.setSpacing(true); buttonPanel.setWidth("100%"); btDist = new Button(); btDist.setIcon(new ClassResource("ui/analyzer/resources/chart.gif", getApplication())); btDist.setDescription("Show selected phrases as a distribution trend in a " + "chart like visualization."); buttonPanel.addComponent(btDist); btDoubleTree = new Button(); btDoubleTree.setIcon(new ClassResource("ui/analyzer/resources/doubletree.gif", getApplication())); btDoubleTree.setDescription("Show a selected phrase with a doubletree kwic visualization."); buttonPanel.addComponent(btDoubleTree); btExcelExport = new Button(); btExcelExport.setIcon(new ThemeResource("../images/table-excel.png")); btExcelExport.setDescription("Export all Query result data as an Excel spreadsheet."); buttonPanel.addComponent(btExcelExport); btSelectAll = new Button("Select all for Kwic"); buttonPanel.addComponent(btSelectAll); buttonPanel.setComponentAlignment(btSelectAll, Alignment.MIDDLE_RIGHT); buttonPanel.setExpandRatio(btSelectAll, 1f); btDeselectAll = new Button("Deselect all for Kwic"); buttonPanel.addComponent(btDeselectAll); buttonPanel.setComponentAlignment(btDeselectAll, Alignment.MIDDLE_RIGHT); leftComponent.addComponent(buttonPanel); splitPanel.addComponent(leftComponent); VerticalLayout rightComponent = new VerticalLayout(); rightComponent.setSpacing(true); rightComponent.setSizeFull(); this.kwicPanel = new KwicPanel(repository, relevantUserMarkupCollectionProvider); rightComponent.addComponent(kwicPanel); rightComponent.setExpandRatio(kwicPanel, 1f); HorizontalLayout kwicButtonPanel = new HorizontalLayout(); kwicButtonPanel.setSpacing(true); kwicButtonPanel.setWidth("100%"); btKwicExcelExport = new Button(); btKwicExcelExport.setIcon(new ThemeResource("../images/table-excel.png")); btKwicExcelExport.setDescription("Export all Query result data as an Excel spreadsheet."); kwicButtonPanel.addComponent(btKwicExcelExport); Label helpLabel = new Label(); helpLabel.setIcon(new ClassResource("ui/resources/icon-help.gif", getApplication())); helpLabel.setDescription("<h3>Hints</h3>" + "<h4>Tagging search results</h4>" + "You can tag the search results in the Kwic-view: " + "<p>First select one or more rows and then drag the desired " + "Tag from the Tag Manager over the Kwic-results.</p>" + "<h4>Take a closer look</h4>" + "You can jump to the location in the full text by double " + "clicking on a row in the Kwic-view." + "<h4>Untag search results</h4>" + "The \"Results by markup\" tab gives you the opportunity " + "to untag markup for selected search results in the Kwic-view."); kwicButtonPanel.addComponent(helpLabel); kwicButtonPanel.setExpandRatio(helpLabel, 1f); kwicButtonPanel.setComponentAlignment(helpLabel, Alignment.MIDDLE_RIGHT); rightComponent.addComponent(kwicButtonPanel); rightComponent.setComponentAlignment(kwicButtonPanel, Alignment.MIDDLE_RIGHT); splitPanel.addComponent(rightComponent); addComponent(splitPanel); }