List of usage examples for com.vaadin.ui Label setContentMode
public void setContentMode(ContentMode contentMode)
From source file:org.activiti.explorer.ui.task.HistoricTaskDetailPanel.java
License:Apache License
protected void initHeader() { GridLayout taskDetails = new GridLayout(5, 2); taskDetails.setWidth(100, UNITS_PERCENTAGE); taskDetails.addStyleName(ExplorerLayout.STYLE_TITLE_BLOCK); taskDetails.setSpacing(true);/*from w w w . j a v a 2s.com*/ taskDetails.setMargin(false, false, true, false); // Add image Embedded image = new Embedded(null, Images.TASK_50); taskDetails.addComponent(image, 0, 0, 0, 1); // Add task name Label nameLabel = new Label(historicTask.getName()); nameLabel.addStyleName(Reindeer.LABEL_H2); taskDetails.addComponent(nameLabel, 1, 0, 4, 0); // Add due date PrettyTimeLabel dueDateLabel = new PrettyTimeLabel(i18nManager.getMessage(Messages.TASK_DUEDATE_SHORT), historicTask.getDueDate(), i18nManager.getMessage(Messages.TASK_DUEDATE_UNKNOWN), false); dueDateLabel.addStyleName(ExplorerLayout.STYLE_TASK_HEADER_DUEDATE); taskDetails.addComponent(dueDateLabel, 1, 1); // Add priority Integer lowMedHighPriority = convertPriority(historicTask.getPriority()); Label priorityLabel = new Label(); switch (lowMedHighPriority) { case 1: priorityLabel.setValue(i18nManager.getMessage(Messages.TASK_PRIORITY_LOW)); priorityLabel.addStyleName(ExplorerLayout.STYLE_TASK_HEADER_PRIORITY_LOW); break; case 2: priorityLabel.setValue(i18nManager.getMessage(Messages.TASK_PRIORITY_MEDIUM)); priorityLabel.addStyleName(ExplorerLayout.STYLE_TASK_HEADER_PRIORITY_MEDIUM); break; case 3: default: priorityLabel.setValue(i18nManager.getMessage(Messages.TASK_PRIORITY_HIGH)); priorityLabel.addStyleName(ExplorerLayout.STYLE_TASK_HEADER_PRIORITY_HIGH); } taskDetails.addComponent(priorityLabel, 2, 1); // Add create date PrettyTimeLabel createLabel = new PrettyTimeLabel(i18nManager.getMessage(Messages.TASK_CREATED_SHORT), historicTask.getStartTime(), "", true); createLabel.addStyleName(ExplorerLayout.STYLE_TASK_HEADER_CREATE_TIME); taskDetails.addComponent(createLabel, 3, 1); // Add label to fill excess space Label spacer = new Label(); spacer.setContentMode(Label.CONTENT_XHTML); spacer.setValue(" "); spacer.setSizeUndefined(); taskDetails.addComponent(spacer); taskDetails.setColumnExpandRatio(1, 1.0f); taskDetails.setColumnExpandRatio(2, 1.0f); taskDetails.setColumnExpandRatio(3, 1.0f); taskDetails.setColumnExpandRatio(4, 1.0f); centralLayout.addComponent(taskDetails); }
From source file:org.apache.ace.webui.vaadin.Activator.java
License:Apache License
@Override public void init(BundleContext context, DependencyManager manager) throws Exception { manager.add(createComponent().setImplementation(VaadinResourceHandler.class) .add(createServiceDependency().setService(HttpService.class).setRequired(true))); Properties props = new Properties(); // ACE-472 - put Vaadin in production mode... props.put("init.productionMode", "true"); // register the main application for the ACE UI client manager.add(createComponent().setInterface(Servlet.class.getName(), props) .setImplementation(VaadinServlet.class) .add(createConfigurationDependency().setPid(PID).setPropagate(true))); props = new Properties(); props.put(UIExtensionFactory.EXTENSION_POINT_KEY, UIExtensionFactory.EXTENSION_POINT_VALUE_TARGET); props.put(Constants.SERVICE_RANKING, Integer.valueOf(100)); // shows off components that are contributed by extensions manager.add(createComponent().setInterface(UIExtensionFactory.class.getName(), props) .setImplementation(new UIExtensionFactory() { public Component create(Map<String, Object> context) { VerticalLayout vl = new VerticalLayout(); vl.setCaption("Info"); final StatefulTargetObject target = (StatefulTargetObject) context.get("statefulTarget"); Label info = new Label( "Target ID : " + target.getID() + "\n" + "Installed version : " + (target.getLastInstallVersion() == null ? "(none)" : target.getLastInstallVersion()) + "\n" + "Available version : " + target.getCurrentVersion() + "\n" + "Approval state : " + target.getApprovalState() + "\n" + "Store state : " + target.getStoreState() + "\n" + "Provisioning state : " + target.getProvisioningState() + "\n" + "Registration state : " + target.getRegistrationState()); info.setContentMode(Label.CONTENT_PREFORMATTED); vl.addComponent(info); return vl; }// w w w . j a v a 2 s . com })); }
From source file:org.apache.ace.webui.vaadin.VaadinClient.java
License:Apache License
public void init() { setTheme("ace"); if (!m_dependenciesResolved.get()) { final Window message = new Window("Apache ACE"); message.getContent().setSizeFull(); setMainWindow(message);/*from www . j a v a 2s . c o m*/ Label richText = new Label("<h1>Apache ACE User Interface</h1>" + "<p>Due to missing component dependencies on the server, probably due to misconfiguration, " + "the user interface cannot be properly started. Please contact your server administrator. " + "You can retry accessing the user interface by <a href=\"?restartApplication\">following this link</a>.</p>"); richText.setContentMode(Label.CONTENT_XHTML); // TODO we might want to add some more details here as to what's // missing on the other hand, the user probably can't fix that anyway message.addComponent(richText); return; } m_mainWindow = new Window("Apache ACE"); m_mainWindow.getContent().setSizeFull(); m_mainWindow.setBorder(Window.BORDER_NONE); setMainWindow(m_mainWindow); // Authenticate the user either by showing a login window; or by another means... authenticate(); }
From source file:org.eclipse.hawkbit.ui.artifacts.upload.UploadConfirmationWindow.java
License:Open Source License
private static Label getWarningLabel() { final Label warningIconLabel = new Label(); warningIconLabel.addStyleName(ValoTheme.LABEL_SMALL); warningIconLabel.setHeightUndefined(); warningIconLabel.setContentMode(ContentMode.HTML); warningIconLabel.setValue(FontAwesome.WARNING.getHtml()); warningIconLabel.addStyleName("warningLabel"); warningIconLabel.setVisible(false);/* w ww. j av a2 s.c om*/ return warningIconLabel; }
From source file:org.eclipse.hawkbit.ui.filtermanagement.AutoCompleteTextFieldComponent.java
License:Open Source License
private static Label createStatusIcon() { final Label statusIcon = new Label(); statusIcon.setImmediate(true);//from w ww . j av a 2 s . com statusIcon.setContentMode(ContentMode.HTML); statusIcon.setSizeFull(); setInitialStatusIconStyle(statusIcon); statusIcon.setId(UIComponentIdProvider.VALIDATION_STATUS_ICON_ID); return statusIcon; }
From source file:org.eclipse.hawkbit.ui.filtermanagement.CreateOrUpdateFilterTable.java
License:Open Source License
private Component getStatusIcon(final Object itemId) { final Item row1 = getItem(itemId); final TargetUpdateStatus targetStatus = (TargetUpdateStatus) row1 .getItemProperty(SPUILabelDefinitions.VAR_TARGET_STATUS).getValue(); final Label label = new LabelBuilder().name("").buildLabel(); label.setContentMode(ContentMode.HTML); if (targetStatus == TargetUpdateStatus.PENDING) { label.setDescription(i18n.getMessage(UIMessageIdProvider.TOOLTIP_STATUS_PENDING)); label.setStyleName(SPUIStyleDefinitions.STATUS_ICON_YELLOW); label.setValue(FontAwesome.ADJUST.getHtml()); } else if (targetStatus == TargetUpdateStatus.REGISTERED) { label.setDescription(i18n.getMessage(UIMessageIdProvider.TOOLTIP_STATUS_REGISTERED)); label.setStyleName(SPUIStyleDefinitions.STATUS_ICON_LIGHT_BLUE); label.setValue(FontAwesome.DOT_CIRCLE_O.getHtml()); } else if (targetStatus == TargetUpdateStatus.ERROR) { label.setDescription(i18n.getMessage(i18n.getMessage(UIMessageIdProvider.TOOLTIP_STATUS_ERROR))); label.setStyleName(SPUIStyleDefinitions.STATUS_ICON_RED); label.setValue(FontAwesome.EXCLAMATION_CIRCLE.getHtml()); } else if (targetStatus == TargetUpdateStatus.IN_SYNC) { label.setStyleName(SPUIStyleDefinitions.STATUS_ICON_GREEN); label.setDescription(i18n.getMessage(UIMessageIdProvider.TOOLTIP_STATUS_INSYNC)); label.setValue(FontAwesome.CHECK_CIRCLE.getHtml()); } else if (targetStatus == TargetUpdateStatus.UNKNOWN) { label.setStyleName(SPUIStyleDefinitions.STATUS_ICON_BLUE); label.setDescription(i18n.getMessage(UIMessageIdProvider.TOOLTIP_TARGET_STATUS_UNKNOWN)); label.setValue(FontAwesome.QUESTION_CIRCLE.getHtml()); }//from ww w . ja va 2s . co m return label; }
From source file:org.eclipse.hawkbit.ui.management.actionhistory.ActionHistoryTable.java
License:Open Source License
private Component getForcedColumn(final Object itemId) { final Action actionWithActiveStatus = (Action) hierarchicalContainer.getItem(itemId) .getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_FORCED).getValue(); final Label actionLabel = new LabelBuilder().name("").buildCaptionLabel(); actionLabel.setContentMode(ContentMode.HTML); actionLabel.setStyleName("action-history-table-col-forced-label"); if (actionWithActiveStatus != null && actionWithActiveStatus.getActionType() == ActionType.FORCED) { actionLabel.setValue(FontAwesome.BOLT.getHtml()); // setted Id for Forced. actionLabel.setId("action.history.table.forcedId"); } else if (actionWithActiveStatus != null && actionWithActiveStatus.getActionType() == ActionType.TIMEFORCED) { return actionLabelWithTimeForceIcon(actionWithActiveStatus, actionLabel); }/* w ww. ja v a 2s .c om*/ return actionLabel; }
From source file:org.eclipse.hawkbit.ui.management.actionhistory.ActionHistoryTable.java
License:Open Source License
/** * Get status icon.// w w w. ja va 2 s.co m * * @param status * as Status * @return Label as UI */ private Label getStatusIcon(final Action.Status status) { final Label label = new LabelBuilder().name("").buildLabel(); final String statusIconPending = "statusIconPending"; label.setContentMode(ContentMode.HTML); if (Action.Status.FINISHED == status) { label.setDescription(i18n.get("label.finished")); label.setStyleName(STATUS_ICON_GREEN); label.setValue(FontAwesome.CHECK_CIRCLE.getHtml()); } else if (Action.Status.ERROR == status) { label.setDescription(i18n.get("label.error")); label.setStyleName("statusIconRed"); label.setValue(FontAwesome.EXCLAMATION_CIRCLE.getHtml()); } else if (Action.Status.WARNING == status) { label.setStyleName("statusIconOrange"); label.setDescription(i18n.get("label.warning")); label.setValue(FontAwesome.EXCLAMATION_CIRCLE.getHtml()); } else if (Action.Status.RUNNING == status) { // dynamic spinner label.setStyleName(statusIconPending); label.setDescription(i18n.get("label.running")); label.setValue(FontAwesome.ADJUST.getHtml()); } else if (Action.Status.CANCELING == status) { label.setStyleName(statusIconPending); label.setDescription(i18n.get("label.cancelling")); label.setValue(FontAwesome.TIMES_CIRCLE.getHtml()); } else if (Action.Status.CANCELED == status) { label.setStyleName(statusIconPending); label.setDescription(i18n.get("label.cancelled")); label.setStyleName(STATUS_ICON_GREEN); label.setValue(FontAwesome.TIMES_CIRCLE.getHtml()); } else if (Action.Status.RETRIEVED == status) { label.setStyleName(statusIconPending); label.setDescription(i18n.get("label.retrieved")); label.setValue(FontAwesome.CIRCLE_O.getHtml()); } else if (Action.Status.DOWNLOAD == status) { label.setStyleName(statusIconPending); label.setDescription(i18n.get("label.download")); label.setValue(FontAwesome.CLOUD_DOWNLOAD.getHtml()); } else if (Action.Status.SCHEDULED == status) { label.setStyleName(statusIconPending); label.setDescription(i18n.get("label.scheduled")); label.setValue(FontAwesome.HOURGLASS_1.getHtml()); } else { label.setDescription(""); label.setValue(""); } return label; }
From source file:org.eclipse.hawkbit.ui.management.actionhistory.ActionHistoryTable.java
License:Open Source License
private Component actionLabelWithTimeForceIcon(final Action actionWithActiveStatus, final Label actionLabel) { final long currentTimeMillis = System.currentTimeMillis(); final HorizontalLayout hLayout = new HorizontalLayout(); final Label autoForceLabel = new LabelBuilder().name("").id("action.history.table.timedforceId") .buildLabel();// ww w . j av a 2 s . com actionLabel.setValue(FontAwesome.BOLT.getHtml()); autoForceLabel.setContentMode(ContentMode.HTML); autoForceLabel.setValue(FontAwesome.HISTORY.getHtml()); hLayout.addComponent(actionLabel); hLayout.addComponent(autoForceLabel); if (actionWithActiveStatus.isHitAutoForceTime(currentTimeMillis)) { autoForceLabel.setDescription("autoforced"); autoForceLabel.setStyleName(STATUS_ICON_GREEN); autoForceLabel.setDescription("auto forced since " + SPDateTimeUtil .getDurationFormattedString(actionWithActiveStatus.getForcedTime(), currentTimeMillis, i18n)); } else { autoForceLabel.setDescription("auto forcing in " + SPDateTimeUtil .getDurationFormattedString(currentTimeMillis, actionWithActiveStatus.getForcedTime(), i18n)); autoForceLabel.setStyleName("statusIconPending"); autoForceLabel.setValue(FontAwesome.HISTORY.getHtml()); } return hLayout; }
From source file:org.eclipse.hawkbit.ui.management.actionhistory.ActionHistoryTable.java
License:Open Source License
/** * Create Status Label./* w w w .j a v a2 s. c o m*/ * * @param activeValue * as String * @return Labeal as UI */ private static Label createActiveStatusLabel(final String activeValue, final boolean endedWithError) { final Label label = new LabelBuilder().name("").buildLabel(); label.setContentMode(ContentMode.HTML); if (SPUIDefinitions.SCHEDULED.equals(activeValue)) { label.setDescription("Scheduled"); label.setValue(FontAwesome.HOURGLASS_1.getHtml()); } else if (SPUIDefinitions.ACTIVE.equals(activeValue)) { label.setDescription("Active"); label.setStyleName("statusIconActive"); } else if (SPUIDefinitions.IN_ACTIVE.equals(activeValue)) { if (endedWithError) { label.setStyleName("statusIconRed"); } else { label.setStyleName("statusIconNeutral"); } label.setDescription("In-active"); label.setValue(FontAwesome.CHECK_CIRCLE.getHtml()); } else { label.setValue(""); } return label; }