-
Notifications
You must be signed in to change notification settings - Fork 298
The Twitter library contains wicket components and behaviors to use the Twitter widgets with wicket.
There are two button types:
- Tweet
- Follow
You can find some examples here: https://twitter.com/about/resources/buttons
These components can be used like normal wicket components. It is required to use a link-tag (a) for the markup. The components should contain the major attributes documented on dev.twitter.com. It is possible to set the properties in the markup as well. They just get overridden if the property is set in at the java component too.
final FollowButton button = new FollowButton("followButton", "tfreier");
button.setShowFollowerCount(true);
add(button);
<a wicket:id="followButton"> </a>
Web intents are links to twitter to perform actions on twitter. https://dev.twitter.com/docs/intents
final FollowLink link = new FollowLink("link");
link.setScreenName("tfreier");
add(link);
<a wicket:id="link">follow me</a>
The anywhere behaviors add some behaviors to normal components like a label. https://dev.twitter.com/docs/anywhere/welcome
The LinkifyBehavior links all words beginning with @ to the matching twitter-account.
final Label label = new Label("label", "This is a linkify test by @tfreier");
label.add(new LinkifyBehavior("your api key"));
add(label);
<span wicket:id="label"></span>
The HovercardBehavior creates hover cards for any twitter account mentions beginning with an @.
final Label label = new Label("label", "This is a hovercard test by @tfreier");
label.add(new HovercardBehavior("your api key"));
add(label);
<span wicket:id="label"></span>
Event Behaviors are basically ajax callbacks for events caused by web intents. https://dev.twitter.com/docs/intents/events
final IModel<String> responseModel = Model.of();
final FollowLink link = new FollowLink("link");
link.setScreenName("tfreier");
add(link);
final Label label = new Label("resonse", responseModel);
label.setOutputMarkupId(true);
add(label);
add(new AjaxFollowEventBehavior()
{
@Override
protected void onEvent(final AjaxRequestTarget target, final Event event)
{
responseModel.setObject("followed");
target.add(label);
}
});
<a wicket:id="link">follow</a>
- wicketstuff-twitter
- wicketstuff-twitter-examples
There is no maven stable build yet.
<dependency>
<groupId>org.wicketstuff</groupId>
<artifactId>wicketstuff-twitter</artifactId>
<version>1.5-SNAPSHOT</version>
</dependency>
<repository>
<id>wicketstuff-core-snapshots</id>
<url>ttps://oss.sonatype.org/content/repositories/snapshots</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
Apache 2.0.