Tag Cloud Widget

The Tag Cloud Wigdet is used to create tag clouds within your non-Dekoh application. The widget uses Prototype library and implements DWR (Direct Web Remoting) to get data. Read more here to use the Tag Cloud widget with your non-Dekoh applications.

Features

  • Dialog and inline mode
  • Return selected value in the text-field
  • Different styles of tag cloud

How to use

Add this code to the head section of the page:

<style type="text/css" title="currentStyle" media="screen">
 @import '<%=dekoh.portal.util.StaticFilesURLGenerator.generateStaticFileURL(request, "theme","app","css.jsp?externalApp=true")%>';
</style>
<script src='/dekohportal/dwr/engine.js'></script>
<script src='/dekohportal/dwr/util.js'></script>
<script type='text/javascript' src='<%=dekoh.portal.util.StaticFilesURLGenerator.generateStaticFileURL(request, "common",null,"JSlibrary.jsp")%>'>
</script>
<script type='text/javascript' src='<%=dekoh.portal.util.StaticFilesURLGenerator.generateStaticFileURL(request, "widget","tagCloud","tagCloudDialog.js")%>'>
</script>
<script type='text/javascript' src='<%=dekoh.portal.util.StaticFilesURLGenerator.generateStaticFileURL(request, "widget","tagCloud","tagcloud.js")%>'>
</script>
<script type='text/javascript' src='<%=dekoh.portal.util.StaticFilesURLGenerator.generateStaticFileURL(request, "widget","tagCloud","interface-dwr.js")%>'>
</script>
<script type="text/JavaScript" src="<%=dekoh.portal.util.StaticFilesURLGenerator.generateStaticFileURL(request, "widget","dialog","dialog.js")%>"></script>

JavaScript code

The basic syntax to initialize the tag cloud widget is
<script type="text/javascript">
            function openTagCloudTray(){
oTC_Dialog = new TC_Dialog('tc_tagContainer', 'chosenTags', 'edit', trayDatasource, 'OBJECT_NAME');
}
            function trayDatasource(){
               }
</script>

HTML code

Include the following code where you want to invoke the File Chooser in page:
 
<input type=”text” size="30" id="chosenTags" name="chosenTags" value=""/>
<input type="button" value="Show Tagcloud" onclick="javascript: openTagCloudTray();"/>

Using the tag cloud as a dialog

Add this code to the head section of the page:
<script src='/dekohportal/dwr/engine.js'>
</script>
<script src='/dekohportal/dwr/util.js'>
</script>
<script type='text/javascript' src='<%=dekoh.portal.util.StaticFilesURLGenerator.generateStaticFileURL(request, "common",null,"JSlibrary.jsp")%>'>
</script>
<script type='text/javascript' src='<%=dekoh.portal.util.StaticFilesURLGenerator.generateStaticFileURL(request, "widget","tagCloud","tagCloudDialog.js")%>'>
</script>
<script type='text/javascript' src='<%=dekoh.portal.util.StaticFilesURLGenerator.generateStaticFileURL(request, "widget","tagCloud","tagcloud.js")%>'>
</script>
<script type='text/javascript' src='<%=dekoh.portal.util.StaticFilesURLGenerator.generateStaticFileURL(request, "widget","tagCloud","interface-dwr.js")%>'>
</script>

JavaScript code

The basic syntax to invoke the tag cloud in the page is:
<script type="text/javascript">
       var pageDatasource = new dwrTagCloudDataSource("<url:tags tagName='#@@#'/>", 'DIO_ID');

var pageTagCloud = new oTagCloud('pageTagCloud', "tagContainer", pageDatasource, {mode:'view', minimalMode:'on', tagView:"view_cloud", tagsLimit:'All', dialogWin:false});
// for windows. Use fileseparator value ‘/’ for linux
</script>

HTML code

Include the following code where you want to invoke the Tag Cloud in page:
<input type=”text” size="30" id="chosenTags" name="chosenTags" value=""/>
<input type="button" value="Show Tagcloud" onclick="javascript: openTagCloudTray();"/>

