if (parameters == null)
parameters = new TagCloudConfiguration();
try {
Cloud cloud = new Cloud(); // create cloud
if (parameters.getCloudCase().equals("Case.LOWER"))
cloud.setTagCase(Case.LOWER);
else if (parameters.getCloudCase().equals("Case.UPPER"))
cloud.setTagCase(Case.UPPER);
else if (parameters.getCloudCase().equals("Case.CAPITALIZATION"))
cloud.setTagCase(Case.CAPITALIZATION);
else if (parameters.getCloudCase().equals("Case.PRESERVE_CASE"))
cloud.setTagCase(Case.PRESERVE_CASE);
else if (parameters.getCloudCase().equals("Case.CASE_SENSITIVE"))
cloud.setTagCase(Case.CASE_SENSITIVE);
cloud.setMaxWeight(Double.parseDouble(parameters.getFontTo())); // max font size
cloud.setMinWeight(Double.parseDouble(parameters.getFontFrom()));
if (parameters.getTotalTags()==-1)
cloud.setMaxTagsToDisplay(1000000);
else
cloud.setMaxTagsToDisplay(parameters.getTotalTags());
for (String subject : data.keySet()){
if (data.get(subject).intValue() > Integer.parseInt(parameters.getCuttingLevel())){
for (int i=0; i<data.get(subject).intValue(); i++){
Tag tag2 = new Tag(subject, ((HttpServletRequest) pageContext.getRequest()).getContextPath()+(scope!=null?scope:"")+(type.equals("0")?("/simple-search?filterquery="+URLEncoder.encode(subject,"UTF-8")+"&filtername="+index+"&filtertype=equals"):("/browse?type="+index+"&value="+subject)));
cloud.addTag(tag2);
}
}
}
out.println("<div class=\"tagcloud\">");
int counter = 0;
List<Tag> tagList = cloud.tags(new Tag.NameComparatorAsc());
if (parameters.getOrdering().equals("Tag.NameComparatorAsc"))
tagList = cloud.tags(new Tag.NameComparatorAsc());
else if (parameters.getOrdering().equals("Tag.NameComparatorDesc"))
tagList = cloud.tags(new Tag.NameComparatorDesc());
else if (parameters.getOrdering().equals("Tag.ScoreComparatorAsc"))
tagList = cloud.tags(new Tag.ScoreComparatorAsc());
else if (parameters.getOrdering().equals("Tag.ScoreComparatorDesc"))
tagList = cloud.tags(new Tag.ScoreComparatorDesc());
for (Tag tag : tagList) {
String tagClass = "";