List of usage examples for com.vaadin.ui VerticalLayout setMargin
@Override public void setMargin(boolean enabled)
From source file:com.lizardtech.expresszip.vaadin.FindLayersViewComponent.java
License:Apache License
public FindLayersViewComponent() { treeTable = new ExpressZipTreeTable(); popupTable = new ExpressZipTreeTable(); configureTable(treeTable);//from w w w.j ava2s. co m popupSelectionListener = new Property.ValueChangeListener() { private static final long serialVersionUID = 625365970493526725L; @Override public void valueChange(ValueChangeEvent event) { // the current popup selection Set<ExpressZipLayer> popupSelection = (Set<ExpressZipLayer>) event.getProperty().getValue(); // get the tree's current selection HashSet<ExpressZipLayer> treeSelection = new HashSet<ExpressZipLayer>( (Set<ExpressZipLayer>) treeTable.getValue()); // remove all items in common with popup treeSelection.removeAll(popupTable.getItemIds()); // set the treeTable selection to the union Set<ExpressZipLayer> unionSelection = new HashSet<ExpressZipLayer>(); unionSelection.addAll(popupSelection); unionSelection.addAll(treeSelection); treeTable.setValue(unionSelection); } }; popupTable.addListener(popupSelectionListener); treeTable.addListener(new Property.ValueChangeListener() { private static final long serialVersionUID = 6236114836521221107L; @Override public void valueChange(ValueChangeEvent event) { Set<ExpressZipLayer> highlightedLayers = (Set<ExpressZipLayer>) event.getProperty().getValue(); for (FindLayersViewListener listener : listeners) { listener.layerHighlightedEvent(highlightedLayers); } // reset selection of popup table popupTable.removeListener(popupSelectionListener); // intersection of treeTable's selection and popupTable items Set<ExpressZipLayer> popupSelection = new HashSet<ExpressZipLayer>(); popupSelection.addAll(highlightedLayers); popupSelection.retainAll(popupTable.getItemIds()); popupTable.setValue(popupSelection); popupTable.addListener(popupSelectionListener); } }); configureTable(popupTable); filter = new Filter(this); filterButtonListener = new FilterListeners(); axisSelectedListener = new AxisSelected(); listeners = new ArrayList<FindLayersViewListener>(); btnNext = new ExpressZipButton("Next", Style.STEP); btnBack = new ExpressZipButton("Back", Style.STEP); btnAddFilter = new ExpressZipButton("Add Filter", Style.ACTION); btnAddFilter.addStyleName("filter-flow"); hshFilterButtons = new HashMap<Button, FilterObject>(); cssLayers = new CssLayout(); basemapSelector = new ComboBox(); basemapSelector.setWidth(100.0f, UNITS_PERCENTAGE); basemapSelector.setTextInputAllowed(false); basemapSelector.setImmediate(true); basemapSelector.setNullSelectionAllowed(false); basemapSelector.addListener(new Property.ValueChangeListener() { private static final long serialVersionUID = -7358667131762099215L; @Override public void valueChange(ValueChangeEvent event) { ProjectedLayer l = (ProjectedLayer) basemapSelector.getValue(); boolean enableCheckbox = false; if (l instanceof WebMapServiceLayer) { for (ExpressZipLayer local : mapModel.getLocalBaseLayers()) { if (l.toString().equals(local.getName())) { enableCheckbox = true; break; } } } includeBasemap.setEnabled(enableCheckbox); if (!enableCheckbox) { includeBasemap.setValue(false); } if (mapModel.getBaseLayerTerms(l) != null && !mapModel.getBaseLayerTermsAccepted(l)) { final Window modal = new Window("Terms of Use"); modal.setModal(true); modal.setClosable(false); modal.setResizable(false); modal.getContent().setSizeUndefined(); // trick to size around content Button bOK = new ExpressZipButton("OK", Style.ACTION, new ClickListener() { private static final long serialVersionUID = -2872178665349848542L; @Override public void buttonClick(ClickEvent event) { ProjectedLayer l = (ProjectedLayer) basemapSelector.getValue(); mapModel.setBaseLayerTermsAccepted(l); for (FindLayersViewListener listener : listeners) listener.baseMapChanged(l); ((ExpressZipWindow) getApplication().getMainWindow()).removeWindow(modal); } }); Button bCancel = new ExpressZipButton("Cancel", Style.ACTION, new ClickListener() { private static final long serialVersionUID = -3044064554876422836L; @Override public void buttonClick(ClickEvent event) { basemapSelector.select(mapModel.getBaseLayers().get(0)); ((ExpressZipWindow) getApplication().getMainWindow()).removeWindow(modal); } }); HorizontalLayout buttons = new HorizontalLayout(); buttons.setSpacing(true); buttons.addComponent(bOK); buttons.addComponent(bCancel); Label termsText = new Label(mapModel.getBaseLayerTerms(l)); termsText.setContentMode(Label.CONTENT_XHTML); VerticalLayout vlay = new VerticalLayout(); vlay.addComponent(termsText); vlay.addComponent(buttons); vlay.setComponentAlignment(buttons, Alignment.MIDDLE_RIGHT); vlay.setWidth(400, UNITS_PIXELS); modal.getContent().addComponent(vlay); ((ExpressZipWindow) getApplication().getMainWindow()).addWindow(modal); } else { for (FindLayersViewListener listener : listeners) listener.baseMapChanged(l); } } }); includeBasemap = new CheckBox(); includeBasemap.setDescription("Include this basemap in the exported image."); includeBasemap.setWidth(64f, UNITS_PIXELS); HorizontalLayout basemapLayout = new HorizontalLayout(); basemapLayout.setWidth(100f, UNITS_PERCENTAGE); VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); layout.setSizeFull(); setSizeFull(); Label step = new Label("Step 1: Select Layers"); step.addStyleName("step"); layout.addComponent(step); layout.addComponent(treeTable); layout.setSpacing(true); treeTable.setSizeFull(); layout.setExpandRatio(treeTable, 1f); layout.addComponent(new Panel(BASEMAP, basemapLayout)); basemapLayout.addComponent(basemapSelector); basemapLayout.setExpandRatio(basemapSelector, 1f); basemapLayout.addComponent(includeBasemap); layout.addComponent(cssLayers); cssLayers.addComponent(btnAddFilter); HorizontalLayout backSubmitLayout = new HorizontalLayout(); backSubmitLayout.setWidth("100%"); backSubmitLayout.addComponent(btnBack); backSubmitLayout.addComponent(btnNext); backSubmitLayout.setComponentAlignment(btnBack, Alignment.BOTTOM_LEFT); backSubmitLayout.setComponentAlignment(btnNext, Alignment.BOTTOM_RIGHT); VerticalLayout navLayout = new VerticalLayout(); navLayout.addComponent(backSubmitLayout); navLayout.setSpacing(true); ThemeResource banner = new ThemeResource("img/ProgressBar1.png"); navLayout.addComponent(new Embedded(null, banner)); layout.addComponent(navLayout); layout.setComponentAlignment(navLayout, Alignment.BOTTOM_CENTER); btnNext.addListener(this); btnNext.setEnabled(false); btnBack.setEnabled(false); // always disabled btnAddFilter.addListener(this); layout.addStyleName("findlayers"); setCompositionRoot(layout); }
From source file:com.lizardtech.expresszip.vaadin.JobsStatusViewComponent.java
License:Apache License
public JobsStatusViewComponent(URL appUrl) { VerticalLayout mainLayout = new VerticalLayout(); mainLayout.setSpacing(true);/*from w w w. j a va 2 s.co m*/ mainLayout.setMargin(true); mainLayout.setWidth("100%"); // Refresher will update UI as progress is made final Refresher refresher = new Refresher(); refresher.setRefreshInterval(UPDATE_STATUS_INTERVAL); refresher.addListener(this); mainLayout.addComponent(refresher); mainLayout.addComponent(buildTableControls()); form = new Form(); form.setCaption("Selected Job"); form.setWidth("420px"); form.setFormFieldFactory(new ExpressZipFieldFactory()); form.setVisible(true); form.setImmediate(true); table = new Table(null); table.addStyleName("expresszip"); table.setWidth("100%"); table.setSelectable(true); table.setImmediate(true); table.setNullSelectionAllowed(false); table.setPageLength(0); table.setHeight("250px"); container = new BeanItemContainer<Job>(Job.class, Job.getJobQueue()); container.addNestedContainerProperty("exportProps.jobName"); container.addNestedContainerProperty("exportProps.userNotation"); table.setContainerDataSource(container); table.setVisibleColumns(new String[] { "exportProps.jobName", "exportProps.userNotation", "status" }); table.setColumnHeaders(new String[] { "Job Name", "User Name", "Status" }); table.sort(new Object[] { "exportProps.jobName", "exportProps.userNotation" }, new boolean[] { true, true }); table.setColumnExpandRatio("status", 0.8f); // use green bar to highlight selected row ExpressZipTreeTable.enableFirstColumnHighlighter(table); updateTableData(); mainLayout.addComponent(table); mainLayout.setExpandRatio(table, 1.0f); mainLayout.addComponent(form); Link browseExports = new Link("Browse Archived Jobs", new ExternalResource(appUrl.getProtocol() + "://" + appUrl.getAuthority() + "/exportdir/")); // Open the URL in a new window/tab browseExports.setTargetName("_blank"); mainLayout.addComponent(browseExports); // setContent(mainLayout); setCompositionRoot(mainLayout); }
From source file:com.lizardtech.expresszip.vaadin.SetupMapViewComponent.java
License:Apache License
public SetupMapViewComponent() { listeners = new ArrayList<SetupMapViewListener>(); cmbProjection = new ComboBox(); cmbProjection.setTextInputAllowed(false); HorizontalLayout projectionLayout = new HorizontalLayout(); projectionLayout.addComponent(cmbProjection); projectionLayout.setWidth(100f, UNITS_PERCENTAGE); setSizeFull();/*from w w w .j a v a 2 s .c om*/ // main layout VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); layout.setSizeFull(); // instruction banner Label step = new Label("Step 2: Select Export Region"); step.addStyleName("step"); layout.addComponent(step); // // setup tree data source // treeHier = new HierarchicalContainer(); treeHier.addContainerProperty(ExpressZipTreeTable.LAYER, ExpressZipLayer.class, null); treeHier.addContainerProperty(DRAG_PROPERTY, Embedded.class, null); // table holding layers treeTable = new ExpressZipTreeTable(); treeTable.setContainerDataSource(treeHier); treeTable.setDragMode(TableDragMode.ROW); treeTable.setColumnHeaders(new String[] { ExpressZipTreeTable.LAYER, "" }); treeTable.setColumnExpandRatio(ExpressZipTreeTable.LAYER, 1); treeTable.setColumnWidth(DRAG_PROPERTY, 23); // upload shape file btnUploadShapeFile.setFieldType(FieldType.BYTE_ARRAY); btnUploadShapeFile.setButtonCaption(""); btnUploadShapeFile.setSizeUndefined(); btnUploadShapeFile.addStyleName("shapefile"); // remove shape file btnRemoveShapeFile.addListener(this); btnRemoveShapeFile.setSizeUndefined(); btnRemoveShapeFile.setVisible(false); btnRemoveShapeFile.setIcon(new ThemeResource("img/RemoveShapefileStandard23px.png")); btnRemoveShapeFile.setStyleName(BaseTheme.BUTTON_LINK); btnRemoveShapeFile.addStyleName("shapefile"); HorizontalLayout hznUpload = new HorizontalLayout(); Panel coordPanel = new Panel("Export Extent"); layout.addComponent(treeTable); layout.addComponent(new Panel(PROJECTION, projectionLayout)); layout.addComponent(new Panel(SHAPEFILE_UPLOAD, hznUpload)); layout.addComponent(coordPanel); layout.setSpacing(true); hznUpload.addComponent(btnUploadShapeFile); hznUpload.addComponent(btnRemoveShapeFile); hznUpload.addComponent(lblCurrentShapeFile); hznUpload.setExpandRatio(lblCurrentShapeFile, 1f); hznUpload.setComponentAlignment(lblCurrentShapeFile, Alignment.MIDDLE_LEFT); hznUpload.setWidth("100%"); cmbProjection.setWidth("100%"); topTextField.setWidth(150, UNITS_PIXELS); topTextField.setImmediate(true); topTextField.setRequired(true); topTextField.addListener(topListener); leftTextField.setWidth(150, UNITS_PIXELS); leftTextField.setImmediate(true); leftTextField.setRequired(true); leftTextField.addListener(leftListener); bottomTextField.setWidth(150, UNITS_PIXELS); bottomTextField.setImmediate(true); bottomTextField.setRequired(true); bottomTextField.addListener(bottomListener); rightTextField.setWidth(150, UNITS_PIXELS); rightTextField.setImmediate(true); rightTextField.setRequired(true); rightTextField.addListener(rightListener); VerticalLayout coordLayout = new VerticalLayout(); coordLayout.setSizeFull(); coordPanel.setContent(coordLayout); coordLayout.addComponent(topTextField); HorizontalLayout leftRightLayout = new HorizontalLayout(); leftRightLayout.setWidth("100%"); leftRightLayout.addComponent(leftTextField); leftRightLayout.addComponent(rightTextField); leftRightLayout.setComponentAlignment(leftTextField, Alignment.MIDDLE_LEFT); leftRightLayout.setComponentAlignment(rightTextField, Alignment.MIDDLE_RIGHT); coordLayout.addComponent(leftRightLayout); coordLayout.addComponent(bottomTextField); coordLayout.setComponentAlignment(topTextField, Alignment.TOP_CENTER); coordLayout.setComponentAlignment(bottomTextField, Alignment.BOTTOM_CENTER); btnNext = new ExpressZipButton("Next", Style.STEP, this); btnBack = new ExpressZipButton("Back", Style.STEP, this); HorizontalLayout backNextLayout = new HorizontalLayout(); backNextLayout.addComponent(btnBack); backNextLayout.addComponent(btnNext); btnNext.setEnabled(false); backNextLayout.setComponentAlignment(btnBack, Alignment.BOTTOM_LEFT); backNextLayout.setComponentAlignment(btnNext, Alignment.BOTTOM_RIGHT); backNextLayout.setWidth("100%"); VerticalLayout navLayout = new VerticalLayout(); navLayout.addComponent(backNextLayout); navLayout.setSpacing(true); ThemeResource banner = new ThemeResource("img/ProgressBar2.png"); navLayout.addComponent(new Embedded(null, banner)); layout.addComponent(navLayout); layout.setComponentAlignment(navLayout, Alignment.BOTTOM_CENTER); layout.setExpandRatio(treeTable, 1.0f); setCompositionRoot(layout); // notify when selection changes treeTable.addListener(new Property.ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { for (SetupMapViewListener listener : listeners) { listener.layersSelectedEvent((Set<ExpressZipLayer>) treeTable.getValue()); } } }); treeTable.addActionHandler(this); treeHier.removeAllItems(); // // drag n' drop behavior // treeTable.setDropHandler(new DropHandler() { public AcceptCriterion getAcceptCriterion() { return AcceptAll.get(); } // Make sure the drag source is the same tree public void drop(DragAndDropEvent event) { // Wrapper for the object that is dragged Transferable t = event.getTransferable(); // Make sure the drag source is the same tree if (t.getSourceComponent() != treeTable) return; AbstractSelectTargetDetails target = (AbstractSelectTargetDetails) event.getTargetDetails(); // Get ids of the dragged item and the target item Object sourceItemId = t.getData("itemId"); Object targetItemId = target.getItemIdOver(); // if we drop on ourselves, ignore if (sourceItemId == targetItemId) return; // On which side of the target the item was dropped VerticalDropLocation location = target.getDropLocation(); // place source after target treeHier.moveAfterSibling(sourceItemId, targetItemId); // if top, switch them if (location == VerticalDropLocation.TOP) { treeHier.moveAfterSibling(targetItemId, sourceItemId); } Collection<ExpressZipLayer> layers = (Collection<ExpressZipLayer>) treeHier.rootItemIds(); for (SetupMapViewListener listener : listeners) listener.layerMovedEvent(layers); } }); cmbProjection.setImmediate(true); cmbProjection.setNullSelectionAllowed(false); cmbProjection.addListener(new Property.ValueChangeListener() { private static final long serialVersionUID = -5188369735622627751L; @Override public void valueChange(ValueChangeEvent event) { if (cmbProjection.getValue() != null) { selectedEpsg = (String) cmbProjection.getValue(); String currentProjection = ((ExpressZipWindow) getApplication().getMainWindow()) .getExportProps().getMapProjection(); if (!selectedEpsg.equals(currentProjection)) for (SetupMapViewListener listener : new ArrayList<SetupMapViewListener>(listeners)) listener.projectionChangedEvent(selectedEpsg); } } }); }
From source file:com.lizardtech.expresszip.vaadin.YesNoDialog.java
License:Apache License
public YesNoDialog(String caption, String question, Callback callback) { super(caption); setModal(true);/* w w w.j av a2 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);//from ww w .j av a 2s . co 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 va 2 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 www . j av a 2 s . co m 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.popup.TodoAnnotation.java
License:Open Source License
@Override public void attach() { super.attach(); LspsUI ui = (LspsUI) getUI();/* w w w.ja va2s .co 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 ww . j av a2 s .co 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 www . j av a 2s .co m 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); }