/** * Creates a new instance of Label with text-contents. * * @param content * @param contentMode */ public Label(String content, ContentMode contentMode) { setValue(content); setContentMode(contentMode); setWidth(100, Unit.PERCENTAGE); }
/** * Creates a new instance of Label with text-contents read from given * datasource. * * @param contentSource * @param contentMode */ public Label(Property contentSource, ContentMode contentMode) { setPropertyDataSource(contentSource); setContentMode(contentMode); setWidth(100, Unit.PERCENTAGE); }
private void refreshInfoArea() { removeAllComponents(); if (expanded) { staticComponents.forEach(this::addComponent); dynamicComponents.forEach(this::addComponent); // Add an empty component with width = 350px to always force the max length // This is required as otherwise the left area of the info panel would be empty, even if the info panel // is not shown. Label label = new Label(); label.setWidth(350, Unit.PIXELS); addComponent(label); // Add a graph container to trigger backshift graph renderings on each update addComponent(new InlineGraphContainer()); } else { addComponent(toggleButton); } }
private Layout createMainArea(final String description) { HorizontalLayout layout = new HorizontalLayout(); layout.setSpacing(true); layout.setMargin(true); layout.setWidth(100, Unit.PERCENTAGE); Label label = new Label(description, ContentMode.PREFORMATTED); label.setWidth(100, Unit.PERCENTAGE); layout.addComponent(label); return layout; }
/** * Adds a component to a given vertical layout and applies some sizing and formatting options. * * @param verticalLayout the vertical layout * @param component the component to be added */ private void addToComponent(VerticalLayout verticalLayout, Component component) { HorizontalLayout horizontalLayout = new HorizontalLayout(); horizontalLayout.setWidth(100, Unit.PERCENTAGE); Label label = new Label(component.getCaption()); label.setWidth(200, Unit.PIXELS); component.setSizeFull(); component.setCaption(null); horizontalLayout.addComponent(label); horizontalLayout.addComponent(component); horizontalLayout.setExpandRatio(component, 1.0f); verticalLayout.addComponent(horizontalLayout); }
@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) { final String topologyLink = new TopologyLinkBuilder() .focus(businessService.getId().toString()) .szl(1) .layout(Layout.HIERARCHY) .provider(TopologyProvider.BUSINESS_SERVICE) .getLink(); // Generate the link final Link link = new Link("View in Topology UI", new ExternalResource(topologyLink)); 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; } });
private Component getLegend(String entity) { HorizontalLayout horizontalLayout = new HorizontalLayout(); horizontalLayout.setSpacing(true); horizontalLayout.addStyleName("summary"); horizontalLayout.addStyleName("global"); Label labelx = new Label(entity); labelx.addStyleName("summary-font-legend"); Image ackdImage = new Image(null, new ThemeResource("img/acknowledged.png")); ackdImage.setWidth(16, Sizeable.Unit.PIXELS); Image unackdImage = new Image(null, new ThemeResource("img/unacknowledged.png")); unackdImage.setWidth(16, Sizeable.Unit.PIXELS); Label dummyLabel = new Label(); dummyLabel.setWidth(32, Sizeable.Unit.PIXELS); horizontalLayout.addComponent(labelx); horizontalLayout.addComponent(ackdImage); horizontalLayout.addComponent(unackdImage); horizontalLayout.addComponent(dummyLabel); horizontalLayout.setComponentAlignment(ackdImage, Alignment.TOP_RIGHT); horizontalLayout.setComponentAlignment(unackdImage, Alignment.TOP_RIGHT); horizontalLayout.setExpandRatio(labelx, 4.0f); horizontalLayout.setExpandRatio(ackdImage, 1.0f); horizontalLayout.setExpandRatio(unackdImage, 1.0f); horizontalLayout.setExpandRatio(dummyLabel, 1.0f); horizontalLayout.setWidth(375, Sizeable.Unit.PIXELS); return horizontalLayout; }
sz.setWidth(null); sz.setHeight(5, Unit.PIXELS); addComponent(sz);