Java Code Examples for com.vaadin.shared.ui.label.ContentMode#HTML

The following examples show how to use com.vaadin.shared.ui.label.ContentMode#HTML . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: UploadDropAreaLayout.java    From hawkbit with Eclipse Public License 1.0 6 votes vote down vote up
private VerticalLayout createDropAreaLayout() {
    final VerticalLayout dropAreaLayout = new VerticalLayout();
    final Label dropHereLabel = new Label(i18n.getMessage(UIMessageIdProvider.LABEL_DROP_AREA_UPLOAD));
    dropHereLabel.setWidth(null);

    final Label dropIcon = new Label(FontAwesome.ARROW_DOWN.getHtml(), ContentMode.HTML);
    dropIcon.addStyleName("drop-icon");
    dropIcon.setWidth(null);

    dropAreaLayout.addComponent(dropIcon);
    dropAreaLayout.setComponentAlignment(dropIcon, Alignment.TOP_CENTER);
    dropAreaLayout.addComponent(dropHereLabel);
    dropAreaLayout.setComponentAlignment(dropHereLabel, Alignment.TOP_CENTER);

    uploadButtonLayout.setWidth(null);
    uploadButtonLayout.addStyleName("upload-button");
    dropAreaLayout.addComponent(uploadButtonLayout);
    dropAreaLayout.setComponentAlignment(uploadButtonLayout, Alignment.BOTTOM_CENTER);

    dropAreaLayout.setSizeFull();
    dropAreaLayout.setStyleName("upload-drop-area-layout-info");
    dropAreaLayout.setSpacing(false);
    return dropAreaLayout;
}
 
Example 2
Source File: TargetDetails.java    From hawkbit with Eclipse Public License 1.0 6 votes vote down vote up
private HorizontalLayout getSecurityTokenLayout(final String securityToken) {
    final HorizontalLayout securityTokenLayout = new HorizontalLayout();

    final Label securityTableLbl = new Label(
            SPUIComponentProvider.getBoldHTMLText(getI18n().getMessage("label.target.security.token")),
            ContentMode.HTML);
    securityTableLbl.addStyleName(SPUIDefinitions.TEXT_STYLE);
    securityTableLbl.addStyleName("label-style");

    final TextField securityTokentxt = new TextField();
    securityTokentxt.addStyleName(ValoTheme.TEXTFIELD_BORDERLESS);
    securityTokentxt.addStyleName(ValoTheme.TEXTFIELD_TINY);
    securityTokentxt.addStyleName("targetDtls-securityToken");
    securityTokentxt.addStyleName(SPUIDefinitions.TEXT_STYLE);
    securityTokentxt.setCaption(null);
    securityTokentxt.setNullRepresentation("");
    securityTokentxt.setValue(securityToken);
    securityTokentxt.setReadOnly(true);

    securityTokenLayout.addComponent(securityTableLbl);
    securityTokenLayout.addComponent(securityTokentxt);
    return securityTokenLayout;
}
 
Example 3
Source File: HomeViewImpl.java    From Vaadin4Spring-MVP-Sample-SpringSecurity with Apache License 2.0 6 votes vote down vote up
@Override
public void postConstruct() {	
	super.postConstruct();
	
	content = new VerticalLayout();
	content.setSpacing(true);
	content.setMargin(true);
	setCompositionRoot(content);
							
	caption = new Label("This is Home View", ContentMode.HTML);
	caption.addStyleName(ValoTheme.LABEL_H2);
	content.addComponent(caption);
	
	loginInfo = new Label("This is Home View", ContentMode.HTML);
	loginInfo.addStyleName(ValoTheme.LABEL_H2);
	content.addComponent(loginInfo);
			
}
 
Example 4
Source File: FormUtils.java    From jdal with Apache License 2.0 6 votes vote down vote up
/**
   * Create a titled separator
   * @param title title
   * @return a {@link HorizontalLayout} with title and rule.
   */
  public static Component createTitledSeparator(String title) {
  	Label titleLabel = new Label(title);
  	titleLabel.setStyleName(Reindeer.LABEL_H2);
Label rule = new Label("<hr />", ContentMode.HTML);
titleLabel.setSizeUndefined();
HorizontalLayout hl = new HorizontalLayout();
hl.addComponent(titleLabel);
Box.addHorizontalStruct(hl, 20);
hl.addComponent(rule);
hl.setComponentAlignment(rule, Alignment.BOTTOM_CENTER);
hl.setExpandRatio(rule, 1);
hl.setWidth(100, Unit.PERCENTAGE);

return hl;
  }
 
