com.vaadin.v7.ui.Label.addStyleName()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(10.4k)|赞(0)|评价(0)|浏览(130)

本文整理了Java中com.vaadin.v7.ui.Label.addStyleName()方法的一些代码示例,展示了Label.addStyleName()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Label.addStyleName()方法的具体详情如下:
包路径:com.vaadin.v7.ui.Label
类名称:Label
方法名:addStyleName

Label.addStyleName介绍

暂无

代码示例

代码示例来源:origin: info.magnolia.activation/magnolia-module-activation

protected Component createFieldsetTitle(String title) {
  Label fieldsetTitle = new Label(title);
  fieldsetTitle.addStyleName("fieldset-title");
  return fieldsetTitle;
}

代码示例来源:origin: info.magnolia.dam/magnolia-dam-app

@Override
public Component createThumbnailComponent(String description, File file, String mimeType) {
  Label thumbnail = new Label();
  thumbnail.setSizeUndefined();
  thumbnail.addStyleName("preview-image");
  thumbnail.addStyleName("file-preview");
  thumbnail.addStyleName("icon-" + imageProvider.resolveIconClassName(mimeType));
  return thumbnail;
}

代码示例来源:origin: OpenNMS/opennms

public static Label createStatusLabel(final String caption, final Status status, final String text) {
  final Label label = createLabel(caption, text);
  label.setContentMode(ContentMode.HTML);
  label.addStyleName("severity-" + status.toString().toLowerCase());
  label.addStyleName("bright");
  return label;
}

代码示例来源:origin: OpenNMS/opennms

@Override
  public Object generateCell(Table table, final Object itemId, Object columnId) {
    Label label = new Label((String) itemId);
    label.setSizeFull();
    label.addStyleName("white");
    return label;
  }
});

代码示例来源:origin: info.magnolia.dam/magnolia-dam-app

/**
 * Add Title.
 * @deprecated since 2.5 with no replacement.
 */
@Deprecated
protected Component getFileDetailHeader() {
  Label label = new Label();
  label.setValue(i18n.translate("dam.assets.filePreview.header"));
  label.addStyleName(ValoTheme.LABEL_BOLD);
  return label;
}

代码示例来源:origin: OpenNMS/opennms

/**
 * Returns the image severity layout for the given content.
 *
 * @param content the content
 * @return the label with the applied style
 */
protected HorizontalLayout getImageSeverityLayout(String content) {
  HorizontalLayout horizontalLayout = new HorizontalLayout();
  Label placeholder = new Label();
  placeholder.addStyleName("placeholder");
  horizontalLayout.addComponent(placeholder);
  Label contentLabel = new Label(content);
  contentLabel.addStyleName("content");
  horizontalLayout.addComponent(contentLabel);
  return horizontalLayout;
}

代码示例来源:origin: info.magnolia.ui/magnolia-ui-framework

public StubView(String iconId) {
  layout.addStyleName("app-stub-view");
  layout.setSizeFull();
  final Label icon = new Label();
  icon.addStyleName("icon");
  icon.setSizeUndefined();
  icon.addStyleName(iconId);
  layout.addComponent(icon);
  layout.setComponentAlignment(icon, Alignment.MIDDLE_CENTER);
}

代码示例来源:origin: OpenNMS/opennms

public Object generateCell(Table source, final Object itemId, Object columnId) {
    final Optional<RowDef> rowDef = view.getRowDef((String) itemId);
    final Optional<ColumnDef> columnDef = view.getColumnDef((String) columnId);
    int rowIndex = view.getRows().indexOf(rowDef.orElse(null));
    int colIndex = view.getColumns().indexOf(columnDef.orElse(null));
    SurveillanceStatus surveillanceStatus = m_cells[rowIndex][colIndex];
    Label label = new Label(surveillanceStatus.getDownEntityCount() + " of " + surveillanceStatus.getTotalEntityCount());
    label.setSizeFull();
    label.addStyleName(surveillanceStatus.getStatus().toLowerCase());
    return label;
  }
});

代码示例来源:origin: OpenNMS/opennms

private HorizontalLayout createRow(BusinessService service) {
  HorizontalLayout rowLayout = new HorizontalLayout();
  rowLayout.setSizeFull();
  rowLayout.setSpacing(true);
  final Status severity = m_businessServiceManager.getOperationalStatus(service);
  Label nameLabel = new Label(service.getName());
  nameLabel.setSizeFull();
  nameLabel.setStyleName("h3");
  nameLabel.addStyleName("bright");
  nameLabel.addStyleName("severity");
  nameLabel.addStyleName(severity.getLabel());
  rowLayout.addComponent(nameLabel);
  return rowLayout;
}

代码示例来源:origin: OpenNMS/opennms

/**
 * Returns the help component for the {@link Dashlet}.
 *
 * @return the help component
 */
@Override
public Component getHelpComponent() {
  VerticalLayout verticalLayout = new VerticalLayout();
  Label helpContent = new Label(getHelpContentHTML(), ContentMode.HTML);
  helpContent.addStyleName("help-content");
  Label helpParameters = new Label(getParameterDescriptionsHTML(), ContentMode.HTML);
  helpParameters.addStyleName("help-content");
  verticalLayout.addComponent(helpContent);
  verticalLayout.addComponent(helpParameters);
  return verticalLayout;
}

