List of usage examples for com.vaadin.ui Label setWidth
@Override public void setWidth(String width)
From source file:org.jpos.qi.RevisionsPanel.java
License:Open Source License
private void addRevision(Revision r) { Label author = new Label("<strong>" + r.getAuthor().getName() + "</strong>", ContentMode.HTML); Label date = new Label(r.getDate().toString()); Label info = new Label(r.getInfo(), ContentMode.HTML); author.setWidth("60%"); HorizontalLayout hl = new HorizontalLayout(); hl.setHeight("30px"); hl.setWidth("100%"); hl.addComponent(author);//from ww w . j ava 2 s . c o m hl.addComponent(date); Layout content = (Layout) getContent(); content.addComponent(hl); content.addComponent(info); content.addComponent(new Label("<hr/>", ContentMode.HTML)); }
From source file:org.jug.montpellier.sonni.about.AboutPerspectiveContribution.java
License:Apache License
private Component getAboutDialog() { CssLayout titleLayout = new CssLayout(); titleLayout.addStyleName("transparent-frame"); titleLayout.setWidth("90%"); Label title = new Label("Sonni - Dynamic Vaadin OSGi Demo"); title.setWidth("100%"); title.addStyleName("about-title"); titleLayout.addComponent(title);//w w w .j ava 2 s . c o m Label description = new Label( "<br/>Copyright (c) Developer <a href='mailto:eric.taix@gmail.com'>Eric Taix</a> - <a href='http://www.montpellier-jug.org'>Montpellier JUG</a><br>" + "<br/><br/>This application aims to demonstrate how to develop a dynamic application with <a href='http://www.vaadin.com'>Vaadin</a> and OSGi<br/>" + "All buttons in the left panel are loaded dynamically from components stored in differents bundles. Play with the parameter view to activate or desactivate components." // + "This application can be forked from <a href='https://github.com/eric-taix/sonni'>gitHub</a>." + "<br/><br/><br/>The Montpellier Java User Group's goals are:" + "<li>Create an independent community 'In Real Life' (the JUG is not intended to be another virtual community built around an electronic forum)</li>" + "<li>Promote exchanges between industry, academia and students</li>" + "<li>Share knowledge and experiences around Java</li>" + "<li>Promote Java and associated technologies</li>" + "All in a professional and user-friendly form.<br/><br><br/>" + "Licensed under Apache Software Foundation 2.0 license (ASF)<br>" + "This software contains modules licenced under the Apache Software Foundation 2.0 license (ASF) and EPL<br>" + "Many thanks to Siemens AG, Kai Tdter, Chris Brind, Neil Bartlett, " + " Petter Holmstrm and others for their OSGi and Vaadin" + " related work, blogs, and bundles." + "<br/><br/><br/>Why <b>Sonni</b>?<br/>'Sonni' is the finish translation for bulls. Finland has a lot of reinders and in our county we have a lot of bulls !<br/><br/>"); description.addStyleName("about"); description.setWidth("100%"); description.setContentMode(Label.CONTENT_XHTML); titleLayout.addComponent(description); return titleLayout; }
From source file:org.lunifera.christmastree.control.DesktopControlComponent.java
License:Creative Commons License
protected AbsoluteLayout buildMainLayout() { // common part: create layout mainLayout = new AbsoluteLayout(); mainLayout.setImmediate(false);//from w w w . ja v a 2s. c o m mainLayout.setWidth("100%"); mainLayout.setHeight("100%"); // top-level component properties setWidth("100.0%"); setHeight("100.0%"); // title area ThemeResource resource = new ThemeResource("images/Title.png"); Image title = new Image(" ", resource); title.setHeight("108px"); title.setWidth("827px"); mainLayout.addComponent(title, "top:22.0px;left:120.0px"); VerticalLayout vl = new VerticalLayout(); vl.setHeight("500px"); vl.setWidth("400px"); vl.setSpacing(true); mainLayout.addComponent(vl, "top:140.0px;left:100.0px;"); contentLayout = buildContent(); vl.addComponent(contentLayout); vl.setExpandRatio(contentLayout, 1.0f); // licenses PopupView licenseLink = new PopupView("Attributions", new Label("<div><i>Monitor/tablet/smartphone</i> and <i>tree</i> icons </br> made by " + "<a href=\"http://www.freepik.com\" title=\"Freepik\">Freepik</a> " + "from <a href=\"http://www.flaticon.com\" title=\"Flaticon\">www.flaticon.com</a> </br>" + "is licensed under <a href=\"http://creativecommons.org/licenses/by/3.0/\" " + "title=\"Creative Commons BY 3.0\">CC BY 3.0</a></div>", ContentMode.HTML)); licenseLink.setPrimaryStyleName("attributions"); vl.addComponent(licenseLink); Label image = new Label(); image.setHeight("400px"); image.setWidth("100%"); // image.setValue("<div style=\"overflow:hidden; width: 400px; // margin-left: -60px;\">" // + "<img src=\"http://77.119.240.22:8081\"/>" + "</div>"); image.setValue("<div style=\"overflow:hidden; width: 370px; margin-left: -60px;\">" + "<img src=\"http://192.168.0.108:8081\"/>" + "</div>"); image.setContentMode(ContentMode.HTML); mainLayout.addComponent(image, "top:140.0px;left:600.0px;"); return mainLayout; }
From source file:org.lunifera.christmastree.control.MobileControlComponent.java
License:Creative Commons License
protected AbsoluteLayout buildMainLayout() { // common part: create layout mainLayout = new AbsoluteLayout(); mainLayout.setImmediate(false);// w w w . j a va 2 s . c om mainLayout.setWidth("1280px"); mainLayout.setHeight("720px"); // top-level component properties setWidth("100.0%"); setHeight("100.0%"); // title area ThemeResource resource = new ThemeResource("images/Title.png"); Image title = new Image(" ", resource); title.setHeight("54px"); title.setWidth("413px"); mainLayout.addComponent(title, "top:11.0px;left:60.0px"); Label image = new Label(); image.setHeight("340px"); image.setWidth("600px"); image.setValue("<div style=\"overflow:hidden; width: 320px; height: 600px; margin-left: -60px;\">" + "<img src=\"http://192.168.0.108:8081\"/>" + "</div>"); image.setContentMode(ContentMode.HTML); mainLayout.addComponent(image, "top:70.0px;left:125px;"); // Image image = new Image(); // image.setHeight("240px"); // image.setWidth("320px"); // image.setSource(new // ExternalResource("http://192.168.0.108:8081/stream", // "video/x-motion-jpeg")); // mainLayout.addComponent(image, "top:70.0px;left:50.0px;"); VerticalLayout vl = new VerticalLayout(); // vl.setHeight("250px"); vl.setWidth("200px"); vl.setSpacing(true); mainLayout.addComponent(vl, "top:180.0px;left:535.0px;"); contentLayout = buildContent(); vl.addComponent(contentLayout); vl.setExpandRatio(contentLayout, 1.0f); // licenses PopupView licenseLink = new PopupView("Attributions", new Label("<div><i>Monitor/tablet/smartphone</i> and <i>tree</i> icons </br> made by " + "<a href=\"http://www.freepik.com\" title=\"Freepik\">Freepik</a> " + "from <a href=\"http://www.flaticon.com\" title=\"Flaticon\">www.flaticon.com</a> </br>" + "is licensed under <a href=\"http://creativecommons.org/licenses/by/3.0/\" " + "title=\"Creative Commons BY 3.0\">CC BY 3.0</a></div>", ContentMode.HTML)); licenseLink.setPrimaryStyleName("attributions"); vl.addComponent(licenseLink); return mainLayout; }
From source file:org.opencms.ui.dialogs.CmsDeleteDialog.java
License:Open Source License
/** * Indents a resources box.<p>//from w w w.j ava 2 s . com * * @param resourceInfo the resource box * * @return an indented resource box */ private Component indent(CmsResourceInfo resourceInfo) { boolean simple = false; if (simple) { return resourceInfo; } else { HorizontalLayout hl = new HorizontalLayout(); Label label = new Label(""); label.setWidth("35px"); hl.addComponent(label); hl.addComponent(resourceInfo); hl.setExpandRatio(resourceInfo, 1.0f); hl.setWidth("100%"); return hl; } }
From source file:org.opennms.features.pluginmgr.vaadin.pluginmanager.LicenceDescriptorPanel.java
License:Apache License
/** * updates the metadata fields from the licence string * if unable to read the metadata then returns false * @param licenceStr/*from w w w . j av a2s.c o m*/ * @return true if metadata read, false if not */ public boolean updateMetadata(String licenceStr) { boolean success = false; if (licenceStr != null) { LicenceMetadata licenceMetadata = null; try { licenceMetadata = Licence.getUnverifiedMetadata(licenceStr); } catch (Exception e) { // can't decode string licenceMetadata will be null } if (licenceMetadata == null) { //create empty licenceMetadata panel licenceMetadata = new LicenceMetadata(); licenceMetadata.setStartDate(null); licenceMetadata.setProductId("cannot decode licence string"); success = false; } else success = true; productIdTextField.setReadOnly(false); productIdTextField .setValue((licenceMetadata.getProductId() == null) ? "" : licenceMetadata.getProductId()); productIdTextField.setReadOnly(noUpdate); featureRepositoryTextField.setReadOnly(false); featureRepositoryTextField.setValue( (licenceMetadata.getFeatureRepository() == null) ? "" : licenceMetadata.getFeatureRepository()); featureRepositoryTextField.setReadOnly(noUpdate); Format formatter = new SimpleDateFormat("yyyy-MM-dd"); startDateTextField.setReadOnly(false); startDateTextField.setValue((licenceMetadata.getStartDate() == null) ? "" : formatter.format(licenceMetadata.getStartDate())); startDateTextField.setReadOnly(noUpdate); expiryDateTextField.setReadOnly(false); expiryDateTextField.setValue((licenceMetadata.getExpiryDate() == null) ? "" : formatter.format(licenceMetadata.getExpiryDate())); expiryDateTextField.setReadOnly(noUpdate); durationTextField.setReadOnly(false); durationTextField .setValue((licenceMetadata.getDuration() == null) ? "" : licenceMetadata.getDuration()); durationTextField.setReadOnly(noUpdate); licenseeTextField.setReadOnly(false); licenseeTextField .setValue((licenceMetadata.getLicensee() == null) ? "" : licenceMetadata.getLicensee()); licenseeTextField.setReadOnly(noUpdate); licensorTextField.setReadOnly(false); licensorTextField .setValue((licenceMetadata.getLicensor() == null) ? "" : licenceMetadata.getLicensor()); licensorTextField.setReadOnly(noUpdate); maxSizeSystemIdsTextField.setReadOnly(false); maxSizeSystemIdsTextField.setValue( (licenceMetadata.getMaxSizeSystemIds() == null) ? "" : licenceMetadata.getMaxSizeSystemIds()); maxSizeSystemIdsTextField.setReadOnly(noUpdate); // display systemIds if present systemIdsVerticalLayout.removeAllComponents(); // add error messages if system ids defined when not expected Label l1 = new Label(); l1.setContentMode(ContentMode.HTML); Integer licenceMetadataMaxSizeSystemIds = null; try { licenceMetadataMaxSizeSystemIds = Integer.parseInt(licenceMetadata.getMaxSizeSystemIds()); } catch (Exception e) { } if (licenceMetadataMaxSizeSystemIds == null || licenceMetadataMaxSizeSystemIds == 0) { // if maxSizeSystemIds=0 check if systemId's list has entries (an error) if (licenceMetadata.getSystemIds() == null || licenceMetadata.getSystemIds().isEmpty()) { l1.setValue("<div style=\"color: green;\">" + "All SystemId's Accepted" + "</div>"); } else { l1.setValue("<div style=\"color: red;\">" + "Licence Error: MaxSizeSystemIds=0 but " + licenceMetadata.getSystemIds().size() + " systemId's are defined" + "</div>"); } systemIdsVerticalLayout.addComponent(l1); } else if (licenceMetadata.getSystemIds() == null || licenceMetadata.getSystemIds().isEmpty()) { l1.setValue("<div style=\"color: green;\">" + "No SystemId's Defined" + "</div>"); systemIdsVerticalLayout.addComponent(l1); } else if (licenceMetadata.getSystemIds().size() > licenceMetadataMaxSizeSystemIds) { l1.setValue("<div style=\"color: red;\">Licence Error: more system id's defined in licence (" + licenceMetadata.getSystemIds().size() + ") than allowed in maxSizeSystemIds=" + licenceMetadata.getMaxSizeSystemIds() + "</div>"); systemIdsVerticalLayout.addComponent(l1); } // add system id strings if present if (licenceMetadata.getSystemIds() != null) { for (String systemId : licenceMetadata.getSystemIds()) { Label systemIdField = new Label(); systemIdField.setImmediate(true); systemIdField.setWidth("400px"); systemIdField.setHeight("-1px"); systemIdField.setValue(systemId); systemIdsVerticalLayout.addComponent(systemIdField); } } // display licence options if present licenceOptionsVerticalLayout.removeAllComponents(); if (licenceMetadata.getOptions() == null || licenceMetadata.getOptions().isEmpty()) { Label l = new Label("No Licence Options Defined"); licenceOptionsVerticalLayout.addComponent(l); } else { for (OptionMetadata option : licenceMetadata.getOptions()) { TextField optionField = new TextField(); optionField.setImmediate(true); optionField.setWidth("400px"); optionField.setHeight("-1px"); optionField.setCaption(option.getName()); optionField.setValue(option.getValue()); optionField.setDescription(option.getDescription()); optionField.setReadOnly(noUpdate); licenceOptionsVerticalLayout.addComponent(optionField); } } mainLayout.markAsDirty(); } return success; }
From source file:org.opennms.features.vaadin.pmatrix.ui.PmatrixApplication.java
License:Open Source License
@Override protected void init(VaadinRequest request) { final VerticalLayout layout = new VerticalLayout(); layout.setWidth("-1px"); layout.setHeight("-1px"); layout.setDefaultComponentAlignment(Alignment.TOP_LEFT); layout.setMargin(true);//from w w w. j a v a 2s . c o m setContent(layout); //used to test that detach events are happening addDetachListener(new DetachListener() { @Override public void detach(DetachEvent event) { LOG.debug("Pmatrix UI instance detached:" + this); } }); Component uiComponent = uiComponentFactory.getUiComponent(request); if (uiComponent == null) { StringBuilder sb = new StringBuilder( "Error: Cannot create the UI because the URL request parameters are not recognised<BR>\n" + "you need to provide atleast '?" + UiComponentFactory.COMPONENT_REQUEST_PARAMETER + "=" + UiComponentFactory.DEFAULT_COMPONENT_REQUEST_VALUE + "'<BR>\n" + "Parameters passed in URL:<BR>\n"); for (Entry<String, String[]> entry : request.getParameterMap().entrySet()) { sb.append("parameter:'" + entry.getKey() + "' value:'"); for (String s : entry.getValue()) { sb.append("{" + s + "}"); } sb.append("'<BR>\n"); } Label label = new Label(); label.setWidth("600px"); label.setContentMode(ContentMode.HTML); label.setValue(sb.toString()); layout.addComponent(label); } else { layout.addComponent(uiComponent); // refresh interval to apply to the UI int pollInterval = uiComponentFactory.getRefreshRate(); setPollInterval(pollInterval); // display poll interval in seconds DecimalFormat dformat = new DecimalFormat("##.##"); Label label = new Label(); label.setCaption("(refresh rate:" + dformat.format(pollInterval / 1000) + " seconds)"); layout.addComponent(label); } }
From source file:org.opennms.netmgt.bsm.vaadin.adminpage.BusinessServiceMainLayout.java
License:Open Source License
public BusinessServiceMainLayout(BusinessServiceManager businessServiceManager) { m_businessServiceManager = Objects.requireNonNull(businessServiceManager); m_table = new BusinessServiceTreeTable(businessServiceManager); setSizeFull();/*from w w w .j a v a 2s . c om*/ // Create button final Button createButton = UIHelper.createButton("New Business Service", null, FontAwesome.PLUS_SQUARE, (Button.ClickListener) event -> { final BusinessService businessService = m_businessServiceManager.createBusinessService(); final BusinessServiceEditWindow window = new BusinessServiceEditWindow(businessService, m_businessServiceManager); window.addCloseListener(e -> m_table.refresh()); getUI().addWindow(window); }); createButton.setId("createButton"); // Collapse all final Button collapseButton = UIHelper.createButton("Collapse All", null, FontAwesome.FOLDER, (Button.ClickListener) event -> { m_table.getContainerDataSource().getItemIds().forEach(id -> m_table.setCollapsed(id, true)); }); collapseButton.setId("collapseButton"); // Expand all final Button expandButton = UIHelper.createButton("Expand All", null, FontAwesome.FOLDER_OPEN, (Button.ClickListener) event -> { m_table.getContainerDataSource().getItemIds().forEach(id -> m_table.setCollapsed(id, false)); }); expandButton.setId("expandButton"); // Refresh final Button refreshButton = UIHelper.createButton("Refresh Table", null, FontAwesome.REFRESH, (Button.ClickListener) event -> { m_table.refresh(); }); refreshButton.setId("refreshButton"); // Reload daemon final Button reloadButton = UIHelper.createButton("Reload Daemon", "Reloads the Business Service State Machine", FontAwesome.RETWEET, (Button.ClickListener) event -> { m_businessServiceManager.triggerDaemonReload(); }); reloadButton.setId("reloadButton"); // Group the create and collapse buttons on the left HorizontalLayout leftButtonGroup = new HorizontalLayout(); leftButtonGroup.setSpacing(true); leftButtonGroup.addComponent(createButton); leftButtonGroup.addComponent(collapseButton); leftButtonGroup.addComponent(expandButton); leftButtonGroup.setDefaultComponentAlignment(Alignment.TOP_LEFT); // Group the refresh and reload buttons to the right HorizontalLayout rightButtonGroup = new HorizontalLayout(); rightButtonGroup.setSpacing(true); rightButtonGroup.addComponent(refreshButton); rightButtonGroup.addComponent(reloadButton); rightButtonGroup.setDefaultComponentAlignment(Alignment.TOP_RIGHT); // Build the upper layout HorizontalLayout upperLayout = new HorizontalLayout(); upperLayout.setSpacing(true); upperLayout.addComponent(leftButtonGroup); upperLayout.addComponent(rightButtonGroup); upperLayout.setComponentAlignment(leftButtonGroup, Alignment.TOP_LEFT); upperLayout.setComponentAlignment(rightButtonGroup, Alignment.TOP_RIGHT); upperLayout.setWidth(100, Unit.PERCENTAGE); addComponent(upperLayout); // Add some space between the upper layout and the table Label sz = new Label(""); sz.setWidth(null); sz.setHeight(5, Unit.PIXELS); addComponent(sz); /** * add the table to the layout */ addComponent(m_table); setExpandRatio(m_table, 1.0f); /** * initial refresh of table */ m_table.refresh(); }
From source file:org.opennms.netmgt.bsm.vaadin.adminpage.BusinessServiceTreeTable.java
License:Open Source License
public BusinessServiceTreeTable(BusinessServiceManager businessServiceManager) { this.businessServiceManager = Objects.requireNonNull(businessServiceManager); setSizeFull();/* w ww. ja v a2s. c o m*/ setContainerDataSource(new BusinessServiceContainer()); // Add the "LINKS" columns addGeneratedColumn("links", new Table.ColumnGenerator() { private static final long serialVersionUID = 7113848887128656685L; @Override public Object generateCell(Table source, Object itemId, Object columnId) { final HorizontalLayout layout = new HorizontalLayout(); final BusinessServiceStateMachine stateMachine = businessServiceManager.getStateMachine(); final BusinessService businessService = getItem(itemId).getBean().getBusinessService(); final Status status = stateMachine.getOperationalStatus(businessService); if (status != null) { // Build the query string final List<BasicNameValuePair> urlParms = Lists.newArrayList( new BasicNameValuePair("focus-vertices", businessService.getId().toString()), new BasicNameValuePair("szl", "1"), new BasicNameValuePair("layout", "Hierarchy Layout"), new BasicNameValuePair("provider", "Business Services")); final String queryString = URLEncodedUtils.format(urlParms, Charset.forName("UTF-8")); // Generate the link final Link link = new Link("View in Topology UI", new ExternalResource(String.format("/opennms/topology?%s", queryString))); link.setIcon(FontAwesome.EXTERNAL_LINK_SQUARE); // This app is typically access in an iframe, so we open the URL in a new window/tab link.setTargetName("_blank"); layout.addComponent(link); layout.setComponentAlignment(link, Alignment.MIDDLE_CENTER); } else { Label label = new Label("N/A"); label.setDescription("Try reloading the daemon and refreshing the table."); label.setWidth(null); layout.addComponent(label); } return layout; } }); // add edit and delete buttons addGeneratedColumn("edit / delete", new Table.ColumnGenerator() { private static final long serialVersionUID = 7113848887128656685L; @Override public Object generateCell(Table source, Object itemId, Object columnId) { HorizontalLayout layout = new HorizontalLayout(); layout.setSpacing(true); Button editButton = new Button("Edit", FontAwesome.PENCIL_SQUARE_O); editButton.setId("editButton-" + getItem(itemId).getBean().getName()); editButton.addClickListener(UIHelper.getCurrent(TransactionAwareUI.class) .wrapInTransactionProxy((Button.ClickListener) event -> { final Long businessServiceId = getItem(itemId).getBean().getBusinessService().getId(); BusinessService businessService = businessServiceManager .getBusinessServiceById(businessServiceId); final BusinessServiceEditWindow window = new BusinessServiceEditWindow(businessService, businessServiceManager); window.addCloseListener(e -> refresh()); getUI().addWindow(window); })); layout.addComponent(editButton); Button deleteButton = new Button("Delete", FontAwesome.TRASH_O); deleteButton.setId("deleteButton-" + getItem(itemId).getBean().getName()); deleteButton.addClickListener((Button.ClickListener) event -> { final Long businessServiceId = getItem(itemId).getBean().getBusinessService().getId(); BusinessService businessService = businessServiceManager .getBusinessServiceById(businessServiceId); if (businessService.getParentServices().isEmpty() && businessService.getChildEdges().isEmpty()) { UIHelper.getCurrent(TransactionAwareUI.class).runInTransaction(() -> { businessServiceManager.getBusinessServiceById(businessServiceId).delete(); refresh(); }); } else { new org.opennms.netmgt.vaadin.core.ConfirmationDialog() .withOkAction((org.opennms.netmgt.vaadin.core.ConfirmationDialog.Action) UIHelper .getCurrent(TransactionAwareUI.class).wrapInTransactionProxy( new org.opennms.netmgt.vaadin.core.ConfirmationDialog.Action() { @Override public void execute( org.opennms.netmgt.vaadin.core.ConfirmationDialog window) { businessServiceManager .getBusinessServiceById(businessServiceId).delete(); refresh(); } })) .withOkLabel("Delete anyway").withCancelLabel("Cancel").withCaption("Warning") .withDescription( "This entry is referencing or is referenced by other Business Services! Do you really want to delete this entry?") .open(); } }); layout.addComponent(deleteButton); return layout; } }); setColumnExpandRatio("name", 5); setColumnExpandRatio("links", 1); setColumnExpandRatio("edit / delete", 1); }
From source file:org.ow2.sirocco.cloudmanager.AddressView.java
License:Open Source License
public AddressView() { this.setSizeFull(); HorizontalLayout actionButtonHeader = new HorizontalLayout(); actionButtonHeader.setMargin(true);/*from w w w.j a va 2 s . co m*/ actionButtonHeader.setSpacing(true); actionButtonHeader.setWidth("100%"); actionButtonHeader.setHeight("50px"); Button button = new Button("Allocate Address..."); button.setIcon(new ThemeResource("img/add.png")); button.addClickListener(new ClickListener() { @Override public void buttonClick(final ClickEvent event) { if (AddressView.this.addressAllocationWizard.init(AddressView.this)) { UI.getCurrent().addWindow(AddressView.this.addressAllocationWizard); } } }); actionButtonHeader.addComponent(button); this.associateAddressButton = new Button("Associate"); this.associateAddressButton.setEnabled(false); this.associateAddressButton.addClickListener(new ClickListener() { @Override public void buttonClick(final ClickEvent event) { Set<?> selectedAddressIds = (Set<?>) AddressView.this.addressTable.getValue(); final String addressId = (String) Iterables.getOnlyElement(selectedAddressIds); List<AddressAssociateDialog.MachineChoice> choices = new ArrayList<>(); Address address = null; try { address = AddressView.this.networkManager.getAddressByUuid(addressId); List<Machine> machines = AddressView.this.machineManager.getMachines( new QueryParams.Builder().filterByProvider(address.getCloudProviderAccount().getUuid()) .filterByLocation(address.getLocation().getUuid()).build()) .getItems(); for (Machine machine : machines) { MachineChoice machineChoice = new MachineChoice(); machineChoice.id = machine.getUuid(); machineChoice.name = machine.getName(); choices.add(machineChoice); } } catch (CloudProviderException e) { Util.diplayErrorMessageBox("Internal error", e); } final String ipAddress = address.getIp(); AddressAssociateDialog addressAssociateDialog = new AddressAssociateDialog(choices, new AddressAssociateDialog.DialogCallback() { @Override public void response(final String machineId) { try { AddressView.this.networkManager.addAddressToMachine(machineId, ipAddress); } catch (CloudProviderException e) { Util.diplayErrorMessageBox("Address association failure", e); } } }); UI.getCurrent().addWindow(addressAssociateDialog); } }); actionButtonHeader.addComponent(this.associateAddressButton); this.disassociateAddressButton = new Button("Disassociate"); this.disassociateAddressButton.setEnabled(false); this.disassociateAddressButton.addClickListener(new ClickListener() { @Override public void buttonClick(final ClickEvent event) { Set<?> selectedAddressIds = (Set<?>) AddressView.this.addressTable.getValue(); String addressId = (String) selectedAddressIds.iterator().next(); try { Address address = AddressView.this.networkManager.getAddressByUuid(addressId); AddressView.this.networkManager.removeAddressFromMachine(address.getResource().getUuid(), address.getIp()); } catch (CloudProviderException e) { Util.diplayErrorMessageBox("Address disassociation failure", e); } } }); actionButtonHeader.addComponent(this.disassociateAddressButton); this.releaseAddressButton = new Button("Release"); this.releaseAddressButton.setIcon(new ThemeResource("img/delete.png")); this.releaseAddressButton.setEnabled(false); this.releaseAddressButton.addClickListener(new ClickListener() { @Override public void buttonClick(final ClickEvent event) { final Set<?> selectedAddressIds = (Set<?>) AddressView.this.addressTable.getValue(); String ip = AddressView.this.addresses.getItem(selectedAddressIds.iterator().next()).getBean() .getIp(); ConfirmDialog confirmDialog = ConfirmDialog.newConfirmDialog("Release Address", "Are you sure you want to release address " + ip + " ?", new ConfirmDialog.ConfirmationDialogCallback() { @Override public void response(final boolean ok, final boolean ignored) { if (ok) { for (Object id : selectedAddressIds) { try { AddressView.this.networkManager.deleteAddress(id.toString()); } catch (CloudProviderException e) { Util.diplayErrorMessageBox("Address delete failure", e); } } AddressView.this.refresh(); } } }); AddressView.this.getUI().addWindow(confirmDialog); } }); actionButtonHeader.addComponent(this.releaseAddressButton); Label spacer = new Label(); spacer.setWidth("100%"); actionButtonHeader.addComponent(spacer); actionButtonHeader.setExpandRatio(spacer, 1.0f); button = new Button("Refresh", new ClickListener() { @Override public void buttonClick(final ClickEvent event) { AddressView.this.refresh(); } }); button.setIcon(new ThemeResource("img/refresh.png")); actionButtonHeader.addComponent(button); this.addComponent(actionButtonHeader); this.addComponent(this.addressTable = this.createAddressTable()); this.setExpandRatio(this.addressTable, 1.0f); }