List of usage examples for com.vaadin.ui Alignment MIDDLE_RIGHT
Alignment MIDDLE_RIGHT
To view the source code for com.vaadin.ui Alignment MIDDLE_RIGHT.
Click Source Link
From source file:de.uni_tuebingen.qbic.qbicmainportlet.QbicmainportletUI.java
License:Open Source License
/** * starts the querying of openbis and initializing the view * /*from w ww . j ava 2 s .com*/ * @param request */ protected void initProgressBarAndThreading(VaadinRequest request) { final VerticalLayout layout = new VerticalLayout(); this.setContent(layout); // TODO so this function uses the same error as above, but doesn't call // OpenbisConnectionErrorLayout...we might want to change that final Label status = new Label("Connecting to database."); status.addStyleName(ValoTheme.LABEL_HUGE); status.addStyleName(ValoTheme.LABEL_LIGHT); layout.addComponent(status); layout.setComponentAlignment(status, Alignment.MIDDLE_RIGHT); try { buildMainLayout(datahandler, request, LiferayAndVaadinUtils.getUser().getScreenName()); } catch (Exception e) { if (datahandler.getOpenBisClient().loggedin()) { LOGGER.error("User not known?", e); buildUserUnknownError(request); } else { LOGGER.error("exception thrown during initialization.", e); status.setValue( "An error occured, while trying to connect to the database. Please try again later, or contact your project manager."); } } }
From source file:de.uni_tuebingen.qbic.qbicmainportlet.QbicmainportletUI.java
License:Open Source License
/** * //from w w w. j a va 2s . co m * @param datahandler * @param request * @param user */ public void buildMainLayout(DataHandler datahandler, VaadinRequest request, String user) { State state = (State) UI.getCurrent().getSession().getAttribute("state"); MultiscaleController multiscaleController = new MultiscaleController(datahandler.getOpenBisClient(), user); final HomeView homeView = new HomeView(datahandler, "Your Projects", user, state, resUrl, manager.getTmpFolder()); DatasetView datasetView = new DatasetView(datahandler, state, resUrl); final SampleView sampleView = new SampleView(datahandler, state, resUrl, multiscaleController); // BarcodeView barcodeView = // new BarcodeView(datahandler.getOpenBisClient(), manager.getBarcodeScriptsFolder(), // manager.getBarcodePathVariable()); final ExperimentView experimentView = new ExperimentView(datahandler, state, resUrl, multiscaleController); // ChangePropertiesView changepropertiesView = new ChangePropertiesView(datahandler); final AddPatientView addPatientView = new AddPatientView(datahandler, state, resUrl); final SearchResultsView searchResultsView = new SearchResultsView(datahandler, "Search results", user, state, resUrl); Submitter submitter = null; try { submitter = WorkflowSubmitterFactory.getSubmitter(Type.guseSubmitter, manager); } catch (Exception e1) { e1.printStackTrace(); } WorkflowViewController controller = new WorkflowViewController(submitter, datahandler, user); final ProjectView projectView = new ProjectView(datahandler, state, resUrl, controller, manager); final PatientView patientView = new PatientView(datahandler, state, resUrl, controller, manager); VerticalLayout navigatorContent = new VerticalLayout(); // navigatorContent.setResponsive(true); final Navigator navigator = new Navigator(UI.getCurrent(), navigatorContent); navigator.addView(DatasetView.navigateToLabel, datasetView); navigator.addView(SampleView.navigateToLabel, sampleView); navigator.addView("", homeView); navigator.addView(ProjectView.navigateToLabel, projectView); // navigator.addView(BarcodeView.navigateToLabel, barcodeView); navigator.addView(ExperimentView.navigateToLabel, experimentView); navigator.addView(PatientView.navigateToLabel, patientView); navigator.addView(AddPatientView.navigateToLabel, addPatientView); navigator.addView(SearchResultsView.navigateToLabel, searchResultsView); setNavigator(navigator); // Production // mainLayout = new VerticalLayout(); for (Window w : getWindows()) { w.setSizeFull(); } mainLayout = new GridLayout(3, 3); mainLayout.setResponsive(true); mainLayout.setWidth(100, Unit.PERCENTAGE); mainLayout.addComponent(navigatorContent, 0, 1, 2, 1); mainLayout.setColumnExpandRatio(0, 0.2f); mainLayout.setColumnExpandRatio(1, 0.3f); mainLayout.setColumnExpandRatio(2, 0.5f); // Production // HorizontalLayout treeViewAndLevelView = new HorizontalLayout(); // HorizontalLayout headerView = new HorizontalLayout(); // headerView.setSpacing(false); HorizontalLayout buttonLayout = new HorizontalLayout(); buttonLayout.setSpacing(true); // final HorizontalLayout labelLayout = new HorizontalLayout(); // headerView.addComponent(buttonLayout); // headerView.addComponent(labelLayout); Button homeButton = new Button("Home"); homeButton.setIcon(FontAwesome.HOME); homeButton.setResponsive(true); homeButton.setStyleName(ValoTheme.BUTTON_LARGE); homeButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { navigator.navigateTo(""); } }); // Production buttonLayout.addComponent(homeButton); // mainLayout.addComponent(homeButton, 0, 0); Boolean includePatientCreation = false; List<Project> projects = datahandler.getOpenBisClient().getOpenbisInfoService() .listProjectsOnBehalfOfUser(datahandler.getOpenBisClient().getSessionToken(), user); int numberOfProjects = 0; for (Project project : projects) { if (project.getSpaceCode().contains("IVAC")) { includePatientCreation = true; } numberOfProjects += 1; } // add patient button if (includePatientCreation) { Button addPatient = new Button("Add Patient"); addPatient.setIcon(FontAwesome.PLUS); addPatient.setStyleName(ValoTheme.BUTTON_LARGE); addPatient.setResponsive(true); // addPatient.setStyleName("addpatient"); addPatient.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { UI.getCurrent().getNavigator().navigateTo(String.format(AddPatientView.navigateToLabel)); } }); // Production buttonLayout.addComponent(addPatient); // mainLayout.addComponent(addPatient, 1, 0); } mainLayout.addComponent(buttonLayout, 0, 0); Button header = new Button(String.format("Total number of projects: %s", numberOfProjects)); header.setIcon(FontAwesome.HAND_O_RIGHT); header.setStyleName(ValoTheme.BUTTON_LARGE); header.addStyleName(ValoTheme.BUTTON_BORDERLESS); // Production // labelLayout.addComponent(header); // labelLayout.setWidth(null); SearchEngineView searchBarView = new SearchEngineView(datahandler); // headerView.setWidth("100%"); // Production // headerView.addComponent(searchBarView); // headerView.setComponentAlignment(searchBarView, Alignment.TOP_RIGHT); // searchBarView.setSizeUndefined(); // treeViewAndLevelView.addComponent(navigatorContent); // mainLayout.addComponent(headerView); // mainLayout.addComponent(treeViewAndLevelView); mainLayout.addComponent(header, 1, 0); mainLayout.addComponent(searchBarView, 2, 0); // Production VerticalLayout versionLayout = new VerticalLayout(); versionLayout.setWidth(100, Unit.PERCENTAGE); Label versionLabel = new Label(String.format("version: %s", version)); Label revisionLabel = new Label(String.format("rev: %s", revision)); revisionLabel.setWidth(null); versionLabel.setWidth(null); versionLayout.addComponent(versionLabel); if (!isInProductionMode()) { versionLayout.addComponent(revisionLabel); } // versionLayout.setMargin(new MarginInfo(true, false, false, false)); // mainLayout.addComponent(versionLayout); mainLayout.addComponent(versionLayout, 0, 2, 2, 2); mainLayout.setRowExpandRatio(2, 1.0f); // mainLayout.setSpacing(true); versionLayout.setComponentAlignment(versionLabel, Alignment.MIDDLE_RIGHT); versionLayout.setComponentAlignment(revisionLabel, Alignment.BOTTOM_RIGHT); mainLayout.setComponentAlignment(searchBarView, Alignment.BOTTOM_RIGHT); setContent(mainLayout); // getContent().setSizeFull(); // "Responsive design" /* * getPage().addBrowserWindowResizeListener(new BrowserWindowResizeListener() { * * @Override public void browserWindowResized(BrowserWindowResizeEvent event) { int height = * event.getHeight(); int width = event.getWidth(); WebBrowser browser = * event.getSource().getWebBrowser(); // tv.rebuildLayout(height, width, browser); if * (currentView instanceof HomeView) { homeView.updateView(height, width, browser); } else if * (currentView instanceof ProjectView) { projectView.updateView(height, width, browser); } else * if (currentView instanceof ExperimentView) { experimentView.updateView(height, width, * browser); } else if (currentView instanceof PatientView) { patientView.updateView(height, * width, browser); } else if (currentView instanceof AddPatientView) { * addPatientView.updateView(height, width, browser); } } }); * * navigator.addViewChangeListener(new ViewChangeListener() { * * @Override public boolean beforeViewChange(ViewChangeEvent event) { int height = * getPage().getBrowserWindowHeight(); int width = getPage().getBrowserWindowWidth(); WebBrowser * browser = getPage().getWebBrowser(); // View oldView = event.getOldView(); // * this.setEnabled(oldView, false); * * currentView = event.getNewView(); if (currentView instanceof HomeView) { * homeView.updateView(height, width, browser); } if (currentView instanceof ProjectView) { * projectView.updateView(height, width, browser); } if (currentView instanceof ExperimentView) * { experimentView.updateView(height, width, browser); } if (currentView instanceof SampleView) * { sampleView.updateView(height, width, browser); } else if (currentView instanceof * PatientView) { patientView.updateView(height, width, browser); } else if (currentView * instanceof AddPatientView) { addPatientView.updateView(height, width, browser); } return * true; } * * private void setEnabled(View view, boolean enabled) { // tv.setEnabled(enabled); if (view * instanceof HomeView) { homeView.setEnabled(enabled); } if (view instanceof ProjectView) { * projectView.setEnabled(enabled); } if (view instanceof ExperimentView) { * experimentView.setEnabled(enabled); } if (view instanceof SampleView) { * sampleView.setEnabled(enabled); } } * * @Override public void afterViewChange(ViewChangeEvent event) { currentView = * event.getNewView(); // this.setEnabled(currentView, true); Object currentBean = null; if * (currentView instanceof ProjectView) { // TODO refactoring currentBean = new HashMap<String, * AbstractMap.SimpleEntry<String, Long>>(); * * // Production // labelLayout.removeAllComponents(); Button header = new * Button(projectView.getHeaderLabel()); header.setStyleName(ValoTheme.BUTTON_LARGE); * header.addStyleName(ValoTheme.BUTTON_BORDERLESS); header.setIcon(FontAwesome.HAND_O_RIGHT); * * // labelLayout.addComponent(header); } else if (currentView instanceof HomeView) { * currentBean = new HashMap<String, AbstractMap.SimpleEntry<String, Long>>(); * * // labelLayout.removeAllComponents(); Button header = new Button(homeView.getHeader()); * header.setStyleName(ValoTheme.BUTTON_LARGE); * header.addStyleName(ValoTheme.BUTTON_BORDERLESS); header.setIcon(FontAwesome.HAND_O_RIGHT); * * // labelLayout.addComponent(header); // currentBean = projectView.getCurrentBean(); } else if * (currentView instanceof ExperimentView) { currentBean = experimentView.getCurrentBean(); * * } else if (currentView instanceof SampleView) { // TODO refactoring currentBean = new * HashMap<String, AbstractMap.SimpleEntry<String, Long>>(); * * // labelLayout.removeAllComponents(); Button header = new Button(sampleView.getHeader()); * header.setStyleName(ValoTheme.BUTTON_LARGE); * header.addStyleName(ValoTheme.BUTTON_BORDERLESS); header.setIcon(FontAwesome.HAND_O_RIGHT); * * // labelLayout.addComponent(header); * * } else if (currentView instanceof DatasetView) { currentBean = new HashMap<String, * AbstractMap.SimpleEntry<String, Long>>(); } else if (currentView instanceof PatientView) { * currentBean = new HashMap<String, AbstractMap.SimpleEntry<String, Long>>(); * * // labelLayout.removeAllComponents(); Button header = new * Button(patientView.getHeaderLabel()); header.setStyleName(ValoTheme.BUTTON_LARGE); * header.addStyleName(ValoTheme.BUTTON_BORDERLESS); header.setIcon(FontAwesome.HAND_O_RIGHT); * // labelLayout.addComponent(header); } else if (currentView instanceof AddPatientView) { * currentBean = new HashMap<String, AbstractMap.SimpleEntry<String, Long>>(); * * // labelLayout.removeAllComponents(); Button header = new Button(addPatientView.getHeader()); * header.setStyleName(ValoTheme.BUTTON_LARGE); * header.addStyleName(ValoTheme.BUTTON_BORDERLESS); header.setIcon(FontAwesome.HAND_O_RIGHT); * // labelLayout.addComponent(header); } try { PortletSession portletSession = * QbicmainportletUI.getCurrent().getPortletSession(); if (portletSession != null) { * portletSession.setAttribute("qbic_download", currentBean, PortletSession.APPLICATION_SCOPE); * } } catch (NullPointerException e) { // nothing to do. during initialization that might * happen. Nothing to worry about } * * * } * * }); */ /* * // go to correct page String requestParams = Page.getCurrent().getUriFragment(); * * // LOGGER.debug("used urifragement: " + requestParams); if (requestParams != null) { * navigator.navigateTo(requestParams.startsWith("!") ? requestParams.substring(1) : * requestParams); } else { navigator.navigateTo(""); } */ }
From source file:de.uni_tuebingen.qbic.qbicmainportlet.SearchEngineView.java
License:Open Source License
public void initUI() { mainlayout = new Panel(); mainlayout.addStyleName(ValoTheme.PANEL_BORDERLESS); // Search bar // *----------- search text field .... search button-----------* VerticalLayout searchbar = new VerticalLayout(); searchbar.setWidth(100, Unit.PERCENTAGE); setResponsive(true);//from w ww . j a v a2 s. c o m searchbar.setResponsive(true); // searchbar.setWidth(); HorizontalLayout buttonLayout = new HorizontalLayout(); buttonLayout.setResponsive(true); buttonLayout.setWidth(75, Unit.PERCENTAGE); // searchbar.setSpacing(true); final TextField searchfield = new TextField(); searchfield.setHeight("44px"); searchfield.setImmediate(true); searchfield.setResponsive(true); searchfield.setWidth(75, Unit.PERCENTAGE); buttonLayout.setSpacing(true); searchfield.setInputPrompt("search DB"); // searchfield.setCaption("QSearch"); // searchfield.setWidth(25.0f, Unit.EM); // searchfield.setWidth(60, Unit.PERCENTAGE); // TODO would be nice to have a autofill or something similar // searchFieldLayout.addComponent(searchfield); searchbar.addComponent(searchfield); searchbar.setComponentAlignment(searchfield, Alignment.MIDDLE_RIGHT); final NativeSelect navsel = new NativeSelect(); navsel.addItem("Whole DB"); navsel.addItem("Projects Only"); navsel.addItem("Experiments Only"); navsel.addItem("Samples Only"); navsel.setValue("Whole DB"); navsel.setHeight("20px"); navsel.setNullSelectionAllowed(false); navsel.setResponsive(true); navsel.setWidth(100, Unit.PERCENTAGE); navsel.addValueChangeListener(new Property.ValueChangeListener() { /** * */ private static final long serialVersionUID = -6896454887050432147L; @Override public void valueChange(ValueChangeEvent event) { // TODO Auto-generated method stub Notification.show((String) navsel.getValue()); switch ((String) navsel.getValue()) { case "Whole DB": datahandler.setShowOptions(Arrays.asList("Projects", "Experiments", "Samples")); break; case "Projects Only": datahandler.setShowOptions(Arrays.asList("Projects")); break; case "Experiments Only": datahandler.setShowOptions(Arrays.asList("Experiments")); break; case "Samples Only": datahandler.setShowOptions(Arrays.asList("Samples")); break; default: datahandler.setShowOptions(Arrays.asList("Projects", "Experiments", "Samples")); break; } } }); searchbar.addComponent(buttonLayout); searchbar.setComponentAlignment(buttonLayout, Alignment.MIDDLE_RIGHT); Button searchOk = new Button(""); searchOk.setStyleName(ValoTheme.BUTTON_TINY); // searchOk.addStyleName(ValoTheme.BUTTON_BORDERLESS); searchOk.setIcon(FontAwesome.SEARCH); searchOk.setSizeUndefined(); // searchOk.setWidth(15.0f, Unit.EM); searchOk.setResponsive(true); searchOk.setHeight("20px"); searchOk.addClickListener(new ClickListener() { private static final long serialVersionUID = -2409450448301908214L; @Override public void buttonClick(ClickEvent event) { String queryString = (String) searchfield.getValue().toString(); LOGGER.debug("the query was " + queryString); if (searchfield.getValue() == null || searchfield.getValue().toString().equals("") || searchfield.getValue().toString().trim().length() == 0) { Notification.show("Query field was empty!", Type.WARNING_MESSAGE); } else { try { /** * Sample foundSample = datahandler.getOpenBisClient() .getSampleByIdentifier( * matcher.group(0).toString()); */ datahandler.setSampleResults(querySamples(queryString)); datahandler.setExpResults(queryExperiments(queryString)); datahandler.setProjResults(queryProjects(queryString)); datahandler.setLastQueryString(queryString); State state = (State) UI.getCurrent().getSession().getAttribute("state"); ArrayList<String> message = new ArrayList<String>(); message.add("clicked"); message.add("view" + queryString); message.add("searchresults"); state.notifyObservers(message); } catch (Exception e) { LOGGER.error("after query: ", e); Notification.show("No Sample found for given barcode.", Type.WARNING_MESSAGE); } } } }); // setClickShortcut() would add global shortcut, instead we // 'scope' the shortcut to the panel: mainlayout.addAction(new com.vaadin.ui.Button.ClickShortcut(searchOk, KeyCode.ENTER)); // searchfield.addItems(this.getSearchResults("Q")); searchfield.setDescription(infotext); searchfield.addValidator(new NullValidator("Field must not be empty", false)); searchfield.setValidationVisible(false); buttonLayout.addComponent(navsel); // buttonLayout.addComponent(new Label("")); buttonLayout.addComponent(searchOk); // searchFieldLayout.setComponentAlignment(searchOk, Alignment.TOP_RIGHT); // buttonLayout.setExpandRatio(searchOk, 1); // buttonLayout.setExpandRatio(navsel, 1); // searchFieldLayout.setSpacing(true); buttonLayout.setComponentAlignment(searchOk, Alignment.BOTTOM_RIGHT); // buttonLayout.setComponentAlignment(navsel, Alignment.BOTTOM_LEFT); buttonLayout.setExpandRatio(searchOk, 1); buttonLayout.setExpandRatio(navsel, 2); // searchbar.setMargin(new MarginInfo(true, false, true, false)); mainlayout.setContent(searchbar); // mainlayout.setComponentAlignment(searchbar, Alignment.MIDDLE_RIGHT); // mainlayout.setWidth(100, Unit.PERCENTAGE); setCompositionRoot(mainlayout); }
From source file:dhbw.clippinggorilla.userinterface.views.InterestProfileView.java
private void addRow(InterestProfile profile, boolean included, String value) { GridLayout tagLayout = new GridLayout(2, 1); tagLayout.setWidth("100%"); Label labelTagName = new Label(value, ContentMode.HTML); labelTagName.setWidth("100%"); labelTagName.addStyleName(ValoTheme.LABEL_H3); labelTagName.addStyleName(ValoTheme.LABEL_NO_MARGIN); Button buttonDeleteTag = new Button(VaadinIcons.TRASH); buttonDeleteTag.addStyleName(ValoTheme.BUTTON_DANGER); buttonDeleteTag.addClickListener(ev -> { profile.getTags().remove(value); if (included) { includedTagsLayouts.get(profile).removeComponent(tagLayout); } else {/*from w ww .j ava2 s .com*/ excludedTagsLayouts.get(profile).removeComponent(tagLayout); } }); tagLayout.addComponents(labelTagName, buttonDeleteTag); tagLayout.setComponentAlignment(labelTagName, Alignment.MIDDLE_LEFT); tagLayout.setComponentAlignment(buttonDeleteTag, Alignment.MIDDLE_RIGHT); tagLayout.setWidth("100%"); tagLayout.setColumnExpandRatio(0, 5); tagLayout.setSpacing(true); tagLayout.setMargin(false); if (included) { includedTagsLayouts.get(profile).addComponent(tagLayout, 2); } else { excludedTagsLayouts.get(profile).addComponent(tagLayout, 2); } }
From source file:dhbw.clippinggorilla.userinterface.windows.GroupProfileWindow.java
private void addRow(GroupInterestProfile profile, boolean included, String value, boolean isAdmin) { GridLayout tagLayout = new GridLayout(2, 1); tagLayout.setWidth("100%"); Label labelTagName = new Label(value, ContentMode.HTML); labelTagName.setWidth("100%"); labelTagName.addStyleName(ValoTheme.LABEL_H3); labelTagName.addStyleName(ValoTheme.LABEL_NO_MARGIN); tagLayout.addComponent(labelTagName); tagLayout.setComponentAlignment(labelTagName, Alignment.MIDDLE_LEFT); if (isAdmin) { Button buttonDeleteTag = new Button(VaadinIcons.TRASH); buttonDeleteTag.addStyleName(ValoTheme.BUTTON_DANGER); buttonDeleteTag.addClickListener(ev -> { profile.getTags().remove(value); if (included) { includedTagsLayouts.get(profile).removeComponent(tagLayout); } else { excludedTagsLayouts.get(profile).removeComponent(tagLayout); }//from w ww . ja va 2s.c o m }); tagLayout.addComponent(buttonDeleteTag); tagLayout.setComponentAlignment(buttonDeleteTag, Alignment.MIDDLE_RIGHT); } tagLayout.setWidth("100%"); tagLayout.setColumnExpandRatio(0, 5); tagLayout.setSpacing(true); tagLayout.setMargin(false); if (included) { if (isAdmin) { includedTagsLayouts.get(profile).addComponent(tagLayout, 2); } else { includedTagsLayouts.get(profile).addComponent(tagLayout, 1); } } else { if (isAdmin) { excludedTagsLayouts.get(profile).addComponent(tagLayout, 2); } else { excludedTagsLayouts.get(profile).addComponent(tagLayout, 1); } } }
From source file:dhbw.clippinggorilla.userinterface.windows.NewSourceWindow.java
/** * Value is optional/* w w w . jav a2 s . co m*/ * * @param action * @param content * @param value * @return */ private Component getRow(Layout parent, Runnable onDelete, String action, String content, String value) { Panel panelRow = new Panel(); GridLayout layoutRow = new GridLayout(2, 1); Label labelInfo = new Label("", ContentMode.HTML); String stringInfo = action.toUpperCase() + "<br>"; if (value != null) { stringInfo += content + " = " + value; } else { stringInfo += content + " "; } labelInfo.setValue(stringInfo); Button buttonDelete = new Button(VaadinIcons.TRASH); buttonDelete.addStyleName(ValoTheme.BUTTON_DANGER); buttonDelete.addClickListener(ce -> { onDelete.run(); parent.removeComponent(panelRow); }); layoutRow.addComponents(labelInfo, buttonDelete); layoutRow.setComponentAlignment(buttonDelete, Alignment.MIDDLE_RIGHT); layoutRow.setComponentAlignment(labelInfo, Alignment.MIDDLE_LEFT); layoutRow.setWidth("100%"); layoutRow.setMargin(true); layoutRow.addStyleName("crawler"); panelRow.setContent(layoutRow); panelRow.setWidth("100%"); return panelRow; }
From source file:ed.cracken.pos.ui.purchases.PurchaserView.java
public HorizontalLayout createFooter() { total = new Label("<h2><strong>Total:</strong></h2>"); total.setContentMode(ContentMode.HTML); totalValue = new Label("<h2><strong>" + DataFormatHelper.formatNumber(BigDecimal.ZERO) + "</strong></h2>"); totalValue.setContentMode(ContentMode.HTML); quantity = new Label("<h2><strong>Cantidad:</strong></h2>"); quantity.setContentMode(ContentMode.HTML); quantityValue = new Label( "<h2><strong>" + DataFormatHelper.formatNumber(BigDecimal.ZERO) + "</strong></h2>"); quantityValue.setContentMode(ContentMode.HTML); saveTrx = new Button("Guardar", FontAwesome.CHECK_CIRCLE_O); saveTrx.addStyleName(ValoTheme.BUTTON_PRIMARY); saveTrx.setHeight("60px"); saveTrx.addClickListener((Button.ClickEvent event) -> { UI.getCurrent().addWindow(paymentView); });// w w w .ja v a2 s. co m cancelTrx = new Button("Cancelar", FontAwesome.CLOSE); cancelTrx.addStyleName(ValoTheme.BUTTON_DANGER); cancelTrx.setHeight("60px"); HorizontalLayout bottom = new HorizontalLayout(); HorizontalLayout labelsArea = new HorizontalLayout(); HorizontalLayout buttonsArea = new HorizontalLayout(); labelsArea.setSpacing(true); labelsArea.addComponent(total); labelsArea.addComponent(totalValue); labelsArea.addComponent(quantity); labelsArea.addComponent(quantityValue); labelsArea.setComponentAlignment(total, Alignment.MIDDLE_LEFT); labelsArea.setComponentAlignment(totalValue, Alignment.MIDDLE_LEFT); labelsArea.setComponentAlignment(quantity, Alignment.MIDDLE_RIGHT); labelsArea.setComponentAlignment(quantityValue, Alignment.MIDDLE_RIGHT); buttonsArea.setSpacing(true); buttonsArea.addComponent(saveTrx); buttonsArea.addComponent(cancelTrx); bottom.setSpacing(true); bottom.addComponent(buttonsArea); bottom.addComponent(labelsArea); bottom.setComponentAlignment(buttonsArea, Alignment.MIDDLE_LEFT); bottom.setComponentAlignment(labelsArea, Alignment.MIDDLE_RIGHT); bottom.setWidth("100%"); return bottom; }
From source file:edu.kit.dama.ui.admin.administration.user.UserDataForm.java
License:Apache License
public UserDataForm(UserDataAdministrationTab userDataAdministrationTab) { this.userDataAdministrationTab = userDataAdministrationTab; LOGGER.debug("Building " + DEBUG_ID_PREFIX + " ..."); setId(DEBUG_ID_PREFIX.substring(0, DEBUG_ID_PREFIX.length() - 1)); setColumns(5);// ww w . j a v a 2 s . c o m setRows(4); setSizeFull(); setSpacing(true); // Add components to addComponent(getUserIdField(), 0, 0); addComponent(getFirstNameField(), 0, 1); addComponent(getValidFromField(), 0, 2); addComponent(getEmailField(), 0, 3); addComponent(getDistinguishedNameField(), 2, 0); addComponent(getLastNameField(), 2, 1); addComponent(getValidUntilField(), 2, 2); addComponent(getMaximumRoleBox(), 2, 3); addComponent(getCommitChangesButton(), 4, 0); addComponent(getShowMembershipsButton(), 4, 1); addComponent(getRegisterUserButton(), 4, 2, 4, 3); setColumnExpandRatio(0, 0.39f); setColumnExpandRatio(1, 0.01f); setColumnExpandRatio(2, 0.39f); setColumnExpandRatio(3, 0.01f); setColumnExpandRatio(4, 0.2f); setComponentAlignment(getCommitChangesButton(), Alignment.MIDDLE_RIGHT); setComponentAlignment(getShowMembershipsButton(), Alignment.MIDDLE_RIGHT); setComponentAlignment(getRegisterUserButton(), Alignment.MIDDLE_CENTER); }
From source file:edu.kit.dama.ui.admin.administration.usergroup.UserGroupForm.java
License:Apache License
public UserGroupForm(UserGroupAdministrationTab groupAdministrationTab) { this.userGroupAdministrationTab = groupAdministrationTab; LOGGER.debug("Building " + DEBUG_ID_PREFIX + " ..."); setId(DEBUG_ID_PREFIX.substring(0, DEBUG_ID_PREFIX.length() - 1)); setColumns(5);/*w w w . j a v a 2 s .com*/ setRows(4); setSizeFull(); setSpacing(true); // Add components addComponent(getIdField(), 0, 0); addComponent(getGroupNameField(), 0, 1); addComponent(getDescriptionArea(), 0, 2, 2, 3); addComponent(getGroupIdField(), 2, 0); addComponent(getNumberOfMembersField(), 2, 1); addComponent(getCommitChangesButton(), 4, 0); addComponent(getShowMembersButton(), 4, 1); addComponent(getCreateUserGroupButton(), 4, 2, 4, 3); setColumnExpandRatio(0, 0.39f); setColumnExpandRatio(1, 0.01f); setColumnExpandRatio(2, 0.39f); setColumnExpandRatio(3, 0.01f); setColumnExpandRatio(4, 0.2f); setComponentAlignment(getCommitChangesButton(), Alignment.BOTTOM_RIGHT); setComponentAlignment(getShowMembersButton(), Alignment.MIDDLE_RIGHT); setComponentAlignment(getCreateUserGroupButton(), Alignment.MIDDLE_CENTER); }
From source file:edu.kit.dama.ui.admin.LoginInformationBar.java
License:Apache License
private void buildMainLayout() { loggedInAsLabel = new Label("Login Username"); loggedInAsLabel.addStyleName("myboldcaption"); loggedInUserLabel = new Label(); activeGroupLabel = new Label("Active Group"); activeGroupLabel.addStyleName("myboldcaption"); groupSelection = new ComboBox(); groupSelection.addValueChangeListener(this); activeRoleLabel = new Label("Current Role"); activeRoleLabel.addStyleName("myboldcaption"); roleLabel = new Label(); Label spacer1 = new Label(""); home = buildMenuItem("home", new ThemeResource("img/70x48/logo_default.png")); profile = buildMenuItem("profile", new ThemeResource("img/70x48/preferences.png")); simon = buildMenuItem("simon", new ThemeResource("img/70x48/simon.png")); settings = buildMenuItem("settings", new ThemeResource("img/70x48/gears_preferences.png")); exit = buildMenuItem("exit", new ThemeResource("img/70x48/exit.png")); final AbsoluteLayout helps = new AbsoluteLayout(); helps.setHeight("48px"); helps.setWidth("100%"); addHelpItem("home", "Return to the main page.", helps); addHelpItem("profile", "Open your profile, e.g. to change your password.", helps); addHelpItem("simon", "Open the <b>SI</b>mple<b>MON</b>itoring Tool, e.g. to check the availability of single services.", helps);/* ww w. ja va2 s. c om*/ addHelpItem("settings", "Open the system settings. (Only available for Group Managers and Administrators)", helps); addHelpItem("exit", "Logout.", helps); HorizontalLayout navigation = new HorizontalLayout(home, profile, simon, settings, exit, helps, spacer1); navigation.setExpandRatio(helps, .9f); navigation.setExpandRatio(spacer1, .1f); navigation.setSizeFull(); navigation.addStyleName("mynavigationmargin"); navigation.addLayoutClickListener((LayoutEvents.LayoutClickEvent event) -> { if (home.equals(event.getClickedComponent())) { parent.updateView(VIEW.INFORMATION); } else if (profile.equals(event.getClickedComponent())) { parent.updateView(VIEW.PROFILE); } else if (simon.equals(event.getClickedComponent())) { parent.updateView(VIEW.SIMON); } else if (settings.equals(event.getClickedComponent())) { parent.updateView(VIEW.SETTINGS); } else if (exit.equals(event.getClickedComponent())) { parent.logout(); } }); GridLayout loginInformationLayout = new UIUtils7.GridLayoutBuilder(3, 2) .addComponent(loggedInAsLabel, Alignment.MIDDLE_CENTER, 0, 0, 1, 1) .addComponent(activeGroupLabel, Alignment.MIDDLE_CENTER, 1, 0, 1, 1) .addComponent(activeRoleLabel, Alignment.MIDDLE_CENTER, 2, 0, 1, 1) .addComponent(loggedInUserLabel, Alignment.MIDDLE_CENTER, 0, 1, 1, 1) .addComponent(groupSelection, Alignment.MIDDLE_CENTER, 1, 1, 1, 1) .addComponent(roleLabel, Alignment.MIDDLE_CENTER, 2, 1, 1, 1).getLayout(); loginInformationLayout.setSpacing(true); mainLayout = new UIUtils7.GridLayoutBuilder(5, 2) .addComponent(navigation, Alignment.MIDDLE_LEFT, 0, 0, 3, 2) .addComponent(loginInformationLayout, Alignment.MIDDLE_RIGHT, 3, 0, 2, 2).getLayout(); mainLayout.setColumnExpandRatio(0, 1.0f); mainLayout.setColumnExpandRatio(1, .01f); mainLayout.setColumnExpandRatio(2, .01f); mainLayout.setColumnExpandRatio(3, .01f); mainLayout.setColumnExpandRatio(4, .01f); mainLayout.setSpacing(true); mainLayout.setMargin(new MarginInfo(false, true, false, true)); mainLayout.setSizeFull(); }