Ignore:
Timestamp:
2012-05-29T10:48:02+12:00 (12 years ago)
Author:
sjm84
Message:

Classifier nodes will now have childType and classifierStyle attributes so that we can tell if it is a VList or an HList

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/AbstractBrowse.java

    r25688 r25689  
    2828import org.w3c.dom.Document;
    2929import org.w3c.dom.Element;
     30import org.w3c.dom.Node;
    3031import org.w3c.dom.NodeList;
    3132
     
    450451            if (want_info)
    451452            {
    452 
    453453                Element node_info_elem = this.doc.createElement("nodeStructureInfo");
    454454                node.appendChild(node_info_elem);
     
    538538                    addDescendants(base_node, node_id, true);
    539539                }
     540
     541                NodeList classifierElements = result.getElementsByTagName(GSXML.CLASS_NODE_ELEM);
     542                for (int j = 0; j < classifierElements.getLength(); j++)
     543                {
     544                    Element current = (Element) classifierElements.item(j);
     545                    Node parentNode = current.getParentNode();
     546
     547                    if (parentNode == null)
     548                    {
     549                        continue;
     550                    }
     551
     552                    Element parent = (Element) parentNode;
     553                    String childType = parent.getAttribute(GSXML.CHILD_TYPE_ATT);
     554                    if (childType == null || childType.length() == 0)
     555                    {
     556                        continue;
     557                    }
     558
     559                    current.setAttribute(GSXML.CLASSIFIER_STYLE_ATT, childType);
     560                }
    540561            } // if want structure
    541562        } // for each doc
     
    624645        Element node = this.doc.createElement(GSXML.CLASS_NODE_ELEM);
    625646        node.setAttribute(GSXML.NODE_ID_ATT, node_id);
     647        node.setAttribute(GSXML.CHILD_TYPE_ATT, getChildType(node_id));
    626648        return node;
    627649    }
     
    759781    abstract protected String translateId(String node_id);
    760782
     783    /** Gets the type of list a classifier is (e.g. VList or HList) */
     784    abstract protected String getChildType(String node_id);
     785
    761786    /**
    762787     * returns the document type of the doc that the specified node belongs to.
Note: See TracChangeset for help on using the changeset viewer.