public class StaticButtonBuilder extends Object implements Serializable
The builder uses sensible default settings that can be changed by using its methods. All methods return a reference to the builder itself, so method calls can be daisy-chained.
Example:
String button = new StaticButtonBuilder().url(thingUrl).toString();
Constructor and Description |
---|
StaticButtonBuilder() |
Modifier and Type | Method and Description |
---|---|
StaticButtonBuilder |
attribute(String attribute,
String value)
Adds a custom HTML attribute to the generated link tag.
|
StaticButtonBuilder |
badge(BadgeType type)
Selects the badge type to be used.
|
StaticButtonBuilder |
badgeUrl(String url)
A URL to a custom badge image.
|
StaticButtonBuilder |
badgeUrl(URL url)
A URL to a custom badge image.
|
StaticButtonBuilder |
style(String style)
CSS style to be used.
|
StaticButtonBuilder |
styleClass(String styleClass)
CSS class to be used.
|
StaticButtonBuilder |
thing(AutoSubmission submission)
Link to the Thing page at Flattr by
AutoSubmission . |
StaticButtonBuilder |
thing(String url)
Link to the Thing page at Flattr.
|
StaticButtonBuilder |
thing(Thing thing)
Link to the Thing page at Flattr.
|
String |
toString()
Builds a static button tag of the current setup.
|
public StaticButtonBuilder()
public StaticButtonBuilder thing(String url)
public StaticButtonBuilder thing(AutoSubmission submission)
AutoSubmission
. If the Thing does not
exist yet, it will be created on the first click.public StaticButtonBuilder thing(Thing thing)
public StaticButtonBuilder badge(BadgeType type)
public StaticButtonBuilder badgeUrl(String url)
badge(org.shredzone.flattr4j.web.BadgeType)
method is ignored.url
- Button image URLpublic StaticButtonBuilder badgeUrl(URL url)
public StaticButtonBuilder style(String style)
public StaticButtonBuilder styleClass(String styleClass)
public StaticButtonBuilder attribute(String attribute, String value)
Attributes are added without further checks. It is your responsibility to take care for HTML compliance.
attribute
- HTML attribute to be addedvalue
- Value of that attribute. The builder takes care for proper HTML
escaping.Copyright © 2010–2017. All rights reserved.