@SuppressWarnings("unchecked") @Test public void test() { Person p1 = new Person(1, "John", LocalDate.of(1990, Month.JANUARY, 2)); Person p2 = new Person(1, "George", LocalDate.of(1991, Month.JUNE, 19)); Person p3 = new Person(1, "Tim", LocalDate.of(1995, Month.APRIL, 7)); SerializablePredicate<Person> predicate = this::isBeforeJan1992; FRadioButtonGroup<Person> radio = new FRadioButtonGroup<Person>().withCaption("My ComboBox", true) .withWidth(300, Unit.PIXELS) .withItems(p1, p2, p3) .withItemCaptionGenerator(p -> p.getName()) .withItemIconGenerator(p -> VaadinIcons.USER) .withItemEnabledProvider(predicate); assertEquals("My ComboBox", radio.getCaption()); assertTrue(radio.isCaptionAsHtml()); assertEquals(300, radio.getWidth(), 0); assertEquals(Unit.PIXELS, radio.getWidthUnits()); assertEquals(3, ((ListDataProvider<Person>) radio.getDataProvider()).getItems().size()); assertEquals(predicate, radio.getItemEnabledProvider()); }
@Test public void testHorizontalSplitPanel() { VerticalLayout c1 = new VerticalLayout(); VerticalLayout c2 = new VerticalLayout(); FHorizontalSplitPanel panel = new FHorizontalSplitPanel().withFirstComponent(c1) .withSecondComponent(c2) .withMinSplitPosition(10, Unit.PERCENTAGE) .withMaxSplitPosition(90, Unit.PERCENTAGE) .withSplitPosition(30) .withLocked(true) .withSplitPositionChangeListener(event -> System.out.println("pos changed")) .withSplitterClickListener(event -> System.out.println("splitter clicked")); assertEquals(c1, panel.getFirstComponent()); assertEquals(c2, panel.getSecondComponent()); assertEquals(10, panel.getMinSplitPosition(), 0); assertEquals(90, panel.getMaxSplitPosition(), 0); assertEquals(Unit.PERCENTAGE, panel.getMinSplitPositionUnit()); assertEquals(Unit.PERCENTAGE, panel.getMaxSplitPositionUnit()); assertEquals(30, panel.getSplitPosition(), 0); assertEquals(Unit.PERCENTAGE, panel.getSplitPositionUnit()); assertTrue(panel.isLocked()); }
@Test public void testVerticalSplitPanel() { VerticalLayout c1 = new VerticalLayout(); VerticalLayout c2 = new VerticalLayout(); FVerticalSplitPanel panel = new FVerticalSplitPanel().withFirstComponent(c1) .withSecondComponent(c2) .withMinSplitPosition(10, Unit.PERCENTAGE) .withSplitPosition(30, Unit.PERCENTAGE, true) .withMaxSplitPosition(90, Unit.PIXELS) .withLocked(true) .withSplitPositionChangeListener(event -> System.out.println("pos changed")) .withSplitterClickListener(event -> System.out.println("splitter clicked")); assertEquals(c1, panel.getFirstComponent()); assertEquals(c2, panel.getSecondComponent()); assertEquals(10, panel.getMinSplitPosition(), 0); assertEquals(90, panel.getMaxSplitPosition(), 0); assertEquals(Unit.PERCENTAGE, panel.getMinSplitPositionUnit()); assertEquals(Unit.PIXELS, panel.getMaxSplitPositionUnit()); assertEquals(30, panel.getSplitPosition(), 0); assertEquals(Unit.PERCENTAGE, panel.getSplitPositionUnit()); assertTrue(panel.isLocked()); }
@Test public void test() { FSlider slider = new FSlider().withCaption("My Slider") .withEnabled(true) .withWidth("75%") .withMin(25.0) .withMax(75.0) .withResolution(1) .withOrientation(SliderOrientation.VERTICAL) .withValue(34.1); assertEquals("My Slider", slider.getCaption()); assertTrue(slider.isEnabled()); assertEquals(75, slider.getWidth(), 0); assertEquals(Unit.PERCENTAGE, slider.getWidthUnits()); assertEquals(25, slider.getMin(), 0); assertEquals(34.1, slider.getValue(), 0); assertEquals(1, slider.getResolution()); assertEquals(SliderOrientation.VERTICAL, slider.getOrientation()); }
@SuppressWarnings("unchecked") @Test public void testItems() { Person p1 = new Person(1, "John", LocalDate.of(1990, Month.JANUARY, 2)); Person p2 = new Person(1, "George", LocalDate.of(1991, Month.JUNE, 19)); Person p3 = new Person(1, "Tim", LocalDate.of(1995, Month.APRIL, 7)); FNativeSelect<Person> select = new FNativeSelect<Person>().withCaption("My NativeSelect", true) .withWidth(300, Unit.PIXELS) .withItems(p1, p2, p3) .withEmptySelectionAllowed(false) .withEmptySelectionCaption("empty") .withItemCaptionGenerator(p -> p.getName()) .withVisibleItemCount(5); assertEquals("My NativeSelect", select.getCaption()); assertTrue(select.isCaptionAsHtml()); assertEquals(300, select.getWidth(), 0); assertEquals(Unit.PIXELS, select.getWidthUnits()); assertFalse(select.isEmptySelectionAllowed()); assertEquals("empty", select.getEmptySelectionCaption()); assertEquals(5, select.getVisibleItemCount()); assertEquals(3, ((ListDataProvider<Person>) select.getDataProvider()).getItems().size()); }
@SuppressWarnings("unchecked") @Test public void testDataProvider() { Person p1 = new Person(1, "John", LocalDate.of(1990, Month.JANUARY, 2)); Person p2 = new Person(1, "George", LocalDate.of(1991, Month.JUNE, 19)); Person p3 = new Person(1, "Tim", LocalDate.of(1995, Month.APRIL, 7)); List<Person> persons = Arrays.asList(p1, p2, p3); ListDataProvider<Person> dataProvider = DataProvider.ofCollection(persons); FNativeSelect<Person> select = new FNativeSelect<Person>().withCaption("My NativeSelect") .withWidth(300, Unit.PIXELS) .withDataProvider(dataProvider); assertEquals("My NativeSelect", select.getCaption()); assertFalse(select.isCaptionAsHtml()); assertEquals(300, select.getWidth(), 0); assertEquals(Unit.PIXELS, select.getWidthUnits()); assertEquals(3, ((ListDataProvider<Person>) select.getDataProvider()).getItems().size()); }
@SuppressWarnings("unchecked") @Test public void testDataProvider() { Person p1 = new Person(1, "John", LocalDate.of(1990, Month.JANUARY, 2)); Person p2 = new Person(1, "George", LocalDate.of(1991, Month.JUNE, 19)); Person p3 = new Person(1, "Tim", LocalDate.of(1995, Month.APRIL, 7)); List<Person> persons = Arrays.asList(p1, p2, p3); ListDataProvider<Person> dataProvider = DataProvider.ofCollection(persons); FComboBox<Person> combBox = new FComboBox<Person>().withCaption("My ComboBox") .withWidth(300, Unit.PIXELS) .withDataProvider( (item, filterText) -> item.toLowerCase().contains(filterText.toLowerCase()), dataProvider); assertEquals("My ComboBox", combBox.getCaption()); assertFalse(combBox.isCaptionAsHtml()); assertEquals(300, combBox.getWidth(), 0); assertEquals(Unit.PIXELS, combBox.getWidthUnits()); assertEquals(3, ((ListDataProvider<Person>) combBox.getDataProvider()).getItems().size()); }
@Override protected DialogOptions setWidth(Float width, SizeUnit sizeUnit) { super.setWidth(width, sizeUnit); if (width != null) { com.vaadin.ui.Window dialogWindow = asDialogWindow(); if (dialogWindow != null) { if (width < 0) { dialogWindow.setWidthUndefined(); component.setWidthUndefined(); getContainer().setWidthUndefined(); } else { Unit unit = sizeUnit != null ? WebWrapperUtils.toVaadinUnit(sizeUnit) : Unit.PIXELS; dialogWindow.setWidth(width, unit); component.setWidth(100, Unit.PERCENTAGE); } } } return this; }
@Override protected DialogOptions setHeight(Float height, SizeUnit sizeUnit) { super.setHeight(height, sizeUnit); if (height != null) { com.vaadin.ui.Window dialogWindow = asDialogWindow(); if (dialogWindow != null) { if (height < 0) { dialogWindow.setHeightUndefined(); component.setHeightUndefined(); getContainer().setHeightUndefined(); } else { Unit unit = sizeUnit != null ? WebWrapperUtils.toVaadinUnit(sizeUnit) : Unit.PIXELS; dialogWindow.setHeight(height, unit); component.setHeight(100, Unit.PERCENTAGE); } } } return this; }
protected void createComponentImpl() { if (orientation == SplitPanel.ORIENTATION_HORIZONTAL) { component = new CubaHorizontalSplitPanel() { @Override public void setSplitPosition(float pos, Unit unit, boolean reverse) { currentPosition = this.getSplitPosition(); inverse = this.isSplitPositionReversed(); super.setSplitPosition(pos, unit, reverse); } }; } else { component = new VerticalSplitPanel() { @Override public void setSplitPosition(float pos, Unit unit, boolean reverse) { currentPosition = this.getSplitPosition(); super.setSplitPosition(pos, unit, reverse); } }; } component.addSplitPositionChangeListener(this::fireSplitPositionChangeListener); }
@Override public void applySettings(Element element) { if (!isSettingsEnabled()) { return; } Element e = element.element("position"); if (e != null) { String value = e.attributeValue("value"); String unit = e.attributeValue("unit"); if (!StringUtils.isBlank(value) && !StringUtils.isBlank(unit)) { Unit convertedUnit; if (NumberUtils.isNumber(unit)) { convertedUnit = convertLegacyUnit(Integer.parseInt(unit)); } else { convertedUnit = Unit.getUnitFromSymbol(unit); } component.setSplitPosition(Float.parseFloat(value), convertedUnit, component.isSplitPositionReversed()); } } }
@Override public void presentTableData(RootResult rootrResult) { ResultToListConverter resultToListConverter = new ResultToListConverter(); List<Result> resultList = resultToListConverter.apply(rootrResult); Collections.sort(resultList, new Inverter<>(new ResultComparator())); Grid<Result> grid = new Grid<>(TABLE_TITLE); grid.addColumn(result -> result.getName()).setCaption(TABLE_COLUMN_METHOD_NAME).setId(TABLE_COLUMN_METHOD_NAME); grid.addColumn(result -> result.getValue() + NONE).setCaption(TABLE_COLUMN_VALUE_NAME) .setId(TABLE_COLUMN_VALUE_NAME); grid.setColumnOrder(TABLE_COLUMN_METHOD_NAME, TABLE_COLUMN_VALUE_NAME); grid.setStyleGenerator(result -> { if (result.getValue() > MAX_ALLOWED_VALUES) return ERROR_STYLE; return NONE; }); grid.setItems(resultList); grid.setSizeFull(); grid.setWidth(70, Unit.REM); mainPanel.addComponent(grid); mainPanel.setComponentAlignment(grid, Alignment.MIDDLE_CENTER); }
private VerticalLayout getCopyPasteLayout() { VerticalLayout layout = new VerticalLayout(); Label label = new Label("Paste the complete Content of your java-file here:"); layout.addComponent(label); layout.setComponentAlignment(label, Alignment.TOP_CENTER); copyPasteTextfield = new TextArea(); copyPasteTextfield.setWordWrap(false); copyPasteTextfield.setWidth(30.0f, Unit.REM); copyPasteTextfield.setHeight(30.0f, Unit.REM); layout.addComponent(copyPasteTextfield); layout.setComponentAlignment(copyPasteTextfield, Alignment.MIDDLE_CENTER); Button button = new Button(ADD); button.addClickListener(x -> addPasteListener.accept(getCopyPasteText())); layout.addComponent(button); layout.setComponentAlignment(button, Alignment.BOTTOM_RIGHT); return layout; }
protected final void createRowItem(final ResponsiveRow row, final Button button, final String description) { final CssLayout layout = new CssLayout(); layout.addStyleName("v-layout-content-overview-panel-level2"); Responsive.makeResponsive(layout); layout.setSizeUndefined(); button.addStyleName("itembox"); button.addStyleName("title"); Responsive.makeResponsive(button); button.setWidth(100, Unit.PERCENTAGE); layout.addComponent(button); final Label descriptionLabel = new Label(description); descriptionLabel.addStyleName("itembox"); Responsive.makeResponsive(descriptionLabel); descriptionLabel.setWidth(100, Unit.PERCENTAGE); layout.addComponent(descriptionLabel); row.addColumn().withDisplayRules(DISPLAY_SIZE_XS_DEVICE,DISPLAYS_SIZE_XM_DEVICE,DISPLAY_SIZE_MD_DEVICE,DISPLAY_SIZE_LG_DEVICE).withComponent(layout); }
protected final void createRowComponent(final ResponsiveRow row, final Component component, final String description) { final CssLayout layout = new CssLayout(); layout.addStyleName(".v-layout-content-pagemode-panel-level2"); Responsive.makeResponsive(layout); layout.setSizeUndefined(); final Label descriptionLabel = new Label(description); descriptionLabel.addStyleName("itembox"); Responsive.makeResponsive(descriptionLabel); descriptionLabel.setWidth(100, Unit.PERCENTAGE); layout.addComponent(descriptionLabel); component.addStyleName("itembox"); component.addStyleName("title"); Responsive.makeResponsive(component); component.setWidth(100, Unit.PERCENTAGE); layout.addComponent(component); row.addColumn().withDisplayRules(DISPLAY_SIZE_XS_DEVICE,DISPLAYS_SIZE_XM_DEVICE,DISPLAY_SIZE_MD_DEVICE,DISPLAY_SIZE_LG_DEVICE).withComponent(layout); }
/** * link component to headerRow and take care for styling * * @param columnId id of property * @param cellFilter component will get added to filterRow */ protected void handleFilterRow(String columnId, CellFilterComponent<?> cellFilter) { cellFilters.put(columnId, cellFilter); cellFilter.getComponent() .setWidth(100, Unit.PERCENTAGE); if (null != filterHeaderRow.getCell(columnId)) { filterHeaderRow.getCell(columnId) .setComponent(cellFilter.getComponent()); filterHeaderRow.getCell(columnId) .setStyleName("filter-header"); } }
protected void createWindow() { window = new Window(); window.addCloseListener(this); window.addCloseShortcut(KeyCode.ESCAPE, null); window.setResizable(false); window.setClosable(false); window.setWidth(50, Unit.PERCENTAGE); window.setHeight(80.0f, Unit.PERCENTAGE); window.setModal(true); initFields(); if (state == WindowState.UPDATE) { fillFields(); } buildContent(); }
@Override public Component buildBottomPanel() { Panel panel = new Panel(); panel.setWidth(100.0f, Unit.PERCENTAGE); panel.setHeight(25.0f, Unit.PIXELS); panel.addStyleName(ValoTheme.PANEL_BORDERLESS); panel.addStyleName("color2"); VerticalLayout layout = new VerticalLayout(); layout.setSizeFull(); panel.setContent(layout); Label label = new Label("Hypothesis v." + VERSION + "   © 2013-2016 Tilioteo Ltd"); label.setContentMode(ContentMode.HTML); label.setWidthUndefined(); label.addStyleName(ValoTheme.LABEL_TINY); layout.addComponent(label); layout.setComponentAlignment(label, Alignment.TOP_CENTER); return panel; }
private void addOrderedLayoutComponents(AbstractOrderedLayout container, Element element, SlideContainerPresenter presenter, Supplier<Unit> unitsGetter, Supplier<Float> sizeGetter, Consumer<String> sizeSetter) { DocumentUtility.getContainerComponents(element, ValidationSets.VALID_CONTAINER_CHILDREN).stream() .map(m -> createComponentFromElement(m, presenter)).filter(Objects::nonNull).forEach(e -> { Component component = e.getComponent(); container.addComponent(component); container.setComponentAlignment(component, e.getAlignment()); if (Objects.nonNull(unitsGetter) && Objects.nonNull(sizeGetter) && Objects.nonNull(sizeSetter)) { float ratio = 1.0f; if (unitsGetter.get() == Unit.PERCENTAGE) { ratio = sizeGetter.get() / 100; sizeSetter.accept("100%"); } container.setExpandRatio(component, ratio); } }); }
/** * Zips project. * * @param projectName the name of the project to be zipped */ protected void zipProject() { try { File zipFile = File.createTempFile("mideaas-"+project.getName(), ".zip"); zipProjectToFile(zipFile, settings); FileResource zip = new FileResource(zipFile); FileDownloader fd = new FileDownloader(zip); Button downloadButton = new Button("Download project"); fd.extend(downloadButton); //filedonwnloader can not be connected to menuitem :( So I connected it to popupwindow :) Window zipButtonWindow = new Window(); zipButtonWindow.setCaption("Zip and download project"); zipButtonWindow.setWidth(200, Unit.PIXELS); zipButtonWindow.setContent(downloadButton); UI.getCurrent().addWindow(zipButtonWindow); } catch (IOException e) { e.printStackTrace(); Notification.show("Error: " + e.getMessage(), Notification.Type.ERROR_MESSAGE); } }
/** * Create a titled separator * @param title title * @return a {@link HorizontalLayout} with title and rule. */ public static Component createTitledSeparator(String title) { Label titleLabel = new Label(title); titleLabel.setStyleName(Reindeer.LABEL_H2); Label rule = new Label("<hr />", ContentMode.HTML); titleLabel.setSizeUndefined(); HorizontalLayout hl = new HorizontalLayout(); hl.addComponent(titleLabel); Box.addHorizontalStruct(hl, 20); hl.addComponent(rule); hl.setComponentAlignment(rule, Alignment.BOTTOM_CENTER); hl.setExpandRatio(rule, 1); hl.setWidth(100, Unit.PERCENTAGE); return hl; }
@SuppressWarnings("unchecked") @Test public void testItems() { Person p1 = new Person(1, "John", LocalDate.of(1990, Month.JANUARY, 2)); Person p2 = new Person(1, "George", LocalDate.of(1991, Month.JUNE, 19)); Person p3 = new Person(1, "Tim", LocalDate.of(1995, Month.APRIL, 7)); FComboBox<Person> combBox = new FComboBox<Person>().withCaption("My ComboBox", true) .withWidth(300, Unit.PIXELS) .withItems(p1, p2, p3) .withEmptySelectionAllowed(false) .withEmptySelectionCaption("empty") .withItemCaptionGenerator(p -> p.getName()) .withItemIconGenerator(p -> VaadinIcons.USER) .withPageLength(5) .withPlaceholder("select") .withTextInputAllowed(false); assertEquals("My ComboBox", combBox.getCaption()); assertTrue(combBox.isCaptionAsHtml()); assertEquals(300, combBox.getWidth(), 0); assertEquals(Unit.PIXELS, combBox.getWidthUnits()); assertFalse(combBox.isEmptySelectionAllowed()); assertFalse(combBox.isTextInputAllowed()); assertEquals("empty", combBox.getEmptySelectionCaption()); assertEquals("select", combBox.getPlaceholder()); assertEquals(5, combBox.getPageLength()); assertEquals(3, ((ListDataProvider<Person>) combBox.getDataProvider()).getItems().size()); }
@Override public void init(Map<String, Object> params) { super.init(params); mainMenu.requestFocus(); initLogoImage(logoImage); initLayoutAnalyzerContextMenu(logoImage); initFtsField(ftsField); if (webConfig.getUseInverseHeader()) { titleBar.setStyleName("c-app-menubar c-inverse-header"); } if (webConfig.getFoldersPaneEnabled()) { if (webConfig.getFoldersPaneVisibleByDefault()) { foldersSplit.setSplitPosition(webConfig.getFoldersPaneDefaultWidth(), Component.UNITS_PIXELS); } else { foldersSplit.setSplitPosition(0); } CubaHorizontalSplitPanel vSplitPanel = (CubaHorizontalSplitPanel) WebComponentsHelper.unwrap(foldersSplit); vSplitPanel.setDefaultPosition(webConfig.getFoldersPaneDefaultWidth() + "px"); vSplitPanel.setMaxSplitPosition(50, Unit.PERCENTAGE); vSplitPanel.setDockable(true); } else { foldersPane.setEnabled(false); foldersPane.setVisible(false); foldersSplit.remove(workArea); int foldersSplitIndex = indexOf(foldersSplit); remove(foldersSplit); add(workArea, foldersSplitIndex); expand(workArea); } }
@Override public void setSplitPosition(int pos, int unit) { if (unit == UNITS_PIXELS) { component.setSplitPosition(pos, Unit.PIXELS); } else if (unit == UNITS_PERCENTAGE) { component.setSplitPosition(pos, Unit.PERCENTAGE); } else { throw new IllegalArgumentException("Unsupported unit " + unit); } }
@Override public void setSplitPosition(int pos, int unit, boolean reversePosition) { if (unit == UNITS_PIXELS) { component.setSplitPosition(pos, Unit.PIXELS, reversePosition); } else if (unit == UNITS_PERCENTAGE) { component.setSplitPosition(pos, Unit.PERCENTAGE, reversePosition); } else { throw new IllegalArgumentException("Unsupported unit " + unit); } }
@Override public int getSplitPositionUnit() { if (component.getSplitPositionUnit() == Unit.PIXELS) { return UNITS_PIXELS; } else if (component.getSplitPositionUnit() == Unit.PERCENTAGE) { return UNITS_PERCENTAGE; } else { throw new IllegalArgumentException("Component has unsupported split position unit " + component.getSplitPositionUnit()); } }
@Override public void setMinSplitPosition(int pos, int unit) { if (unit == UNITS_PIXELS) { component.setMinSplitPosition(pos, Unit.PIXELS); } else if (unit == UNITS_PERCENTAGE) { component.setMinSplitPosition(pos, Unit.PERCENTAGE); } else { throw new IllegalArgumentException("Unsupported unit " + unit); } }
@Override public void setMaxSplitPosition(int pos, int unit) { if (unit == UNITS_PIXELS) { component.setMaxSplitPosition(pos, Unit.PIXELS); } else if (unit == UNITS_PERCENTAGE) { component.setMaxSplitPosition(pos, Unit.PERCENTAGE); } else { throw new IllegalArgumentException("Unsupported unit " + unit); } }
protected Unit convertLegacyUnit(int unit) { switch (unit) { case 0: return Unit.PIXELS; case 8: return Unit.PERCENTAGE; default: return Unit.PIXELS; } }
public ElementModelLayout(TaskModel taskModel, ProcessModelLayout processModelLayout) { super(null); setCompositionRoot(button); setSizeUndefined(); setDragStartMode(DragAndDropWrapper.DragStartMode.WRAPPER); this.taskModel = taskModel; this.processModelLayout = processModelLayout; button.setCaption(taskModel.getTitle()); button.setWidth(taskModel.getWidth(), Unit.PIXELS); button.setHeight(taskModel.getHeight(), Unit.PIXELS); button.addStyleName("process-element"); setStyleSelected(false); }
@Override public void presentChartData(RootResult result) { List<Result> cummulatedResults = new ResultToCummulatedResultConverter().apply(result); String name = result.getName(); Collections.sort(cummulatedResults, new ResultNameComparator()); ChartConfiguration chartConfiguration = new ResultListToChart(name).apply(cummulatedResults); chartConfiguration = chartConfiguration.colorize(new ColorByLimitFunction(numberFromName(), Colors.GRAY, Integer.valueOf(MAX_ALLOWED_VALUES), Colors.RED)); chartConfiguration.setLegend(State.Enabled); chartConfiguration.setBackground(Colors.WHITE); Axis xAxis = chartConfiguration.xAxis(); xAxis.setTitle(result.getName()); Axis yAxis = chartConfiguration.yAxis(); yAxis.setTitle(DIAGRAMM_X_AXIS_LABEL); yAxis.setAxisValueType(AxisValueType.LOGARITHMIC); yAxis.setAxis(AxisOption.NOT_REVERSED); HighChart pieChart = HighChartFactory.renderChart(chartConfiguration, ChartType.BAR); pieChart.setHeight(50, Unit.REM); pieChart.setWidth(70, Unit.REM); pieChart.setSizeUndefined(); mainPanel.addComponent(pieChart); mainPanel.setComponentAlignment(pieChart, Alignment.TOP_CENTER); }
/** * Create a search text field. * * @param textChangeListener * listener when text is changed. * @return the textfield */ public TextField createSearchField(final TextChangeListener textChangeListener) { final TextField textField = style("filter-box").styleName("text-style filter-box-hide").buildTextComponent(); textField.setWidth(100.0F, Unit.PERCENTAGE); textField.addTextChangeListener(textChangeListener); textField.setTextChangeEventMode(TextChangeEventMode.LAZY); // 1 seconds timeout. textField.setTextChangeTimeout(1000); return textField; }
@Secured({ "ROLE_ADMIN" }) @Override public Layout createContent(final String parameters, final MenuBar menuBar, final Panel panel) { final VerticalLayout content = createPanelContent(); getMenuItemFactory().createMainPageMenuBar(menuBar); LabelFactory.createHeader2Label(content,ADMIN_AGENT_OPERATION); final ComboBox targetSelect = new ComboBox(TARGET, Arrays.asList(DataAgentTarget.values())); targetSelect.setId(ViewAction.START_AGENT_BUTTON + TARGET2); content.addComponent(targetSelect); content.setExpandRatio(targetSelect, ContentRatio.SMALL2); final ComboBox operationSelect = new ComboBox(OPERATION, Arrays.asList(DataAgentOperation.values())); operationSelect.setId(ViewAction.START_AGENT_BUTTON + OPERATION2); content.addComponent(operationSelect); content.setExpandRatio(operationSelect, ContentRatio.SMALL2); final Button startAgentButton = new Button(START, new StartAgentClickListener(targetSelect, operationSelect, agentContainer)); startAgentButton.setId(ViewAction.START_AGENT_BUTTON.name()); startAgentButton.setIcon(VaadinIcons.CROSSHAIRS); content.addComponent(startAgentButton); content.setExpandRatio(startAgentButton, ContentRatio.SMALL3); content.setSizeFull(); content.setMargin(false); content.setSpacing(true); content.setWidth(100, Unit.PERCENTAGE); content.setHeight(100, Unit.PERCENTAGE); return content; }
/** * Creates the panel content. * * @return the vertical layout */ protected final VerticalLayout createPanelContent() { final VerticalLayout panelContent = new VerticalLayout(); panelContent.setMargin(true); panelContent.setWidth(100, Unit.PERCENTAGE); panelContent.setHeight(100, Unit.PERCENTAGE); panelContent.setStyleName("Header"); return panelContent; }
/** * Creates the page visit history. * * @param pageName * the page name * @param pageId * the page id * @param panelContent * the panel content */ protected final void createPageVisitHistory(final String pageName, final String pageId, final VerticalLayout panelContent) { final TabSheet tabsheet = new TabSheet(); tabsheet.setWidth(100, Unit.PERCENTAGE); tabsheet.setHeight(100, Unit.PERCENTAGE); panelContent.addComponent(tabsheet); panelContent.setExpandRatio(tabsheet, ContentRatio.LARGE); final HorizontalLayout tabContentPageItemRankHistory = new HorizontalLayout(); tabContentPageItemRankHistory.setWidth(100, Unit.PERCENTAGE); tabContentPageItemRankHistory.setHeight(100, Unit.PERCENTAGE); final Tab tabPageItemRankHistory = tabsheet.addTab(tabContentPageItemRankHistory); tabPageItemRankHistory.setCaption(CURRENT_PAGE_VISIT_HISTORY); adminChartDataManager.createApplicationActionEventPageElementDailySummaryChart(tabContentPageItemRankHistory, pageName, pageId); final HorizontalLayout tabContentPageModeSummary = new HorizontalLayout(); tabContentPageModeSummary.setWidth(100, Unit.PERCENTAGE); tabContentPageModeSummary.setHeight(100, Unit.PERCENTAGE); final Tab tabPageModeSummary = tabsheet.addTab(tabContentPageModeSummary); tabPageModeSummary.setCaption(GENERAL_PAGE_MODE_PAGE_VISIT); adminChartDataManager.createApplicationActionEventPageModeDailySummaryChart(tabContentPageModeSummary, pageName); }
protected final ResponsiveRow createGridLayout(final VerticalLayout panelContent) { final ResponsiveLayout layout = new ResponsiveLayout(); Responsive.makeResponsive(layout); layout.addStyleName("v-layout-content-overview-panel-level1"); layout.setWidth(100, Unit.PERCENTAGE); layout.setHeight(100, Unit.PERCENTAGE); panelContent.addComponent(layout); panelContent.setExpandRatio(layout, ContentRatio.LARGE); return layout.addRow(); }
/** * Creates the button link. * * @param row * the panel content * @param linkText * the link text * @param icon * the icon * @param command * the command * @param description * the description */ protected final void createButtonLink(final ResponsiveRow row,final String linkText,final Resource icon, final ClickListener command, final String description) { final CssLayout layout = new CssLayout(); layout.addStyleName("v-layout-content-overview-panel-level2"); Responsive.makeResponsive(layout); layout.setSizeUndefined(); final Button button = new Button(linkText); Responsive.makeResponsive(button); button.setStyleName(LINK_STYLE_NAME); button.addStyleName("title"); button.addClickListener(command); button.setIcon(icon); button.setWidth(100, Unit.PERCENTAGE); layout.addComponent(button); final Label descriptionLabel = new Label(description); descriptionLabel.addStyleName("itembox"); Responsive.makeResponsive(descriptionLabel); descriptionLabel.setWidth(100, Unit.PERCENTAGE); layout.addComponent(descriptionLabel); row.addColumn().withDisplayRules(DISPLAY_SIZE_XS_DEVICE,DISPLAYS_SIZE_XM_DEVICE,DISPLAY_SIZE_MD_DEVICE,DISPLAY_SIZE_LG_DEVICE).withComponent(layout); }
/** * Creates the grid layout. * * @param panelContent * the panel content * @return the grid layout */ protected final ResponsiveRow createGridLayout(final VerticalLayout panelContent) { final ResponsiveLayout layout = new ResponsiveLayout(); Responsive.makeResponsive(layout); layout.addStyleName("v-layout-content-overview-panel-level1"); layout.setWidth(100, Unit.PERCENTAGE); layout.setHeight(100, Unit.PERCENTAGE); panelContent.addComponent(layout); panelContent.setExpandRatio(layout, ContentRatio.LARGE); return layout.addRow(); }
/** * Adds the chart. * * @param content * the content * @param caption * the caption * @param chart * the chart * @param fullPage * the full page */ protected final void addChart(final AbstractOrderedLayout content,final String caption, final DCharts chart, final boolean fullPage) { final HorizontalLayout horizontalLayout = new HorizontalLayout(); final int browserWindowWidth = getChartWindowWidth(); final int browserWindowHeight = getChartWindowHeight(fullPage); horizontalLayout.setWidth(browserWindowWidth, Unit.PIXELS); horizontalLayout.setHeight(browserWindowHeight, Unit.PIXELS); horizontalLayout.setMargin(true); horizontalLayout.setSpacing(false); horizontalLayout.addStyleName("v-layout-content-overview-panel-level1"); final Panel formPanel = new Panel(); formPanel.setSizeFull(); formPanel.setContent(horizontalLayout); formPanel.setCaption(caption); content.addComponent(formPanel); content.setExpandRatio(formPanel, ContentRatio.LARGE); chart.setWidth(100, Unit.PERCENTAGE); chart.setHeight(100, Unit.PERCENTAGE); chart.setMarginRight(CHART_RIGHT_MARGIN); chart.setMarginLeft(CHART_LEFT_MARGIN); chart.setMarginBottom(CHART_BOTTOM_MARGIN_SIZE); chart.setMarginTop(CHART_TOP_MARGIN_SIZE); horizontalLayout.addComponent(chart); chart.setCaption(caption); }
/** * Creates the gantt. * * @return the gantt */ private static final Gantt createGantt() { final Gantt gantt = new Gantt(); gantt.setSizeFull(); gantt.setWidth(100, Unit.PERCENTAGE); gantt.setHeight(100, Unit.PERCENTAGE); gantt.setResizableSteps(false); gantt.setMovableSteps(false); gantt.setResolution(Resolution.Week); return gantt; }