Changeset 8932


Ignore:
Timestamp:
2005-01-28T10:13:58+13:00 (19 years ago)
Author:
mdewsnip
Message:

More improvements to GEMS, by Matthew Whyte. Subelements now work better, and the agls and nzgls metadata sets now have the correct subelements.

Location:
trunk/gli
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/gli/classes/dictionary.properties

    r8930 r8932  
    11271127GEMS.Add_Value_Tooltip:Add a new value to the selected element
    11281128GEMS.AddAttribute:Add Attribute
     1129GEMS.AddElement:Add Element
    11291130GEMS.AddSet:Add Set
    11301131GEMS.AddValue:Add Value
     
    11371138GEMS.Attribute_Value_Tooltip:The value of the new attribute
    11381139GEMS.Attributes:Attributes
     1140GEMS.Cannot_Undo:(this action cannot be undone)
    11391141GEMS.Cannot_Add_Elements_To_Greenstone_MDS:You cannot manually add elements to the Greenstone Metadata. If\nnecessary create a new set, then add your new element to it instead.
    11401142GEMS.Confirm_Removal:Are you sure you wish to remove this {0}?
  • trunk/gli/metadata/agls.mds

    r8747 r8932  
    6161        <Attribute language="en" name="obligation">Mandatory</Attribute>
    6262        <Attribute language="en" name="comment">Typically, Date will be associated with the creator or availability of the resource. Recommended best practice for encoding the date value is defined in a profile of ISO 8601 [W3CDTF] and follows the YYYY-MM-DD format.</Attribute>
     63        <Element name="created">
     64            <Attribute language="en" name="identifier">Created</Attribute>
     65            <Attribute language="en" name="definition">Creation date of the resource</Attribute>
     66            <Attribute language="en" name="qualifier type">element refinement</Attribute>
     67        </Element>
     68        <Element name="modified">
     69            <Attribute language="en" name="identifier">Modified</Attribute>
     70            <Attribute language="en" name="definition">Creation date of the resource</Attribute>
     71            <Attribute language="en" name="qualifier type">element refinement</Attribute>
     72        </Element>
     73        <Element name="valid">
     74            <Attribute language="en" name="identifier">Valid</Attribute>
     75            <Attribute language="en" name="comment">Typically, a date the resource becomes valid or ceases to be valid, or the date range for which the resource is valid.</Attribute>
     76            <Attribute language="en" name="definition">A date (often a range) of validity of a resource.</Attribute>
     77            <Attribute language="en" name="qualifier type">element refinement</Attribute>
     78        </Element>
     79        <Element name="issued">
     80            <Attribute language="en" name="qualifier type">element refinement</Attribute>
     81            <Attribute language="en" name="definition">A date on which the rescource was made formally available in its current form.</Attribute>
     82            <Attribute language="en" name="identifier">Issued</Attribute>
     83        </Element>
    6384    </Element>
    6485    <Element name="Title">
     
    6788        <Attribute language="en" name="obligation">Mandatory</Attribute>
    6889        <Attribute language="en" name="comment">This qualifier could include abbreviations and acronyms by which a resource may be known.</Attribute>
     90        <Element name="alternative">
     91            <Attribute language="en" name="identifier">Alternative</Attribute>
     92            <Attribute language="en" name="qualifier type">element refinement</Attribute>
     93            <Attribute language="en" name="definition">Any form of the title used as a substitute or alternative to the formal title or the resource</Attribute>
     94            <Attribute language="en" name="comment">This qualifier could include abbreviations and acronyms by which a resource may be known.</Attribute>
     95        </Element>
    6996    </Element>
    7097    <Element name="Availability">
    71         <Attribute language="en" name="identifier">Availability</Attribute>
    7298        <Attribute language="en" name="definition">How the resource can be obtained or contact information for obtaining the resource.</Attribute>
    7399        <Attribute language="en" name="obligation">Mandatory for offline resources.</Attribute>
    74100        <Attribute language="en" name="comment">The Availability element is primarily used for non-electronic resources to provide information on how to obtain physical access to the resource.</Attribute>
     101        <Attribute language="en" name="identifier">Availability</Attribute>
    75102    </Element>
    76103    <Element name="Function">
     
    115142        <Attribute language="en" name="obligation">Optional</Attribute>
    116143        <Attribute language="en" name="comment">Coverage will typically include spatial location (a place name or geographic coordinates), temporal period (a period label, date, or date range) or jurisdiction (such as a named administrative entity). Recommended best practice is to select a value from a controlled vocabulary (for example, the Thesaurus of Geographic Names [TGN]) and that, where appropriate, named places or time periods be used in preference to numeric identifiers such as sets of coordinates or date ranges. </Attribute>
     144        <Element name="jurisdiction">
     145            <Attribute language="en" name="identifier">Jurisdiction</Attribute>
     146            <Attribute language="en" name="qualifier type">element refinement</Attribute>
     147            <Attribute language="en" name="definition">The name of the political/administrative entity covered by the content of the resource.</Attribute>
     148            <Attribute language="en" name="comment">Jurisdiction is a description of the territory over which a particular government exercises its authority or a particualar business transacts its operations, to which the resource content is applicable.</Attribute>
     149        </Element>
     150        <Element name="spatial">
     151            <Attribute language="en" name="identifier">Spatial</Attribute>
     152            <Attribute language="en" name="qualifier type">element refinement</Attribute>
     153            <Attribute language="en" name="definition">Spatial (geographic) characteristics of the intellectual content of the resource.</Attribute>
     154        </Element>
     155        <Element name="temporal">
     156            <Attribute language="en" name="identifier">Temporal</Attribute>
     157            <Attribute language="en" name="qualifier type">element refinement</Attribute>
     158            <Attribute language="en" name="definition">Temporal characteristics of the intellectual content of the resource.</Attribute>
     159        </Element>
     160        <Element name="postcode">
     161            <Attribute language="en" name="identifier">Postcode</Attribute>
     162            <Attribute language="en" name="qualifier type">element refinement</Attribute>
     163            <Attribute language="en" name="definition">Australian postcode(s) applicable to the spatial coverage of the resource content.</Attribute>
     164            <Attribute language="en" name="comment">Postcode refers to the actual Australian postcode(s) which is relevant to the spatial coverage of the resource content. This qualifier will be of particular use in describing services.</Attribute>
     165        </Element>
    117166    </Element>
    118167    <Element name="Description">
     
    127176        <Attribute language="en" name="obligation">Optional</Attribute>
    128177        <Attribute language="en" name="comment">Typically, Format may include the media-type or dimensions of the resource. Format may be used to determine the software, hardware or other equipment needed to display or operate the resource. Examples of dimensions include size and duration. Recommended best practice is to select a value from a controlled vocabulary (for example, the list of Internet Media Types [MIME] defining computer media formats).</Attribute>
     178        <Element name="extent">
     179            <Attribute language="en" name="identifier">Extent</Attribute>
     180            <Attribute language="en" name="qualifier type">Element refinement</Attribute>
     181            <Attribute language="en" name="definition">The size or duration of the resource.</Attribute>
     182            <Attribute language="en" name="comment">The extent qualifier allows the description of the physical dimensions, file size or duration of the resource.</Attribute>
     183        </Element>
     184        <Element name="medium">
     185            <Attribute language="en" name="identifier">Medium</Attribute>
     186            <Attribute language="en" name="qualifier type">Element refinement</Attribute>
     187            <Attribute language="en" name="definition">The material or physical carrier of the resource.</Attribute>
     188        </Element>
    129189    </Element>
    130190    <Element name="Language">
     
    139199        <Attribute language="en" name="obligation">Optional </Attribute>
    140200        <Attribute language="en" name="comment">The element is useful to indicate the specific legal mandate which requires the resource being described to be created or provided to the public. The content of this element will usually be a reference to a specific Act, Regulation or Case, but may be a URI pointing to the legal instrument in question. </Attribute>
     201        <Element name="act">
     202            <Attribute language="en" name="identifier">Act</Attribute>
     203            <Attribute language="en" name="definition">A reference to a specific State or Federal Act which requires the creation or provision of the resource</Attribute>
     204            <Attribute language="en" name="qualifier type">Element refinement</Attribute>
     205        </Element>
     206        <Element name="regulation">
     207            <Attribute language="en" name="identifier">Regulation</Attribute>
     208            <Attribute language="en" name="definition">A reference to a specific regulation which requires the creation or provision of the resource.</Attribute>
     209            <Attribute language="en" name="qualifier type">Element refinement</Attribute>
     210        </Element>
     211        <Element name="case">
     212            <Attribute language="en" name="identifier">Case Law</Attribute>
     213            <Attribute language="en" name="qualifier type">Element refinement</Attribute>
     214            <Attribute language="en" name="definition">A reference to a specific case which requires the creation or provision of the resource</Attribute>
     215        </Element>
    141216    </Element>
    142217    <Element name="Relation">
     
    145220        <Attribute language="en" name="obligation">Optional</Attribute>
    146221        <Attribute language="en" name="comment">Recommended best practice is to reference the resource by means of a string or number conforming to a formal identification system.</Attribute>
     222        <Element name="isVersionOf">
     223            <Attribute language="en" name="identifier">Is Version Of</Attribute>
     224            <Attribute language="en" name="qualifier type">element refinement</Attribute>
     225            <Attribute language="en" name="definition">The described resource is a version, edition, or adaption of the referenced resource. Changes in version imply substative changes in content rather than differences in format.</Attribute>
     226        </Element>
     227        <Element name="hasVersion">
     228            <Attribute language="en" name="identifier">Has Version</Attribute>
     229            <Attribute language="en" name="qualifier type">element refinement</Attribute>
     230            <Attribute language="en" name="definition">The described resource has a version, edition, or adaptation, namely, the referenced resource.</Attribute>
     231        </Element>
     232        <Element name="isReplacedBy">
     233            <Attribute language="en" name="identifier">Is Replaced By</Attribute>
     234            <Attribute language="en" name="qualifier type">element refinement</Attribute>
     235            <Attribute language="en" name="definition">The described resource is supplanted, displaced, or superseded by the referenced resource.</Attribute>
     236        </Element>
     237        <Element name="replaces">
     238            <Attribute language="en" name="identifier">Replaces</Attribute>
     239            <Attribute language="en" name="qualifier type">element refinement</Attribute>
     240            <Attribute language="en" name="definition">The described resources supplants, displaces, or supersedes the referenced reource.</Attribute>
     241        </Element>
     242        <Element name="isRequiredBy">
     243            <Attribute language="en" name="identifier">Is Required By</Attribute>
     244            <Attribute language="en" name="qualifier type">element refinement</Attribute>
     245            <Attribute language="en" name="definition">The described resource is required by the referenced resource, either physically or logically. </Attribute>
     246        </Element>
     247        <Element name="requires">
     248            <Attribute language="en" name="identifier">Requires</Attribute>
     249            <Attribute language="en" name="qualifier type">element refinement</Attribute>
     250            <Attribute language="en" name="definition">The described resource requires the referenced resource to support its function, delivery, or coherence of content. </Attribute>
     251        </Element>
     252        <Element name="isPartOf">
     253            <Attribute language="en" name="identifier">Is Part Of</Attribute>
     254            <Attribute language="en" name="qualifier type">element refinement</Attribute>
     255            <Attribute language="en" name="definition">The described resource is a physical or logical part of the referenced resource. </Attribute>
     256        </Element>
     257        <Element name="hasPart">
     258            <Attribute language="en" name="identifier">Has Part</Attribute>
     259            <Attribute language="en" name="qualifier type">element refinement</Attribute>
     260            <Attribute language="en" name="definition">The described resource includes the referenced resource either physically or logically. </Attribute>
     261        </Element>
     262        <Element name="isReferencedBy">
     263            <Attribute language="en" name="identifier">Is Referenced By</Attribute>
     264            <Attribute language="en" name="qualifier type">element refinement</Attribute>
     265            <Attribute language="en" name="definition">The described resource is referenced, cited, or otherwise pointed to by the referenced resource. </Attribute>
     266        </Element>
     267        <Element name="references">
     268            <Attribute language="en" name="identifier">References</Attribute>
     269            <Attribute language="en" name="qualifier type">element refinement</Attribute>
     270            <Attribute language="en" name="definition">The described resource references, cites, or otherwise points to the referenced resource. </Attribute>
     271        </Element>
     272        <Element name="isFormatOf">
     273            <Attribute language="en" name="identifier">Is Format Of</Attribute>
     274            <Attribute language="en" name="qualifier type">element refinement</Attribute>
     275            <Attribute language="en" name="definition">The described resource is the same intellectual content of the referenced resource, but presented in another format. </Attribute>
     276        </Element>
     277        <Element name="hasFormat">
     278            <Attribute language="en" name="identifier">Has Format</Attribute>
     279            <Attribute language="en" name="qualifier type">element refinement</Attribute>
     280            <Attribute language="en" name="definition">The described resource pre-existed the referenced resource, which is essentially the same intellectual content presented in another format. </Attribute>
     281        </Element>
     282        <Element name="isBasisFor">
     283            <Attribute language="en" name="identifier">Is Basis For</Attribute>
     284            <Attribute language="en" name="qualifier type">element refinement</Attribute>
     285            <Attribute language="en" name="definition">The described resource pre-existed the referenced resource, which is a performance, production, derivation, translation, or interpretation of the described resource. </Attribute>
     286        </Element>
     287        <Element name="isBasedOn">
     288            <Attribute language="en" name="identifier">Is Based On</Attribute>
     289            <Attribute language="en" name="qualifier type">element refinement </Attribute>
     290            <Attribute language="en" name="definition">The described resource is a performance, production, derivation, translation, or interpretation of the referenced resource. </Attribute>
     291        </Element>
    147292    </Element>
    148293    <Element name="Rights">
     
    163308        <Attribute language="en" name="obligation">Optional</Attribute>
    164309        <Attribute language="en" name="comment">Type includes terms describing general categories, genres, or aggregation levels for content. Recommended best practice is to select a value from a controlled vocabulary (for example, the working draft list of Dublin Core Types [DCT1]). To describe the physical or digital manifestation of the resource, use the FORMAT element.</Attribute>
     310        <Element name="category">
     311            <Attribute language="en" name="identifier">Category</Attribute>
     312            <Attribute language="en" name="qualifier type">element refinement </Attribute>
     313            <Attribute language="en" name="definition">The generic type of the resource being described. </Attribute>
     314            <Attribute language="en" name="comment">The value for this qualifier must be one of either service, document, or agency. </Attribute>
     315        </Element>
     316        <Element name="aggregtionLevel">
     317            <Attribute language="en" name="identifier">Aggregtion Level</Attribute>
     318            <Attribute language="en" name="qualifier type">Element refinement</Attribute>
     319            <Attribute language="en" name="definition">The level of aggregation of the resource being described.</Attribute>
     320            <Attribute language="en" name="comment">There are only two values possible for this qualifier, either item or collection.</Attribute>
     321        </Element>
     322        <Element name="documentType">
     323            <Attribute language="en" name="identifier">Document Type</Attribute>
     324            <Attribute language="en" name="qualifier type">Element refinement</Attribute>
     325            <Attribute language="en" name="definition">The form of the resource where category = document.</Attribute>
     326            <Attribute language="en" name="comment">Document is used in its widest sense and includes such things as software sound files and images. </Attribute>
     327        </Element>
     328        <Element name="serviceType">
     329            <Attribute language="en" name="identifier">Service Type</Attribute>
     330            <Attribute language="en" name="qualifier type">Element refinement</Attribute>
     331            <Attribute language="en" name="definition">The type of service being offered where category = service. </Attribute>
     332        </Element>
    165333    </Element>
    166334</MetadataSet>
  • trunk/gli/metadata/nzgls.mds

    r8747 r8932  
    6565        <Description language="en">The NZGLS metadata standard is the official New Zealand Government standard for creating discovery-level metadata (see Cabinet Circular CO (02) 3). The standard is based closely on two well established standards: the Dublin Core Metadata Element Set and the Australian Government Locator Service.</Description>
    6666    </SetLanguage>
    67     <!-- Maori Version sourced from http://www.tki.org.nz/r/maori/pedagogy/dc_elements_m.php -->
    68     <SetLanguage code="mi">
    69         <Name>Dublin Core Huanga - Maori (He Tauira)</Name>
    70     </SetLanguage>
    71     <!-- French Version sourced from http://www-rocq.inria.fr/%7Evercoust/METADATA/DC-fr.1.1.html -->
    72     <!--  by Anne-Marie Vercoustre, Inria -->
    73     <SetLanguage code="fr">
    74         <Name language="fr">Eléments de métadonnées du Dublin Core, Version 1.1: Description de Réference</Name>
    75         <Description language="fr">Ce document résume les derniÚres définitions des éléments demétadonnées du Dublin Core originellement définis dans le document[RFC2413]. Ces nouvelles définitions seront officiellement connues comme la Version 1.1. Elles utilisent un standard défini formellement pour la description d&apos;éléments de métadonnées. Cette formalisation contribue à améliorer la cohérence avec d&apos;autres communautés décrivant des métadonnées et à augmenter la précision, la portée et la cohérence interne de la définition des éléments du Dublin Core.</Description>
    76     </SetLanguage>
    77     <!-- Russian Version sourced from -->
    78     <!-- by Olga Barysheva, National Library of Russia -->
    79     <SetLanguage code="ru">
    80         <Name language="ru">НабПр элеЌеМтПв ЌетаЎаММыÑ
    81  Dublin Core (ДублОМскПгП яЎра) ВерсОя 1.1: СправПчМПе ПпОсаМОе</Name>
    82         <Description language="ru">НастПящОй ЎПкуЌеМт ПбПбщает ПбМПвлеММые ПпреЎелеМОя элеЌеМтПв ЌетаЎаММыÑ
    83  Dublin Core (ДублОМскПгП яЎра), первПМачальМП ПпреЎелеММыÑ
    84  Ð² RFC2413 (МетаЎаММые Dublin Core Ўля МаÑ
    85 ÐŸÐ¶ÐŽÐµÐœÐžÑ ресурсПв). ЭтО МПвые ПпреЎелеМОя ПфОцОальМП ОзвестМы как ВерсОя 1.1.</Description>
    86     </SetLanguage>
    87     <!-- Spanish Version sourced from http://www.rediris.es/metadata/. Please note that this is a translation for Dublin Core v1.0 -->
    88     <!-- by Javi Masa, RedIRIS -->
    89     <SetLanguage code="es">
    90         <Name language="es">Elementos del conjunto de metadatas de Dublin Core: Descripción de Referencia</Name>
    91         <Description language="es">Este documento corresponde a una traducción del original en lengua inglesa, con fecha 02/11/1997 que se encuentra en http://purl.org/metadata/dublin_core_elements. Este documento es una descripción de referencia de los elementos del conjunto de &quot;Dublin Core&quot;. Para más información sobre reuniones de trabajo, documentos de trabajo, proyectos y nuevos desarrollos relacionados con el conjunto de elementos que aquí se describen consultar la &quot;Home Page&quot; de &quot;Dublin Core&quot; (http://purl.org/metadata/dublin_core). Los elementos poseen nombres descriptivos que pretenden transmitir un significado semántico a los mismos. Para promover una interoperabilidad global, una descripción del valor de algunos elementos prodrá ser asociada a vocabularios controlados. Se asume que otros vocabularios controlados serán desarrollados para asegurar esta interoperabilidad en dominios específicos. Cada elemento es opcional y puede repetirse. Además, los elementos pueden aparecer en cualquier orden. Aunque algunos entornos, como HTML, no diferencian entre mayúsculas y minúsculas, es recomendable escribir correctamente cada metadata según su definición para evitar conflictos con otros entornos, como XML (Extensible Markup Language) http://www.w3.org/TR/PR-xml</Description>
    92     </SetLanguage>
    93     <!-- Arabic Version sourced from http://haddouti.de/DC_arabic.html -->
    94     <!-- maintained by Hachim Haddouti. -->
    95     <SetLanguage code="ar">
    96         <Name>دؚلين كور</Name>
    97         <Description>نرحؚ ØšÙƒÙ
    98  ÙÙŠ صفحة  د ؚلين كو  ر ؚالعرؚي    في  هذه الصفحة  و ؚالتعاون Ù
    99 Ø¹ الاخوان العرؚ Ù
    100 Ù† الÙ
    101 ÙƒØªØšØ§ØªØŒ دار الن؎ر، الؚحوث العلÙ
    102 ÙŠØ© و    ور؎ة عÙ
    103 Ù„Working Group On Multilingual Dublin Core (DC-International) ،</Description>
    104     </SetLanguage>
    105     <!-- Chinese - Simplified Version from http://dc.library.sh.cn/DC/1-1.htm -->
    106     <!-- by Liu Wei, Shanghai Library -->
    107     <SetLanguage code="cn">
    108         <Name>郜柏林栞心å
    109 ƒæ•°æ®å
    110 ƒçŽ é›†1.1版参考描述</Name>
    111         <Description>本文档å
    112 ³äºŽéƒœæŸæž—栞心å
    113 ƒæ•°æ®å
    114 ƒçŽ é›†1.1版本的参考描述。歀描述䞎已经提亀给ISO甚于囜é™
    115 æŠ•ç¥šçš„NISO官方标准保持䞀臎。    郜柏林栞心å
    116 ƒæ•°æ®é›†æ˜¯äž€ç§è·šé¢†åŸŸçš„信息资源描述标准。这里的信息资源被定义䞺“任䜕å
    117 ·æœ‰æ ‡è¯†çš„䞜西”。歀定义来自于Tim Berners-Lee等人所著的Internet RFC2396 &quot;Uniform Resource Identifiers (URI): Generic Syntax&quot;文件。郜柏林栞心å
    118 ƒæ•°æ®çš„应甚领域没有根本的限制。</Description>
    119     </SetLanguage>
    120     <!-- Czech Version from http://www.ics.muni.cz/dublin_core/DC-czech-1.1.html -->
    121     <!-- Ustav vypocetni techniky Masarykovy univerzity v Brne -->
    122     <SetLanguage code="cs">
    123         <Name>Soubor metadatovÃœch prvků Dublin Core, verze 1.1: referenční popis</Name>
    124         <Description>Tento dokument je českÃœm překladem anglické verze referenčního popisu souboru metadatovÃœch prvků  Dublin Core, verze 1.1 [DCEN1.1]. Tento dokument nahrazuje českÃœ překlad souboru metadatovÃœch prvků Dublin Core, verze 1.0 [DCCS1.0]. Další informace o pracovních seminářích (workshopech), zprávách, studiích pracovních skupin, projektech a dalším vÃœvoji souboru metadatovÃœch prvků Dublin Core najdete na domovské stránce Dublin Core (http://purl.org/dc)</Description>
    125     </SetLanguage>
    126     <!-- Dutch Version from http://www.kb.nl/coop/donor/project-nl-index.html?/coop/donor/rapporten/DCsimpleformat.html -->
    127     <!-- by ... -->
    128     <SetLanguage code="nl">
    129         <Name>Rapporten Dublin Core Simple Format</Name>
    130         <Description>Dit document beschrijft welke Dublin Core metadata elementen er zijn en geeft een korte definitie van elk element. Voor uitgebreide uitleg en gebruik van de Dublin Core elementen wordt u verwezen naar de gebruikershandleiding. Deze vertaling geeft ook de keuzes aan voor standaarden (taalcodes, datum codes) die wij in DONOR verband gaan hanteren. In zoverre kan deze vertaling afwijken van het oorspronkelijke document &quot;Description of Dublin Core Elements&quot; http://purl.org/metadata/dublin_core_elements&quot;</Description>
    131     </SetLanguage>
    132     <!-- Finnish Version from http://www.lib.helsinki.fi/dublin_core/dcref-fin.html -->
    133     <!-- by Jani Stenvall and Juha Hakala, Helsinki University Library -->
    134     <SetLanguage code="fi">
    135         <Name/>
    136         <Description/>
    137     </SetLanguage>
    138     <!-- Interlingua Version sourced from http://www.nautilus.com.br/%7Eensjo/ia/purl.org/dc/documents/rec-dces-19990702.htm -->
    139     <!-- by Emerson Jose` Silveira da Costa -->
    140     <SetLanguage code="ia">
    141         <Name>Collection de elementos de metadatos de Dublin Core, version 1.1: Description de referentia</Name>
    142         <Description>Isto es un traduction de un Recommendation del Dublin Core Metadata Initiative. Le publication como un recommendation significa que le specificationes es stabile e su adoption es supportate per le communitate Dublin Core (http://purl.org/dc/).</Description>
    143     </SetLanguage>
    144     <!-- Marathi Version sourced from http://bioinfo.ernet.in/library/dc/ele.txt -->
    145     <!-- by by Shubhada Nagarkar, Bioinformatics Centre, University of Pune -->
    146     <SetLanguage code="mr">
    147         <Name>à€¡à€¬à¥à€²à€¿à€š à€•à¥‹à€° à€®à¥‡à€Ÿà€Ÿà€¡à¥‡à€Ÿà€Ÿ à€žà¥‡à€Ÿ à€†à€µà¥ƒà€€à¥à€€à¥€ १.१ à€žà€‚à€Šà€°à¥à€­ à€žà¥à€ªà€·à¥à€Ÿà¥€à€•à€°à€£ १.१ à€¡à€¬à¥à€²à€¿à€š à€•à¥‹à€° à€®à¥‡à€Ÿà€Ÿà€¡à¥‡à€Ÿà€Ÿà€†à€µà¥ƒà€€à¥à€€à¥€ १.१.</Name>
    148         <Description>१.१ à€¡à€¬à¥à€²à€¿à€š à€•à¥‹à€° à€®à¥‡à€Ÿà€Ÿà€¡à¥‡à€Ÿà€Ÿ à€¹à¥‡ à€µà¥‡à€—à€µà¥‡à€—à€³à¥à€¯à€Ÿ à€µà€¿à€·à€¯à€Ÿà€€à¥€à€² à€®à€Ÿà€¹à¥€à€€à¥€ à€žà€Ÿà€ à¥à€¯à€Ÿà€‚à€µà€Šà¥à€Šà€²à€šà¥€ à€®à€Ÿà€¹à¥€à€€à¥€ à€Šà¥‡à€£à¥à€¯à€Ÿà€šà¥‡ à€®à€Ÿà€šà€• à€†à€¹à¥‡.  à€¯à€Ÿà€€ à€®à€Ÿà€¹à¥€à€€à¥€à€žà€Ÿà€ à€Ÿ à€®à¥à€¹à€£à€œà¥‡ à€œà¥à€¯à€Ÿà€²à€Ÿ à€“à€³à€– à€†à€¹à¥‡ à€
    149 à€žà€Ÿ à€†à€žà€€à¥‹.  à€
    150 à€¶à€Ÿ à€ªà¥à€°à€•à€Ÿà€°à€šà¥€ à€µà¥à€¯à€Ÿà€–à¥à€¯à€Ÿ à€®à€Ÿà€¹à¥€à€€à¥€ à€œà€Ÿà€³à¥à€¯à€µà€°à¥€à€² à€†. à€à€«.à€žà¥€. ग़३९६URI: Generic Syntax -- Tim Berners Lee et al. à€¡à€¬à¥à€²à€¿à€š à€•à¥‹à€° à€®à€Ÿà€šà€• à€•à¥‹à€£à€€à¥à€¯à€Ÿà€¹à¥€ à€ªà¥à€°à€•à€Ÿà€°à€šà¥à€¯à€Ÿ à€®à€Ÿà€¹à¥€à€€à¥€ à€žà€Ÿà€ à¥à€¯à€Ÿà€‚à€žà€Ÿà€ à¥€ à€µà€Ÿà€ªà€°à€€à€Ÿ à€¯à¥‡à€€à¥‹.  à€€à¥à€¯à€Ÿà€žà€Ÿà€ à¥€ à€•à¥‹à€£à€€à€Ÿà€¹à¥€ à€®à€œà¥à€œà€Ÿà€µ à€šà€Ÿà€¹à¥€.</Description>
    151     </SetLanguage>
    15267    <Element name="Title" remember_values="true">
    15368        <!-- English -->
     
    626541        <Attribute language="en" name="definition">A specific warrant which requires the resource to be created or provided.</Attribute>
    627542        <Attribute language="en" name="comment">The element is useful to indicate the specific legal mandate that requires the resource being described to be created or provided to the public. The content of this element will usually be a reference to a specific Act, Regulation or Case, but may be a URI pointing to the legal instrument in question.</Attribute>
     543        <Element name="act">
     544            <Attribute language="en" name="identifier">Act</Attribute>
     545            <Attribute language="en" name="qualifier type">element refinement</Attribute>
     546            <Language code="en">
     547                <Attribute name="definition">A reference to a specific Act of Parliament which requires the creation or provision of the resource.</Attribute>
     548            </Language>
     549        </Element>
     550        <Element name="regulation">
     551            <Attribute language="en" name="identifier">Regulation</Attribute>
     552            <Attribute language="en" name="qualifier type">element refinement</Attribute>
     553            <Language code="en">
     554                <Attribute name="definition">A reference to a specific regulation which requires the creation or provision of the resource.</Attribute>
     555            </Language>
     556        </Element>
     557        <Element name="rules">
     558            <Attribute language="en" name="identifier">Rules</Attribute>
     559            <Attribute language="en" name="qualifier type">element refinement</Attribute>
     560            <Language code="en">
     561                <Attribute name="definition">The specific rule or bylaw which requires the creation or provision of the resource.</Attribute>
     562            </Language>
     563        </Element>
     564        <Element name="case">
     565            <Attribute language="en" name="identifier">Case Law</Attribute>
     566            <Attribute language="en" name="qualifier type">element refinement</Attribute>
     567            <Language code="en">
     568                <Attribute name="definition">A reference to a specific case which requires the creation or provision of the resource.</Attribute>
     569            </Language>
     570        </Element>
    628571    </Element>
    629572    <Element name="Contributor" remember_values="true">
     
    833776        <Attribute name="datatype">Charater String</Attribute>
    834777        <Attribute name="maximum_occurance">Unlimited</Attribute>
     778        <Element name="created">
     779            <Attribute language="en" name="identifier">Created</Attribute>
     780            <Attribute language="en" name="qualifier type">element refinement</Attribute>
     781            <Language code="en">
     782                <Attribute name="definition">Date of creation of the resource.</Attribute>
     783            </Language>
     784        </Element>
     785        <Element name="modified">
     786            <Attribute language="en" name="identifier">Modified</Attribute>
     787            <Attribute language="en" name="qualifier type">element refinement</Attribute>
     788            <Language code="en">
     789                <Attribute name="definition">Date on which the resource was changed.</Attribute>
     790            </Language>
     791        </Element>
     792        <Element name="valid">
     793            <Attribute language="en" name="identifier">Valid</Attribute>
     794            <Attribute language="en" name="qualifier type">element refinement</Attribute>
     795            <Language code="en">
     796                <Attribute name="definition">Date (often a range) of validity of a resource.</Attribute>
     797                <Attribute name="comment">Typically, a date the resource becomes valid or ceases to be valid, or the date range for which the resource is valid.</Attribute>
     798            </Language>
     799        </Element>
     800        <Element name="issued">
     801            <Attribute language="en" name="identifier">Issued</Attribute>
     802            <Attribute language="en" name="qualifier type">element refinement</Attribute>
     803            <Language code="en">
     804                <Attribute name="definition">Date of formal issuance (e.g. publication) of the resource.</Attribute>
     805            </Language>
     806        </Element>
     807        <Element name="available">
     808            <Attribute language="en" name="identifier">Available</Attribute>
     809            <Attribute language="en" name="qualifier type">element refinement</Attribute>
     810            <Language code="en">
     811                <Attribute name="definition">Date (often a range) that the resource will become or did become available.</Attribute>
     812            </Language>
     813        </Element>
    835814    </Element>
    836815    <Element name="Type" remember_values="true">
     
    931910        <Attribute name="datatype">Charater String</Attribute>
    932911        <Attribute name="maximum_occurance">Unlimited</Attribute>
     912        <Element name="category">
     913            <Attribute language="en" name="identifier">Category</Attribute>
     914            <Attribute language="en" name="type">element refinement</Attribute>
     915            <Language code="en">
     916                <Attribute name="definition">The generic type of the resource being described.</Attribute>
     917                <Attribute name="comment">The value for this qualifier must be one of service, document, or agency.</Attribute>
     918            </Language>
     919            <Attribute language="en" name="source">AGLS</Attribute>
     920            <Attribute language="en" name="service">used when describing a service directly, not a document about a service.</Attribute>
     921            <Attribute language="en" name="document">used for all resources which are not services or agencies, even if they are no traditional &amp;quot;documents&amp;quot; - for example, a sculpture;</Attribute>
     922            <Attribute language="en" name="agency">used to describe an organisation</Attribute>
     923        </Element>
     924        <Element name="aggregationLevel">
     925            <Attribute language="en" name="identifier">Aggregation Level</Attribute>
     926            <Attribute language="en" name="qualifier type">element refinement</Attribute>
     927            <Language code="en">
     928                <Attribute name="definition">The level of aggregation of the resource being described.</Attribute>
     929                <Attribute name="comment">There are only two values possible for this qualifier, either item or collection.</Attribute>
     930            </Language>
     931        </Element>
    933932    </Element>
    934933    <Element name="Format" remember_values="true">
     
    10311030        <Attribute name="datatype">Charater String</Attribute>
    10321031        <Attribute name="maximum_occurance">Unlimited</Attribute>
     1032        <Element name="extent">
     1033            <Attribute language="en" name="identifier">Extent</Attribute>
     1034            <Attribute language="en" name="qualifier type">element refinement</Attribute>
     1035            <Language code="en">
     1036                <Attribute name="definition">The size or duration of the resource.</Attribute>
     1037                <Attribute name="comment">The extent qualifier allows the description of the physical dimensions, file size or duration of the resource.</Attribute>
     1038            </Language>
     1039        </Element>
     1040        <Element name="medium">
     1041            <Attribute language="en" name="identifier">Medium</Attribute>
     1042            <Attribute language="en" name="qualifier type">element refinement</Attribute>
     1043            <Language code="en">
     1044                <Attribute name="definition">The material or physical carrier of the resource.</Attribute>
     1045            </Language>
     1046        </Element>
    10331047    </Element>
    10341048    <Element name="Availability">
     
    14561470        <Attribute name="datatype">Charater String</Attribute>
    14571471        <Attribute name="maximum_occurance">Unlimited</Attribute>
     1472        <Element name="isVersionOf">
     1473            <Attribute language="en" name="identifier">Is Version Of</Attribute>
     1474            <Attribute language="en" name="qualifier type">element refinement</Attribute>
     1475            <Language code="en">
     1476                <Attribute name="definition">The described resource is a version, edition, or adaptation of the referenced resource. Changes in version imply substantive changes in content rather than differences in format.</Attribute>
     1477            </Language>
     1478        </Element>
     1479        <Element name="hasVersion">
     1480            <Attribute language="en" name="identifier">Has Version</Attribute>
     1481            <Attribute language="en" name="qualifier type">element refinement</Attribute>
     1482            <Language code="en">
     1483                <Attribute name="definition">The described resource has a version, edition, or adaptation, namely, the referenced resource.</Attribute>
     1484            </Language>
     1485        </Element>
     1486        <Element name="isReplacedBy">
     1487            <Attribute language="en" name="identifier">Is Replaced By</Attribute>
     1488            <Attribute language="en" name="qualifier type">element refinement</Attribute>
     1489            <Language code="en">
     1490                <Attribute name="definition">The described resource is supplanted, displaced, or superseded by the referenced resource.</Attribute>
     1491            </Language>
     1492        </Element>
     1493        <Element name="replaces">
     1494            <Attribute language="en" name="identifier">Replaces</Attribute>
     1495            <Attribute language="en" name="qualifier type">element refinement</Attribute>
     1496            <Language code="en">
     1497                <Attribute name="definition">The described resource supplants, displaces, or supersedes the referenced resource.</Attribute>
     1498            </Language>
     1499        </Element>
     1500        <Element name="isRequiredBy">
     1501            <Attribute language="en" name="identifier">Is Required By</Attribute>
     1502            <Attribute language="en" name="qualifier type">element refinement</Attribute>
     1503            <Language code="en">
     1504                <Attribute name="definition">The described resource is required by the referenced resource, either physically or logically.</Attribute>
     1505            </Language>
     1506        </Element>
     1507        <Element name="requires">
     1508            <Attribute language="en" name="identifier">Requires</Attribute>
     1509            <Attribute language="en" name="qualifier type">element refinement</Attribute>
     1510            <Language code="en">
     1511                <Attribute name="definition">The described resource requires the referenced resource to support its function, delivery, or coherence of content.</Attribute>
     1512            </Language>
     1513        </Element>
     1514        <Element name="isPartOf">
     1515            <Attribute language="en" name="identifier">Is Part Of</Attribute>
     1516            <Attribute language="en" name="qualifier type">element refinement</Attribute>
     1517            <Language code="en">
     1518                <Attribute name="definition">The described resource is a physical or logical part of the referenced resource.</Attribute>
     1519                <Attribute name="comment">Used to describe the relationship between a service and relevant documents (e.g. web pages and forms)</Attribute>
     1520            </Language>
     1521        </Element>
     1522        <Element name="hasPart">
     1523            <Attribute language="en" name="identifier">Has Part</Attribute>
     1524            <Attribute language="en" name="qualifier type">element refinement</Attribute>
     1525            <Language code="en">
     1526                <Attribute name="definition">The described resource includes the referenced resource either physically or logically.</Attribute>
     1527            </Language>
     1528        </Element>
     1529        <Element name="isReferencedBy">
     1530            <Attribute language="en" name="identifier">Is Referenced By</Attribute>
     1531            <Attribute language="en" name="qualifier type">element refinement</Attribute>
     1532            <Language code="en">
     1533                <Attribute name="definition">The described resource is referenced, cited, or otherwise pointed to by the referenced resource.</Attribute>
     1534            </Language>
     1535        </Element>
     1536        <Element name="references">
     1537            <Attribute language="en" name="identifier">References</Attribute>
     1538            <Attribute language="en" name="qualifier type">element refinement</Attribute>
     1539            <Language code="en">
     1540                <Attribute name="definition">The described resource references, cites, or otherwise points to the referenced resource.</Attribute>
     1541            </Language>
     1542        </Element>
     1543        <Element name="isFormatOf">
     1544            <Attribute language="en" name="identifier">Is Format Of</Attribute>
     1545            <Attribute language="en" name="qualifier type">element refinement</Attribute>
     1546            <Language code="en">
     1547                <Attribute name="definition">The described resource is the same intellectual content of the referenced resource, but presented in another format.</Attribute>
     1548            </Language>
     1549        </Element>
     1550        <Element name="hasFormat">
     1551            <Attribute language="en" name="identifier">Has Format</Attribute>
     1552            <Attribute language="en" name="qualifier type">element refinement</Attribute>
     1553            <Language code="en">
     1554                <Attribute name="definition">The described resource pre-existed the referenced resource, which is essentially the same intellectual content presented in another format.</Attribute>
     1555            </Language>
     1556        </Element>
     1557        <Element name="isBasisFor">
     1558            <Attribute language="en" name="identifier">Is Basis For</Attribute>
     1559            <Attribute language="en" name="qualifier type">element refinement</Attribute>
     1560            <Language code="en">
     1561                <Attribute name="definition">The described resource pre-existed the referenced resource, which is a performance, production, derivation, translation, or interpretation of the described resource.</Attribute>
     1562            </Language>
     1563        </Element>
     1564        <Element name="isBasedOn">
     1565            <Attribute language="en" name="identifier">Is Based On</Attribute>
     1566            <Attribute language="en" name="qualifier type">element refinement</Attribute>
     1567            <Language code="en">
     1568                <Attribute name="definition">The described resource is a performance, production, derivation, translation, or interpretation of the referenced resource.</Attribute>
     1569            </Language>
     1570        </Element>
    14581571    </Element>
    14591572    <Element name="Coverage" remember_values="true">
     
    15791692        <Attribute name="datatype">Charater String</Attribute>
    15801693        <Attribute name="maximum_occurance">Unlimited</Attribute>
     1694        <Element name="jurisdiction">
     1695            <Attribute language="en" name="identifier">Jurisdiction</Attribute>
     1696            <Attribute language="en" name="qualifier type">element refinement</Attribute>
     1697            <Language code="en">
     1698                <Attribute name="definition">The name of the political/administrative entity covered by the content of the resource.</Attribute>
     1699                <Attribute name="comment">Jurisdiction is a description of the territory over which a particular government exercises its authority or a particular business transacts its operations, to which the resource content is applicable.</Attribute>
     1700            </Language>
     1701        </Element>
     1702        <Element name="spatial">
     1703            <Attribute language="en" name="identifier">Spatial</Attribute>
     1704            <Attribute language="en" name="qualifier type">element refinement</Attribute>
     1705            <Language code="en">
     1706                <Attribute name="definition">Spatial characteristics of the intellectual content of the resource.</Attribute>
     1707                <Attribute name="comment">Spatial (geographic) coverage or locations or areas covered in the content of a resource. Use of the New Zealand Geographic Place Names Database (LINZ) may be appropriate. In some cases the DCMI Box Encoding Scheme may be suitable. Refer: http//dublincore.org.documents/2000/07/28/dcmi-box/</Attribute>
     1708            </Language>
     1709        </Element>
     1710        <Element name="temporal">
     1711            <Attribute language="en" name="identifier">Temporal</Attribute>
     1712            <Attribute language="en" name="qualifier type">element refinement</Attribute>
     1713            <Language code="en">
     1714                <Attribute name="definition">Temporal characteristics of the intellectual content of the resource.</Attribute>
     1715                <Attribute name="comment">The refinement &amp;quot;temporal&amp;quot; refers to time periods that are covered by or discussed in the content of resource. Time periods will generally be best expressed as date ranges, although named periods may be appropriate. The recommended encoding schemes for dates and date ranges are noted in the section on Date.</Attribute>
     1716            </Language>
     1717        </Element>
    15811718    </Element>
    15821719    <Element name="Rights" remember_values="true">
  • trunk/gli/src/org/greenstone/gatherer/gems/ElementWrapper.java

    r8930 r8932  
    4545 **************************************************************************************/
    4646import java.util.TreeSet;
     47import java.util.ArrayList;
    4748import org.greenstone.gatherer.util.StaticStrings;
    4849import org.greenstone.gatherer.util.Troolean;
    4950import org.greenstone.gatherer.util.Utility;
     51import org.greenstone.gatherer.util.XMLTools;
    5052import org.w3c.dom.*;
    5153
     
    6062    /** A string prefix identifying the metadata set namespace. */
    6163    private String namespace = "";
    62 
    63     private NodeList subelements = null; //The list of subelements
     64    private ArrayList subelements = null; //The list of subelements
     65    // private XMLTools xmlTools = new XMLTools(); //uh, a class of XML tools, i guess
    6466
    6567    private Troolean is_extracted = new Troolean();
     
    6971    public ElementWrapper(Element element) {
    7072    this.element = element;
    71     //System.err.println("ElementWrapper: element is: " + element); //debug
    7273    Element parent =  (Element)element.getParentNode();
    7374    if (parent != null)
     
    7677        }
    7778   
    78     subelements = element.getElementsByTagName("Subelement");
     79    subelements = XMLTools.getChildElementsByTagName(element, "Element");
    7980    //Should read in each subelement's value tree?
    8081    }
     
    99100    {
    100101    //System.err.println("Want to see if subelement: " + name + " exists."); //debug
    101     for(int i = 0; i < subelements.getLength(); i++)
     102    for(int i = 0; i < subelements.size(); i++)
    102103        {
    103         Element sibling = (Element)subelements.item(i);
     104        Element sibling = (Element)subelements.get(i);
    104105        String sibling_name = sibling.getAttribute("name");
    105106        if(sibling_name.equals(name))
     
    113114
    114115    /**
     116       Method to add a subelement to the list of subelements.
     117       @param element the subelement to add to the list, as a <strong>Element</strong>
     118       @author Matthew Whyte
     119       Date last modified: 27/01/05
     120     */
     121    public void addSubelementToList(Element element)
     122    {
     123    subelements.add(element);
     124    }
     125
     126    /**
    115127       Method to acquire a list of all the subelements in the element.
    116128       @return A <strong>NodeList</strong> containing all of this element's subelements.
     
    119131       @date last modified: 19/01/04
    120132     */
    121     public NodeList getSubelements()
     133    public ArrayList getSubelements()
    122134    {
    123135    return subelements;
    124136    }
    125137
    126     /**
    127        Method to determine if this is a subelement
    128        @return A <strong>boolean</strong> - true if the 'element' is a subelement
    129        @author Matthew Whyte
    130        @date last modified 19/01/04
    131      */
    132     public boolean isSubelement()
    133     {
    134     Element element = this.getElement();
    135     if(element.getTagName().equals("Subelement"))
    136         {
    137         return true;
    138         }
    139     return false;
    140     }
    141138
    142139    /** Create a copy of this element wrapper.
     
    276273    /** Removes an Attribute node from the element. */
    277274    public boolean removeAttribute(String name, String language, String value) {
    278     return MSMUtils.removeElementAttribute(element, name, language, value);
     275    boolean sucess = MSMUtils.removeElementAttribute(element, name, language, value);
     276    if(!sucess)
     277        {
     278        //This should not happen.
     279        System.err.println("Error removing attribute \'" + name + "\' with value \'" + value +"\'");
     280        }
     281    return sucess;
    279282    }
    280283
  • trunk/gli/src/org/greenstone/gatherer/gems/GEMS.java

    r8930 r8932  
    3737
    3838
    39 
    4039import java.awt.*;
    4140import java.awt.event.*;
     
    8483    static final public int NORMAL     = 1;
    8584    static final public int REMOVE_SET = 2;
     85
    8686    /** The default size of the editor dialog. */
    8787    static final private Dimension ADD_ELEMENT_SIZE = new Dimension(400,125);
     
    121121    private AddFileActionListener add_file_action_listener = null;
    122122    public  AddSetActionListener add_set_action_listener = null;
    123     // private RenameElementActionListener rename_element_action_listener = null;
    124123    /** The class used to handle add or edit attribute actions has to be globally available so that we can dispose of its dialog properly. */
    125124    public AddOrEditAttributeActionListener add_or_edit_attribute_action_listener = null;
    126125    /** The class used to handle add or edit value actions has to be globally available so that we can dispose of its dialog properly. */
    127     public AddOrEditValueActionListener add_or_edit_value_action_listener = null;
     126    //public AddOrEditValueActionListener add_or_edit_value_action_listener = null;
    128127    private boolean ignore = false;
    129128    /** A card layout is used to switch between the two differing detail views. */
     
    131130    /** A card layout is used to switch between a value tree or an empty placeholder (if no value tree available). */
    132131    private CardLayout element_values_layout = null;
     132
    133133    /** Um, the size of the screen I'd guess. */
    134134    private Dimension screen_size = null;
     
    141141    private int current_attribute = -1;
    142142    private int current_attribute_type = -1;
    143     private JButton add_attribute = null;
    144     private JButton add_element = null;
    145     private JButton add_file = null;
    146     private JButton add_set = null;
    147     private JButton add_value = null;
    148     private JButton edit_attribute = null;
    149     private JButton edit_value = null;
    150     private JButton remove_attribute = null;
    151     private JButton remove_element = null;
    152     private JButton remove_file = null;
    153     private JButton remove_set = null;
    154     private JButton remove_value = null;
     143
    155144    private JLabel element_name = null;
    156145    private JLabel profile_name = null;
     
    175164    public org.w3c.dom.Element rootelement;
    176165   
    177    // public LanguageManager languageManager = new LanguageManager(rootelement);
    178166    //PopupListener provides right-click functionality to any component that needs it
    179167    //It is a centralized manager for all popups, then we use evt.Source() and determine where the
    180168    //event was performed
    181169    private PopupListener popupListener = new PopupListener(this);
    182 
    183     /**KeyPressedListener is a centralized manager for all key pressed action */
    184     //    private KeyPressedListener keyPressedListener = new KeyPressedListener();
    185170 
    186171    /** A tree that represents the current metadata sets associated with this collection. */
     
    194179    // Parse arguments
    195180    GetOpt go = new GetOpt(args);
    196         //org.w3c.dom.Document attiladoc = Utility.parse(new String("xml/languages.xml"),false);
    197        
    198       // attiladoc.getAttributes();
    199       // attiladoc.getAttributes();
    200        //System.out.println(attiladoc.getLocalName());
    201         //for(int k = 0; k < nnm.getLength(); k++) {
    202         //    System.out.println("My lang: " + nnm.item(k).toString());
    203            
    204        // }
    205     // Debugging control
    206       //  Configuration.setLocale("general.locale", true, new Locale("ar"));
    207        
     181
    208182    if (go.debug) {
    209183        DebugStream.enableDebugging();
     
    306280    JLabel set_name_label = new JLabel();
    307281    set_name_label.setOpaque(false);
    308     //Dictionary.setText(set_name_label, "GEMS.Name");
    309282    set_name = new JLabel();
    310     //set_name.setBorder(BorderFactory.createLoweredBevelBorder());
    311     //set_name.setOpaque(false);
    312283         
    313284    JPanel set_attributes_pane = new JPanel();
     
    336307    JLabel element_name_label = new JLabel();
    337308    element_name_label.setOpaque(false);
    338     //Dictionary.setText(element_name_label, "GEMS.Name");
    339     //element_name = new JLabel();
    340     //element_name.setBorder(BorderFactory.createLoweredBevelBorder());
    341     //element_name.setOpaque(false);
    342309         
    343310    JPanel element_inner_pane = new JPanel();
     
    409376    JLabel profile_name_label = new JLabel();
    410377    profile_name_label.setOpaque(false);
    411     //Dictionary.setText(profile_name_label, "GEMS.Name");
    412378    profile_name = new JLabel();
    413379    profile_name.setBorder(BorderFactory.createLoweredBevelBorder());
     
    457423    JPanel inner_button_pane = new JPanel();
    458424    inner_button_pane.setOpaque(false);
    459     add_attribute = new GLIButton();
    460     add_attribute.setMnemonic(KeyEvent.VK_4);
    461     Dictionary.setBoth(add_attribute, "GEMS.Add", "GEMS.Add_Attribute_Tooltip");
    462     add_element = new GLIButton();
    463     add_element.setMnemonic(KeyEvent.VK_3);
    464     Dictionary.setBoth(add_element, "GEMS.Add", "GEMS.Add_Element_Tooltip");
    465     add_file = new GLIButton();
    466     add_file.setMnemonic(KeyEvent.VK_2);
    467     Dictionary.setBoth(add_file, "GEMS.Add", "GEMS.Add_File_Tooltip");
    468     add_set = new GLIButton();
    469     add_set.setMnemonic(KeyEvent.VK_1);
    470     Dictionary.setBoth(add_set, "GEMS.Add", "GEMS.Add_Set_Tooltip");
    471     add_value = new GLIButton();
    472     add_value.setMnemonic(KeyEvent.VK_5);
    473     Dictionary.setBoth(add_value, "GEMS.Add", "GEMS.Add_Value_Tooltip");
    474 
    475     edit_attribute = new GLIButton();
    476     edit_attribute.setMnemonic(KeyEvent.VK_6);
    477     Dictionary.setBoth(edit_attribute, "GEMS.Edit", "GEMS.Edit_Attribute_Tooltip");
    478     edit_value = new GLIButton();
    479     edit_value.setMnemonic(KeyEvent.VK_7);
    480     Dictionary.setBoth(edit_value, "GEMS.Edit", "GEMS.Edit_Value_Tooltip");
    481 
    482     remove_attribute = new GLIButton();
    483     remove_attribute.setMnemonic(KeyEvent.VK_MINUS);
    484     Dictionary.setBoth(remove_attribute, "GEMS.Remove", "GEMS.Remove_Attribute_Tooltip");
    485     remove_element = new GLIButton();
    486     remove_element.setMnemonic(KeyEvent.VK_0);
    487     Dictionary.setBoth(remove_element, "GEMS.Remove", "GEMS.Remove_Element_Tooltip");
    488     remove_file = new GLIButton();
    489     remove_file.setMnemonic(KeyEvent.VK_9);
    490     Dictionary.setBoth(remove_file, "GEMS.Remove", "GEMS.Remove_File_Tooltip");
    491     remove_set = new GLIButton();
    492     remove_set.setMnemonic(KeyEvent.VK_8);
    493     Dictionary.setBoth(remove_set, "GEMS.Remove", "GEMS.Remove_Set_Tooltip");
    494     remove_value = new GLIButton();
    495     remove_value.setMnemonic(KeyEvent.VK_EQUALS);
    496     Dictionary.setBoth(remove_value, "GEMS.Remove", "GEMS.Remove_Value_Tooltip");
    497     //setControls(false, false, false, false, false, false, false, false, false, false, false, false);
    498425
    499426    add_element_action_listener = new AddElementActionListener();
    500427    add_file_action_listener = new AddFileActionListener();
    501428    add_set_action_listener = new AddSetActionListener();
    502     //   rename_element_action_listener = new RenameElementActionListener();
    503        
    504  
    505429    add_or_edit_attribute_action_listener = new AddOrEditAttributeActionListener();
    506     add_or_edit_value_action_listener = new AddOrEditValueActionListener();
    507430    remove_set_action_listener = new RemoveSetActionListener();
    508431
     
    517440    edit_set_pane.setOpaque(false);
    518441
    519     // Connection
    520     add_attribute.addActionListener(add_or_edit_attribute_action_listener);
    521     add_element.addActionListener(add_element_action_listener);
    522     add_file.addActionListener(add_file_action_listener);
    523     add_set.addActionListener(add_set_action_listener);
    524     add_value.addActionListener(add_or_edit_value_action_listener);
    525     edit_attribute.addActionListener(add_or_edit_attribute_action_listener);
    526     edit_value.addActionListener(add_or_edit_value_action_listener);
    527     remove_attribute.addActionListener(new RemoveAttributeActionListener());
    528     remove_element.addActionListener(new RemoveElementActionListener());
    529     remove_file.addActionListener(new RemoveFileActionListener());
    530     remove_set.addActionListener(remove_set_action_listener);
    531     remove_value.addActionListener(new RemoveValueActionListener());
    532442    element_attributes.getSelectionModel().addListSelectionListener(new AttributesListSelectionListener(element_attributes));
    533443    subelement_attributes.getSelectionModel().addListSelectionListener(new AttributesListSelectionListener(subelement_attributes));
    534444    profile_attributes.getSelectionModel().addListSelectionListener(new AttributesListSelectionListener(profile_attributes));
    535445    set_attributes.getSelectionModel().addListSelectionListener(new AttributesListSelectionListener(set_attributes));
    536     //element_values.addTreeSelectionListener(new ElementValuesTreeSelectionListener());
    537446    mds_tree.addTreeSelectionListener(new MDSTreeSelectionListener());
     447
    538448    // Layout
    539449    mds_tree_pane.setLayout(new BorderLayout());
     
    574484    element_inner_pane.setLayout(new BorderLayout());
    575485    element_inner_pane.add(element_attributes_pane);
    576         //element_inner_pane.add(element_values_pane);
     486    //element_inner_pane.add(element_values_pane);
    577487         
    578488    element_details_pane.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(Dictionary.get("GEMS.Element_Details")), BorderFactory.createEmptyBorder(2,2,2,2)));
     
    646556    private void exit()
    647557    {
    648     // Flush debug
    649         //System.out.println("Final exit func");
    650     DebugStream.closeDebugStream();
    651         if(atLeastOneSetChanged == true) {
    652            
    653             int result = JOptionPane.showConfirmDialog(self, Dictionary.get("GEMS.Menu.Confirm_Exit_Save", Dictionary.get("GEMS.Element")), Dictionary.get("GEMS.Menu.Confirm_Exit_Save_Title"), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); //, null, dialog_options, dialog_options[0]);
    654 
    655          //   System.out.println("Exit: "+result);
    656             if(result == 0) {
    657                 msm.save();
    658             }
    659            
    660         }
    661        
    662     System.exit(0);
     558        if(atLeastOneSetChanged == true)
     559        {
     560        int result = JOptionPane.showConfirmDialog(self, Dictionary.get("GEMS.Menu.Confirm_Exit_Save", Dictionary.get("GEMS.Element")), Dictionary.get("GEMS.Menu.Confirm_Exit_Save_Title"), JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE);
     561
     562        if(result == 0)
     563            {
     564            DebugStream.closeDebugStream();
     565            msm.save();
     566            System.exit(0);
     567            }
     568        else if(result == 1)
     569            {
     570            DebugStream.closeDebugStream();
     571            System.exit(0);
     572            }
     573        else if(result == 2)
     574            {
     575            //do nothing
     576            }
     577        }
     578    else
     579        {
     580        //Just exit
     581        DebugStream.closeDebugStream();
     582        System.exit(0);
     583        }
    663584    }
    664585
     
    711632           
    712633            file_delete = new JMenuItem();
    713         file_delete.addActionListener(new RemoveSetActionListener());
     634        file_delete.addActionListener(new KeyPressedHandler()); //KeyPressedHandler handles deleting stuff.
    714635        file_delete.setMnemonic(KeyEvent.VK_S);
    715636       // Dictionary.registerText(file_delete, "GEMS.Menu.File_Delete");
     
    784705        // File -> New
    785706        if (event_source == file_new) {
    786         add_set.doClick();
    787                // set_changed = true;
     707        AddSetActionListener rah = new AddSetActionListener();
     708        rah.show();
     709     
    788710        return;
    789711        }
     
    801723                //once we have clicked 'ok' on the jdialog above, then we should have
    802724                //the directory pointer in string set_directory...and pass it to the jfilechoose constru
    803        
    804                
    805725        return;
    806726        }
     
    816736        if (event_source == file_exit) {
    817737                exit(); //The exit() method checks if data needs saving.
    818              
    819         }
    820 
    821         // Edit -> Cut
     738        }
     739
     740        // File -> Preferences
    822741            if(event_source == file_preferences){
    823742              GEMSPreferences GemsPreferences = new GEMSPreferences(); 
    824  
    825                
    826743            }
     744
     745        // Edit -> Cut
    827746        if (event_source == edit_cut) {
    828747        try {
     
    892811        return false;
    893812    }
    894 
    895813
    896814    public String getDescription()
     
    968886    screen_size = null;
    969887    self = null;
    970     add_attribute = null;
    971     add_element = null;
    972     add_file = null;
    973     add_set = null;
    974     add_value = null;
    975     edit_attribute = null;
    976     edit_value = null;
    977     remove_attribute = null;
    978     remove_element = null;
    979     remove_file = null;
    980     remove_set = null;
    981     remove_value = null;
    982888    details_pane = null;
    983889    element_attributes = null;
     
    1000906        add_or_edit_attribute_action_listener = null;
    1001907    }
    1002     if (add_or_edit_value_action_listener != null) {
    1003         add_or_edit_value_action_listener.dispose();
    1004         add_or_edit_value_action_listener = null;
    1005     }
    1006908    remove_set_action_listener = null;
    1007909
     
    1010912    }
    1011913
    1012      
    1013     private void setControls(boolean a_s, boolean r_s, boolean a_f, boolean r_f, boolean a_e, boolean r_e, boolean a_a, boolean e_a, boolean r_a, boolean a_v, boolean e_v, boolean r_v) {
    1014     add_attribute.setEnabled(a_a);
    1015     add_element.setEnabled(a_e);
    1016     add_file.setEnabled(true); // Always true
    1017     add_set.setEnabled(true); // Always true
    1018     add_value.setEnabled(a_v);
    1019     edit_attribute.setEnabled(e_a);
    1020     edit_value.setEnabled(e_v);
    1021     remove_attribute.setEnabled(r_a);
    1022     remove_element.setEnabled(r_e);
    1023     remove_file.setEnabled(r_f);
    1024     remove_set.setEnabled(r_s);
    1025     remove_value.setEnabled(r_v);
    1026     }
    1027914
    1028915    /**
     
    1071958            attributeLists.add("registration_authority");
    1072959           
    1073            
    1074             //
    1075960        setSize(ADD_OR_EDIT_ATTRIBUTE_SIZE);
    1076961        name_to_values = new HashMap();
     
    1089974        target = new JLabel();
    1090975        target.setOpaque(false);
    1091         //Dictionary.setText(target, "this is the target"); //debug
    1092976
    1093977        JLabel name_label = new JLabel();
     
    1101985        language_label.setOpaque(false);
    1102986        Dictionary.setText(language_label, "GEMS.Language");
    1103         language_box = new JComboBox();  // !!! Gatherer.g_man.design_pane.getLanguageCodes().toArray());
    1104            
     987        language_box = new JComboBox();
    1105988           
    1106989            for(int n = 0; n < attributeLists.size(); n++){
    1107                
    1108990                name.add(attributeLists.get(n));
    1109                
    1110991            }
    1111            // org.w3c.dom.Element myelem = new org.w3c.dom.Element();
    1112            
    1113            // LanguageManager languageManager = new LanguageManager(myelem);
    1114            
    1115          
    1116         // !!! language_box.setRenderer(new LanguageListCellRenderer());
     992 
    1117993        Dictionary.setTooltip(language_box, "GEMS.Attribute_Language_Tooltip");
    1118994
     
    12911167        else
    12921168            {
    1293             //This should not happen.
    1294             System.err.println("No success by OK button."); //debug
     1169            //If no success (an attribute with that name already exists), do nothing.
    12951170            }
    12961171        }
     
    13161191                    }
    13171192        }
    1318         //setVisible(true);
    13191193        }
    13201194        else if (source == popupListener.menuAddAttributeAttribute || source == popupListener.menuAddAttributeSet || source == popupListener.menuAddAttributeElement || source == popupListener.menuAddAttributeSubelement){
     
    14701344       case GEMSNode.COLLECTION:
    14711345           tablemodel = (AttributeTableModel) profile_attributes.getModel();
    1472            //String prevLang =  tablemodel.getValueAt(current_attribute,0).toString();
    1473            //String prevValue = tablemodel.getValueAt(current_attribute,1).toString();
    14741346           
    14751347           break;
    14761348       case GEMSNode.SET:
    14771349           tablemodel = (AttributeTableModel) set_attributes.getModel();
    1478            //grab value in table(
     1350           //grab value in table
    14791351           prevLang =  tablemodel.getValueAt(current_attribute,0).toString();
    14801352           prevValue = tablemodel.getValueAt(current_attribute,1).toString();
     
    15301402       private void editAttribute()
    15311403       {
     1404       //System.err.println("just entered editAttribute"); //debug
    15321405       AttributeTableModel model = null;
    15331406       Dictionary.setText(this, "GEMS.EditAttribute");
    1534        //System.out.println(source.toString()+"\n");
    15351407       
    15361408       switch(current_attribute_type) {
     
    15771449       }
    15781450
     1451       //Is this method ever used? What's a collection attribute? --Matthew
    15791452    private boolean addOrEditCollectionAttribute(AttributeTableModel model)
    15801453    {
     1454        System.err.println("addOrEditCollectionAttribute was actually used!!"); //if this is ever used!!
    15811455        String name_str = name.getSelectedItem().toString();
    15821456        String value_str = Codec.transform(Codec.transformUnicode(value.getText()), Codec.TEXT_TO_DOM);
     
    15851459        if(!add_type && current_attribute != -1) {
    15861460        String old_source = (String) model.getValueAt(current_attribute, 0);
    1587         // !!! msm.profiler.removeAction(current_collection_file, old_source);
    15881461        old_source = null;
    15891462        model.removeRow(current_attribute);
     
    15931466        // Check that there isn't already an entry for this attribute
    15941467        if (!model.contains(name_str, 0)) {
    1595         // Add profile
    1596         // !!! msm.profiler.addAction(current_collection_file, name_str, value_str);
    15971468        // Update attribute table
    15981469        model.add(new Attribute(name_str, value_str));
     
    16121483    private boolean addOrEditSetAttribute(AttributeTableModel model)
    16131484    {
    1614         String name_str = name.getSelectedItem().toString();
     1485        String new_name_str = name.getSelectedItem().toString();
    16151486        String value_str = Codec.transform(Codec.transformUnicode(value.getText()), Codec.TEXT_TO_DOM);
     1487        String old_name_str = null;
    16161488        boolean cont = false;
    1617 
    1618         // Remove the existing attribute if this is an edit
    1619              
    1620         if(!add_type && current_attribute != -1) {
    1621              
    1622         current_set.removeAttribute(name_str);
    1623         // Update attribute table
    1624                model.removeRow(current_attribute);
    1625         }
    1626             current_set.addAttribute(name_str, value_str);
    1627         // Update the attribute table
    1628         model.add(new Attribute(name_str, value_str));
    1629         cont = true;
    1630          
    1631         /*
     1489        boolean edit = false;
     1490
     1491        if(!add_type && current_attribute != -1) //If edit, grab the attribute's old name
     1492        {
     1493            old_name_str = (String) set_attributes.getValueAt(current_attribute, 0);
     1494            edit = true;
     1495        }
     1496
    16321497        // Check that there isn't already an entry for this attribute
    1633         if (!model.contains(name_str, 0)) {
    1634         // Add the new attribute
    1635         current_set.addAttribute(name_str, value_str);
    1636         // Update the attribute table
    1637         model.add(new Attribute(name_str, value_str));
    1638         cont = true;
    1639         }
    1640         // Otherwise show an error message and do not proceed
    1641         else {
    1642         cont = false;
    1643         JOptionPane.showMessageDialog(self, Dictionary.get("GEMS.Attribute_Already_Exists"), Dictionary.get("General.Error"), JOptionPane.ERROR_MESSAGE);
    1644         }
    1645         */
    1646 
     1498        if (!model.contains(new_name_str, 0) || (edit && new_name_str.equals(old_name_str)))
     1499        {
     1500            if(edit) //If edit, remove old attribute
     1501            {
     1502                current_set.removeAttribute(old_name_str);
     1503                model.removeRow(current_attribute);
     1504            }
     1505           
     1506            // Add the new attribute
     1507            current_set.addAttribute(new_name_str, value_str);
     1508            // Update the attribute table
     1509            model.add(new Attribute(new_name_str, value_str));
     1510            cont = true;
     1511        }
     1512        // Otherwise show an error message and do not proceed
     1513        else
     1514        {
     1515            cont = false;
     1516            JOptionPane.showMessageDialog(self, Dictionary.get("GEMS.Attribute_Already_Exists"), Dictionary.get("General.Error"), JOptionPane.ERROR_MESSAGE);
     1517        }
     1518       
    16471519        value_str = null;
    1648         name_str = null;
     1520        new_name_str = null;
    16491521        return cont;
    16501522    }
     
    16531525    private boolean addOrEditElementAttribute(AttributeTableModel model)
    16541526    {
    1655         // Add the attribute, even if one of the same name already exists. Maybe one day someone would like to enforce the occurance rules but not me and not today.
    1656         String name_str = name.getSelectedItem().toString();
     1527        String new_name_str = name.getSelectedItem().toString();
     1528        String old_name_str = null;
    16571529        String language_code = (String) language_box.getSelectedItem();
    1658            
    16591530        String value_str = Codec.transform(Codec.transformUnicode(value.getText()), Codec.TEXT_TO_DOM);
    1660        
    1661         // Remove the existing attribute if this is an edit
    1662         if(!add_type && current_attribute != -1) {
    1663         Attribute old_attribute = model.getAttribute(current_attribute);
    1664         String old_value_str = old_attribute.value;
    1665         String old_lang_code = old_attribute.language;
    1666         current_element.removeAttribute(name_str, old_lang_code, old_value_str);
    1667         // Update the attribute table
    1668         model.removeRow(current_attribute);
    1669         }
    1670 
    1671         // Add the new attribute
    1672         current_element.addAttribute(name_str, language_code, value_str);
    1673         // Update the attribute table
    1674         int row = model.add(new Attribute(name_str, language_code, value_str));
    1675         element_attributes.setRowSelectionInterval(row, row);
    1676 
     1531        String old_value_str = null;
     1532        String old_lang_code = null;
     1533        boolean cont = false;
     1534        boolean edit = false;
     1535
     1536        if(!add_type && current_attribute != -1) //An edit
     1537        {
     1538            Attribute old_attribute = model.getAttribute(current_attribute);
     1539            old_value_str = old_attribute.value;
     1540            old_lang_code = old_attribute.language;
     1541            old_name_str = (String) element_attributes.getValueAt(current_attribute, 0); //get the old name.
     1542            edit = true;
     1543        }
     1544
     1545        //Check that there isn't already an entry for this attribute
     1546        if (!model.contains(new_name_str, 0) || (edit && new_name_str.equals(old_name_str)))
     1547        {
     1548            if(edit) //If this is an edit, remove the old attribute
     1549            {
     1550                current_element.removeAttribute(old_name_str, old_lang_code, old_value_str);
     1551                model.removeRow(current_attribute);
     1552            }
     1553
     1554            // Add the new attribute
     1555            current_element.addAttribute(new_name_str, language_code, value_str);
     1556            // Update the attribute table
     1557            int row = model.add(new Attribute(new_name_str, language_code, value_str));
     1558            element_attributes.setRowSelectionInterval(row, row);
     1559            cont = true;
     1560        }
     1561        // Otherwise show an error message and do not proceed
     1562        else
     1563        {
     1564            cont = false;
     1565            JOptionPane.showMessageDialog(self, Dictionary.get("GEMS.Attribute_Already_Exists"), Dictionary.get("General.Error"), JOptionPane.ERROR_MESSAGE);
     1566        }
     1567   
    16771568        value_str = null;
    16781569        language_code = null;
    1679         name_str = null;
    1680         return true;
    1681     }
    1682 
     1570        new_name_str = null;
     1571        return cont;
     1572    }
     1573       
    16831574       //Very similar to addOrEditElementAttribute
    16841575       private boolean addOrEditSubelementAttribute(AttributeTableModel model)
    16851576       {
    1686        //System.err.println("\ncurrent_attribute is: " + current_attribute + "current_attribute_type is: " + current_attribute_type); //debug
    1687 
    1688        String name_str = name.getSelectedItem().toString();
     1577       String new_name_str = name.getSelectedItem().toString();
     1578       String old_name_str = null;
    16891579       String language_code = (String) language_box.getSelectedItem();
    1690 
    16911580       String value_str = Codec.transform(Codec.transformUnicode(value.getText()), Codec.TEXT_TO_DOM);
    1692 
    1693        //Remove the existing attribute if this is an edit.
    1694        if(!add_type && current_attribute != -1)
     1581       String old_value_str = null;
     1582       String old_lang_code = null;
     1583       boolean edit = false;
     1584       boolean cont = false;
     1585
     1586       if(!add_type && current_attribute != -1) //An edit
    16951587           {
    16961588           Attribute old_attribute = model.getAttribute(current_attribute);
    1697            String old_value_str = old_attribute.value;
    1698            String old_lang_code = old_attribute.language;
    1699            current_subelement.removeAttribute(name_str, old_lang_code, old_value_str);
    1700            //update the attribute table
    1701            model.removeRow(current_attribute);
     1589           old_value_str = old_attribute.value;
     1590           old_lang_code = old_attribute.language;
     1591           old_name_str = (String) subelement_attributes.getValueAt(current_attribute, 0); //get the old name.
     1592           edit = true;
    17021593           }
    1703 
    1704        //Add the new attribute
    1705        current_subelement.addAttribute(name_str, language_code, value_str);
    1706        //Update the attribute table
    1707        int row = model.add(new Attribute(name_str, language_code, value_str));
    1708        subelement_attributes.setRowSelectionInterval(row, row);
    1709 
     1594       
     1595       //Check that there isn't already an entry for this attribute
     1596       if (!model.contains(new_name_str, 0) || (edit && new_name_str.equals(old_name_str)))
     1597           {
     1598            if(edit) //If this is an edit, remove the old attribute
     1599            {
     1600                current_subelement.removeAttribute(old_name_str, old_lang_code, old_value_str);
     1601                model.removeRow(current_attribute);
     1602            }
     1603
     1604           // Add the new attribute
     1605           current_subelement.addAttribute(new_name_str, language_code, value_str);
     1606           // Update the attribute table
     1607           int row = model.add(new Attribute(new_name_str, language_code, value_str));
     1608           subelement_attributes.setRowSelectionInterval(row, row);
     1609           cont = true;
     1610           }
     1611       // Otherwise show an error message and do not proceed
     1612       else
     1613           {
     1614           cont = false;
     1615           JOptionPane.showMessageDialog(self, Dictionary.get("GEMS.Attribute_Already_Exists"), Dictionary.get("General.Error"), JOptionPane.ERROR_MESSAGE);
     1616           }
     1617       
    17101618       value_str = null;
    17111619       language_code = null;
    1712        name_str = null;
    1713        return true;
     1620       new_name_str = null;
     1621       return cont;
    17141622       }
    17151623
     
    17691677        ok_button = new GLIButton();
    17701678        ok_button.setMnemonic(KeyEvent.VK_O);
     1679        getRootPane().setDefaultButton(ok_button);
    17711680        Dictionary.setBoth(ok_button, "General.OK", "General.OK_Tooltip");
    17721681        cancel_button = new GLIButton();
     
    18131722        //System.err.println("You chose to add a new subelement!!\n"); //debug
    18141723        Object source = event.getSource();
     1724        GEMSNode new_node = null;
     1725        current_element = current_node.getElement(); //current_element here is used generically for a element or subelement.
    18151726
    18161727        if(source == ok_button) //Add then dispose
     
    18191730           
    18201731            current_set = msm.getSet(current_element.getNamespace());
     1732            //System.err.println("current_element.getNamespace(): " + current_element.getNamespace()); //debug
    18211733            if(current_set != null)
    18221734            {
     
    18261738                    // Add it,
    18271739                    String language_code = config.getLanguage();
    1828                     //ElementWrapper subelement = current_set.addSubelementTest(current_element, name_str);
    1829                     ElementWrapper subelement = current_set.addSubelement(current_element, name_str, language_code);
     1740                    ElementWrapper subelement = current_set.addElement(name_str, language_code, current_node);
     1741
    18301742                    // Then update the tree
    1831                     model.add(current_node, subelement, GEMSNode.SUBELEMENT);
    1832                     //System.out.println("current_node is: " + current_node); //debug
    1833                    
    1834                     // Done
     1743                    new_node = model.add(current_node, subelement, GEMSNode.SUBELEMENT);
     1744                    //Expand element so can see subelement.
     1745                    mds_tree.expandPath(new TreePath(current_node.getPath()));
     1746                    //Would like to select new subelement, but this doesn't seem to work.
     1747
     1748                    //Done. Finish up.
    18351749                    subelement = null;
    18361750                    setVisible(false);
    1837                     //mark as changed
    1838                     atLeastOneSetChanged = true;
    1839                     current_set.setSetChanged(true);
     1751                    atLeastOneSetChanged = true; //mark as changed
    18401752                }
    18411753                else
     
    18481760            {
    18491761                //This should not happen.
    1850                 System.err.println("current_set is null in AddSubelementActionListener!!");
     1762                System.err.println("Error: current_set is null in AddSubelementActionListener");
    18511763            }
    18521764        }
     
    18571769        else
    18581770        {
    1859             element_field.setText(current_element.getName()); //set to the name of the element
     1771            element_field.setText(current_node.toString()); //set to the name of the element
    18601772            name_field.setText("");
    18611773            setVisible(true);
     
    18901802        JPanel center_pane = new JPanel();
    18911803        center_pane.setOpaque(false);
     1804        Dictionary.setText(this, "GEMS.AddElement");
    18921805
    18931806        JPanel labels_pane = new JPanel();
     
    19161829        ok_button = new GLIButton();
    19171830        ok_button.setMnemonic(KeyEvent.VK_O);
     1831        getRootPane().setDefaultButton(ok_button);
    19181832        Dictionary.setBoth(ok_button, "General.OK", "General.OK_Tooltip");
    19191833        cancel_button = new GLIButton();
     
    19671881            // Add it,
    19681882            String language_code = config.getLanguage();
    1969             ElementWrapper element = current_set.addElement(name_str, language_code);
     1883            ElementWrapper element = current_set.addElement(name_str, language_code, null);
    19701884            // Then update the tree
    19711885            model.add(current_node, element, GEMSNode.ELEMENT);
    1972             //System.out.println("current_node is: " + current_node); //debug
    1973             // Signal that the metadata set has changed
    1974             // msm.fireSetChanged(current_set);
     1886            mds_tree.expandPath(new TreePath(current_node.getPath())); //expand set.
    19751887
    19761888            // Done
     
    19941906        }
    19951907        else {
    1996         if(current_set != null) {
     1908        if(current_set != null) { //Does this ever happen? --Matthew
    19971909            // You can't manually add elements to the Greenstone metadata set.
    19981910            if(!current_set.getNamespace().equals("")) {
     
    20021914            setVisible(true);
    20031915            }
    2004             // Warn the user that they can't do that dave.
     1916            // Warn the user that they can't do that dave. 
    20051917            else {
    20061918                       
     
    21862098        ok_button = new GLIButton();
    21872099        ok_button.setMnemonic(KeyEvent.VK_O);
     2100        getRootPane().setDefaultButton(ok_button);
    21882101        Dictionary.setBoth(ok_button, "General.OK", "General.OK_Tooltip");
    21892102        cancel_button = new GLIButton();
     
    22022115        label_pane.add(name_label);
    22032116        label_pane.add(namespace_label);
    2204            // label_pane.add
    2205       //  boxes_pane.setLayout(new GridLayout(2,1,0,5));
    22062117            boxes_pane.setLayout(new GridLayout(3,1));
    22072118        boxes_pane.add(name_field);
     
    22132124            label_pane.add(inheritJLabel);
    22142125       
    2215            
    2216             //add inherit metadata set functionality
    2217            // String[] s = msm.getSets().toArray();
    2218            
    2219           //JComboBox existingSetJComboBox = new JComboBox(new String(msm.getSetsForInherit().toArray()));
    2220            
    22212126            int getSetsLen = msm.getSets().toArray().length;
    22222127            Vector theSets = msm.getSets();
     
    22302135            //add sets to existingSetJComboBox
    22312136           
    2232            
    22332137            //String tempstr = new String();
    22342138            JLabel dummyl = new JLabel();
    22352139            Dictionary.setText(dummyl, "GEMS.Add_Set.No_Inherit");
    2236            
    2237            
    22382140           
    22392141            existingSetJComboBox.addItem("Do not inherit");
     
    22662168                    flag = true;     
    22672169                }
    2268 
    2269                
    22702170            }
    22712171           
     
    22882188        String name_str = Codec.transform(Codec.transformUnicode(name_field.getText()), Codec.TEXT_TO_DOM);
    22892189       
    2290                
    2291                
    22922190                if (existingSetJComboBox.getSelectedItem().toString().trim().compareTo("Do not inherit") == 0){
    22932191
    22942192        // Ensure the set doesn't already exist
    2295         //if(msm.getSet(namespace_str) == null) {
    22962193                if(a_set_exists_with_this_namespace(namespace_str) == false){
    22972194       
    2298              
    2299                    
    23002195            MetadataSet set = msm.addSet(namespace_str, name_str);
    23012196                   
     
    23162211         
    23172212                }
    2318                 //do not inherit == 0
    2319         // Otherwise show a warning.
    2320         //else {
    2321          //   JOptionPane.showMessageDialog(self, Dictionary.get("GEMS.Set_Already_Exists"), Dictionary.get("General.Error"), JOptionPane.ERROR_MESSAGE);
    2322         //}
    2323                
    23242213               
    23252214        name_str = null;
     
    23402229            FileInputStream fstream = new FileInputStream(items[1].trim());
    23412230            BufferedReader in = new BufferedReader(new InputStreamReader(fstream, "UTF8"));
    2342                         //DataInputStream in = new DataInputStream(fstream);
    2343                         ///////////////
    23442231
    23452232                        FileOutputStream out;
     
    23512238                        p = new PrintWriter(pout);
    23522239
    2353                         //cycle through all lines in IN and print to OUT
    2354                         //while(in.available() != 0){
    23552240            while(in.ready()){
    2356 
    2357                             //System.out.println(in.readLine()+ "\n"
    2358                             //String nextline = in.readLine();
    23592241                String nextline = in.readLine();
    23602242
    2361                             if(nextline.matches(".+namespace=\".+\".*") == true){
    2362 
    2363                                nextline = nextline.replaceFirst("namespace=\".+\"","namespace=\"" + namespace_str+ "\"");                         
    2364                             }
    2365                             else{
    2366                              nextline = nextline.replaceFirst(">.+</Name>",">" + name_str + "</Name>");
    2367 
    2368                             }
    2369 
    2370 
    2371 
    2372 
     2243                            if(nextline.matches(".+namespace=\".+\".*") == true)
     2244                {
     2245                    nextline = nextline.replaceFirst("namespace=\".+\"","namespace=\"" + namespace_str+ "\"");                         
     2246                }
     2247                            else
     2248                {
     2249                    nextline = nextline.replaceFirst(">.+</Name>",">" + name_str + "</Name>");
     2250                }
     2251               
    23732252                            p.print(nextline + "\n");
    23742253                        }
    2375 
    2376 
    2377                         //
    23782254                        p.close();
    23792255                       
     
    23862262                        }
    23872263
    2388 
    2389 
    2390                         ///////////////
    2391 
    2392 
    23932264                        }
    23942265                        catch(Exception e){
    2395 
    23962266                            System.out.println("File Input error");
    2397 
    23982267                        }
    23992268                   
     
    24022271                       
    24032272                      JOptionPane.showMessageDialog(self, Dictionary.get("GEMS.Set_Already_Exists"), Dictionary.get("General.Error"), JOptionPane.ERROR_MESSAGE);
    2404          
    2405                        
    24062273                    }
     2274             setVisible(false);
    24072275                }
    2408             //}//if a_set_exists_with_this_namespace
    2409                  //set = null;
    2410          setVisible(false);
    2411         }
     2276
     2277        } //if(source == ok_button)
    24122278        else if(source == cancel_button) {
    24132279        setVisible(false);
     
    24172283        setVisible(true);
    24182284        }
    2419     }
     2285    } //actionPerformed
    24202286         
    24212287    public void dispose() {
     
    24272293    }
    24282294    }
     2295
    24292296    ////
    24302297    private class SetSelectionDialog
     
    24332300    private JButton cancel_button = null;
    24342301    private JButton ok_button = null;
    2435     //private JTextField name_field = null;
    2436     //private JTextField namespace_field = null;
    24372302        private JComboBox existingSetJComboBox = new JComboBox();
    24382303           
     
    24412306        setModal(true);
    24422307        setSize(OPEN_SETS_SIZE);
    2443         Dictionary.setText(this, "Open Sets");
     2308        Dictionary.setText(this, "GEMS.Menu.File_Open");
    24442309
    24452310        // Creation
     
    24572322        ok_button = new GLIButton();
    24582323        ok_button.setMnemonic(KeyEvent.VK_O);
     2324        getRootPane().setDefaultButton(ok_button);
    24592325        Dictionary.setBoth(ok_button, "General.OK", "General.OK_Tooltip");
    24602326        cancel_button = new GLIButton();
     
    24662332        cancel_button.addActionListener(this);
    24672333        ok_button.addActionListener(this);
    2468        // ok_button_enabler.add(name_field);
    2469        // ok_button_enabler.add(namespace_field);
    24702334
    24712335        // Layout
    2472      
    2473            // label_pane.add
    2474       //  boxes_pane.setLayout(new GridLayout(2,1,0,5));
    24752336            boxes_pane.setLayout(new GridLayout(4,1));
    2476       //  boxes_pane.add(name_field);
    2477        // boxes_pane.add(namespace_field);
    2478            
     2337
    24792338            JLabel inheritJLabel = new JLabel();
    24802339            Dictionary.setText(inheritJLabel, "GEMS.inheritMetadataSet");
    24812340       
    2482             //label_pane.add(inheritJLabel);
    2483        
    2484            
    2485             //add inherit metadata set functionality
    2486            // String[] s = msm.getSets().toArray();
    2487            
    2488           //JComboBox existingSetJComboBox = new JComboBox(new String(msm.getSetsForInherit().toArray()));
    2489            
    24902341            int getSetsLen = msm.getSets().toArray().length;
    24912342            Vector theSets = msm.getSets();
    2492           //  System.out.println(Configuration.gsdl_path);
    24932343            File[] col_dir = new File(Configuration.gsdl_path + "/collect").listFiles();
    24942344           
    2495             existingSetJComboBox.addItem("Default Metadata Sets                                                                                                                        #% " + Configuration.gsdl_path + "gli/metadata");
     2345            existingSetJComboBox.addItem("Default Metadata Sets                                                                                        #% " + Configuration.gsdl_path + "gli/metadata");
    24962346               
    24972347            for(int k = 0; k < col_dir.length; k++){
    2498                 //MetadataSet ms = (MetadataSet)theSets.elementAt(k);
    2499                
    25002348                  if(col_dir[k].isDirectory() && col_dir[k].getName().compareTo("CVS") != 0) {
    25012349                   
     
    25052353                 
    25062354                  }
    2507                  
    2508               //  existingSetJComboBox.addItem(new String(ms.getName() + "                                                                             #% " + ms.getFile().toString()));
    25092355               
    25102356            }
     
    25162362            Dictionary.setText(dummyl, "GEMS.Add_Set.No_Inherit");
    25172363           
    2518            
    2519            
    2520             //existingSetJComboBox.addItem("Do not inherit");
    2521            // existingSetJComboBox.setSelectedIndex(getSetsLen);
    25222364            boxes_pane.add(new JLabel("Select which group of metadata sets you wish to edit:\n\n\n\n"));
    25232365            boxes_pane.add(new JLabel("\n"));
    25242366            boxes_pane.add(existingSetJComboBox);
    25252367            boxes_pane.add(new JLabel("\n"));
    2526        // center_pane.setLayout(new BorderLayout(5,0));
    2527       //  center_pane.add(label_pane, BorderLayout.WEST);
    2528       //  center_pane.add(boxes_pane, BorderLayout.CENTER);
    2529 
    2530        // button_pane.setLayout(new GridLayout(1,3,0,5));
     2368
    25312369            button_pane.setLayout(new GridLayout(1,3,0,5));
    25322370        button_pane.add(ok_button);
    25332371        button_pane.add(cancel_button);
    2534            
    25352372           
    25362373        content_pane.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
     
    25482385        Object source = event.getSource();
    25492386           
    2550            
    2551           // if(a_set_exists_with_this_namespace(namespace_field.getText()) == false){
    25522387        if(source == ok_button) {
    25532388                //this code below handles whether we inherit from an existing set or not
     
    25932428    }
    25942429   
    2595     ////
    2596     private class AddOrEditValueActionListener
    2597     extends ModalDialog
    2598     implements ActionListener, TreeSelectionListener {
    2599     private boolean add_type = true;
    2600     private boolean ignore = false;
    2601     private GValueNode subject_node = null;
    2602     private JButton cancel_button = null;
    2603     private JButton ok_button = null;
    2604     private JTextArea value = null;
    2605     private SmarterTree subject_tree = null;
    2606 
    2607     /** Constructor. */
    2608     public AddOrEditValueActionListener() {
    2609         super(self);
    2610         this.setModal(true);
    2611         this.setSize(ADD_OR_EDIT_VALUE_SIZE);
    2612 
    2613         // Create
    2614         JPanel content_pane = (JPanel) getContentPane();
    2615         content_pane.setBackground(config.getColor("coloring.collection_heading_background", false));
    2616         JPanel center_pane = new JPanel();
    2617         center_pane.setOpaque(false);
    2618         JPanel inner_pane = new JPanel();
    2619         inner_pane.setOpaque(false);
    2620         JPanel subject_tree_pane = new JPanel();
    2621         subject_tree_pane.setOpaque(false);
    2622         JLabel subject_tree_label = new JLabel();
    2623         subject_tree_label.setOpaque(false);
    2624         Dictionary.setText(subject_tree_label, "GEMS.Subject");
    2625         subject_tree = new SmarterTree();
    2626         subject_tree.setBackground(config.getColor("coloring.collection_tree_background", false));
    2627         subject_tree.setForeground(config.getColor("coloring.collection_tree_foreground", false));
    2628         subject_tree.setSelectionColor(config.getColor("coloring.collection_selection_background", false));
    2629         subject_tree.setSelectedTextColor(config.getColor("coloring.collection_selection_foreground", false));
    2630         JPanel value_pane = new JPanel();
    2631         value_pane.setOpaque(false);
    2632         JLabel value_label = new JLabel();
    2633         value_label.setOpaque(false);
    2634         Dictionary.setText(value_label, "GEMS.Value");
    2635         value = new JTextArea();
    2636         value.setBackground(config.getColor("coloring.collection_tree_background", false));
    2637         value.setForeground(config.getColor("coloring.collection_tree_foreground", false));
    2638         value.setSelectionColor(config.getColor("coloring.collection_selection_background", false));
    2639         value.setSelectedTextColor(config.getColor("coloring.collection_selection_foreground", false));
    2640         Dictionary.setTooltip(value, "GEMS.Value_Tooltip");
    2641 
    2642         JPanel button_pane = new JPanel();
    2643         button_pane.setOpaque(false);
    2644 
    2645         ok_button = new GLIButton();
    2646         ok_button.setMnemonic(KeyEvent.VK_O);
    2647         ok_button.setEnabled(false);
    2648         Dictionary.setBoth(ok_button, "General.OK", "General.OK_Tooltip");
    2649         cancel_button = new GLIButton();
    2650         cancel_button.setMnemonic(KeyEvent.VK_C);
    2651         Dictionary.setBoth(cancel_button, "General.Cancel", "General.Pure_Cancel_Tooltip");
    2652         TextFieldEnabler ok_button_enabler = new TextFieldEnabler(ok_button);
    2653 
    2654         // Connect
    2655         ok_button_enabler.add(value);
    2656         cancel_button.addActionListener(this);
    2657         ok_button.addActionListener(this);
    2658         subject_tree.addTreeSelectionListener(this);
    2659 
    2660         // Layout
    2661         subject_tree_pane.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
    2662         subject_tree_pane.setLayout(new BorderLayout());
    2663         subject_tree_pane.add(subject_tree_label, BorderLayout.NORTH);
    2664         subject_tree_pane.add(new JScrollPane(subject_tree), BorderLayout.CENTER);
    2665 
    2666         value_pane.setBorder(BorderFactory.createEmptyBorder(0,5,5,5));
    2667         value_pane.setLayout(new BorderLayout());
    2668         value_pane.add(value_label, BorderLayout.NORTH);
    2669         value_pane.add(new JScrollPane(value), BorderLayout.CENTER);
    2670                
    2671         inner_pane.setLayout(new GridLayout(2,1));
    2672         inner_pane.add(subject_tree_pane);
    2673         inner_pane.add(value_pane);
    2674 
    2675         button_pane.setBorder(BorderFactory.createEmptyBorder(0,5,5,5));
    2676         button_pane.setLayout(new GridLayout(1,2,5,5));
    2677         button_pane.add(ok_button);
    2678         button_pane.add(cancel_button);
    2679 
    2680         content_pane.setLayout(new BorderLayout());
    2681         content_pane.add(inner_pane, BorderLayout.CENTER);
    2682         content_pane.add(button_pane, BorderLayout.SOUTH);
    2683         setLocation((config.screen_size.width - ADD_OR_EDIT_VALUE_SIZE.width) / 2, (config.screen_size.height - ADD_OR_EDIT_VALUE_SIZE.height) / 2);
    2684     }
    2685     /** Any implementation of ActionListener must include this method so that we can be informed when an action as occured on our registered component, allowing us to add a new metadata value to the assigned values tree.
    2686      * @param event An <strong>ActionEvent</strong> containing information about the event.
    2687      */
    2688     public void actionPerformed(ActionEvent event) {
    2689         Object source = event.getSource();
    2690         if(source == ok_button) {
    2691         String value_str = Codec.transform(Codec.transformUnicode(value.getText()), Codec.TEXT_TO_DOM);
    2692         // Now we action as necessary
    2693         GValueModel model = msm.getValueTree(current_element);
    2694         if(add_type) {
    2695             ///ystem.err.println("Add type - insert node: " + value.getText() + " into " + subject_node);
    2696             // Add this value to the tree.
    2697             model.addValue(value_str, subject_node);
    2698         }
    2699         else {
    2700             // Rewrite this value in the DOM model. Note that this will automatically rewrite all assignments as they are live references.
    2701             current_value_node.setValue(value_str);
    2702             // Now insert the node into the currently selected subject, but only if the parent has changed.
    2703             if(subject_node != current_value_node.getParent()) {
    2704             GValueNode old_subject_node = (GValueNode) current_value_node.getParent();
    2705             // Find the new values position in subject_nodes children.
    2706             GValueNode sibling = null;
    2707             int index = 0;
    2708             boolean found = false;
    2709             while(index < subject_node.getChildCount() && !found) {
    2710                 sibling = (GValueNode) subject_node.getChildAt(index);
    2711                 int order = current_value_node.toString().compareToIgnoreCase(sibling.toString());
    2712                 // If the sibling is 'greater than' or comes after current value then insert.
    2713                 if(order < 0) {
    2714                 // Insert. This will coincidently remove from original parent.
    2715                 Node parent_node = subject_node.getElement();
    2716                 Node child_node = current_value_node.getElement();
    2717                 Node sibling_node = sibling.getElement();
    2718                 parent_node.insertBefore(child_node, sibling_node);
    2719                 found = true;
    2720                 }
    2721                 // The value already exists exactly as is. In theory this case can never happenm but just incase do nothing more.
    2722                 else if(order == 0) {
    2723                 found = true;
    2724                 }
    2725                 // The sibling is 'less than' or before the current value, keep looking.
    2726                 else {
    2727                 index++;
    2728                 }
    2729             }
    2730             // If we haven't done so yet, insert the current node This will coincidently remove from original parent.
    2731             if(!found) {
    2732                 Node parent_node = subject_node.getElement();
    2733                 Node child_node = current_value_node.getElement();
    2734                 parent_node.appendChild(child_node);
    2735             }
    2736             // Inform the tree model what two nodes structures have changed (origin and destination).
    2737             //subject_node.unmap();
    2738             //old_subject_node.unmap();
    2739             model.nodeStructureChanged(old_subject_node);
    2740             model.nodeStructureChanged(subject_node);
    2741             }
    2742             // And if a data change was made tell the tree its data model is ka-bluey.
    2743             else {
    2744             model.nodeChanged(current_value_node);
    2745             }
    2746         }
    2747         model = null;
    2748         // Hide dialog
    2749         setVisible(false);
    2750                  atLeastOneSetChanged = true;
    2751         }
    2752         else if(source == cancel_button) {
    2753         // Hide dialog
    2754         setVisible(false);
    2755 
    2756         }
    2757         else {
    2758         // Reset dialog
    2759         // current_value_node
    2760         GValueModel model = msm.getValueTree(current_element);
    2761         subject_tree.setModel(model);
    2762         // Task specific
    2763         if(source == add_value) {
    2764             add_type = true;
    2765             if(current_value_node != null) {
    2766             subject_node = current_value_node;
    2767             }
    2768             else {
    2769             subject_node = (GValueNode) model.getRoot();
    2770             }
    2771             value.setText("");
    2772             Dictionary.setText(this, "GEMS.AddValue");
    2773         }
    2774         else {
    2775             add_type = false;
    2776             if(current_value_node != null) {
    2777             subject_node = (GValueNode) current_value_node.getParent();
    2778             }
    2779             else {
    2780             subject_node = (GValueNode) model.getRoot();
    2781             }
    2782             value.setText(Codec.transform(current_value_node.toString(), Codec.DOM_TO_TEXT));
    2783             Dictionary.setText(this, "GEMS.EditValue");
    2784         }
    2785         model = null;
    2786         if(subject_node != null) {
    2787             TreePath path = new TreePath(subject_node.getPath());
    2788             subject_tree.scrollPathToVisible(path);
    2789             subject_tree.setSelectionPath(path);
    2790             path = null;
    2791         }
    2792         // Display
    2793         setVisible(true);
    2794         }
    2795     }
    2796 
    2797     public void dispose() {
    2798         cancel_button = null;
    2799         ok_button = null;
    2800         subject_node = null;
    2801         subject_tree = null;
    2802         value = null;
    2803         ///ystem.err.println("Dispose AddOrEditValueActionListener");
    2804         super.dispose();
    2805     }
    2806 
    2807     public void valueChanged(TreeSelectionEvent event) {
    2808         if(subject_tree.getSelectionCount() > 0 && !ignore) {
    2809         ignore = true;
    2810         TreePath selected_path = subject_tree.getSelectionPath();
    2811         GValueNode requested_node = (GValueNode) selected_path.getLastPathComponent();
    2812         // Ensure the requested node is not a descendant of the current_value_node
    2813         if(current_value_node != null) {
    2814             if(!add_type && current_value_node.isNodeDescendant(requested_node)) {
    2815             TreePath path = new TreePath(subject_node.getPath());
    2816             subject_tree.scrollPathToVisible(path);
    2817             subject_tree.setSelectionPath(path);
    2818             }
    2819             else {
    2820             subject_node = requested_node;
    2821             }
    2822         }
    2823         selected_path = null;
    2824         ignore = false;
    2825         }
    2826     }
    2827     }
    2828      
     2430
    28292431
    28302432    /** This listener is responsible for keeping the root node of a value tree expanded where and when possible. */
     
    29192521                ((AttributeTableModel)subelement_attributes.getModel()).removeRow(current_attribute);
    29202522            }
    2921             // Disable buttons
    2922            // edit_attribute.setEnabled(false);
    2923             remove_attribute.setEnabled(false);
    29242523            ignore = false;
    29252524                   
     
    29382537       This class can be created from either PopupHandler or KeyPressedHandler. KeyPressedHandler passes a null ActionEvent!!
    29392538       @author: Matthew Whyte
    2940        @Date last modified: 18/01/04
     2539       @Date last modified: 18/01/05
     2540                            25/01/05
    29412541    */
    29422542    private class RemoveSubelementActionListener implements ActionListener {
     
    29602560                // Clear selection
    29612561                mds_tree.clearSelection();
    2962                 model.remove(current_node); //This is a new way of doing things.
    2963                 // Meanwhile disable/enable controls given we had an element selected, but no longer do.
    2964                 remove_element.setEnabled(false);
    2965                 // Show a blank panel.
    2966                 card_layout.show(details_pane, BLANK);
     2562                model.remove(current_node); //This is the new way of doing things :-)
     2563                card_layout.show(details_pane, BLANK); //Show a blank panel.
    29672564                ignore = false;
    29682565               
     
    29982595
    29992596            // Meanwhile disable/enable controls given we had an element selected, but no longer do.
    3000             remove_element.setEnabled(false);
     2597            //remove_element.setEnabled(false);
    30012598            // Show a blank panel.
    30022599            card_layout.show(details_pane, BLANK);
     
    30262623        if(result == 0) {
    30272624            ignore = true;
    3028             // !!! msm.profiler.removeProfile(current_collection_file);
     2625 
    30292626            // Clear selection
    30302627            mds_tree.clearSelection();
    30312628            model.remove(current_collection_file, GEMSNode.COLLECTION);
    3032             // Meanwhile disable/enable controls given we had a set selected, but no longer do.
    3033             remove_file.setEnabled(false);
    3034             // Show a blank panel.
    3035             card_layout.show(details_pane, BLANK);
     2629            card_layout.show(details_pane, BLANK); //Show a blank panel.
    30362630            ignore = false;
    30372631        }
     
    30952689        ok_button = new GLIButton();
    30962690        ok_button.setMnemonic(KeyEvent.VK_O);
     2691        getRootPane().setDefaultButton(ok_button);
    30972692        Dictionary.setBoth(ok_button, "General.OK", "General.OK_Tooltip");
    30982693        cancel_button = new GLIButton();
     
    31402735                    flag = true;     
    31412736                }
    3142 
    3143                
    31442737            }
    31452738           
     
    31602753            String namespace_str = namespace_field.getText();
    31612754            String name_str = Codec.transform(Codec.transformUnicode(name_field.getText()), Codec.TEXT_TO_DOM);
    3162             //Note: The name in name_str is language dependent. However, currently GEMS does not create new sets with different names for different languages.
     2755            //Note: The name in name_str is language dependent. However, currently GEMS does not create new sets with different names for different languages(?).
    31632756            String current_set_namespace = current_set.getNamespace();
    3164 
    3165             //System.err.println("namespace_str is: " + namespace_str);
    3166             //System.err.println("name_str is: " + name_str);
    3167             //System.err.println("current_set_namespace is: " + current_set_namespace);
    31682757
    31692758            //Ensure that the namespace is unique.
     
    31762765                //Rename set & namespace
    31772766                msm.renameSet(current_set, namespace_str, name_str);
    3178 
    31792767                //Add (renamed) set back to tree
    31802768                model.add(null, current_set, GEMSNode.SET);
    3181 
    31822769
    31832770                //Clean up
     
    32172804        ok_button = null;
    32182805        name_field = null;
    3219         //System.err.println("Dispose AddElementActionListener");
    32202806        super.dispose();
    32212807    }
     
    32452831            current_element = parent.getElement();
    32462832            //MetadataSet currentSet = msm.getSet(current_subelement.getNamespace());
    3247 
    32482833            String name_str = Codec.transform(Codec.transformUnicode(name_field.getText()), Codec.TEXT_TO_DOM);
    32492834
     
    32552840               
    32562841                msm.renameElement(current_subelement, name_str); //rename the element
    3257                
    32582842                model.add(parent, current_subelement, GEMSNode.SUBELEMENT);
    3259                
    3260                 //Could now select the new element, but for now will just clean up ;-)
    3261                 // Disable/enable controls given we had an element selected, but no longer do.
    3262                 remove_element.setEnabled(false);
    3263                 card_layout.show(details_pane, BLANK); // Show a blank panel.
    3264                 ignore = false;
    3265                    
     2843
     2844                //Finish up
     2845                ignore = false;   
    32662846                atLeastOneSetChanged = true;
    32672847                setVisible(false);
     
    33052885    protected NonWhitespaceField name_field = null;
    33062886
    3307        
    33082887    public RenameElementActionListener() {
    33092888        super(self);
     
    33182897        JPanel labels_pane = new JPanel();
    33192898        labels_pane.setOpaque(false);
    3320         //JLabel set_label = new JLabel();
    3321         //set_label.setOpaque(false);
    3322         //Dictionary.setText(set_label, "GEMS.Rename_Element");
    3323         //label = new JLabel();
    3324         //label.setOpaque(false);
    33252899
    33262900        JPanel values_pane = new JPanel();
     
    33412915        ok_button = new GLIButton();
    33422916        ok_button.setMnemonic(KeyEvent.VK_O);
     2917        getRootPane().setDefaultButton(ok_button);
    33432918        Dictionary.setBoth(ok_button, "General.OK", "General.OK_Tooltip");
    33442919        cancel_button = new GLIButton();
     
    33952970            TreeNode selPath = current_node.getParent();
    33962971            GEMSNode parent = (GEMSNode)selPath;
     2972            GEMSNode new_node = null;
    33972973            MetadataSet currentSet = msm.getSet(current_element.getNamespace());
    3398 
    33992974            String name_str = Codec.transform(Codec.transformUnicode(name_field.getText()), Codec.TEXT_TO_DOM);
     2975            GValueModel value_model = msm.getValueTree(current_element);
    34002976 
    34012977            // If this element doesn't already exist.
     
    34032979            {   
    34042980                //Hide the element that are about to rename
    3405                 mds_tree.clearSelection();
     2981                //mds_tree.clearSelection();
    34062982                model.remove(current_element.getName(), GEMSNode.ELEMENT);
    34072983               
    34082984                msm.renameElement(current_element, name_str); //rename the element
    34092985               
    3410                 model.add(parent, current_element, GEMSNode.ELEMENT);
    3411                
     2986                new_node = model.add(parent, current_element, GEMSNode.ELEMENT);
     2987                TreePath new_node_path = new TreePath(new_node.getPath());
     2988
     2989                value_model.nodeChanged((TreeNode)current_node); //trial!
     2990                value_model.nodeStructureChanged((TreeNode)current_node);
     2991                mds_tree.repaint();
     2992
     2993                //mds_tree.setSelectionPath(new_node_path);
    34122994                //Could now select the new element, but for now will just clean up ;-)
    34132995                // Disable/enable controls given we had an element selected, but no longer do.
    3414                 remove_element.setEnabled(false);
    3415                 card_layout.show(details_pane, BLANK); // Show a blank panel.
    3416                 ignore = false;
     2996                //card_layout.show(details_pane, BLANK); // Show a blank panel.
     2997                //ignore = false;
    34172998               
     2999                currentSet.setSetChanged(true);
    34183000                atLeastOneSetChanged = true;
    34193001                setVisible(false);
     
    34473029        ok_button = null;
    34483030        name_field = null;
    3449         //label = null;
    3450         //System.err.println("Dispose AddElementActionListener");
    34513031        super.dispose();
    34523032    }
    34533033
    34543034    }
    3455 
    3456 
    34573035
    34583036
     
    34633041
    34643042       Author: Matthew Whyte
    3465        Date last modified: 21/12/04
     3043       Date last modified: 25/01/05
    34663044    */
    3467     private class KeyPressedHandler implements KeyListener {   
     3045    private class KeyPressedHandler implements KeyListener, ActionListener {   
    34683046
    34693047    // All implementations of KeyListener requires these methods
     
    34763054        if(e.getKeyCode() == java.awt.event.KeyEvent.VK_DELETE) //DELETE key pressed
    34773055        {
    3478         boolean cont = true;
    3479 
    3480         /**
    3481            Check to see if more than one tree node/leaf is selected. If so don't continue.
    3482 
    3483            This could be updated to delete multiple nodes/leaves in the futere.
    3484            But not me and not today!!
    3485         */
    3486         TreePath[] multiSelectionCheck = mds_tree.getSelectionPaths();
    3487         if(multiSelectionCheck.length > 1)
    3488             {
    3489             cont = false;
    3490             Toolkit.getDefaultToolkit().beep();
    3491             }
    3492 
    3493         if(cont)
    3494             {
    3495             //Check to see if pressed on Set or Element.
    3496             TreePath selPath = mds_tree.getSelectionPath();
    3497             GEMSNode t = (GEMSNode)selPath.getLastPathComponent();
    3498            
    3499             if(t.type == T_SUBELEMENT) //Remove the subelement
    3500                 {
    3501                 RemoveSubelementActionListener removeSubelement = new RemoveSubelementActionListener();
    3502                 removeSubelement.actionPerformed((ActionEvent)null);
    3503                 }
    3504             else if(t.type == T_ELEMENT) //Remove the element
    3505                 {
    3506                 //System.err.println("element");
    3507                 RemoveElementActionListener removeElement = new RemoveElementActionListener();
    3508                 removeElement.actionPerformed((ActionEvent)null);
    3509                 }
    3510            
    3511             else if(t.type == T_ROOT)
    3512                 {
    3513                 //Do nothing
    3514                 System.err.println("Tree type of ROOT: this should not happen!");
    3515                 }
    3516             else if(t.type == T_SET) //Remove the whole set
    3517                 {
    3518                 //System.err.println("set");
    3519                 RemoveSetActionListener removeSet = new RemoveSetActionListener();
    3520                 removeSet.actionPerformed((ActionEvent)null);
    3521                 }
    3522             }
    3523         }
    3524     }
    3525     public void keyReleased(KeyEvent e) {
    3526         //Do nothing
     3056        this.removeItem();
     3057        }
     3058    }
     3059    public void keyReleased(KeyEvent e)
     3060        {
     3061        //Do nothing
     3062        }
     3063
     3064    public void actionPerformed(ActionEvent event)
     3065    {
     3066        this.removeItem();
     3067    }
     3068
     3069    public void removeItem()
     3070    {
     3071        boolean cont = true;
     3072       
     3073        /**
     3074           Check to see if more than one tree node/leaf is selected. If so don't continue.
     3075           
     3076           This could be updated to delete multiple nodes/leaves in the futere.
     3077           But not me and not today!!
     3078        */
     3079        TreePath[] multiSelectionCheck = mds_tree.getSelectionPaths();
     3080        if(multiSelectionCheck.length > 1)
     3081        {
     3082            cont = false;
     3083            Toolkit.getDefaultToolkit().beep();
     3084        }
     3085       
     3086        if(cont)
     3087        {
     3088           
     3089            //Check to see if pressed on Set or Element.
     3090            TreePath selPath = mds_tree.getSelectionPath();
     3091            GEMSNode t = (GEMSNode)selPath.getLastPathComponent();
     3092           
     3093            if(t.type == T_SUBELEMENT) //Remove the subelement
     3094            {
     3095                RemoveSubelementActionListener removeSubelement = new RemoveSubelementActionListener();
     3096                removeSubelement.actionPerformed((ActionEvent)null);
     3097            }
     3098            else if(t.type == T_ELEMENT) //Remove the element
     3099            {
     3100                //System.err.println("element");
     3101                RemoveElementActionListener removeElement = new RemoveElementActionListener();
     3102                removeElement.actionPerformed((ActionEvent)null);
     3103            }
     3104           
     3105            else if(t.type == T_ROOT)
     3106            {
     3107                //Do nothing
     3108                System.err.println("Tree type of ROOT: this should not happen!");
     3109            }
     3110            else if(t.type == T_SET) //Remove the whole set
     3111            {
     3112                //System.err.println("set");
     3113                RemoveSetActionListener removeSet = new RemoveSetActionListener();
     3114                removeSet.actionPerformed((ActionEvent)null);
     3115            }
     3116        }
    35273117    }
    35283118    }
    3529 
     3119   
    35303120
    35313121   
     
    35433133                //If the current_set_filename is dls or dublin or ex and in the METADATA_DIR, then do
    35443134                //not let anyone remove them --Attila
    3545                // System.out.println(current_set.getName());
    3546                
    35473135                File current_set_filename = current_set.getFile();
    3548               //  System.out.println(current_set_filename.toString());
    3549                
    35503136                if(current_set_filename.toString().compareTo(new String(Utility.METADATA_DIR+"dls.mds")) == 0 ||
    35513137                    current_set_filename.toString().compareTo(new String(Utility.METADATA_DIR+"dublin.mds")) == 0 ||
     
    35573143               
    35583144               
    3559         int result = JOptionPane.showOptionDialog(self, Dictionary.get("GEMS.Confirm_Removal", Dictionary.get("GEMS.Set")), Dictionary.get("GEMS.Confirm_Removal_Title"), JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE, null, dialog_options, dialog_options[0]);
     3145        int result = JOptionPane.showOptionDialog(self, Dictionary.get("GEMS.Confirm_Removal", Dictionary.get("GEMS.Set") + " " +  Dictionary.get("GEMS.Cannot_Undo")), Dictionary.get("GEMS.Confirm_Removal_Title"), JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE, null, dialog_options, dialog_options[0]);
    35603146        // Remove the currently selected set
    35613147        if(result == 0) {
     
    35663152            mds_tree.clearSelection();
    35673153            model.remove(current_set.toString(), GEMSNode.SET);
    3568             // Meanwhile disable/enable controls given we had a set selected, but no longer do.
    3569             remove_set.setEnabled(false);
    3570             // Show a blank panel.
    3571             card_layout.show(details_pane, BLANK);
     3154            card_layout.show(details_pane, BLANK); //Show a blank panel.
    35723155            ignore = false;
    3573                    
    3574                    
    3575                     //We do not need to set the following var because by this point the set was
    3576                     //completetely removed
    3577                     //atLeastOneSetChanged
    3578                    
    3579                    
     3156 
    35803157        }
    35813158        }
    35823159    }
    35833160    }
     3161
    35843162    /** This class will remove the currently selected metadata or profile value when any registered control is actioned. Note that removing a value acts differently from the other removes in that if you remove a value which is still assigned somewhere the values are restored next time said assignment is viewed. This turned out far easier and reasonable to code than attempting to remove all remaining values when you delete its reference in the GValueModel. */
    35853163    private class RemoveValueActionListener
     
    35943172        if(result == 0) {
    35953173            ignore = true;
    3596             // GValueModel model = (GValueModel) element_values.getModel();
    3597             // model.removeValue(current_value_node);
    3598             // Meanwhile disable/enable controls given we had a value selected, but no longer do.
    3599             edit_value.setEnabled(false);
    3600             remove_value.setEnabled(false);
    3601             ignore = false;
     3174            ignore = false; //What the heck?? --Matthew
    36023175                   
    3603                     //does this every get called?
     3176                    //does this ever get called?
    36043177                    System.out.println("\nGEMS.RemovevalueActionListener called");
    36053178                    atLeastOneSetChanged = true;
     
    36613234
    36623235    private class AttributesListSelectionListener
    3663     implements ListSelectionListener {
     3236    implements ListSelectionListener
     3237    {
    36643238    private JTable table = null;
    3665     public AttributesListSelectionListener(JTable table) {
     3239    public AttributesListSelectionListener(JTable table)
     3240    {
    36663241        this.table = table;
    36673242    }
    3668     public void valueChanged(ListSelectionEvent event) {
    3669         if(!event.getValueIsAdjusting()) {
    3670         if((current_attribute = table.getSelectedRow()) != -1) {
    3671           //  edit_attribute.setEnabled(true);
    3672           //  remove_attribute.setEnabled(true);
    3673                      // System.out.println("curr_attr != -1");
    3674          
    3675         }
    3676         else {
    3677                    // System.out.println("curr_attr = -1");
    3678             current_attribute = -1;
    3679           //  edit_attribute.setEnabled(false);
    3680           //  remove_attribute.setEnabled(false);
    3681         }
    3682         }
     3243
     3244    public void valueChanged(ListSelectionEvent event)
     3245    {
     3246        if(!event.getValueIsAdjusting())
     3247        {
     3248            current_attribute = table.getSelectedRow();
     3249            /*
     3250            if((current_attribute = table.getSelectedRow()) != -1)
     3251            {           
     3252            }
     3253            else
     3254            {
     3255                current_attribute = -1;
     3256            }
     3257            */
     3258        }
    36833259    }
    36843260    }
    3685 
     3261   
    36863262    private class ElementValuesTreeSelectionListener
    36873263    implements TreeSelectionListener {
     
    36913267        TreePath selected_path = element_values.getSelectionPath();
    36923268        current_value_node = (GValueNode) selected_path.getLastPathComponent();
    3693         edit_value.setEnabled(true);
    3694         remove_value.setEnabled(true);
    36953269        }
    36963270        else {
    36973271        current_value_node = null;
    3698         edit_value.setEnabled(false);
    3699         remove_value.setEnabled(false);
    37003272        }
    37013273    }
     
    37233295            atm = current_node.getModel();
    37243296            if(atm == null) {
    3725             // !!! ArrayList sources = msm.profiler.getSources(current_collection_file);
    37263297            attributes = new TreeSet();
    3727             // for(int i = 0; i < sources.size(); i++) {
    3728             // String source = (String) sources.get(i);
    3729             // !!! String action = msm.profiler.getAction(current_collection_file, source);
    3730             // if (action == null) {
    3731             // action = Dictionary.get("GEMS.Ignore");
    3732             // }
    3733             // attributes.add(new Attribute(source, action));
    3734             // }
     3298     
    37353299            atm = new AttributeTableModel(attributes, Dictionary.get("GEMS.Source"), Dictionary.get("GEMS.Target"), Dictionary.get("GEMS.Ignore"));
    3736             //current_node.setModel(atm);
    37373300            }
    37383301            profile_attributes.setModel(atm);
     
    37413304
    37423305            card_layout.show(details_pane, PROFILE);
    3743            // setControls(true, false, false, true, false, false, true, false, false, false, false, false);
    37443306            break;
    37453307
     
    37583320
    37593321            card_layout.show(details_pane, SUBELEMENT);
    3760             //card_layout.show(details_pane, BLANK);
    37613322            break;
    37623323
     
    37723333            atm.setTable(element_attributes);
    37733334
    3774             //System.err.println("atm is: " + atm); //debug
    3775 
    37763335            // Be careful not to add the keep_root_expanded_listener over and over!
    37773336            value_model = msm.getValueTree(current_element);
     
    37813340            element_values.setModel(value_model);
    37823341            element_values_layout.show(element_values_pane, VALUES);
    3783             // Meanwhile disable/enable controls depending on this Element selection.
    3784             //setControls(true, false, false, false, false, true, true, false, false, true, false, false);
    37853342            }
    37863343            else {
    3787             System.err.println("ELEMENT: value_model is null"); //debug
     3344            //this shouldn't happen!
    37883345            element_values_layout.show(element_values_pane, BLANK);
    3789             // Meanwhile disable/enable controls depending on this Element selection.
    3790             //setControls(true, false, false, false, false, false, true, false, false, false, false, false);
    37913346            }
    37923347            card_layout.show(details_pane, ELEMENT);
     
    38073362            }
    38083363            atm = new AttributeTableModel(attributes, Dictionary.get("GEMS.Name"), Dictionary.get("GEMS.Value"), "");
    3809             //current_node.setModel(atm);
    38103364            temp = null;
    38113365            }
     
    38163370            card_layout.show(details_pane, SET);
    38173371            attributes = null;
    3818             // Meanwhile disable/enable controls depending on this Element selection.
    3819            // setControls(true, true, false, false, true, false, true, false, false, false, false, false);
    38203372            break;
    38213373        case GEMSNode.PROFILER:
    3822             // Meanwhile disable/enable controls depending on this Element selection.
    3823             //setControls(true, false, true, false, false, false, false, false, false, false, false, false);
     3374
    38243375        default:
    38253376            // Show a blank panel.
     
    38293380        path = null;
    38303381        atm = null;
    3831                
    3832                 //System.out.println("Tree eventselection");
    38333382        }
    38343383    }
     
    38473396    //PopupListener is our main manager for all right-click popups
    38483397  class PopupListener extends MouseAdapter implements ActionListener{
    3849         JPopupMenu setPopup;
    3850         JPopupMenu subelementPopup;
    3851         JPopupMenu elementPopup;
    3852         JPopupMenu attributePopup;
    3853         //all of our popup menu items EVER!
    3854         JMenuItem menuAddSet;
    3855         JMenuItem menuRenameSet;
    3856         JMenuItem menuAddElement;
     3398      JPopupMenu setPopup;
     3399      JPopupMenu subelementPopup;
     3400      JPopupMenu elementPopup;
     3401      JPopupMenu attributePopup;
     3402      //all of our popup menu items EVER!
     3403      JMenuItem menuAddSet;
     3404      JMenuItem menuRenameSet;
     3405      JMenuItem menuAddElement;
    38573406      JMenuItem menuAddAttributeSet;
    38583407
    3859         JMenuItem menuRenameSubelement;
    3860         JMenuItem menuDeleteSubelement;
    3861         JMenuItem menuAddAttributeSubelement;
    3862         JMenuItem menuRenameElement;
    3863        
    3864         JMenuItem menuDeleteElement;
    3865         JMenuItem menuAddAttributeElement;
    3866         JMenuItem menuAddSubelement;
    3867        
    3868         JMenuItem menuEditValue;
    3869         JMenuItem menuDeleteAttribute;
    3870         JMenuItem menuAddAttributeAttribute;
    3871        
    3872         JMenuItem menuRemoveSet;
    3873        
     3408      JMenuItem menuRenameSubelement;
     3409      JMenuItem menuDeleteSubelement;
     3410      JMenuItem menuAddAttributeSubelement;
     3411      JMenuItem menuRenameElement;
     3412     
     3413      JMenuItem menuDeleteElement;
     3414      JMenuItem menuAddAttributeElement;
     3415      JMenuItem menuAddSubelement;
     3416      JMenuItem menuAddSubelementCopy;
     3417     
     3418      JMenuItem menuEditValue;
     3419      JMenuItem menuDeleteAttribute;
     3420      JMenuItem menuAddAttributeAttribute;
     3421     
     3422      JMenuItem menuRemoveSet;
     3423     
    38743424        GEMS GEMSRef = null;
    38753425        PopupListener(GEMS g) {
     
    38883438        //set related popups
    38893439        menuAddSet = new JMenuItem();
    3890             //Dictionary.setText(menuAddSet,"GEMS.Popup.menuAddSet");
    3891             //Dictionary.setText(menuAddSet,"GEMS.Add_Set_Tooltip");
    38923440           
    38933441        menuRenameSet = new JMenuItem();
     
    39043452           
    39053453            menuRemoveSet = new JMenuItem();
    3906     //Dictionary.setText(menuRemoveSet,"GEMS.Popup.menuRemoveSet");
    39073454       Dictionary.setText(menuRemoveSet,"GEMS.Remove_Set_Tooltip");
    39083455       
     
    39343481            Dictionary.setText(menuAddSubelement,"GEMS.Popup.menuAddSubelement");
    39353482             //Dictionary.setText(menuAddSubelement,"GEMS.Add_Subelement");
     3483        menuAddSubelementCopy = new JMenuItem(); //A copy of menuAddSubelement
     3484        Dictionary.setText(menuAddSubelementCopy, "GEMS.Popup.menuAddSubelement");
    39363485       
    39373486            //attribute related GEMS.Popups
     
    39493498             
    39503499             //start Associate the menu items with the appropriate popups:
    3951              setPopup.add(menuRenameSet);
    3952          //setPopup.add(menuAddSet);
    39533500         setPopup.add(menuAddAttributeSet);
    39543501         setPopup.add(menuAddElement);
     3502             setPopup.add(menuRenameSet);
    39553503         setPopup.add(menuRemoveSet);
    3956              //setPopup.add(menuRenameSet);
    3957          //setPopup.add(menuAddSet);
    3958         setPopup.add(menuAddAttributeSet);
    3959         setPopup.add(menuAddElement);
    3960         setPopup.add(menuRemoveSet);
     3504           
     3505         elementPopup.add(menuAddAttributeElement);
     3506         elementPopup.add(menuAddSubelement);
     3507             elementPopup.add(menuRenameElement);
     3508             elementPopup.add(menuDeleteElement);
    39613509             
     3510         subelementPopup.add(menuAddAttributeSubelement);
     3511         //subelementPopup.add(menuAddSubelementCopy);
    39623512             subelementPopup.add(menuRenameSubelement);
    39633513             subelementPopup.add(menuDeleteSubelement);
    3964              subelementPopup.add(menuAddAttributeSubelement);
    3965          subelementPopup.add(menuAddSubelement);
    3966              
    3967              elementPopup.add(menuRenameElement);
    3968              elementPopup.add(menuDeleteElement);
    3969              elementPopup.add(menuAddAttributeElement);
    3970              elementPopup.add(menuAddSubelement);
    3971              
     3514           
     3515         attributePopup.add(menuAddAttributeAttribute);
    39723516             attributePopup.add(menuEditValue);
    39733517             attributePopup.add(menuDeleteAttribute);
    3974              attributePopup.add(menuAddAttributeAttribute);
    39753518             //end Associate the menu items with the appropriate popups:
    39763519             
    3977              
    39783520             menuRemoveSet.addActionListener(new RemoveSetActionListener());
    3979              //menuAddSet.addActionListener(new AddSetActionListener());
    39803521             menuAddElement.addActionListener(new AddElementActionListener());
    39813522             menuAddAttributeSet.addActionListener(new AddOrEditAttributeActionListener());
     
    39893530             menuAddAttributeElement.addActionListener(new AddOrEditAttributeActionListener());
    39903531             menuAddSubelement.addActionListener(new AddSubelementActionListener());
    3991              
    3992             // menuEditValue.addActionListener(new AddOrEditAttributeActionListener());
    3993              AddOrEditAttributeActionListener tes = new AddOrEditAttributeActionListener();
    3994              
     3532         menuAddSubelementCopy.addActionListener(new AddSubelementActionListener());
    39953533             menuEditValue.addActionListener(new AddOrEditAttributeActionListener());
    3996              
    3997              //menuEditValue.addActionListener(this);
    3998              
    39993534             menuDeleteAttribute.addActionListener(new RemoveAttributeActionListener());
    40003535             menuAddAttributeAttribute.addActionListener(new AddOrEditAttributeActionListener());
     
    40143549        private void maybeShowPopup(MouseEvent e) {
    40153550           
    4016          //TreeNode oTreeNode = e.getSource().
    40173551         int selRow = mds_tree.getRowForLocation(e.getX(), e.getY());
    40183552     TreePath selPath = mds_tree.getPathForLocation(e.getX(), e.getY());
    40193553     Point p = null;
    40203554            if (e.isPopupTrigger()) {
    4021                // setPopup.show(e.getComponent(),
    4022                  //          e.getX(), e.getY());
    4023                //System.out.println(e.getSource().toString());
    4024                
    4025                //SmarterTable table = (SmarterTable) e.getSource();
    4026                
    4027              /*  if(table.getSelectedRow() <= -1) {
    4028                    
    4029                    System.out.println("blahasdf");                   
    4030                }
    4031                
    4032                table.getComponent(0)
    4033              
    4034                System.out.println(.get);
    4035                
    4036              
    4037               */
    40383555               
    40393556             if(e.getSource() == mds_tree) {
     
    40503567            }
    40513568
    4052             /*  else if(t.type == T_ELEMENT){
    4053            
    4054             subelementPopup.show(e.getComponent(),
    4055                        e.getX(), e.getY());
    4056                 }
    4057             */
    40583569            else if(t.type == T_SUBELEMENT)
    40593570            {
     
    41103621                     e.getX(), e.getY());
    41113622             }
    4112              
    4113                
    4114             }
    4115            
     3623            } 
    41163624        }
    41173625     
    41183626        public void actionPerformed(ActionEvent e) {
    4119            // GEMSRef.add_or_edit_attribute_action_listener.actionPerformed(e);
     3627        //This should never happen!!
    41203628            System.out.println("NO way hose");
    41213629        }
    4122        
    41233630    }
    41243631 
  • trunk/gli/src/org/greenstone/gatherer/gems/GEMSModel.java

    r8930 r8932  
    5050    }
    5151
    52     public void add(GEMSNode parent, Object object, int type) {
     52    public GEMSNode add(GEMSNode parent, Object object, int type) {
    5353    if(parent == null) {
    5454        parent = (GEMSNode) root;
    5555    }
     56
    5657    GEMSNode new_node = new GEMSNode(type, object, null);
    5758    SynchronizedTreeModelTools.insertNodeInto(this, parent, new_node);
     59
     60    return new GEMSNode(type, object, parent);
    5861    }
    5962
  • trunk/gli/src/org/greenstone/gatherer/gems/GEMSNode.java

    r8930 r8932  
    206206
    207207
    208     private void mapChildren()
     208    public void mapChildren()
    209209    {
    210210    children = new Vector();
     
    215215        // Add the elements as children
    216216        MetadataSet set = (MetadataSet) userObject;
    217         NodeList elements = set.getElements();
    218         for (int i = 0; i < elements.getLength(); i++)
     217        ArrayList elements = set.getElements();
     218        for (int i = 0; i < elements.size(); i++)
    219219            {
    220             children.add(new GEMSNode(ELEMENT, new ElementWrapper((Element) elements.item(i)), this));
     220            children.add(new GEMSNode(ELEMENT, new ElementWrapper((Element) elements.get(i)), this));
    221221            }
    222222        }
    223     if (type == ELEMENT) //Add subelements
     223    if (type == ELEMENT) //Add subelements. This will need to be changed to cope with multiple levels of subelements.
    224224        {
    225         NodeList subelements = this.getElement().getSubelements();
    226         for(int j = 0; j < subelements.getLength(); j++)
     225        ArrayList subelements = this.getElement().getSubelements();
     226        for(int j = 0; j < subelements.size(); j++)
    227227            {
    228             children.add(new GEMSNode(SUBELEMENT, new ElementWrapper((Element)subelements.item(j)), this));
     228            children.add(new GEMSNode(SUBELEMENT, new ElementWrapper((Element)subelements.get(j)), this));
    229229            }
    230230        }
  • trunk/gli/src/org/greenstone/gatherer/gems/GEMSPreferences.java

    r8884 r8932  
    230230
    231231    // The new method makes use of the successor to the languages.dat file, classes/xml/languages.xml
     232    // Should update to also give the full name of the language --Matthew
    232233    NodeList language_elements = LanguageManager.LANGUAGES_DOCUMENT.getDocumentElement().getElementsByTagName(StaticStrings.LANGUAGE_ELEMENT);
    233234    for(int i = 0; i < language_elements.getLength(); i++) {
     
    263264    //Dictionary.registerBoth(view_extracted_metadata_checkbox, "Preferences.General.View_Extracted_Metadata", "Preferences.General.View_Extracted_Metadata_Tooltip");
    264265
     266   
    265267    // Show file sizes
    266268    use_subfields_checkbox = new JCheckBox();
     
    274276        //  System.out.println("before"+ blah);
    275277         
    276     if (Configuration.get("GEMS.Preferences.Use_Subfields", true)) {
     278    if (Configuration.get("GEMS.Preferences.Use_Subelements", true)) {
    277279            use_subfields_checkbox.setSelected(true);
    278280    }
    279     Dictionary.registerBoth(use_subfields_checkbox_label, "GEMS.Preferences.Use_Subfields", "GEMS.Preferences.Use_Subfields_Tooltip");
     281    Dictionary.registerBoth(use_subfields_checkbox_label, "GEMS.Preferences.Use_Subelements", "GEMS.Preferences.Use_Subelements_Tooltip");
     282   
    280283
    281284    // Language
     
    451454            //save subfield checkbox
    452455           
    453         Configuration.set("Gems.Preferences.Use_Subfields", true, use_subfields_checkbox.isSelected());
     456        Configuration.set("Gems.Preferences.Use_Subelements", true, use_subfields_checkbox.isSelected());
    454457      //  Gatherer.g_man.enrich_pane.valueChanged((TreeSelectionEvent) null); // Refresh metadata table
    455458
  • trunk/gli/src/org/greenstone/gatherer/gems/MSMUtils.java

    r8930 r8932  
    6363    static public char NS_SEP= '.';
    6464    /** The character used to separate subfields from metadata element. */
    65     static public String SF_SEP= "#";
     65    static public String SF_SEP= "^";
    6666    /** Method to add one node as a child of another, after migrating into the target document.
    6767     * @param parent The <strong>Node</strong> we are inserting into.
     
    128128    }
    129129
    130     /**
    131        @author: Matthew Whyte
    132        @date last modified: 17/01/04
    133 
    134        This will need modifications!!!
    135        Maybe this should not be here.
    136     */
    137     static public void addSubelement(Element element_element, String subelement_name)
    138     {
    139     Document document = element_element.getOwnerDocument();
    140     //Create the new subelement
    141     Element subelement = document.createElement("Subelement");
    142     subelement.setAttribute(StaticStrings.NAME_ATTRIBUTE, subelement_name);
    143    
    144     //Add the attribute the old fashioned way.
    145     element_element.appendChild(subelement);
    146 
    147     //Clean up
    148     subelement = null;
    149     document = null;
    150     }
    151130
    152131    /** A method for comparing two AssignedValues trees. This compares not only the Subject hierarchies but also the values themselves.
     
    758737     * @see org.greenstone.gatherer.util.StaticStrings#LANGUAGEDEPENDANT_ATTRIBUTE
    759738     */
    760     static private boolean isAttributeLanguageDependant(Document document, String attribute_name_str) {
     739    static private boolean isAttributeLanguageDependant(Document document, String attribute_name_str)
     740    {
    761741    String language_specific_attributes = document.getDocumentElement().getAttribute(StaticStrings.LANGUAGEDEPENDANT_ATTRIBUTE).toLowerCase();
    762742    return language_specific_attributes.indexOf(attribute_name_str) != -1;
     
    858838        language_elements = null;
    859839        // Not found
     840        //System.err.println("new optimised way failed."); //debug
    860841        return false;
    861     }
     842    } // end if
    862843    // Otherwise just use the old method
    863844
     
    878859    attribute_elements = null;
    879860    // No match found
     861    //System.err.println("Old method failed."); //debug
    880862    return false;
    881863    }
  • trunk/gli/src/org/greenstone/gatherer/gems/MetadataSet.java

    r8930 r8932  
    6363    private Hashtable value_trees = null;
    6464    /** The list of metadata elements which are, of course, children of the root node. */
    65     private NodeList elements = null;
     65    private ArrayList elements = null;
    6666   
    6767    // the nmae of the collection if this set is collection-specific
     
    111111    root = (Element) document.importNode(original.getDocument().getDocumentElement(), true);
    112112    document.appendChild(root);
    113     elements = root.getElementsByTagName("Element");
     113    elements = XMLTools.getChildElementsByTagName(root, "Element");
     114    //elements = root.getElementsByTagName("Element");
    114115    file = original.getFile();
    115116    // Now for each element read in its value tree if present.
    116     for(int i = elements.getLength() - 1; i >= 0; i--) {
    117         ElementWrapper value_element_wrapper = new ElementWrapper((Element)elements.item(i));
     117    for(int i = elements.size() - 1; i >= 0; i--) {
     118        ElementWrapper value_element_wrapper = new ElementWrapper((Element)elements.get(i));
    118119        GValueModel value_tree = original.getValueTree(value_element_wrapper);
    119120        Document value_document = value_tree.getDocument();
     
    177178    }
    178179
    179     /**
    180        Add a new subelement with the name given to parent_element in this metadata set.
    181        @param name The name of this element as a <strong>String</strong>.
    182        @param parent_element The <strong>ElementWrapper</strong> that parents the subelement.
    183        @param language The two letter language code as a <strong>String</strong>
    184        @return An <strong>SubelementWrapper</strong> around the newly created subelement.
    185        @author Matthew Whyte
    186        @date last modified: 18/01/05
    187      */
    188     public ElementWrapper addSubelement(ElementWrapper parent_element, String name, String language)
     180
     181    /** Add a new default metadata element with the given name to this metadata set.
     182    This method also handles the addtion of 'subelements'
     183     * @param name The name of this element as a <strong>String</strong>.
     184     * @param parent The parent element as an <strong>GEMSNode</strong>. If null, the parent is the metadataset root.
     185     * @return An <strong>ElementWrapper</strong> around the newly created element or null if the element was not created.
     186     */
     187    public ElementWrapper addElement(String name, String language, GEMSNode parent)
    189188    {
    190     //The language-dependent 'label' of the subelement. By default is same as name.
    191     Text text = document.createTextNode(name);
    192     Element label = document.createElementNS("", "Attribute");
    193     label.setAttribute("name", "label");
    194     label.setAttribute("language", language);
    195     label.appendChild(text);
    196 
    197     //The subelement.
    198     Element subelement = document.createElementNS("", "Subelement");
    199     subelement.setAttribute("name", name);
    200     subelement.appendChild(label);
    201 
    202     Element parent = parent_element.getElement(); //The parent element
    203     parent.appendChild(subelement);
    204     return new ElementWrapper(subelement);
    205     }
    206 
    207 
    208     /** Add a new default metadata element with the given name to this metadata set.
    209      * @param name The name of this element as a <strong>String</strong>.
    210      * @return An <strong>ElementWrapper</strong> around the newly created element or null if the element was not created.
    211      */
    212     public ElementWrapper addElement(String name, String language)
    213     {
    214     Text text = document.createTextNode(name);
    215     Element identifier = document.createElementNS("","Attribute");
    216     identifier.setAttribute("name","identifier");
    217     identifier.setAttribute("language", language);
    218     identifier.appendChild(text);
     189    Element parent_element = null;
     190
     191    //The element that we are creating
    219192    Element element = document.createElementNS("","Element");
    220193    element.setAttribute("name",name);
    221     element.appendChild(identifier);
    222     root.appendChild(element);
     194
     195    //Add identifier attribute. This handles if we use the new or old language identification
     196    MSMUtils.addElementAttribute(element, "identifier", language, name);
     197   
     198    if(parent == null) //A element
     199        {
     200        parent_element = root;
     201        elements.add(element); //Add the new element to the list of 'em
     202        }
     203    else //A subelement!
     204        {
     205        //Add the new subelement to the list of 'em
     206        parent.getElement().addSubelementToList(element);
     207        parent_element = parent.getElement().getElement(); //get the parent as an Element
     208        }
     209
     210    parent_element.appendChild(element);
     211
    223212    return new ElementWrapper(element);
    224213    }
     
    289278        int index_e2 = -1;
    290279        // Locate the indexes for each element.
    291         for(int i = 0; i < elements.getLength(); i++) {
    292         Node element = elements.item(i);
     280        for(int i = 0; i < elements.size(); i++) {
     281        Node element = (Node)elements.get(i);
    293282        if(element == e1) {
    294283            index_e1 = i;
     
    313302     */
    314303    public boolean containsElement(String name) {
    315     for(int i = 0; i < elements.getLength(); i++) {
    316         Element sibling = (Element) elements.item(i);
     304    for(int i = 0; i < elements.size(); i++) {
     305        Element sibling = (Element) elements.get(i);
    317306        String sibling_name = sibling.getAttribute("name");
    318307        if(sibling_name.equals(name)) {
     
    363352     */
    364353    public Element getElement(int index) {
    365     return (Element)elements.item(index);
     354    return (Element)elements.get(index);
    366355    }
    367356    /** This method is used to acquire a reference to the element which matches the given metadata. Note that this is not the same as <i>metadata.getElement()</i> as the reference returned by it may now be obsolete.
     
    382371    }
    383372    ///ystem.err.println("Get element named " + name);
    384     for(int i = 0; i < elements.getLength(); i++) {
    385         Element element = (Element) elements.item(i);
     373    for(int i = 0; i < elements.size(); i++) {
     374        Element element = (Element) elements.get(i);
    386375        ///ystem.err.println("Compare to: " + element.getAttribute("name"));
    387376        if(element.getAttribute("name").equals(name)) {
     
    394383    public Element getElement(Element parent_element, String name) {
    395384    DebugStream.println("Get element named " + name + " from " + parent_element.getAttribute("name"));
    396     NodeList elements = parent_element.getElementsByTagName("Element");
    397     for(int i = 0; i < elements.getLength(); i++) {
    398         Element element = (Element) elements.item(i);
     385    ArrayList elements = XMLTools.getChildElementsByTagName(parent_element, "Element");
     386    for(int i = 0; i < elements.size(); i++) {
     387        Element element = (Element) elements.get(i);
    399388        if(element.getAttribute("name").equals(name) && element.getParentNode() == parent_element) {
    400389        elements = null;
     
    408397     * @return A <strong>NodeList</strong> containing all of this sets elements.
    409398     */
    410     public NodeList getElements() {
     399    public ArrayList getElements() {
    411400    return elements;
    412401    }
     
    417406//     public Vector getElementsSorted() {
    418407//  Vector elements_list = new Vector();
    419 //  for (int i = 0; i < elements.getLength(); i++) {
    420 //      elements_list.add(new ElementWrapper((Element) elements.item(i)));
     408//  for (int i = 0; i < elements.size(); i++) {
     409//      elements_list.add(new ElementWrapper((Element) elements.get(i)));
    421410//  }
    422411//  Collections.sort(elements_list, MSMUtils.METADATA_COMPARATOR);
     
    504493    root.removeAttribute(name);
    505494    }
     495
    506496    /** Method to remove the given element from this metadata set.
    507497     * @param element The <strong>Element</strong> to be removed.
    508      */
    509     public void removeElement(Element element, ElementWrapper parent_wrapped) {
     498     * @param parent The parent element, as an <strong>Element</strong>. If null, the parent is root.
     499     */
     500    public void removeElement(Element element, Element parent) {
    510501    // we need to remove the value tree too!!
    511502    //System.err.println("removeElement in MetadataSet: element is: " + element); //Debug
     
    514505        ElementWrapper element_wrapped = new ElementWrapper(element);
    515506        removeValueTree(element_wrapped);
    516         if(element_wrapped.isSubelement())
     507
     508        if(parent == null)
    517509        {
    518             //Want to remove subelement.
    519             //System.err.println("Wanna remove subelement"); //debug
    520             Element parent = parent_wrapped.getElement();
    521             parent.removeChild(element);
     510            parent = root;
    522511        }
    523         else
    524         {
    525             root.removeChild(element);
    526         }
    527 
     512       
     513        //Want to remove subelement.
     514        //System.err.println("Wanna remove subelement"); //debug
     515        parent.removeChild(element);
     516       
    528517    } catch(Exception DOMException) { //The element does not exist!!
    529518        System.err.println("Exception: '"+ DOMException + "' occured. Cannot remove element because it does not exist.");
     
    606595     */
    607596    public int size() {
    608     return elements.getLength();
     597    return elements.size();
    609598    }
    610599    /** Method to translate this class into a meaningful string, which in this case is the metadata sets name.
     
    693682
    694683    if(this.document != null) {
    695         this.elements = document.getElementsByTagName("Element");
    696684        this.root = document.getDocumentElement();
     685        this.elements = XMLTools.getChildElementsByTagName(root, "Element");
    697686        // Now for each element read in its value tree if present.
    698         for(int i = elements.getLength() - 1; i >= 0; i--) {
    699         ElementWrapper value_element = new ElementWrapper((Element)elements.item(i));
     687        for(int i = elements.size() - 1; i >= 0; i--) {
     688        ElementWrapper value_element = new ElementWrapper((Element)elements.get(i));
    700689        File value_file = new File(file.getParentFile(), value_element.getName() + ".mdv");
    701690        ///ystem.err.println("Searching for " + value_file.getAbsolutePath());
  • trunk/gli/src/org/greenstone/gatherer/gems/MetadataSetManager.java

    r8930 r8932  
    120120    if(current_set != null)
    121121        {
    122         //Update the namespace
    123         current_set.setNamespace(new_namespace);
    124 
    125         //Update the name
    126         //Element name = new Element(current_set.getElement(Name));
    127         current_set.setName(new_name);
    128         }
    129 
     122        String old_namespace = current_set.getNamespace();
     123        current_set.setNamespace(new_namespace); //Update the namespace
     124        current_set.setName(new_name); //Update the name
     125        mds_hashtable.remove(old_namespace); //Remove the old set from the hashtable
     126        mds_hashtable.put(new_namespace, current_set); //Add the new set to the hashtable
     127        }
    130128    else
    131129        {
    132         System.err.println("No such set " + current_set);
     130        //This should not happen.
     131        System.err.println("Error: no such set \'" + current_set + "\'");
    133132        }
    134133    }
     
    201200           || (mds.getNamespace().equals(Utility.EXTRACTED_METADATA_NAMESPACE) && (Configuration.get("general.view_extracted_metadata", Configuration.COLLECTION_SPECIFIC) || force_extracted))
    202201           || (mds.getNamespace().equals(Utility.EXTRACTED_METADATA_NAMESPACE) && mds.getNamespace().equals(HIDDEN) && all)) {
    203         NodeList set_elements = mds.getElements();
     202        ArrayList set_elements = mds.getElements();
    204203        ///ystem.err.println("The set " + mds + " has " + set_elements.getLength() + " elements.");
    205         for(int i = 0; i < set_elements.getLength(); i++) {
    206             Element raw_element = (Element)set_elements.item(i);
     204        for(int i = 0; i < set_elements.size(); i++) {
     205            Element raw_element = (Element)set_elements.get(i);
    207206            ElementWrapper element = new ElementWrapper(raw_element);
    208207            // For now we do not add subfield elements and their parents, just the subfields.
     
    429428       Method to remove an element or subelement from a metadata set
    430429       @param element the element to remove, as an <strong>ElementWrapper</strong>
    431        @param parent the parent of the element, as an <strong>ElementWrapper</strong> This is required if removing a subelement (can be null otherwise)
     430       @param parent the parent of the element, as an <strong>ElementWrapper</strong> This is required if removing a subelement (can be null - this means the parent is the metadataset root.)
    432431       @return void
    433432       Modified by Matthew Whyte 19/01/04
     
    439438    MetadataSet set = (MetadataSet) mds_hashtable.get(namespace);
    440439    if(set != null) {
    441         // Bugger. Get the old name -before- we remove the element from the set.
    442         //String old_name = element.toString();
    443         set.removeElement(element.getElement(), parent); //Remove the element
     440        //Remove the element
     441        if(parent == null)
     442        {
     443            set.removeElement(element.getElement(), null); //Let's not cause an exception!
     444        }
     445        else
     446        {
     447            set.removeElement(element.getElement(), parent.getElement());
     448        }
    444449    }
    445450    else {
     
    458463    public void renameElement(ElementWrapper oldElement, String newName)
    459464    {
     465    GEMSNode node = null;
     466
    460467    //Retrive the metadata set this element belongs to.
    461468    String namespace = oldElement.getNamespace();
Note: See TracChangeset for help on using the changeset viewer.