Parameters for initializing Tag Cloud in dialog mode

Required parameters

OptionsSinceDescriptionDefault
tagCloundTargetDivIdV1.0Dialog Id-
returnTxtFieldIdV1.0The textfield id where the selected values will be populated-
cloudModeV1.0If it’s a list or cloud mode-
trayDatasourceV1.0Datasource-
currentDigitalObjectNameV1.0Dio name-

Optional parameters

OptionsSinceDescriptionDefault
classNameV1.0The style classDekoh
dialogTitleV1.0The dialog title-
topMessageV1.0The message shown on the dialog“Select file(s) to add/import'
fileSeperatorV1.0This value is to be initialized for different operating systems
'
widthV1.0Width of the dialog700
heightV1.0Height of the dialog450
minWidthV1.0Minimum width400
minHeightV1.0Minimum height300
xPosV1.0Specify the x position of the dialog in the document 0
yPosV1.0Specify the y position of the dialog in the document0
minimizableV1.0Works with resizable value set to ‘true’. The value defined for this is ‘true’ or ‘false’ depends on whether you want to make dialog minimized False
maximizableV1.0Works with resizable value set to ‘true’. The value defined for this is ‘true’ or ‘false’ depends on whether you want to make dialog maximizedFalse
isModalV1.0Specify whether the dialog is modal or nottrue

Parameters for initializing Tag Cloud

Required parameters

OptionsSinceDescriptionDefault
IdV1.0Tagcloud Id-
targetDivIdV1.0The target div where the tagcloud is going to get rendered-
dsV1.0Datasource-

Optional parameters

OptionsSinceDescriptionDefault
cloudtitleV1.0-null
modeV1.0Start the tagcloud in ‘select’ or ‘edit’ mode'edit'
minimalModeV1.0 Show/hide toolbar and advanced controlsnull
rankOnV1.0display frequency in cloudFalse
colorsOnV1.0display colors in cloudtrue
textSizeOnV1.0display text sizes in cloudtrue
tagViewV1.0'list' or 'cloud'cloud
contentdivV1.0ID of div holding the actual tags HTML'cloudContent'
sortOrderV1.0order of the tags list: ORDER_ASC or ORDER_REVERSEORDER_ASC
tagSeparatorV1.0inserted between tags, … = elipsis‘, ’
sortFieldV1.0SORT_DEFAULT, SORT_FREQ, SORT_DATE, SORT_NAMESORT_DEFAULT
tagsLimitV1.0limits how many tags are displayed. 'All' displays all available tagsLABEL_ALL
dioIdV1.0Digital Object ID-
urlBaseV1.0--
currusagefilterV1.0filters the tags based on recency of usage. options are USG_MONTH, USG_WEEK, USG_24HOURS, USG_ALLUSG_ALL
moreOptionsV1.0the following are ignored if minimalMode is 'on'. advanced options drawer available‘on’
sorterOnV1.0show/hide Sort controltrue
styleSwitcherOnV1.0show/hide Style controltrue
usageFilterOnV1.0show/hide Usage filter controltrue
tagLimiterOnV1.0show/hide taglimiter controltrue
noOfStylesV1.0The style number6
currentShowSortV1.0sort the tags on the parameterLABEL_MOST_USED
dialogWinV1.0The tagcloud in the dialog mode or notfalse
returnTxtFieldIdV1.0The text field where the selected values are going to get saved-
tagCloudHeightV1.0Tagcloud heightnull
activeStyleSheetV1.0-0
tagLinkWindowV1.0Specify a named window frame to open the links in a new page or same page'_self'

Functions

