- Timestamp:
- 2005-01-28T10:13:58+13:00 (19 years ago)
- Location:
- trunk/gli
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/classes/dictionary.properties
r8930 r8932 1127 1127 GEMS.Add_Value_Tooltip:Add a new value to the selected element 1128 1128 GEMS.AddAttribute:Add Attribute 1129 GEMS.AddElement:Add Element 1129 1130 GEMS.AddSet:Add Set 1130 1131 GEMS.AddValue:Add Value … … 1137 1138 GEMS.Attribute_Value_Tooltip:The value of the new attribute 1138 1139 GEMS.Attributes:Attributes 1140 GEMS.Cannot_Undo:(this action cannot be undone) 1139 1141 GEMS.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. 1140 1142 GEMS.Confirm_Removal:Are you sure you wish to remove this {0}? -
trunk/gli/metadata/agls.mds
r8747 r8932 61 61 <Attribute language="en" name="obligation">Mandatory</Attribute> 62 62 <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> 63 84 </Element> 64 85 <Element name="Title"> … … 67 88 <Attribute language="en" name="obligation">Mandatory</Attribute> 68 89 <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> 69 96 </Element> 70 97 <Element name="Availability"> 71 <Attribute language="en" name="identifier">Availability</Attribute>72 98 <Attribute language="en" name="definition">How the resource can be obtained or contact information for obtaining the resource.</Attribute> 73 99 <Attribute language="en" name="obligation">Mandatory for offline resources.</Attribute> 74 100 <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> 75 102 </Element> 76 103 <Element name="Function"> … … 115 142 <Attribute language="en" name="obligation">Optional</Attribute> 116 143 <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> 117 166 </Element> 118 167 <Element name="Description"> … … 127 176 <Attribute language="en" name="obligation">Optional</Attribute> 128 177 <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> 129 189 </Element> 130 190 <Element name="Language"> … … 139 199 <Attribute language="en" name="obligation">Optional </Attribute> 140 200 <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> 141 216 </Element> 142 217 <Element name="Relation"> … … 145 220 <Attribute language="en" name="obligation">Optional</Attribute> 146 221 <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> 147 292 </Element> 148 293 <Element name="Rights"> … … 163 308 <Attribute language="en" name="obligation">Optional</Attribute> 164 309 <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> 165 333 </Element> 166 334 </MetadataSet> -
trunk/gli/metadata/nzgls.mds
r8747 r8932 65 65 <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> 66 66 </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'éléments de métadonnées. Cette formalisation contribue à améliorer la cohérence avec d'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 "Dublin Core". 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 "Home Page" de "Dublin Core" (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 "Uniform Resource Identifiers (URI): Generic Syntax"æ件ãéœæææ žå¿å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 "Description of Dublin Core Elements" http://purl.org/metadata/dublin_core_elements"</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>152 67 <Element name="Title" remember_values="true"> 153 68 <!-- English --> … … 626 541 <Attribute language="en" name="definition">A specific warrant which requires the resource to be created or provided.</Attribute> 627 542 <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> 628 571 </Element> 629 572 <Element name="Contributor" remember_values="true"> … … 833 776 <Attribute name="datatype">Charater String</Attribute> 834 777 <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> 835 814 </Element> 836 815 <Element name="Type" remember_values="true"> … … 931 910 <Attribute name="datatype">Charater String</Attribute> 932 911 <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 &quot;documents&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> 933 932 </Element> 934 933 <Element name="Format" remember_values="true"> … … 1031 1030 <Attribute name="datatype">Charater String</Attribute> 1032 1031 <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> 1033 1047 </Element> 1034 1048 <Element name="Availability"> … … 1456 1470 <Attribute name="datatype">Charater String</Attribute> 1457 1471 <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> 1458 1571 </Element> 1459 1572 <Element name="Coverage" remember_values="true"> … … 1579 1692 <Attribute name="datatype">Charater String</Attribute> 1580 1693 <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 &quot;temporal&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> 1581 1718 </Element> 1582 1719 <Element name="Rights" remember_values="true"> -
trunk/gli/src/org/greenstone/gatherer/gems/ElementWrapper.java
r8930 r8932 45 45 **************************************************************************************/ 46 46 import java.util.TreeSet; 47 import java.util.ArrayList; 47 48 import org.greenstone.gatherer.util.StaticStrings; 48 49 import org.greenstone.gatherer.util.Troolean; 49 50 import org.greenstone.gatherer.util.Utility; 51 import org.greenstone.gatherer.util.XMLTools; 50 52 import org.w3c.dom.*; 51 53 … … 60 62 /** A string prefix identifying the metadata set namespace. */ 61 63 private String namespace = ""; 62 63 private NodeList subelements = null; //The list of subelements64 private ArrayList subelements = null; //The list of subelements 65 // private XMLTools xmlTools = new XMLTools(); //uh, a class of XML tools, i guess 64 66 65 67 private Troolean is_extracted = new Troolean(); … … 69 71 public ElementWrapper(Element element) { 70 72 this.element = element; 71 //System.err.println("ElementWrapper: element is: " + element); //debug72 73 Element parent = (Element)element.getParentNode(); 73 74 if (parent != null) … … 76 77 } 77 78 78 subelements = element.getElementsByTagName("Subelement");79 subelements = XMLTools.getChildElementsByTagName(element, "Element"); 79 80 //Should read in each subelement's value tree? 80 81 } … … 99 100 { 100 101 //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++) 102 103 { 103 Element sibling = (Element)subelements. item(i);104 Element sibling = (Element)subelements.get(i); 104 105 String sibling_name = sibling.getAttribute("name"); 105 106 if(sibling_name.equals(name)) … … 113 114 114 115 /** 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 /** 115 127 Method to acquire a list of all the subelements in the element. 116 128 @return A <strong>NodeList</strong> containing all of this element's subelements. … … 119 131 @date last modified: 19/01/04 120 132 */ 121 public NodeList getSubelements()133 public ArrayList getSubelements() 122 134 { 123 135 return subelements; 124 136 } 125 137 126 /**127 Method to determine if this is a subelement128 @return A <strong>boolean</strong> - true if the 'element' is a subelement129 @author Matthew Whyte130 @date last modified 19/01/04131 */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 }141 138 142 139 /** Create a copy of this element wrapper. … … 276 273 /** Removes an Attribute node from the element. */ 277 274 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; 279 282 } 280 283 -
trunk/gli/src/org/greenstone/gatherer/gems/GEMS.java
r8930 r8932 37 37 38 38 39 40 39 import java.awt.*; 41 40 import java.awt.event.*; … … 84 83 static final public int NORMAL = 1; 85 84 static final public int REMOVE_SET = 2; 85 86 86 /** The default size of the editor dialog. */ 87 87 static final private Dimension ADD_ELEMENT_SIZE = new Dimension(400,125); … … 121 121 private AddFileActionListener add_file_action_listener = null; 122 122 public AddSetActionListener add_set_action_listener = null; 123 // private RenameElementActionListener rename_element_action_listener = null;124 123 /** The class used to handle add or edit attribute actions has to be globally available so that we can dispose of its dialog properly. */ 125 124 public AddOrEditAttributeActionListener add_or_edit_attribute_action_listener = null; 126 125 /** 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; 128 127 private boolean ignore = false; 129 128 /** A card layout is used to switch between the two differing detail views. */ … … 131 130 /** A card layout is used to switch between a value tree or an empty placeholder (if no value tree available). */ 132 131 private CardLayout element_values_layout = null; 132 133 133 /** Um, the size of the screen I'd guess. */ 134 134 private Dimension screen_size = null; … … 141 141 private int current_attribute = -1; 142 142 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 155 144 private JLabel element_name = null; 156 145 private JLabel profile_name = null; … … 175 164 public org.w3c.dom.Element rootelement; 176 165 177 // public LanguageManager languageManager = new LanguageManager(rootelement);178 166 //PopupListener provides right-click functionality to any component that needs it 179 167 //It is a centralized manager for all popups, then we use evt.Source() and determine where the 180 168 //event was performed 181 169 private PopupListener popupListener = new PopupListener(this); 182 183 /**KeyPressedListener is a centralized manager for all key pressed action */184 // private KeyPressedListener keyPressedListener = new KeyPressedListener();185 170 186 171 /** A tree that represents the current metadata sets associated with this collection. */ … … 194 179 // Parse arguments 195 180 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 208 182 if (go.debug) { 209 183 DebugStream.enableDebugging(); … … 306 280 JLabel set_name_label = new JLabel(); 307 281 set_name_label.setOpaque(false); 308 //Dictionary.setText(set_name_label, "GEMS.Name");309 282 set_name = new JLabel(); 310 //set_name.setBorder(BorderFactory.createLoweredBevelBorder());311 //set_name.setOpaque(false);312 283 313 284 JPanel set_attributes_pane = new JPanel(); … … 336 307 JLabel element_name_label = new JLabel(); 337 308 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);342 309 343 310 JPanel element_inner_pane = new JPanel(); … … 409 376 JLabel profile_name_label = new JLabel(); 410 377 profile_name_label.setOpaque(false); 411 //Dictionary.setText(profile_name_label, "GEMS.Name");412 378 profile_name = new JLabel(); 413 379 profile_name.setBorder(BorderFactory.createLoweredBevelBorder()); … … 457 423 JPanel inner_button_pane = new JPanel(); 458 424 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);498 425 499 426 add_element_action_listener = new AddElementActionListener(); 500 427 add_file_action_listener = new AddFileActionListener(); 501 428 add_set_action_listener = new AddSetActionListener(); 502 // rename_element_action_listener = new RenameElementActionListener();503 504 505 429 add_or_edit_attribute_action_listener = new AddOrEditAttributeActionListener(); 506 add_or_edit_value_action_listener = new AddOrEditValueActionListener();507 430 remove_set_action_listener = new RemoveSetActionListener(); 508 431 … … 517 440 edit_set_pane.setOpaque(false); 518 441 519 // Connection520 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());532 442 element_attributes.getSelectionModel().addListSelectionListener(new AttributesListSelectionListener(element_attributes)); 533 443 subelement_attributes.getSelectionModel().addListSelectionListener(new AttributesListSelectionListener(subelement_attributes)); 534 444 profile_attributes.getSelectionModel().addListSelectionListener(new AttributesListSelectionListener(profile_attributes)); 535 445 set_attributes.getSelectionModel().addListSelectionListener(new AttributesListSelectionListener(set_attributes)); 536 //element_values.addTreeSelectionListener(new ElementValuesTreeSelectionListener());537 446 mds_tree.addTreeSelectionListener(new MDSTreeSelectionListener()); 447 538 448 // Layout 539 449 mds_tree_pane.setLayout(new BorderLayout()); … … 574 484 element_inner_pane.setLayout(new BorderLayout()); 575 485 element_inner_pane.add(element_attributes_pane); 576 486 //element_inner_pane.add(element_values_pane); 577 487 578 488 element_details_pane.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(Dictionary.get("GEMS.Element_Details")), BorderFactory.createEmptyBorder(2,2,2,2))); … … 646 556 private void exit() 647 557 { 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 } 663 584 } 664 585 … … 711 632 712 633 file_delete = new JMenuItem(); 713 file_delete.addActionListener(new RemoveSetActionListener());634 file_delete.addActionListener(new KeyPressedHandler()); //KeyPressedHandler handles deleting stuff. 714 635 file_delete.setMnemonic(KeyEvent.VK_S); 715 636 // Dictionary.registerText(file_delete, "GEMS.Menu.File_Delete"); … … 784 705 // File -> New 785 706 if (event_source == file_new) { 786 add_set.doClick(); 787 // set_changed = true; 707 AddSetActionListener rah = new AddSetActionListener(); 708 rah.show(); 709 788 710 return; 789 711 } … … 801 723 //once we have clicked 'ok' on the jdialog above, then we should have 802 724 //the directory pointer in string set_directory...and pass it to the jfilechoose constru 803 804 805 725 return; 806 726 } … … 816 736 if (event_source == file_exit) { 817 737 exit(); //The exit() method checks if data needs saving. 818 819 } 820 821 // Edit -> Cut 738 } 739 740 // File -> Preferences 822 741 if(event_source == file_preferences){ 823 742 GEMSPreferences GemsPreferences = new GEMSPreferences(); 824 825 826 743 } 744 745 // Edit -> Cut 827 746 if (event_source == edit_cut) { 828 747 try { … … 892 811 return false; 893 812 } 894 895 813 896 814 public String getDescription() … … 968 886 screen_size = null; 969 887 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;982 888 details_pane = null; 983 889 element_attributes = null; … … 1000 906 add_or_edit_attribute_action_listener = null; 1001 907 } 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 }1006 908 remove_set_action_listener = null; 1007 909 … … 1010 912 } 1011 913 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 true1017 add_set.setEnabled(true); // Always true1018 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 }1027 914 1028 915 /** … … 1071 958 attributeLists.add("registration_authority"); 1072 959 1073 1074 //1075 960 setSize(ADD_OR_EDIT_ATTRIBUTE_SIZE); 1076 961 name_to_values = new HashMap(); … … 1089 974 target = new JLabel(); 1090 975 target.setOpaque(false); 1091 //Dictionary.setText(target, "this is the target"); //debug1092 976 1093 977 JLabel name_label = new JLabel(); … … 1101 985 language_label.setOpaque(false); 1102 986 Dictionary.setText(language_label, "GEMS.Language"); 1103 language_box = new JComboBox(); // !!! Gatherer.g_man.design_pane.getLanguageCodes().toArray()); 1104 987 language_box = new JComboBox(); 1105 988 1106 989 for(int n = 0; n < attributeLists.size(); n++){ 1107 1108 990 name.add(attributeLists.get(n)); 1109 1110 991 } 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 1117 993 Dictionary.setTooltip(language_box, "GEMS.Attribute_Language_Tooltip"); 1118 994 … … 1291 1167 else 1292 1168 { 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. 1295 1170 } 1296 1171 } … … 1316 1191 } 1317 1192 } 1318 //setVisible(true);1319 1193 } 1320 1194 else if (source == popupListener.menuAddAttributeAttribute || source == popupListener.menuAddAttributeSet || source == popupListener.menuAddAttributeElement || source == popupListener.menuAddAttributeSubelement){ … … 1470 1344 case GEMSNode.COLLECTION: 1471 1345 tablemodel = (AttributeTableModel) profile_attributes.getModel(); 1472 //String prevLang = tablemodel.getValueAt(current_attribute,0).toString();1473 //String prevValue = tablemodel.getValueAt(current_attribute,1).toString();1474 1346 1475 1347 break; 1476 1348 case GEMSNode.SET: 1477 1349 tablemodel = (AttributeTableModel) set_attributes.getModel(); 1478 //grab value in table (1350 //grab value in table 1479 1351 prevLang = tablemodel.getValueAt(current_attribute,0).toString(); 1480 1352 prevValue = tablemodel.getValueAt(current_attribute,1).toString(); … … 1530 1402 private void editAttribute() 1531 1403 { 1404 //System.err.println("just entered editAttribute"); //debug 1532 1405 AttributeTableModel model = null; 1533 1406 Dictionary.setText(this, "GEMS.EditAttribute"); 1534 //System.out.println(source.toString()+"\n");1535 1407 1536 1408 switch(current_attribute_type) { … … 1577 1449 } 1578 1450 1451 //Is this method ever used? What's a collection attribute? --Matthew 1579 1452 private boolean addOrEditCollectionAttribute(AttributeTableModel model) 1580 1453 { 1454 System.err.println("addOrEditCollectionAttribute was actually used!!"); //if this is ever used!! 1581 1455 String name_str = name.getSelectedItem().toString(); 1582 1456 String value_str = Codec.transform(Codec.transformUnicode(value.getText()), Codec.TEXT_TO_DOM); … … 1585 1459 if(!add_type && current_attribute != -1) { 1586 1460 String old_source = (String) model.getValueAt(current_attribute, 0); 1587 // !!! msm.profiler.removeAction(current_collection_file, old_source);1588 1461 old_source = null; 1589 1462 model.removeRow(current_attribute); … … 1593 1466 // Check that there isn't already an entry for this attribute 1594 1467 if (!model.contains(name_str, 0)) { 1595 // Add profile1596 // !!! msm.profiler.addAction(current_collection_file, name_str, value_str);1597 1468 // Update attribute table 1598 1469 model.add(new Attribute(name_str, value_str)); … … 1612 1483 private boolean addOrEditSetAttribute(AttributeTableModel model) 1613 1484 { 1614 String n ame_str = name.getSelectedItem().toString();1485 String new_name_str = name.getSelectedItem().toString(); 1615 1486 String value_str = Codec.transform(Codec.transformUnicode(value.getText()), Codec.TEXT_TO_DOM); 1487 String old_name_str = null; 1616 1488 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 1632 1497 // 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 1647 1519 value_str = null; 1648 n ame_str = null;1520 new_name_str = null; 1649 1521 return cont; 1650 1522 } … … 1653 1525 private boolean addOrEditElementAttribute(AttributeTableModel model) 1654 1526 { 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; 1657 1529 String language_code = (String) language_box.getSelectedItem(); 1658 1659 1530 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 1677 1568 value_str = null; 1678 1569 language_code = null; 1679 n ame_str = null;1680 return true;1681 } 1682 1570 new_name_str = null; 1571 return cont; 1572 } 1573 1683 1574 //Very similar to addOrEditElementAttribute 1684 1575 private boolean addOrEditSubelementAttribute(AttributeTableModel model) 1685 1576 { 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; 1689 1579 String language_code = (String) language_box.getSelectedItem(); 1690 1691 1580 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 1695 1587 { 1696 1588 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; 1702 1593 } 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 1710 1618 value_str = null; 1711 1619 language_code = null; 1712 n ame_str = null;1713 return true;1620 new_name_str = null; 1621 return cont; 1714 1622 } 1715 1623 … … 1769 1677 ok_button = new GLIButton(); 1770 1678 ok_button.setMnemonic(KeyEvent.VK_O); 1679 getRootPane().setDefaultButton(ok_button); 1771 1680 Dictionary.setBoth(ok_button, "General.OK", "General.OK_Tooltip"); 1772 1681 cancel_button = new GLIButton(); … … 1813 1722 //System.err.println("You chose to add a new subelement!!\n"); //debug 1814 1723 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. 1815 1726 1816 1727 if(source == ok_button) //Add then dispose … … 1819 1730 1820 1731 current_set = msm.getSet(current_element.getNamespace()); 1732 //System.err.println("current_element.getNamespace(): " + current_element.getNamespace()); //debug 1821 1733 if(current_set != null) 1822 1734 { … … 1826 1738 // Add it, 1827 1739 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 1830 1742 // 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. 1835 1749 subelement = null; 1836 1750 setVisible(false); 1837 //mark as changed 1838 atLeastOneSetChanged = true; 1839 current_set.setSetChanged(true); 1751 atLeastOneSetChanged = true; //mark as changed 1840 1752 } 1841 1753 else … … 1848 1760 { 1849 1761 //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"); 1851 1763 } 1852 1764 } … … 1857 1769 else 1858 1770 { 1859 element_field.setText(current_ element.getName()); //set to the name of the element1771 element_field.setText(current_node.toString()); //set to the name of the element 1860 1772 name_field.setText(""); 1861 1773 setVisible(true); … … 1890 1802 JPanel center_pane = new JPanel(); 1891 1803 center_pane.setOpaque(false); 1804 Dictionary.setText(this, "GEMS.AddElement"); 1892 1805 1893 1806 JPanel labels_pane = new JPanel(); … … 1916 1829 ok_button = new GLIButton(); 1917 1830 ok_button.setMnemonic(KeyEvent.VK_O); 1831 getRootPane().setDefaultButton(ok_button); 1918 1832 Dictionary.setBoth(ok_button, "General.OK", "General.OK_Tooltip"); 1919 1833 cancel_button = new GLIButton(); … … 1967 1881 // Add it, 1968 1882 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); 1970 1884 // Then update the tree 1971 1885 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. 1975 1887 1976 1888 // Done … … 1994 1906 } 1995 1907 else { 1996 if(current_set != null) { 1908 if(current_set != null) { //Does this ever happen? --Matthew 1997 1909 // You can't manually add elements to the Greenstone metadata set. 1998 1910 if(!current_set.getNamespace().equals("")) { … … 2002 1914 setVisible(true); 2003 1915 } 2004 // Warn the user that they can't do that dave. 1916 // Warn the user that they can't do that dave. 2005 1917 else { 2006 1918 … … 2186 2098 ok_button = new GLIButton(); 2187 2099 ok_button.setMnemonic(KeyEvent.VK_O); 2100 getRootPane().setDefaultButton(ok_button); 2188 2101 Dictionary.setBoth(ok_button, "General.OK", "General.OK_Tooltip"); 2189 2102 cancel_button = new GLIButton(); … … 2202 2115 label_pane.add(name_label); 2203 2116 label_pane.add(namespace_label); 2204 // label_pane.add2205 // boxes_pane.setLayout(new GridLayout(2,1,0,5));2206 2117 boxes_pane.setLayout(new GridLayout(3,1)); 2207 2118 boxes_pane.add(name_field); … … 2213 2124 label_pane.add(inheritJLabel); 2214 2125 2215 2216 //add inherit metadata set functionality2217 // String[] s = msm.getSets().toArray();2218 2219 //JComboBox existingSetJComboBox = new JComboBox(new String(msm.getSetsForInherit().toArray()));2220 2221 2126 int getSetsLen = msm.getSets().toArray().length; 2222 2127 Vector theSets = msm.getSets(); … … 2230 2135 //add sets to existingSetJComboBox 2231 2136 2232 2233 2137 //String tempstr = new String(); 2234 2138 JLabel dummyl = new JLabel(); 2235 2139 Dictionary.setText(dummyl, "GEMS.Add_Set.No_Inherit"); 2236 2237 2238 2140 2239 2141 existingSetJComboBox.addItem("Do not inherit"); … … 2266 2168 flag = true; 2267 2169 } 2268 2269 2270 2170 } 2271 2171 … … 2288 2188 String name_str = Codec.transform(Codec.transformUnicode(name_field.getText()), Codec.TEXT_TO_DOM); 2289 2189 2290 2291 2292 2190 if (existingSetJComboBox.getSelectedItem().toString().trim().compareTo("Do not inherit") == 0){ 2293 2191 2294 2192 // Ensure the set doesn't already exist 2295 //if(msm.getSet(namespace_str) == null) {2296 2193 if(a_set_exists_with_this_namespace(namespace_str) == false){ 2297 2194 2298 2299 2300 2195 MetadataSet set = msm.addSet(namespace_str, name_str); 2301 2196 … … 2316 2211 2317 2212 } 2318 //do not inherit == 02319 // 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 2324 2213 2325 2214 name_str = null; … … 2340 2229 FileInputStream fstream = new FileInputStream(items[1].trim()); 2341 2230 BufferedReader in = new BufferedReader(new InputStreamReader(fstream, "UTF8")); 2342 //DataInputStream in = new DataInputStream(fstream);2343 ///////////////2344 2231 2345 2232 FileOutputStream out; … … 2351 2238 p = new PrintWriter(pout); 2352 2239 2353 //cycle through all lines in IN and print to OUT2354 //while(in.available() != 0){2355 2240 while(in.ready()){ 2356 2357 //System.out.println(in.readLine()+ "\n"2358 //String nextline = in.readLine();2359 2241 String nextline = in.readLine(); 2360 2242 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 2373 2252 p.print(nextline + "\n"); 2374 2253 } 2375 2376 2377 //2378 2254 p.close(); 2379 2255 … … 2386 2262 } 2387 2263 2388 2389 2390 ///////////////2391 2392 2393 2264 } 2394 2265 catch(Exception e){ 2395 2396 2266 System.out.println("File Input error"); 2397 2398 2267 } 2399 2268 … … 2402 2271 2403 2272 JOptionPane.showMessageDialog(self, Dictionary.get("GEMS.Set_Already_Exists"), Dictionary.get("General.Error"), JOptionPane.ERROR_MESSAGE); 2404 2405 2406 2273 } 2274 setVisible(false); 2407 2275 } 2408 //}//if a_set_exists_with_this_namespace 2409 //set = null; 2410 setVisible(false); 2411 } 2276 2277 } //if(source == ok_button) 2412 2278 else if(source == cancel_button) { 2413 2279 setVisible(false); … … 2417 2283 setVisible(true); 2418 2284 } 2419 } 2285 } //actionPerformed 2420 2286 2421 2287 public void dispose() { … … 2427 2293 } 2428 2294 } 2295 2429 2296 //// 2430 2297 private class SetSelectionDialog … … 2433 2300 private JButton cancel_button = null; 2434 2301 private JButton ok_button = null; 2435 //private JTextField name_field = null;2436 //private JTextField namespace_field = null;2437 2302 private JComboBox existingSetJComboBox = new JComboBox(); 2438 2303 … … 2441 2306 setModal(true); 2442 2307 setSize(OPEN_SETS_SIZE); 2443 Dictionary.setText(this, " Open Sets");2308 Dictionary.setText(this, "GEMS.Menu.File_Open"); 2444 2309 2445 2310 // Creation … … 2457 2322 ok_button = new GLIButton(); 2458 2323 ok_button.setMnemonic(KeyEvent.VK_O); 2324 getRootPane().setDefaultButton(ok_button); 2459 2325 Dictionary.setBoth(ok_button, "General.OK", "General.OK_Tooltip"); 2460 2326 cancel_button = new GLIButton(); … … 2466 2332 cancel_button.addActionListener(this); 2467 2333 ok_button.addActionListener(this); 2468 // ok_button_enabler.add(name_field);2469 // ok_button_enabler.add(namespace_field);2470 2334 2471 2335 // Layout 2472 2473 // label_pane.add2474 // boxes_pane.setLayout(new GridLayout(2,1,0,5));2475 2336 boxes_pane.setLayout(new GridLayout(4,1)); 2476 // boxes_pane.add(name_field); 2477 // boxes_pane.add(namespace_field); 2478 2337 2479 2338 JLabel inheritJLabel = new JLabel(); 2480 2339 Dictionary.setText(inheritJLabel, "GEMS.inheritMetadataSet"); 2481 2340 2482 //label_pane.add(inheritJLabel);2483 2484 2485 //add inherit metadata set functionality2486 // String[] s = msm.getSets().toArray();2487 2488 //JComboBox existingSetJComboBox = new JComboBox(new String(msm.getSetsForInherit().toArray()));2489 2490 2341 int getSetsLen = msm.getSets().toArray().length; 2491 2342 Vector theSets = msm.getSets(); 2492 // System.out.println(Configuration.gsdl_path);2493 2343 File[] col_dir = new File(Configuration.gsdl_path + "/collect").listFiles(); 2494 2344 2495 existingSetJComboBox.addItem("Default Metadata Sets 2345 existingSetJComboBox.addItem("Default Metadata Sets #% " + Configuration.gsdl_path + "gli/metadata"); 2496 2346 2497 2347 for(int k = 0; k < col_dir.length; k++){ 2498 //MetadataSet ms = (MetadataSet)theSets.elementAt(k);2499 2500 2348 if(col_dir[k].isDirectory() && col_dir[k].getName().compareTo("CVS") != 0) { 2501 2349 … … 2505 2353 2506 2354 } 2507 2508 // existingSetJComboBox.addItem(new String(ms.getName() + " #% " + ms.getFile().toString()));2509 2355 2510 2356 } … … 2516 2362 Dictionary.setText(dummyl, "GEMS.Add_Set.No_Inherit"); 2517 2363 2518 2519 2520 //existingSetJComboBox.addItem("Do not inherit");2521 // existingSetJComboBox.setSelectedIndex(getSetsLen);2522 2364 boxes_pane.add(new JLabel("Select which group of metadata sets you wish to edit:\n\n\n\n")); 2523 2365 boxes_pane.add(new JLabel("\n")); 2524 2366 boxes_pane.add(existingSetJComboBox); 2525 2367 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 2531 2369 button_pane.setLayout(new GridLayout(1,3,0,5)); 2532 2370 button_pane.add(ok_button); 2533 2371 button_pane.add(cancel_button); 2534 2535 2372 2536 2373 content_pane.setBorder(BorderFactory.createEmptyBorder(5,5,5,5)); … … 2548 2385 Object source = event.getSource(); 2549 2386 2550 2551 // if(a_set_exists_with_this_namespace(namespace_field.getText()) == false){2552 2387 if(source == ok_button) { 2553 2388 //this code below handles whether we inherit from an existing set or not … … 2593 2428 } 2594 2429 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 2829 2431 2830 2432 /** This listener is responsible for keeping the root node of a value tree expanded where and when possible. */ … … 2919 2521 ((AttributeTableModel)subelement_attributes.getModel()).removeRow(current_attribute); 2920 2522 } 2921 // Disable buttons2922 // edit_attribute.setEnabled(false);2923 remove_attribute.setEnabled(false);2924 2523 ignore = false; 2925 2524 … … 2938 2537 This class can be created from either PopupHandler or KeyPressedHandler. KeyPressedHandler passes a null ActionEvent!! 2939 2538 @author: Matthew Whyte 2940 @Date last modified: 18/01/04 2539 @Date last modified: 18/01/05 2540 25/01/05 2941 2541 */ 2942 2542 private class RemoveSubelementActionListener implements ActionListener { … … 2960 2560 // Clear selection 2961 2561 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. 2967 2564 ignore = false; 2968 2565 … … 2998 2595 2999 2596 // Meanwhile disable/enable controls given we had an element selected, but no longer do. 3000 remove_element.setEnabled(false);2597 //remove_element.setEnabled(false); 3001 2598 // Show a blank panel. 3002 2599 card_layout.show(details_pane, BLANK); … … 3026 2623 if(result == 0) { 3027 2624 ignore = true; 3028 // !!! msm.profiler.removeProfile(current_collection_file); 2625 3029 2626 // Clear selection 3030 2627 mds_tree.clearSelection(); 3031 2628 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. 3036 2630 ignore = false; 3037 2631 } … … 3095 2689 ok_button = new GLIButton(); 3096 2690 ok_button.setMnemonic(KeyEvent.VK_O); 2691 getRootPane().setDefaultButton(ok_button); 3097 2692 Dictionary.setBoth(ok_button, "General.OK", "General.OK_Tooltip"); 3098 2693 cancel_button = new GLIButton(); … … 3140 2735 flag = true; 3141 2736 } 3142 3143 3144 2737 } 3145 2738 … … 3160 2753 String namespace_str = namespace_field.getText(); 3161 2754 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(?). 3163 2756 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);3168 2757 3169 2758 //Ensure that the namespace is unique. … … 3176 2765 //Rename set & namespace 3177 2766 msm.renameSet(current_set, namespace_str, name_str); 3178 3179 2767 //Add (renamed) set back to tree 3180 2768 model.add(null, current_set, GEMSNode.SET); 3181 3182 2769 3183 2770 //Clean up … … 3217 2804 ok_button = null; 3218 2805 name_field = null; 3219 //System.err.println("Dispose AddElementActionListener");3220 2806 super.dispose(); 3221 2807 } … … 3245 2831 current_element = parent.getElement(); 3246 2832 //MetadataSet currentSet = msm.getSet(current_subelement.getNamespace()); 3247 3248 2833 String name_str = Codec.transform(Codec.transformUnicode(name_field.getText()), Codec.TEXT_TO_DOM); 3249 2834 … … 3255 2840 3256 2841 msm.renameElement(current_subelement, name_str); //rename the element 3257 3258 2842 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; 3266 2846 atLeastOneSetChanged = true; 3267 2847 setVisible(false); … … 3305 2885 protected NonWhitespaceField name_field = null; 3306 2886 3307 3308 2887 public RenameElementActionListener() { 3309 2888 super(self); … … 3318 2897 JPanel labels_pane = new JPanel(); 3319 2898 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);3325 2899 3326 2900 JPanel values_pane = new JPanel(); … … 3341 2915 ok_button = new GLIButton(); 3342 2916 ok_button.setMnemonic(KeyEvent.VK_O); 2917 getRootPane().setDefaultButton(ok_button); 3343 2918 Dictionary.setBoth(ok_button, "General.OK", "General.OK_Tooltip"); 3344 2919 cancel_button = new GLIButton(); … … 3395 2970 TreeNode selPath = current_node.getParent(); 3396 2971 GEMSNode parent = (GEMSNode)selPath; 2972 GEMSNode new_node = null; 3397 2973 MetadataSet currentSet = msm.getSet(current_element.getNamespace()); 3398 3399 2974 String name_str = Codec.transform(Codec.transformUnicode(name_field.getText()), Codec.TEXT_TO_DOM); 2975 GValueModel value_model = msm.getValueTree(current_element); 3400 2976 3401 2977 // If this element doesn't already exist. … … 3403 2979 { 3404 2980 //Hide the element that are about to rename 3405 mds_tree.clearSelection();2981 //mds_tree.clearSelection(); 3406 2982 model.remove(current_element.getName(), GEMSNode.ELEMENT); 3407 2983 3408 2984 msm.renameElement(current_element, name_str); //rename the element 3409 2985 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); 3412 2994 //Could now select the new element, but for now will just clean up ;-) 3413 2995 // 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; 3417 2998 2999 currentSet.setSetChanged(true); 3418 3000 atLeastOneSetChanged = true; 3419 3001 setVisible(false); … … 3447 3029 ok_button = null; 3448 3030 name_field = null; 3449 //label = null;3450 //System.err.println("Dispose AddElementActionListener");3451 3031 super.dispose(); 3452 3032 } 3453 3033 3454 3034 } 3455 3456 3457 3035 3458 3036 … … 3463 3041 3464 3042 Author: Matthew Whyte 3465 Date last modified: 2 1/12/043043 Date last modified: 25/01/05 3466 3044 */ 3467 private class KeyPressedHandler implements KeyListener {3045 private class KeyPressedHandler implements KeyListener, ActionListener { 3468 3046 3469 3047 // All implementations of KeyListener requires these methods … … 3476 3054 if(e.getKeyCode() == java.awt.event.KeyEvent.VK_DELETE) //DELETE key pressed 3477 3055 { 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 } 3527 3117 } 3528 3118 } 3529 3119 3530 3120 3531 3121 … … 3543 3133 //If the current_set_filename is dls or dublin or ex and in the METADATA_DIR, then do 3544 3134 //not let anyone remove them --Attila 3545 // System.out.println(current_set.getName());3546 3547 3135 File current_set_filename = current_set.getFile(); 3548 // System.out.println(current_set_filename.toString());3549 3550 3136 if(current_set_filename.toString().compareTo(new String(Utility.METADATA_DIR+"dls.mds")) == 0 || 3551 3137 current_set_filename.toString().compareTo(new String(Utility.METADATA_DIR+"dublin.mds")) == 0 || … … 3557 3143 3558 3144 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]); 3560 3146 // Remove the currently selected set 3561 3147 if(result == 0) { … … 3566 3152 mds_tree.clearSelection(); 3567 3153 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. 3572 3155 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 3580 3157 } 3581 3158 } 3582 3159 } 3583 3160 } 3161 3584 3162 /** 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. */ 3585 3163 private class RemoveValueActionListener … … 3594 3172 if(result == 0) { 3595 3173 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 3602 3175 3603 //does this ever yget called?3176 //does this ever get called? 3604 3177 System.out.println("\nGEMS.RemovevalueActionListener called"); 3605 3178 atLeastOneSetChanged = true; … … 3661 3234 3662 3235 private class AttributesListSelectionListener 3663 implements ListSelectionListener { 3236 implements ListSelectionListener 3237 { 3664 3238 private JTable table = null; 3665 public AttributesListSelectionListener(JTable table) { 3239 public AttributesListSelectionListener(JTable table) 3240 { 3666 3241 this.table = table; 3667 3242 } 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 } 3683 3259 } 3684 3260 } 3685 3261 3686 3262 private class ElementValuesTreeSelectionListener 3687 3263 implements TreeSelectionListener { … … 3691 3267 TreePath selected_path = element_values.getSelectionPath(); 3692 3268 current_value_node = (GValueNode) selected_path.getLastPathComponent(); 3693 edit_value.setEnabled(true);3694 remove_value.setEnabled(true);3695 3269 } 3696 3270 else { 3697 3271 current_value_node = null; 3698 edit_value.setEnabled(false);3699 remove_value.setEnabled(false);3700 3272 } 3701 3273 } … … 3723 3295 atm = current_node.getModel(); 3724 3296 if(atm == null) { 3725 // !!! ArrayList sources = msm.profiler.getSources(current_collection_file);3726 3297 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 3735 3299 atm = new AttributeTableModel(attributes, Dictionary.get("GEMS.Source"), Dictionary.get("GEMS.Target"), Dictionary.get("GEMS.Ignore")); 3736 //current_node.setModel(atm);3737 3300 } 3738 3301 profile_attributes.setModel(atm); … … 3741 3304 3742 3305 card_layout.show(details_pane, PROFILE); 3743 // setControls(true, false, false, true, false, false, true, false, false, false, false, false);3744 3306 break; 3745 3307 … … 3758 3320 3759 3321 card_layout.show(details_pane, SUBELEMENT); 3760 //card_layout.show(details_pane, BLANK);3761 3322 break; 3762 3323 … … 3772 3333 atm.setTable(element_attributes); 3773 3334 3774 //System.err.println("atm is: " + atm); //debug3775 3776 3335 // Be careful not to add the keep_root_expanded_listener over and over! 3777 3336 value_model = msm.getValueTree(current_element); … … 3781 3340 element_values.setModel(value_model); 3782 3341 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);3785 3342 } 3786 3343 else { 3787 System.err.println("ELEMENT: value_model is null"); //debug3344 //this shouldn't happen! 3788 3345 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);3791 3346 } 3792 3347 card_layout.show(details_pane, ELEMENT); … … 3807 3362 } 3808 3363 atm = new AttributeTableModel(attributes, Dictionary.get("GEMS.Name"), Dictionary.get("GEMS.Value"), ""); 3809 //current_node.setModel(atm);3810 3364 temp = null; 3811 3365 } … … 3816 3370 card_layout.show(details_pane, SET); 3817 3371 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);3820 3372 break; 3821 3373 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 3824 3375 default: 3825 3376 // Show a blank panel. … … 3829 3380 path = null; 3830 3381 atm = null; 3831 3832 //System.out.println("Tree eventselection");3833 3382 } 3834 3383 } … … 3847 3396 //PopupListener is our main manager for all right-click popups 3848 3397 class PopupListener extends MouseAdapter implements ActionListener{ 3849 3850 3851 3852 3853 3854 3855 3856 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; 3857 3406 JMenuItem menuAddAttributeSet; 3858 3407 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 3874 3424 GEMS GEMSRef = null; 3875 3425 PopupListener(GEMS g) { … … 3888 3438 //set related popups 3889 3439 menuAddSet = new JMenuItem(); 3890 //Dictionary.setText(menuAddSet,"GEMS.Popup.menuAddSet");3891 //Dictionary.setText(menuAddSet,"GEMS.Add_Set_Tooltip");3892 3440 3893 3441 menuRenameSet = new JMenuItem(); … … 3904 3452 3905 3453 menuRemoveSet = new JMenuItem(); 3906 //Dictionary.setText(menuRemoveSet,"GEMS.Popup.menuRemoveSet");3907 3454 Dictionary.setText(menuRemoveSet,"GEMS.Remove_Set_Tooltip"); 3908 3455 … … 3934 3481 Dictionary.setText(menuAddSubelement,"GEMS.Popup.menuAddSubelement"); 3935 3482 //Dictionary.setText(menuAddSubelement,"GEMS.Add_Subelement"); 3483 menuAddSubelementCopy = new JMenuItem(); //A copy of menuAddSubelement 3484 Dictionary.setText(menuAddSubelementCopy, "GEMS.Popup.menuAddSubelement"); 3936 3485 3937 3486 //attribute related GEMS.Popups … … 3949 3498 3950 3499 //start Associate the menu items with the appropriate popups: 3951 setPopup.add(menuRenameSet);3952 //setPopup.add(menuAddSet);3953 3500 setPopup.add(menuAddAttributeSet); 3954 3501 setPopup.add(menuAddElement); 3502 setPopup.add(menuRenameSet); 3955 3503 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); 3961 3509 3510 subelementPopup.add(menuAddAttributeSubelement); 3511 //subelementPopup.add(menuAddSubelementCopy); 3962 3512 subelementPopup.add(menuRenameSubelement); 3963 3513 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); 3972 3516 attributePopup.add(menuEditValue); 3973 3517 attributePopup.add(menuDeleteAttribute); 3974 attributePopup.add(menuAddAttributeAttribute);3975 3518 //end Associate the menu items with the appropriate popups: 3976 3519 3977 3978 3520 menuRemoveSet.addActionListener(new RemoveSetActionListener()); 3979 //menuAddSet.addActionListener(new AddSetActionListener());3980 3521 menuAddElement.addActionListener(new AddElementActionListener()); 3981 3522 menuAddAttributeSet.addActionListener(new AddOrEditAttributeActionListener()); … … 3989 3530 menuAddAttributeElement.addActionListener(new AddOrEditAttributeActionListener()); 3990 3531 menuAddSubelement.addActionListener(new AddSubelementActionListener()); 3991 3992 // menuEditValue.addActionListener(new AddOrEditAttributeActionListener()); 3993 AddOrEditAttributeActionListener tes = new AddOrEditAttributeActionListener(); 3994 3532 menuAddSubelementCopy.addActionListener(new AddSubelementActionListener()); 3995 3533 menuEditValue.addActionListener(new AddOrEditAttributeActionListener()); 3996 3997 //menuEditValue.addActionListener(this);3998 3999 3534 menuDeleteAttribute.addActionListener(new RemoveAttributeActionListener()); 4000 3535 menuAddAttributeAttribute.addActionListener(new AddOrEditAttributeActionListener()); … … 4014 3549 private void maybeShowPopup(MouseEvent e) { 4015 3550 4016 //TreeNode oTreeNode = e.getSource().4017 3551 int selRow = mds_tree.getRowForLocation(e.getX(), e.getY()); 4018 3552 TreePath selPath = mds_tree.getPathForLocation(e.getX(), e.getY()); 4019 3553 Point p = null; 4020 3554 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 */4038 3555 4039 3556 if(e.getSource() == mds_tree) { … … 4050 3567 } 4051 3568 4052 /* else if(t.type == T_ELEMENT){4053 4054 subelementPopup.show(e.getComponent(),4055 e.getX(), e.getY());4056 }4057 */4058 3569 else if(t.type == T_SUBELEMENT) 4059 3570 { … … 4110 3621 e.getX(), e.getY()); 4111 3622 } 4112 4113 4114 } 4115 3623 } 4116 3624 } 4117 3625 4118 3626 public void actionPerformed(ActionEvent e) { 4119 // GEMSRef.add_or_edit_attribute_action_listener.actionPerformed(e); 3627 //This should never happen!! 4120 3628 System.out.println("NO way hose"); 4121 3629 } 4122 4123 3630 } 4124 3631 -
trunk/gli/src/org/greenstone/gatherer/gems/GEMSModel.java
r8930 r8932 50 50 } 51 51 52 public voidadd(GEMSNode parent, Object object, int type) {52 public GEMSNode add(GEMSNode parent, Object object, int type) { 53 53 if(parent == null) { 54 54 parent = (GEMSNode) root; 55 55 } 56 56 57 GEMSNode new_node = new GEMSNode(type, object, null); 57 58 SynchronizedTreeModelTools.insertNodeInto(this, parent, new_node); 59 60 return new GEMSNode(type, object, parent); 58 61 } 59 62 -
trunk/gli/src/org/greenstone/gatherer/gems/GEMSNode.java
r8930 r8932 206 206 207 207 208 p rivatevoid mapChildren()208 public void mapChildren() 209 209 { 210 210 children = new Vector(); … … 215 215 // Add the elements as children 216 216 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++) 219 219 { 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)); 221 221 } 222 222 } 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. 224 224 { 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++) 227 227 { 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)); 229 229 } 230 230 } -
trunk/gli/src/org/greenstone/gatherer/gems/GEMSPreferences.java
r8884 r8932 230 230 231 231 // 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 232 233 NodeList language_elements = LanguageManager.LANGUAGES_DOCUMENT.getDocumentElement().getElementsByTagName(StaticStrings.LANGUAGE_ELEMENT); 233 234 for(int i = 0; i < language_elements.getLength(); i++) { … … 263 264 //Dictionary.registerBoth(view_extracted_metadata_checkbox, "Preferences.General.View_Extracted_Metadata", "Preferences.General.View_Extracted_Metadata_Tooltip"); 264 265 266 265 267 // Show file sizes 266 268 use_subfields_checkbox = new JCheckBox(); … … 274 276 // System.out.println("before"+ blah); 275 277 276 if (Configuration.get("GEMS.Preferences.Use_Sub fields", true)) {278 if (Configuration.get("GEMS.Preferences.Use_Subelements", true)) { 277 279 use_subfields_checkbox.setSelected(true); 278 280 } 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 280 283 281 284 // Language … … 451 454 //save subfield checkbox 452 455 453 Configuration.set("Gems.Preferences.Use_Sub fields", true, use_subfields_checkbox.isSelected());456 Configuration.set("Gems.Preferences.Use_Subelements", true, use_subfields_checkbox.isSelected()); 454 457 // Gatherer.g_man.enrich_pane.valueChanged((TreeSelectionEvent) null); // Refresh metadata table 455 458 -
trunk/gli/src/org/greenstone/gatherer/gems/MSMUtils.java
r8930 r8932 63 63 static public char NS_SEP= '.'; 64 64 /** The character used to separate subfields from metadata element. */ 65 static public String SF_SEP= " #";65 static public String SF_SEP= "^"; 66 66 /** Method to add one node as a child of another, after migrating into the target document. 67 67 * @param parent The <strong>Node</strong> we are inserting into. … … 128 128 } 129 129 130 /**131 @author: Matthew Whyte132 @date last modified: 17/01/04133 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 subelement141 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 up148 subelement = null;149 document = null;150 }151 130 152 131 /** A method for comparing two AssignedValues trees. This compares not only the Subject hierarchies but also the values themselves. … … 758 737 * @see org.greenstone.gatherer.util.StaticStrings#LANGUAGEDEPENDANT_ATTRIBUTE 759 738 */ 760 static private boolean isAttributeLanguageDependant(Document document, String attribute_name_str) { 739 static private boolean isAttributeLanguageDependant(Document document, String attribute_name_str) 740 { 761 741 String language_specific_attributes = document.getDocumentElement().getAttribute(StaticStrings.LANGUAGEDEPENDANT_ATTRIBUTE).toLowerCase(); 762 742 return language_specific_attributes.indexOf(attribute_name_str) != -1; … … 858 838 language_elements = null; 859 839 // Not found 840 //System.err.println("new optimised way failed."); //debug 860 841 return false; 861 } 842 } // end if 862 843 // Otherwise just use the old method 863 844 … … 878 859 attribute_elements = null; 879 860 // No match found 861 //System.err.println("Old method failed."); //debug 880 862 return false; 881 863 } -
trunk/gli/src/org/greenstone/gatherer/gems/MetadataSet.java
r8930 r8932 63 63 private Hashtable value_trees = null; 64 64 /** The list of metadata elements which are, of course, children of the root node. */ 65 private NodeList elements = null;65 private ArrayList elements = null; 66 66 67 67 // the nmae of the collection if this set is collection-specific … … 111 111 root = (Element) document.importNode(original.getDocument().getDocumentElement(), true); 112 112 document.appendChild(root); 113 elements = root.getElementsByTagName("Element"); 113 elements = XMLTools.getChildElementsByTagName(root, "Element"); 114 //elements = root.getElementsByTagName("Element"); 114 115 file = original.getFile(); 115 116 // 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)); 118 119 GValueModel value_tree = original.getValueTree(value_element_wrapper); 119 120 Document value_document = value_tree.getDocument(); … … 177 178 } 178 179 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) 189 188 { 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 219 192 Element element = document.createElementNS("","Element"); 220 193 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 223 212 return new ElementWrapper(element); 224 213 } … … 289 278 int index_e2 = -1; 290 279 // 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); 293 282 if(element == e1) { 294 283 index_e1 = i; … … 313 302 */ 314 303 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); 317 306 String sibling_name = sibling.getAttribute("name"); 318 307 if(sibling_name.equals(name)) { … … 363 352 */ 364 353 public Element getElement(int index) { 365 return (Element)elements. item(index);354 return (Element)elements.get(index); 366 355 } 367 356 /** 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. … … 382 371 } 383 372 ///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); 386 375 ///ystem.err.println("Compare to: " + element.getAttribute("name")); 387 376 if(element.getAttribute("name").equals(name)) { … … 394 383 public Element getElement(Element parent_element, String name) { 395 384 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); 399 388 if(element.getAttribute("name").equals(name) && element.getParentNode() == parent_element) { 400 389 elements = null; … … 408 397 * @return A <strong>NodeList</strong> containing all of this sets elements. 409 398 */ 410 public NodeList getElements() {399 public ArrayList getElements() { 411 400 return elements; 412 401 } … … 417 406 // public Vector getElementsSorted() { 418 407 // 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))); 421 410 // } 422 411 // Collections.sort(elements_list, MSMUtils.METADATA_COMPARATOR); … … 504 493 root.removeAttribute(name); 505 494 } 495 506 496 /** Method to remove the given element from this metadata set. 507 497 * @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) { 510 501 // we need to remove the value tree too!! 511 502 //System.err.println("removeElement in MetadataSet: element is: " + element); //Debug … … 514 505 ElementWrapper element_wrapped = new ElementWrapper(element); 515 506 removeValueTree(element_wrapped); 516 if(element_wrapped.isSubelement()) 507 508 if(parent == null) 517 509 { 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; 522 511 } 523 else524 {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 528 517 } catch(Exception DOMException) { //The element does not exist!! 529 518 System.err.println("Exception: '"+ DOMException + "' occured. Cannot remove element because it does not exist."); … … 606 595 */ 607 596 public int size() { 608 return elements. getLength();597 return elements.size(); 609 598 } 610 599 /** Method to translate this class into a meaningful string, which in this case is the metadata sets name. … … 693 682 694 683 if(this.document != null) { 695 this.elements = document.getElementsByTagName("Element");696 684 this.root = document.getDocumentElement(); 685 this.elements = XMLTools.getChildElementsByTagName(root, "Element"); 697 686 // 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)); 700 689 File value_file = new File(file.getParentFile(), value_element.getName() + ".mdv"); 701 690 ///ystem.err.println("Searching for " + value_file.getAbsolutePath()); -
trunk/gli/src/org/greenstone/gatherer/gems/MetadataSetManager.java
r8930 r8932 120 120 if(current_set != null) 121 121 { 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 } 130 128 else 131 129 { 132 System.err.println("No such set " + current_set); 130 //This should not happen. 131 System.err.println("Error: no such set \'" + current_set + "\'"); 133 132 } 134 133 } … … 201 200 || (mds.getNamespace().equals(Utility.EXTRACTED_METADATA_NAMESPACE) && (Configuration.get("general.view_extracted_metadata", Configuration.COLLECTION_SPECIFIC) || force_extracted)) 202 201 || (mds.getNamespace().equals(Utility.EXTRACTED_METADATA_NAMESPACE) && mds.getNamespace().equals(HIDDEN) && all)) { 203 NodeList set_elements = mds.getElements();202 ArrayList set_elements = mds.getElements(); 204 203 ///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); 207 206 ElementWrapper element = new ElementWrapper(raw_element); 208 207 // For now we do not add subfield elements and their parents, just the subfields. … … 429 428 Method to remove an element or subelement from a metadata set 430 429 @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.) 432 431 @return void 433 432 Modified by Matthew Whyte 19/01/04 … … 439 438 MetadataSet set = (MetadataSet) mds_hashtable.get(namespace); 440 439 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 } 444 449 } 445 450 else { … … 458 463 public void renameElement(ElementWrapper oldElement, String newName) 459 464 { 465 GEMSNode node = null; 466 460 467 //Retrive the metadata set this element belongs to. 461 468 String namespace = oldElement.getNamespace();
Note:
See TracChangeset
for help on using the changeset viewer.