代码示例来源:origin: OpenNMS/opennms

if (alarms.size() == 0) {
  Label label = new Label("No alarms found!");
  label.addStyleName("alert-details-noalarms-font");
  component.addComponent(label);
} else {

代码示例来源:origin: OpenNMS/opennms

private Component createComponent() {
  Label label = new Label("Simulation Mode Enabled");
  label.setDescription("Simulation Mode is enabled");
  label.setIcon(FontAwesome.EXCLAMATION_TRIANGLE);
  label.addStyleName("warning");
  HorizontalLayout layout = new HorizontalLayout();
  layout.addComponent(label);
  layout.addStyleName("simulation");
  return layout;
}

代码示例来源:origin: OpenNMS/opennms

/**
 * Adds the alarms components to a {@link com.vaadin.ui.AbstractOrderedLayout}
 *
 * @param component the component to add alarms to
 * @param alarms    the alarms list
 */
private void addComponents(AbstractOrderedLayout component, List<OnmsAlarm> alarms) {
  if (alarms.size() == 0) {
    Label label = new Label("No alarms found!");
    label.addStyleName("alerts-noalarms-font");
    component.addComponent(label);
  } else {
    for (OnmsAlarm onmsAlarm : alarms) {
      OnmsNode onmsNode = null;
      if (onmsAlarm.getNodeId() != null) {
        CriteriaBuilder nodeCb = new CriteriaBuilder(OnmsNode.class);
        nodeCb.eq("id", onmsAlarm.getNodeId());
        List<OnmsNode> nodes = m_nodeDao.findMatching(nodeCb.toCriteria());
        if (nodes.size() == 1) {
          onmsNode = nodes.get(0);
        }
      }
      component.addComponent(createAlarmComponent(onmsAlarm, onmsNode));
      OnmsSeverity boostSeverity = OnmsSeverity.valueOf(getDashletSpec().getParameters().get("boostSeverity"));
      if (onmsAlarm.getSeverity().isGreaterThanOrEqual(boostSeverity)) {
        boosted = true;
      }
    }
  }
}

代码示例来源:origin: OpenNMS/opennms

labelAgo.addStyleName("alerts-font");
labelAgo.setValue(ago);
labelId.addStyleName("alerts-font");
if (onmsNode != null) {
  labelId.setValue(onmsNode.getLabel() + " (" + onmsNode.getNodeId() + ")");
labelUei.addStyleName("alerts-font");
labelUei.setValue(onmsAlarm.getUei());

代码示例来源:origin: OpenNMS/opennms

/**
 * Wraps the provided component in order to fit it better in the Info Panel.
 * E.g. a caption is added to better difference between components.
 *
 * @param component The component to wrap.
 * @param title the title of the component to wrap.
 * @param id the id of the wrapped component.
 * @return The wrapped component.
 */
private Component wrap(Component component, String title, String id) {
  Label label = new Label();
  label.addStyleName("info-panel-item-label");
  if (title != null) {
    label.setValue(title);
  }
  VerticalLayout layout = new VerticalLayout();
  layout.addStyleName("info-panel-item");
  layout.addComponent(label);
  layout.addComponent(component);
  layout.setMargin(true);
  if (id != null) {
    layout.setId(id);
  }
  return layout;
}

代码示例来源:origin: OpenNMS/opennms

labelFrom.addStyleName("text");
labelTo.addStyleName("text");

代码示例来源:origin: OpenNMS/opennms

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");
labelTitle.addStyleName("summary-font");
labelTitle.setSizeUndefined();
labelTimeslot.addStyleName("summary-font");
labelTimeslot.setSizeUndefined();

代码示例来源:origin: OpenNMS/opennms

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");
labelTitle.addStyleName("summary-font");
labelTitle.setSizeUndefined();
labelTimeslot.addStyleName("summary-font");
labelTimeslot.setSizeUndefined();

代码示例来源:origin: info.magnolia.ui/magnolia-ui-vaadin-common-widgets

private void construct() {
  mainLayout.setPrimaryStyleName("switcher");
  mainLayout.addStyleName(VARIATION_GREEN.equals(colorVariation) ? cssGreenVariationClassname : cssBlackVariationClassname);
  // back-arrow
  back = new Button("");
  back.setPrimaryStyleName(cssSwitcherArrowClassname);
  back.addStyleName("icon-arrow2_w");
  mainLayout.addComponent(back);
  // combobox with descriptionLabel below wrapped in verticalLayout
  //
  comboLayout.setWidth(100, Unit.PERCENTAGE);
  combobox.setWidth(100, Unit.PERCENTAGE);
  comboLayout.addComponent(combobox);
  // descriptionLabel
  descriptionLabel = new Label("");
  descriptionLabel.setPrimaryStyleName("switcherItemDescription");
  descriptionLabel.addStyleName("descriptionLabel");
  comboLayout.addComponent(descriptionLabel);
  mainLayout.addComponent(comboLayout);
  mainLayout.setExpandRatio(comboLayout, 1.0f);
  // forward arrow
  forward = new Button("");
  forward.setPrimaryStyleName(cssSwitcherArrowClassname);
  forward.addStyleName("icon-arrow2_e");
  mainLayout.addComponent(forward);
  updateButtonState(getValue());
  updateItemDescription();
}

代码示例来源:origin: OpenNMS/opennms

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;
}

相关文章