List of usage examples for com.vaadin.ui HorizontalLayout setWidth
@Override public void setWidth(String width)
From source file:de.catma.ui.repository.RepositoryView.java
License:Open Source License
private Component createDocumentsLabel() { HorizontalLayout labelLayout = new HorizontalLayout(); labelLayout.setWidth("100%"); labelLayout.setSpacing(true);//from www . ja v a2s .c om Label documentsLabel = new Label("Document Manager"); documentsLabel.addStyleName("bold-label"); labelLayout.addComponent(documentsLabel); labelLayout.setExpandRatio(documentsLabel, 1.0f); btAdmin = new Button("Admin"); btAdmin.addStyleName("icon-button"); // for top-margin btAdmin.setVisible(repository.getUser().getRole().equals(Role.ADMIN)); labelLayout.addComponent(btAdmin); labelLayout.setComponentAlignment(btAdmin, Alignment.MIDDLE_RIGHT); btReload = new Button(""); btReload.setIcon(new ClassResource("ui/resources/icon-reload.gif", getApplication())); btReload.addStyleName("icon-button"); labelLayout.addComponent(btReload); labelLayout.setComponentAlignment(btReload, Alignment.MIDDLE_RIGHT); Label helpLabel = new Label(); helpLabel.setIcon(new ClassResource("ui/resources/icon-help.gif", getApplication())); helpLabel.setWidth("20px"); helpLabel.setDescription("<h3>Hints</h3>" + "<h4>First steps</h4>" + "<h5>Adding a Source Document</h5>" + "You can add a Source Document by clicking the \"Add Source Document\"-button. " + "A Source Document can be a web resource pointed to by the URL or you can upload a document from your computer. " + "<h5>Tagging a Source Document</h5>" + "When you add your first Source Document, CATMA generates a set of example items to get you going: " + "<ul><li>A User Markup Collection to hold your markup</li><li>A Tag Library with an example Tagset that contains an example Tag</li></ul> " + "To start tagging a Source Document, just select the example User Markup Collection from the tree and click the \"Open User Markup Collection\"-button. " + "Then follow the instructions given to you by the Tagger component." + "<h5>Analyze a Source Document</h5>" + "To analyze a Source Document, just select that document from the tree and click \"Analyze Source Document\" in the \"More Actions\"-menu." + "Then follow the instructions given to you by the Analyzer component."); labelLayout.addComponent(helpLabel); labelLayout.setComponentAlignment(helpLabel, Alignment.MIDDLE_RIGHT); return labelLayout; }
From source file:de.catma.ui.visualizer.chart.DistributionChartView.java
License:Open Source License
private void initComponents(DistributionComputation distributionComputation) { setSpacing(true);/*from w w w . j a va 2s. c om*/ setMargin(new MarginInfo(true, false, false, false)); addStyleName("distributionchartviewpanel"); zoom = new Slider("Zoom", 0, 100, "%"); zoom.setValue(100.0); addComponent(zoom); setComponentAlignment(zoom, Alignment.TOP_CENTER); zoomPanel = new ZoomableVerticalLayout(); zoomPanel.setSizeFull(); List<Distribution> distributions = distributionComputation.getDistributions(); int rows = distributions.size() / ROW_LENGTH; if (distributions.size() % ROW_LENGTH != 0) { rows++; } Integer firstRowLength = null; for (int rowIdx = 0; rowIdx < rows; rowIdx++) { HorizontalLayout row = new HorizontalLayout(); row.setSpacing(true); zoomPanel.addComponent(row); row.setWidth("100%"); int rowLength = Math.min(distributions.size() - ((rowIdx) * ROW_LENGTH), ROW_LENGTH); if (firstRowLength == null) { firstRowLength = rowLength; } for (int colIdx = 0; colIdx < rowLength; colIdx++) { Distribution distribution = distributions.get((rowIdx * ROW_LENGTH) + colIdx); Chart chart = new Chart(distribution, maxOccurrences, distributionSelectionListener); int width = (int) (500.0 * (3.0 / firstRowLength)); chart.setWidth(width + "px"); chart.setHeight("700px"); row.addComponent(chart); charts.put(distribution.getId(), chart); } } addComponent(zoomPanel); }
From source file:de.escidoc.admintool.view.admintask.AbstractAdminTaskView.java
License:Open Source License
private void init() { setCompositionRoot(mainLayout);/* w ww . java 2 s . co m*/ cssLayout.setHeight(100, UNITS_PERCENTAGE); cssLayout.setMargin(true); cssLayout.setWidth(ViewConstants._100_PERCENT); mainLayout.addComponent(cssLayout); final HorizontalLayout texts = new HorizontalLayout(); texts.setSpacing(true); texts.setWidth(ViewConstants._100_PERCENT); texts.setMargin(false, false, true, false); cssLayout.addComponent(texts); }
From source file:de.escidoc.admintool.view.admintask.reindex.ReindexView.java
License:Open Source License
@Override public void addView() { Label text = new H2(ViewConstants.REINDEX_RESOURCES_TITLE); text.setContentMode(Label.CONTENT_XHTML); cssLayout.addComponent(text);// w w w .j a va2 s . c o m cssLayout.addComponent(new Ruler()); text = new Label(ViewConstants.REINDEX_TEXT, Label.CONTENT_XHTML); cssLayout.addComponent(text); final HorizontalLayout hLayout = new HorizontalLayout(); hLayout.setWidth("100%"); hLayout.setHeight("250px"); final ReindexResourceView reindexResourceView = new ReindexResourceViewImpl(services.getAdminService(), mainWindow, application); reindexResourceView.init(); hLayout.addComponent(reindexResourceView); cssLayout.addComponent(hLayout); }
From source file:de.escidoc.admintool.view.EscidocPagedTable.java
License:Open Source License
public HorizontalLayout createControls() { // final Label itemsPerPageLabel = new Label("Items per page:"); final Label pageLabel = new Label("Page: ", Label.CONTENT_XHTML); final TextField currentPageTextField = new TextField(); currentPageTextField.setValue(String.valueOf(getCurrentPage())); currentPageTextField.addValidator(new IntegerValidator(null)); final Label separatorLabel = new Label(" / ", Label.CONTENT_XHTML); final Label totalPagesLabel = new Label(String.valueOf(getTotalAmountOfPages()), Label.CONTENT_XHTML); currentPageTextField.setStyleName(Reindeer.TEXTFIELD_SMALL); currentPageTextField.setImmediate(true); currentPageTextField.addListener(new ValueChangeListener() { private static final long serialVersionUID = -2255853716069800092L; public void valueChange(final com.vaadin.data.Property.ValueChangeEvent event) { if (currentPageTextField.isValid() && currentPageTextField.getValue() != null) { @SuppressWarnings("boxing") final int page = Integer.valueOf(String.valueOf(currentPageTextField.getValue())); setCurrentPage(page);//from ww w. ja v a 2s. c o m } } }); pageLabel.setWidth(null); currentPageTextField.setWidth("20px"); separatorLabel.setWidth(null); totalPagesLabel.setWidth(null); final HorizontalLayout controlBar = new HorizontalLayout(); final HorizontalLayout pageSize = new HorizontalLayout(); final HorizontalLayout pageManagement = new HorizontalLayout(); final Button first = new Button("<<", new ClickListener() { private static final long serialVersionUID = -355520120491283992L; public void buttonClick(final ClickEvent event) { setCurrentPage(0); } }); final Button previous = new Button("<", new ClickListener() { private static final long serialVersionUID = -355520120491283992L; public void buttonClick(final ClickEvent event) { previousPage(); } }); final Button next = new Button(">", new ClickListener() { private static final long serialVersionUID = -1927138212640638452L; public void buttonClick(final ClickEvent event) { nextPage(); } }); final Button last = new Button(">>", new ClickListener() { private static final long serialVersionUID = -355520120491283992L; public void buttonClick(final ClickEvent event) { setCurrentPage(getTotalAmountOfPages()); } }); first.setStyleName(BaseTheme.BUTTON_LINK); previous.setStyleName(BaseTheme.BUTTON_LINK); next.setStyleName(BaseTheme.BUTTON_LINK); last.setStyleName(BaseTheme.BUTTON_LINK); pageLabel.addStyleName("pagedtable-pagecaption"); currentPageTextField.addStyleName("pagedtable-pagefield"); separatorLabel.addStyleName("pagedtable-separator"); totalPagesLabel.addStyleName("pagedtable-total"); first.addStyleName("pagedtable-first"); previous.addStyleName("pagedtable-previous"); next.addStyleName("pagedtable-next"); last.addStyleName("pagedtable-last"); pageLabel.addStyleName("pagedtable-label"); currentPageTextField.addStyleName("pagedtable-label"); separatorLabel.addStyleName("pagedtable-label"); totalPagesLabel.addStyleName("pagedtable-label"); first.addStyleName("pagedtable-button"); previous.addStyleName("pagedtable-button"); next.addStyleName("pagedtable-button"); last.addStyleName("pagedtable-button"); pageSize.setSpacing(true); pageManagement.addComponent(first); pageManagement.addComponent(previous); pageManagement.addComponent(pageLabel); pageManagement.addComponent(currentPageTextField); pageManagement.addComponent(separatorLabel); pageManagement.addComponent(totalPagesLabel); pageManagement.addComponent(next); pageManagement.addComponent(last); pageManagement.setComponentAlignment(first, Alignment.MIDDLE_LEFT); pageManagement.setComponentAlignment(previous, Alignment.MIDDLE_LEFT); pageManagement.setComponentAlignment(pageLabel, Alignment.MIDDLE_LEFT); pageManagement.setComponentAlignment(currentPageTextField, Alignment.MIDDLE_LEFT); pageManagement.setComponentAlignment(separatorLabel, Alignment.MIDDLE_LEFT); pageManagement.setComponentAlignment(totalPagesLabel, Alignment.MIDDLE_LEFT); pageManagement.setComponentAlignment(next, Alignment.MIDDLE_LEFT); pageManagement.setComponentAlignment(last, Alignment.MIDDLE_LEFT); pageManagement.setWidth(null); pageManagement.setSpacing(true); controlBar.addComponent(pageSize); controlBar.addComponent(pageManagement); controlBar.setComponentAlignment(pageManagement, Alignment.MIDDLE_CENTER); controlBar.setWidth("100%"); controlBar.setExpandRatio(pageSize, 1); addListener(new PageChangeListener() { @SuppressWarnings("boxing") public void pageChanged(final PagedTableChangeEvent event) { previous.setEnabled(true); next.setEnabled(true); currentPageTextField.setValue(String.valueOf(getCurrentPage())); totalPagesLabel.setValue(getTotalAmountOfPages()); } }); return controlBar; }
From source file:de.fatalix.bookery.view.admin.AppUserCard.java
License:Open Source License
private HorizontalLayout createHeader() { captionLabel = new Label("some.user"); Button deleteUser = new Button(null, new Button.ClickListener() { @Override/*w w w . jav a2 s. c om*/ public void buttonClick(Button.ClickEvent event) { presenter.deleteUser(appUser); for (Listener listener : listeners) { listener.userDeleted(AppUserCard.this); } } }); deleteUser.setIcon(FontAwesome.TIMES_CIRCLE); deleteUser.addStyleName("borderless"); deleteUser.addStyleName("icon-only"); HorizontalLayout captionLayout = new HorizontalLayout(); captionLayout.addStyleName("v-panel-caption"); captionLayout.setWidth("100%"); captionLayout.addComponents(captionLabel, deleteUser); captionLayout.setExpandRatio(captionLabel, 1); return captionLayout; }
From source file:de.fatalix.bookery.view.admin.BatchJobCard.java
private HorizontalLayout createHeader() { captionLabel = new Label("some.batchjob"); Button deleteBatchJob = new Button(null, new Button.ClickListener() { @Override// w w w . j a v a 2 s. c om public void buttonClick(Button.ClickEvent event) { presenter.deleteBatchJob(jobConfig); for (BatchJobCard.Listener listener : listeners) { listener.jobDeleted(BatchJobCard.this); } } }); deleteBatchJob.setIcon(FontAwesome.TIMES_CIRCLE); deleteBatchJob.addStyleName("borderless"); deleteBatchJob.addStyleName("icon-only"); HorizontalLayout captionLayout = new HorizontalLayout(); captionLayout.addStyleName("v-panel-caption"); captionLayout.setWidth("100%"); captionLayout.addComponents(captionLabel, deleteBatchJob); captionLayout.setExpandRatio(captionLabel, 1); return captionLayout; }
From source file:de.fzi.fhemapi.view.vaadin.ui.DeviceDetailsPanel.java
License:Apache License
@AutoGenerated private VerticalLayout buildMainLayout() { // common part: create layout VerticalLayout layout = new VerticalLayout(); layout.setImmediate(false);/*ww w . j a v a 2 s. c o m*/ layout.setWidth("100.0%"); layout.setHeight("-1"); layout.setMargin(false); HorizontalLayout titleLayout = new HorizontalLayout(); titleLayout.setImmediate(false); titleLayout.setWidth("-1"); titleLayout.setHeight("50"); titleLayout.setMargin(false); layout.addComponent(titleLayout); layout.setComponentAlignment(titleLayout, Alignment.TOP_CENTER); // deviceTitle deviceTitle = new TextField(); deviceTitle.setImmediate(true); deviceTitle.setWidth("100%"); deviceTitle.setHeight("-1px"); deviceTitle.setValue(device.getName()); deviceTitle.addListener(new Property.ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { if (((String) event.getProperty().getValue()).length() > 1) { device.rename((String) event.getProperty().getValue()); parent.reloadTree(); } } }); titleLayout.addComponent(deviceTitle); titleLayout.setComponentAlignment(deviceTitle, Alignment.TOP_CENTER); ComboBox combobox = new ComboBox(); String[] classes = DeviceFactory.getAvailableDevicetypes(); for (String name : classes) { combobox.addItem(name); } combobox.select(device.getClass().getSimpleName()); combobox.addListener(new Property.ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { setDeviceType((String) event.getProperty().getValue()); } }); combobox.setImmediate(true); deviceTypeHoriLayout = UIHelper.buildAttributePanel("Device Type", combobox); layout.addComponent(deviceTypeHoriLayout); layout.setComponentAlignment(deviceTypeHoriLayout, Alignment.TOP_CENTER); layout.setExpandRatio(deviceTypeHoriLayout, 1); ioDevHoriLayout = buildAttributePanel("IO Device", device.getType()); layout.addComponent(ioDevHoriLayout); layout.setComponentAlignment(ioDevHoriLayout, Alignment.TOP_CENTER); layout.setExpandRatio(ioDevHoriLayout, 1); addDeviceDetails(DevicePanelManager.getDeviceDetails(device, this), layout); return layout; }
From source file:de.fzi.fhemapi.view.vaadin.ui.NewDevicePanel.java
License:Apache License
private static HorizontalLayout getTitlePanel() { HorizontalLayout titleLayout = new HorizontalLayout(); titleLayout.setImmediate(false);/*ww w.j a va2s. c o m*/ titleLayout.setWidth("-1"); titleLayout.setHeight("-1"); titleLayout.setMargin(false); // deviceTitle Label title = new Label(); title.setImmediate(true); title.setWidth("100%"); title.setHeight("50"); title.setValue("<h1>Neues Gert..</h1>"); title.setContentMode(Label.CONTENT_XHTML); titleLayout.addComponent(title); titleLayout.setComponentAlignment(title, Alignment.TOP_CENTER); return titleLayout; }
From source file:de.fzi.fhemapi.view.vaadin.ui.UIHelper.java
License:Apache License
/** * Builds an attribute panel. This build a caption on the left side. This should be altered if * one would like to change the appearance of the whole UI. * @param attributeName the caption of the component * @param component a component/*from www.j a v a 2 s . com*/ * @return a horizontallayout. */ public static HorizontalLayout buildAttributePanel(String attributeName, AbstractComponent component) { // common part: create layout HorizontalLayout horizontalLayout = new HorizontalLayout(); horizontalLayout.setImmediate(false); horizontalLayout.setWidth("100.0%"); horizontalLayout.setHeight("-1px"); horizontalLayout.setMargin(false); horizontalLayout.addComponent(buildRichTextField("<b>" + attributeName + "</b>")); horizontalLayout.addComponent(component); component.setCaption(attributeName); // component.set return horizontalLayout; }