The NixMash Spring Tag Cloud is now online. We’ll cover the highlights here.
We used a Native SQL Query to retrieve the tag data which you can read about in this post. We’re focusing on the Tag Cloud here, so let’s jump to the Spring MVC Controller. We’re going to retrieve the cloud from the client, much like we retrieve the Posts stream. Like the Posts stream we’ll be sending HTML to the client. We determine a min/max for tag counts from our List<TagDTO> to calculate CSS styling later, then wrap our list HTML tags around a <ul /> tag and build our tag list items.
Our tagHtml(tag) method formats the individual <li /> elements. The only Spring element of interest in this bit of code is how we’re using our applicationSettings conponent for loading our baseUrl from an external properties file.
And finally our Tag Cloud CSS styling logic.
All of the data has been retrieved, the logic applied and the HTML created. We need only call /json/post/tagcloud and populate our #sidebartags DOM element.