FunctionParametersDescription
getTagCloudObj-Returns the selected tagcloud object
showProcessRunning-Shows the running status
closeDialogWindow-Close the dialog window if the tagcloud is initialized in the dialog mode
initAndViewTagCloud-Initialize the tagcloud
isMinimalMode-Return whether the tagcloud is running in the minimal mode
sortByNameReverse
toggleText
listToSort
Sorting of tags by name
sortByFreqreverseSorting of tags by frequency. Set the reverse value as true or false.
sortByDatereverseSorting of tags by date. Set the reverse value as true or false.
toggleTagLimit-Set the tag limits to the predefined values as 25,50, 100 and all
toggleUsageFilter-Toggle the values to be shown along with the tag.
filterByUsagefilterSet the value as USG_24HOURS, USG_WEEK, USG_MONTH, USG_ALL
toggleSortingcurrSortField
isAscending
Toggle the displayed values Most used, least used, latest. isAscending is the Boolean whether the sorting is done in ascending or descending order.
toggleShowSorting-Toggle the tags sorting by from A to Z , Z to A
updateTagViewuseFilterUpdate the tag view after applying the user filters
setMinMaxTagFrequency-Set the minimum and maximum frequency
extractTopXTagsfilterClickReturns the tag when the filter is clicked
setTagFontSizes-Set the font size as same or variable based on frequency
refreshTagCloudId
bFilter
Refresh the tag cloud. The id is the id of the division where the tagcloud is rendered. If we're using a month/week filter, then use the alternate filtered tag array
refreshTagListId
bFilter
Refresh tag list. The id is the id of the division where the tagcloud is rendered. If we're using a month/week filter, then use the alternate filtered tag array
editAddTags-Edit and add tags
selectTags-Select the tags
editTagsstrActionEdit selected tags. Set, add,delete,rename & merge as action.
editMerge-Merge the selected tags
editRename-Rename the selected tags
editDelete-Delete the selected tags
getTagByNametagNameGet the tag in the array by name
resizeTagContainer-Resize the tag container
initEditMode-Initialize the tagcloud in edit mode
endEditMode-End the tagcloud in edit mode
isDuplicateselectedTags
currentTag
Check if the tag is duplicate.
addTagtagsArrayadd the tags as an array
getTagidxGet tag from array
getSortOrder-Get the sorting order
setSortOrderorderSet the sorting order. if true set to ORDER_REVERSE, otherwise ORDER_ASC
getSortField-Get the sorting field
setSortFieldfieldSet the sorting field
getView-Get view of tagcloud
setViewviewSet the view of tagcloud. Set VIEW_CLOUD or VIEW_LIST
getStyleForRankwtGet style for ranking the tags
initTagClouddataInitialize the tag cloud with the data.
viewAsList-View the tagcloud as list
viewAsCloud-View the tagcloud as cloud
showColors-Show colors
hideColors-Hide colors
removeTextSizes-Remove the variable text sizes
applyTextSizes-Apply text sizes
setPrevStyleSheet-Set the previous style of tagcloud than the selected one
setNextStyleSheet-Set the next style of tagcloud than the selected one
setActiveStyleSheetindexSet the style of tagcloud. Select values from 0 to 7

DWR Implementation

Reference in web.xml

<init-param>
            <param-name>config-tagcloud</param-name>
            <param-value>widgets/tagcloud/dwr-tagcloud.xml</param-value>
  </init-param>

DWR XML

Each application implements tag cloud differently.

Creators

Each class on which we execute methods, needs a <create ...> entry. There are several types of creator. The most common ones use either the 'new' keyword or the Spring framework. For more information, see the Creator documentation. Each class on which we execute methods, needs a <create ...> entry. There are several types of creator. The most common ones use either the 'new' keyword or the Spring framework. For more information, see the Creator documentation.

Method NameFunctionality
--

Converters

We need to ensure that all the parameters can be converted. Many of the types provided by the JDK are enabled for you, but you need to give DWR permission to convert your own code. Generally this means that JavaBean parameters will need a <convert ...> entry.

Availability

Dekoh Portal Ver 0.4.2 or later.

Attachments

tagcloud_widget.jpg Info on tagcloud_widget.jpg 88996 bytes