List of usage examples for com.vaadin.ui Label setSizeUndefined
@Override public void setSizeUndefined()
From source file:org.milleni.dunning.ui.prcstart.TaskViewPanel.java
License:Apache License
protected void initPageTitle() { HorizontalLayout layout = createHorizontalLayout(); addDetailComponent(layout);//from w w w. j a v a 2 s.com Embedded databaseImage = new Embedded(null, Images.DATABASE_50); layout.addComponent(databaseImage); Label groupName = new Label("Task Durum Sorgula"); groupName.setSizeUndefined(); groupName.addStyleName(Reindeer.LABEL_H2); layout.addComponent(groupName); layout.setComponentAlignment(groupName, Alignment.MIDDLE_LEFT); layout.setExpandRatio(groupName, 1.0f); BeanItemContainer<DunningPolicy> objects = new BeanItemContainer(TaskDefObject.class, taskDefs); taskDefCombo = new ComboBox("Tasklar", objects); taskDefCombo.setItemCaptionPropertyId("desc"); taskDefCombo.addListener(new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { selectedTaskDef = (TaskDefObject) event.getProperty().getValue(); } }); }
From source file:org.openeos.services.ui.vaadin.internal.notifications.VaadinNotificationManager.java
License:Apache License
private void refreshLayout(final IUnoVaadinApplication application, HorizontalLayout layout) { layout.removeAllComponents();// w w w . jav a 2 s. co m for (final Notification notification : resolveAndSortNotifications(application)) { VerticalLayout vLayout = new VerticalLayout(); vLayout.setMargin(false); vLayout.setSpacing(false); Button button = new Button(); button.addListener(new Button.ClickListener() { private static final long serialVersionUID = 3202745949615598633L; @Override public void buttonClick(ClickEvent event) { notification.onClick(applicationFactory.createApplication(application)); ; } }); button.setStyleName(Reindeer.BUTTON_LINK); button.setIcon(createIconResource(application, notification)); button.setDescription(notification.getText()); //createOverlay(application, notification, button, layout); vLayout.addComponent(button); if (notification.getNumber() != null) { Label label = new Label(notification.getNumber().toString()); label.setSizeUndefined(); vLayout.addComponent(label); vLayout.setComponentAlignment(label, Alignment.MIDDLE_CENTER); } layout.addComponent(vLayout); } }
From source file:org.opennms.features.vaadin.dashboard.dashlets.AlarmDetailsDashlet.java
License:Open Source License
/** * Returns the component for visualising the alarms data. * * @param onmsAlarm an {@link OnmsAlarm} instance * @param onmsNode an {@link OnmsNode} instance * @return component for this alarm/*from w w w .java 2s. com*/ */ @Deprecated public Component createAlarmComponent(OnmsAlarm onmsAlarm, OnmsNode onmsNode) { HorizontalLayout horizontalLayout = new HorizontalLayout(); horizontalLayout.setSizeFull(); horizontalLayout.addStyleName("alert-details"); horizontalLayout.addStyleName("alert-details-font"); horizontalLayout.addStyleName(onmsAlarm.getSeverity().name().toLowerCase()); VerticalLayout verticalLayout1 = new VerticalLayout(); VerticalLayout verticalLayout2 = new VerticalLayout(); horizontalLayout.addComponent(verticalLayout1); horizontalLayout.addComponent(verticalLayout2); Label lastEvent = new Label(); lastEvent.setSizeUndefined(); lastEvent.addStyleName("alert-details-font"); lastEvent.setCaption("Last event"); lastEvent.setValue(onmsAlarm.getLastEventTime().toString()); Label firstEvent = new Label(); firstEvent.setSizeUndefined(); firstEvent.addStyleName("alert-details-font"); firstEvent.setCaption("First event"); firstEvent.setValue(onmsAlarm.getFirstEventTime().toString()); verticalLayout1.addComponent(firstEvent); verticalLayout1.addComponent(lastEvent); Label nodeId = new Label(); nodeId.setSizeUndefined(); nodeId.addStyleName("alert-details-font"); nodeId.setCaption("Node Id"); if (onmsNode != null) { nodeId.setValue(onmsNode.getNodeId()); } else { nodeId.setValue("-"); } Label nodeLabel = new Label(); nodeLabel.setSizeUndefined(); nodeLabel.addStyleName("alert-details-font"); nodeLabel.setCaption("Node Label"); if (onmsNode != null) { nodeLabel.setValue(onmsNode.getLabel()); } else { nodeLabel.setValue("-"); } Label logMessage = new Label(); logMessage.addStyleName("alert-details-font"); logMessage.setSizeFull(); logMessage.setCaption("Log message"); logMessage.setValue(onmsAlarm.getLogMsg().replaceAll("<[^>]*>", "")); HorizontalLayout horizontalLayout2 = new HorizontalLayout(); horizontalLayout2.setSizeFull(); horizontalLayout2.setSpacing(true); horizontalLayout2.addComponent(nodeId); horizontalLayout2.addComponent(nodeLabel); verticalLayout2.addComponent(horizontalLayout2); verticalLayout2.addComponent(logMessage); horizontalLayout.setExpandRatio(verticalLayout1, 1.0f); horizontalLayout.setExpandRatio(verticalLayout2, 4.0f); return horizontalLayout; }
From source file:org.opennms.features.vaadin.dashboard.dashlets.AlarmsDashlet.java
License:Open Source License
/** * Returns the component for visualising the alarms data. * * @param onmsAlarm an {@link OnmsAlarm} instance * @param onmsNode an {@link OnmsNode} instance * @return component for this alarm//ww w .j a v a 2s . c o m */ public Component createAlarmComponent(OnmsAlarm onmsAlarm, OnmsNode onmsNode) { Calendar calendar = Calendar.getInstance(); String ago = getHumanReadableFormat( (calendar.getTimeInMillis() / 1000) - (onmsAlarm.getLastEventTime().getTime() / 1000)); HorizontalLayout horizontalLayout = new HorizontalLayout(); horizontalLayout.setWidth("100%"); horizontalLayout.addStyleName("alerts"); horizontalLayout.addStyleName(onmsAlarm.getSeverity().name().toLowerCase()); Label labelAgo = new Label(); labelAgo.setSizeUndefined(); labelAgo.addStyleName("alerts-font"); labelAgo.setValue(ago); Label labelId = new Label(); labelId.setSizeUndefined(); labelId.addStyleName("alerts-font"); if (onmsNode != null) { labelId.setValue(onmsNode.getLabel() + " (" + onmsNode.getNodeId() + ")"); } else { labelId.setValue("-"); } Label labelUei = new Label(); labelUei.setSizeUndefined(); labelUei.addStyleName("alerts-font"); labelUei.setValue(onmsAlarm.getUei()); horizontalLayout.addComponent(labelAgo); horizontalLayout.addComponent(labelId); horizontalLayout.addComponent(labelUei); horizontalLayout.setExpandRatio(labelAgo, 1.0f); horizontalLayout.setExpandRatio(labelId, 3.0f); horizontalLayout.setExpandRatio(labelUei, 3.0f); return horizontalLayout; }
From source file:org.opennms.features.vaadin.dashboard.dashlets.SummaryDashlet.java
License:Open Source License
/** * Returns the component showing the alarms and the trends by severity * * @return the {@link Component}// w w w . ja v a 2s . c o m */ private Component getComponentSeverity(int width) { VerticalLayout verticalLayout = new VerticalLayout(); int overallSum = 0; int severitySum = 0; verticalLayout.addComponent(getLegend("Severity")); for (OnmsSeverity onmsSeverity : OnmsSeverity.values()) { HorizontalLayout horizontalLayout = new HorizontalLayout(); horizontalLayout.setSpacing(true); horizontalLayout.addStyleName("summary"); horizontalLayout.addStyleName(onmsSeverity.name().toLowerCase()); int acknowledged = countBySeverity(true, m_timeslot, onmsSeverity); int notAcknowledged = countBySeverity(false, m_timeslot, onmsSeverity); Label labelSeverity = new Label(onmsSeverity.getLabel()); labelSeverity.addStyleName("summary-font"); Label labelAcknowledge = new Label(String.valueOf(acknowledged)); labelAcknowledge.addStyleName("summary-font"); Label labelNotAcknowledged = new Label(String.valueOf(notAcknowledged)); labelNotAcknowledged.addStyleName("summary-font"); horizontalLayout.addComponent(labelSeverity); horizontalLayout.addComponent(labelAcknowledge); horizontalLayout.addComponent(labelNotAcknowledged); int status = computeTrend(acknowledged, notAcknowledged); severitySum += onmsSeverity.getId(); overallSum += onmsSeverity.getId() * status; Image image = new Image(null, new ThemeResource("img/a" + status + ".png")); image.setWidth(width, Sizeable.Unit.PIXELS); horizontalLayout.addComponent(image); horizontalLayout.setExpandRatio(labelSeverity, 4.0f); horizontalLayout.setExpandRatio(labelAcknowledge, 1.0f); horizontalLayout.setExpandRatio(labelNotAcknowledged, 1.0f); horizontalLayout.setExpandRatio(image, 1.0f); horizontalLayout.setComponentAlignment(image, Alignment.TOP_CENTER); horizontalLayout.setWidth(375, Sizeable.Unit.PIXELS); verticalLayout.addComponent(horizontalLayout); } int globalTrend = (int) Math.max(0, Math.min(4, Math.round(((double) overallSum) / ((double) severitySum)))); Image image = new Image(null, new ThemeResource("img/a" + globalTrend + ".png")); image.setWidth(width * 8, Sizeable.Unit.PIXELS); VerticalLayout globalTrendLayout = new VerticalLayout(); globalTrendLayout.setSpacing(true); globalTrendLayout.addStyleName("summary"); globalTrendLayout.addStyleName("global"); globalTrendLayout.setSizeFull(); Label labelTitle = new Label("Alarms trend by severity"); labelTitle.addStyleName("summary-font"); labelTitle.setSizeUndefined(); Label labelTimeslot = new Label("(" + getHumanReadableFormat(m_timeslot) + ")"); labelTimeslot.addStyleName("summary-font"); labelTimeslot.setSizeUndefined(); globalTrendLayout.addComponent(labelTitle); globalTrendLayout.addComponent(labelTimeslot); globalTrendLayout.addComponent(image); globalTrendLayout.setWidth(375, Sizeable.Unit.PIXELS); globalTrendLayout.setComponentAlignment(labelTitle, Alignment.MIDDLE_CENTER); globalTrendLayout.setComponentAlignment(labelTimeslot, Alignment.MIDDLE_CENTER); globalTrendLayout.setComponentAlignment(image, Alignment.MIDDLE_CENTER); globalTrendLayout.setExpandRatio(labelTitle, 1.0f); verticalLayout.addComponent(globalTrendLayout, 0); m_boosted = (globalTrend > 2); return verticalLayout; }
From source file:org.opennms.features.vaadin.dashboard.dashlets.SummaryDashlet.java
License:Open Source License
/** * Returns the component showing the alarms and the trends by severity * * @return the {@link Component}//from www.j av a 2 s. co m */ private Component getComponentUei(int width) { VerticalLayout verticalLayout = new VerticalLayout(); int overallSum = 0; int severitySum = 0; verticalLayout.addComponent(getLegend("UEI")); String[] ueis = { "uei.opennms.org/nodes/nodeLostService", "uei.opennms.org/nodes/interfaceDown", "uei.opennms.org/nodes/nodeDown" }; for (int i = 0; i < ueis.length; i++) { String uei = ueis[i]; HorizontalLayout horizontalLayout = new HorizontalLayout(); horizontalLayout.setSpacing(true); horizontalLayout.addStyleName("summary"); if (i == 0) { horizontalLayout.addStyleName(OnmsSeverity.MINOR.name().toLowerCase()); } else { if (i == 1) { horizontalLayout.addStyleName(OnmsSeverity.MINOR.name().toLowerCase()); } else { horizontalLayout.addStyleName(OnmsSeverity.MAJOR.name().toLowerCase()); } } int acknowledged = countByUei(true, m_timeslot, uei); int notAcknowledged = countByUei(false, m_timeslot, uei); Label labelSeverity = new Label(uei.replace("uei.opennms.org/nodes/", "")); labelSeverity.addStyleName("summary-font"); Label labelAcknowledge = new Label(String.valueOf(acknowledged)); labelAcknowledge.addStyleName("summary-font"); Label labelNotAcknowledged = new Label(String.valueOf(notAcknowledged)); labelNotAcknowledged.addStyleName("summary-font"); horizontalLayout.addComponent(labelSeverity); horizontalLayout.addComponent(labelAcknowledge); horizontalLayout.addComponent(labelNotAcknowledged); int status = computeTrend(acknowledged, notAcknowledged); severitySum += i; overallSum += i * status; Image image = new Image(null, new ThemeResource("img/a" + status + ".png")); image.setWidth(width, Sizeable.Unit.PIXELS); horizontalLayout.addComponent(image); horizontalLayout.setExpandRatio(labelSeverity, 4.0f); horizontalLayout.setExpandRatio(labelAcknowledge, 1.0f); horizontalLayout.setExpandRatio(labelNotAcknowledged, 1.0f); horizontalLayout.setExpandRatio(image, 1.0f); horizontalLayout.setComponentAlignment(image, Alignment.TOP_CENTER); horizontalLayout.setWidth(375, Sizeable.Unit.PIXELS); verticalLayout.addComponent(horizontalLayout); } int globalTrend = (int) Math.max(0, Math.min(4, Math.round(((double) overallSum) / ((double) severitySum)))); Image image = new Image(null, new ThemeResource("img/a" + globalTrend + ".png")); image.setWidth(width * 8, Sizeable.Unit.PIXELS); VerticalLayout globalTrendLayout = new VerticalLayout(); globalTrendLayout.setSpacing(true); globalTrendLayout.addStyleName("summary"); globalTrendLayout.addStyleName("global"); globalTrendLayout.setSizeFull(); Label labelTitle = new Label("Alarms trend by UEI"); labelTitle.addStyleName("summary-font"); labelTitle.setSizeUndefined(); Label labelTimeslot = new Label("(" + getHumanReadableFormat(m_timeslot) + ")"); labelTimeslot.addStyleName("summary-font"); labelTimeslot.setSizeUndefined(); globalTrendLayout.addComponent(labelTitle); globalTrendLayout.addComponent(labelTimeslot); globalTrendLayout.addComponent(image); globalTrendLayout.setWidth(375, Sizeable.Unit.PIXELS); globalTrendLayout.setComponentAlignment(labelTitle, Alignment.MIDDLE_CENTER); globalTrendLayout.setComponentAlignment(labelTimeslot, Alignment.MIDDLE_CENTER); globalTrendLayout.setComponentAlignment(image, Alignment.MIDDLE_CENTER); globalTrendLayout.setExpandRatio(labelTitle, 1.0f); verticalLayout.addComponent(globalTrendLayout, 0); m_boosted = (globalTrend > 2); return verticalLayout; }
From source file:org.plukh.fluffymeow.ui.MainView.java
License:Open Source License
public MainView() { setSizeFull();//from ww w . ja v a 2 s. c o m Label label = new Label("Main View will be here"); label.setSizeUndefined(); addComponent(label); setComponentAlignment(label, Alignment.MIDDLE_CENTER); }
From source file:org.plukh.fluffymeow.ui.user.UserAccountView.java
License:Open Source License
public UserAccountView() { log.trace("Creating user account view..."); setSizeFull();//from w ww. ja v a2 s . c o m Label label = new Label("Account View will be here"); label.setSizeUndefined(); addComponent(label); setComponentAlignment(label, Alignment.MIDDLE_CENTER); log.debug("User account view created"); }
From source file:org.plukh.fluffymeow.ui.user.UserRegistrationView.java
License:Open Source License
public UserRegistrationView() { log.trace("Creating user registration view..."); setSizeFull();//from www . j a v a 2 s. c o m Label label = new Label("Registration View will be here"); label.setSizeUndefined(); addComponent(label); setComponentAlignment(label, Alignment.MIDDLE_CENTER); log.debug("User registration view created"); }
From source file:org.rapidpm.jumpstart.vaadin.ui.basics.RapidTopPanel.java
License:Apache License
@PostConstruct private void createIconsLayout() { iconsLayout.setWidth("100%"); iconsLayout.setMargin(new MarginInfo(false, false, false, false)); if (propertyService.hasKey("app.logo")) { final String resourceName = propertyService.resolve("app.logo"); final Image iconLeft = new Image(null, new ClassResource(resourceName)); final Image iconRight = new Image(null, new ClassResource(resourceName)); iconsLayout.addComponent(iconLeft); iconsLayout.setComponentAlignment(iconLeft, Alignment.TOP_LEFT); if (propertyService.hasKey("app.version")) { final Label versionLabel = new Label(propertyService.resolve("app.version")); versionLabel.setSizeUndefined(); iconsLayout.addComponent(versionLabel); iconsLayout.setComponentAlignment(versionLabel, Alignment.MIDDLE_CENTER); iconsLayout.setExpandRatio(versionLabel, 1.0f); }//from ww w . j a v a 2 s . c o m iconsLayout.addComponent(iconRight); iconsLayout.setComponentAlignment(iconRight, Alignment.TOP_RIGHT); } }