/** * Constructeur, initialisation du champs * @param listeLangueEnService * @param langueParDefaut * @param libelleBtnPlus */ public I18nField(Langue langueParDefaut, List<Langue> listeLangueEnService, String libelleBtnPlus) { super(); setRequired(false); this.langueParDefaut = langueParDefaut; this.listeLangueEnService = listeLangueEnService; listLayoutTraductions = new ArrayList<HorizontalLayout>(); listeTraduction = new ArrayList<I18nTraduction>(); layoutComplet = new VerticalLayout(); layoutComplet.setSpacing(true); layoutLangue = new VerticalLayout(); layoutLangue.setSpacing(true); layoutComplet.addComponent(layoutLangue); btnAddLangue = new OneClickButton(libelleBtnPlus,FontAwesome.PLUS_SQUARE_O); btnAddLangue.setVisible(false); btnAddLangue.addStyleName(ValoTheme.BUTTON_TINY); layoutComplet.addComponent(btnAddLangue); btnAddLangue.addClickListener(e->{ layoutLangue.addComponent(getLangueLayout(null)); checkVisibleAddLangue(); centerWindow(); }); }
@Override protected void init(VaadinRequest request) { final VerticalLayout root = new VerticalLayout(); root.setSizeFull(); root.setMargin(true); root.setSpacing(true); setContent(root); MHorizontalLayout horizontalLayout = new MHorizontalLayout(); for (MenuEntry menuEntry : menuEntries) { horizontalLayout.addComponent(new MButton(menuEntry.getName(), event -> { navigator.navigateTo(menuEntry.getNavigationTarget()); })); } root.addComponent(horizontalLayout); springViewDisplay = new Panel(); springViewDisplay.setSizeFull(); root.addComponent(springViewDisplay); root.setExpandRatio(springViewDisplay, 1.0f); }
@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()); }
@Override protected void init(VaadinRequest request) { final VerticalLayout rootLayout = new VerticalLayout(); rootLayout.setSizeFull(); setContent(rootLayout); final CssLayout navigationBar = new CssLayout(); navigationBar.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP); navigationBar.addComponent(createNavigationButton("Demo View (Default)", Constants.VIEW_DEFAULT)); navigationBar.addComponent(createNavigationButton("Stream View", Constants.VIEW_STREAM)); rootLayout.addComponent(navigationBar); springViewDisplay = new Panel(); springViewDisplay.setSizeFull(); rootLayout.addComponent(springViewDisplay); rootLayout.setExpandRatio(springViewDisplay, 1.0f); }
@Override protected void init(VaadinRequest vaadinRequest) { // crate a binder for a form, specifying the data class that will be used in binding Binder<ImageData> binder = new Binder<>(ImageData.class); // specify explicit binding in order to add validation and converters binder.forMemberField(imageSize) // input should not be null or empty .withValidator(string -> string != null && !string.isEmpty(), "Input values should not be empty") // convert String to Integer, throw ValidationException if String is in incorrect format .withConverter(new StringToIntegerConverter("Input value should be an integer")) // validate converted integer: it should be positive .withValidator(integer -> integer > 0, "Input value should be a positive integer"); // tell binder to bind use all fields from the current class, but considering already existing bindings binder.bindInstanceFields(this); // crate data object with predefined imageName and imageSize ImageData imageData = new ImageData("Lorem ipsum", 2); // fill form with predefined data from data object and // make binder to automatically update the object from the form, if no validation errors are present binder.setBean(imageData); binder.addStatusChangeListener(e -> { // the real image drawing will not be considered in this article if (e.hasValidationErrors() || !e.getBinder().isValid()) { Notification.show("Form contains validation errors, no image will be drawn"); } else { Notification.show(String.format("I will draw image with \"%s\" text and width %d\n", imageData.getText(), imageData.getSize())); } }); // add a form to layout setContent(new VerticalLayout(text, imageSize)); }
private void getVarLayout(String title, List<String> liste, HorizontalLayout hlContent){ if (liste==null || liste.size()==0){ return; } VerticalLayout vl = new VerticalLayout(); if (title!=null){ Label labelTitle = new Label(title); vl.addComponent(labelTitle); vl.setComponentAlignment(labelTitle, Alignment.MIDDLE_CENTER); } StringBuilder txt = new StringBuilder("<ul>"); liste.forEach(e->txt.append("<li><input type='text' value='${"+e+"}'></li>")); txt.append("</ul>"); Label labelSearch = new Label(txt.toString(),ContentMode.HTML); vl.addComponent(labelSearch); hlContent.addComponent(vl); }
/** * @return le layout de légende */ private VerticalLayout getLegendLayout() { VerticalLayout vlLegend = new VerticalLayout(); // vlLegend.setWidth(300, Unit.PIXELS); vlLegend.setMargin(true); vlLegend.setSpacing(true); Label labelTitle = new Label( applicationContext.getMessage("formation.table.flagEtat.tooltip", null, UI.getCurrent().getLocale())); labelTitle.addStyleName(StyleConstants.VIEW_TITLE); vlLegend.addComponent(labelTitle); vlLegend.addComponent(getLegendLineLayout(ConstanteUtils.FLAG_GREEEN)); vlLegend.addComponent(getLegendLineLayout(ConstanteUtils.FLAG_RED)); vlLegend.addComponent(getLegendLineLayout(ConstanteUtils.FLAG_YELLOW)); vlLegend.addComponent(getLegendLineLayout(ConstanteUtils.FLAG_BLUE)); return vlLegend; }
/** * ajoute la mention CNIL */ private void addMentionCnil() { panelCnil.setWidth(100, Unit.PERCENTAGE); panelCnil.setHeight(100, Unit.PIXELS); addComponent(panelCnil); setComponentAlignment(panelCnil, Alignment.BOTTOM_LEFT); VerticalLayout vlContentLabelCnil = new VerticalLayout(); vlContentLabelCnil.setSizeUndefined(); vlContentLabelCnil.setWidth(100, Unit.PERCENTAGE); vlContentLabelCnil.setMargin(true); labelCnil.setContentMode(ContentMode.HTML); labelCnil.addStyleName(ValoTheme.LABEL_TINY); labelCnil.addStyleName(StyleConstants.LABEL_JUSTIFY); labelCnil.addStyleName(StyleConstants.LABEL_SAUT_LIGNE); vlContentLabelCnil.addComponent(labelCnil); panelCnil.setContent(vlContentLabelCnil); }
@Override protected void init(VaadinRequest vaadinRequest) { final VerticalLayout layout = new VerticalLayout(); final TextField name = new TextField(); name.setCaption("Type your name here:"); Button button = new Button("Click Me"); button.addClickListener(e -> { layout.addComponent(new Label("Thanks " + name.getValue() + ", it works!")); }); layout.addComponents(name, button); setContent(layout); }
private VerticalLayout makeSslUploadContainer(SslCertificateUploader certificateUploader, String title) { VerticalLayout sslUploadContainer = new VerticalLayout(); try { certificateUploader.setSizeFull(); certificateUploader.setUploadNotifier(uploadStatus -> { if (uploadStatus) { buildSslConfigurationTable(); } }); sslUploadContainer.addComponent(ViewUtil.createSubHeader(title, null)); sslUploadContainer.addComponent(certificateUploader); } catch (Exception e) { log.error("Cannot add upload component. Trust manager factory failed to initialize", e); ViewUtil.iscNotification(getString(MAINTENANCE_SSLCONFIGURATION_UPLOAD_INIT_FAILED, new Date()), null, Notification.Type.TRAY_NOTIFICATION); } return sslUploadContainer; }
public EmailLayout(GetEmailSettingsServiceApi getEmailSettingsService, SetEmailSettingsServiceApi setEmailSettingsService) { super(); this.getEmailSettingsService = getEmailSettingsService; this.setEmailSettingsService = setEmailSettingsService; try { this.emailTable = createTable(); // creating layout to hold edit button HorizontalLayout optionLayout = new HorizontalLayout(); optionLayout.addComponent(createEditButton()); // populating Email Settings in the Table populateEmailtable(); // adding all components to Container this.container = new VerticalLayout(); this.container.addComponent(optionLayout); this.container.addComponent(this.emailTable); // adding container to the root Layout addComponent(this.container); } catch (Exception ex) { log.error("Failed to get email settings", ex); } }
public SummaryLayout(ServerApi server, BackupServiceApi backupService, ArchiveApi archiver) { super(); this.server = server; this.backupService = backupService; this.archiver = archiver; this.summarytable = createTable(); // creating Server table this.summarytable.addItem(new Object[] { "DNS Name: ", getHostName() }, new Integer(1)); this.summarytable.addItem(new Object[] { "IP Address: ", getIpAddress() }, new Integer(2)); this.summarytable.addItem(new Object[] { "Version: ", getVersion() }, new Integer(3)); this.summarytable.addItem(new Object[] { "Uptime: ", server.uptimeToString() }, new Integer(4)); this.summarytable.addItem(new Object[] { "Current Server Time: ", new Date().toString() }, new Integer(5)); VerticalLayout tableContainer = new VerticalLayout(); tableContainer.addComponent(this.summarytable); addComponent(tableContainer); addComponent(createCheckBox()); HorizontalLayout actionContainer = new HorizontalLayout(); actionContainer.addComponent(createDownloadButton()); addComponent(actionContainer); }
public ManageLayout(BackupServiceApi backupService, RestoreServiceApi restoreService, ServerApi server, ValidationApi validator) { super(); this.backupService = backupService; this.validator = validator; VerticalLayout backupContainer = new VerticalLayout(); VerticalLayout restoreContainer = new VerticalLayout(); DbRestorer restorer = new DbRestorer(restoreService, server, validator); restorer.setSizeFull(); // Component to Backup Database Panel bkpPanel = new Panel(); bkpPanel.setContent(createBackup()); backupContainer.addComponent(ViewUtil.createSubHeader("Backup Database", null)); backupContainer.addComponent(bkpPanel); restoreContainer.addComponent(ViewUtil.createSubHeader("Restore Database", null)); restoreContainer.addComponent(restorer); addComponent(backupContainer); addComponent(restoreContainer); }
private void createSubView(String title, ToolbarButtons[] buttons) { setSizeFull(); final VerticalLayout layout = new VerticalLayout(); layout.addStyleName(StyleConstants.BASE_CONTAINER); layout.setSizeFull(); final VerticalLayout panel = new VerticalLayout(); panel.addStyleName("panel"); panel.setSizeFull(); layout.addComponent(createHeader(title)); layout.addComponent(panel); if (buttons != null) { panel.addComponent(createToolbar(buttons)); } panel.addComponent(createTable()); panel.setExpandRatio(this.table, 1L); layout.setExpandRatio(panel, 1L); addComponent(layout); }
private void addExitCloseTab() { VerticalLayout exitLayout = new VerticalLayout(); exitLayout.addComponentsAndExpand(new Label("We hope you had fun using the TinyPounder, it is now shutdown, " + "as well as all the DatasetManagers, CacheManagers, and Terracotta servers you started with it")); TabSheet.Tab tab = mainLayout.addTab(exitLayout, "EXIT : Close TinyPounder " + VERSION); tab.setStyleName("tab-absolute-right"); mainLayout.addSelectedTabChangeListener(tabEvent -> { if (tabEvent.getTabSheet().getSelectedTab().equals(tab.getComponent())) { new Thread(() -> { runningServers.values().forEach(RunningServer::stop); consoleRefresher.cancel(true); SpringApplication.exit(appContext); }).start(); } }); }
/** * Create a new vertical stepper using the given iterator and label change handler. * * @param stepIterator * The iterator that handles the iteration over the given steps * @param labelProvider * The handler that handles changes to labels */ private VerticalStepper(StepIterator stepIterator, LabelProvider labelProvider) { super(stepIterator, labelProvider); addStepperCompleteListener(this); getStepIterator().addElementAddListener(this); getStepIterator().addElementRemoveListener(this); this.rowMap = new HashMap<>(); this.rootLayout = new VerticalLayout(); this.rootLayout.setDefaultComponentAlignment(Alignment.TOP_LEFT); this.rootLayout.setSizeFull(); this.rootLayout.setMargin(false); this.rootLayout.setSpacing(false); setCompositionRoot(rootLayout); addStyleName(STYLE_ROOT_LAYOUT); setSizeFull(); refreshLayout(); }
@Override protected void init(VaadinRequest vaadinRequest) { final VerticalLayout contentArea = new VerticalLayout(); contentArea.setMargin(false); setContent(contentArea); final Navigator navigator = new Navigator(this, contentArea); navigator.addProvider(viewProvider); navigator.setErrorView(InaccessibleErrorView.class); String defaultView = Page.getCurrent().getUriFragment(); if (defaultView == null || defaultView.trim().isEmpty()) { defaultView = SecureView.VIEW_NAME; } if (isUserAuthenticated(vaadinRequest)) { navigator.navigateTo(defaultView); } else { navigator.navigateTo(LoginView.VIEW_NAME + "/" + defaultView); } }
@Override protected void init(VaadinRequest request) { setSizeFull(); VerticalLayout layout = new VerticalLayout(); layout.setSizeFull(); layout.setMargin(true); testGrid.setSizeFull(); testGrid.getEditor().setEnabled(true); testGrid.setItems(getCustomers()); layout.addComponent(testGrid); setContent(layout); }
@PostConstruct public void init() { applications = this.appService.findAll(); // Title Label title = new Label("<h2>Applications</h2>", ContentMode.HTML); initApplicationsGrid(); // Build layout VerticalLayout leftLayout = new VerticalLayout(title, grid); leftLayout.setMargin(false); this.addComponent(leftLayout); // Center align layout this.setWidth("100%"); this.setMargin(new MarginInfo(false, true)); }
@Override protected void init(VaadinRequest request) { // The root of the component hierarchy VerticalLayout content = new VerticalLayout(); content.setSizeFull(); // Use entire window setContent(content); // Attach to the UI // Add some component content.addComponent(new Label("<b>Hello!</b> - How are you?", ContentMode.HTML)); }
public ResultPanel(HighlightedSearchResult searchResult) { HttpArticle article = searchResult.getArticle(); String highlights = searchResult.getHighlights().stream().collect(Collectors.joining("<br/>...<br/>")); String text = String.format(RESULTS_TEMPLATE, DataUtils.formatInUTC(article.getPublished()).replace("T", " "), article.getUrl(), article.getTitle(), article.getSource(), highlights); Label content = new Label(text); content.setContentMode(ContentMode.HTML); VerticalLayout component = new VerticalLayout(content); component.setMargin(true); setContent(component); }
/** * Constructor */ public AbstractDialog() { super(); // defaults setModal(true); setResizable(false); setDraggable(false); setClosable(false); // style name addStyleName("h-dialog"); // build content = new Panel(); content.setWidth("100%"); content.addStyleName(ValoTheme.PANEL_BORDERLESS); content.addStyleName("h-dialog-content"); actions = new HorizontalLayout(); actions.setWidth("100%"); actions.setSpacing(true); actions.addStyleName(ValoTheme.WINDOW_BOTTOM_TOOLBAR); actions.addStyleName("h-dialog-actions"); root = new VerticalLayout(); root.addComponent(content); root.addComponent(actions); setContent(root); }
public void listing6() { // tag::listing6[] PropertyListing listing = Components.listing.properties(PROPERTIES) // .heightByContents() // <1> .frozenColumns(1) // <2> .hideHeaders() // <3> .withRowStyle(item -> { // <4> return item.getValue(DESCRIPTION) != null ? "has-des" : "no-nes"; }) // .itemDescriptionGenerator(item -> item.getValue(DESCRIPTION)) // <5> .detailsGenerator(item -> { // <6> VerticalLayout component = new VerticalLayout(); // ... return component; }).withItemClickListener((item, property, event) -> { // <7> // ... }).header(header -> { // <8> header.getDefaultRow().setStyleName("my-header"); }).footer(footer -> { // <9> footer.appendRow().setStyleName("my-footer"); }).footerGenerator((source, footer) -> { // <10> footer.getRowAt(0).getCell(ID).setText("ID footer"); }).withPostProcessor(grid -> { // <11> // ... }).build(); // end::listing6[] }
/** * Créé la popup d'astuce */ private Content createPopUpAstuce() { VerticalLayout vlAstuce = new VerticalLayout(); vlAstuce.setMargin(true); vlAstuce.setSpacing(true); Label labelTitle = new Label(applicationContext.getMessage("candidature.change.commission.astuce.title", null, UI.getCurrent().getLocale())); labelTitle.addStyleName(ValoTheme.LABEL_LARGE); labelTitle.addStyleName(ValoTheme.LABEL_BOLD); vlAstuce.addComponent(labelTitle); vlAstuce.addComponent(new Label(applicationContext.getMessage("candidature.change.commission.astuce.content", null, UI.getCurrent().getLocale()), ContentMode.HTML)); return new Content() { /** serialVersionUID **/ private static final long serialVersionUID = -4599757106887300854L; @Override public String getMinimizedValueAsHTML() { return applicationContext.getMessage("candidature.change.commission.astuce.link", null, UI.getCurrent().getLocale()); } @Override public Component getPopupComponent() { return vlAstuce; } }; }
/** * Créé la popup SVA * * @param listeAlerteSva * @param dateSva * @return le contenu de la popup SVA */ private Content createPopUpContent(final List<AlertSva> listeAlerteSva, final String dateSva) { VerticalLayout vlAlert = new VerticalLayout(); vlAlert.setMargin(true); vlAlert.setSpacing(true); Label labelTitle = new Label(applicationContext.getMessage("alertSva.popup.title", new Object[] {alertSvaController.getLibelleDateSVA(dateSva)}, UI.getCurrent().getLocale())); labelTitle.addStyleName(ValoTheme.LABEL_LARGE); labelTitle.addStyleName(ValoTheme.LABEL_BOLD); vlAlert.addComponent(labelTitle); listeAlerteSva.forEach(alert -> { vlAlert.addComponent( new Label( "<div style='display:inline-block;border:1px solid;width:20px;height:20px;background:" + alert.getColorSva() + ";'></div><div style='height:100%;display: inline-block;vertical-align: super;'>" + applicationContext.getMessage("alertSva.popup.alert", new Object[] {alert.getNbJourSva()}, UI.getCurrent().getLocale()) + "</div>", ContentMode.HTML)); }); return new Content() { /** serialVersionUID **/ private static final long serialVersionUID = -4599757106887300854L; @Override public String getMinimizedValueAsHTML() { return applicationContext.getMessage("alertSva.popup.link", null, UI.getCurrent().getLocale()); } @Override public Component getPopupComponent() { return vlAlert; } }; }
/** * Initialise la vue */ @PostConstruct public void init() { /* Style */ setSizeFull(); setSpacing(true); /*Layout des mails*/ VerticalLayout layoutMailModel = new VerticalLayout(); layoutMailModel.setSizeFull(); layoutMailModel.setSpacing(true); layoutMailModel.setMargin(true); /*Layout des typ decision*/ VerticalLayout layoutMailTypeDec = new VerticalLayout(); layoutMailTypeDec.setSizeFull(); layoutMailTypeDec.setSpacing(true); layoutMailTypeDec.setMargin(true); /*Le layout a onglet*/ TabSheet sheet = new TabSheet(); sheet.setImmediate(true); sheet.addStyleName(ValoTheme.TABSHEET_PADDED_TABBAR); addComponent(sheet); sheet.setSizeFull(); sheet.addTab(layoutMailModel, applicationContext.getMessage("mail.model.title", null, UI.getCurrent().getLocale()),FontAwesome.ENVELOPE_O); sheet.addTab(layoutMailTypeDec, applicationContext.getMessage("mail.typdec.title", null, UI.getCurrent().getLocale()),FontAwesome.ENVELOPE); /*Populate le layoutMailModel*/ populateMailModelLayout(layoutMailModel); /*Populate le layoutMailModel*/ populateMailTypeDecLayout(layoutMailTypeDec); /* Inscrit la vue aux mises à jour de mail */ mailEntityPusher.registerEntityPushListener(this); }
/** * Initialise le layout principal */ private void initLayout() { layout.setSizeFull(); setContent(layout); menuLayout.setPrimaryStyleName(ValoTheme.MENU_ROOT); layoutWithSheet.setPrimaryStyleName(StyleConstants.VALO_CONTENT); layoutWithSheet.addStyleName(StyleConstants.SCROLLABLE); layoutWithSheet.setSizeFull(); VerticalLayout vlAll = new VerticalLayout(); vlAll.addStyleName(StyleConstants.SCROLLABLE); vlAll.setSizeFull(); subBarMenu.addStyleName(ValoTheme.TABSHEET_PADDED_TABBAR); subBarMenu.setVisible(false); vlAll.addComponent(subBarMenu); contentLayout.addStyleName(StyleConstants.SCROLLABLE); contentLayout.setSizeFull(); vlAll.addComponent(contentLayout); vlAll.setExpandRatio(contentLayout, 1); layoutWithSheet.addComponent(vlAll); menuButtonLayout.addStyleName(StyleConstants.VALO_MY_MENU_MAX_WIDTH); layout.setExpandRatio(layoutWithSheet, 1); Responsive.makeResponsive(this); addStyleName(ValoTheme.UI_WITH_MENU); }
/** * Constructeur * * @param title * @param parent */ public AccordionItemMenu(String title, AccordionMenu parent, Boolean isExpandable) { super(); setWidth(100, Unit.PERCENTAGE); /* * Les labels n'etant pas cliquable, on passe par un layout * intermediaire */ VerticalLayout layoutClickable = new VerticalLayout(); layoutClickable.setWidth(100, Unit.PERCENTAGE); /* Label */ Label label = new Label(title); label.setPrimaryStyleName(ValoTheme.MENU_SUBTITLE); label.setSizeUndefined(); layoutClickable.addComponent(label); layoutClickable.addStyleName(StyleConstants.VALO_MENUACCORDEON); addComponent(layoutClickable); if (isExpandable) { layoutClickable.addStyleName(StyleConstants.CLICKABLE); layoutClickable.addLayoutClickListener(e -> { parent.changeItem((String) getData()); }); } vlButton = new VerticalLayout(); vlButton.addStyleName(StyleConstants.VALO_MENUACCORDEON); vlButton.setWidth(100, Unit.PERCENTAGE); addComponent(vlButton); }
private VerticalLayout buildSidebar() { VerticalLayout sideBar = new VerticalLayout(); sideBar.addStyleName("sidebar"); sideBar.addComponent(buildMainMenu()); sideBar.setExpandRatio(this.menu, 1); sideBar.setWidth(null); sideBar.setHeight("100%"); return sideBar; }
private VerticalLayout createTab(String caption, String title, FormLayout content, String guid) { VerticalLayout tabSheet = new VerticalLayout(); tabSheet.setCaption(caption); tabSheet.setStyleName(StyleConstants.TAB_SHEET); Panel panel = new Panel(); // creating subHeader inside panel panel.setContent(content); panel.setSizeFull(); tabSheet.addComponent(ViewUtil.createSubHeader(title, guid)); tabSheet.addComponent(panel); return tabSheet; }
public ArchiveLayout(ArchiveServiceApi archiveService, GetJobsArchiveServiceApi getJobsArchiveService, UpdateJobsArchiveServiceApi updateJobsArchiveService) { super(); VerticalLayout downloadContainer = new VerticalLayout(); VerticalLayout archiveContainer = new VerticalLayout(); // Component to Archive Jobs JobsArchiverPanel archiveConfigurator = new JobsArchiverPanel(this, archiveService, getJobsArchiveService, updateJobsArchiveService); archiveConfigurator.setSizeFull(); archiveContainer.addComponent(ViewUtil.createSubHeader("Archive Jobs/Alerts", null)); archiveContainer.addComponent(archiveConfigurator); downloadContainer.addComponent(ViewUtil.createSubHeader("Download Archive", null)); // Component to download archive this.archiveTable = new Table(); this.archiveTable.setSizeFull(); this.archiveTable.setPageLength(5); this.archiveTable.setImmediate(true); this.archiveTable.addContainerProperty("Name", String.class, null); this.archiveTable.addContainerProperty("Date", Date.class, null); this.archiveTable.addContainerProperty("Size", Long.class, null); this.archiveTable.addContainerProperty("Download", Link.class, null); this.archiveTable.addContainerProperty("Delete", Button.class, null); buildArchivesTable(); Panel archiveTablePanel = new Panel(); archiveTablePanel.setContent(this.archiveTable); addComponent(archiveContainer); addComponent(archiveTablePanel); }
@Activate void start(BundleContext ctx) throws Exception { setSizeFull(); addStyleName(StyleConstants.BASE_CONTAINER); VerticalLayout component = createComponent("Plugins", "Plugins", new PluginsLayout(ctx, this.importPluginService, this.server), HELP_PLUGIN_GUID); addComponent(component); setExpandRatio(component, 1L); }
private VerticalLayout createComponent(String caption, String title, FormLayout content, String guid) { VerticalLayout tabSheet = new VerticalLayout(); Panel panel = new Panel(); // creating subHeader inside panel panel.setContent(content); panel.setSizeFull(); tabSheet.addComponent(ViewUtil.createSubHeader(title, guid)); tabSheet.addComponent(panel); return tabSheet; }
public Component getTreeTable() throws Exception { VerticalLayout content = new VerticalLayout(); content.setMargin(new MarginInfo(true, true, false, true)); this.treeTable = new TreeTable(); this.treeTable.setPageLength(10); this.treeTable.setSelectable(false); this.treeTable.setSizeFull(); this.treeTable.addContainerProperty(PROPERTY_ID_MEMBER_NAME, String.class, ""); this.treeTable.addContainerProperty(PROPERTY_ID_MEMBER_TYPE, String.class, ""); this.treeTable.addContainerProperty(PROPERTY_ID_MEMBER_IP, String.class, ""); this.treeTable.addContainerProperty(PROPERTY_ID_MEMBER_MAC, String.class, ""); this.treeTable.setColumnHeader(PROPERTY_ID_MEMBER_NAME, VmidcMessages.getString(VmidcMessages_.NAME)); this.treeTable.setColumnHeader(PROPERTY_ID_MEMBER_TYPE, VmidcMessages.getString(VmidcMessages_.OS_MEMBER_TYPE)); this.treeTable.setColumnHeader(PROPERTY_ID_MEMBER_MAC, VmidcMessages.getString(VmidcMessages_.GENERAL_MACADDR)); this.treeTable.setColumnHeader(PROPERTY_ID_MEMBER_IP, VmidcMessages.getString(VmidcMessages_.GENERAL_IPADDR)); this.treeTable.setColumnWidth(PROPERTY_ID_MEMBER_NAME, NAME_COLUMN_WIDTH); this.treeTable.setColumnWidth(PROPERTY_ID_MEMBER_TYPE, TYPE_COLUMN_WIDTH); this.treeTable.setColumnWidth(PROPERTY_ID_MEMBER_MAC, MAC_COLUMN_WIDTH); this.treeTable.setColumnWidth(PROPERTY_ID_MEMBER_IP, IP_COLUMN_WIDTH); populateData(); content.addComponent(this.treeTable); return content; }
/** * Create a Modal window with the given parameters. * * @param content * the content to be placed within the window */ @Override public void setContent(Component content) { if (content == null) { super.setContent(content); } else { VerticalLayout panelContent = new VerticalLayout(); panelContent.addComponent(content); panelContent.addComponent(submitLayout()); super.setContent(panelContent); } }
@Override public void populateForm() { try { this.name = new TextField("Name"); this.name.focus(); this.name.setImmediate(true); this.name.setRequired(true); this.name.setRequiredError("Name cannot be empty"); FormLayout innerForm = new FormLayout(); innerForm.addComponent(this.name); innerForm.addComponent(getManagerConnector()); innerForm.addComponent(getApplianceDefinition()); innerForm.setWidth(100, Unit.PERCENTAGE); VerticalLayout layout = new VerticalLayout(); layout.addComponent(innerForm); // TODO: Future. Need to dynamically show/hide attributes based on manager type getAttributesPanel(); layout.addComponent(getVirtualSystemPanel()); this.form.setMargin(true); this.form.setWidth(689, Unit.PIXELS); this.form.addComponent(layout); } catch (Exception e) { log.error("Fail to populate Distributed Appliance form", e); ViewUtil.iscNotification("Fail to populate Distributed Appliance form (" + e.getMessage() + ")", Notification.Type.ERROR_MESSAGE); } }
public void createWindow(String caption) throws Exception { setCaption(caption); // creating top level layout for every window this.content = new VerticalLayout(); // creating form layout shared by all derived classes this.form = new FormLayout(); this.form.setMargin(true); this.form.setSizeUndefined(); this.infoText = new PageInformationComponent(); this.infoText.addStyleName(StyleConstants.PAGE_INFO_COMPONENT_WINDOW); this.content.addComponent(this.infoText); this.content.addComponent(this.form); getComponentModel().setOkClickedListener((ClickListener) event -> submitForm()); getComponentModel().setCancelClickedListener((ClickListener) event -> { cancelForm(); close(); }); // calling populateForm to create window specific content populateForm(); // adding content to this window setContent(this.content); }
public ProgressIndicatorWindow() { center(); setVisible(true); setResizable(false); setDraggable(false); setImmediate(true); setModal(true); setClosable(false); setCaption("Loading"); VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); layout.setWidth("100%"); this.currentStatus = new Label(); this.currentStatus.addStyleName(StyleConstants.TEXT_ALIGN_CENTER); this.currentStatus.setSizeFull(); this.currentStatus.setImmediate(true); ProgressBar progressBar = new ProgressBar(); progressBar.setSizeFull(); progressBar.setIndeterminate(true); progressBar.setImmediate(true); progressBar.setVisible(true); layout.addComponent(progressBar); layout.addComponent(this.currentStatus); layout.setComponentAlignment(this.currentStatus, Alignment.MIDDLE_CENTER); layout.setComponentAlignment(progressBar, Alignment.MIDDLE_CENTER); setContent(layout); }