Example 5
Source File: AbstractHawkbitLoginUI.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
private Component buildDisclaimer() {
    final HorizontalLayout fields = new HorizontalLayout();
    fields.setSpacing(true);
    fields.addStyleName("disclaimer");

    final Label disclaimer = new Label(uiProperties.getDemo().getDisclaimer(), ContentMode.HTML);
    disclaimer.setCaption(i18n.getMessage("label.login.disclaimer"));
    disclaimer.setIcon(FontAwesome.EXCLAMATION_CIRCLE);
    disclaimer.setId("login-disclaimer");
    disclaimer.setWidth("525px");

    fields.addComponent(disclaimer);

    return fields;
}
 
Example 6
Source File: SPTargetAttributesLayout.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Custom Decorate.
 *
 * @param controllerAttibs
 */
private void decorate(final Map<String, String> controllerAttibs) {
    final VaadinMessageSource i18n = SpringContextHelper.getBean(VaadinMessageSource.class);
    final Label title = new Label(i18n.getMessage("label.target.controller.attrs"), ContentMode.HTML);
    title.addStyleName(SPUIDefinitions.TEXT_STYLE);
    targetAttributesLayout.addComponent(title);
    if (HawkbitCommonUtil.isNotNullOrEmpty(controllerAttibs)) {
        for (final Map.Entry<String, String> entry : controllerAttibs.entrySet()) {
            targetAttributesLayout.addComponent(
                    SPUIComponentProvider.createNameValueLabel(entry.getKey() + ": ", entry.getValue()));
        }
    }
}
 
Example 7
Source File: SPUIComponentProvider.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
private static Label createUsernameLabel(final String label, final String username) {
    String loadAndFormatUsername = "";
    if (!StringUtils.isEmpty(username)) {
        loadAndFormatUsername = UserDetailsFormatter.loadAndFormatUsername(username);
    }

    final Label nameValueLabel = new Label(getBoldHTMLText(label) + loadAndFormatUsername, ContentMode.HTML);
    nameValueLabel.setSizeFull();
    nameValueLabel.addStyleName(SPUIDefinitions.TEXT_STYLE);
    nameValueLabel.addStyleName(LABEL_STYLE);
    nameValueLabel.setDescription(loadAndFormatUsername);
    return nameValueLabel;
}
 
Example 8
Source File: UserViewImpl.java    From Vaadin4Spring-MVP-Sample-SpringSecurity with Apache License 2.0 5 votes vote down vote up
@Override
public void postConstruct() {	
	super.postConstruct();
	
	content = new VerticalLayout();
	content.setSpacing(true);
	content.setMargin(true);
	setCompositionRoot(content);
							
	caption = new Label("This is User view", ContentMode.HTML);
	caption.addStyleName(ValoTheme.LABEL_H2);
	content.addComponent(caption);
	
	info = new Label("Invoke admin service", ContentMode.HTML);
	info.addStyleName(ValoTheme.LABEL_H2);
	content.addComponent(info);
	
	btnTest = new Button("Click me", FontAwesome.STAR);
	content.addComponent(btnTest);
	btnTest.addClickListener(new ClickListener() {
		
		@Override
		public void buttonClick(ClickEvent event) {
			mvpPresenterHandlers.callDummyService();
			
		}
	});
	
	dummyInfo = new Label("", ContentMode.HTML);
	dummyInfo.addStyleName(ValoTheme.LABEL_H2);
	content.addComponent(dummyInfo);
	
	
			
}
 
Example 9
Source File: ToolEditorUI.java    From chipster with MIT License 5 votes vote down vote up
@Override
protected void init(VaadinRequest request) {
	treeToolEditor = new TreeToolEditor(this);
	toolEditor = new ToolEditor(this);
	textEditor = new TextEditor(this);
	final Panel vLayout = new Panel();
	vSplitPanel = new VerticalSplitPanel();
	vSplitPanel.setSplitPosition(50, Unit.PERCENTAGE);
	vSplitPanel.setImmediate(true);
	vSplitPanel.setLocked(false);
	vSplitPanel.setWidth("100%");
	vLayout.setContent(vSplitPanel);
    setContent(vSplitPanel);
    VerticalLayout vvLayout = new VerticalLayout();
    vvLayout.setSizeFull();
    Label title = new Label("<h2><b>&nbsp;Tool Editor</b></h2>", ContentMode.HTML);

    vvLayout.addComponent(title);
    vvLayout.setComponentAlignment(title, Alignment.TOP_LEFT);
    HorizontalSplitPanel hSplitpPanel = new HorizontalSplitPanel();
    hSplitpPanel.setSizeFull();
    vvLayout.addComponent(hSplitpPanel);

    HorizontalLayout buttonPanel = getButtonPanel();
    vvLayout.addComponent(buttonPanel);
    vvLayout.setComponentAlignment(buttonPanel, Alignment.MIDDLE_CENTER);

    vvLayout.setExpandRatio(hSplitpPanel, 5);
    vvLayout.setComponentAlignment(hSplitpPanel, Alignment.TOP_LEFT);
    vvLayout.setMargin(false);
    vvLayout.setSpacing(false);
    hSplitpPanel.setFirstComponent(treeToolEditor);
    hSplitpPanel.setSecondComponent(toolEditor);
    vSplitPanel.setFirstComponent(vvLayout);
    vSplitPanel.setSecondComponent(textEditor);
    hSplitpPanel.setStyleName("topborder");
}
 
