List of usage examples for com.vaadin.ui GridLayout addStyleName
@Override public void addStyleName(String style)
From source file:dhbw.clippinggorilla.userinterface.windows.GroupProfileWindow.java
public GroupProfileWindow(GroupInterestProfile p, Runnable onClose, boolean isAdmin) { VerticalLayout profileSettingsLayout = new VerticalLayout(); GridLayout windowContent;//from w w w .ja va 2 s . c om Button buttonSave = new Button(); if (isAdmin) { windowContent = new GridLayout(3, 3); TextField textFieldName = new TextField(); Language.set(Word.NAME, textFieldName); textFieldName.setWidth("100%"); textFieldName.setValue(p.getName()); textFieldName.setMaxLength(255); Language.set(Word.SAVE, buttonSave); buttonSave.setIcon(VaadinIcons.CHECK); buttonSave.addStyleName(ValoTheme.BUTTON_PRIMARY); buttonSave.addClickListener(ce -> { GroupInterestProfileUtils.changeName(p, textFieldName.getValue()); GroupInterestProfileUtils.changeSources(p, p.getSources()); GroupInterestProfileUtils.changeCategories(p, p.getCategories()); GroupInterestProfileUtils.changeAllTags(p, p.getTags()); VaadinUtils.infoNotification(Language.get(Word.SUCCESSFULLY_SAVED)); close(); onClose.run(); }); Label placeholder2 = new Label(); placeholder2.setWidth("100%"); windowContent.addComponents(textFieldName, placeholder2); windowContent.setComponentAlignment(textFieldName, Alignment.MIDDLE_LEFT); windowContent.addComponent(getSources(p, true), 0, 1, 1, 1); windowContent.addComponent(getCategories(p, true), 2, 1); windowContent.addComponent(getTags(p, true), 0, 2, 2, 2); } else { windowContent = new GridLayout(3, 2); Language.set(Word.CLOSE, buttonSave); buttonSave.setIcon(VaadinIcons.CLOSE); buttonSave.addStyleName(ValoTheme.BUTTON_PRIMARY); buttonSave.addClickListener(ce -> { close(); onClose.run(); }); windowContent.addComponent(getSources(p, false), 0, 0, 1, 0); windowContent.addComponent(getCategories(p, false), 2, 0); windowContent.addComponent(getTags(p, false), 0, 1, 2, 1); } buttonSave.setClickShortcut(ShortcutAction.KeyCode.ENTER, null); Label placeholder = new Label(); Label labelHelp = new Label(Language.get(Word.HELP_TEXT), ContentMode.HTML); labelHelp.setWidth("500px"); PopupView popupHelp = new PopupView(null, labelHelp); Button buttonHelp = new Button(Language.get(Word.HELP), VaadinIcons.QUESTION); buttonHelp.addClickListener(ce -> { popupHelp.setPopupVisible(true); }); GridLayout footer; if (isAdmin) { footer = new GridLayout(4, 1); footer.addComponents(buttonHelp, popupHelp, placeholder, buttonSave); footer.setColumnExpandRatio(2, 5); } else { footer = new GridLayout(2, 1); footer.addComponents(placeholder, buttonSave); footer.setColumnExpandRatio(0, 5); } footer.setSpacing(true); footer.setSizeUndefined(); footer.addStyleName(ValoTheme.WINDOW_BOTTOM_TOOLBAR); footer.setWidth("100%"); footer.addStyleName("menubar"); footer.setComponentAlignment(buttonSave, Alignment.MIDDLE_CENTER); windowContent.setWidth("100%"); windowContent.setSpacing(true); windowContent.setMargin(true); windowContent.addStyleName("profiles"); profileSettingsLayout.addComponents(windowContent, footer); profileSettingsLayout.setMargin(false); profileSettingsLayout.setSpacing(false); profileSettingsLayout.setWidth("100%"); setContent(profileSettingsLayout); center(); setWidthUndefined(); setCaption(p.getName()); setWidth("950px"); }
From source file:dhbw.clippinggorilla.userinterface.windows.GroupProfileWindow.java
public Component getSources(GroupInterestProfile profile, boolean isAdmin) { VerticalLayout windowLayout = new VerticalLayout(); windowLayout.setWidth("100%"); VerticalLayout sourcesLayout = new VerticalLayout(); sourcesLayout.setWidth("100%"); Panel sourcesPanel = new Panel(sourcesLayout); List<CheckBox> checkBoxes = new ArrayList<>(); HashMap<String, GridLayout> sourceLayouts = new HashMap<>(); profile.getSources().entrySet().stream() .sorted((e1, e2) -> e1.getKey().getName().compareToIgnoreCase(e2.getKey().getName())).forEach(e -> { Source source = e.getKey(); boolean enabled = e.getValue(); GridLayout sourceLayout = new GridLayout(5, 1); sourceLayout.setSizeFull(); CheckBox sourceSelected = new CheckBox(); sourceSelected.setValue(enabled); sourceSelected.addStyleName(ValoTheme.CHECKBOX_LARGE); sourceSelected.addValueChangeListener(v -> profile.getSources().replace(source, v.getValue())); sourceSelected.setEnabled(isAdmin); checkBoxes.add(sourceSelected); Image sourceLogo = new Image(); sourceLogo.addStyleName("logosmall"); sourceLogo.setSource(new ExternalResource(source.getLogo())); if (isAdmin) { sourceLogo.addClickListener(c -> { sourceSelected.setValue(!sourceSelected.getValue()); profile.getSources().replace(source, sourceSelected.getValue()); });/*from w w w. j a v a 2 s .c o m*/ } VerticalLayout layoutLogo = new VerticalLayout(sourceLogo); layoutLogo.setWidth("150px"); layoutLogo.setHeight("50px"); layoutLogo.setMargin(false); layoutLogo.setSpacing(false); layoutLogo.setComponentAlignment(sourceLogo, Alignment.MIDDLE_LEFT); Label labelHeadLine = new Label( source.getCategory().getIcon().getHtml() + " " + source.getName(), ContentMode.HTML); labelHeadLine.addStyleName(ValoTheme.LABEL_H3); Label labelDescription = new Label(source.getDescription(), ContentMode.HTML); labelDescription.setWidth("300px"); PopupView popup = new PopupView(null, labelDescription); Button buttonDescription = new Button(VaadinIcons.INFO_CIRCLE_O); buttonDescription.addClickListener(ce -> { popup.setPopupVisible(true); }); sourceLayout.addComponents(sourceSelected, layoutLogo, labelHeadLine, popup, buttonDescription); sourceLayout.setComponentAlignment(sourceSelected, Alignment.MIDDLE_CENTER); sourceLayout.setComponentAlignment(layoutLogo, Alignment.MIDDLE_CENTER); sourceLayout.setColumnExpandRatio(2, 5); sourceLayout.setSpacing(true); sourceLayouts.put(source.getName().toLowerCase().replaceAll(" ", "").replaceAll("-", "") .replaceAll("_", ""), sourceLayout); sourcesLayout.addComponent(sourceLayout); }); sourcesPanel.setContent(sourcesLayout); sourcesPanel.setHeight("100%"); sourcesPanel.setCaption(Language.get(Word.SOURCES)); Language.setCustom(Word.SOURCES, s -> sourcesPanel.setCaption(s)); windowLayout.addComponent(sourcesPanel); windowLayout.setExpandRatio(sourcesPanel, 1); windowLayout.setSpacing(false); windowLayout.setMargin(false); CheckBox checkBoxSelectAll = new CheckBox(); Language.setCustom(Word.SELECT_ALL, s -> checkBoxSelectAll.setCaption(s)); checkBoxSelectAll.setWidth("100%"); checkBoxSelectAll.addValueChangeListener(e -> { profile.getSources().replaceAll((c, enabled) -> checkBoxSelectAll.getValue()); checkBoxes.forEach(c -> c.setValue(checkBoxSelectAll.getValue())); }); checkBoxSelectAll.setEnabled(isAdmin); TextField textFieldSearch = new TextField(); Language.setCustom(Word.SEARCH, s -> textFieldSearch.setPlaceholder(s)); textFieldSearch.setWidth("100%"); textFieldSearch.setMaxLength(255); textFieldSearch.setPlaceholder(Language.get(Word.SEARCH)); textFieldSearch.addValueChangeListener(searchValue -> { sourceLayouts.forEach((sourceName, sourceLayout) -> { if (!sourceName.contains(searchValue.getValue().toLowerCase().replaceAll(" ", "") .replaceAll("-", "").replaceAll("_", ""))) { sourcesLayout.removeComponent(sourceLayout); } else { sourcesLayout.addComponent(sourceLayout); } }); }); Label placeholder = new Label(); placeholder.setWidth("100%"); GridLayout footer = new GridLayout(3, 1); footer.setSpacing(true); footer.setMargin(new MarginInfo(true, false, false, false)); footer.addStyleName("menubar"); footer.setWidth("100%"); footer.addComponents(checkBoxSelectAll, textFieldSearch, placeholder); footer.setComponentAlignment(checkBoxSelectAll, Alignment.MIDDLE_LEFT); footer.setComponentAlignment(textFieldSearch, Alignment.MIDDLE_CENTER); windowLayout.addComponent(footer); windowLayout.setHeight("350px"); return windowLayout; }
From source file:dhbw.clippinggorilla.userinterface.windows.ManageSourcesWindow.java
public Component getSourcesList() { VerticalLayout windowLayout = new VerticalLayout(); windowLayout.setSizeFull();/*from w ww . j av a 2 s. com*/ sourcesLayout = new VerticalLayout(); sourcesLayout.setWidth("100%"); Panel sourcesPanel = new Panel(sourcesLayout); refreshSources(); sourcesPanel.setContent(sourcesLayout); sourcesPanel.setHeight("100%"); windowLayout.addComponent(sourcesPanel); windowLayout.setExpandRatio(sourcesPanel, 1); windowLayout.setSpacing(false); windowLayout.setMargin(false); TextField textFieldSearch = new TextField(); textFieldSearch.setPlaceholder(Language.get(Word.SEARCH)); textFieldSearch.addValueChangeListener(searchValue -> { sourceLayouts.forEach((sourceName, sourceLayout) -> { if (!sourceName.contains(searchValue.getValue().toLowerCase().replaceAll(" ", "") .replaceAll("-", "").replaceAll("_", ""))) { sourcesLayout.removeComponent(sourceLayout); } else { sourcesLayout.addComponent(sourceLayout); } }); }); Button buttonAddSource = new Button(Language.get(Word.ADD_SOURCE), VaadinIcons.PLUS); buttonAddSource.addClickListener(ce -> UI.getCurrent().addWindow(NewSourceWindow.create())); Button buttonSave = new Button(); Language.set(Word.SAVE, buttonSave); buttonSave.setIcon(VaadinIcons.CHECK); buttonSave.addStyleName(ValoTheme.BUTTON_PRIMARY); buttonSave.addClickListener(ce -> { close(); }); buttonSave.setClickShortcut(ShortcutAction.KeyCode.ENTER, null); Label placeholder = new Label(); GridLayout footer = new GridLayout(4, 1); footer.setSpacing(true); footer.setSizeUndefined(); footer.addStyleName(ValoTheme.WINDOW_BOTTOM_TOOLBAR); footer.addStyleName("menubar"); footer.setWidth(100.0f, Unit.PERCENTAGE); footer.addComponents(textFieldSearch, placeholder, buttonAddSource, buttonSave); footer.setComponentAlignment(textFieldSearch, Alignment.MIDDLE_CENTER); footer.setComponentAlignment(buttonAddSource, Alignment.MIDDLE_CENTER); footer.setComponentAlignment(buttonSave, Alignment.MIDDLE_CENTER); footer.setColumnExpandRatio(1, 5); windowLayout.addComponent(footer); return windowLayout; }
From source file:dhbw.clippinggorilla.userinterface.windows.NewSourceWindow.java
/** * Value is optional/*from w w w.ja v a2 s .c o 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:dhbw.clippinggorilla.userinterface.windows.NewSourceWindow.java
public Component getFooter(Runnable cancelRunnable, Runnable nextRunnable, Component... extraComponents) { Label placeholder = new Label(); Button cancel = new Button(Language.get(Word.CANCEL), VaadinIcons.CLOSE); cancel.addClickListener(ce -> cancelRunnable.run()); Button next = new Button(Language.get(Word.NEXT), VaadinIcons.ARROW_RIGHT); next.addClickListener(ce -> nextRunnable.run()); GridLayout footer = new GridLayout(3 + extraComponents.length, 1); footer.setSpacing(true);//from w ww . j a v a 2 s .com footer.addStyleName(ValoTheme.WINDOW_BOTTOM_TOOLBAR); footer.setWidth(100.0f, Sizeable.Unit.PERCENTAGE); footer.setSizeUndefined(); footer.setWidth("100%"); for (Component extraComponent : extraComponents) { footer.addComponent(extraComponent); footer.setComponentAlignment(extraComponent, Alignment.MIDDLE_CENTER); } footer.addComponents(placeholder, cancel, next); footer.setColumnExpandRatio(footer.getColumns() - 1 - 2, 1);//ExpandRatio(placeholder, 1); footer.setComponentAlignment(cancel, Alignment.MIDDLE_CENTER); footer.setComponentAlignment(next, Alignment.MIDDLE_CENTER); return footer; }
From source file:dhbw.clippinggorilla.userinterface.windows.RegisterWindow.java
public RegisterWindow() { setModal(true);//from ww w .j a v a2 s . c o m setResizable(false); setDraggable(false); setCaption(Language.get(Word.REGISTER)); addCloseShortcut(KeyCode.ENTER, null); Button save = new Button(Language.get(Word.REGISTER)); VerticalLayout windowLayout = new VerticalLayout(); windowLayout.setMargin(false); windowLayout.setSizeUndefined(); FormLayout forms = new FormLayout(); forms.setMargin(true); forms.setSizeUndefined(); TextField firstName = new TextField(Language.get(Word.FIRST_NAME)); firstName.focus(); firstName.setMaxLength(20); firstName.addValueChangeListener(event -> { String firstNameError = UserUtils.checkName(event.getValue()); if (!firstNameError.isEmpty()) { firstName.setComponentError(new UserError(firstNameError, AbstractErrorMessage.ContentMode.HTML, ErrorMessage.ErrorLevel.INFORMATION)); VaadinUtils.infoNotification(firstNameError); save.setEnabled(setError(firstName, true)); } else { firstName.setComponentError(null); boolean enabled = setError(firstName, false); save.setEnabled(enabled); } }); forms.addComponent(firstName); TextField lastName = new TextField(Language.get(Word.LAST_NAME)); lastName.setMaxLength(20); lastName.addValueChangeListener(event -> { String lastNameError = UserUtils.checkName(event.getValue()); if (!lastNameError.isEmpty()) { lastName.setComponentError(new UserError(lastNameError, AbstractErrorMessage.ContentMode.HTML, ErrorMessage.ErrorLevel.INFORMATION)); VaadinUtils.infoNotification(lastNameError); save.setEnabled(setError(lastName, true)); } else { lastName.setComponentError(null); save.setEnabled(setError(lastName, false)); } }); forms.addComponent(lastName); TextField userName = new TextField(Language.get(Word.USERNAME)); userName.setMaxLength(20); userName.addValueChangeListener(event -> { String userNameError = UserUtils.checkUsername(event.getValue()); if (!userNameError.isEmpty()) { userName.setComponentError(new UserError(userNameError, AbstractErrorMessage.ContentMode.HTML, ErrorMessage.ErrorLevel.INFORMATION)); VaadinUtils.infoNotification(userNameError); save.setEnabled(setError(userName, true)); } else { userName.setComponentError(null); save.setEnabled(setError(userName, false)); } }); forms.addComponent(userName); TextField email1 = new TextField(Language.get(Word.EMAIL)); email1.setMaxLength(256); email1.addValueChangeListener(event -> { String email1Error = UserUtils.checkEmail(event.getValue().toLowerCase()); if (!email1Error.isEmpty()) { email1.setComponentError(new UserError(email1Error, AbstractErrorMessage.ContentMode.HTML, ErrorMessage.ErrorLevel.INFORMATION)); VaadinUtils.infoNotification(email1Error); save.setEnabled(setError(email1, true)); } else { email1.setComponentError(null); save.setEnabled(setError(email1, false)); } }); forms.addComponent(email1); TextField email2 = new TextField(Language.get(Word.EMAIL_AGAIN)); email2.setMaxLength(256); email2.addValueChangeListener(event -> { String email2Error = UserUtils.checkEmail(event.getValue().toLowerCase()) + UserUtils.checkSecondEmail(email1.getValue().toLowerCase(), event.getValue().toLowerCase()); if (!email2Error.isEmpty()) { email2.setComponentError(new UserError(email2Error, AbstractErrorMessage.ContentMode.HTML, ErrorMessage.ErrorLevel.INFORMATION)); VaadinUtils.infoNotification(email2Error); save.setEnabled(setError(email2, true)); } else { email2.setComponentError(null); save.setEnabled(setError(email2, false)); } }); forms.addComponent(email2); ProgressBar strength = new ProgressBar(); PasswordField password1 = new PasswordField(Language.get(Word.PASSWORD)); password1.setMaxLength(51); password1.addValueChangeListener(event -> { String password1Error = UserUtils.checkPassword(event.getValue()); strength.setValue(UserUtils.calculatePasswordStrength(event.getValue())); if (!password1Error.isEmpty()) { password1.setComponentError(new UserError(password1Error, AbstractErrorMessage.ContentMode.HTML, ErrorMessage.ErrorLevel.INFORMATION)); VaadinUtils.infoNotification(password1Error); save.setEnabled(setError(password1, true)); } else { password1.setComponentError(null); save.setEnabled(setError(password1, false)); } }); forms.addComponent(password1); strength.setWidth("184px"); strength.setHeight("1px"); forms.addComponent(strength); PasswordField password2 = new PasswordField(Language.get(Word.PASSWORD_AGAIN)); password2.setMaxLength(51); password2.addValueChangeListener(event -> { String password2Error = UserUtils.checkPassword(event.getValue()) + UserUtils.checkSecondPassword(password1.getValue(), event.getValue()); if (!password2Error.isEmpty()) { password2.setComponentError(new UserError(password2Error, AbstractErrorMessage.ContentMode.HTML, ErrorMessage.ErrorLevel.INFORMATION)); VaadinUtils.infoNotification(password2Error); save.setEnabled(setError(password2, true)); } else { password2.setComponentError(null); save.setEnabled(setError(password2, false)); } }); forms.addComponent(password2); GridLayout footer = new GridLayout(3, 1); footer.setSpacing(true); footer.setSizeUndefined(); footer.addStyleName(ValoTheme.WINDOW_BOTTOM_TOOLBAR); footer.setWidth(100.0f, Unit.PERCENTAGE); Label placeholder = new Label(); Button cancel = new Button(Language.get(Word.CANCEL)); cancel.setIcon(VaadinIcons.CLOSE); cancel.addClickListener(ce -> { close(); }); cancel.setClickShortcut(KeyCode.ESCAPE, null); save.setEnabled(false); save.setIcon(VaadinIcons.CHECK); save.addStyleName(ValoTheme.BUTTON_PRIMARY); save.addClickListener(ce -> { try { User user = UserUtils.registerUser(userName.getValue(), password1.getValue(), password2.getValue(), email1.getValue().toLowerCase(), email2.getValue().toLowerCase(), firstName.getValue(), lastName.getValue()); UserUtils.setCurrentUser(user); close(); UI.getCurrent().addWindow(ActivateWindow.get()); } catch (UserCreationException ex) { Log.error("Registration failed", ex); VaadinUtils.errorNotification(Language.get(Word.REG_FAILED)); } }); save.setClickShortcut(KeyCode.ENTER, null); footer.addComponents(placeholder, cancel, save); footer.setColumnExpandRatio(0, 1);//ExpandRatio(placeholder, 1); footer.setComponentAlignment(cancel, Alignment.MIDDLE_CENTER); footer.setComponentAlignment(save, Alignment.MIDDLE_CENTER); windowLayout.addComponent(forms); windowLayout.addComponent(footer); setContent(windowLayout); }
From source file:dhbw.ka.mwi.businesshorizon2.ui.scenarioscreen.ScenarioScreenViewImpl.java
License:Open Source License
/** * Die Methode fuegt der View ein Szenario hinzu. Sie baut hierzu saemtliche * notwendigen GUI-Elemente und entsprechenden Listener hinzu. * // ww w. ja va2 s .c om * Auf ein GridLayout umgestellt. * * @author Julius Hacker, Tobias Lindner * @param rateReturnEquity Standardwert fuer die Renditeforderung Eigenkapital * @param rateReturnCapitalStock Standardwert fuer die Renditeforderung Fremdkapital * @param businessTax Standardwert fuer die Gewerbesteuer * @param corporateAndSolitaryTax Standardwert fuer die Koerperschaftssteuer mit Solidaritaetszuschlag. */ @Override public void addScenario(String rateReturnEquity, String rateReturnCapitalStock, String corporateAndSolitaryTax, String businessTax, String personalTaxRate, boolean isIncludeInCalculation, final int number) { HashMap<String, AbstractComponent> scenarioComponents = new HashMap<String, AbstractComponent>(); Property.ValueChangeListener changeListener = new Property.ValueChangeListener() { private static final long serialVersionUID = 1L; @Override public void valueChange(ValueChangeEvent event) { presenter.updateScenario(number); logger.debug("TextChange ausgeloest"); logger.debug("ChangeListener " + System.identityHashCode(this)); presenter.isValid(); } }; final GridLayout gl = new GridLayout(3, 7); gl.addStyleName("gridLayoutScenarios"); gl.setSizeFull(); gl.setColumnExpandRatio(0, 2); gl.setColumnExpandRatio(1, 1); gl.setColumnExpandRatio(2, 1); final Label scenarioName = new Label("<strong>Szenario " + number + "</strong>"); scenarioName.setContentMode(Label.CONTENT_XHTML); scenarioComponents.put("label", scenarioName); logger.debug("SzenarioName: " + scenarioName); gl.addComponent(scenarioName, 0, 0); //EK Rendite final Label textEigenkapital = new Label("Renditeforderung Eigenkapital: "); textEigenkapital.setSizeFull(); final TextField tfEigenkapital = new TextField(); if (!"0.0".equals(rateReturnEquity)) { tfEigenkapital.setValue(rateReturnEquity); } tfEigenkapital.setImmediate(true); tfEigenkapital.addStyleName("scenario"); tfEigenkapital.addListener(changeListener); gl.addComponent(textEigenkapital, 0, 1); gl.addComponent(tfEigenkapital, 1, 1); scenarioComponents.put("rateReturnEquity", tfEigenkapital); // Fremdkapital final Label textFremdkapitel = new Label("Renditeforderung FK: "); final TextField tfFremdkapital = new TextField(); if (!"0.0".equals(rateReturnCapitalStock)) { tfFremdkapital.setValue(rateReturnCapitalStock); } tfFremdkapital.setImmediate(true); tfFremdkapital.addStyleName("scenario"); tfFremdkapital.addListener(changeListener); gl.addComponent(textFremdkapitel, 0, 2); gl.addComponent(tfFremdkapital, 1, 2); scenarioComponents.put("rateReturnCapitalStock", tfFremdkapital); //Gewerbesteuer final Label textGewerbesteuer = new Label("Gewerbesteuer:"); final TextField tfGewerbesteuer = new TextField(); if (!"0.0".equals(businessTax)) { tfGewerbesteuer.setValue(businessTax); } tfGewerbesteuer.setImmediate(true); tfGewerbesteuer.addStyleName("scenario"); tfGewerbesteuer.addListener(changeListener); gl.addComponent(textGewerbesteuer, 0, 3); gl.addComponent(tfGewerbesteuer, 1, 3); scenarioComponents.put("businessTax", tfGewerbesteuer); //Krperschaftssteuer final Label textKoerperschaftssteuer = new Label("Krperschaftssteuer mit Solidarittszuschlag: "); final TextField tfKoerperschaftssteuer = new TextField(); if (!"0.0".equals(corporateAndSolitaryTax)) { tfKoerperschaftssteuer.setValue(corporateAndSolitaryTax); } tfKoerperschaftssteuer.setImmediate(true); tfKoerperschaftssteuer.addStyleName("scenario"); tfKoerperschaftssteuer.addListener(changeListener); gl.addComponent(textKoerperschaftssteuer, 0, 4); gl.addComponent(tfKoerperschaftssteuer, 1, 4); scenarioComponents.put("corporateAndSolitaryTax", tfKoerperschaftssteuer); // Persnlicher Steuersatz final Label textPersonalTaxRate = new Label("pers\u00F6nlicher Steuersatz: "); final TextField tfPersonalTaxRate = new TextField(); if (!"0.0".equals(personalTaxRate)) { tfPersonalTaxRate.setValue(personalTaxRate); } tfPersonalTaxRate.setImmediate(true); tfPersonalTaxRate.addStyleName("scenario"); tfPersonalTaxRate.addListener(changeListener); gl.addComponent(textPersonalTaxRate, 0, 5); gl.addComponent(tfPersonalTaxRate, 1, 5); scenarioComponents.put("personalTaxRate", tfPersonalTaxRate); deleteIcon = new Embedded(null, new ThemeResource("./images/icons/newIcons/1418766003_editor_trash_delete_recycle_bin_-128.png")); deleteIcon.setHeight(60, UNITS_PIXELS); deleteIcon.addStyleName("deleteScenario"); deleteIcon.addListener(new ClickListener() { private static final long serialVersionUID = 1L; @Override public void click(ClickEvent event) { presenter.removeScenario(number); } }); gl.addComponent(deleteIcon, 2, 0, 2, 6); gl.setComponentAlignment(deleteIcon, Alignment.MIDDLE_CENTER); final Label gap = new Label(); gap.setHeight(20, UNITS_PIXELS); gl.addComponent(gap, 0, 6); scenarioComponents.put("scenario", gl); this.scenarios.add(scenarioComponents); this.vlScenarios.addComponent(gl); //Button bei 3 Scenarios deaktivieren if (number == 3) { deactivateAddScenario(); } }
From source file:edu.nps.moves.mmowgli.AbstractMmowgliControllerHelper.java
License:Open Source License
void handleShowActiveUsersPerServer(MenuBar mbar) { Object[][] oa = Mmowgli2UI.getGlobals().getSessionCountByServer(); Window svrCountWin = new Window("Display Active Users Per Server"); svrCountWin.setModal(true);//from w ww.j a v a 2 s . co m VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); layout.setSpacing(true); layout.setWidth("99%"); svrCountWin.setContent(layout); GridLayout gl = new GridLayout(2, Math.max(1, oa.length)); gl.setSpacing(true); gl.addStyleName("m-greyborder"); for (Object[] row : oa) { Label lab = new Label(); lab.setSizeUndefined(); lab.setValue(row[0].toString()); gl.addComponent(lab); gl.setComponentAlignment(lab, Alignment.MIDDLE_RIGHT); gl.addComponent(new Label(row[1].toString())); } layout.addComponent(gl); layout.setComponentAlignment(gl, Alignment.MIDDLE_CENTER); svrCountWin.setWidth("250px"); UI.getCurrent().addWindow(svrCountWin); svrCountWin.center(); }
From source file:edu.nps.moves.mmowgli.export.BaseExporter.java
License:Open Source License
protected void getMetaStringOrCancel(final MetaListener lis, String title, final Map<String, String> params) { final Window dialog = new Window(title); final TextField[] parameterFields; dialog.setModal(true);/*ww w . j a v a2 s . c o m*/ VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); layout.setSpacing(true); layout.setSizeFull(); dialog.setContent(layout); final TextArea ta = new TextArea(); ta.setWidth("100%"); ta.setInputPrompt("Type a description of this data, or the game which generated this data (optional)"); ta.setImmediate(true); layout.addComponent(ta); Set<String> keySet = params.keySet(); parameterFields = new TextField[keySet.size()]; int i = 0; GridLayout pGL = new GridLayout(); pGL.addStyleName("m-greyborder"); pGL.setColumns(2); Label hdr = new HtmlLabel("<b>Parameters</b>"); hdr.addStyleName("m-textaligncenter"); pGL.addComponent(hdr, 0, 0, 1, 0); // top row pGL.setComponentAlignment(hdr, Alignment.MIDDLE_CENTER); pGL.setSpacing(false); for (String key : keySet) { pGL.addComponent(new HtmlLabel(" " + key + " ")); pGL.addComponent(parameterFields[i] = new TextField()); parameterFields[i++].setValue(params.get(key)); } if (i > 0) { layout.addComponent(pGL); layout.setComponentAlignment(pGL, Alignment.TOP_CENTER); } HorizontalLayout hl = new HorizontalLayout(); hl.setSpacing(true); @SuppressWarnings("serial") Button cancelButt = new Button("Cancel", new Button.ClickListener() { public void buttonClick(ClickEvent event) { dialog.close(); lis.continueOrCancel(null); } }); @SuppressWarnings("serial") Button exportButt = new Button("Export", new Button.ClickListener() { public void buttonClick(ClickEvent event) { dialog.close(); Set<String> keySet = params.keySet(); int i = 0; for (String key : keySet) params.put(key, parameterFields[i++].getValue().toString()); lis.continueOrCancel(ta.getValue().toString()); } }); hl.addComponent(cancelButt); hl.addComponent(exportButt); hl.setComponentAlignment(cancelButt, Alignment.MIDDLE_RIGHT); hl.setExpandRatio(cancelButt, 1.0f); // The components added to the window are actually added to the window's // layout; you can use either. Alignments are set using the layout layout.addComponent(hl); dialog.setWidth("385px"); dialog.setHeight("310px"); hl.setWidth("100%"); ta.setWidth("100%"); ta.setHeight("100%"); layout.setExpandRatio(ta, 1.0f); UI.getCurrent().addWindow(dialog); }
From source file:edu.nps.moves.mmowgli.modules.userprofile.UserProfileMyIdeasPanel2.java
License:Open Source License
@SuppressWarnings("unchecked") private Component createProfileTL() { VerticalLayout lay = new VerticalLayout(); lay.setWidth("670px"); Label lab;/*from ww w. ja v a 2 s . co m*/ lay.addComponent(lab = new Label()); lab.setHeight("10px"); VerticalLayout innerVL = new VerticalLayout(); innerVL.setSpacing(true); innerVL.setMargin(true); innerVL.setWidth("100%"); //"90%"); innerVL.addStyleName("m-myideaprofile-table"); lay.addComponent(innerVL); GridLayout gridL = new GridLayout(); gridL.setColumns(2); gridL.addStyleName("m-userprofile-text"); gridL.setSpacing(true); CardType ct; int count = 0; int largest = -1; List<Card> lisPos = commonCriteria() .add(Restrictions.eq("cardType", ct = CardType .getCurrentPositiveIdeaCardTypeTL()/*CardTypeManager.getPositiveIdeaCardTypeTL()*/)) .list(); count += lisPos.size(); largest = Math.max(largest, lisPos.size()); List<Card> lisNeg = commonCriteria() .add(Restrictions.eq("cardType", ct = CardType.getCurrentNegativeIdeaCardTypeTL())).list(); //CardTypeManager.getNegativeIdeaCardTypeTL())).list(); count += lisNeg.size(); largest = Math.max(largest, lisNeg.size()); List<Card> lisExpand = commonCriteria().add(Restrictions.eq("cardType", ct = CardType.getExpandTypeTL())) .list();//CardTypeManager.getExpandTypeTL())).list(); count += lisExpand.size(); largest = Math.max(largest, lisExpand.size()); List<Card> lisAdapt = commonCriteria().add(Restrictions.eq("cardType", ct = CardType.getAdaptTypeTL())) .list();//CardTypeManager.getAdaptTypeTL())).list(); count += lisAdapt.size(); largest = Math.max(largest, lisAdapt.size()); List<Card> lisCounter = commonCriteria().add(Restrictions.eq("cardType", ct = CardType.getCounterTypeTL())) .list();//CardTypeManager.getCounterTypeTL())).list(); count += lisCounter.size(); largest = Math.max(largest, lisCounter.size()); List<Card> lisExplore = commonCriteria().add(Restrictions.eq("cardType", ct = CardType.getExploreTypeTL())) .list();//CardTypeManager.getExploreTypeTL())).list(); count += lisExplore.size(); largest = Math.max(largest, lisExplore.size()); ct = CardType.getCurrentPositiveIdeaCardTypeTL(); //CardTypeManager.getPositiveIdeaCardTypeTL(); row(ct.getSummaryHeader(), largest, lisPos.size(), ct, gridL); ct = CardType.getCurrentNegativeIdeaCardTypeTL(); //CardTypeManager.getNegativeIdeaCardTypeTL(); row(ct.getSummaryHeader(), largest, lisNeg.size(), ct, gridL); ct = CardType.getExpandTypeTL(); //CardTypeManager.getExpandTypeTL(); row(ct.getSummaryHeader(), largest, lisExpand.size(), ct, gridL); ct = CardType.getAdaptTypeTL(); //CardTypeManager.getAdaptTypeTL(); row(ct.getSummaryHeader(), largest, lisAdapt.size(), ct, gridL); ct = CardType.getCounterTypeTL(); //CardTypeManager.getCounterTypeTL(); row(ct.getSummaryHeader(), largest, lisCounter.size(), ct, gridL); ct = CardType.getExploreTypeTL(); //CardTypeManager.getExploreTypeTL(); row(ct.getSummaryHeader(), largest, lisExplore.size(), ct, gridL); gridL.addComponent(new Label("")); gridL.addComponent(new Label("")); gridL.addComponent(new Label("TOTAL")); gridL.addComponent(new Label("" + count)); innerVL.addComponent(gridL); lay.addComponent(lab = new Label()); lab.setHeight("1px"); lay.setExpandRatio(lab, 1.0f); return lay; }