List of usage examples for com.vaadin.ui VerticalLayout setSpacing
@Override public void setSpacing(boolean spacing)
From source file:com.lizardtech.expresszip.vaadin.YesNoDialog.java
License:Apache License
public YesNoDialog(String caption, String question, Callback callback) { super(caption); setModal(true);/*from w w w. j av a 2 s.com*/ setWidth("350px"); setHeight("150px"); setClosable(false); setResizable(false); this.callback = callback; VerticalLayout layout = new VerticalLayout(); layout.setSizeFull(); layout.setSpacing(true); layout.setMargin(true); if (question != null) { layout.addComponent(new Label(question)); } yes = new ExpressZipButton("Yes", ExpressZipButton.Style.ACTION, this); no = new ExpressZipButton("No", ExpressZipButton.Style.ACTION, this); HorizontalLayout hl = new HorizontalLayout(); hl.setSpacing(true); hl.addComponent(yes); hl.addComponent(no); layout.addComponent(hl); layout.setComponentAlignment(hl, Alignment.BOTTOM_RIGHT); setContent(layout); }
From source file:com.logicbomb.newschool.pages.masterpages.PrimaryMasterPage.java
public PrimaryMasterPage() { //ContextWidget c= new ContextWidget(); HorizontalLayout iHorizontalLayout = new HorizontalLayout(); //addComponent(iHorizontalLayout,"top:0px;left:0px"); iHorizontalLayout.setWidth(String.valueOf(Page.getCurrent().getBrowserWindowWidth())); iHorizontalLayout.setHeight(String.valueOf(Page.getCurrent().getBrowserWindowHeight())); iHorizontalLayout.setStyleName("backColorBlack"); //String[] captions1 = {"Logo Here", "My Cool School", "Third"}; //Layout A and its sub components Panel AP = new Panel(); iHorizontalLayout.addComponent(AP);//w w w . j a va2s. c o m AP.setSizeFull(); AP.setStyleName("backColorBlack"); VerticalLayout A1 = new VerticalLayout(); AP.setContent(A1); //A.setSizeFull(); A1.setSpacing(true); iHorizontalLayout.setExpandRatio(AP, 1); A1.setStyleName("backColorBlack"); A1.setMargin(new MarginInfo(true, true, true, true)); Button logoImage = new Button(); logoImage.setIcon(FontAwesome.PICTURE_O); logoImage.setWidth("80px"); logoImage.setHeight(logoImage.getWidth(), Unit.PIXELS); //logoImage.setWidth("100px"); A1.addComponent(logoImage); A1.setComponentAlignment(logoImage, Alignment.TOP_CENTER); Label schoolName = new Label("The School Of Future"); schoolName.setStyleName("v-label-big"); A1.addComponent(schoolName); //A.setComponentAlignment(schoolName,Alignment.TOP_CENTER); Label schoolMinorName = new Label("Random Branch"); schoolMinorName.setStyleName("v-label-small"); A1.addComponent(schoolMinorName); VerticalLayout A2 = new VerticalLayout(); A1.addComponent(A2); MainMenuWidget iMainMenuWidget = new MainMenuWidget(); A2.addComponent(iMainMenuWidget); //A.setComponentAlignment(schoolName,Alignment.TOP_CENTER); //Layout B ContextWidgetTop c = new ContextWidgetTop(); c = ContextWidgetTop.ContextWidgetTransformer(c, new UserDetailsWidget(), SliderMode.TOP, SliderPanelStyles.COLOR_RED); VerticalLayout B = new VerticalLayout(); B.setSizeFull(); //B.setSpacing(true); iHorizontalLayout.addComponent(c); c.addComponent(B); iHorizontalLayout.setExpandRatio(c, 7); //Layout B1 and its sub Components HorizontalLayout B1 = new HorizontalLayout(); B.addComponent(B1); //B.setExpandRatio(B1, 1); //B1.setHeight("70px"); B1.setSizeFull(); //B1=ContextWidget.ContextWidgetTransformer(B1, new SliderMasterPage(),SliderMode.RIGHT,SliderPanelStyles.COLOR_RED); HorizontalLayout B11 = new HorizontalLayout(); B1.addComponent(B11); B1.setStyleName("backColorBlack"); B11.setSizeFull(); B1.setHeight("45px"); //B1.setStyleName("backColorWhite"); //B1.setMargin(new MarginInfo(false, true, false, true)); TextField iTextField = new TextField(); iTextField.setWidth("200px"); iTextField.setInputPrompt("Search!"); iTextField.setStyleName("v-text-type-search"); iTextField.focus(); B11.addComponent(iTextField); B11.setComponentAlignment(iTextField, Alignment.MIDDLE_LEFT); //Layout B2 and its Sub Components ContextWidget B2 = new ContextWidget(); B2.setSizeFull(); B.addComponent(B2); B.setExpandRatio(B2, 10); B2 = ContextWidget.ContextWidgetTransformer(B2, new SliderMasterPage(), SliderMode.RIGHT, SliderPanelStyles.COLOR_BLUE); //B2=ContextWidget.ContextWidgetTransformer(B2, new SliderMasterPage(),SliderMode.TOP,SliderPanelStyles.COLOR_RED); VerticalLayout v = new VerticalLayout(); B2.addComponent(v); Button b1111 = new Button( "Put all the inner components like this Put all the inner components like this Put all the inner components like this Put all the inner components like this"); v.addComponent(b1111); Button b1112 = new Button("Put all the inner components like this"); v.addComponent(b1112); /* Panel p = new Panel(); VerticalLayout v= new VerticalLayout(); v.addComponent(new TextField("Name")); v.addComponent(new TextField("Street address")); v.addComponent(new TextField("Postal code")); p.setContent(v); B2.addComponent(p); v.setWidth(String.valueOf(B2.getWidth()*10)+"px"); //v.setSizeFull();// <- This will cause issues. Don't do this p.setSizeFull(); */ //ContextWidget iContextPanel= new ContextWidget(p); //B2.addComponent(iContextPanel); //setPosition(p, iComponentPositionPanel); addComponent(iHorizontalLayout); }
From source file:com.logviewer.ui.dialog.FilterLog.java
License:Open Source License
private com.vaadin.ui.Component buildContetDialog() { final TextField txtFilter = new TextField() { {/*from w w w .j a va2 s . c o m*/ setWidth(100, Unit.PERCENTAGE); } }; table = new Table(""); table.addStyleName("small compact"); table.setSizeFull(); table.setImmediate(true); table.setSelectable(true); table.setEditable(false); table.addContainerProperty("Filter", String.class, null); loadTable(); VerticalLayout panelContent = new VerticalLayout(); panelContent.setSpacing(true); panelContent.setMargin(true); panelContent.setSizeFull(); panelContent.setId("panel-content"); panelContent.addComponent(new HorizontalLayout() { { addComponent(txtFilter); addComponent(new Button("Add", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent clickEvent) { filters.add(txtFilter.getValue()); loadTable(); } })); setExpandRatio(txtFilter, 1f); setWidth(100, Unit.PERCENTAGE); } }); panelContent.addComponent(table); panelContent.setExpandRatio(table, 1.0f); return panelContent; }
From source file:com.lst.deploymentautomation.vaadin.page.SettingsView.java
License:Open Source License
private void createView() { LspsUI ui = (LspsUI) getUI();//from w w w. j a va2s . c om Person user = ui.getUser().getPerson(); userRights = user.getRights(); setTitle(ui.getMessage(TITLE)); Panel panel = new Panel(); panel.addStyleName("l-border-none"); setContent(panel); VerticalLayout layout = new VerticalLayout(); layout.setSpacing(true); layout.setMargin(true); panel.setContent(layout); //user data and settings will be laid out next to each other HorizontalLayout topSection = new HorizontalLayout(); topSection.setSpacing(true); topSection.setWidth("100%"); layout.addComponent(topSection); VerticalLayout userData = createUserDataSection(ui, user); topSection.addComponent(userData); topSection.setExpandRatio(userData, 1); Label spacer = new Label(); spacer.setWidth("20px"); topSection.addComponent(spacer); VerticalLayout settings = createSettingsSection(ui); topSection.addComponent(settings); topSection.setExpandRatio(settings, 1); //substitution section VerticalLayout substitution = createSubstitutionSection(ui, user); layout.addComponent(substitution); Label spacer2 = new Label(); spacer2.setHeight("10px"); layout.addComponent(spacer2); //buttons HorizontalLayout buttons = new HorizontalLayout(); buttons.setSpacing(true); Button saveButton = new Button(ui.getMessage("action.save"), new ClickListener() { @Override public void buttonClick(ClickEvent event) { if (save()) { if (requestReload) { JavaScript.getCurrent().execute("window.location.reload()"); } else { close(); } } } }); saveButton.setData(BUTTON_TYPE_SAVE); buttons.addComponent(saveButton); Button cancelButton = new Button(ui.getMessage("action.cancel"), new ClickListener() { @Override public void buttonClick(ClickEvent event) { close(); } }); buttons.addComponent(cancelButton); layout.addComponent(buttons); }
From source file:com.lst.deploymentautomation.vaadin.page.SettingsView.java
License:Open Source License
private VerticalLayout createSettingsSection(LspsUI ui) { VerticalLayout settings = new VerticalLayout(); settings.setSpacing(true); Label settingsHeader = new Label("<h2>" + ui.getMessage("settings.applicationSection") + "</h2>", ContentMode.HTML);//from w ww.ja v a2s .co m settings.addComponent(settingsHeader); this.languages = new OptionGroup(ui.getMessage("settings.language")); languages.addStyleName("ui-spacing"); languages.addItem("en_US"); languages.setItemCaption("en_US", "English"); languages.addItem("de_DE"); languages.setItemCaption("de_DE", "Deutsch"); languages.addItem("sk_SK"); languages.setItemCaption("sk_SK", "Slovensky"); languages.setValue(ui.getLocale().toString()); settings.addComponent(languages); this.themes = new OptionGroup(ui.getMessage("settings.theme")); themes.addStyleName("ui-spacing"); for (String s : Constants.THEMES) { themes.addItem(s); } String userTheme = ui.getUser().getSettingString("theme", Constants.DEFAULT_THEME); themes.setValue(userTheme); themes.addValueChangeListener(new ValueChangeListener() { private static final long serialVersionUID = 1L; @Override public void valueChange(ValueChangeEvent event) { if (Constants.CUSTOMISABLE_THEMES.contains(themes.getValue().toString())) { layoutSettings.setVisible(true); fontSettings.setVisible(true); } else { layoutSettings.setVisible(false); fontSettings.setVisible(false); } } }); settings.addComponent(themes); layoutSettings = new OptionGroup(ui.getMessage("settings.layout")); layoutSettings.addStyleName("ui-spacing"); layoutSettings.addItem("compact"); layoutSettings.setItemCaption("compact", ui.getMessage("settings.layout.compact")); layoutSettings.addItem("standard"); layoutSettings.setItemCaption("standard", ui.getMessage("settings.layout.standard")); layoutSettings.addItem("generous"); layoutSettings.setItemCaption("generous", ui.getMessage("settings.layout.generous")); layoutSettings.setValue(ui.getUser().getSettingString("layoutSetting", "compact")); settings.addComponent(layoutSettings); fontSettings = new OptionGroup(ui.getMessage("settings.font")); fontSettings.addStyleName("ui-spacing"); fontSettings.addItem("small"); fontSettings.setItemCaption("small", ui.getMessage("settings.font.small")); fontSettings.addItem("standard"); fontSettings.setItemCaption("standard", ui.getMessage("settings.font.standard")); fontSettings.addItem("large"); fontSettings.setItemCaption("large", ui.getMessage("settings.font.large")); fontSettings.addItem("huge"); fontSettings.setItemCaption("huge", ui.getMessage("settings.font.huge")); fontSettings.setValue(ui.getUser().getSettingString("fontSetting", "standard")); settings.addComponent(fontSettings); if (!Constants.CUSTOMISABLE_THEMES.contains(userTheme)) { layoutSettings.setVisible(false); fontSettings.setVisible(false); } return settings; }
From source file:com.lst.deploymentautomation.vaadin.page.SettingsView.java
License:Open Source License
private VerticalLayout createSubstitutionSection(LspsUI ui, Person user) { VerticalLayout substitution = new VerticalLayout(); substitution.setSpacing(true); Label substitutionHeader = new Label("<h2>" + ui.getMessage("settings.substitutionSection") + "</h2>", ContentMode.HTML);//from www .ja v a 2s . c om substitution.addComponent(substitutionHeader); Label substitutionHelp = new Label(ui.getMessage("settings.substitutionHelp")); substitutionHelp.setStyleName("form-help"); substitution.addComponent(substitutionHelp); this.substitutionActive = new CheckBox(ui.getMessage("settings.substitutionActive")); substitutionActive.addStyleName("ui-spacing"); substitutionActive.setValue(user.isSubstitutionActive()); substitution.addComponent(substitutionActive); //substitutes Set<Person> selectedPersons = user.getDirectSubstitutes(); //all persons except the user himself Collection<Person> persons = new ArrayList<Person>( personService.findPersons(new PersonCriteria()).getData()); this.substitutes = new OptionGroup(ui.getMessage("settings.substitutes")); substitutes.setMultiSelect(true); substitutes.addStyleName("ui-spacing"); for (Person substitute : persons) { if (!substitute.equals(user)) { substitutes.addItem(substitute); substitutes.setItemCaption(substitute, substitute.getFullName()); } } substitutes.setValue(selectedPersons); substitution.addComponent(substitutes); return substitution; }
From source file:com.lst.deploymentautomation.vaadin.page.TodoListView.java
License:Open Source License
@SuppressWarnings("serial") private void createView() { final LspsUI ui = (LspsUI) getUI(); setTitle(ui.getMessage(TITLE));//from w w w. ja v a2s .c o m VerticalLayout layout = new VerticalLayout(); setContent(layout); table = new Table(); table.setSizeFull(); table.setSelectable(true); table.setMultiSelectMode(MultiSelectMode.SIMPLE); table.setSortEnabled(false); table.setColumnReorderingAllowed(true); table.setColumnCollapsingAllowed(true); table.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { final Object sel = event.getProperty().getValue(); if (sel instanceof Set) { selection = (Set<Long>) sel; } else if (sel instanceof Long) { selection = Collections.singleton((Long) sel); } else { selection = Collections.emptySet(); } //enable todo actions only if the sel is non-empty actionBtn.setEnabled(selection.size() > 0); } }); table.addItemClickListener(new ItemClickListener() { @Override public void itemClick(ItemClickEvent event) { if (table.isMultiSelect()) { return; //don't do anything if in selection mode } if (event.getButton() != MouseButton.LEFT || event.isDoubleClick()) { return; //ignore right-clicks } final Item item = event.getItem(); final Long todoId = (Long) item.getItemProperty("id").getValue(); try { ((LspsUI) getUI()).openTodo(todoId); } catch (Exception e) { Utils.log(e, "could not open to-do " + todoId, log); final LspsUI ui = (LspsUI) getUI(); ui.showErrorMessage("app.unknownErrorOccurred", e); //todo.openFailed? } } }); table.setContainerDataSource(container); Object[] defaultColumns = new Object[] { "title", "notes", "priority", "authorization", "modelInstanceId", "issuedDate" }; //load table settings String settings = ui.getUser().getSettingString(SETTINGS_KEY, null); if (settings == null) { table.setVisibleColumns(defaultColumns); originalSettings = getColumnSettings(); } else { originalSettings = settings; try { applyTableSettings(settings); } catch (Exception e) { table.setVisibleColumns(defaultColumns); Utils.log(e, "could not load todo list settings", log); } } table.setColumnHeader("title", ui.getMessage("todo.title")); table.setColumnHeader("notes", ui.getMessage("todo.notes")); table.setColumnHeader("priority", ui.getMessage("todo.priority")); table.setColumnHeader("authorization", ui.getMessage("todo.authorizationShort")); table.setColumnHeader("modelInstanceId", ui.getMessage("todo.process")); table.setColumnHeader("issuedDate", ui.getMessage("todo.issued")); table.setColumnAlignment("modelInstanceId", Table.Align.CENTER); table.setColumnExpandRatio("title", 2); table.setColumnExpandRatio("notes", 1); //localize todo titles table.addGeneratedColumn("title", new ColumnGenerator() { @Override public Object generateCell(Table source, Object itemId, Object columnId) { @SuppressWarnings("unchecked") BeanItem<Todo> item = (BeanItem<Todo>) source.getItem(itemId); return ui.localizeEngineText(item.getBean().getTitle()); } }); //show icons for authorization table.addGeneratedColumn("authorization", new ColumnGenerator() { @Override public Object generateCell(Table source, Object itemId, Object columnId) { @SuppressWarnings("unchecked") BeanItem<Todo> item = (BeanItem<Todo>) source.getItem(itemId); String icon; String text; switch (item.getBean().getAuthorization()) { case INITIAL_PERFORMER: icon = "auth_performer.gif"; text = ui.getMessage("todo.authorizationPerformer"); break; case DELEGATE: icon = "auth_delegate.gif"; text = ui.getMessage("todo.authorizationDelegate"); break; case SUBSTITUTE: icon = "auth_substitute.gif"; text = ui.getMessage("todo.authorizationSubstitute"); break; case NOT_PERMITTED: default: icon = "auth_unknown.gif"; text = ui.getMessage("todo.authorizationUnknown"); break; } Embedded authIcon = new Embedded(null, new ThemeResource("../icons/" + icon)); authIcon.setDescription(text); if (item.getBean().getAllocatedTo() != null) { HorizontalLayout layout = new HorizontalLayout(); layout.setSpacing(true); layout.addComponent(authIcon); Embedded lockedIcon = new Embedded(null, new ThemeResource("../icons/lock.gif")); lockedIcon.setDescription( ui.getMessage("todo.lockedBy", item.getBean().getAllocatedToFullName())); layout.addComponent(lockedIcon); return layout; } else { return authIcon; } } }); //format date final SimpleDateFormat df = new SimpleDateFormat(ui.getMessage("app.dateTimeFormat")); table.addGeneratedColumn("issuedDate", new ColumnGenerator() { @Override public Object generateCell(Table source, Object itemId, Object columnId) { @SuppressWarnings("unchecked") BeanItem<Todo> item = (BeanItem<Todo>) source.getItem(itemId); return df.format(item.getBean().getIssuedDate()); } }); layout.addComponent(table); layout.setExpandRatio(table, 1); }
From source file:com.lst.deploymentautomation.vaadin.popup.TodoAnnotation.java
License:Open Source License
@Override public void attach() { super.attach(); LspsUI ui = (LspsUI) getUI();//from www. j a v a2 s.c o m setCaption(ui.getMessage("todo.annotationTitle")); VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); layout.setSpacing(true); layout.setSizeFull(); setContent(layout); Label help = new Label(ui.getMessage("todo.annotationHelp")); help.setStyleName("form-help"); layout.addComponent(help); priorityField = new TextField(ui.getMessage("todo.priority"), priority); //TODO forbid negative priorities priorityField.setConverter(Integer.class); priorityField.setConversionError(ui.getMessage("app.invalidValueMessage")); priorityField.setNullRepresentation(""); priorityField.setNullSettingAllowed(true); layout.addComponent(priorityField); TextArea notesField = new TextArea(ui.getMessage("todo.notes"), notes); notesField.setMaxLength(1024); notesField.setNullRepresentation(""); priorityField.setNullSettingAllowed(true); notesField.setSizeFull(); layout.addComponent(notesField); layout.setExpandRatio(notesField, 1); HorizontalLayout buttons = new HorizontalLayout(); buttons.setSpacing(true); layout.addComponent(buttons); @SuppressWarnings("serial") Button submitButton = new Button(ui.getMessage("action.annotate"), new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { annotate(); } }); buttons.addComponent(submitButton); @SuppressWarnings("serial") Button cancelButton = new Button(ui.getMessage("action.cancel"), new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { close(); } }); buttons.addComponent(cancelButton); }
From source file:com.lst.deploymentautomation.vaadin.popup.TodoDelegation.java
License:Open Source License
@Override public void attach() { super.attach(); LspsUI ui = (LspsUI) getUI();/* w w w . j a va 2 s.c o m*/ setCaption(ui.getMessage("todo.delegationTitle")); VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); layout.setSpacing(true); layout.setSizeFull(); setContent(layout); Label help = new Label(ui.getMessage("todo.delegationHelp")); help.setStyleName("form-help"); layout.addComponent(help); Collection<Person> allUsers = new ArrayList<Person>( personService.findPersons(new PersonCriteria()).getData()); Set<Person> substitutes = ui.getUser().getPerson().getDirectSubstitutes(); Set<String> substitutesIds = new HashSet<String>(); for (Person p : substitutes) { substitutesIds.add(p.getId()); } delegates = new OptionGroup(ui.getMessage("todo.delegates")); delegates.setMultiSelect(true); delegates.addStyleName("ui-spacing"); delegates.setRequired(true); delegates.setSizeFull(); for (Person p : allUsers) { delegates.addItem(p.getId()); delegates.setItemCaption(p.getId(), p.getFullName()); } delegates.setValue(substitutesIds); layout.addComponent(delegates); layout.setExpandRatio(delegates, 1); HorizontalLayout buttons = new HorizontalLayout(); buttons.setSpacing(true); layout.addComponent(buttons); @SuppressWarnings("serial") Button delegateButton = new Button(ui.getMessage("action.delegate"), new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { delegate(); } }); buttons.addComponent(delegateButton); @SuppressWarnings("serial") Button cancelButton = new Button(ui.getMessage("action.cancel"), new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { close(); } }); buttons.addComponent(cancelButton); }
From source file:com.lst.deploymentautomation.vaadin.popup.TodoEscalation.java
License:Open Source License
@Override public void attach() { super.attach(); LspsUI ui = (LspsUI) getUI();//from ww w. ja v a 2 s . c om setCaption(ui.getMessage("todo.escalationTitle")); VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); layout.setSpacing(true); layout.setSizeFull(); setContent(layout); Label help = new Label(ui.getMessage("todo.escalationHelp")); help.setStyleName("form-help"); layout.addComponent(help); reason = new TextArea(ui.getMessage("todo.escalationReason")); reason.setMaxLength(1024); reason.setRequired(true); reason.setSizeFull(); layout.addComponent(reason); layout.setExpandRatio(reason, 1); HorizontalLayout buttons = new HorizontalLayout(); buttons.setSpacing(true); layout.addComponent(buttons); @SuppressWarnings("serial") Button submitButton = new Button(ui.getMessage("action.escalate"), new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { escalate(); } }); buttons.addComponent(submitButton); @SuppressWarnings("serial") Button cancelButton = new Button(ui.getMessage("action.cancel"), new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { close(); } }); buttons.addComponent(cancelButton); }