Example 10
Source File: SignInViewImpl.java    From Vaadin4Spring-MVP-Sample-SpringSecurity with Apache License 2.0 4 votes vote down vote up
@Override
public void postConstruct() {	
	super.postConstruct();		
	setSizeFull();
	layout = new VerticalLayout();
	layout.setSizeFull();
	layout.setSpacing(true);
	setCompositionRoot(layout);
	
	caption = new Label("Sign in to Vaadin4Spring Security Demo");
	caption.addStyleName(ValoTheme.LABEL_H2);
	caption.setSizeUndefined();		
	layout.addComponent(caption);
	layout.setComponentAlignment(caption, Alignment.MIDDLE_CENTER);
	
	loginPanel = new VerticalLayout();
	loginPanel.setSizeUndefined();
	loginPanel.setSpacing(true);
	loginPanel.setMargin(true);
	layout.addComponent(loginPanel);
	layout.setComponentAlignment(loginPanel, Alignment.MIDDLE_CENTER);
	layout.setExpandRatio(loginPanel, 1);
	
	errorMessage = new Label();
	errorMessage.setWidth("300px");
	errorMessage.addStyleName(ValoTheme.LABEL_FAILURE);		
	errorMessage.setVisible(false);
	loginPanel.addComponent(errorMessage);
	
	username = new TextField("Username");
	username.setImmediate(true);
	username.setWidth("300px");
	username.setNullRepresentation("");
	username.setInputPrompt("Enter your username");
	loginPanel.addComponent(username);
	
	password = new PasswordField("Password");
	password.setImmediate(true);
	password.setWidth("300px");
	password.setNullRepresentation("");
	loginPanel.addComponent(password);
	
	rememberMe = new CheckBox("Remember me");
	rememberMe.setValue(false);
	rememberMe.addStyleName(ValoTheme.CHECKBOX_LARGE);
	loginPanel.addComponent(rememberMe);
	
	btnLogin = new Button("Signin", FontAwesome.UNLOCK);
	btnLogin.addStyleName(ValoTheme.BUTTON_PRIMARY);
	btnLogin.addClickListener(this);
	btnLogin.setWidth("100%");
	loginPanel.addComponent(btnLogin);							
	
	final Label infoLabel = new Label(FontAwesome.INFO_CIRCLE.getHtml() + " You can sign in as: <br/>\"user\" with password \"user\" <br/>\"admin\" with password \"admin\".", ContentMode.HTML);
	infoLabel.setWidth("300px");
	loginPanel.addComponent(infoLabel);
}
 
Example 11
Source File: SPUIComponentProvider.java    From hawkbit with Eclipse Public License 1.0 3 votes vote down vote up
/**
 * Method to CreateName value labels.
 *
 * @param label
 *            as string
 * @param values
 *            as string
 * @return Label
 */
public static Label createNameValueLabel(final String label, final String... values) {
    final String valueStr = StringUtils.arrayToDelimitedString(values, " ");
    final Label nameValueLabel = new Label(getBoldHTMLText(label) + valueStr, ContentMode.HTML);
    nameValueLabel.setSizeFull();
    nameValueLabel.addStyleName(SPUIDefinitions.TEXT_STYLE);
    nameValueLabel.addStyleName(LABEL_STYLE);
    return nameValueLabel;
}
 
Example 12
Source File: UIUtil.java    From usergrid with Apache License 2.0 3 votes vote down vote up
public static Label addLabel(AbsoluteLayout parent, String text, String position, String width) {

        Label label = new Label(text, ContentMode.HTML);
        label.setWidth(width);

        parent.addComponent(label, position);

        return label;
    }