source: trunk/java-client/org/nzdl/gsdl/SimpleGraphicalClient/GMLDocument.java@ 2195

Last change on this file since 2195 was 2184, checked in by daven, 23 years ago

preferences dialog added

  • Property svn:keywords set to Author Date Id Revision
File size: 3.9 KB
Line 
1/*
2 * GMLDocument.java
3 * Copyright (C) 2001 New Zealand Digital Library Project
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19package org.nzdl.gsdl.SimpleGraphicalClient;
20
21import java.util.*;
22import javax.swing.text.*;
23import javax.swing.text.html.*;
24
25
26import org.nzdl.gsdl.service.*;
27
28/**
29 * Class GMLDocument
30 *
31 * A class to represent GML Documents
32 *
33 * @author Dave Nichols ([email protected])
34 * @see org.nzdl.gsdl.service.SimpleGraphicalClient.SimpleGraphicalClient
35 */
36
37public class GMLDocument extends HTMLDocument
38{
39
40 GMLDocument(){
41 super();
42 }
43
44
45
46 public void getImageData(NzdlService nzdl, String collectionName) {
47 // display image data
48 System.err.println("about to get iterator ...");
49 /*
50 HTML.Tag tag = HTML.Tag.IMG;
51
52 HTMLDocument.Iterator it = getIterator(tag); */
53 //System.err.println("collectionName = " + collectionName);
54 //System.err.println("HTTPPrefix = " + nzdl.getCollectionInfo(collectionName).getHTTPPrefix());
55 //System.err.println("HTTPDomain = " + nzdl.getCollectionInfo(collectionName).getHTTPDomain());
56
57 ElementIterator iterator = new ElementIterator(this);
58
59 Element element;
60
61 while ((element = iterator.next()) != null) {
62 // System.err.println("Got an element, getName() = " + element.getName() );
63 if (element.getName() == "img") {
64 //System.err.println("Got an image tag!");
65 AttributeSet attributes = element.getAttributes();
66 System.err.println("Num of attributes = " + attributes.getAttributeCount());
67 //Enumeration attributeNames = attributes.getAttributeNames();
68 for (Enumeration attributeNames = attributes.getAttributeNames() ; attributeNames.hasMoreElements() ;) {
69 Object attributeName = attributeNames.nextElement();
70 Object attributeValue = attributes.getAttribute(attributeName);
71 System.err.println("\t" + attributeName + " = " + attributeValue);
72 }
73
74 Object name = attributes.getAttribute(StyleConstants.NameAttribute);
75 //System.err.println("name = " + name);
76 }
77
78 }
79
80 /*
81 if (it.getTag() == null) System.err.println("iterator is null");
82 System.err.println("got iterator for tag type:" + it.getTag());
83 System.err.println("about to loop over " + it.getTag() + " tags...");
84 while (it.isValid()) {
85 System.err.println("Found tag: " + it.getTag());
86 System.err.println("Start offset = " + it.getStartOffset() + " End Offset = " + it.getEndOffset());
87 int length = it.getEndOffset() - it.getStartOffset();
88 AttributeSet attributeSet = it.getAttributes();
89
90 for (Enumeration i = attributeSet.getAttributeNames(); i.hasMoreElements();) {
91 System.err.println(i.nextElement());
92 }
93
94 System.err.println("extracted Document contents = ...");
95 try {
96 System.err.println(getText(it.getStartOffset(), length));
97 }
98 catch (BadLocationException e) {
99 System.err.println(e);
100 }
101
102 System.err.println("attr count =" + attributeSet.getAttributeCount());
103 it.next();
104 }
105 System.err.println("no more " + it.getTag() + " tags");
106 System.err.println("tag " + tag + " has block status " + tag.isBlock());
107 */
108 }
109
110
111
112} //end GMLDocument class
Note: See TracBrowser for help on using the repository browser.