Changeset 4014


Ignore:
Timestamp:
2003-03-27T12:27:35+12:00 (21 years ago)
Author:
mdewsnip
Message:

Replaced GATE annotation tags with div tags, for display purposes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl3/src/java/org/greenstone/gsdl3/service/GATEServices.java

    r4010 r4014  
    3737import java.net.URL;
    3838import java.util.HashSet;
     39import java.util.Iterator;
    3940import java.util.Set;
    4041
     
    133134
    134135    return display;
     136    }
     137
     138
     139    /** creates a new param element and adds it to the param list */
     140    protected void createParameter(String name, Element param_list,
     141                   boolean display, String lang)
     142    {
     143    Element param = null;
     144
     145    // the index info - read from config file
     146    /* Element index_list = (Element)GSXML.getChildByTagName(config_info_, INDEX_ELEM+GSXML.LIST_MODIFIER);
     147    NodeList indexes = index_list.getElementsByTagName(INDEX_ELEM);
     148    int len = indexes.getLength();
     149    if (len > 1) { // add index param to list only if more than one index specified
     150        String [] inds  = new String[len];
     151        String [] ind_names = new String[len];
     152        for (int i=0; i<len; i++) {
     153        inds[i] = ((Element)indexes.item(i)).getAttribute(GSXML.NAME_ATT);
     154        if (display) {
     155            Element disp = (Element)GSXML.getChildByTagName(indexes.item(i), GSXML.DISPLAY_ELEM);
     156            ind_names[i] = GSXML.getDisplayText(disp, GSXML.DISPLAY_NAME_ELEM, lang, "en");
     157        }
     158        }
     159        if (display) {
     160        param = GSXML.createParameterDisplay(doc_, INDEX_PARAM, getTextString("param."+INDEX_PARAM, lang), inds, ind_names);
     161        } else {
     162        param = GSXML.createParameter(doc_, INDEX_PARAM, GSXML.PARAM_TYPE_ENUM_SINGLE, default_index_, inds);
     163        }
     164        } */
    135165    }
    136166
     
    228258        String result = doc.toXml(outputAnnotations, false);
    229259        Factory.deleteResource(doc);
     260
     261        // Replace all the annotations with div tags
     262        Iterator setIterator = annotationTypesToExport.iterator();
     263        while (setIterator.hasNext()) {
     264        String annotationType = (String) setIterator.next();
     265        result = result.replaceAll("<" + annotationType + ">",
     266                       "<div id=\"" + annotationType + "\">");
     267        result = result.replaceAll("</" + annotationType + ">",
     268                       "</div id=\"" + annotationType + "\">");
     269        }
     270
     271        // System.out.println("Result:\n" + result);
    230272        return result;
    231273    }
Note: See TracChangeset for help on using the changeset viewer.