public UserSelect() { loginInfo = new Label(""); loginInfo.addStyleName("error-font"); loginInfo.addStyleName("margin15"); loginInfo.addStyleName("margin-top40"); loginInfo.setVisible(false); selected = null; loginField = new PasswordField(""); loginField.setWidth("200px"); loginField.addStyleName("margin15"); loginField.addStyleName("margin-bot40"); loginBut = new Button("login"); loginBut.addStyleName("margin15"); loginBut.addClickListener( e -> { if (loginField.getValue().equals(selected.getPassword())) { hidePass(); Globals.user = selected; Globals.root.changeScreen(Globals.user); } else { loginInfo.setVisible(true); loginInfo.setValue("Wrong password"); loginField.setValue(""); } }); loginBox = new HorizontalLayout(); loginBox.addStyleName("popup-box"); loginBox.addComponents(loginField, loginBut, loginInfo); loginBox.setComponentAlignment(loginField, Alignment.MIDDLE_LEFT); loginBox.setComponentAlignment(loginBut, Alignment.MIDDLE_CENTER); loginBox.setComponentAlignment(loginField, Alignment.MIDDLE_RIGHT); loginBox.setVisible(false); userIcon = new ThemeResource("icons/user.png"); users = Globals.control.usersData(); vbox = new VerticalLayout(); // vbox.setSizeUndefined(); vbox.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER); Panel p = new Panel(); p.setSizeFull(); p.setContent(vbox); // vbox.addStyleName("border-l-r"); this.addComponent(p, "left: 25%; right: 25%; top: 15px"); this.addComponent(loginBox, "left: 25%; right: 25%; top: 40%"); this.addLayoutClickListener( e -> { if (!loginBox.isVisible()) return; System.out.println(e.getClickedComponent()); if (e.getClickedComponent() == null || e.getClickedComponent().equals(vbox)) hidePass(); }); }
public SelectWindow( float width, int units, Collection<T> items, T selectedItem, Resource icon, String caption, String message, String okButtonText, String cancelButtonText) { super(); if (caption != null) { setCaption(caption); } if (icon != null) { setIcon(icon); } setWidth(width, units); setModal(true); setClosable(false); setResizable(false); setDraggable(false); VerticalLayout verticalLayout = new VerticalLayout(); verticalLayout.setMargin(true); verticalLayout.setSpacing(true); setContent(verticalLayout); Label label = new Label(message); addComponent(label); mySelect = new Select(null, items); mySelect.setNullSelectionAllowed(false); mySelect.setValue(selectedItem != null ? selectedItem : items.iterator().next()); mySelect.setWidth(100, Sizeable.UNITS_PERCENTAGE); addComponent(mySelect); Panel panel = new Panel(); addComponent(panel); verticalLayout.setComponentAlignment(panel, Alignment.MIDDLE_RIGHT); panel.addStyleName("light"); HorizontalLayout horizontalLayout = new HorizontalLayout(); panel.setContent(horizontalLayout); horizontalLayout.setSpacing(true); verticalLayout.setComponentAlignment(panel, Alignment.MIDDLE_RIGHT); myCancelButton = new Button(cancelButtonText, this); panel.addComponent(myCancelButton); myOkButton = new Button(okButtonText, this); panel.addComponent(myOkButton); }
@Override public void attach() { super.attach(); init( getBundleString("streamingConfigPanel.caption"), getComponentFactory().createGridLayout(1, 5, true, true)); myVlcEnabled = getComponentFactory().createCheckBox("streamingConfigPanel.vlcEnabled"); myVlcBinary = getComponentFactory() .createTextField( "streamingConfigPanel.vlcBinary", new VlcExecutableFileValidator( getBundleString("streamingConfigPanel.vlcBinary.invalidBinary"))); myVlcBinary.setImmediate(false); myVlcBinarySelect = getComponentFactory().createButton("streamingConfigPanel.vlcBinary.select", this); myVlcHomepageButton = getComponentFactory().createButton("streamingConfigPanel.vlcHomepage", this); myVlcForm = getComponentFactory().createForm(null, true); myVlcForm.addField(myVlcEnabled, myVlcEnabled); myVlcForm.addField(myVlcBinary, myVlcBinary); myVlcForm.addField(myVlcBinarySelect, myVlcBinarySelect); myVlcForm.addField(myVlcHomepageButton, myVlcHomepageButton); Panel vlcPanel = getComponentFactory() .surroundWithPanel( myVlcForm, FORM_PANEL_MARGIN_INFO, getBundleString("streamingConfigPanel.caption.vlc")); addComponent(vlcPanel); Panel transcoderPanel = new Panel(getBundleString("streamingConfigPanel.caption.transcoder")); transcoderPanel.setContent(getComponentFactory().createVerticalLayout(true, true)); Panel addTranscoderButtons = new Panel(); addTranscoderButtons.addStyleName("light"); addTranscoderButtons.setContent( getApplication().getComponentFactory().createHorizontalLayout(false, true)); myAddTranscoder = getComponentFactory().createButton("streamingConfigPanel.transcoder.add", this); addTranscoderButtons.addComponent(myAddTranscoder); myTranscoderTable = new Table(); myTranscoderTable.setCacheRate(50); myTranscoderTable.addContainerProperty( "name", String.class, null, getBundleString("streamingConfigPanel.transcoder.name"), null, null); myTranscoderTable.addContainerProperty("edit", Button.class, null, "", null, null); myTranscoderTable.addContainerProperty("delete", Button.class, null, "", null, null); myTranscoderTable.setSortContainerPropertyId("name"); transcoderPanel.addComponent(myTranscoderTable); transcoderPanel.addComponent(addTranscoderButtons); addComponent(transcoderPanel); myCacheForm = getComponentFactory().createForm(null, true); myTranscodingCacheMaxGiB = getComponentFactory() .createTextField( "streamingConfigPanel.cache.transcodingCacheMaxGiB", getApplication().getValidatorFactory().createMinMaxValidator(1, 1024)); myCacheForm.addField("limitTranscoding", myTranscodingCacheMaxGiB); myHttpLiveStreamCacheMaxGiB = getComponentFactory() .createTextField( "streamingConfigPanel.cache.httpLiveStreamCacheMaxGiB", getApplication().getValidatorFactory().createMinMaxValidator(1, 1024)); myCacheForm.addField("limitHttpLiveStream", myHttpLiveStreamCacheMaxGiB); myClearAllCachesButton = getComponentFactory().createButton("streamingConfigPanel.clearAllCaches", this); myCacheForm.addField(myClearAllCachesButton, myClearAllCachesButton); addComponent( getComponentFactory() .surroundWithPanel( myCacheForm, FORM_PANEL_MARGIN_INFO, getBundleString("streamingConfigPanel.caption.cache"))); addDefaultComponents(0, 4, 0, 4, false); initFromConfig(); }
private void recreateRootLayout() { List<ConnectionProfile> profiles = SettingsManager.get().getConfiguration().getProfiles(); Component component = profiles.isEmpty() ? createProfileEditorInvite() : createConnectionSelectorLayout(); rootPanel.setContent(component); }
@Override public void execute() { List<ChangeRecord> historyList = view.getUi().getStockService().findChanges(good); Window subWindow = new Window(); subWindow.setModal(true); subWindow.setHeight("650px"); subWindow.setWidth("700px"); subWindow.setClosable(true); view.getUi().addWindow(subWindow); final Button pdfButton = new Button(bundle.getString("pdf.export")); pdfButton.setIcon(new ThemeResource("img/pdf.png")); pdfButton.setWidth("150"); StreamResource pdfStream = getPDFStream(view.getUi().getStockService().findChanges(good)); pdfStream.setMIMEType("application/pdf"); FileDownloader pdfDownloader = new FileDownloader(pdfStream); pdfDownloader.extend(pdfButton); final VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); layout.setSpacing(true); layout.addComponent(pdfButton); for (ChangeRecord record : historyList) { for (ChangeRecord.PropertyChange p : record.getChangeList()) { p.setName(bundle.getString(p.getName())); } Panel panel = new Panel(); BeanItemContainer<ChangeRecord.PropertyChange> container = new BeanItemContainer<>(ChangeRecord.PropertyChange.class, record.getChangeList()); Table table = new Table(); table.setContainerDataSource(container); table.setVisibleColumns("name", "oldValue", "newValue"); table.setColumnHeaders( bundle.getString("history.property"), bundle.getString("history.old"), bundle.getString("history.new")); table.setColumnExpandRatio("name", 0.33f); table.setColumnExpandRatio("oldValue", 0.33f); table.setColumnExpandRatio("newValue", 0.33f); table.setPageLength(0); table.setWidth("100%"); VerticalLayout panelLayout = new VerticalLayout(); panelLayout.addComponent( new Label( "<b>" + new SimpleDateFormat("dd-MM-YYYY HH:mm").format(record.getDate()) + ": " + record.getUser().getName() + " " + record.getUser().getSurname() + "</b><br/>", ContentMode.HTML)); panelLayout.addComponent(table); panel.setContent(panelLayout); layout.addComponent(panel); } subWindow.setContent(layout); }