Project Description
In the most basic level, SitemapTree is a hierarchical tree manipulation application that will allow creation and maintenance of a hierarchical tree strucuture. This structure can represent a file system like the Windows Explorer, as well as a hyperlink-based map of a given Web site. It can also be used as a display and a navigation tool for an information system to provide various contents in an efficient and effective manner.
The idea of SitemapTree was conceived during my attemp to harvest "Web Directory" information from various Web search engine sites. The contents brought back by IRIS Web Crawler, which was developed in the predecessor Java course, contained much noise since Web Directories (WD) are usually embedded in a page with various other hyperlinks. To isolate the WD information, I either needed to implement a "smart" filter in the crawler, or devise some method of manipulating the hyperlink structure after the fact.
SitemapTree not only offer a visual interface that can accomplish this task easily, but also can be used as a visual representation and navigation tool of hierarchical data.
The basic funtionalites of SitemapTree are twofold. On one side, there is the hierarchical tree structure that can be manipulated visually. On the other side is the area that can display the content of a tree node/leaf that is currently selected. Unfortunately, the implementation of content display area is still ongoing. The image below is the screen capture of the SitemapTree application, which uses Swing components of the Java Foundation Class.

- New:
creates a new sitemap tree with just a root node
- Open:
opens an existing sitemap file.
- Save:
saves the sitemap to a file. (currently, Save functions the same as SaveAs)
- SaveAs:
saves the sitemap to a different file.
- Exit:
displays a "Save" dialog window before exiting the application.
- Add Node:
add a node under the active (selected/highlighted) node.
- Delete Node:
deletes the active node.
- Collapse Tree:
collapse the tree to the root and the first level nodes.
- Cut:
cuts the active node and puts it into the clipboard.
- Copy:
copy the active node and puts it into the clipboard.
- Paste:
pastes the content of the clipboard under the active node.
- Single Node:
allow selection of single nodes only.
- Contiguous Nodes:
allow selection of multiple contiguous nodes.
- Discontiguous Nodes:
allow selection of multiple discontiguous nodes.
i.e. add the Fetch/Harvest button with a URL box, which will launch the Web crawler and create an input file for the tree display.
System Description
Design Considerations
In keeping with the original purpose of this project, and to facilitate future upgrades, I tried to make the system components as modular and object-oriented as possible. Since this application has a data component that drives the display of visual component and vice versa, and the current data structure is likely to change (e.g. database representation), special consideration had to be given to how the manipulation of the tree structure would be reflected in the data file. My approach was to introduce my own version of a tree data model, which can handle various data formats. I believe the current strategy will work without too much complications when SitemapTree interfaces with a database file via a JDBC/ODBC bridge in the future.
Due to my relative inexperience with object-oriented programming and Swing, the implementation of SitemapTree application is not optimized in my opinion. However, I will continue my efforts with this project until SitemapTree is fully functional and streamlined. Matter of fact, SitemapTree is a candidate tool for driving the information system to be built this summer at my job site.
Data Structure
0,0,1,0,"Yangk","http://ils.unc.edu/yangk/"
1,1,1,0,"My Projects","http://ils.unc.edu/yangk/projects.htm"
2,2,1,1,"External Links","http://ils.unc.edu/yangk/projects.htm"
3,3,1,2,"IRISWeb","http://ils.unc.edu/iris/"
4,4,1,3,"External Links","http://ils.unc.edu/iris/"
5,5,1,4,"XLINK (irisnav.htm)","http://ils.unc.edu/iris/irisnav.htm"
6,5,2,4,"XLINK (iris.htm)","http://ils.unc.edu/iris/iris.htm"
7,3,2,2,"XLINK Chancellor's Grant","http://bootcamp.oit.unc.edu/grants/fetchabstract.asp?number=25&"
8,3,3,2,"XLINK Link Summarizer (summary.htm)","http://ils.unc.edu/~yangk/i283/irisw2/summary.htm"
9,3,4,2,"IRIS Sitemap/Crawler (index.html)","http://www.cs.unc.edu/Courses/wwwp-f97/projects/iris/index.html"
10,4,2,9,"External Links","http://www.cs.unc.edu/Courses/wwwp-f97/projects/iris/index.html"
- column 1:
unique ID (primary key)
- column 2:
tree level (vertical)
- column 3
primary key of the parent node
- column 4:
primary key of the parent node
- column 5:
node label
- column 6:
URL
- URL array:
holds URLs
- ID array:
holds primary keys
- treeItem array:
holds treeItem objects (JavaBean)
- treeItemString array:
holds strings that can be used as input for StringTree Model
each treeItem object represents a tree node and has the following attributes.
- ID:
unique ID (primary key)
- level:
tree level (vertical)
- LID:
primary key of the parent node
- PID:
primary key of the parent node
- label
node label
- URL
URL
- URL
URL
- treeItemString
label in StringTree Model format
In addition to treeItem and treeItemData Beans, there are two other main components of SitemapTree.
- addObject
inserts a new node under the active node
- copyCurrentNode
copy the active node and puts it into the clipboard.
- getCurrentNodeURL
gets the URL of the active node (to be used for Content Display)
- pasteObject
pastes the content of the clipboard under the active node.
- removeCurrentNode
cuts/deletes the content of the clipboard under the active node.
- saveTreeData
outputs the tree data to a file.
There other miscellaneous components such as kyString1 class to handle string manipulations, BasicActionBean to handle events, and the SitemapTree application itself, where all the components come together. Please refer to JavaDocs and source codes for further information.