List of usage examples for com.vaadin.ui HorizontalSplitPanel setSecondComponent
public void setSecondComponent(Component c)
From source file:com.oodrive.nuage.webui.VvrManagerUi.java
License:Apache License
/** * Add a VVR user interface./*from w w w. java 2 s. c om*/ * * @param vvrUuid * the vvr unique identifier * */ public final void addVvr(final UUID vvrUuid) { // Create a vvr model final VvrModel vvrModel = jmxHandler.createVvrModel(vvrUuid); vvrModels.put(vvrUuid, vvrModel); // Layout for the first component final VerticalLayout vvrLayout = new VerticalLayout(); vvrLayout.setWidth("100%"); vvrsTabsheet.addTab(vvrLayout, vvrModel.getVvrName(), null, vvrsTabsheet.getComponentCount() - 1); vvrLayouts.put(vvrUuid, vvrLayout); // Create component for vvr operations final VvrOperationComponent op = new VvrOperationComponent(vvrManagerModel); final AbstractComponent opComponent = op.createComponent(vvrModel, jmxHandler); opComponent.setHeight(opLayoutHeight); vvrLayout.addComponent(opComponent); final Label label = new Label(" ", ContentMode.HTML); label.setHeight(labelLayoutHeight); vvrLayout.addComponent(label); vvrLayout.addComponent(new Label("<hr />", ContentMode.HTML)); // Create Tool tip for attributes final VvrAttributesComponent attr = new VvrAttributesComponent(vvrUuid); vvrsTabsheet.getTab(vvrLayout).setDescription(attr.createComponent(vvrModel)); // If there was only the + sheet, select the new vvr sheet if (vvrsTabsheet.getComponentCount() == 2) { vvrsTabsheet.setSelectedTab(0); } // Create its panel final HorizontalSplitPanel panel = new HorizontalSplitPanel(); vvrLayout.addComponent(panel); panel.setWidth("100%"); panel.setHeight(panelLayoutHeight); panel.setSplitPosition(35); // Component to display snapshot/device atributes final VerticalLayout vvrTreeLayout = new VerticalLayout(); final VvrTreeComponent vvrTreeComponent = new VvrTreeComponent(vvrTreeLayout); panel.setFirstComponent(vvrTreeComponent.createComponent(vvrModel, jmxHandler)); panel.setSecondComponent(vvrTreeLayout); vvrTreeComponents.put(vvrUuid, vvrTreeComponent); }
From source file:com.rdonasco.datamanager.view.DataManagerView.java
License:Apache License
@Override public void initWidget() throws WidgetInitalizeException { HorizontalSplitPanel splitPanel = new HorizontalSplitPanel(); splitPanel.setSplitPosition(300f, UNITS_PIXELS); getListView().getTable().setDataManager(dataManager); refreshData();//from ww w. j ava 2 s . co m getListView().setSizeFull(); splitPanel.setFirstComponent(getListView()); getDataForm().setSizeFull(); getDataForm().setDataManager(dataManager); getDataForm().setView(this); splitPanel.setSecondComponent(getDataForm()); splitPanel.setSizeFull(); addComponent(splitPanel); setExpandRatio(splitPanel, 1.0f); setMargin(false); // setup listeners getListView().getTable().addListener(new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { displaySelectedRecordInTheForm(); } }); }
From source file:de.unioninvestment.portal.explorer.view.vfs.VFSMainView.java
License:Apache License
public VFSMainView(ConfigBean cb, VFSFileExplorerPortlet instance) throws Exception { final String vfsUrl = cb.getVfsUrl(); if (vfsUrl.length() != 0) { removeAllComponents();// w w w . java 2 s . c om explorerPanel.setStyleName(Reindeer.PANEL_LIGHT); filePanel.setStyleName(Reindeer.PANEL_LIGHT); FileSystemOptions opts = new FileSystemOptions(); logger.log(Level.INFO, "Check Type "); if (cb.getVfsType().equalsIgnoreCase("FTP") || cb.getVfsType().equalsIgnoreCase("SFTP")) { if (cb.getUsername() != null && cb.getUsername().length() > 0) { StaticUserAuthenticator auth = new StaticUserAuthenticator(null, cb.getUsername(), cb.getPassword()); DefaultFileSystemConfigBuilder.getInstance().setUserAuthenticator(opts, auth); } } if (cb.getVfsType().equalsIgnoreCase("FTP")) { FtpFileSystemConfigBuilder.getInstance().setUserDirIsRoot(opts, true); FtpFileSystemConfigBuilder.getInstance().setPassiveMode(opts, true); } if (cb.getVfsType().equalsIgnoreCase("SFTP")) { SftpFileSystemConfigBuilder.getInstance().setUserDirIsRoot(opts, true); if (cb.getKeyfile() != null && cb.getKeyfile().length() > 0) { logger.log(Level.INFO, "Keyfile " + cb.getKeyfile()); SftpFileSystemConfigBuilder.getInstance().setStrictHostKeyChecking(opts, "no"); File keyFile = new File(cb.getKeyfile()); SftpFileSystemConfigBuilder.getInstance().setIdentities(opts, new File[] { keyFile }); } SftpFileSystemConfigBuilder.getInstance().setProxyType(opts, SftpFileSystemConfigBuilder.PROXY_HTTP); if (cb.getProxyHost() != null && cb.getProxyHost().length() > 0) { SftpFileSystemConfigBuilder.getInstance().setProxyHost(opts, cb.getProxyHost()); logger.log(Level.INFO, "ProxyHost " + cb.getProxyHost()); } if (cb.getProxyPort() != null && cb.getProxyPort().length() > 0) { SftpFileSystemConfigBuilder.getInstance().setProxyPort(opts, Integer.valueOf(cb.getProxyPort())); logger.log(Level.INFO, "ProxyPort " + cb.getProxyPort()); } } DefaultFileSystemManager fsManager = null; fsManager = getManager(); final HorizontalSplitPanel panel = new HorizontalSplitPanel(); panel.setHeight(500, UNITS_PIXELS); panel.setWidth(1400, UNITS_PIXELS); panel.setSplitPosition(350, Sizeable.UNITS_PIXELS); panel.setFirstComponent(explorerPanel); panel.setSecondComponent(filePanel); addComponent(panel); final Embedded image = new Embedded(); image.setType(Embedded.TYPE_IMAGE); image.setSource(FOLDER); image.setHeight(15, Sizeable.UNITS_PIXELS); explorerPanel.setSizeFull(); filePanel.setSizeFull(); explorerPanel.addComponent(tree); filePanel.addComponent(new TableView(instance, fsManager, opts, cb)); tree.setImmediate(true); tree.addListener(new ItemClickEvent.ItemClickListener() { private static final long serialVersionUID = 1L; @Override public void itemClick(ItemClickEvent event) { VFSFileExplorerPortlet app = (VFSFileExplorerPortlet) getApplication(); String newDir = (String) event.getItemId(); app.getEventBus().fireEvent(new TableChangedEvent(newDir)); } }); scanDirectory(fsManager, opts, vfsUrl); } else { addComponent(new Label("Please configure Portlet !")); } }
From source file:fi.jasoft.qrcode.demo.QRCodeDemo.java
License:Apache License
@Override protected void init(VaadinRequest request) { VerticalLayout content = new VerticalLayout(); content.setSizeFull();//from w ww .j av a 2 s . c om setContent(content); Label header = new Label("QR Code Generator"); header.setStyleName(ValoTheme.LABEL_H2); content.addComponent(header); HorizontalSplitPanel root = new HorizontalSplitPanel(); root.setSizeFull(); root.setSplitPosition(50, Unit.PERCENTAGE); root.setLocked(true); Panel panel = new Panel(root); panel.setSizeFull(); content.addComponent(panel); content.setExpandRatio(panel, 1); VerticalLayout first = new VerticalLayout(); first.setSizeFull(); root.setFirstComponent(first); first.addComponent( new HorizontalLayout(createPrimaryColorSelect(), createSecondaryColorSelect(), createSizeSelect())); code = new QRCode(); code.setWidth("100px"); code.setHeight("100px"); final TextArea text = new TextArea("Text embedded in QR Code"); text.setPlaceholder("Type the message of the QR code here"); text.setSizeFull(); text.setValueChangeMode(ValueChangeMode.LAZY); text.addValueChangeListener(e -> { code.setValue(e.getValue()); }); first.addComponent(text); first.setExpandRatio(text, 1); VerticalLayout vl = new VerticalLayout(); vl.setSizeFull(); vl.addComponent(code); vl.setComponentAlignment(code, Alignment.MIDDLE_CENTER); root.setSecondComponent(vl); }
From source file:hu.fnf.devel.wishbox.ui.MainPage.java
License:Open Source License
@Override protected void init(VaadinRequest vaadinRequest) { PropertysetItem item = new PropertysetItem(); item.addItemProperty("name", new ObjectProperty<String>("Zaphod")); item.addItemProperty("age", new ObjectProperty<Integer>(42)); // Have some layout FormLayout form = new FormLayout(); HorizontalLayout footer = new HorizontalLayout(); footer.addComponent(new Button("cica")); footer.addComponent(new Button("kutya")); // Now create a binder that can also create the fields // using the default field factory FieldGroup binder = new FieldGroup(item); form.addComponent(binder.buildAndBind("Name", "name")); form.addComponent(binder.buildAndBind("Age", "age")); HorizontalSplitPanel sample = new HorizontalSplitPanel(); sample.setSizeFull();// w w w .j a v a 2s .co m VerticalSplitPanel verticalSplitPanel = new VerticalSplitPanel(); verticalSplitPanel.setFirstComponent(form); verticalSplitPanel.setSecondComponent(new Label("masodik")); sample.setSecondComponent(verticalSplitPanel); Table grid = new Table(); grid.setSizeFull(); for (Object i : getItemContiner().getItemIds()) { System.out.println("item ids: " + i.toString()); } grid.setContainerDataSource(getItemContiner()); grid.setSelectable(true); grid.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent valueChangeEvent) { final String valueString = String.valueOf(valueChangeEvent.getProperty().getValue()); Notification.show("Value changed:", valueString, Notification.Type.TRAY_NOTIFICATION); } }); sample.setFirstComponent(grid); setContent(sample); // Main window is the primary browser window final Window main = new Window("Hello window"); addWindow(main); // "Hello world" text is added to window as a Label component UserService userService = UserServiceFactory.getUserService(); User user = userService.getCurrentUser(); if (user != null) { String email = user.getEmail(); } else { // no user logged in } assert user != null; main.setContent(new Label(user.getUserId())); }
From source file:myGroup.gwt.client.ui.MyUI.java
License:Open Source License
@Override protected void init(VaadinRequest vaadinRequest) { HorizontalSplitPanel sample = new HorizontalSplitPanel(); sample.setSizeFull();//from w w w .j a v a 2 s . c om // sample.setSplitPosition(150.0f, PIXELS); sample.setSecondComponent(new Label("korte")); setContent(sample); Table grid = new Table(); grid.setSizeFull(); for (Object i : getItemContiner().getItemIds()) { System.out.println(i.toString()); } grid.setContainerDataSource(getItemContiner()); grid.setSelectable(true); grid.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent valueChangeEvent) { final String valueString = String.valueOf(valueChangeEvent.getProperty().getValue()); Notification.show("Value changed:", valueString, Notification.Type.TRAY_NOTIFICATION); } }); sample.setFirstComponent(grid); // Main window is the primary browser window final Window main = new Window("Hello window"); addWindow(main); // "Hello world" text is added to window as a Label component UserService userService = UserServiceFactory.getUserService(); User user = userService.getCurrentUser(); if (user != null) { String email = user.getEmail(); } else { // no user logged in } assert user != null; main.setContent(new Label(user.getUserId())); }
From source file:net.sourceforge.javydreamercsw.validation.manager.web.admin.AdminScreenProvider.java
License:Apache License
private Component getEmailSettingTab() { VerticalLayout s2 = new VerticalLayout(); HorizontalSplitPanel split2 = new HorizontalSplitPanel(); s2.addComponent(split2);//w w w. j av a2s . co m Tree sTree2 = new Tree(TRANSLATOR.translate("general.email.settings")); sTree2.addValueChangeListener((Property.ValueChangeEvent event) -> { if (sTree2.getValue() instanceof VmSetting) { VmSetting vmSetting = (VmSetting) sTree2.getValue(); split2.setSecondComponent(displaySetting(vmSetting, !vmSetting.getSetting().equals("mail.enable"))); } }); split2.setFirstComponent(sTree2); VMSettingServer.getSettings().forEach(s -> { if (s.getSetting().startsWith("mail")) { sTree2.addItem(s); sTree2.setChildrenAllowed(s, false); sTree2.setItemCaption(s, TRANSLATOR.translate(s.getSetting())); } }); Button testEmail = new Button(TRANSLATOR.translate("general.email.settings.test"), listener -> { //Show a window to test email settings VMWindow w = new VMWindow(TRANSLATOR.translate("general.email.settings.test")); VerticalLayout vl = new VerticalLayout(); TextField to = new TextField(TRANSLATOR.translate("general.email.to")); TextField from = new TextField(TRANSLATOR.translate("general.email.from")); TextField subject = new TextField(TRANSLATOR.translate("general.email.subject")); TextArea mess = new TextArea(TRANSLATOR.translate("general.email.message")); mess.setSizeFull(); TextArea output = new TextArea(TRANSLATOR.translate("general.output")); output.setReadOnly(true); output.setSizeFull(); Button send = new Button(TRANSLATOR.translate("general.email.send"), l -> { try { Lookup.getDefault().lookup(IEmailManager.class).sendEmail(to.getValue(), null, from.getValue(), subject.getValue(), mess.getValue()); output.setValue(TRANSLATOR.translate("general.email.settings.test.success")); //Successful, update the enable setting. VMSettingServer enable = new VMSettingServer("mail.enable"); enable.setBoolVal(true); enable.write2DB(); } catch (Exception ex) { LOG.log(Level.SEVERE, null, ex); StringWriter sw = new StringWriter(); ex.printStackTrace(new PrintWriter(sw)); output.setReadOnly(false); output.setValue(sw.toString()); output.setReadOnly(true); } }); vl.addComponent(to); vl.addComponent(from); vl.addComponent(subject); vl.addComponent(mess); vl.addComponent(send); vl.addComponent(output); w.setContent(vl); w.setHeight(75, Sizeable.Unit.PERCENTAGE); w.setWidth(75, Sizeable.Unit.PERCENTAGE); ValidationManagerUI.getInstance().addWindow(w); }); s2.addComponent(testEmail); return s2; }
From source file:net.sourceforge.javydreamercsw.validation.manager.web.admin.AdminScreenProvider.java
License:Apache License
private Component getSettingTab() { VerticalLayout sl = new VerticalLayout(); HorizontalSplitPanel split1 = new HorizontalSplitPanel(); sl.addComponent(split1);// w w w . j ava2 s. c o m Tree sTree = new Tree(TRANSLATOR.translate("general.settings")); split1.setFirstComponent(sTree); sTree.addValueChangeListener((Property.ValueChangeEvent event) -> { if (sTree.getValue() instanceof VmSetting) { split1.setSecondComponent(displaySetting((VmSetting) sTree.getValue())); } }); VMSettingServer.getSettings().forEach(s -> { if (!s.getSetting().startsWith("mail")) { sTree.addItem(s); sTree.setChildrenAllowed(s, false); sTree.setItemCaption(s, TRANSLATOR.translate(s.getSetting())); } }); return sl; }
From source file:net.sourceforge.javydreamercsw.validation.manager.web.admin.AdminScreenProvider.java
License:Apache License
private Component getUserManagementTab() { VerticalLayout vl = new VerticalLayout(); HorizontalSplitPanel split = new HorizontalSplitPanel(); vl.addComponent(split);/* ww w . j av a 2 s . c om*/ //Create left side Tree users = new Tree(); //Menu VerticalLayout main = new VerticalLayout(); main.addComponent(users); HorizontalLayout hl = new HorizontalLayout(); Button addUser = new Button(TRANSLATOR.translate("add.user")); addUser.addClickListener(listener -> { VMUserServer user = new VMUserServer(new VmUser()); split.setSecondComponent(new UserComponent(user, true)); }); hl.addComponent(addUser); main.addComponent(hl); split.setFirstComponent(main); VMUserServer.getVMUsers().forEach(user -> { if (!Objects.equals(user.getId(), ((VMUI) UI.getCurrent()).getUser().getId())) { users.addItem(user.getEntity()); users.setItemCaption(user.getEntity(), user.toString()); users.setItemIcon(user.getEntity(), VaadinIcons.USER); users.setChildrenAllowed(user.getEntity(), false); } }); users.addValueChangeListener((Property.ValueChangeEvent event) -> { VmUser user = (VmUser) users.getValue(); split.setSecondComponent(new UserComponent(new VMUserServer(user), true)); }); vl.setSizeFull(); return vl; }
From source file:net.sourceforge.javydreamercsw.validation.manager.web.ValidationManagerUI.java
License:Apache License
private Component getContentComponent() { HorizontalSplitPanel hsplit = new HorizontalSplitPanel(); hsplit.setLocked(true);//from w w w . java 2 s . c o m if (left != null) { if (!(left instanceof Panel)) { left = new Panel(left); } if (user != null) { hsplit.setFirstComponent(left); } } tabSheet.removeAllComponents(); //Build the right component main = tabSheet.addTab(new VerticalLayout(), TRANSLATOR.translate("general.main")); Lookup.getDefault().lookupAll(IMainContentProvider.class).forEach((provider) -> { Iterator<Component> it = tabSheet.iterator(); Component me = findMainProvider(provider.getComponentCaption()); if (me == null) { if (provider.shouldDisplay()) { LOG.log(Level.FINE, "Loading: {0}", TRANSLATOR.translate(provider.getComponentCaption())); tabSheet.addTab(provider.getContent(), TRANSLATOR.translate(provider.getComponentCaption())); } } else { provider.update(); } //Hide if needed if (me != null && !provider.shouldDisplay()) { tabSheet.removeComponent(me); } }); hsplit.setSecondComponent(tabSheet); //This is a tabbed pane. Enable/Disable the panes based on role if (getUser() != null) { roles.clear(); user.update();//Get any recent changes user.getRoleList().forEach((r) -> { roles.add(r.getRoleName()); }); } hsplit.setSplitPosition(25, Unit.PERCENTAGE); return hsplit; }