org.greenstone.gs3client
Class Displays

java.lang.Object
  extended by org.greenstone.gs3client.Displays

public class Displays
extends java.lang.Object

Class containing static methods, static variables and inner classes that are used by both SearchResultsDisplay and BrowseDisplay.

Author:
ak19

Nested Class Summary
static class Displays.MetadataComparator
          Static inner class MetadataComparator is a Comparator for the metadata fields stored as a list of Pair objects (name, values).
(package private) static class Displays.PopupListener
          Handles rightclicks on a treeview of documentNodeData objects by showing the popupMenu with associated files that, when selected, can be displayed in the htmlPane.
 
Field Summary
protected static Displays.MetadataComparator comparator
          Static Comparator object for Pair objects of (name, value) Metadata
 
Constructor Summary
Displays()
           
 
Method Summary
static void createNodesForChildren(DocumentNodeData docNode, javax.swing.tree.DefaultMutableTreeNode treeNode)
          Recursion to add all descendent docnodes into the tree.
static java.lang.String getImgUrlEnclosedInHtml(java.lang.String imgURL)
          JEditorPane cannot deal with <img src="" />.
static void showMeta(NodeData nodeData, javax.swing.JList metanames, javax.swing.JList metavalues)
          Sorts the metadata of the docNode into the required order and displays metadata names in the JList metanames and the associated metadata values in the JList metavalues.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

comparator

protected static final Displays.MetadataComparator comparator
Static Comparator object for Pair objects of (name, value) Metadata

Constructor Detail

Displays

public Displays()
Method Detail

createNodesForChildren

public static void createNodesForChildren(DocumentNodeData docNode,
                                          javax.swing.tree.DefaultMutableTreeNode treeNode)
Recursion to add all descendent docnodes into the tree.

Parameters:
docNode - - the documentNodeData object for whose children treenodes need to be created.
treeNode - - the treeNode associated with the docNode parameter.

getImgUrlEnclosedInHtml

public static java.lang.String getImgUrlEnclosedInHtml(java.lang.String imgURL)
JEditorPane cannot deal with <img src="" />. It can only handle it without ending slash: <img src="" >. This method constructs complete html (with html, head and body tags) where the parameter imgURL is enclosed inside an img src tag.

Parameters:
imgURL - - src URL for a (web) image
Returns:
the imgURL parameter enclosed in complete html

showMeta

public static void showMeta(NodeData nodeData,
                            javax.swing.JList metanames,
                            javax.swing.JList metavalues)
Sorts the metadata of the docNode into the required order and displays metadata names in the JList metanames and the associated metadata values in the JList metavalues. The order is based on metanames: first come all the official metadata sets which are recognised by the existence of a period in the metaname (eg. dc.creator, dls.title). These are arranged alphabetically. Next come all the metadata names that start with a capital letter - arranged alphabetically; the remainder are organised alphabetically as well, with the last ones being those metadata whose names do not start with a letter (e.g. "/srclink").

Parameters:
nodeData - is the NodeData object (classifierNodeData or documentNodeData) whose metadata is to be displayed in the metanames and metavalues components.
metanames - - a JList to display all the metadata names of nodeData
metavalues - - a JList to display all the metadata values of nodeData