src/0000755000175000017500000000000012644165244011527 5ustar mathieumathieusrc/doc/0000755000175000017500000000000012644165236012275 5ustar mathieumathieusrc/doc/manpage.xml0000644000175000017500000005061112644165236014432 0ustar mathieumathieu Michael Fuchs Software Engineer herold herold 1 User Commands herold HTML to DocBook converter herold OPTIONS Description The reuse of HTML content in presentation-neutral form is a frequent problem. One possible solution is to convert HTML to DocBook XML, because DocBook is a semantic markup language for documentation, which enables its users to create document content that captures the logical structure of the content. The command line tool herold can be used to convert HTML to DocBook. Because HTML elements are often used not as intended, the possibilities for such a transformation are somewhat limited. herold is part of the dbdoclet suite of tools. For more information visit http://www.dbdoclet.org. Options --docbook-add-index, -x Automatically add an index element at the end of the document. --docbook-decompose-tables, -T Decomposes the tables from the HTML code into single paragraphs. This can be useful, if a document contains a lot of tables for formatting reasons. --docbook-encoding, -d Specifies the encoding of the generated DocBook XML files. --docbook-root-element, -r The root element of the document. Possible values are: book, article, reference, part, chapter or section. The default value for this option is 'article' --docbook-title, -t The title for the resulting document. --in, -i Specifies the HTML input file. --help, -h Prints a help page on the console. --html-encoding, -s Specifies the encoding of the HTML source files, such as ISO-8859-1. --out, -o Specifies the DocBook XML destination file. --profile, -p A profile file with predefined settings. --verbose, v Enables the verbosity for the console output. --version, -V Displays the version of herold. Configuration The details of a transformation are controlled by a profile file. A profile file offers more possibilities to influence the transformation than the command line arguments. The following example shows a typical profile file. transformation html2docbook; section section-detection { attribute-class = ["^MsoHeading(\d+)$"]; section-numbering-pattern = "((\d+\.)+)?\d*\.?\p{Z}*"; } section list-detection { itemized-attribute-class = ["^MsoListBullet(\w*)$", "Aufzhlung(\w+)$]; itemized-strip-prefix = [ "-", "o", "\u00b7" ]; ordered-attribute-class = ["^MsoListNumbered(\w*)$"]; ordered-strip-prefix = [ "\d+\.\s+" ]; } section HTML { encoding = "windows-1252"; exclude = [ "//p[starts-with(@class, 'MsoToc')]", "" ]; } section DocBook { abstract = """<title>Lorem ipsum</title> <para>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.sed, dolor amet.</para>"""; add-index = true; author-email = "me@somewhere.de"; author-firstname = "Michael"; author-surname = "Fuchs"; chunk-elements = [ "chapter", "section", "appendix" ]; // Syntax: chunk-<CHUNK-ELEMENT>-depth = <INT>; chunk-section-depth = 3; collapse-protected-space = "true"; copyright-holder = "Ingenieurbüro Michael Fuchs"; copyright-year = "2015"; corporation = ""; create-condition-attribute = false; create-prolog = true; create-remap-attribute = false; create-xref-label = false; decompose-tables = false; detect-trapped-br = true; documentation-id = "doc01"; document-element = "book"; encoding = "UTF-8"; hyphenation-char = "soft-hyphen"; image-data-formats = [ "gif", "base64" ]; image-path = "./figures"; language = "de"; release-info = "Version 3.1"; table-style = "all"; title = "Tutorial"; title-normalize-space = true; use-absolute-image-path = false; } Syntax A profile file consists mainly of sections. Sections are used to group parameters which share the same context. Every section must start with the keyword section followed by the name of the section. After the name comes the block of parameters, which is surrounded by curly braces. Parameters can be of type String, Number, Boolean or Array. Strings must be framed with double quotes. If the String contains newlines, use three double quotes instead of one. Arrays are framed with square brackets. Inside an array, the elements must be comma separated. Every assignment must be finished by a semicolon. Multi line comments have the form /* my comment */ , single line comments look like // my comment\n. Mandatory Elements A profile for herold must start with the line transformation html2docbook;. Section HTML The section HTML defines parameters, which control the loading and parsing of the HTML input data. encoding The character set used to read the input stream. exclude Defines an array of xpath expressions. All matches are removed from the HTML DOM tree before transformation. Section DocBook abstract The text for the abstract element of the info section. If the text is structured with newlines, use three double quotes as delimiters. If the text starts with a "<" character, it is embedded into an abstract element, otherwise the text is embedded into an para element inside of an abstract element. The text will parsed and can contain DocBook elements. add-index If set to true, an index element is inserted at the end of the DocBook XML. author-email The email address of the author. If this parameter is set, it is used to create an info section at the beginning of the document. author-firstname The firstname of the author. If this parameter is set, it is used to create an info section at the beginning of the document. author-surname The surname of the author. If this parameter is set, it is used to create an info section at the beginning of the document. chunk-elements Defines an array of element names. If an element of this list is detected while writing the output, the element and all child nodes will be written to a separate file. This new file will be included into the parent file with an xi:include tag. Recursive structures result in recursive includes. You might want to use this, if you are transforming big HTML files and the resulting DocBook XML file becomes uncomfortable large. chunk-<CHUNK-ELEMENT>-depth Defines the depth for a chunk element, until the chunking should be executed, eg chunk-section-depth = 3. If an element defined for chunking is nested recursivley, you might want to control the depth to which the chunking should be done. The default depth is 1, which means only the topmost element is separated. create-xref-label if set to false, anchor elements doesn't get a xreflabel attribute. decompose-tables If set to true, tables structures will be ignored. The content of the table cells will be inserted into the DocBook XML as a sequence of paragraphs. This parameter can be useful if your HTML contains tables for formatting purposes. Normally you want to get rid of them, because they tamper the logical structure. document-element The document element you want to use. Must be one of article, book, part or reference. encoding The character set which will be used for writing the output file. image-data-formats An array of image formats. These formats will be inserted as imageobject elements, additionally to the format found in the src attribute of the corresponding img element. The original format is inserted twice with the roles "html" and "fo". The other formats are inserted as "html-<FORMAT>" and "fo-<FORMAT>". title The title of the resulting document. If this parameter is undefined, herold tries to dected the title from the head section of the HTML data. use-absolute-image-path If you want absolute image paths in the fileref attribute of the imagedata element, set this parameter to true. Section node The mapping of HTML elements to DocBook element can be fine tuned by using node sections. If you have HTML code which looks like the following fragment: <ol class="procedure"> <li>Step 1</li> <li>Step 2</li> <li>Step 3</li> </ol> The resulting DocBook XML after the transformation would normally look like: <orderedlist> <listitem>Step 1</listitem> <listitem>Step 2</listitem> <listitem>Step 3</listitem> </orderlist> But what you would like to have is something like: <procedure> <step>Step 1</step> <step>Step 2</step> <step>Step 3</step> </procedure> To achieve this, you can use the following rules in our profile: node "//ol[@class='procedure']" { map-to = "procedure"; } node "//ol[@class='procedure']/li" { map-to = "step"; } After the keyword node follows a xpath expression which is matched against the document element of the HTML file (typically <html>). The parameter map-to defines the DocBook element, which is used instead of the default mapping element. Section attribute An attribute section is more or less the same as a node section. Instead of redefining the mapping of a HTML element to a DocBook element, the mapping for an attribute is changed. The following section maps an attribute class='procedure' to role='procedure'. attribute "//@class[contains(., 'procedure')]" { map-to = "role"; } Section section-detection The section section-detection is used to detect section elements in HTML code and to strip off any numbering prefix from the titles. Many authoring tools allow deeply nested sections. While exporting HTML, it happens, that the nesting becomes deeper than six levels. HTML provides header elements for up to six levels, h1-h6, but no h7 or even more. At this point, the formatting is normally done with the help of CSS and div or p elements. herold is able to detect the header element of HTML, but it can not know about the export format of a specific tool. To solve this problem even for some cases, you can specify the parameter attribute-class. It consists of a list of regular expressions, which are matched against the class attribute of each HTML element. If a match is found, the element is considered as a section element. The regular expression can have group, which is interpreted as level indicator. The group must be the first group and it must match against a number, e.g. ^heading(\d+)$. If the level can not be detected, a level of seven is assumed. Because DocBook XSL stylesheets take care of the section numbering while transforming the DocBook XML to a specific output, it is often necessary to strip the numbering already defined in the HTML page. Otherwise you end up with two numbering texts in front of your titles. To help herold with the detection of numbering patterns, use the parameter section-numbering-pattern. attribute-class A regular expression, which is applied to every p and div element. If the expression matches, the current element is handled as a section element. If the regular expression has groups, the first group will be used as nesting level, otherwise level seven is assumed. section-numbering-pattern Normally you want to get rid of the section numbering that comes with the HTML data, because it becomes part of the title text in DocBook. The section numbers will the appear twice in your target media. One from HTML and one from the DocBook XSL processing. The parameter section-numbering-pattern defines a regular expression, which is matched against the beginning of every section title. If it matches, the matching part is removed. Section list-detection Sometimes lists are not represented with ul, ol or dl tags, but they are represented as p tags with additional css formatting. If you use a tool, which creates or exports HTML with such a construct, the conversion will end up with para elements, instead of the corresponding list elements in DocBook. To recreate the lists in some cases, you can use the section list-detection. The parameters itemized-attribute-class and ordered-attribute-class let you define lists of regular expression, which should match against the class attribute of listitem elements in the HTML. herold tries to rebuild the proper list structure from this information, even for nested lists. Copyright Copyright 2001-2015 Michael Fuchs. License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. src/profiles/0000755000175000017500000000000012644165236013353 5ustar mathieumathieusrc/profiles/section.her0000644000175000017500000000030512644165236015515 0ustar mathieumathieutransformation html2docbook; section HTML { encoding = "UTF-8"; section-numbering-pattern = "((\d+\.)+)?\d*\.?\p{Z}*"; } section DocBook { document-element = "section"; encoding = "UTF-8"; } src/profiles/word.her0000644000175000017500000000125312644165236015027 0ustar mathieumathieutransformation html2docbook; /** * Transformation of HTML exported from Winword 2003 as filtered HTML. */ section section-detection { attribute-class = ["^MsoHeading(\d+)$"]; section-numbering-pattern = "((\d+\.)+)?\d*\.?\p{Z}*"; } section list-detection { itemized-attribute-class = ["^MsoListBullet(\w*)$"]; itemized-strip-prefix = [ "-", "\u00b7" ]; ordered-attribute-class = ["^MsoListNumbered(\w*)$"]; ordered-strip-prefix = [ "\d+\.\s+" ]; } section HTML { encoding = "windows-1252"; exclude = [ "//p[starts-with(@class, 'MsoToc')]" ]; } section DocBook { encoding = "UTF-8"; collapse-protected-space = true; chunk-elements = [ "chapter", "appendix" ]; } src/profiles/article.her0000644000175000017500000000030512644165236015474 0ustar mathieumathieutransformation html2docbook; section HTML { encoding = "UTF-8"; section-numbering-pattern = "((\d+\.)+)?\d*\.?\p{Z}*"; } section DocBook { document-element = "article"; encoding = "UTF-8"; } src/profiles/paragraph.her0000644000175000017500000000030212644165236016013 0ustar mathieumathieutransformation html2docbook; section HTML { encoding = "UTF-8"; section-numbering-pattern = "((\d+\.)+)?\d*\.?\p{Z}*"; } section DocBook { document-element = "para"; encoding = "UTF-8"; } src/profiles/reference.her0000644000175000017500000000030712644165236016011 0ustar mathieumathieutransformation html2docbook; section HTML { encoding = "UTF-8"; section-numbering-pattern = "((\d+\.)+)?\d*\.?\p{Z}*"; } section DocBook { document-element = "reference"; encoding = "UTF-8"; } src/profiles/part.her0000644000175000017500000000030212644165236015014 0ustar mathieumathieutransformation html2docbook; section HTML { encoding = "UTF-8"; section-numbering-pattern = "((\d+\.)+)?\d*\.?\p{Z}*"; } section DocBook { document-element = "part"; encoding = "UTF-8"; } src/profiles/default.her0000644000175000017500000000032712644165236015501 0ustar mathieumathieutransformation html2docbook; section HTML { encoding = "UTF-8"; section-numbering-pattern = "((\d+\.)+)?\d*\.?\p{Z}*"; } section DocBook { encoding = "UTF-8"; add-index = true; emphasis-role-bold = "bold"; } src/profiles/chapter.her0000644000175000017500000000030512644165236015477 0ustar mathieumathieutransformation html2docbook; section HTML { encoding = "UTF-8"; section-numbering-pattern = "((\d+\.)+)?\d*\.?\p{Z}*"; } section DocBook { document-element = "chapter"; encoding = "UTF-8"; } src/profiles/book.her0000644000175000017500000000032512644165236015005 0ustar mathieumathieutransformation html2docbook; section HTML { encoding = "UTF-8"; section-numbering-pattern = "((\d+\.)+)?\d*\.?\p{Z}*"; } section DocBook { document-element = "book"; encoding = "UTF-8"; add-index = true; } src/icons/0000755000175000017500000000000012644165236012643 5ustar mathieumathieusrc/icons/48x48/0000755000175000017500000000000012644165236013442 5ustar mathieumathieusrc/icons/48x48/herold.ico0000644000175000017500000002170612644165236015421 0ustar mathieumathieuhF v 00( @"s‚YGrhE);<Ť:SAvڣQXPu/h~8ZOlEyI>)GvUƇ7GQS2̜ZbqtYeEb'{EđV$geΦ3M{J4ԛTƍ`HGȊRo{YEj`Nqo>ϙTɑXKQ#vKy<C#i 8IE$h٢QӚTDI4|ZGP HHEcGqKz9'L ?HB @L 2J &!#403+*46$;/ 8(GF. :K1IO5%"MD<>5N7P- ,)ECA=????????(0"sW?YȎ®o5lCHI}{<٬uGXu5FvFo^4]Vw֞Sl{(9*qőmܽ[zc>xXI0:~^P`i΢E]F]cKqMM]Vvb͜ʒV#{ӹm$d\htYUB ɼ5zG/dYI<{4ESŃKzPZfw[Rl5'rWh[WŗEb xaїU!|ݧO%lMtŇYL6IP^0;|7yY+iHB٣QȌXASV~ZEj#xIv!#h=I1I8Ef6( WΖU͒W֞VƒYI5z[9C$iGOGq$f:?~YEaKuE` }RĄ$g՝SҘU:јVBD}YJ1xYHCHHGpL{ݧN$f$hڣQ٢Q֝SCEјUňY‚YI1tYI6I=HHGPEaEgEkGpLzEm} m}}m}}~fm}}_m}}i6u v`z-  |:Y*h7S:ex(@O\Jd.s/ =C!A;5TVaL%&Zw>")cB{p$^#yNHcB<jrI9 q?Glr'[2X1lQK3g+MlFPD4Rt]8oUnb,k0W??( @"rƒY?\ʒʢQlFGOEQƫD΢NfCBK`ElhHU#iSÏ[ܼɑXKyVăѠT`I2I>JH-~Yʢ ?ΒVAx!ܦOE_'t֞RM8HIņY&g(TЖUFRc͞e"1:Mb4[NwRĀEhId#yBuY,I0KSuZȐ%q>ʎWFoEI;$kʼnYIwM{WNj@|Y:u$g%5GSFaJr #k$e%i<D̑VȎXYI3H@HFI5 }!#hןSgwYtYFmQt!$h"s$fڣQ%h+ԛTԚU28їU699AˑWFzYrZI<IEHJE`EiGpJxLzN~O!$d٣QןRЖV?7ʨ777 777 777777Bs˝777ʨ777QS kP79q$K; qgRUI46q^6ؽ]8/HWZo:nb_dmG`i<}_A3(#X |b[F"L)c+*b>&ae҄C,Tb2 eе5~-N=O e5χDxNl% 5uxNw! tVxN'z@vxNæhYMrĤ10.{j?߿fp➶E괋 J\yז?0?(0` "sƒY?^˖ƹtZoCKObP۴:?y*kȡu{xDY>ڤPIvF,̦sZC~am5}gZ/é;Pm~PWfU;cmoB_"P'xHkt=˗sV_l[0qYִcR;sG?{7nFbϔPVńKUΡ%c9~81j/JD#Gœ^cz*`7sաagϣqյ";Rg/ssI2Z9IH/{``Xv֮ÇeI@R+̜ZDcM|X\ƠS.Uڼ|}V/lOmycORzYȎ^o;pwXElOa(7ԛTŐx;yʍX_HX%jʚ~FS>${|^-yƫ_BʡީND)|_bxY2hHHPÀuI//j4c͝bջ&rVЖUʼnZu_DaN2'|\5oެGiB~YE^ZǗI:OAMԤPB?L{pXxZ *9hMeGp%o3^\L[GSF]:~:u>}$g7E#ןR._x^EgOrTň%vKtY!}5fƇX}\&AHF]GN?ȎZHD`̑W\ʓWŋ"wF111111111J :dJiT ]4d˾먨?Үh =먨q\Nx=먨~[=먨'mk#=먨9sFb먨>p ؼWW(E7?WVf$웠Ot妱VCLa6{ Az~Ve).r2-@jj<~&^UQ0jjjjj}B~ªujjjjjG5*"yujjjjGc_ۖujjjGIIZ/ujjIIHuujjԍIێuunXԍIII!, ӇԍIImRلMԍII+;ӇKoԍIIIKv8ߗԍԫ|3l֗ߗ3SwѺ̫֗``1V֗P``1VVPPP``1VPPYΉȜg%D%P??src/conf/0000755000175000017500000000000012644165236012455 5ustar mathieumathieusrc/conf/config.properties0000644000175000017500000000773712644165236016056 0ustar mathieumathieu# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. # # Framework config properties. # # To override the packages the framework exports by default from the # class path, set this variable. #org.osgi.framework.system.packages= # To append packages to the default set of exported system packages, # set this value. #org.osgi.framework.system.packages.extra= # The following property makes specified packages from the class path # available to all bundles. You should avoid using this property. #org.osgi.framework.bootdelegation=sun.*,com.sun.* # Felix tries to guess when to implicitly boot delegate in certain # situations to ease integration without outside code. This feature # is enabled by default, uncomment the following line to disable it. #felix.bootdelegation.implicit=false # The following property explicitly specifies the location of the bundle # cache, which defaults to "felix-cache" in the current working directory. # If this value is not absolute, then the felix.cache.rootdir controls # how the absolute location is calculated. (See next property) #org.osgi.framework.storage=${felix.cache.rootdir}/felix-cache # The following property is used to convert a relative bundle cache # location into an absolute one by specifying the root to prepend to # the relative cache path. The default for this property is the # current working directory. #felix.cache.rootdir=${user.dir} # The following property controls whether the bundle cache is flushed # the first time the framework is initialized. Possible values are # "none" and "onFirstInit"; the default is "none". #org.osgi.framework.storage.clean=onFirstInit # The following property determines which actions are performed when # processing the auto-deploy directory. It is a comma-delimited list of # the following values: 'install', 'start', 'update', and 'uninstall'. # An undefined or blank value is equivalent to disabling auto-deploy # processing. felix.auto.deploy.action=install,start # The following property specifies the directory to use as the bundle # auto-deploy directory; the default is 'bundle' in the working directory. #felix.auto.deploy.dir=bundle # The following property is a space-delimited list of bundle URLs # to install when the framework starts. The ending numerical component # is the target start level. Any number of these properties may be # specified for different start levels. #felix.auto.install.1= # The following property is a space-delimited list of bundle URLs # to install and start when the framework starts. The ending numerical # component is the target start level. Any number of these properties # may be specified for different start levels. #felix.auto.start.1= felix.log.level=1 # Sets the initial start level of the framework upon startup. #org.osgi.framework.startlevel.beginning=1 # Sets the start level of newly installed bundles. #felix.startlevel.bundle=1 # Felix installs a stream and content handler factories by default, # uncomment the following line to not install them. #felix.service.urlhandlers=false # The launcher registers a shutdown hook to cleanly stop the framework # by default, uncomment the following line to disable it. #felix.shutdown.hook=false # # Bundle config properties. # org.osgi.service.http.port=8080 obr.repository.url=http://felix.apache.org/obr/releases.xml src/conf/log4j.properties0000644000175000017500000000055712644165236015621 0ustar mathieumathieulog4j.rootLogger=ERROR, console log4j.appender.console=org.apache.log4j.ConsoleAppender log4j.appender.console.layout=org.apache.log4j.PatternLayout log4j.appender.console.layout.ConversionPattern=[%-5p] %m%n log4j.logger.org.dbdoclet.herold=WARN log4j.logger.org.dbdoclet.trafo.html.parser=WARN log4j.logger.org.dbdoclet.trafo.html.docbook.DocBookTransformer=WARN src/build.xml0000644000175000017500000000150112644165236013346 0ustar mathieumathieu src/java/0000755000175000017500000000000012644165236012451 5ustar mathieumathieusrc/java/fonts/0000755000175000017500000000000012644165236013602 5ustar mathieumathieusrc/java/fonts/Euterpe.ttf0000644000175000017500000014326012644165236015740 0ustar mathieumathieupFFTMI{~ƔGDEFPHGPOSS3ŤGSUBHGØ OS/2-xVcmapp~$ gaspHglyf=n vheadcB6hhea 4$hmtxVYPlocaon*maxpvrX nameL,a6posta Y_< Ġ_Ġ_xC ^ ^CRx@33f@PfEd@ ff ^M   |xx2H H R z  8P88T8PdKUFbZN[[eTTmT[ K$TLLXbzz`@@@@@@@```///2 LL      l;___,^fnMMMMMMMMMMMMMMMMMMMMMT37xxx88,,vvlxx^Xxu jjLnm51@@)ke $ 44"..MMMM]]]]GgEgm,, "  &o!%(3BJQU]_bei &m%(2BJPU\_aeiٗ     &m&o!%%&(('23(BB*JJ+PQ,UU.\]/__1ab2ee4ii5&6)] l<^.FZ,t  < | 0 R  R < D V D8n@NbvvFV~ BZ4\ ^ .DLh:\"VVLF\n, !!!(!:!F!Z!h!|!!!!!!"":"b"v"v"""##<#T##$L$%|%%%%%%&&2&D&p&''("("("("("("("("("(4(F(T(b(t((()N))**$*X*v**++b++,N,,,--R-..f.//6/Z////020r0011*1D1T11112334455:5556686N6\6v6667J77777778868h8889 9<9v999999::0:N:t:::;;@;h(ak!!.5467#".5477232.'7>54&#"327#"&'654&#"32654'>54&#"'&54632R-' "'@9&*/4D?<IC1$7 (50g)%,. C+"''OL2C3#,2 mH!0K)nTU0e4/W.!Hd=]B3ON$eN$:IR/qjj&B<#)+'?HV3rsW3Tf3^(}A)ZD 3>32>54#"F%%@*B@*962"&( \CIYI2@G'D D/ 3%#75F6F(W)t-D8#5755737377#'75TFFFFFFdFFFFFFddd] ?f 6~x#g3267654#"32>7654#"#"'3!536#"#"'3!536#"'>32>32>32>3226.fG$o25,3-H$W 0Ab;J24}jJ%0Ab;I33|jP'855VCM &^QF3I>*@%&Oki9n/"&O/cDi9n/S&SaUG*6??%jc/X[C*6??%wpDqQ-A&TGOLA&$?NxOu32>7654#"#"'3!536#"#"'3!536#"#"'3!536#"'>32>32>32>32>32>32%32>7654#"3267654#"25,3-H$W 0Ab;J24}j91@`8J24}jJ%0Ab;I33|jP'855VCM &^QF3I>t!#ZJF3I>*@%@25,3-H$26.fG$&O/cDi9n/S&SaUG*6??%ID(Q]PC&6??%jc/X[C*6??%wpDqQ-A&TGOLA&@?A&$?N&O/cDi9n/"&Oki9n/v #"&54632#"32>767#53>32#"&5463254&#"!>32#"&54632654&#"3# #"&54632#"32>7675uUC<'"23.C&$ %cB?Y<'"2&!!4'/&cC>Z='"1 "4& 5uVB<4-D&# A 3>;M#%jnWW?us99:M#& 4eoPus99:M#& 4eoP?3>;M#%jnWW #"&54632#"32>767! #"&54632#"32>767! #"&54632#"32>767#53>32#"&5463254&#"!>32#"&54632654&#"!>32#"&5463254&#"3l5uUC<'"13.C&$ 5uVB<4-D&# 5uUC<'"23.C&$ %cB?Y<'"2&!!4'/&cC>Z='"1 "4& /%cB?Y<'"1'!!4'A3>;M#%jnWW3>;M#%jnWW 3>;M#%jnWW?us99:M#& 4eoPus99:M#& 4eoPus99:M#& 4eoP?_>ct"&76&#"#6&#"#6#"'>32632>323>7#"'3!536#"'>32>32%3267654#"6& T!&\j!&\cP'855V+?%25/fG$ F//"9 /"9%wpDqQ-AAAM?%woDqQ-&SaUG*6??% F+5A&$?N&Oki9n/<=|"3# #"&54632#"32>767#53>32#"&54632654&"&76&#"#6&#"#6#"'>32632>323>7"4& 5uVB<4-D&# &cC>Z='"1 6& T!&\j!&\cP'855V;M#%jnWW?us99:M#& 1F//"9 /"9%wpDqQ-AAAM?%woDqQ-=u"3# #"&54632#"32>767#53>32#"&54632654&4&#"#"&5463232654.54632#"&546!4& 5vUC='"12.D&# %cB?Y<!4#8,&:C:&tZr0 %:),:%8@8%qUf( 4eoP?3>;M#%jnWW?us99:M#& <$#10!/0Q2SQHC12# #3'%7 '(H0PYU< )f2654#"&54632#"&#"#5#"#7!632"3# #"&54632#"32>767#53>32#"&5463254&)"$,(.1/s*-9 N/# 2(l0(!4'5uUC<'"23.C&$ %cB?Y<'"2&!R )%%P;M#%jnWW?us99:M#& *h2654#"&54632#".#"#5#"#7!632"3# #"&54632#"32>767#53>32#"&54632654&4&#"#"&5463232654.54632#"&546]*#$,(/0/=B"-:N/$ 1(k/)!4& 5vUC='"12.D&# %cB?Y<!4#8,&:C:&tZr0 %:),:%8@8%qUf( R )%%P<()"[ 4eoP?3>;M#%jnWW?us99:M#& <$#10!/0Q2SQHC12# #3'%7 '(H0PYU<   3!3#!F FFdJ(f'>'6&>8dQf;CK6!".54>32&54632#"&'&32654&#"32>&462"462"F xبcpVgщZugo; 8zp|ٓMkQ<;S::S;;S::S#+\ms ӨTbbFW# _i(LUR;;R;R;;R;Q@'&QQf'&%-0!!73#32+32654&#324##'##33'HPP<5R-FBGPP;;Z(([Pe{>PKFV8I$NBRP| $̈ssϱf/##3!4632#"&"!!2632#"&5!PP rn3JA-1<Z<1-AJ3nrfff:rR4*6>4F"bb"F4>6*4Rr: @ 462"###!#462" # n:S;;Spqyp;R;;R!qCR;;R;FFFR;;R;@F P35#!7 F&7 (  &ڵ$EE$  %' 7 (  ( x$EE$FFEE: #!#!#!:dNFNdrXJ^ w !3! !3! FppF w-K.^ *72654'>54&" 5467.5462(132>54#"3%#75F%%@*B@*962"&F6F( \CIYI2@G'D W)t-8'+#5755737377#'753%#75 FFFFFFdFFFFFFdddF6F] ?f 6~W)t-#57557377TFFFFFFPPP] ? N#'+#575573737377##7'7TFFFFFFdFdFFFFFFdFdddd] ?R f 6 Jd D #.546323.#"DF@B*@%%FF &"269*(YIC\u@ D'G@2 '33>32>54#"#.546323.#"F%%@*B@*962"&F@B*@%%FF &"269*( \CIYI2@G'D YIC\u@ D'G@2P/$2>4."2".4>rZ<+  +,DlgiiglD,,DlgiiglDUŻUUŻa/)"&5432>546&'&'&'&?632328A"2  'Z *, 2"A *   2 ! O * T5#!2#"&'.5463232654.#!26767632p(4 N6PW`F?= /CeJNw59",5Ċsf3-'#:*+0.ƬCzN2&& P!<2>54.7>54&" 467.54>2q0VmmV0,Fcc0xf3.J5h,C?'v̷v%FP8_T{G""G{T)PB@10viss$>.)9At}j>(;Gc=^NN^CjI0d4"&'&#"32>32#".54>3232>32[ FI}T<8rHAj2$,K}ErS*[|g*Q  # ? FDnAKq*1* 7@0}j54&#"'!2#!".54>7>76'.546l")#PZ?@&G0ZgSF'   0%%AhA& !@\[ /  F K.54>3232>32#"&'&#"#"'.#"#"?>3232654.>=6^y8&;  #  F==IQ:=AQ  # %   %ag@e'L/4GJ7Dg. .? FK69i8(2JW9}. &9%!dCDR8Z462"Z3H33HBH44H4[/"32>7676&".54>323>7#"/M- > T=3L;7>32>32#"&'654#"#"3267654&#">aY ;)TP1HtFps $ 2/w"(]3 Co`.jy`@_N $(}k72+e<"3# #"&54632#"32>767#53>32#"&5463254&G!4'5uUC<'"23.C&$ %cB?Y<'"2&!4eoP? 3>;M#%jnWW?us99:M#& T >"&76&#"#6&#"#6#"'>32632>323>76& T!&\j!&\cP'855V7#"&76&#"#6#"'>32>1h JO&855V<6& T#EO \cP'855V32>32%32>7654#" 0Ab;J24}jP'846U=F3I>*@%25,3-H$&SaUG*6??%wpDqQ-A&$?N&O/cDi9n/TJ#2>32#"&5463254&#"#6&#"'6+/2O.1/(,$#*Pce %0Q6I5X9f&>8d^462"462";R;;R;;R;;RCR;;R;R;;R;RPd.54>3232632#"&'&#"#"&'.#"#"?>3232654.32>54&#"'!2#!".54>7>76'.546462"$462"<1567T\)&;  3   F<>IQ.4=@y  3 $   $agAe+@P")#PZ?@&G0ZgSF'    0%$3G44Gy3H33H%,83C,4V3 (. ? FK69i8 '<7L.} (. &9%!dC4F00AhA& !@\[ /  `H44H44H44H4R9Av~32>54&#"'!2#!".54>7>76'.546462""&'&#"32>32#".54>3232>32462"")#PZ?@&G0ZgSF'    0%$3G44G FI}T<8rHAj2$,K}ErS*[|g*Q  # /3H33HAhA& !@\[ /  `H44H4 ? FDnAKq*1* 7@0}j->IR+47UU8#xK*-< '=->IR+QR;;R;R;;R; +DPsEq}8J.6.B3"9)# K+DPsEq}8J.6.B3"9)# )3=G33##5.'#53>73#>5#34.PJ}T33T}JPJ}T33T}J)  )j)  ) R|RPR|R R|RPR|R I")?7O8)9w)8O7?)"")?7O8))8O7?)"$ #$qF$462"462" #R;R;;R;;R;;R!qCR;;R;R;;R;@F 462"#462" #":S;;Sp;R;;R!qCR;;R;FR;;R;@F f #4632#"&"&54>2&54&X;)*::*);}"!RɌR!"}*::*);;k oӟaao k] %4632#"&2>546".546X;)*::*);}K"!RɌR!"K});;)*::TP oӟaao Pb2#"&547>7"&5465AV 3-KDIbOES \M*=1< ###pqFF9'.54>54&'>54.54>76:#1J/@' (L;$%\LL\%$;L( '@/J1#:3 $./K-FFCN<,D@W2JzAS)g::g)SAzJ2W@D,32| (EWRRWE( Z50>LNV%f%VNL>05Z@J!!@J.U@!!!!@@..@ !!!!!!@@@...@ !!!!!!!!@@@@....@f !!!!!!!!!!@@@@@....f.9@- !!!!!!!!!!!!@@@@@@.f....f. #'+/37;?CGKOS35#35#535#535#%35#5#!35#35#!!35#535#535#5#5#5#35#535#535#35#535#535# 2F2&...6..(..(..  #'+/335#5#!35#!!35#535#535#5#5#5#35#535#535#2 >26..(..y*mz%.5467&'327.'>54&#"632#"&5463232>54'#"54>7&54>32'$54.#"#;B.h^5U~H6Q,0T[%=beF#,Ai@%P30 *!`F"3V9k*[l? J<F>aNe;ޠH0_is7d`q:4g\9V_\MBG.,-HL%BT~g?>uL_Έ(KK.9 M'&^TCy'&HTmf`d632#"&54632324&#"#"&'.'#3>7>323265#"#"&54632#"'#FN4Z2KpFM2;KLBBCY$:.  *'0,PP,0'*  .:$YCBBLK;2MFpK2Z43,=k^C'S;NE8T$,u//%[T[CfC[T[%//u,$T8EN;S'C^k=,f9Y=462"462""&54>32#"&547$54&#"632:S;;S::S;;STh(Vjgq>+K|À"Nlca=`;+!5R;;R;R;;R;ab?ob:=mW`lo]6,#2.9@'&QXY'&Xj###jFF7!! \<b 53353#3#5##535Ȟ &2>54#"3>323>32#5>54#"*962"&fF%%@*)F%%@*B@FI@*962"&!2@G'D  A\CIYRiI2@G'D D#>32##6>54#"G"F%%@*B@FF"j*962"&Ǘ*f\CIY.*2@G'D D3&'33>32>54#"F"GG"FF%%@*B@*962"&**~\CIYI2@G'D D175%##676FF"GG".'K)t)**/753&'33%FF"GG"FF6.**)W)D'+#>7#77##575573775F) FFFFFFdFFFFFFddddI*8&"" 6] ?D8'+3.'3#5755737377'75F) FdFFFFFFdFFFFFddI*8&"" B] ?f ul9)575733#75377#5#557557#M~FF1##F111111F11111 2 bb bbC;s !>54#">32##5733'5=A#-.-pi11#TMY,R4/R @/3k?I*22,14>32#"&54632.#"32>?2#".1XSSM@@L7]@3K&'L86\.,$AuF[U+3GuIXjRR?6D )5@kn?2#"'#5.5467< SM@@L7]@6\.,$AuF 54&"#"5467.54632%"32674?6&#"546323267#"2#"&54?6&#"'6323267654&"&548CST;2MnL3*^?TQ?9;xMNx?m&2 ) ]tD#4% ' */M869 )5 *9 U/OJJOV:38AA8-! l94aLGDYYD?FFJ M  qE&;6 !8':e)[Q/   >) .:(! V!0\ft4>7>32>32#"&'654#""3267654#"'2#"&54?6&#"'6323267654&#"&542654'>54&"#"5467.5462 0 ,P"B+79F  M: $./#B*69 )5 +8  7DTT<2MnM/"W?TQ?::wx?#  fCF./&b{ >>0. fDF./   >* .:%$ U.OJJOT:48AA8(  l94bKHEXXE@FQa"&?6&#"#6&#"#76#"'>32632>323267>323267#"'#"'"32674?6&%+2#"'.543232654&#327632!"5432>56&'&'&'4?63232M) 2 .J4 2 .J1 & )")A $   n=$4% ' )  K-+  )@ &Eb:MH"84AV:)D!,  l   )" 7 7:7 !8' &+)Br&:6 !7'H""(;7M  " hJf)) "aTI% ?    U U)R!"&5432>54'&'"'4?63232+2#"'.543232654&#3267632"&?6&#"#6&#"#76#"'>32632>323>7654#"#"54>7>32>32#"'73267654&#" , l  0'\IL #74AW; * 2 .J5 2 .J1 ' )"+@   $ %8  0 ,P"B+\!: .    U   Nhmm) #bTH " 7 7;7 "7( '74  fDE.>>z =?2 !#3!53#(...`5#5!#..3!535(.._1"&#"#".54632.54>54.54632 R&%*4* IUAE5D0FbTTGG3 u($&"B*$)@`.Q]P$ t"`Q *'#"&54632>oHGn>EI:?;>2v!;!:_I?7RR7"1<+*'#"&54632>7#"&54632>7Gn>EI:?;>2 Vn=EH:!1 >1 H!:_I?7RR7"1_I?7R)."1!+= '#"&54632>7#"&54632>7#"&54632>7 Gn>EI:?;>2 Vn=EH:!1 >1 Un>EI:?;>2 !:_I?7RR7"1_I?7R)."1_I?7RR7"1ER '#"&54632>7#"&54632>7#"&54632>7#"&54632>7DGn>EI:?;>2 Vn=EH:!1 >1 Un>EI:?;>2 Vn>FI; 1>1 q!:_I?7RR7"1_I?7R)."1_I?7RR7"1_I?7R)."1te '#"&54632>7#"&54632>7#"&54632>7#"&54632>7#"&54632>7Gn>EI:?;>2 Vn=EH:!1 >1 Un>EI:?;>2 Vn>FI; 1>1 Un>EI:?;>2 q!:_I?7RR7"1_I?7R)."1_I?7RR7"1_I?7R)."1_I?7RR7"1 77''7//////// %#53533##FFFF 6462"764''7&"7'2ɂV}VV'^NV}VV'^'^'V}VVB'^'V}VV%!!!0FF0D3!D%3'5!4&'74>7.%0-4%%4-0i%0-4%%4-0fX;,;\\;,;fX;,;\\;,; 2#"5462>4&#"0یI=aA)=aA)}}CZW*CZW* 2#"5460ی}}J%!!!0FFJJ3!J /"32654&%#!###5#".'#3>325/DPK/DM0040 Ys9Wk?00 Ys9Wk?v?3Sk?3Uin  3O',P: 3O',P:k "32654&'2#".54>/DPK/DMx_n7Y|>_n7Y|v?3Sk?3UiF6bG;^.6bG;^.f %2>4&#"3#"54632Z=aA)=aA)Fیڍc8CCZW*CZW*#}}f 3#"54632Fیڍc8f}}f(3&7>54.'#"54632FCR^WG+Qg 7 5+&?LQF7 یڍc8fJlicfyAy*EEDS07\C<:=R0}}f)8#"546323&7>54.64.'یڍc8F @R^ZI,!!Mk7181IkoZ @WYc 4PaVD }}6aLKNUrAtF?ON  '5JY=H_2-L6\G54.'#"546323aj%'?NQF5 4PaVD AX[cLMk7353'?NQF5 یڍc8F @R^ZI,C{Po0#&5T90-0D*"3<]78/M0X7cOHWsBGhN  (/AD.5T90-0D*}}6aLKNUqAfB>Cn}3CSd&7>54.'#"546327'654.'654.'654.Mk7353'?NQF5 یڍc8F @R^ZI,F4PaVD AX[caj%'?NQF5 AY[c'?NQF5BGhN  (/AD.5T90-0D*}}6bKLNUqAgD>GfB>Cn "3<]78/M0X7cOHWC{Po0#&5T90-0D*0Y7cPGX)!-5T90-0D  0hy654.654.'654.'&7>54.'#"546323654. AY[c'?NQF5 aj%'?NQF5 4PaVD AX[cLMk7353'?NQF5 یڍc8F @R^ZI,8 AY[c'?NQF5Y7cPGX)!-5T90-0DC{Po0#&5T90-0D*"3<]78/M0X7cOHWsBGhN  (/AD.5T90-0D*}}6aLKNUqAhD>GgD>GfB>CnY7cPHX)"-5T90-0D'8f3F'?7'f737'#'77/F//F/////K %l"K%%llK %%%lll3%J%%g_ %%%v_zB&462"(;R;;RR;;R;8f&7>54.'CR^WG+Qg 7 5+&?LQF7 fJlicfyAy*EEDS07\C<:=R08-f,&7>54.'564.' @R^ZI,!!Mk7181IkoZ @WYc 4PaVD f6aLKNUrAtF?ON  '5JY=H_2-L96\G54.'5654.'5654.'F @R^ZI,Mk7434'?NQF5 AX[c4PaVD aj%'?NQF5 R6aLKNUqAfB>CnABGhN  ).AD.5T90-0D*7cOHW)"3<]78/M0C{Po0#&5T90-0D*#-}J[3&7>54.'5654.'5654.'654.F @R^ZI,Mk7434'?NQF5 AX[c4PaVD aj%'?NQF5 AY[c'?NQF5R+6bKLNUqAgD>GfB>CnABGhN  ).AD.5T90-0D*7cOHW)"3<]78/M0C{Po0#&5T90-0D*#SY7cPGX)!-5T90-0D- N_p3&7>54.'5654.'5654.'654.654.F @R^ZI,Mk7434'?NQF5 AX[c4PaVD aj%'?NQF5 AY[c'?NQF5 AY[c'?NQF5R[6aLKNUqAhD>GgD>GfB>CnABGhN  ).AD.5T90-0D*7cOHW)"3<]78/M0C{Po0#&5T90-0D*#Y7cPHX)"-5T90-0DY7cPGX)!-5T90-0D 5-0-{MdQ462"/B//BB//B/8!!HFxxk, 3Ma0-,  3462"M/B//Ba0-tB//B/ 462" 5-/B//B0-B//B/]M8Q !!6462"H/B//BHFB//B/ne%.54>54.54>54.54>54.54>54.'&54632#" $,$$,$$,$$,$$,$$,$$,$  *:(1(&&)0)&&)0)&&)0) !4-4 )3*F'4 )3*F'4 )3*F'4 )   .&!>'.0&!?'.0&!?'.0&!?'. n`3.54>54.54>54.54>54.54>54&'&546323;D$,$$,$$,$$,$$,$$,$$,$( (:(1(&&)0)&&)0)&&)0)qR3)4 )3*F'4 )3*F'4 )3*F'4 )/ .&!>'.0&!?'.0&!?'.0&!?'.2>7#"&'7^te38?[|BQhZ9k75KbG %(^i\*A)"'>32.k9ZhQ|*83et#)A*.^% GbK5|3F#<]l8"232>32#".#"#"&5460# $&  -&2%#) ^##  +8&' X#"'&53 5a:~AnF z #j8^^6xQ462"$462""&'7267Z/B//B/B//B.F*AC(FB//B//B//B/vH,;QQ;,HxQ#462"6462"$462""&'7267/B//B/B//B/B//BF*AC(FB//B//B//B//B//B/vH,;QQ;,H#2>32#"&5463254&#"#6&#"'6u+/2O.1/(,$#*Pce %0Q6I532>32%3267654#"v 0Ac;I33|jP'855V+?%26.fG$&SaUG*6??%wpDqQ-A&$?N&Oki9n/ >"&76&#"#6&#"#6#"'>32632>323>76& T!&\j!&\cP'855V767#53>32#"&5463254&m!4'5uUC<'"23.C&$ %cB?Y<'"2&!4eoP? 3>;M#%jnWW?us99:M#&   ( x$EE$' 7 ( xFEE .237&7>54.'#"54632'?&'01L>]#_CD9H'  "%zbcD)u#1SELyG]#^KtJ[yT  ,&))2/$" y>WwhWx=u#1R9B %3&7>54.'#"5463201MYU89H' 2JM@ bcD)Fa`r>[yT  ,&))24S96K-+WwhWx =GO#6&#"#"&?#"546327>32>32#"&5463254&#"&#"3232654cj A33"(M?M>%T7kW5=DTZQ{7 /2O.1/(,$#*P?4(4!;$ % q;u*F_qs c3:;-6'*I53232654&#"#"&54632Jg_g13L  >8H*IY,ATFAzXZGT(0O >8H*IY@b[vLllL?.D#2Dw8X5" 7Q`Q7?-D$2DwEf2vd=".54632#"&#"32>32#"&5463232>54&#")[b@YI*H8>  O0(TGZXzAFTA,YI*H8>  L31g_gv2fEwD2$D-?7Q`Q7 "5X8wD2#D.?LllL&D332654&#"#"&54632#"'#5.#"32632#"&54>32<F2;:0O >8H*IY@b[)jf<H/<<3L  >8H*IY,ATFldN66?-D$2DwEf2RP15?.D#2Dw8X5" MY;32654&54632#".54>54&#"#"&54632LllL?/C#3Cw7Y4# 7Q`Q7?-C%2DxEf2[Jg_g13L  >8H*IY,BSFAzXZGT(0O >8H*IY@b[@f463232>32#"&5s * +>g*01 G , ;?tH42"$#"&7>32 ']2LA2 c4%a9LG-4722676"$#"&7>32l (b3KB4']2LA2 (B$b9KH.%a9LG-f#>54'&?&73=C %?9<479\_>738Z6Jnd@;8m2'#"&57>54.#"&7>32m2HL4 ,,'6/ &%3H## .-/$XOjS)CBWz?YJ&%&9M% *J`F #U &I$'2#".#"32>32#"&54>L|S )_1#Ie$VmYttHe7f#'-#<|b=(j,4>54&#"3276#".54>32#"&k?9U&>H%g8;P|W>r\7?g{?<\3Q-# KxH&g4CC*9jgnk803M$".#"0#"&547>32!*N1G=X6e,hRop2:OA0!%,%)P6h/rR^4:KC z 32#".'&5463232>,hRop2:OA0! ,gTG=X6e/rR^4:KC \F)P6h.#"&54>763232>732Mn2- CC;)LL5Y,U=\lʭ}BN hd=4`/`;G#\x 3!!!#!dd>\[d[\x #3!!#,ddd>\d\R #!5!Rd\Jdf#46327#"''7&%32654'&#"iI5.E1EiI5.E1E.A=.A IiE1E.5IiE1E.g A.H A.) !#!FT:k;  3M 0-5264&"462"A\AA\iii\AA\AiiieA ^ 2654&'#57"&54673ccL:F:LVuČuVFFccF<] ] YbbY  4>32#"&'&5463232654.'327&54632327&5467&$'&546323#"&'#".'#".'#"&54>7>54.5467"#"32>7632#"&462"654&#"32>54*\n|30!P$ =a'AO,lnnUD;]4$L{L[o$`%Oi]dӽ  l%L' =%T,"fE49hheA$/  cq'=V==V2('8"8*+$6mFdZ:L" ] !u1$+K5& QT$10";PgJL4\@Q\@N|'t! NMzL1HC?L"A+4W,=P]w&cR?W ~/'lOG'A-! qV==V==S"+jR? ""4)G0,X4bG.g264&"7327654&547632#"&#"32>32#".#"32632#"'&54654'&#""&54>54&#"#"&547632327654&#"#"&463232654'&#"#"'&5463232654.5462AZ@@Z?U"'%.5^%&6 1 (/(1";@@;"2',( / 3'%]6.$($E##OtO##E#'$.7]%'4 0 (-'2":@@:"2'. ' 15'$]6.%'"T##OsP#"XZ@@Z@-( 0 4'%]7.$'#E##OtO##T"'%.6]$'51 ' .'3":@@:"2'. ' 15'$]6.%'"T##OtO##E#'$.7]%'4 0 (-(2":??:"3'^ w !! !5!OppOw-FKFl`2>3232654&5432#"&#"#"&#"#"&#"#"&#"#"54>3232>3232>32(! ;; 0 "& * ]:L + \9L + [:L + " *+) 1 (! ;; 0 )" <; 1;TS;",!$ 7 ed;&9d;&9d;&9 @3F! ;ST;;ST;v`32632#"#"54654#"#"&54654#"#"&54654#"#"&54654.#"5432;ST;",!$ 7 ed;&9d;&9d;&9 @3F! ;TS;;TS;(! ;; 0 "& * ]:L + \9L + [:L + " *+) 1 (! ;; 0 )" <; 14.2."'>."6 YO*4==4*OY5OftfO5L.Igf0,5>>5,0fg7533##;.'>7#5#\ 44 \F\ 44 \F?\ \??\ F \% \F\ 44 \F\ 4 \??\ \??\ ',16; 6& 6  7.'#53>7533##;.'>7#5#*b[ 44 [F[ 44 [F?\ \??\ F \*b \F\ 44 \F\ 4 \??\ \??\Zf 3!3#5!#!5FFFFFybyy54.'7ʻ޻FCR^WG+Qg 7 5+&?LQF7 #~~~޻JlicfyAy*EEDS07\C<:=R0)~~~f"'73&7>54.'ʻ޻FCR^WG+Qg 7 5+&?LQF7 ޻JlicfyAy*EEDS07\C<:=R0f#'6'73&7>54.'764.ʻ޻F @R^ZI,!!Mk7181IkoZ #~~~[ @WYc 4PaVD޻6aLKNUrAtF?ON  '5JY=H_2-L9H~~~6\G54.'64.ʻ޻F @R^ZI,!!Mk7181IkoZ @WYc 4PaVD޻6aLKNUrAtF?ON  '5JY=H_2-L9z6\G4&'+FFcccᶶ  O ̗ ̗ 462"632&"27#"/B//BǍE|/2OޝO2/|EB//B/=5/3OޝO3/5632&"27#"ǍE|/2OޝO2/|E5/3OޝO3/5#"'73264&#"'632Ǎd3MpoopM3dd3OޝO3d+;3&'67#5.67FxU2AZZA2UxFc; V3A A3V   ̗+;#5&'7'675>4&'ǁFwV3AYYA3VwFcc; V3A  A3V ̗ B77'777'''7''?7/%n/on/o&//&o/no/n%/Ä&&%/%o/nn/o%//%o/nn/o%/&&&&E!!#3&FE !!#3#!#&*&FP '%3F''8Kt#!#&F735#!&jY !!#!F&xK !!535#!&!T{o '/#!#C&F4  !)!!!KFp#7#!#.FFv&FeԵ^׳X\Hy$p!3!##.'#7DڸFeԵ2FFS*Hyt^׳XY}o535#!#!3!&FDFrK'p7#!#.'!3Fv&FeԵ2o׳X\HytP''35#!C&VFF7 2676"$'#&?3>32l (b3KB4UT2UB3(B$b9KH.*V9G0F 3>32#"$'#&7OUB3c UT2aG0*V9X1x   %$\5     # >8     "J 45Created by Ben Laenen (benlaenen@gmail.com) with FontForge 1.0 (http://fontforge.sf.net)Created by Ben Laenen (benlaenen@gmail.com) with FontForge 1.0 (http://fontforge.sf.net)EuterpeEuterpeMediumMediumFontForge : Euterpe : 14-7-2008FontForge : Euterpe : 14-7-2008EuterpeEuterpeVersion 1.1 Version 1.1 EuterpeEuterpeBen LaenenBen LaenenCopyright (c) 2008, Ben Laenen (benlaenen@gmail.com), with Reserved Font Name Euterpe. This Font Software is licensed under the SIL Open Font License, Version 1.1. This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL ----------------------------------------------------------- SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 ----------------------------------------------------------- PREAMBLE The goals of the Open Font License (OFL) are to stimulate worldwide development of collaborative font projects, to support the font creation efforts of academic and linguistic communities, and to provide a free and open framework in which fonts may be shared and improved in partnership with others. The OFL allows the licensed fonts to be used, studied, modified and redistributed freely as long as they are not sold by themselves. The fonts, including any derivative works, can be bundled, embedded, redistributed and/or sold with any software provided that any reserved names are not used by derivative works. The fonts and derivatives, however, cannot be released under any other type of license. The requirement for fonts to remain under this license does not apply to any document created using the fonts or their derivatives. DEFINITIONS "Font Software" refers to the set of files released by the Copyright Holder(s) under this license and clearly marked as such. This may include source files, build scripts and documentation. "Reserved Font Name" refers to any names specified as such after the copyright statement(s). "Original Version" refers to the collection of Font Software components as distributed by the Copyright Holder(s). "Modified Version" refers to any derivative made by adding to, deleting, or substituting -- in part or in whole -- any of the components of the Original Version, by changing formats or by porting the Font Software to a new environment. "Author" refers to any designer, engineer, programmer, technical writer or other person who contributed to the Font Software. PERMISSION & CONDITIONS Permission is hereby granted, free of charge, to any person obtaining a copy of the Font Software, to use, study, copy, merge, embed, modify, redistribute, and sell modified and unmodified copies of the Font Software, subject to the following conditions: 1) Neither the Font Software nor any of its individual components, in Original or Modified Versions, may be sold by itself. 2) Original or Modified Versions of the Font Software may be bundled, redistributed and/or sold with any software, provided that each copy contains the above copyright notice and this license. These can be included either as stand-alone text files, human-readable headers or in the appropriate machine-readable metadata fields within text or binary files as long as those fields can be easily viewed by the user. 3) No Modified Version of the Font Software may use the Reserved Font Name(s) unless explicit written permission is granted by the corresponding Copyright Holder. This restriction only applies to the primary font name as presented to the users. 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font Software shall not be used to promote, endorse or advertise any Modified Version, except to acknowledge the contribution(s) of the Copyright Holder(s) and the Author(s) or with their explicit written permission. 5) The Font Software, modified or unmodified, in part or in whole, must be distributed entirely under this license, and must not be distributed under any other license. The requirement for fonts to remain under this license does not apply to any document created using the Font Software. TERMINATION This license becomes null and void if any of the above conditions are not met. DISCLAIMER THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.Copyright (c) 2008, Ben Laenen (benlaenen@gmail.com), with Reserved Font Name Euterpe. This Font Software is licensed under the SIL Open Font License, Version 1.1. This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL ----------------------------------------------------------- SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 ----------------------------------------------------------- PREAMBLE The goals of the Open Font License (OFL) are to stimulate worldwide development of collaborative font projects, to support the font creation efforts of academic and linguistic communities, and to provide a free and open framework in which fonts may be shared and improved in partnership with others. The OFL allows the licensed fonts to be used, studied, modified and redistributed freely as long as they are not sold by themselves. The fonts, including any derivative works, can be bundled, embedded, redistributed and/or sold with any software provided that any reserved names are not used by derivative works. The fonts and derivatives, however, cannot be released under any other type of license. The requirement for fonts to remain under this license does not apply to any document created using the fonts or their derivatives. DEFINITIONS "Font Software" refers to the set of files released by the Copyright Holder(s) under this license and clearly marked as such. This may include source files, build scripts and documentation. "Reserved Font Name" refers to any names specified as such after the copyright statement(s). "Original Version" refers to the collection of Font Software components as distributed by the Copyright Holder(s). "Modified Version" refers to any derivative made by adding to, deleting, or substituting -- in part or in whole -- any of the components of the Original Version, by changing formats or by porting the Font Software to a new environment. "Author" refers to any designer, engineer, programmer, technical writer or other person who contributed to the Font Software. PERMISSION & CONDITIONS Permission is hereby granted, free of charge, to any person obtaining a copy of the Font Software, to use, study, copy, merge, embed, modify, redistribute, and sell modified and unmodified copies of the Font Software, subject to the following conditions: 1) Neither the Font Software nor any of its individual components, in Original or Modified Versions, may be sold by itself. 2) Original or Modified Versions of the Font Software may be bundled, redistributed and/or sold with any software, provided that each copy contains the above copyright notice and this license. These can be included either as stand-alone text files, human-readable headers or in the appropriate machine-readable metadata fields within text or binary files as long as those fields can be easily viewed by the user. 3) No Modified Version of the Font Software may use the Reserved Font Name(s) unless explicit written permission is granted by the corresponding Copyright Holder. This restriction only applies to the primary font name as presented to the users. 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font Software shall not be used to promote, endorse or advertise any Modified Version, except to acknowledge the contribution(s) of the Copyright Holder(s) and the Author(s) or with their explicit written permission. 5) The Font Software, modified or unmodified, in part or in whole, must be distributed entirely under this license, and must not be distributed under any other license. The requirement for fonts to remain under this license does not apply to any document created using the Font Software. TERMINATION This license becomes null and void if any of the above conditions are not met. DISCLAIMER THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.http://scripts.sil.org/oflhttp://scripts.sil.org/ofl2      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~     uni266Duni266Euni266F u1D18F_u1D18Fu1D18F_u1D18F_u1D18F u1D191_u1D191u1D191_u1D191_u1D191 u1D190_u1D18F u1D190_u1D191 u1D18D_u1D191 u1D191_u1D18Eu1D18D_u1D191_u1D18Emultiple_measure_rest u1D107_u1D106 u1D122.old u1D123.old u1D124.oldtab_sign u1D121.olduniE010crescendo_from_silenceswell mute_strings u1D1B0.altuniE018uni266E_uni266Euni266E_uni266Duni266E_uni266F half_sharpsharp_and_a_half half_flatflat_and_a_halfuniE020uniE021uniE025uniE028uniE032uniE033uniE042uniE04AuniE050uniE051uniE055uniE05CuniE05DuniE05FuniE061uniE062uniE065uniE069u1D100u1D101u1D102u1D103u1D104u1D105u1D106u1D107u1D108u1D109u1D10Au1D10Bu1D10Cu1D10Du1D10Eu1D10Fu1D110u1D111u1D112u1D113u1D114u1D115u1D116u1D117u1D118u1D119u1D11Au1D11Bu1D11Cu1D11Du1D11Eu1D11Fu1D120u1D121u1D122u1D123u1D124u1D125u1D126u1D129u1D12Au1D12Bu1D12Cu1D12Du1D12Eu1D12Fu1D130u1D131u1D132u1D133u1D134u1D135u1D136u1D137u1D138u1D139u1D13Au1D13Bu1D13Cu1D13Du1D13Eu1D13Fu1D140u1D141u1D142u1D143u1D144u1D145u1D146u1D147u1D148u1D149u1D14Au1D14Bu1D14Cu1D14Du1D14Eu1D14Fu1D150u1D151u1D152u1D153u1D154u1D155u1D156u1D157u1D158u1D159u1D15Au1D15Bu1D15Cu1D15Du1D15Eu1D15Fu1D160u1D161u1D162u1D163u1D164u1D165u1D166u1D167u1D168u1D169u1D16Au1D16Bu1D16Cu1D16Du1D16Eu1D16Fu1D170u1D171u1D172u1D173u1D174u1D175u1D176u1D177u1D178u1D179u1D17Au1D17Bu1D17Cu1D17Du1D17Eu1D17Fu1D180u1D181u1D182u1D183u1D184u1D185u1D186u1D187u1D188u1D189u1D18Au1D18Bu1D18Cu1D18Du1D18Eu1D18Fu1D190u1D191u1D192u1D193u1D194u1D195u1D196u1D197u1D198u1D199u1D19Au1D19Bu1D19Cu1D19Du1D19Eu1D19Fu1D1A0u1D1A1u1D1A2u1D1A3u1D1A4u1D1A5u1D1A6u1D1A7u1D1A8u1D1A9u1D1AAu1D1ABu1D1ACu1D1ADu1D1AEu1D1AFu1D1B0u1D1B1u1D1B2u1D1B3u1D1B4u1D1B5u1D1B6u1D1B7u1D1B8u1D1B9u1D1BAu1D1BBu1D1BCu1D1BDu1D1BEu1D1BFu1D1C0u1D1C1u1D1C2u1D1C3u1D1C4u1D1C5u1D1C6u1D1C7u1D1C8u1D1C9u1D1CAu1D1CBu1D1CCu1D1CDu1D1CEu1D1CFu1D1D0u1D1D1u1D1D2u1D1D3u1D1D4u1D1D5u1D1D6u1D1D7u1D1D8u1D1D9u1D1DAu1D1DBu1D1DCu1D1DD u1D1A0_u1D19D u1D1A0_u1D19C @  ZDFLTlatn(musc<aalt ccmp&hist,liga2ss018 $,(,BR(7XYZWWZ 2<FPZv <         =  BPDFLTlatn musc,kern| .@.N``@r > TĠ;src/java/META-INF/0000755000175000017500000000000012644165236013611 5ustar mathieumathieusrc/java/META-INF/MANIFEST.MF0000644000175000017500000000054412644165236015246 0ustar mathieumathieuManifest-Version: 1.0 Ant-Version: Apache Ant 1.8.2 Created-By: 1.8.0_45-b14 (Oracle Corporation) Main-Class: org.dbdoclet.herold.Herold Specification-Version: 8.0.4-SNAPSHOT Implementation-Version: 8.0.4-SNAPSHOT Class-Path: ../conf/ org.antlr.runtime.jar org.apache.commons.jxpat h.jar org.apache.commons.logging.jar org.apache.log4j.jar src/java/OSGI-INF/0000755000175000017500000000000012644165236013624 5ustar mathieumathieusrc/java/OSGI-INF/component-description.xml0000644000175000017500000000045312644165236020673 0ustar mathieumathieu src/java/org/0000755000175000017500000000000012644165236013240 5ustar mathieumathieusrc/java/org/dbdoclet/0000755000175000017500000000000012644165244015017 5ustar mathieumathieusrc/java/org/dbdoclet/herold/0000755000175000017500000000000012644165236016275 5ustar mathieumathieusrc/java/org/dbdoclet/herold/ConsoleProgressListener.java0000644000175000017500000000767712644165236024016 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.herold; import org.dbdoclet.progress.ProgressAdapter; import org.dbdoclet.progress.ProgressEvent; public class ConsoleProgressListener extends ProgressAdapter { private static final int DEFAULT_LINE_WIDTH = 77; private int prepareCounter = 0; private int actionCounter = 0; private final boolean dumb; private int lastPercent = 0; private ProgressEvent lastEvent; private int barWidth; private int lineWidth; private String lastLine; public ConsoleProgressListener(boolean dumb) { this.dumb = dumb; int lineWidth = DEFAULT_LINE_WIDTH; String value = System.getProperty("console.lineWidth"); if (value != null) { try { lineWidth = Integer.parseInt(value); } catch (Exception e) { lineWidth = DEFAULT_LINE_WIDTH; } } // print("LineWidth=" + lineWidth + "\n"); setLineWidth(lineWidth); } @Override public boolean progress(ProgressEvent event) { if (lastEvent != null) { if (lastEvent.getStage() == ProgressEvent.STAGE_ACTION && lastEvent.getConsider() == true && (event.getStage() != ProgressEvent.STAGE_ACTION || event.getConsider() == false)) { printBar(100); } } if (event.getConsider() == false) { print("\n" + event.getAction() + "\n"); lastEvent = event; return true; } if (event.getStage() == ProgressEvent.STAGE_PREPARE) { stagePrepare(event); } if (event.getStage() == ProgressEvent.STAGE_ACTION) { actionCounter++; int percent = 0; int max = getProgressMaximum(); if (max > 0) { percent = (100 * actionCounter) / getProgressMaximum(); } if (percent > 100) { percent = 100; } printBar(percent); } lastEvent = event; return true; } private void stagePrepare(ProgressEvent event) { if (dumb == false) { StringBuilder buffer = new StringBuilder(String.valueOf(++prepareCounter)); buffer.append(' '); String action = event.getAction(); if (action != null) { action = action.replaceAll("\n", " ").trim(); action = action.replaceAll("\r", " ").trim(); buffer.append(action); } while (buffer.length() < lineWidth) { buffer.append(' '); } if (buffer.length() > lineWidth) { buffer = buffer.delete(lineWidth, buffer.length()); } print(buffer.toString() + "\r"); } } private void printBar(int percent) { int pos = 0; if (percent > 0) { pos = (int) (percent * ((float) barWidth / 100)); } StringBuilder buffer = new StringBuilder(); for (int i = 0; i < pos; i++) { buffer.append('#'); } for (int i = pos; i < barWidth; i++) { buffer.append(' '); } if (dumb == true) { if (percent != lastPercent) { System.out.println(percent + "%"); lastPercent = percent; } } else { String line = String.format(" %3d%% |%s| 100%%\r", percent, buffer.toString()); print(line); } } @Override public void setProgressMaximum(int max) { super.setProgressMaximum(max); actionCounter = 0; } public void setLineWidth(int lineWidth) { if (lineWidth < 15) { return; } this.lineWidth = lineWidth; barWidth = lineWidth - 13; } private void print(String line) { if (lastLine != null && line.equals(lastLine)) { return; } System.out.print(line); lastLine = line; } } src/java/org/dbdoclet/herold/usage.txt0000644000175000017500000000242712644165236020147 0ustar mathieumathieuherold Version {0} Copyright (C) 2001-2013 Michael Fuchs Syntax: herold [options] --docbook-encoding -d - Specifies the encoding of the generated DocBook XML files. Example: --destination-encoding=ISO-8859-1 --help -h - Print this message and quit. --in= -i - Input HTML file. --license -L - Display the herold license and quit. --out= -o - Output XML file. --profile= -p - Profile file with predefined parameter settings. --docbook-document-element= -r - The root element of the document. Possible values are: book and article. The default value is 'article'. --html-encoding -s - Specifies the encoding of the source files, such as ISO-8859-1. --docbook-title -t - The title for the resulting document. --docbook-decompose-tables -T - Tables inside the HTML file are decomposed during the transformation. --verbose -v - Progress messages on the console. --version -V - Version numbersrc/java/org/dbdoclet/herold/Resources_de.properties0000644000175000017500000000507712644165236023046 0ustar mathieumathieu# Java Resource Bundle # Modified by Zaval JRC Editor (C) Zaval CE Group # http://www.zaval.org/products/jrc-editor/ C_COLUMN=Spalte C_DOCBOOK_FILE=DocBook-Datei C_ERROR=Fehler C_ERROR_CANT_FIND_DOCBOOK_XSD=Das DocBook XML Schema {1} fr Version {0} konnte nicht gefunden werden! C_ERROR_DOCBOOK_FILE_MISSING=

DocBook Datei ist unbestimmt

\n\

Sie mssen die DocBook-Datei bestimmen, in der das DocBook XML gespeichert werden soll. Klicken Sie dazu in das \n\ Eingabefeld mit dem zugehrigen Attributnamen "DocBook-Datei" des Parameterdialog. Es ffnet sich nun ein \n\ Dateidialog in dem Sie eine entsprechende DocBook-Datei auswhlen knnen.

\n\ C_ERROR_FILE_NOT_FOUND=Die Datei {0} konnte nicht gefunden werden. C_ERROR_HTML_FILE_MISSING=

HTML Datei ist unbestimmt

\n\

Sie mssen die HTML-Datei bestimmen, die nach DocBook XML konvertiert werden soll. Klicken Sie dazu in das \n\ Eingabefeld mit dem zugehrigen Attributnamen "HTML-Datei" des Parameterdialog. Es ffnet sich nun ein \n\ Dateidialog in dem Sie die entsprechende HTML-Datei auswhlen knnen.

\n\ C_ERROR_PARSE=Parser: C_ERROR_RESOURCE_NOT_FOUND=Die URL {0} konnte nicht gefunden werden. C_ERROR_XML_NOT_VALID=Das erzeugte XML-Dokument ist nicht gltig. Die aktuelle Version von dbdoclet kann\\nbei http://www.dbdoclet.org bezogen werden. Falls sie einen Fehler entdeckt haben,\\nschreiben sie bitte eine E-Mail an michael.fuchs@unico-group.com. C_FATAL_ERROR=Fataler Fehler C_HTML_FILE=HTML-Datei C_INDEX_ELEMENT=Element Index einfgen C_LINE=Zeile C_OPTION_DOCBOOK_VERSION=DocBook Version C_OPTION_INDEX_ELEMENT=Element Index einfgen C_OPTION_NO_TABLES=Tabellen ausblenden C_OPTION_ROOT_ELEMENT=Dokumenttyp C_OVERVIEW=berblick C_REFERENCE_HANDBOOK=Referenzhandbuch C_TOOLTIP_INDEX_ELEMENT=

Bestimmt ob am Ende der DocBook XML Datei das Element index eingefgt wird.

C_TOOLTIP_OPTION_DOCBOOK_VERSION=

Die Version des DocBook Schemas, das fr die Generierung des DocBook XML verwendet werden soll.

C_TOOLTIP_OPTION_INDEX_ELEMENT=

Bestimmt fr den Dokumententyp book, ob am Ende der DocBook XML Datei das Element index eingefgt wird.

C_TOOLTIP_OPTION_NO_TABLES=

Das Ausblenden der Tabellen kann die Transformation von HTML-Dateien verbessern, die Tabellen fr \n\ das Layout verwenden.

C_TOOLTIP_OPTION_ROOT_ELEMENT=Der Type des Dokumentes bestimmt das Wurzelelement des XML-Baumes. C_USAGE=/org/dbdoclet/herold/usage_de.txt C_VALIDATING=Validierung des DocBook-Dokumentes... C_WARNING=Warnung src/java/org/dbdoclet/herold/COPYING0000644000175000017500000010451312644165236017334 0ustar mathieumathieu GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . src/java/org/dbdoclet/herold/Herold.java0000644000175000017500000003217412644165236020364 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.herold; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.StringWriter; import java.net.URL; import java.text.MessageFormat; import java.util.ResourceBundle; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.dbdoclet.option.BooleanOption; import org.dbdoclet.option.FileOption; import org.dbdoclet.option.Option; import org.dbdoclet.option.OptionException; import org.dbdoclet.option.OptionList; import org.dbdoclet.option.SelectOption; import org.dbdoclet.option.StringOption; import org.dbdoclet.service.FileServices; import org.dbdoclet.service.ResourceServices; import org.dbdoclet.service.StringServices; import org.dbdoclet.trafo.AbstractTrafoService; import org.dbdoclet.trafo.TrafoConstants; import org.dbdoclet.trafo.TrafoException; import org.dbdoclet.trafo.TrafoExceptionHandler; import org.dbdoclet.trafo.TrafoResult; import org.dbdoclet.trafo.TrafoScriptManager; import org.dbdoclet.trafo.html.dita.HtmlDitaTrafo; import org.dbdoclet.trafo.html.docbook.HtmlDocBookTrafo; import org.dbdoclet.trafo.param.BooleanParam; import org.dbdoclet.trafo.param.TextParam; import org.dbdoclet.trafo.script.Namespace; import org.dbdoclet.trafo.script.Script; import org.dbdoclet.trafo.script.Section; /** * The class Herold implements a console converter to transform * HTML code to DocBook XML. * * @author Michael Fuchs * @version 1.0 */ public class Herold { public enum OutputFormat { DITA, DocBook } private static Log logger = LogFactory.getLog(Herold.class);; private int exitCode; private FileOption optIn; private FileOption optOut; private OutputFormat outputFormat; private ResourceBundle res = ResourceBundle .getBundle("org/dbdoclet/herold/Resources"); private boolean systemExitEnabled = true; private boolean verbose = false; private static String getVersion() { Package p = Herold.class.getPackage(); return p.getImplementationVersion(); } public static void main(String[] args) { Herold herold = new Herold(); herold.execute(args); } private static void printLicense() throws IOException { URL url = ResourceServices .getResourceAsUrl("/org/dbdoclet/herold/COPYING"); if (url != null) { BufferedReader reader = new BufferedReader(new InputStreamReader( url.openStream())); String line = reader.readLine(); while (line != null) { println(line); line = reader.readLine(); } reader.close(); } else { logger.fatal("Can't find resource for license!"); } } private static void println(String str) { System.out.println(str); } private static void printVersion() { println("herold version \"" + getVersion() + "\""); } public void convert(File htmlFile, File xmlFile) throws TrafoException, FileNotFoundException { Script script = new Script(); convert(new FileInputStream(htmlFile), new FileOutputStream(xmlFile), xmlFile, script); } public void convert(InputStream in, OutputStream out, File systemId, Script script) throws TrafoException { AbstractTrafoService trafo = new HtmlDocBookTrafo(); if (outputFormat == OutputFormat.DITA) { trafo = new HtmlDitaTrafo(); } trafo.setSystemId(systemId); trafo.setInputStream(in); trafo.setOutputStream(out); TrafoResult result = null; if (verbose == true) { trafo.addProgressListener(new ConsoleProgressListener(false)); result = trafo.transform(script); } else { result = trafo.transform(script); } if (result.isFailed()) { System.err.print(result.toString()); } if (verbose == true) { System.out.println(); } } private OptionList createOptionList(String[] args) { Option option; SelectOption selopt; BooleanOption bopt; StringOption sopt; OptionList options = new OptionList(args); // docbook-add-index bopt = new BooleanOption(TrafoConstants.SECTION_DOCBOOK.toLowerCase() + "-" + TrafoConstants.PARAM_ADD_INDEX, "x"); bopt.setValue(false); options.add(bopt); // docbook-encoding sopt = new StringOption(TrafoConstants.SECTION_DOCBOOK.toLowerCase() + "-" + TrafoConstants.PARAM_ENCODING, "d"); sopt.setDefault("UTF-8"); options.add(sopt); // decompose-tables bopt = new BooleanOption(TrafoConstants.SECTION_DOCBOOK.toLowerCase() + "-" + TrafoConstants.PARAM_DECOMPOSE_TABLES, "T"); bopt.setDefault(false); options.add(bopt); // document-element selopt = new SelectOption(TrafoConstants.SECTION_DOCBOOK.toLowerCase() + "-" + TrafoConstants.PARAM_DOCUMENT_ELEMENT, "r"); String[] optv2 = { "article", "book", "reference", "part", "chapter", "section" }; selopt.setList(optv2); selopt.setDefault("article"); options.add(selopt); // title sopt = new StringOption(TrafoConstants.SECTION_DOCBOOK.toLowerCase() + "-" + TrafoConstants.PARAM_TITLE, "t"); sopt.setDefault("http://www.dbdoclet.org/herold"); options.add(sopt); // source-encoding sopt = new StringOption(TrafoConstants.SECTION_HTML.toLowerCase() + "-" + TrafoConstants.PARAM_ENCODING, "s"); sopt.setDefault("UTF-8"); options.add(sopt); // in optIn = new FileOption("in", "i"); optIn.isExisting(true); options.add(optIn); // loglevel SelectOption optLogLevel = new SelectOption("logging-level", "l"); optLogLevel.setList(new String[] { "debug5", "debug4", "debug3", "debug2", "debug", "info", "warn", "error", "fatal" }); optLogLevel.setDefault("error"); options.add(optLogLevel); // out optOut = new FileOption("out", "o"); options.add(optOut); StringOption optProfile = new StringOption("profile", "p"); options.add(optProfile); // verbose option = new BooleanOption("verbose", "v"); options.add(option); return options; } public OutputFormat getOutputFormat() { return outputFormat; } public void setOutputFormat(OutputFormat outputFormat) { this.outputFormat = outputFormat; } private OutputStream createOutputStream() throws FileNotFoundException { OutputStream out; if (optOut.isUnset()) { out = System.out; } else { File outDir = optOut.getValue().getParentFile(); if (outDir != null && outDir.exists() == false) { outDir.mkdir(); } out = new FileOutputStream(optOut.getValue()); } return out; } public void execute(String[] args) { OptionList options = null; exitCode = 0; try { Option option; options = new OptionList(args); // help option = new BooleanOption("help", "h"); option.setMediumName("?"); options.add(option); // license option = new BooleanOption("license", "L"); options.add(option); // version option = new BooleanOption("version", "V"); options.add(option); options.validate(true); if (options.getFlag("help", false)) { printUsage(); return; } if (options.getFlag("version", false)) { printVersion(); return; } if (options.getFlag("license", false)) { printLicense(); exit(0); } options = createOptionList(args); if (options.validate() == false) { throw new OptionException(options.getError()); } StringOption optProfile = (StringOption) options .getOption("profile"); File profileFile = findProfile(optProfile); Script script; TrafoScriptManager mgr = new TrafoScriptManager(); script = mgr.parseScript(profileFile); logger.info(String.format("Using profile file %s.", profileFile.getAbsolutePath())); if (logger.isTraceEnabled()) { StringWriter buffer = new StringWriter(); mgr.writeScript(script, buffer); logger.trace("Script: " + buffer.toString()); } File outFile = processCommandLineOptions(options, script); if (outFile != null) { logger.info(String.format("Output file is %s.", outFile.getPath())); } InputStream in = null; OutputStream out = null; if (optIn.isUnset()) { in = System.in; } else { in = new FileInputStream(optIn.getValue()); } out = createOutputStream(); convert(in, out, optOut.getValue(), script); } catch (OptionException oops) { if ((options != null) && (options.getFlag("help", false) == false)) { printUsage(); String msg = oops.getMessage(); if (msg != null) { System.err.println(msg); } } else { oops.printStackTrace(); printUsage(); } exitCode = 1; } catch (TrafoException oops) { logger.fatal("TrafoException", TrafoExceptionHandler.getCause(oops)); exitCode = 2; } catch (FileNotFoundException oops) { logger.fatal(oops.getMessage()); exitCode = 3; } catch (IOException oops) { oops.printStackTrace(); exitCode = 4; } catch (Exception oops) { oops.printStackTrace(); exitCode = 5; } exit(exitCode); } private void exit(int exitCode) { this.exitCode = exitCode; if (systemExitEnabled == true) { System.exit(exitCode); } } private File findProfile(StringOption optProfile) throws FileNotFoundException { String profileName = "default.her"; if (optProfile.isUnset() == false) { profileName = optProfile.getValue(); } if (profileName == null || profileName.trim().length() == 0) { profileName = "default.her"; } File profile = new File(profileName); if (profile.exists() == true) { return profile; } String homePath = System.getProperty("herold.home"); if (homePath != null) { File homeDir = new File(homePath); if (homeDir.exists() == false) { throw new FileNotFoundException(String.format( "Home directory %s does not exist!", homePath)); } File profilesDir = new File(homeDir, "profiles"); if (profilesDir.exists() == false) { throw new FileNotFoundException(String.format( "Profiles directory %s does not exist!", profilesDir.getAbsolutePath())); } File file = new File(profilesDir, profileName); if (file.exists() == true) { return file; } file = new File(profilesDir, profileName + ".her"); if (file.exists() == true) { return file; } } throw new FileNotFoundException(String.format( "Profile %s does not exist!", profileName)); } public int getExitCode() { return exitCode; } public boolean isCanceled() { return false; } private void printUsage() { try { String resname = ResourceServices.getString(res, "C_USAGE"); String buffer = ResourceServices.getResourceAsString(resname); println(MessageFormat.format(buffer, getVersion())); } catch (IOException oops) { logger.fatal("Printing usage message failed!", oops); } } public File processCommandLineOptions(OptionList options, Script script) { Namespace namespace = script.getNamespace(); Section section = null; for (Option option : options) { String name = option.getLongName(); if (name.startsWith(TrafoConstants.SECTION_DOCBOOK.toLowerCase())) { section = namespace.findOrCreateSection(TrafoConstants.SECTION_DOCBOOK); name = StringServices.cutPrefix(name, TrafoConstants.SECTION_DOCBOOK.toLowerCase()); } else if (name.startsWith(TrafoConstants.SECTION_HTML .toLowerCase())) { section = namespace.findOrCreateSection(TrafoConstants.SECTION_HTML); name = StringServices.cutPrefix(name, TrafoConstants.SECTION_HTML.toLowerCase()); } name = StringServices.cutPrefix(name, "-"); if (section != null && option.isUnset() == false) { switch (option.getType()) { case BOOLEAN: section.setParam(new BooleanParam(name, (Boolean) option.getValue())); break; default: section.setParam(new TextParam(name, option.getValue().toString())); break; } } } setVerbose(options.getFlag("verbose", false)); File outFile; if (optOut == null) { throw new IllegalStateException( "The field optOut must not be null!"); } if (optIn == null) { throw new IllegalStateException( "The field optIn must not be null!"); } if (optOut.isUnset() && optIn.isUnset() == false) { String outFileName = FileServices.getFileBase(optIn.getValue()) + ".xml"; // outFile = FileServices.createUniqueFile(new File(outFileName)); outFile = new File(outFileName); } else { outFile = optOut.getValue(); } return outFile; } public void setSystemExitEnabled(boolean systemExitEnabled) { this.systemExitEnabled = systemExitEnabled; } public void setVerbose(boolean verbose) { this.verbose = verbose; } } src/java/org/dbdoclet/herold/Resources.properties0000644000175000017500000000377712644165236022403 0ustar mathieumathieu# Java Resource Bundle # Modified by Zaval JRC Editor (C) Zaval CE Group # http://www.zaval.org/products/jrc-editor/ C_COLUMN=Column C_DOCBOOK_FILE=DocBook File C_DOCBOOK_VERSION= C_ERROR=Error C_ERROR_CANT_FIND_DOCBOOK_XSD=Can't find DocBook Schema {1} for version {0}! C_ERROR_DOCBOOK_FILE_MISSING=

DocBook File not defined

\n\

You must specify a DocBook file as output target. Please use the field "DocBook File" in the property dialog \n\ to choose the file where the DocBook output should be stored.

C_ERROR_FILE_NOT_FOUND=Can't find file {0}. C_ERROR_HTML_FILE_MISSING=

HTML File not defined

\n\

You must specify a HTML file for processing. Please use the field "HTML File" in the property dialog \n\ to choose the HTML file you want to convert to DocBook XML

C_ERROR_PARSE=Parser: C_ERROR_RESOURCE_NOT_FOUND=Can't find resource {0}. C_ERROR_XML_NOT_VALID=The generated XML document is not valid. Please download the latest version of dbdoclet from \\nhttp://www.dbdoclet.org. If you encountered a bug, please send an email to michael.fuchs@unico-group.com. C_FATAL_ERROR=Fatal Error C_HTML_FILE=HTML File C_LINE=Line C_OPTION_DOCBOOK_VERSION=DocBook Version C_OPTION_INDEX_ELEMENT=Add Index Element C_OPTION_NO_TABLES=Suppress Tables C_OPTION_ROOT_ELEMENT=Document Type C_OVERVIEW=Overview C_REFERENCE_HANDBOOK=Reference Handbook C_TOOLTIP_OPTION_DOCBOOK_VERSION=

The Version of the DocBook Schema, which is used for the generation of the DocBook XML.

C_TOOLTIP_OPTION_INDEX_ELEMENT=

If set and document type is book, an index element will be added at the end of the DocBook Xml file.

C_TOOLTIP_OPTION_NO_TABLES=

Suppressing tables may be helpful, if your HTML files contains tables for layout purposes.

C_TOOLTIP_OPTION_ROOT_ELEMENT=The document type of generated DocBook XML. Actually the root element of the XML tree. C_USAGE=/org/dbdoclet/herold/usage.txt C_VALIDATING=Validating... C_WARNING=Warning src/java/org/dbdoclet/herold/usage_de.txt0000644000175000017500000000260012644165236020610 0ustar mathieumathieuherold Version {0} Copyright (C) 2001-2013 Michael Fuchs Aufruf: herold --docbook-encoding -d - Spezifiziert die Kodierung der generierten DocBook XML Dateien. Beispiel: --destination-encoding ISO-8859-1. --help -h - Diesen Text ausgeben. --in= -i - Zu verarbeitende HTML Datei. --license -L - Anzeige der herold Lizenz. --out= -o - Name der zu erzeugenden DocBook XML Datei. --profile= -p - Angabe einer Profildatei mit vordefinierten Parametern. --docbook-document-element= -r - Das Wurzelelement des Dokumentes: Mögliche Elemente sind: book und article. Die Standardeinstellung ist 'article'. --html-encoding -s - Spezifiziert die Kodierung der Quelldateien, z.B. ISO-8859-1. --docbook-title -t - Der Title des generierten Dokuments. --docbook-decompose-tables -T - Tabellen innerhalb der HTML Datei werden bei der Umwandlung in das DocBook-Format aufgelöst. --verbose -v - Fortschrittsanzeige auf der Konsole. --version -V - Ausgabe der Versionsnummer. src/java/org/dbdoclet/service/0000755000175000017500000000000012644165244016457 5ustar mathieumathieusrc/java/org/dbdoclet/service/ArrayServices.java0000644000175000017500000001144712644165236022114 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.service; import java.io.File; import java.util.ArrayList; import java.util.Arrays; /** * Die Klasse ArrayServices bietet Methoden für die Bearbeitung von Arrays. * */ public class ArrayServices { /** * Die Methode concat verknüpft 2 Arrays des Typs * String[] zu einem neuen String[] Array. * * @see java.lang.System#arraycopy */ public static String[] concat(String[] array1, String[] array2) { if (array1 == null) { throw new IllegalArgumentException("The argument array1 must not be null!"); } if (array2 == null) { throw new IllegalArgumentException("The argument array2 must not be null!"); } String[] array = new String[array1.length + array2.length]; System.arraycopy(array1, 0, array, 0, array1.length); System.arraycopy(array2, 0, array, array1.length, array2.length); return array; } public static File[] concat(File[] array1, File[] array2) { if (array1 == null) { throw new IllegalArgumentException("The argument array1 must not be null!"); } if (array2 == null) { throw new IllegalArgumentException("The argument array2 must not be null!"); } File[] array = new File[array1.length + array2.length]; System.arraycopy(array1, 0, array, 0, array1.length); System.arraycopy(array2, 0, array, array1.length, array2.length); return array; } /** * Die Methode concat verknüpft 2 Arrays des Typs Object[] zu einem neuen Array. */ public static Object[] concat(Object[] array1, Object[] array2) { if (array1 == null) { throw new IllegalArgumentException("The argument array1 must not be null!"); } if (array2 == null) { throw new IllegalArgumentException("The argument array2 must not be null!"); } Object[] array = new Object[array1.length + array2.length]; System.arraycopy(array1, 0, array, 0, array1.length); System.arraycopy(array2, 0, array, array1.length, array2.length); return array; } public static String[] listToSortedStringArray(ArrayList list) { if (list == null) { throw new IllegalArgumentException("The argument list must not be null!"); } Object[] objArray = list.toArray(); Arrays.sort(objArray); String[] strArray = new String[objArray.length]; for (int i = 0; i < objArray.length; i++) { if (objArray[i] == null) { strArray[i] = null; continue; } if (objArray[i] instanceof String) { strArray[i] = (String) objArray[i]; } else { strArray[i] = objArray.toString(); } } return strArray; } public static String[] listToStringArray(ArrayList list) { if (list == null) { throw new IllegalArgumentException("The argument list must not be null!"); } Object[] objArray = list.toArray(); String[] strArray = new String[objArray.length]; for (int i = 0; i < objArray.length; i++) { if (objArray[i] == null) { strArray[i] = null; continue; } if (objArray[i] instanceof String) { strArray[i] = (String) objArray[i]; } else { strArray[i] = objArray.toString(); } } return strArray; } public static String listToString(ArrayList list) { if (list == null) { throw new IllegalArgumentException("The argument list must not be null!"); } Object[] objArray = list.toArray(); StringBuffer buffer = new StringBuffer(); for (int i = 0; i < objArray.length; i++) { if (objArray[i] == null) { continue; } buffer.append(objArray[i].toString()); buffer.append(' '); } return buffer.toString(); } } src/java/org/dbdoclet/service/StringServices.java0000644000175000017500000005307212644165236022304 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.service; import java.io.File; import java.util.List; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.dbdoclet.Sfv; /** * Die Klasse StringServices stellt eine Sammlung statischer * Methoden zur Bearbeitung von Zeichenketten und/oder deren * Internationalisierung zur Verfügung. * * @author Michael Fuchs * */ public class StringServices { public static final Log logger = LogFactory.getLog(StringServices.class); public static final String ZERO_WIDTH_SPACE = "\u200b"; public static final String SIX_PER_EM_SPACE = "\u2006"; public static final String SOFT_HYPHEN = "\u00ad"; /** * Die Methode replace ersetzt alle Vorkomnisse eines * bestimmten Musters durch eine Zeichenkette. * * Die orginale Zeichenkette bleibt unverändert. * * Das Muster kann in der Zeichenkette durch geschweifte Klammern begrenzt * sein, um Anfang und Ende einer Ersetzung zu kennzeichnen. * * @param str * Die Zeichenkette * @param pattern * Das Suchmuster * @param subst * Die Ersetzung * @return Die bearbeitete Zeichenkette */ public static String replace(String str, String pattern, String subst) { if (str == null) { return null; } if (pattern == null) { return str; } if (subst == null) { subst = ""; } if (pattern.equals(subst)) { return str; } int fromIndex = 0; int toIndex = 0; String pattern2 = "{" + pattern + "}"; if (str.indexOf(pattern) == -1 && str.indexOf(pattern2) == -1) { return str; } StringBuffer buffer = new StringBuffer(); while ((toIndex = str.indexOf(pattern2, toIndex)) != -1) { buffer.append(str.substring(fromIndex, toIndex)); buffer.append(subst); fromIndex = toIndex + pattern2.length(); toIndex = fromIndex; } // end of while () buffer.append(str.substring(fromIndex)); fromIndex = 0; toIndex = 0; str = buffer.toString(); buffer = new StringBuffer(); while ((toIndex = str.indexOf(pattern, toIndex)) != -1) { buffer.append(str.substring(fromIndex, toIndex)); buffer.append(subst); fromIndex = toIndex + pattern.length(); toIndex = fromIndex; } // end of while () buffer.append(str.substring(fromIndex)); return buffer.toString(); } /** * Die Methode replace ersetzt alle Vorkomnisse eines * bestimmten Musters durch eine Zeichenkette ohne die Groß/Kleinscrebung zu * beachten. * * Die orginale Zeichenkette bleibt unverändert. * * Das Muster kann in der Zeichenkette durch geschweifte Klammern begrenzt * sein, um Anfang und Ende einer Ersetzung zu kennzeichnen. * * @param str * Die Zeichenkette * @param pattern * Das Suchmuster * @param subst * Die Ersetzung * @return Die bearbeitete Zeichenkette */ public static String replaceIgnoreCase(String str, String pattern, String subst) { if (str == null) { return null; } if (pattern == null) { return str; } if (subst == null) { subst = ""; } int fromIndex = 0; int toIndex = 0; String buffer = ""; String lowerStr = str.toLowerCase(); String lowerPattern = pattern.toLowerCase(); String pattern2 = "{" + lowerPattern + "}"; while ((toIndex = lowerStr.indexOf(pattern2, toIndex)) != -1) { buffer += str.substring(fromIndex, toIndex); buffer += subst; fromIndex = toIndex + pattern2.length(); toIndex = fromIndex; } // end of while () buffer += str.substring(fromIndex); fromIndex = 0; toIndex = 0; str = buffer; buffer = ""; while ((toIndex = lowerStr.indexOf(lowerPattern, toIndex)) != -1) { buffer += str.substring(fromIndex, toIndex); buffer += subst; fromIndex = toIndex + lowerPattern.length(); toIndex = fromIndex; } // end of while () buffer += str.substring(fromIndex); return buffer; } /** * Die Methode createIndent erzeugt eine Einrückung aus * Leerzeichen der Länge len. * * @param len * int * @return String */ public static String createIndent(int len) { StringBuffer indent = new StringBuffer(); for (int i = 0; i < len; i++) { indent.append(' '); } return indent.toString(); } /** * Die Methode capFirstLetter wandelt den ersten Buchstaben * einer Zeichenkette in einen Großbuchstaben um. * * Die orginale Zeichenkette bleibt unverändert. * * @param str * Die Zeichenkette * @return Die bearbeitete Zeichenkette */ public static String capFirstLetter(String str) { if (str == null || str.length() == 0) { return str; } char[] chars = str.toCharArray(); chars[0] = Character.toUpperCase(chars[0]); return new String(chars); } /** * Liefert den ersten Buchstaben einer Zeichenkette. */ public static String getFirstLetter(String str) { if (str == null || str.length() == 0) { return str; } char fc = str.toCharArray()[0]; char[] chars = new char[1]; chars[0] = fc; return new String(chars); } /** * Die Methode lowerFirstLetter wandelt den ersten Buchstaben * einer Zeichenkette in einen Kleinbuchstaben um. * * Die orginale Zeichenkette bleibt unverändert. * * @param str * Die Zeichenkette * @return Die bearbeitete Zeichenkette */ public static String lowerFirstLetter(String str) { if (str == null || str.length() == 0) { return str; } char[] chars = str.toCharArray(); chars[0] = Character.toLowerCase(chars[0]); return new String(chars); } /** * Die Methode createJavaIdentifier erzeugt aus einer * Zeichenkette einen gültiges Java Schlüsselwort. * * Falls der Parameter mangleUnderscores auf wahr gesetzt ist, * werden auch Unterstriche entfernt. Dies ist notwendig, um * jspc.sh konforme Klassennamen zu erzeugen. * jspc.sh ist der JSP-Compiler aus der Tomcat-Distribution. * * @param str * Die Zeichenkette * @param mangleUnderscores * boolean * @return Die bearbeitete Zeichenkette */ public static String createJavaIdentifier(String str, boolean mangleUnderscores) { if (str == null || str.length() == 0) { return str; } StringBuffer identifier = new StringBuffer(); if (Character.isJavaIdentifierStart(str.charAt(0)) == false) { identifier.append("i"); } for (int i = 0; i < str.length(); i++) { if (Character.isJavaIdentifierPart(str.charAt(i)) == false) { if (mangleUnderscores == true) { identifier.append(mangleChar(str.charAt(i), "0x")); } else { identifier.append(mangleChar(str.charAt(i), "_")); } } else { char c = str.charAt(i); if (c == '_' && mangleUnderscores == true) { identifier.append(mangleChar(str.charAt(i), "0x")); } else { identifier.append(str.charAt(i)); } } } // end of for () return identifier.toString(); } /** * Die Methode createJavaIdentifier erzeugt aus einer * Zeichenkette einen gültiges Java Schlüsselwort. * * @param str * Die Zeichenkette * @return Die bearbeitete Zeichenkette */ public static String createJavaIdentifier(String str) { return createJavaIdentifier(str, false); } /** * Die Methode mangleChar übersetzt ein Schriftzeichen in eine * numerische Darstellung. * * Die resultierende Zeichenkette startet mit einem Vorspann dem ein 5 * Spalten breiter, hexadezimaler Wert folgt. starts with a prefix, the * * Beispiel: _0002f * * @param c * a char value * @param prefix * a String value * @return String */ public static String mangleChar(char c, String prefix) { String s = Integer.toHexString(c); int nzeros = 5 - s.length(); char[] result = new char[5]; for (int i = 0; i < nzeros; i++) { result[i] = '0'; } for (int i = nzeros, j = 0; i < 5; i++, j++) { result[i] = s.charAt(j); } return (prefix + new String(result)); } /** * Die Methode createHeadline erzeugt eine Überschrift der Form * **** title ****. * * @param title * String * @return String */ public static String createHeadline(String title) { if (title == null) { throw new IllegalArgumentException( "The argument title may not be null!"); } StringBuffer sep = new StringBuffer(); for (int i = 0; i < title.length() + 4; i++) { sep.append('*'); } String buffer = sep + "\n" + "* " + title + " *\n" + sep + "\n\n"; return buffer; } /** * Die Methode info erzeugt eine Informationszeile der Form * info.... ..: . * * Die Länge der erzeugten Zeichenkette beträgt 50 Zeichen. * * @param line * String * @return String */ public static String info(String line) { return align(line, 50, '.') + ": "; } /** * Die Methode info erzeugt eine Informationszeile der Form * info.... ... * * Die Länge der erzeugten Zeichenkette beträgt 50 Zeichen. * * @param line * String * @return String */ public static String align(String line) { return align(line, 50, '.'); } /** * Die Methode info erzeugt eine Informationszeile der Form * info.... ... * * Die Länge der erzeugten Zeichenkette beträgt width Zeichen. * * @param line * String * @param width * int * @return String */ public static String align(String line, int width) { return align(line, width, '.'); } /** * Die Methode info erzeugt eine Informationszeile der Form * info... ... * * Die Länge der erzeugten Zeichenkette beträgt width Zeichen. * Das verwendete Trennzeichen kann mit Hilfe des Parameters * fill angegeben werden. * * @param line * String * @param width * int * @param fill * char * @return String */ public static String align(String line, int width, char fill) { if (line == null || line.length() == 0) { throw new IllegalArgumentException( "The argument line may not be null!"); } StringBuffer buffer = new StringBuffer(line); if (line.length() >= width) { buffer.append(fill); buffer.append(fill); buffer.append(fill); return buffer.toString(); } for (int i = line.length(); i < width; i++) { buffer.append(fill); } return buffer.toString(); } /** * The method align returns a string prefix for the output of a * double. If the double is greater than 100 the method returns an empty * string. If the double is between 100 and 10 the method returns one space, * and if the double is less than 10 it returns two spaces. * * @param d * a double value * @return String * */ public static String align(double d) { return align((int) d); } /** * The method align returns a string prefix for the output of * an integer. If the integer is greater than 100 the method returns an * empty string. If the integer is between 100 and 10 the method returns one * space, and if the integer is less than 10 it returns two spaces. * * @param i * an int value * @return String * */ public static String align(int i) { if (i >= 1000) { return ""; } // end of if () if (i >= 100) { return " "; } // end of if () if (i >= 10) { return " "; } // end of if () return " "; } /** * Die Methode chop bzw. cutSuffix schneidet die * mit suffix angegebene Zeichenkette vom Ende der Zeichenkette * suffix ab. * * @param text * String * @param suffix * String * @return String */ public static String cutSuffix(String text, String suffix) { if (suffix == null) { logger.warn(String .format("Can't cut off a null suffix (%s)!", text)); return text; } if (text == null) { return null; } if (text.length() == 0) { return text; } int index; if (text.endsWith(suffix)) { index = text.lastIndexOf(suffix); if (index != -1) { text = text.substring(0, index); } } return text; } /** * Ein Alias für cutSuffix. */ public static String chop(String text, String suffix) { return cutSuffix(text, suffix); } /** * Löscht den Buchstaben c vom Anfang und Ende der Zeichenkette * text. */ public static String trim(String text, char c) { StringBuffer buffer = new StringBuffer(); buffer.append(c); return trim(text, buffer.toString()); } /** * Löscht das Muster pattern vom Anfang und Ende der * Zeichenkette text. */ public static String trim(String text, String pattern) { if (text == null) { return null; } if (text.length() == 0) { return text; } while (text.startsWith(pattern)) { text = cutPrefix(text, pattern); } while (text.endsWith(pattern)) { text = cutSuffix(text, pattern); } return text; } /** * Die Methode cut schneidet die erste mit pattern * angegebene Zeichenkette aus der Zeichenkette text aus. * * @param text * String * @param pattern * String * @return String */ public static String cut(String text, String pattern) { if (text == null) { throw new IllegalArgumentException("Parameter text is null!"); } if (pattern == null) { throw new IllegalArgumentException("Parameter pattern is null!"); } String buffer; int start; int end; buffer = text; start = text.indexOf(pattern); if (start != -1) { buffer = text.substring(0, start); end = start + pattern.length(); if (end < text.length()) { buffer += text.substring(end, text.length()); } } return buffer; } /** * Die Methode cutPrefix entfernt die Zeichenkette * prefix vom Anfang der Zeichenkette text. * * @param text * String * @param prefix * String * @return String */ public static String cutPrefix(String text, String prefix) { if (text == null) { throw new IllegalArgumentException("Parameter text is null!"); } if (prefix == null) { throw new IllegalArgumentException("Parameter prefix is null!"); } if (text.length() < prefix.length()) { return text; } if (text.equals(prefix)) { return ""; } String buffer = text; if (text.startsWith(prefix)) { if (text.length() == prefix.length()) { buffer = ""; } else { buffer = text.substring(prefix.length()); } } return buffer; } /** * Kürzt die Zeichenkette text auf die maximale Länge von * cols. * * Ist die Zeichenkette text länger als cols * werden die letzten 3 Zeichen durch Punkte ersetzt. */ public static String shorten(String text, int cols) { if (text == null || text.length() == 0) { return ""; } if (cols < 5) { return text; } if (text.length() <= cols) { return text; } String msg = new String(text); msg = text.substring(0, (cols / 2) - 3); msg += "..."; msg += text.substring(text.length() - (cols / 2)); return msg; } public static String splitAt(String text) { return splitAt(text, File.separator, 71, Sfv.LSEP); } /** * Fügt das Trennzeichen Sfv.LSEP an Positionen des Muster * breakable ein, falls die Position innerhalb der Teilkette * größer als 71 ist. */ public static String splitAt(String text, String breakable) { return splitAt(text, breakable, 71, Sfv.LSEP); } /** * Fügt in eine Zeichenkette Trennzeichen ein. * * Die Zeichenkette text daraufhin untersucht ob an bestimmten * Stellen Trennzeichen eingefügt werden können. Der Parameter * breakPos bestimmt die minimale Länge einer Teilkette bevor * deas nächste Trennzeichen eingfügt werden kann. Der Parameter * breakable definiert das Muster an dem das Einfügen von * Trennzeichen möglich ist. */ public static String splitAt(String text, String breakable, int breakPos, String splitter) { if (text == null || text.length() == 0) { return ""; } if (text.length() <= 3) { return text; } if (breakable == null || breakable.length() == 0) { return text; } if (breakPos <= 0 || breakPos >= text.length()) { return text; } if (splitter == null || splitter.length() == 0) { return text; } boolean doSplit = true; StringBuffer buffer = new StringBuffer(); while (doSplit == true) { int lessIndex = 0; int greaterIndex = 0; int index = text.indexOf(breakable); while (index != -1) { if (index <= breakPos) { lessIndex = index; } if (index >= breakPos && greaterIndex == 0) { greaterIndex = index; } index = text.indexOf(breakable, index + 1); } if (greaterIndex == 0) { greaterIndex = text.length(); } if (lessIndex == 0) { lessIndex = breakPos; } int lessDistance = breakPos - lessIndex; int greaterDistance = greaterIndex - breakPos; // StringBuffer buffer = new StringBuffer(text); if (lessDistance <= greaterDistance || greaterIndex >= text.length()) { buffer.append(text.substring(0, lessIndex)); buffer.append(splitter); text = text.substring(lessIndex); } if (greaterDistance < lessDistance && greaterIndex < text.length()) { buffer.append(text.substring(0, greaterIndex)); buffer.append(splitter); text = text.substring(greaterIndex); } if (text.length() <= breakPos) { buffer.append(text); doSplit = false; } /* * logger.debug("text=" + text); logger.debug("text.length=" + * text.length()); logger.debug("breakPos " + breakPos); * logger.debug("lessIndex " + lessIndex); * logger.debug("greaterIndex " + greaterIndex); * logger.debug("lessDistance " + lessDistance); * logger.debug("greaterDistance " + greaterDistance); */ } return buffer.toString(); } public static String fillInt(int num, int width) { if (num < 1) { num *= -1; } String buffer = String.valueOf(num); while (width > buffer.length()) { buffer = "0" + buffer; } return buffer; } public static String fillLeadingZero(String num, int width) { String buffer = String.valueOf(num); boolean negative = false; if (buffer.startsWith("-")) { buffer = buffer.substring(1); negative = true; } while (width > buffer.length()) { buffer = "0" + buffer; } if (negative == true) { buffer = "-" + buffer; } return buffer; } public static String makeWrapable(String str) { if (str == null || str.length() == 0) { return str; } String[] tokens = { "/", "\\", "-" }; String wrapable = new String(str); for (String token : tokens) { if (token == null || token.length() == 0) { continue; } // zero width space wrapable = StringServices.replace(wrapable, token, token + ZERO_WIDTH_SPACE); } return wrapable; } public static String arrayToString(String[] array) { return arrayToString(array, " "); } public static String arrayToString(String[] array, String sep) { if (array == null || array.length == 0) { return ""; } StringBuffer buffer = new StringBuffer(); for (int i = 0; i < array.length; i++) { buffer.append(array[i]); buffer.append(sep); } return buffer.toString(); } public static String listToString(List list) { return listToString(list, Sfv.LSEP); } public static String listToString(List list, String sep) { if (list == null || list.size() == 0) { return ""; } StringBuffer buffer = new StringBuffer(); for (int i = 0; i < list.size(); i++) { buffer.append(list.get(i)); buffer.append(sep); } return buffer.toString(); } /** * Erstellt einen Rahmen aus Linienzeichen um den angegebenen Text. * * @param text * @return */ public static String createBox(String text) { StringBuilder buffer = new StringBuilder(); buffer.append('\u2554'); for (int i = 0; i < text.length() + 2; i++) { buffer.append('\u2550'); } buffer.append('\u2557'); buffer.append('\n'); buffer.append("\u2551 "); buffer.append(text); buffer.append(" \u2551\n"); buffer.append('\u255A'); for (int i = 0; i < text.length() + 2; i++) { buffer.append('\u2550'); } buffer.append('\u255D'); buffer.append('\n'); return buffer.toString(); } } src/java/org/dbdoclet/service/FileServices.java0000644000175000017500000020513412644165236021713 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.service; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.net.FileNameMap; import java.net.URLConnection; import java.text.MessageFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.Iterator; import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.dbdoclet.CreatePathException; import org.dbdoclet.DeleteFileException; import org.dbdoclet.FileAccessDeniedException; import org.dbdoclet.RenameFileException; import org.dbdoclet.ServiceException; import org.dbdoclet.Sfv; import org.dbdoclet.io.DirectoryFilter; import org.dbdoclet.io.EndsWithFilter; import org.dbdoclet.io.MimeType; import org.dbdoclet.io.StartsWithFilter; import org.dbdoclet.progress.ProgressEvent; import org.dbdoclet.progress.ProgressListener; import org.dbdoclet.template.TemplateTransformException; import org.dbdoclet.template.TemplateTransformer; /** * Die Klasse FileServices stellt statische Methoden zur Verfügung, die * Dateien und Dateverzeichnisse manipulieren und auswerten bereit. * * @author Michael Fuchs * @version 8.0 */ public class FileServices { /** Alle Dateien */ public static final int ALL = 2; /** Verwende den EndsWith-Filter */ public static final int ENDS_WITH = 1; public static final String FSEP = System.getProperty("file.separator"); private static Log logger = LogFactory.getLog(FileServices.class); /** Verwende den StartsWith-Filter */ public static final int STARTS_WITH = 0; public static final Pattern PATTERN_ABSOLUTE_WINDOWS_PATH = Pattern .compile("^([a-z,A-Z]:|/)/.*$"); /** * @see #appendFileName(String dir, String filename) */ public static String appendFileName(File dir, String filename) { if (dir == null) { throw new IllegalArgumentException( "The argument dir must not be null!"); } return appendFileName(dir.getAbsolutePath(), filename); } /** * Die Methode appendFileName hängt den Dateinamen and das * Verzeichnis an. * * Falls der Dateinamen mit dem betriebsspezifischen Pfadtrennzeichen endet * wird eine IllegalArgumentException ausgelöst. * *
* *
	 * 
	 * String path = System.getProperty("user.home");
	 * 
	 * path = FileServices.appendPath(path, "logs");
	 * FileServices.createPath(path);
	 * 
	 * path = FileServices.appendFileName(path, "Errors.log");
	 * File file = new File(path);
	 * 
	 * 
* *
* * */ public static String appendFileName(String path1, String filename) { if (path1 == null || path1.length() == 0) { throw new IllegalArgumentException( "The argument path1 must not be null!"); } if (filename == null) { throw new IllegalArgumentException( "The argument filename must not be null!"); } if (filename.trim().length() == 0) { throw new IllegalArgumentException( "The argument filename must not be empty!"); } if (path1.endsWith(File.separator) == false) { path1 += File.separator; } if (filename.startsWith(File.separator) == true && filename.length() > 1) { filename = filename.substring(1); } if (filename.endsWith(File.separator) == true) { throw new IllegalArgumentException("The name of file '" + filename + "' must not end with '" + File.separator + "'!"); } if (filename.length() == 0) { throw new IllegalArgumentException( "The filename must not be of length 0!"); } return path1 + filename; } public static String appendPath(File dir1, File dir2) { if (dir1 == null) { throw new IllegalArgumentException( "The argument dir1 must not be null!"); } if (dir2 == null) { throw new IllegalArgumentException( "The argument dir2 must not be null!"); } return appendPath(dir1.getPath(), dir2.getPath()); } public static String appendPath(File dir1, String path2) { if (dir1 == null) { throw new IllegalArgumentException( "The argument dir1 must not be null!"); } if (path2 == null) { throw new IllegalArgumentException( "The argument path2 must not be null!"); } return appendPath(dir1.getPath(), path2); } /** * Die Methode appendPath hängt das Verzeichnis path2 an das * Verzeichnis path1. * * Der erstellte Verzeichnispfad endet in jedem Fall mit dem * betriebsspezifischen Trennzeichen für Verzeichnisse. */ public static String appendPath(String path1, String path2) { if (path1 == null || path1.length() == 0) { throw new IllegalArgumentException( "The argument path1 must not be null!"); } if (path2 == null || path2.length() == 0) { throw new IllegalStateException("The field path2 must not be null!"); } path1 = path1.replace("/", File.separator); path2 = path2.replace("/", File.separator); if (path1.endsWith(File.separator) == false) { path1 += File.separator; } if (path2.startsWith(File.separator) == true) { if (path2.length() > File.separator.length()) { path2 = path2.substring(File.separator.length()); } } if (path2.endsWith(File.separator) == false) { path2 += File.separator; } return path1 + path2; } /** * Die Methode cleanRelatedFiles löscht eine Datei oder ein * Verzeichnis und alle "verwandten" Dateien und Verzeichnisse. * * Als verwandte Dateiobjekte werden alle Dateien und Verzeichnisse * betrachtet, deren Dateinname aus dem Dateinamen der Referenzdatei mit * angehängtem Bindestrich und einer Ziffer besteht. Falls eine * Dateinamenserweiterung vorhanden ist, wird diese am Ende des Dateinamens * erwartet, z.B. Addressen-12.txt ist verwand mit * Addressen.txt. * * @param file * File * @exception IOException */ public static void cleanRelatedFiles(File file) throws IOException { if (file == null) { throw new IllegalArgumentException( "The argument file must not be null!"); } int index = 1; String fileBase; String fileExt; String path; fileBase = getFileBase(file.getCanonicalPath()); fileExt = getExtension(file.getCanonicalPath()); logger.debug("Verzeichnis aufräumen: " + file.getCanonicalPath()); while (file.exists() == true) { try { setWritable(file); delete(file); } catch (Exception oops) { logger.fatal("FileServices.cleanRelatedFiles", oops); } path = fileBase + "-" + String.valueOf(index++); if (fileExt != null && fileExt.trim().length() > 0) { path += "." + fileExt; } file = new File(path); logger.debug("Verzeichnis aufräumen: " + file.getCanonicalPath()); } } public static boolean contains(File file, String regex) throws ServiceException { if (file == null) { throw new IllegalArgumentException( "The argument file must not be null!"); } if (regex == null) { throw new IllegalArgumentException( "The argument regex must not be null!"); } BufferedReader reader = null; try { Pattern pattern = Pattern.compile(regex); Matcher matcher; reader = new BufferedReader(new FileReader(file)); String line; while ((line = reader.readLine()) != null) { matcher = pattern.matcher(line); if (matcher.find()) { return true; } } return false; } catch (IOException oops) { throw new ServiceException(oops); } finally { try { if (reader != null) { reader.close(); } } catch (IOException ioe) { ioe.printStackTrace(); } } } public static boolean copyDir(File src, File dest) throws IOException { if (src == null) { throw new IllegalArgumentException( "The argument src must not be null!"); } if (dest == null) { throw new IllegalArgumentException( "The argument dest must not be null!"); } return copyDir(src.getCanonicalPath(), dest.getCanonicalPath(), null, null); } public static boolean copyDir(File src, File dest, Map filterSet) throws IOException { if (src == null) { throw new IllegalArgumentException( "The argument src must not be null!"); } if (dest == null) { throw new IllegalArgumentException( "The argument dest must not be null!"); } return copyDir(src.getCanonicalPath(), dest.getCanonicalPath(), null, filterSet, null, null); } public static boolean copyDir(File src, File dest, Pattern includePattern) throws IOException { if (src == null) { throw new IllegalArgumentException( "The argument src must not be null!"); } if (dest == null) { throw new IllegalArgumentException( "The argument dest must not be null!"); } if (includePattern == null) { throw new IllegalArgumentException( "The argument includePattern must not be null!"); } Pattern[] patterns = new Pattern[1]; patterns[0] = includePattern; return copyDir(src.getPath(), dest.getPath(), patterns, null, null, null); } public static boolean copyDir(File src, String dest, int index) throws IOException { if (src == null) { throw new IllegalArgumentException( "The argument src must not be null!"); } return copyDir(src.getCanonicalPath(), dest, index); } public static boolean copyDir(File src, String dest, int index, ProgressListener listener, String resourceString) throws IOException { if (src == null) { throw new IllegalArgumentException( "The argument src must not be null!"); } return copyDir(src.getCanonicalPath(), dest, index, listener, resourceString); } public static boolean copyDir(String src, String dest) throws IOException { return copyDir(src, dest, null, null, null, null); } public static boolean copyDir(String src, String dest, int index) throws IOException { return copyDir(src, dest, index, null, null); } /** * Die Methode copyDir kopiert das Verzeichnis mit einem Teil * seines übergeordneten Pfades in das angegebene Zielverzeichnis. * * @param src * String * @param dest * String * @param index * int * @exception IOException */ public static boolean copyDir(String src, String dest, int index, ProgressListener listener, String resourceString) throws IOException { String path = normalizePath(src); path = StringServices.chop(path, "/"); String name = getPathToken(path, index); if (name == null) { throw new FileNotFoundException(src); } for (int i = index; i > 0; i--) { name = getPathToken(path, i); dest = appendPath(dest, name); logger.debug("Anlegen des Verzeichnisses " + dest + "."); dest = normalizePath(dest); FileServices.createPath(dest); } return copyDir(src, dest, null, null, listener, resourceString); } public static boolean copyDir(String src, String dest, Map filterSet) throws IOException { return copyDir(src, dest, null, filterSet, null, null); } public static boolean copyDir(String src, String dest, Pattern[] includePatterns) throws IOException { return copyDir(src, dest, includePatterns, null, null, null); } /** * Die Methode copyDir kopiert ein Verzeichnis und seinen * Inhalt einschließlich aller Unterverzeichnissen. * * @param src * Der Parameter src enthält das Quellverzeichnis, * welches kopiert werden soll. Wird als Wert null * übergeben existiert das Verzeichnis nicht oder der angegebene * Pfad ist kein Verzeichnis, wird eine * IllegalArgumentException ausglöst. * * @param dest * Der Parameter dest enthält das Zielverzeichnis in * das kopiert werden soll. Wird als Wert null * übergeben oder ist der angegebene Pfad kein Verzeichnis, wird * eine IllegalArgumentException ausglöst. Falls das * Zielverzeichnis nicht existiert wird es angelegt. * * @exception IOException * Falls beim Kopieren ein Ein/Ausgabefehler auftritt. */ public static boolean copyDir(String src, String dest, Pattern[] includePatterns, Map filterSet, ProgressListener listener, String resourceString) throws IOException { String msg; src = normalizePath(src); dest = normalizePath(dest); logger.debug(src + " -> " + dest); if (src == null) { throw new IllegalArgumentException("Parameter src is null!"); } if (dest == null) { throw new IllegalArgumentException("Parameter dest is null!"); } File srcDir = new File(src); if (srcDir.exists() == false) { throw new FileNotFoundException("Source path '" + srcDir.getAbsolutePath() + "' dosen't exist!"); } if (srcDir.isDirectory() == false) { throw new IllegalArgumentException("Source path '" + srcDir.getAbsolutePath() + "' is not a directory!"); } File destDir = FileServices.createPath(dest); if (destDir.isDirectory() == false) { throw new IllegalArgumentException("Destination path '" + destDir.getAbsolutePath() + "' is not a directory!"); } src = normalizePath(srcDir.getCanonicalPath()); dest = normalizePath(destDir.getCanonicalPath()); File[] files = srcDir.listFiles(); File destFile; String destFileName; for (int i = 0; i < files.length; i++) { destFileName = appendFileName(dest, files[i].getName()); destFile = new File(destFileName); if (files[i].isDirectory()) { String newSrc = files[i].getCanonicalPath(); newSrc = normalizePath(newSrc); String newDest = StringServices.replace(newSrc, src, dest); copyDir(newSrc, newDest, includePatterns, filterSet, listener, resourceString); if (includePatterns != null) { File newDestDir = new File(newDest); if (newDestDir.list().length == 0) { delete(newDestDir); } } } if (includePatterns != null) { boolean doCopy = false; for (int p = 0; p < includePatterns.length; p++) { Matcher matcher = includePatterns[p].matcher(destFileName); if (matcher.matches() == true) { doCopy = true; break; } } if (doCopy == false) { continue; } } if (files[i].isFile()) { if (listener != null) { logger.debug("Firing progress event."); if (resourceString != null) { msg = MessageFormat.format(resourceString, files[i].getPath(), destFile.getPath()); } else { msg = files[i].getName(); } if (listener.progress(new ProgressEvent(msg, false)) == false) { return false; } } logger.debug(files[i].getAbsolutePath() + " -> " + destFile.getAbsolutePath()); if (filterSet == null || isBinary(files[i])) { FileInputStream in; FileOutputStream out; in = new FileInputStream(files[i]); out = new FileOutputStream(destFile); int n = 0; byte[] buffer = new byte[4096]; while ((n = in.read(buffer, 0, 4096)) != -1) { out.write(buffer, 0, n); } in.close(); out.flush(); out.close(); if (destFile.exists() == false) { throw new IOException("Couldn't create file " + destFileName + "!"); } if (destFile.length() != files[i].length()) { throw new IOException("Files differ after copy: " + destFileName + "!"); } } else { try { TemplateTransformer trafo = TemplateTransformer .newInstance(files[i]); trafo.transform(filterSet, destFile); } catch (TemplateTransformException oops) { IOException ioe = new IOException( "TemplateTransformException: " + oops.getMessage()); ioe.initCause(oops); ioe.fillInStackTrace(); throw ioe; } if (destFile.exists() == false) { throw new IOException("Couldn't create file " + destFileName + "!"); } } } } return true; } public static boolean copyDir(String src, String dest, ProgressListener listener, String resourceString) throws IOException { return copyDir(src, dest, null, null, listener, resourceString); } public static void copyFileToDir(File src, File destdir) throws IOException { copyFileToDir(src.getPath(), destdir.getPath()); } /** * Die Methode copyFileToDir kopiert eine einzelne Datei in das * angegebene Zielverzeichnis. * * Falls das Zielverzeichnis nicht existiert, wird es angelegt. * * Die Datei wird nur kopiert, falls die Quelldatei neuer als die Zieldatei * ist. * * @exception IOException * falls ein Fehler beim Kopieren auftritt. */ public static void copyFileToDir(String src, String destdir) throws IOException { File file; if (src == null) { throw new IllegalArgumentException("Parameter src is null!"); } file = new File(src); if (file.exists() == false) { throw new IllegalArgumentException("Parameter src (" + file.getAbsolutePath() + ") can not be found!"); } if (file.isFile() == false) { throw new IllegalArgumentException("Parameter src (" + file.getAbsolutePath() + ") is not a normal file!"); } if (destdir == null) { throw new IllegalArgumentException("Parameter destdir is null!"); } file = new File(destdir); if (file.exists() && file.isDirectory() == false) { throw new IllegalArgumentException("Parameter destdir (" + file.getAbsolutePath() + ") is not a directory!"); } File srcFile = new File(src); String path = appendFileName(destdir, srcFile.getName()); File destFile = new File(path); FileInputStream in; FileOutputStream out; in = new FileInputStream(srcFile); out = new FileOutputStream(destFile); int n = 0; byte[] buffer = new byte[4096]; while ((n = in.read(buffer, 0, 4096)) != -1) { out.write(buffer, 0, n); } in.close(); out.close(); } /** * Die Methode copyFileToFile kopiert eine einzelne Datei, * falls die Quelldatei neuer als die Zieldatei ist. * * Falls das Zielverzeichnis nicht existiert, wird es angelegt. * * @throws IOException * falls ein Fehler beim Kopieren auftritt. */ public static void copyFileToFile(File src, File dest) throws IOException { copyFileToFile(src.getAbsolutePath(), dest.getAbsolutePath(), null); } public static void copyFileToFile(File srcFile, File destFile, Map filterSet) throws IOException { if (srcFile == null) { throw new IllegalArgumentException("Parameter srcFile is null!"); } if (srcFile.exists() == false) { throw new IllegalArgumentException( "Parameter srcFile doesn't exist! '" + srcFile.getAbsolutePath() + "'"); } if (srcFile.isFile() == false) { throw new IllegalArgumentException( "Parameter srcFile is not a normal file! '" + srcFile.getAbsolutePath() + "'"); } if (destFile == null) { throw new IllegalArgumentException("Parameter destFile is null!"); } if (srcFile.exists() && srcFile.isFile() == false) { throw new IllegalArgumentException( "Parameter destFile is not a normal file! '" + srcFile.getAbsolutePath() + "'"); } if (srcFile.equals(destFile)) { return; } if (destFile.exists() == true && destFile.canWrite() == false) { throw new FileAccessDeniedException(destFile); } String srcPath = srcFile.getCanonicalPath(); srcPath = normalizePath(srcPath); String destPath = destFile.getCanonicalPath(); destPath = normalizePath(destPath); if (destPath.equals(srcPath)) { logger.warn("Copy: Files " + srcPath + " and " + destPath + " are identical!"); return; } String destParentDir = destFile.getParent(); if (destParentDir != null && destParentDir.length() > 0) { createPath(destParentDir); } if (filterSet == null || isBinary(srcFile)) { FileInputStream in; FileOutputStream out; in = new FileInputStream(srcFile); out = new FileOutputStream(destFile); int n = 0; byte[] buffer = new byte[4096]; while ((n = in.read(buffer, 0, 4096)) != -1) { out.write(buffer, 0, n); } in.close(); out.flush(); out.close(); } else { try { TemplateTransformer trafo = TemplateTransformer .newInstance(srcFile); trafo.transform(filterSet, destFile); } catch (TemplateTransformException oops) { IOException ioe = new IOException( "TemplateTransformException: " + oops.getMessage()); ioe.initCause(oops); ioe.fillInStackTrace(); throw ioe; } } } public static void copyFileToFile(String src, String dest) throws IOException { copyFileToFile(new File(src), new File(dest), null); } /** * Die Methode copyFileToFile kopiert eine einzelne Datei. * Falls das Zielverzeichnis nicht existiert, wird es angelegt. * * @throws IOException * falls ein Fehler beim Kopieren auftritt. */ public static void copyFileToFile(String src, String dest, Map filterSet) throws IOException { copyFileToFile(new File(src), new File(dest), filterSet); } public static File createParentDir(File dir) throws IOException { if (dir == null) { throw new IllegalArgumentException( "The argument dir must not be null!"); } File parentDir = dir.getParentFile(); if (parentDir == null) { return null; } return createPath(parentDir); } /** * Legt ein neues Verzeichnis an. * * Falls das Verzeichnis bereits existiert, wird dieses ohne Fehlermeldung * zurückgeliefert. Existiert das Verzeichnis nicht und das Anlegen schlägt * fehl wird eine Ausnahme erzeugt. * * Vorbedingung: Wird als dir-Parameter * null Übergeben, so wird eine * IllegalArgumentException ausgelöst. * * @exception IOException * falls das Anlegen des Verzeichnisses fehlschlägt. */ public static File createPath(File dir) throws IOException { if (dir == null) { throw new IllegalArgumentException( "The argument dir must not be null!"); } String dirName = dir.getCanonicalPath(); if (JvmServices.isWindows()) { if (dirName != null && dirName.length() > 255) { throw new CreatePathException(dirName, CreatePathException.PATH_TOO_LONG); } } if (dir.exists() == false) { if (dir.mkdirs() == false && dir.exists() == false) { ArrayList pathList = new ArrayList(); pathList.add(0, dir); File parent = dir.getParentFile(); File next = dir; while (parent != null && parent.exists() == false) { pathList.add(0, parent); next = parent; parent = parent.getParentFile(); } if (parent != null && parent.exists() == true) { if (parent.isDirectory() == false) { throw new CreatePathException(next.getCanonicalPath(), CreatePathException.FILE_PARENT); } if (parent.canWrite() == false || parent.canRead() == false) { throw new CreatePathException(next.getCanonicalPath(), CreatePathException.PERMISSION_DENIED); } } throw new CreatePathException(dir.getCanonicalPath()); } } return dir; } /** * Legt ein neues Verzeichnis an. * * Falls das Verzeichnis bereits existiert, wird dieses ohne Fehlermeldung * zurückgeliefert. Existiert das Verzeichnis nicht und das Anlegen schlägt * fehl wird eine Ausnahme erzeugt. * * Vorbedingung:Wird als path-Parameter * null übergeben, so wird eine * IllegalArgumentException ausgelöst. * * @throws IOException * falls das Anlegen des Verzeichnisses fehlschlägt. */ public static File createPath(String path) throws IOException { if (path == null) { throw new IllegalArgumentException("Parameter path is null!"); } return createPath(new File(path)); } public static File createUniqueFile(File file) throws IOException { if (file == null) { throw new IllegalArgumentException( "The argument file must not be null!"); } int index = 1; String fileBase; String fileExt; String path; fileBase = getFileBase(file.getCanonicalPath()); fileExt = getExtension(file.getCanonicalPath()); while (file.exists() == true) { path = fileBase + "-" + String.valueOf(index++); if (fileExt != null && fileExt.trim().length() > 0) { path += "." + fileExt; } file = new File(path); } return file; } public static String cutPrefixPathItems(String path, int length) { if (path == null) { throw new IllegalArgumentException( "The argument path must not be null!"); } if (length < 0) { throw new IllegalArgumentException( "The argument length must not be < 0!"); } String buffer = normalizePath(path); buffer = StringServices.cutPrefix(buffer, "/"); while (buffer.endsWith("/")) { buffer = StringServices.cutSuffix(buffer, "/"); } int index = buffer.indexOf("/"); int counter = 1; while (index > 0 && counter < length) { index = buffer.indexOf("/", index + 1); counter++; } return buffer.substring(index + 1); } public static int delete(File file) throws IOException { if (file == null) { return 0; } return delete(file.getPath(), null); } public static int delete(File file, ProgressListener listener) throws IOException { return delete(file.getPath(), listener, null); } /** * Die Methode delete löscht alle regulären Dateien aus dem * Verzeichnis, die auf den regulären Asudruck passen. * * @param dir * a File value * @param regexp * a String value * @return an int value * @exception IOException * if an error occurs */ public static int delete(File dir, String regexp) throws IOException { if (dir == null) { return 0; } ArrayList fileList = new ArrayList(); FindServices.findFile(dir, regexp, false, fileList); for (File file : fileList) { delete(file); } return fileList.size(); } /** * Die Methode delete löscht eine Datei oder ein Verzeichnis * und alle darin enthaltenen Dateien und Unterverzeichnisse. */ public static int delete(String path) throws IOException { return delete(path, null); } public static int delete(String path, ProgressListener listener) throws IOException { return delete(path, listener, null); } /** * Die Methode delete löscht eine Datei oder ein Verzeichnis * und alle darin enthaltenen Dateien und Unterverzeichnisse. */ public static int delete(String path, ProgressListener listener, String resourceString) throws IOException { return delete(new File(path), listener, resourceString); } /** * Die Methode delete löscht eine Datei oder ein * Verzeichnis und alle darin enthaltenen Dateien und Unterverzeichnisse. */ public static int delete(File node, ProgressListener listener, String resourceString) throws IOException { String msg; logger.debug("Lösche Pfad " + node + "."); if (node == null) { return 0; } boolean rc; int counter = 0; if (node.exists() == false) { logger.debug("Der Pfad " + node.getAbsolutePath() + " existiert nicht!"); return 0; } if (node.isFile() == true) { rc = node.delete(); if (rc == false) { throw new DeleteFileException(node); /* * if (JvmServices.isWindows()) { * * String[] cmd = new String[4]; cmd[0] = "del"; cmd[1] = "/F"; * cmd[2] = "/Q"; cmd[3] = node.getCanonicalPath(); * * ExecResult result = ExecServices.exec(cmd); * * if (result.getFailed()) { throw new * DeleteFileException(node); } * * } else if (JvmServices.isUnix()) { * * String[] cmd = new String[3]; cmd[0] = "rm"; cmd[1] = "-f"; * cmd[2] = node.getCanonicalPath(); * * ExecResult result = ExecServices.exec(cmd); * * if (result.getFailed()) { throw new * DeleteFileException(node); } * * } else { * * } */ } } if (node.isDirectory() == true) { File[] list = node.listFiles(); if (list != null) { for (int i = 0; i < list.length; i++) { if (list[i].isDirectory()) { counter += delete(list[i].getAbsolutePath(), listener, resourceString); } else { rc = list[i].delete(); if (rc == false) { throw new DeleteFileException(node); } } } } counter++; if (listener != null) { logger.debug("Firing progress event."); if (resourceString != null) { msg = MessageFormat.format(resourceString, node.getPath()); } else { msg = node.getName(); } listener.progress(new ProgressEvent(msg, false)); } rc = node.delete(); if (rc == false) { throw new DeleteFileException(node); } } if (node.exists() == true) { throw new DeleteFileException(node); } return counter; } /** * Die Methode delete löscht alle Dateien aus dem Verzeichnis * path die auf den Filter filter passen. * * Die Art des Filters wird durch den Filtertyp bestimmt. Der Typ kann den * Anfang oder das Ende eines Dateinamens überpüfen. * * Folgende Type können verwendet werden: *
    *
  • STARTS_WITH - Testet den Anfang des Dateinamens
  • *
  • ENDS_WITH - Testet das Ende des Dateinamens
  • *
  • ALL - Trifft auf alle Dateien zu
  • *
*/ public static void delete(String path, String filter, int type) { if (path == null) { return; } File dir = new File(path); if (dir.exists() == false) { return; } File[] list; switch (type) { case STARTS_WITH: list = dir.listFiles(new StartsWithFilter(filter)); break; case ENDS_WITH: list = dir.listFiles(new EndsWithFilter(filter)); break; case ALL: list = dir.listFiles(); break; default: return; } for (int i = 0; i < list.length; i++) { list[i].delete(); } } public static void deleteEmptyDirs(File dir) throws IOException { if (dir == null) { throw new IllegalArgumentException( "The argument dir must not be null!"); } File[] list = dir.listFiles(); for (int i = 0; i < list.length; i++) { if (list[i].isDirectory()) { deleteEmptyDirs(list[i]); if (list[i].list().length == 0) { delete(list[i]); } } } } public static void deleteEmptyDirs(String path) throws IOException { deleteEmptyDirs(new File(path)); } /** * Die Methode getAbsoluteDirName liefert das übergeordnete * Verzeichnis des angegebenen Pfades als absoluten Pfad. */ public static String getAbsoluteDirName(String filename) { if (filename == null) { throw new IllegalArgumentException("Parameter filename is null!"); } if (filename.length() == 0) { throw new IllegalArgumentException("Parameter filename is null!"); } File file = new File(filename); String path = file.getAbsolutePath(); int index = path.lastIndexOf(File.separator); if (index == -1) { return "."; } path = path.substring(0, index); return path; } /** * Die Methode getDirName liefert das übergeordnete Verzeichnis * des angegebenen Pfades. */ public static String getDirName(String fileName) { if (fileName == null) { throw new IllegalArgumentException("Parameter fileName is null!"); } if (fileName.length() == 0) { throw new IllegalArgumentException("Parameter fileName is null!"); } fileName = StringServices.chop(fileName, File.separator); int index = fileName.lastIndexOf(File.separator); if (index == -1) { return "."; } String path = fileName.substring(0, index); return path; } /** * Die Methode getExtension liefert die Dateinamenerweiterung * des angegebenen Pfadnamens. * * Die Dateinamenerweiterung muß mit einem Punkt vom Rest getrennt sein. Der * Punkt wird nicht mit zurückgeliefert. */ public static String getExtension(String filename) { if (filename == null) { throw new IllegalArgumentException("Parameter filename is null!"); } // strip any directory information filename = getFileName(filename); int index = filename.lastIndexOf("."); if (index == -1) { return ""; } filename = filename.substring(index + 1); return filename; } public static String getFileBase(File file) { if (file == null) { throw new IllegalArgumentException( "The argument file must not be null!"); } return getFileBase(file.getPath()); } /** * Die Methode getFileBase liefert den Pfadnamen ohne * Dateinamenerweiterung. * * Als Dateinamenerweiterung wird der letzte Teil eines Pfadnamens * angesehen, der mit einem Punkt vom Rest abgetrennt ist. * * Falls der Pfad Verzeichnisse enthält werden diese nicht entfernt. Um den * letzten Teil der Pfadangabe zu erhalten kann die Methode * getFileName verwendet werden. * *
*

* Der Pfad /tmp/file.txt wird zu /tmp/file. *

* */ public static String getFileBase(String fileName) { if (fileName == null) { throw new IllegalArgumentException("Parameter fileName is null!"); } int index = fileName.lastIndexOf("."); if (index == -1) { return fileName; } fileName = fileName.substring(0, index); return fileName; } /** * Die Methode getFileName liefert den letzten Teil einer * Pfadangabe, üblicherweise einen Dateinamen. */ public static String getFileName(String path) { if (path == null) { throw new IllegalArgumentException("Parameter path is null!"); } path = normalizePath(path); path = StringServices.chop(path, "/"); File file = new File(path); return file.getName(); } public static String getMimeType(String fileName) { if (fileName == null) { throw new IllegalArgumentException( "The argument fileName must not be null!"); } String type = null; String[] cmd = new String[5]; cmd[0] = "file"; cmd[1] = "-b"; cmd[2] = "-p"; cmd[3] = "-i"; cmd[4] = fileName; ExecResult result = ExecServices.exec(cmd); type = result.getOutput(); type = StringServices.trim(type, Sfv.LSEP); type = StringServices.trim(type, ' '); if (result.failed() == false && type != null && type.length() > 0) { logger.debug("(file -b -pi -i " + fileName + ") -e type=" + type); return type; } String name = FileServices.getFileName(fileName.toLowerCase()); name = StringServices.cutSuffix(name, ",v"); FileNameMap fnm = URLConnection.getFileNameMap(); type = fnm.getContentTypeFor(name); if (type != null && type.trim().length() > 0) { logger.debug("(FileNameMap " + name + ") type=" + type); return type; } String ext = FileServices.getExtension(name); MimeType mimeType = MimeType.findByExtension(ext); if (mimeType != null) { logger.debug("(MimeType " + name + ") type=" + mimeType.getMimeType()); return mimeType.getMimeType(); } File file = new File(fileName); boolean nullByte = false; if (file.exists() && file.canRead()) { FileReader reader = null; try { reader = new FileReader(file); int c = reader.read(); while (c != -1) { c = reader.read(); if (c == 0) { nullByte = true; break; } } } catch (Throwable oops) { logger.fatal("FileServices.isBinary", oops); } finally { try { if (reader != null) { reader.close(); } } catch (IOException oops) { logger.fatal("FileServices.isBinary reader.close() ", oops); } } } if (nullByte == true) { logger.debug("(No MimeType Found, Null Byte) " + name + ") type=application/octet-stream"); return "application/octet-stream"; } else { logger.debug("(No MimeType Found " + name + ") type=text/plain"); return "text/plain"; } } public static String getPathHead(String path, int length) { if (path == null) { throw new IllegalArgumentException( "The argument path must not be null!"); } if (length < 0) { throw new IllegalArgumentException( "The argument length must not be < 0!"); } path = normalizePath(path); String subPath = path; int index = path.indexOf("/"); int counter = 0; while (index > 0 && counter < length) { index = path.indexOf("/", index + 1); counter++; } if (index > 0) { subPath = path.substring(0, index); } return subPath; } public static String getPathTail(String path, int length) { if (path == null) { throw new IllegalArgumentException( "The argument path must not be null!"); } if (length < 0) { throw new IllegalArgumentException( "The argument length must not be < 0!"); } path = StringServices.replace(path, FSEP, "/"); String subPath = path; int index = path.lastIndexOf("/"); int counter = 1; while (index > 0 && counter < length) { index = path.lastIndexOf("/", index - 1); counter++; } if (index > 0) { subPath = path.substring(index + 1); } return subPath; } /** * Die Methode getPathToken liefert einen bestimmenten Teil * eines Pfades. * * Der Pfad wird von hinten nach vorne beginnend mit der Ziffer 1 * durchnummeriert. * * @param path * String * @param index * int * @return String */ public static String getPathToken(String path, int index) { if (index == 0) return ""; if (path == null) { throw new IllegalArgumentException( "The argument path must not be null!"); } if (index < 0) { throw new IllegalArgumentException( "The argument index must not be < 0!"); } String buffer = normalizePath(path); buffer = StringServices.chop(buffer, "/"); logger.debug("buffer = " + buffer); int indexStart = buffer.length(); int indexEnd = indexStart; for (int i = 0; i < index; i++) { indexEnd = indexStart; indexStart = buffer.lastIndexOf('/', indexStart - 1); logger.debug("start = " + indexStart + ", end = " + indexEnd); if (indexStart == -1) { return null; } } String token = buffer.substring(indexStart + 1, indexEnd); logger.debug("path token [" + index + "] = '" + token + "'."); return token; } public static int getPathTokenCount(String path) { logger.debug("#1 path=" + path); if (path == null || path.trim().length() == 0) { return 0; } path = normalizePath(path); path = StringServices.trim(path, '/'); logger.debug("#2 path=" + path); int index = path.indexOf("/"); logger.debug("index=" + index); int counter = 1; while (index > 0) { index = path.indexOf("/", index + 1); logger.debug("index=" + index); counter++; } logger.debug("counter=" + counter); return counter; } public static String getValueOfKey(File file, String key) throws IOException { if (file == null) { throw new IllegalArgumentException( "The argument file must not be null!"); } if (key == null) { throw new IllegalArgumentException( "The argument key must not be null!"); } key = key.trim(); if (key.endsWith("=") == false) { key += "="; } BufferedReader reader = null; try { reader = new BufferedReader(new FileReader(file)); String line; while ((line = reader.readLine()) != null) { if (line.startsWith(key) == true) { if (line.length() <= key.length()) { return ""; } else { return line.substring(key.length() + 1); } } } return ""; } finally { try { if (reader != null) { reader.close(); } } catch (IOException ioe) { ioe.printStackTrace(); } } } public static boolean hasSubdirectory(File dir, String name) { if (dir == null) { return false; } if (name == null || name.length() == 0) { return false; } String[] listing = dir.list(); if (listing == null) { return false; } for (int i = 0; i < listing.length; i++) { if (name.equals(listing[i])) { return true; } } return false; } public static String info(File file) throws IOException { if (file == null) { throw new IllegalArgumentException( "The argument file must not be null!"); } StringBuffer buffer = new StringBuffer(); buffer.append("path=" + file.getCanonicalPath()); if (file.exists() == false) { buffer.append(",exists=false"); return buffer.toString(); } buffer.append(",size=" + file.length()); return buffer.toString(); } /** * Liefert true, falls die Zeichenkette einen absoluten Pfad * repräsentiert. */ public static boolean isAbsolutePath(String path) { if (path == null) { throw new IllegalArgumentException( "The argument path must not be null!"); } String buffer = new String(path); buffer = StringServices.replace(buffer, File.separator, "/"); buffer = buffer.toLowerCase(); if (buffer.startsWith("/")) { return true; } if (JvmServices.isWindows()) { if (PATTERN_ABSOLUTE_WINDOWS_PATH.matcher(buffer).matches()) { return true; } } return false; } public static boolean isBinary(File file) { if (file == null) { throw new IllegalArgumentException( "The argument file must not be null!"); } return isBinary(file.getAbsolutePath()); } public static boolean isBinary(String fileName) { if (fileName == null) { throw new IllegalArgumentException( "The argument fileName must not be null!"); } String mimeType = getMimeType(fileName); logger.debug("mimeType=" + mimeType); if (mimeType.startsWith("image/")) { return true; } if (mimeType.startsWith("video/")) { return true; } if (mimeType.startsWith("audio/")) { return true; } if (mimeType.equals("application/octet-stream") || mimeType.equals("application/pdf") || mimeType.equals("application/postscript") || mimeType.equals("application/x-cpio") || mimeType.equals("application/x-dvi") || mimeType.equals("application/x-gtar") || mimeType.equals("application/x-tar") || mimeType.equals("application/x-ustar") || mimeType.equals("application/x-troff-msvideo") || mimeType.equals("application/zip")) { return true; } File file = new File(fileName); boolean nullByte = false; if (file.exists() && file.canRead()) { FileReader reader = null; try { reader = new FileReader(file); int c = reader.read(); while (c != -1) { c = reader.read(); if (c == 0) { nullByte = true; break; } } } catch (Throwable oops) { logger.fatal("FileServices.isBinary", oops); } finally { try { if (reader != null) { reader.close(); } } catch (IOException oops) { logger.fatal("FileServices.isBinary reader.close() ", oops); } } } if (nullByte == true) { return true; } return false; } public static boolean isEmptyDirectory(File file) { if (file.isDirectory() == false) { return false; } File[] list = file.listFiles(); if (list.length == 0) { return true; } else { return false; } } /** * Die Methode move verschiebt eine Datei in ein anderes * Verzeichnis. */ public static void move(String src, String destdir) throws IOException { if (src == null) { throw new IllegalArgumentException( "The argument src must not be null!"); } if (destdir == null) { throw new IllegalArgumentException( "The argument destdir must not be null!"); } File srcFile = new File(src); File destFile = new File(destdir + File.separator + srcFile.getName()); if (srcFile.equals(destFile)) { return; } boolean rc = srcFile.renameTo(destFile); if (rc == false) { throw new RenameFileException(srcFile, destFile); } } /** * Die Methode newer vergleicht ob die 1. Datei neuer als die * 2, Datei ist. Falls die 2. Datei nicht existiert wird true zurückgegeben. */ public static boolean newer(File f1, File f2) { if (f1 == null || f1.exists() == false) { return false; } if (f2 == null || f2.exists() == false) { return true; } if (f1.lastModified() >= f2.lastModified()) { return true; } else { return false; } } /** * Die Methode newer vergleicht 2 Dateien oder Verzeichnisse * bezüglich des Datums ihrer letzten Änderung. * * Requires: Beide Dateien/Verzeichnisse müssen existieren. */ public static boolean newer(String f1, String f2) { return newer(new File(f1), new File(f2)); } /** * Die Methode normalizePath konvertiert den angegegebenen Pfad * in ein Standardformat. * *
    *
  1. Weißraum am Anfang oder Ende der Zeichenkette wird entfernt.
  2. *
  3. Alle betriebssystemspezifischen Trennzeichen werden in einen * Schrägstrich umgewandelt.
  4. *
  5. Falls der Pfad einen absoluten Pfad repäsentiert, werden redundante * Angaben bereinigt, z.B. /C:/temp wird zu * C:/temp.
  6. *
      * * @param path * String * @return String */ public static String normalizePath(String path) { if (path == null) { throw new IllegalArgumentException( "The argument path must not be null!"); } path = new String(path); File file = new File(path); path = path.trim(); path = StringServices.replace(path, File.separator, "/"); while (isAbsolutePath(path) && path.length() > 1) { String buffer = path.substring(1); if (isAbsolutePath(buffer)) { path = buffer; } else { break; } } if (isAbsolutePath(path)) { path = StringServices.lowerFirstLetter(path); } if (file.exists() && file.isDirectory() && path.endsWith("/") == false) { path += "/"; } return path; } /** * Die Methode pkgToPath wandelt den Namen eines Java Packages * in einen Verzeichnispfad um. */ public static String pkgToPath(String pkg) { if (pkg == null) { throw new IllegalArgumentException( "The argument pkg must not be null!"); } String path = StringServices.replace(pkg, ".", File.separator); return path; } public static String readLine(File file, int lineIndex) throws IOException { if (file == null) { throw new IllegalArgumentException( "The argument file must not be null!"); } if (lineIndex < 0) { throw new IllegalArgumentException( "The argument lineIndex must not be < 0!"); } int count = 0; if (file != null && file.exists()) { BufferedReader reader = new BufferedReader(new FileReader(file)); String line = reader.readLine(); while (line != null) { if (count == lineIndex) { reader.close(); return line; } line = reader.readLine(); count++; } reader.close(); } return null; } public static Object[] readToArray(File file) throws IOException { return readToArray(file, "UTF-8"); } public static Object[] readToArray(File file, String encoding) throws IOException { if (file == null) { throw new IllegalArgumentException( "The argument file must not be null!"); } if (encoding == null) { throw new IllegalArgumentException( "The argument encoding must not be null!"); } BufferedReader reader = new BufferedReader(new InputStreamReader( new FileInputStream(file), encoding)); Object[] array = null; try { ArrayList list = new ArrayList(); String line = reader.readLine(); while (line != null) { list.add(line); line = reader.readLine(); } int index = 0; array = new Object[list.size()]; Iterator iterator = list.iterator(); while (iterator.hasNext()) { line = iterator.next(); array[index++] = line; } } finally { reader.close(); } return array; } public static byte[] readToByteArray(File file) throws IOException { if (file == null) { return null; } if (file.exists() == false) { return null; } FileInputStream fis = new FileInputStream(file); int off = 0; long fileLength = file.length(); if (fileLength > Integer.MAX_VALUE) { logger.error("The file is too big (>" + Integer.MAX_VALUE + ")!"); fis.close(); return null; } int length = (int) fileLength; int size = length; byte[] buffer = new byte[length]; int count; try { while ((count = fis.read(buffer, off, size)) != -1) { off += count; if ((length - off) < size) { size = length - off; if (size < 1) { break; } } if (off < 0) { logger.error("Argument off must not be negative: off=" + off + ", count=" + count + ", len=" + size + ", b.length=" + length); } if (size < 0) { logger.error("Argument len must not be negative: off=" + off + ", count=" + count + ", len=" + size + ", b.length=" + length); } if (size > (length - off)) { logger.error("Argument len must not be negative: off=" + off + ", count=" + count + ", len=" + size + ", b.length=" + length); } } } finally { fis.close(); } return buffer; } public static String readToString(File file) throws IOException { if (file == null) { throw new IllegalArgumentException( "The argument file must not be null!"); } return readToString(file, "UTF-8"); } public static String readToString(File file, String encoding) throws IOException { if (file == null) { throw new IllegalArgumentException( "The argument file must not be null!"); } FileInputStream fis = new FileInputStream(file); String buffer = readToString(fis, encoding); fis.close(); return buffer; } public static String readToString(InputStream is) throws IOException { return readToString(is, "UTF-8"); } public static String readToString(InputStream is, String encoding) throws IOException { if (is == null) { throw new IllegalArgumentException( "The argument is must not be null!"); } if (encoding == null) { throw new IllegalArgumentException( "The argument encoding must not be null!"); } BufferedReader reader = new BufferedReader(new InputStreamReader(is, encoding)); StringBuffer buffer = new StringBuffer(); char[] data = new char[4096]; int count; try { while ((count = reader.read(data)) > 0) { buffer.append(data, 0, count); } } finally { reader.close(); } return buffer.toString(); } public static String readToString(String fileName) throws IOException { if (fileName == null) { throw new IllegalArgumentException( "The argument fileName must not be null!"); } return readToString(new File(fileName), "UTF-8"); } public static String readToString(String fileName, String encoding) throws IOException { if (fileName == null) { throw new IllegalArgumentException( "The argument fileName must not be null!"); } return readToString(new File(fileName), encoding); } /** * Die Methode relativePath ermittelt den relativen Pfad um vom * Verzeichnis start zum Verzeichnis dest zu * gelangen. Falls kein relativer Pfad ermittelt werden kann wird der * absolute Pfad von dest zurückgeliefert. * * Werden relative Pfade übergeben, so werden diese mit Hilfe der Methode * {@link File#getCanonicalFile()} in absolute PFade umgewandelt. Diese * Methode ermittelt Pfad anscheinend anhand des Rückgabewertes von * System.getProperty("user.dir"). Der Wert ist also nicht * vohersagbar und ist abhängig vom aktuellen Arbeitsverzeichnis. * * @throws IOException */ public static String relativePath(File start, File dest) throws IOException { if (start == null) { throw new IllegalArgumentException( "The argument start must not be null!"); } if (dest == null) { throw new IllegalArgumentException( "The argument dest must not be null!"); } File from = new File(start.getCanonicalPath()); File to = new File(dest.getCanonicalPath()); logger.debug("Berechne relativen Pfad von " + from + " zu " + to + ".\n"); if (from.equals(to)) { return "."; } File file = to; String downPath = ""; String upPath = ""; String relativePath; String path1; String path2; String str; File fromParent = from; if (fromParent.isFile() == true) { fromParent = fromParent.getParentFile(); } while (fromParent != null) { path1 = fromParent.getCanonicalPath() + File.separator; path2 = to.getCanonicalPath(); logger.debug("path1 = " + path1); logger.debug("path2 = " + path2); if (path2.startsWith(path1)) { str = StringServices.cutPrefix(path2, path1); if (downPath.length() == 0) { downPath = "." + File.separator; } str = appendPath(downPath, str); relativePath = StringServices.chop(str, File.separator); return relativePath; } downPath += ".." + File.separator; if (file != null) { upPath = file.getName() + File.separator + upPath; } fromParent = fromParent.getParentFile(); if (fromParent.getParent() == null) { break; } if (file != null) { file = file.getParentFile(); } } return dest.getCanonicalPath(); } public static String removeParentPath(File dir, File parentDir) throws IOException { if (dir == null) { throw new IllegalArgumentException( "The argument dir must not be null!"); } if (parentDir == null) { throw new IllegalArgumentException( "The argument parentDir must not be null!"); } String parentPath = parentDir.getCanonicalPath(); if (parentPath.endsWith(Sfv.FSEP) == false) { parentPath += Sfv.FSEP; } return removeParentPath(dir.getCanonicalPath(), parentPath); } public static String removeParentPath(String path, String parentPath) { if (path == null) { throw new IllegalArgumentException( "The argument path must not be null!"); } if (parentPath == null) { throw new IllegalArgumentException( "The argument parentPath must not be null!"); } path = normalizePath(path); parentPath = normalizePath(parentPath); logger.debug("path=" + path); logger.debug("parentPath=" + parentPath); path = StringServices.cutPrefix(path, parentPath); return path; } public static void rename(File srcFile, File destFile) throws IOException { if (srcFile == null) { throw new IllegalArgumentException( "The argument srcFile must not be null!"); } if (destFile == null) { throw new IllegalArgumentException( "The argument destFile must not be null!"); } if (srcFile.equals(destFile)) { logger.warn("Source file " + srcFile + " is identical to destination file."); return; } boolean rc = srcFile.renameTo(destFile); if (rc == true) { return; } if (srcFile.isDirectory() == true) { copyDir(srcFile, destFile); delete(srcFile); return; } throw new RenameFileException(srcFile, destFile); } /** * Die Methode replaceExtension ersetzt die * Dateinamenserweiterung. */ public static String replaceExtension(File file, String extension) { return replaceExtension(file.getPath(), extension); } /** * Die Methode replaceExtension ersetzt die * Dateinamenserweiterung. */ public static String replaceExtension(String fileName, String extension) { if (fileName == null) { throw new IllegalArgumentException( "The argument fileName must not be null!"); } if (extension == null) { throw new IllegalArgumentException( "The argument extension must not be null!"); } String base = getFileBase(fileName); return base + extension; } public static boolean setReadOnly(File file) { if (file == null || file.exists() == false) { return false; } String[] cmd = null; ExecResult result = null; try { if (JvmServices.isUnix()) { if (file.isDirectory()) { cmd = new String[7]; cmd[0] = "find"; cmd[1] = file.getCanonicalPath(); cmd[2] = "-exec"; cmd[3] = "chmod"; cmd[4] = "a-w"; cmd[5] = "{}"; cmd[6] = ";"; } else { cmd = new String[3]; cmd[0] = "chmod"; cmd[1] = "a-w"; cmd[2] = file.getCanonicalPath(); } } if (JvmServices.isWindows()) { cmd = new String[4]; cmd[0] = "attrib"; cmd[1] = "+r"; cmd[2] = "+h"; cmd[3] = file.getCanonicalPath(); if (file.isDirectory()) { result = ExecServices.exec(cmd); if (result.failed() == true) { IOException oops = new IOException(result.toString()); throw oops; } cmd = new String[6]; cmd[0] = "attrib"; cmd[1] = "+r"; cmd[2] = "+h"; cmd[3] = file.getCanonicalPath() + "\\*.*"; cmd[4] = "/S"; cmd[5] = "/D"; } } if (cmd == null) { logger.error("Operating System '" + JvmServices.getOperatingSystem() + "' is not supported!"); return false; } logger.debug("Executing command '" + StringServices.arrayToString(cmd) + "'..."); result = ExecServices.exec(cmd); if (result.failed() == true) { logger.error(result.toString()); return false; } } catch (IOException oops) { logger.fatal( "setReadOnly failed! (" + StringServices.arrayToString(cmd) + ")", oops); return false; } return true; } public static boolean setReadOnly(String path) { if (path == null) { return false; } return setReadOnly(new File(path)); } /** * Die Methode setWritable setzt die Berechtigung Datei oder * das Verzeichnis auf schreibbar. Falls eine Verzeichnis angegeben wurde, * werden auch alle darin enthaltenen Dateien und Unterverzeichnisse * bearbeitet. * * setWritable verwendet Kommandos des Betriebssystems um die * Berechtigungen zu ändern. Unter Windows wird das Kommando * attrib aufgerufen und zusätzlich das Attribut * hidden zurückgesetzt. * * @param file * File */ public static boolean setWritable(File file) { if (file == null || file.exists() == false) { return false; } String[] cmd = null; ExecResult result = null; try { if (JvmServices.isUnix()) { if (file.isDirectory()) { cmd = new String[7]; cmd[0] = "find"; cmd[1] = file.getCanonicalPath(); cmd[2] = "-exec"; cmd[3] = "chmod"; cmd[4] = "a+w"; cmd[5] = "{}"; cmd[6] = ";"; } else { cmd = new String[3]; cmd[0] = "chmod"; cmd[1] = "a+w"; cmd[2] = file.getCanonicalPath(); } } if (JvmServices.isWindows()) { cmd = new String[4]; cmd[0] = "attrib"; cmd[1] = "-r"; cmd[2] = "-h"; cmd[3] = file.getCanonicalPath(); if (file.isDirectory()) { result = ExecServices.exec(cmd); if (result.failed() == true) { IOException oops = new IOException(result.toString()); throw oops; } cmd = new String[6]; cmd[0] = "attrib"; cmd[1] = "-r"; cmd[2] = "-h"; cmd[3] = file.getCanonicalPath() + "\\*.*"; cmd[4] = "/S"; cmd[5] = "/D"; } } if (cmd == null) { logger.error("Operating System '" + JvmServices.getOperatingSystem() + "' is not supported!"); return false; } logger.debug("Executing command '" + StringServices.arrayToString(cmd) + "'..."); result = ExecServices.exec(cmd); if (result.failed() == true) { logger.error(result.toString()); return false; } } catch (IOException oops) { logger.fatal( "setWritable failed! (" + StringServices.arrayToString(cmd) + ")", oops); return false; } return true; } public static boolean setWritable(File file, String caller) { logger.debug("Caller of setWritable is '" + caller + "'."); return setWritable(file); } public static boolean setWritable(String path) { if (path == null) { return false; } return setWritable(new File(path)); } public static boolean setWritable(String path, String caller) { logger.debug("Caller of setWritable is '" + caller + "'."); return setWritable(path); } public static void sort(File file) throws IOException { if (file == null) { throw new IllegalArgumentException( "The argument file must not be null!"); } Object[] array = readToArray(file); Arrays.sort(array); writeFromArray(file, array); } public static void touch(File file) throws IOException { writeFromString(file, String.valueOf(System.currentTimeMillis())); } public static void touch(String fileName) throws IOException { if (fileName == null) { throw new IllegalArgumentException( "The argument fileName must not be null!"); } touch(new File(fileName)); } public static String toWindowsPath(String path) { if (path == null) { throw new IllegalArgumentException( "The argument path must not be null!"); } String winPath = path; Pattern winDrivePattern = Pattern.compile("^/[a-cA-Z]:/"); Matcher matcher = winDrivePattern.matcher(winPath); if (matcher.lookingAt()) { winPath = winPath.substring(1); } winPath = winPath.trim(); winPath = StringServices.replace(winPath, "/", "\\"); return winPath; } /** * This method corrects the path regarding the used operating system. * Windows "\" and Linux "/" * * @param in * the string representing the path * @return out the corrected string representing the path */ public static String correctPathSeperator(String in) { String os = System.getProperty("os.name"); in = FileServices.normalizePath(in); if (os.toLowerCase().contains("windows")) { in = toWindowsPath(in); return in; } return in; } public static void traverse(File dir, FileVisitor visitor) { if (dir == null || dir.exists() == false || visitor == null) { return; } for (File file : dir.listFiles()) { visitor.visit(file); } File[] subdirs = dir.listFiles(new DirectoryFilter()); if (subdirs != null) { for (File subdir : subdirs) { traverse(subdir, visitor); } } } public static void write(File file, InputStream instr) throws IOException { if (file == null) { throw new IllegalArgumentException( "The argument file must not be null!"); } if (instr == null) { throw new IllegalArgumentException( "The argument instr must not be null!"); } File parent = file.getParentFile(); if (parent != null) { createPath(parent); } FileOutputStream out = new FileOutputStream(file); int n = 0; byte[] buffer = new byte[4096]; while ((n = instr.read(buffer, 0, 4096)) != -1) { out.write(buffer, 0, n); } out.flush(); out.close(); } public static void writeFromArray(File file, Object[] array) throws IOException { writeFromArray(file, array, "UTF-8"); } public static void writeFromArray(File file, Object[] array, String encoding) throws IOException { if (file == null) { throw new IllegalArgumentException( "The argument file must not be null!"); } if (array == null) { throw new IllegalArgumentException( "The argument array must not be null!"); } if (encoding == null) { throw new IllegalArgumentException( "The argument encoding must not be null!"); } PrintWriter writer = new PrintWriter(new OutputStreamWriter( new FileOutputStream(file), encoding)); try { for (int i = 0; i < array.length; i++) { writer.println(array[i]); } } finally { writer.close(); } } public static void writeFromByteArray(File file, byte[] buffer) throws IOException { if (file == null) { throw new IllegalArgumentException( "The argument file must not be null!"); } if (buffer == null) { throw new IllegalArgumentException( "The argument buffer must not be null!"); } FileOutputStream out = new FileOutputStream(file); out.write(buffer); out.close(); } public static void writeFromStream(String fileName, InputStream instr) throws IOException { if (fileName == null) { throw new IllegalArgumentException( "The argument fileName must not be null!"); } if (instr == null) { throw new IllegalArgumentException( "The argument instr must not be null!"); } FileOutputStream out = new FileOutputStream(fileName); int n = 0; byte[] buffer = new byte[4096]; while ((n = instr.read(buffer, 0, 4096)) != -1) { out.write(buffer, 0, n); } out.close(); } public static void writeFromString(File file, String str) throws IOException { writeFromString(file, str, "UTF-8"); } /* * Die Methode schreibt einen String in eine Datei * * @param File die Datei in die geschrieben wird * * @param String der zu schreibende String * * @param String die zu benutzende Zeichenkodierung (Standard UTF-8) */ public static void writeFromString(File file, String str, String encoding) throws IOException { if (file == null) { throw new IllegalArgumentException( "The argument file must not be null!"); } File parent = file.getParentFile(); if (parent != null && parent.exists() == false) { createPath(parent); } FileOutputStream fos = new FileOutputStream(file); writeFromString(fos, str, encoding); fos.close(); } public static void writeFromString(OutputStream os, String str) throws IOException { writeFromString(os, str, "UTF-8"); } public static void writeFromString(OutputStream os, String str, String encoding) throws IOException { if (os == null) { throw new IllegalArgumentException( "The argument os must not be null!"); } if (str == null) { throw new IllegalArgumentException( "The argument str must not be null!"); } if (encoding == null) { throw new IllegalArgumentException( "The argument encoding must not be null!"); } PrintWriter writer = new PrintWriter(new OutputStreamWriter(os, encoding)); try { writer.print(str); } finally { writer.close(); } } public static void writeFromString(String fileName, String str) throws IOException { if (fileName == null) { throw new IllegalArgumentException( "The argument fileName must not be null!"); } writeFromString(new File(fileName), str); } public static void writeFromString(String fileName, String str, String encoding) throws IOException { if (fileName == null) { throw new IllegalArgumentException( "The argument fileName must not be null!"); } writeFromString(new File(fileName), str, encoding); } } src/java/org/dbdoclet/service/UnicodeServices.java0000644000175000017500000000747712644165236022434 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.service; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * Die Klasse UnicodeServices stellt eine Sammlung statischer * Methoden zur Bearbeitung von Unicode zur Verfügung. * * @author Michael Fuchs * @version 1.0 */ public class UnicodeServices { private static Pattern pattern = Pattern.compile("\\\\u[0-9a-fA-F]{4}"); public static String escape(char c) { char[] v = new char[1]; v[0] = c; return escape(new String(v)); } /** * Die Methode escape wandelt die Zeichenkette * str in eine 7-bit ASCII Darstellung um. * * @param str String * @return String */ public static String escape(String str) { if (str == null) { return ""; } StringBuffer buffer = new StringBuffer(); for (int i = 0; i < str.length(); i++) { char c = str.charAt(i); int n = c; if (c == '\r') { continue; } if (n >= 0 && n < 128 && c != '\n' && c != '\\') { buffer.append(c); } else { buffer.append("\\u"); String hex = Integer.toHexString(n); for (int j = 0; j < 4 - hex.length(); j++) { buffer.append("0"); } buffer.append(hex); } } return buffer.toString(); } public static String unescape(String str) { Matcher matcher = pattern.matcher(str); char[] c = new char[1]; String escape; String buffer; String part1; String part2; while (matcher.find()) { escape = matcher.group(); c[0] = (char) Integer.parseInt(escape.substring(2), 16); buffer = new String(c); // System.out.println("buffer = " + buffer); part1 = str.substring(0, matcher.start()); // System.out.println("part1 = " + part1); part2 = str.substring(matcher.end()); // System.out.println("part2 = " + part2); str = part1 + buffer + part2; // System.out.println("str = " + str); matcher.reset(str); } return str; } public static String removeUndefinedCharacters(String text) { if (text == null || text.length() == 0) { return ""; } StringBuffer textBuffer = new StringBuffer(text); StringBuffer buffer = new StringBuffer(); char c; for (int i = 0; i < textBuffer.length(); i++) { c = textBuffer.charAt(i); if (c == '\n' || c == '\t') { buffer.append(c); continue; } if (Character.isISOControl(c) == false && Character.isDefined(c) == true) { buffer.append(c); } } return buffer.toString(); } } src/java/org/dbdoclet/service/ReplaceServices.java0000644000175000017500000001230712644165236022405 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.service; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; import java.io.StringReader; import java.io.StringWriter; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.dbdoclet.ServiceException; public class ReplaceServices { public static String replaceAll(String buffer, String regexp, String subst) { if (buffer == null) { throw new IllegalArgumentException("The argument buffer must not be null!"); } if (regexp == null) { throw new IllegalArgumentException("The argument regexp must not be null!"); } if (subst == null) { throw new IllegalArgumentException("The argument subst must not be null!"); } Pattern pattern = Pattern.compile(regexp); Matcher matcher = pattern.matcher(buffer); return matcher.replaceAll(subst); } public static String replaceLines(String buffer, String regexp, String subst) throws IOException, ServiceException { if (buffer == null) { throw new IllegalArgumentException("The argument buffer must not be null!"); } if (regexp == null) { throw new IllegalArgumentException("The argument regexp must not be null!"); } if (subst == null) { throw new IllegalArgumentException("The argument subst must not be null!"); } BufferedReader reader = null; PrintWriter writer = null; StringWriter out = new StringWriter(); try { Pattern pattern = Pattern.compile(regexp); Matcher matcher; reader = new BufferedReader(new StringReader(buffer)); writer = new PrintWriter(out); String line; while ((line = reader.readLine()) != null) { matcher = pattern.matcher(line); if (matcher.find()) { writer.println(subst); } else { writer.println(line); } } reader.close(); writer.close(); return out.toString(); } catch (Exception oops) { throw new ServiceException(oops); } finally { try { if (reader != null) { reader.close(); } if (writer != null) { writer.close(); } } catch (IOException ioe) { ioe.printStackTrace(); } } } public static void replaceLines(File file, String regexp, String subst) throws IOException, ServiceException { if (file == null) { throw new IllegalArgumentException("The argument file must not be null!"); } if (regexp == null) { throw new IllegalArgumentException("The argument regexp must not be null!"); } if (subst == null) { throw new IllegalArgumentException("The argument subst must not be null!"); } PrintWriter writer = null; BufferedReader reader = null; try { Pattern pattern = Pattern.compile(regexp); Matcher matcher; File tmpFile = File.createTempFile("rsrl",".tmp"); writer = new PrintWriter(new FileWriter(tmpFile)); reader = new BufferedReader(new FileReader(file)); String line; while ((line = reader.readLine()) != null) { matcher = pattern.matcher(line); if (matcher.find()) { writer.println(subst); } else { writer.println(line); } } reader.close(); writer.close(); if (file.exists()) { file.delete(); } FileServices.copyFileToFile(tmpFile, file); } catch (Exception oops) { throw new ServiceException(oops); } finally { try { if (reader != null) { reader.close(); } if (writer != null) { writer.close(); } } catch (IOException ioe) { ioe.printStackTrace(); } } } } src/java/org/dbdoclet/service/FileVisitor.java0000644000175000017500000000151612644165236021565 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.service; import java.io.File; public interface FileVisitor { public void visit(File file); } src/java/org/dbdoclet/service/ExecResult.java0000644000175000017500000000564612644165236021421 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.service; import java.io.PrintWriter; import java.io.StringWriter; public class ExecResult { private Process process; private String command; private StringBuffer output; private Throwable oops; private int exitCode = -1; public ExecResult() { output = new StringBuffer(); oops = null; } public void setCommand(String command) { this.command = command; } public String getCommand() { return command; } public void setOutput(StringBuffer output) { this.output = output; } public void appendOutput(StringBuffer buffer) { this.output.append(buffer); } public void appendOutput(String buffer) { this.output.append(buffer); } public String getOutput() { return output.toString(); } public void setProcess(Process process) { this.process = process; } public Process getProcess() { return process; } public void setThrowable(Throwable oops) { this.oops = oops; } public Throwable getThrowable() { return oops; } public String getStackTrace() { if (oops == null) { return ""; } StringWriter buffer = new StringWriter(); oops.printStackTrace(new PrintWriter(buffer)); return buffer.toString(); } public void setExitCode(int exitCode) { this.exitCode = exitCode; } public int getExitCode() { return exitCode; } public boolean failed() { if (exitCode == 0) { return false; } return true; } @Override public String toString() { StringBuffer buffer = new StringBuffer(); buffer.append("Command '" + command + "' failed!\n"); buffer.append("Exit Code: "); buffer.append(exitCode); buffer.append('\n'); buffer.append("Console Output: "); buffer.append(output); buffer.append('\n'); if (oops != null) { buffer.append("Stacktrace: "); buffer.append(getStackTrace()); buffer.append('\n'); } return buffer.toString(); } } src/java/org/dbdoclet/service/ExecServices.java0000644000175000017500000002274012644165236021720 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.service; import java.io.BufferedReader; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.StringTokenizer; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.dbdoclet.Sfv; import org.dbdoclet.progress.InfoListener; public class ExecServices { private static Log logger = LogFactory.getLog(ExecServices.class); public static void sleep(int secs) { try { Thread.sleep(secs * 1000); } catch (InterruptedException oops) { oops.printStackTrace(); } } /** * Ausführen eines externen Programmes im aktuellen Arbeitsverzeichnis. * * @param cmd * @return */ public static ExecResult exec(String cmd) { return exec(cmd, new File("."), false, null); } public static ExecResult exec(String cmd, InfoListener listener) { return exec(cmd, new File("."), false, listener); } public static ExecResult exec(String cmd, File workDir, InfoListener listener) { return exec(cmd, workDir, false, listener); } public static ExecResult exec(String cmd, boolean background) { return exec(cmd, new File("."), background, null); } public static ExecResult exec(String cmd, File workDir, boolean background) { return exec(cmd, workDir, background, null); } public static ExecResult exec(String cmd, File workDir, boolean background, InfoListener listener) { if (cmd == null) { throw new IllegalArgumentException( "The argument cmd may not be null!"); } if (workDir == null) { workDir = new File("."); } StringTokenizer stz = new StringTokenizer(cmd); ArrayList cmdList = new ArrayList(); String token; while (stz.hasMoreTokens()) { token = stz.nextToken(); if (token.startsWith("-") && token.endsWith("\"")) { token = StringServices.cut(token, "\""); token = StringServices.cutSuffix(token, "\""); } if (token.startsWith("\"")) { while (stz.hasMoreTokens()) { token += " " + stz.nextToken(); if (token.endsWith("\"")) { break; } } } token = StringServices.trim(token, '"'); cmdList.add(token); } String[] cmdArray = ArrayServices.listToStringArray(cmdList); for (int i = 0; i < cmdArray.length; i++) { logger.debug("cmdArray[" + i + "]=" + cmdArray[i]); } return exec(cmdArray, null, workDir, background, listener); } public static ExecResult exec(String[] cmd) { if (cmd == null) { throw new IllegalArgumentException( "The argument cmd may not be null!"); } return exec(cmd, null, null, false); } public static ExecResult exec(String[] cmd, boolean background) { if (cmd == null) { throw new IllegalArgumentException( "The argument cmd may not be null!"); } return exec(cmd, null, null, background); } public static ExecResult exec(String[] cmd, String path) { if (cmd == null) { throw new IllegalArgumentException( "The argument cmd may not be null!"); } if (path == null) { throw new IllegalArgumentException( "The argument path may not be null!"); } return exec(cmd, null, new File(path), false); } public static ExecResult exec(String[] cmd, String[] envp, File dir) { return exec(cmd, envp, dir, false); } public static ExecResult exec(String[] cmd, String[] envp, File dir, boolean background) { return exec(cmd, envp, dir, background, null); } public static ExecResult exec(String[] cmd, String[] envp, File dir, boolean background, InfoListener listener) { if (cmd == null) { throw new IllegalArgumentException( "The argument cmd may not be null!"); } StringBuilder buffer = new StringBuilder(); buffer.append("Executing \""); for (int i = 0; i < cmd.length; i++) { buffer.append("'"); buffer.append(cmd[i]); buffer.append("' "); } buffer.append("\""); logger.info(buffer.toString()); Process process = null; int exitCode = 0; ExecResult result = new ExecResult(); result.setCommand(StringServices.arrayToString(cmd)); StdInput stdout = null; StdInput stderr = null; try { Runtime runtime = Runtime.getRuntime(); if (envp == null && dir == null) { process = runtime.exec(cmd); } if (envp == null && dir != null) { // envp = new String[0]; process = runtime.exec(cmd, envp, dir); } if (envp != null && dir == null) { dir = new File("."); process = runtime.exec(cmd, envp, dir); } if (envp != null && dir != null) { process = runtime.exec(cmd, envp, dir); } result.setProcess(process); stdout = new StdInput(process.getInputStream(), listener, result); stderr = new StdInput(process.getErrorStream(), listener, result); stdout.start(); stderr.start(); if (background == false) { process.waitFor(); stdout.join(10000); stderr.join(10000); } } catch (Throwable oops) { result.setThrowable(oops); result.setExitCode(-1); } finally { if (background == false) { try { logger.info("Closing Stdout and Stderr..."); if (stdout != null) { stdout.close(); } if (stderr != null) { stderr.close(); } if (process != null) { exitCode = process.exitValue(); result.setExitCode(exitCode); } else { result.setExitCode(-1); } } catch (IllegalThreadStateException itse) { process.destroy(); } } } return result; } public static ExecResult open(File file) throws IOException { if (file == null) { throw new IllegalArgumentException( "The argument file must not be null!"); } String[] cmd; ExecResult result = null; String path = file.getCanonicalPath(); if (JvmServices.isWindows()) { if (file.isDirectory()) { cmd = new String[2]; cmd[0] = "explorer"; cmd[1] = path; } else { cmd = new String[3]; cmd[0] = "cmd"; cmd[1] = "/c"; cmd[2] = path; } result = ExecServices.exec(cmd); } if (JvmServices.isUnix()) { String desktopSession = System.getProperty("desktop.session"); if (desktopSession != null && desktopSession.equalsIgnoreCase("gnome")) { cmd = new String[2]; cmd[0] = "gnome-open"; cmd[1] = path; result = ExecServices.exec(cmd); } else if (desktopSession != null && desktopSession.equalsIgnoreCase("kde")) { cmd = new String[3]; cmd[0] = "kfmclient"; cmd[1] = "newTab"; cmd[2] = path; result = ExecServices.exec(cmd); } else { cmd = new String[2]; cmd[0] = "gnome-open"; cmd[1] = path; result = ExecServices.exec(cmd); if (result.failed()) { cmd = new String[3]; cmd[0] = "kfmclient"; cmd[1] = "newTab"; cmd[2] = path; result = ExecServices.exec(cmd); } } } return result; } public static void invokeInfoViewer(final InfoListener viewer, final InputStream instr) { if (viewer == null) { throw new IllegalArgumentException( "The argument viewer must not be null!"); } if (instr == null) { throw new IllegalArgumentException( "The argument instr must not be null!"); } Thread t = new Thread() { @Override public void run() { BufferedReader reader = null; try { reader = new BufferedReader(new InputStreamReader(instr)); String line = reader.readLine(); while (line != null) { viewer.info(line); line = reader.readLine(); } } catch (Exception oops) { oops.printStackTrace(); } finally { if (reader != null) { try { reader.close(); } catch (IOException ioe) { ioe.printStackTrace(); } } } } }; t.start(); } } class StdInput extends Thread { private BufferedReader reader; private InfoListener listener; private ExecResult result; private boolean doClose = false; public StdInput(InputStream instr, InfoListener listener, ExecResult result) { if (instr == null) { throw new IllegalArgumentException( "The argument instr must not be null!"); } if (result == null) { throw new IllegalArgumentException( "The argument result may not be null!"); } this.result = result; this.listener = listener; reader = new BufferedReader(new InputStreamReader(instr)); } public void close() { doClose = true; try { reader.close(); } catch (IOException ioe) { ioe.printStackTrace(); } } @Override public void run() { try { String line = reader.readLine(); while (line != null && doClose == false) { if (listener != null) { listener.info(line); } result.appendOutput(line + Sfv.LSEP); line = reader.readLine(); } } catch (Exception oops) { oops.printStackTrace(); } finally { if (reader != null) { try { reader.close(); } catch (IOException ioe) { ioe.printStackTrace(); } } } } } src/java/org/dbdoclet/service/FindServices.java0000644000175000017500000002106212644165236021710 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.service; import java.io.File; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.dbdoclet.comparator.PathTokenCountComparator; import org.dbdoclet.progress.ProgressEvent; import org.dbdoclet.progress.ProgressListener; public class FindServices { /** * Die Methode findFileInDirectory durchsucht ein Verzeichnis rekursiv nach * Unterverzeichnissen und Dateien. * * Die gefundenen Dateien werden als java.io.File-Objekte in * der übergebenen Liste abgelegt. * * @param dir Das Verzeichnis * @param dpattern Der reguläre Ausdruck für die Auswahl der Verzeichnisse. * @param fpattern Der reguläre Ausdruck für die Auswahl der Dateien. * @param list Die Liste der gefundenen Dateien als File-Objekte. * * @see java.io.File */ public static void findFileInDirectory(File dir, String dpattern, String fpattern, List list) { findFileInDirectory(dir, dpattern, fpattern, null, list); } public static void findFileInDirectory(File dir, String dpattern, String fpattern, ProgressListener listener, List list) { if (dir == null) { throw new IllegalArgumentException("The argument dir must not be null!"); } if (dpattern == null) { throw new IllegalArgumentException("The argument dpattern must not be null!"); } if (fpattern == null) { throw new IllegalArgumentException("The argument fpattern must not be null!"); } if (list == null) { throw new IllegalArgumentException("The argument list must not be null!"); } File[] files1 = dir.listFiles(); File[] files2; File file1; File file2; Pattern red = Pattern.compile(dpattern, Pattern.CASE_INSENSITIVE); Pattern ref = Pattern.compile(fpattern, Pattern.CASE_INSENSITIVE); Matcher dirMatcher; Matcher fileMatcher; if (files1 == null) { return; } for (int i = 0; i < files1.length; i++) { file1 = files1[i]; dirMatcher = red.matcher(file1.getName()); if (file1.isDirectory() && dirMatcher.matches()) { if (listener != null) { listener.progress(new ProgressEvent().setStage(ProgressEvent.STAGE_PREPARE).setUserObject(file1)); } files2 = file1.listFiles(); if (files2 != null && files2.length > 0) { for (int j = 0; j < files2.length; j++) { file2 = files2[j]; fileMatcher = ref.matcher(file2.getName()); if (file2.isFile() && fileMatcher.matches()) { list.add(file2); } } } findFileInDirectory(file1, dpattern, fpattern, listener, list); continue; } if (file1.isDirectory()) { if (listener != null) { listener.progress(new ProgressEvent().setStage(ProgressEvent.STAGE_PREPARE).setUserObject(file1)); } findFileInDirectory(file1, dpattern, fpattern, listener, list); } } } public static void findFile(String path, ArrayList list) { if (path == null) { throw new IllegalArgumentException("The argument path must not be null!"); } findFile(new File(path), null, list); } public static void findFile(File dir, ArrayList list) { findFile(dir, null, list); } public static void findFile(File dir, String fpattern, ArrayList list) { findFile(dir, fpattern, true, list); } /** * Die Methode findFile sucht nach Dateien im Verzeichnis * dir die auf den regulären Ausdruck fpattern * passen. * * @param dir Das Verzeichnis. * @param fpattern Der reguläre Ausdruck. * @param list Die Liste der gefundenen Dateien */ public static void findFile(File dir, String fpattern, boolean recursive, ArrayList list) { if (dir == null) { throw new IllegalArgumentException("The argument dir must not be null!"); } if (list == null) { throw new IllegalArgumentException("The argument list must not be null!"); } File[] files = dir.listFiles(); File file; Pattern ref = null; Matcher fileMatcher = null; if (fpattern != null) { ref = Pattern.compile(fpattern, Pattern.CASE_INSENSITIVE); } if (files == null) { return; } for (int i = 0; i < files.length; i++) { file = files[i]; if (file.isDirectory()) { if (recursive == true) { findFile(file, fpattern, list); } } else { if (ref != null) { fileMatcher = ref.matcher(file.getName()); if (fileMatcher.matches()) { list.add(file); } } else { list.add(file); } } } } /** * Die Methode findDirectory sucht nach Unterverzeichnissen im * Verzeichnis dir die auf den regulären Ausdruck * dpattern passen. Die Liste wird, bevor sie an die aufrufende * Methode zurückgegeben wird, nach der Anzahl der Pfadelemente * sortiert. Und zwar so, daß die längsten Pfade am Anfang der Liste * stehen. Dies ermöglicht eine Verarbeitung, z.B. Umbenennung, der Pfade * vom Ende her, in der Art, daß möglichst alle Pfade ihre Gültigkeit * behalten. Würde ein Pfad zuerst am Anfang manipuliert, z.B. durch * Umbennenung, wären alle Pfadnamen der Unterverzeichnisse auf einen Schlag * ungültig. * * @param dir Das Verzeichnis * @param dpattern Der reguläre Ausdruck. * @param list Die Liste der gefundenen Dateien */ public static void findDirectory(File dir, String dpattern, ArrayList list) { if (dir == null) { throw new IllegalArgumentException("The argument dir must not be null!"); } if (dpattern == null) { throw new IllegalArgumentException("The argument dpattern must not be null!"); } if (list == null) { throw new IllegalArgumentException("The argument list must not be null!"); } File[] files = dir.listFiles(); File file; Pattern red = Pattern.compile(dpattern, Pattern.CASE_INSENSITIVE); Matcher dirMatcher; if (files == null) { return; } for (int i = 0; i < files.length; i++) { file = files[i]; if (file.isDirectory()) { dirMatcher = red.matcher(file.getName()); if (dirMatcher.matches()) { list.add(file); } findDirectory(file, dpattern, list); } } Collections.sort(list, new PathTokenCountComparator()); } } src/java/org/dbdoclet/service/ResourceServices.java0000644000175000017500000003421112644165236022617 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.service; import java.io.BufferedReader; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.StringReader; import java.io.UnsupportedEncodingException; import java.net.URL; import java.util.ArrayList; import java.util.Iterator; import java.util.MissingResourceException; import java.util.ResourceBundle; import javax.swing.ImageIcon; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * Die Klasse ResourceServices bietet Methoden zur Bearbeitung von * Resourcen die vom Classloader geldaen werden. * * @author Michael Fuchs * @version 1.0 */ public class ResourceServices { private static Log logger = LogFactory.getLog(ResourceServices.class); public static ImageIcon getButtonIcon(String name) { if (name == null) { throw new IllegalArgumentException("The argument name must not be null!"); } ClassLoader loader = ClassLoader.getSystemClassLoader(); URL iconUrl = loader.getResource(name); if (iconUrl == null) { iconUrl = ResourceServices.class.getResource(name); } if (iconUrl == null) { return null; } ImageIcon icon = new ImageIcon(iconUrl, name); return icon; } public static String getXmlTemplate(String name) throws IOException { return getXmlTemplate(null, name); } public static String getXmlTemplate(String language, String name) throws IOException { String path; URL url = null; ClassLoader loader = ClassLoader.getSystemClassLoader(); if (language != null && language.length() > 0) { path = "/templates/xml/" + language.toLowerCase() + "/" + name; url = loader.getResource(path); if (url == null) { url = ResourceServices.class.getResource(path); } } if (url == null) { path = "/templates/xml/default/" + name; url = loader.getResource(path); if (url == null) { url = ResourceServices.class.getResource(path); } } if (url == null) { return null; } return readUrl(url); } /** * Die Methode getResourceAsString liefert die Resource als * Zeichenkette zurück. Die Eingabestrom wird dabei mit der Kodierung UTF-8 * eingelesen. * * @param name String * @return String * @exception IOException */ public static String getResourceAsString(String name) throws IOException { return getResourceAsString(name, null); } public static String getResourceAsString(String name, ClassLoader classLoader) throws IOException { if (name == null) { throw new IllegalArgumentException("The argument name must not be null!"); } InputStream is = getResourceAsStream(name, classLoader); if (is == null) { return null; } return readStream(is); } /** * @param is * @return String * @throws UnsupportedEncodingException * @throws IOException */ public static String readStream(InputStream is) throws UnsupportedEncodingException, IOException { if (is == null) { throw new IllegalArgumentException("The argument is must not be null!"); } InputStreamReader isr = new InputStreamReader(is, "UTF-8"); BufferedReader reader = new BufferedReader(isr); StringBuffer buffer = new StringBuffer(); String lsep = System.getProperty("line.separator"); String line = reader.readLine(); while (line != null) { buffer.append(line + lsep); line = reader.readLine(); } reader.close(); isr.close(); is.close(); return buffer.toString(); } public static URL getResourceAsUrl(String name) { URL url = null; ClassLoader loader = ClassLoader.getSystemClassLoader(); url = loader.getResource(name); if (url == null) { url = ResourceServices.class.getResource(name); } return url; } public static URL getResourceAsUrl(String name, ClassLoader classLoader) { if (name == null) { throw new IllegalArgumentException("The argument name must not be null!"); } if (classLoader == null) { throw new IllegalArgumentException("The argument classLoader must not be null!"); } URL url = null; url = classLoader.getResource(name); if (url == null) { return getResourceAsUrl(name); } return url; } public static InputStream getResourceAsStream(String name) throws IOException { return getResourceAsStream(name, null); } public static InputStream getResourceAsStream(String name, ClassLoader classLoader) throws IOException { URL url; if (classLoader != null) { url = getResourceAsUrl(name, classLoader); } else { url = getResourceAsUrl(name); } if (url == null) { return null; } return url.openStream(); } public static ImageIcon getIcon(String path) { return getIcon(path, null); } public static ImageIcon getIcon(String path, ClassLoader loader) { URL iconUrl = null; if (loader != null) { iconUrl = loader.getResource(path); } if (iconUrl == null) { iconUrl = ClassLoader.getSystemClassLoader().getResource(path); } if (iconUrl == null) { iconUrl = ResourceServices.class.getResource(path); } if (iconUrl == null) { return null; } ImageIcon icon = new ImageIcon(iconUrl, path); return icon; } public static boolean isDirectory(String name) { if (name == null) { throw new IllegalArgumentException("The argument name must not be null!"); } String buffer; String entry; String str; BufferedReader reader = null; if (name.endsWith("/") == false) { name += "/"; } try { buffer = getResourceAsString(name); if (buffer == null) { throw new IOException("Can't find resource " + name); } reader = new BufferedReader(new StringReader(buffer)); entry = reader.readLine(); while (entry != null) { entry = name + entry; logger.debug("entry=" + entry); str = getResourceAsString(entry); if (str == null) { return false; } break; // entry = reader.readLine(); } return true; } catch (IOException oops) { logger.error(oops); return false; } finally { if (reader != null) { try { reader.close(); } catch (IOException oops) { logger.error(oops); } } } } public static String[] list(String name) { logger.debug("list " + name); if (isDirectory(name) == false) { logger.error("Resource " + name + " is not a directory!"); return new String[0]; } String buffer; String entry; BufferedReader reader = null; try { ArrayList list = new ArrayList(); buffer = getResourceAsString(name); reader = new BufferedReader(new StringReader(buffer)); entry = reader.readLine(); while (entry != null) { list.add(entry); entry = reader.readLine(); } String[] listing = new String[list.size()]; Iterator iterator = list.iterator(); int i = 0; while (iterator.hasNext()) { entry = iterator.next(); listing[i++] = entry; } return listing; } catch (IOException oops) { logger.error(oops); return null; } finally { if (reader != null) { try { reader.close(); } catch (IOException oops) { logger.error(oops); } } } } public static void copyToDir(String name, String path) throws IOException { if (path == null) { throw new IllegalArgumentException("The argument path must not be null!"); } copyToDir(name, new File(path)); } public static void copyToDir(String name, File dir) throws IOException { if (name == null) { throw new IllegalArgumentException("The argument name must not be null!"); } if (dir == null) { throw new IllegalArgumentException("The argument dir must not be null!"); } logger.debug("Resource: " + name + ", Directory: " + dir.getPath()); FileServices.createPath(dir); String resourceName = name; resourceName = StringServices.chop(resourceName, "/"); int index = resourceName.lastIndexOf('/'); if (index != -1) { resourceName = resourceName.substring(index + 1); } if (isDirectory(name)) { if (name.endsWith("/") == false) { name += "/"; } logger.debug("Examination of directory " + name + "..."); String[] listing = list(name); for (int i = 0; i < listing.length; i++) { logger.debug("listing[" + i + "] = " + listing[i]); copyToDir(name + listing[i], FileServices.appendFileName(dir, resourceName)); } } else { InputStream instr = getResourceAsStream(name); if (instr == null) { throw new IOException("Can't find resource " + name); } String fileName = FileServices.appendFileName(dir, resourceName); logger.debug("Writing resource " + fileName + "..."); FileOutputStream outstr = new FileOutputStream(fileName); int n = 0; byte[] buffer = new byte[4096]; while ((n = instr.read(buffer, 0, 4096)) != -1) { outstr.write(buffer, 0, n); } instr.close(); outstr.close(); } } public static void copyToFile(String name, String fileName) throws IOException { if (fileName == null) { throw new IllegalArgumentException("The argument fileName must not be null!"); } copyToFile(name, new File(fileName)); } public static void copyToFile(String name, File file) throws IOException { if (name == null) { throw new IllegalArgumentException("The argument name must not be null!"); } if (file == null) { throw new IllegalArgumentException("The argument file must not be null!"); } if (file.exists() == true && file.isFile() == false) { throw new IllegalArgumentException("The argument file must be a regular file!"); } if (isDirectory(name)) { throw new IllegalArgumentException("The resource must not be a directory!"); } logger.debug("Resource: " + name + ", Datei: " + file.getPath()); File dir = file.getParentFile(); if (dir != null && dir.exists() == false) { FileServices.createPath(dir); } String resourceName = name; resourceName = StringServices.chop(resourceName, "/"); int index = resourceName.lastIndexOf('/'); if (index != -1) { resourceName = resourceName.substring(index + 1); } InputStream instr = getResourceAsStream(name); if (instr == null) { throw new IOException("Can't find resource " + name); } String fileName = FileServices.appendFileName(dir, file.getName()); logger.debug("Writing resource " + fileName + "..."); FileOutputStream outstr = new FileOutputStream(fileName); int n = 0; byte[] buffer = new byte[4096]; while ((n = instr.read(buffer, 0, 4096)) != -1) { outstr.write(buffer, 0, n); } instr.close(); outstr.close(); } public static String getString(ResourceBundle res, String key) { if (res == null && key == null) { return "(null)"; } if (res == null) { return key; } if (key == null) { return ""; } try { return res.getString(key); } catch (MissingResourceException oops) { logger.error("Missing resource '" + key + "'.", oops); return key; } } public static String readUrl(URL resourceUrl) throws UnsupportedEncodingException, IOException { if (resourceUrl == null) { throw new IllegalArgumentException("The argument resourceUrl must not be null!"); } return readStream(resourceUrl.openStream()); } } src/java/org/dbdoclet/service/JvmServices.java0000644000175000017500000001046712644165236021573 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.service; import java.io.File; import java.io.IOException; import java.util.Properties; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class JvmServices { public static Log logger = LogFactory.getLog(JvmServices.class); public static void listSystemProperties() { Properties props = System.getProperties(); props.list(System.out); } public static String getOperatingSystem() { String os = System.getProperty("os.name"); return os; } public static String getLinuxDistribution() throws IOException { File file; file = new File("/etc/lsb-release"); if (file.exists() == true) { String value = FileServices.getValueOfKey(file, "DISTRIB_ID"); if (value != null && value.length() > 0) { return value; } } file = new File("/etc/redhat-release"); if (file.exists() == true) { return "RedHat"; } file = new File("/etc/SuSE-release"); if (file.exists() == true) { return "SUSE"; } return null; } public static boolean isUnix() { String os = System.getProperty("os.name"); if (os.equalsIgnoreCase("Linux")) { return true; } return false; } public static boolean isWindows() { String os = System.getProperty("os.name"); if (os.startsWith("Windows")) { return true; } return false; } public static boolean isJdk() { File binDir; File libDir; File jreDir; File srcFile; String path; String jreHome = System.getProperty("java.home"); File jreHomeDir = new File(jreHome); File jdkHomeDir = jreHomeDir.getParentFile(); if (jdkHomeDir == null) { return false; } path = FileServices.appendPath(jdkHomeDir, "bin"); logger.debug("binPath=" + path); binDir = new File(path); path = FileServices.appendPath(jdkHomeDir, "lib"); libDir = new File(path); path = FileServices.appendPath(jdkHomeDir, "jre"); jreDir = new File(path); path = FileServices.appendFileName(jdkHomeDir, "src.zip"); srcFile = new File(path); if (binDir.exists() == false || libDir.exists() == false || jreDir.exists() == false || srcFile.exists() == false) { return false; } return true; } public static File getTmpDirectory() { return new File(System.getProperty("java.io.tmpdir", "/tmp")); } public static File getJavaHomeDirectory() { return new File(System.getProperty("java.home")); } public static File getJdkHomeDirectory() { File jreHomeDir = getJavaHomeDirectory(); return jreHomeDir.getParentFile(); } public static File getHomeDirectory() { return new File(System.getProperty("user.home", "/tmp")); } public static void checkMemory() { Runtime runtime = Runtime.getRuntime(); long free = runtime.freeMemory(); if (free < (1048576 * 24)) { logger.debug("Running out of memory: " + ((free / 1048576)) + "MB left."); runtime.gc(); logger.debug("Running garbage collection: " + ((runtime.freeMemory() / 1048576)) + " MB available."); } } } src/java/org/dbdoclet/unit/0000755000175000017500000000000012644165236015777 5ustar mathieumathieusrc/java/org/dbdoclet/unit/Length.java0000644000175000017500000001541112644165236020065 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.unit; import java.text.NumberFormat; import java.util.Locale; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.dbdoclet.service.StringServices; /** * Längenangabe mit zugehöriger Einheit. * * @author michael */ public class Length { private static final LengthUnit DEFAULT_UNIT = LengthUnit.MILLIMETER; private static Log logger = LogFactory.getLog(Length.class); private Double distance = null; private boolean excludePercent = true; private Locale locale = Locale.getDefault(); private LengthUnit unit = LengthUnit.MILLIMETER; public Length() { this(Locale.getDefault(), null, null); } public Length(Double distance) { this(Locale.getDefault(), distance, DEFAULT_UNIT); } public Length(Double distance, LengthUnit unit) { this(Locale.getDefault(), distance, unit); } public Length(float distance, LengthUnit unit) { this(Locale.getDefault(), new Double(distance), unit); } public Length(int top) { this(Locale.getDefault(), new Double(top), DEFAULT_UNIT); } public Length(Locale locale, Double distance, LengthUnit unit) { this.setLocale(locale); this.distance = distance; this.unit = unit; } public static double toMillimeter(Object value) { if (value instanceof Length == false) { throw new IllegalArgumentException( "The argument value must be of type Distance!"); } Length length = (Length) value; if (length.getUnit() == LengthUnit.POINT) { return (length.getLength() / 72.0f) * 25.4f; } if (length.getUnit() == LengthUnit.INCH) { return length.getLength() * 25.4f; } if (length.getUnit() == LengthUnit.CENTIMETER) { return length.getLength() * 10; } return length.getLength(); } public static Length valueOf(String value) { return valueOf(value, true); } public static Length valueOf(String value, boolean excludePercent) { Length distance = new Length(Locale.US, null, DEFAULT_UNIT); distance.setExcludePercent(excludePercent); if (distance.processValue(Locale.US, value) == false) { return null; } return distance; } public void decrDistance(float decr) { if (distance != null) { distance -= decr; } } public Length deepCopy() { if (locale == null) { locale = Locale.getDefault(); } if (unit == null) { unit = LengthUnit.MILLIMETER; } if (distance == null) { return new Length(locale, null, unit); } Length copy = new Length(locale, new Double(distance), unit); return copy; } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } Length other = (Length) obj; if (distance == null && other.distance != null) { return false; } if (distance == null && other.distance == null) { return false; } if (distance.equals(other.distance) == false) { return false; } if (unit == null && other.unit != null) { return false; } if (unit.equals(other.unit) == false) { return false; } return true; } public boolean excludePercent() { return excludePercent; } public float getLength() { if (distance == null) { return 0; } return distance.floatValue(); } public Locale getLocale() { return locale; } public LengthUnit getUnit() { return unit; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((distance == null) ? 0 : distance.hashCode()); result = prime * result + ((unit == null) ? 0 : unit.hashCode()); return result; } public void incrDistance(float incr) { if (distance != null) { distance += incr; } } public Length minus(Length operand) { if (operand == null) { return this.deepCopy(); } double sum = this.toMillimeter() - operand.toMillimeter(); return new Length(sum, LengthUnit.MILLIMETER); } public Length plus(Length operand) { if (operand == null) { return this.deepCopy(); } double sum = this.toMillimeter() + operand.toMillimeter(); return new Length(sum, LengthUnit.MILLIMETER); } public boolean processValue(Locale locale, String value) { if (value == null || value.trim().length() == 0) { unit = null; distance = null; return false; } String tu = null; double td; value = value.trim().toLowerCase(); for (LengthUnit unit : LengthUnit.values()) { if (excludePercent() == true && unit.equals(LengthUnit.PERCENT)) { continue; } if (value.endsWith(unit.getAbbreviation())) { tu = unit.getAbbreviation(); break; } } if (tu == null) { tu = LengthUnit.POINT.getAbbreviation(); } value = StringServices.cutSuffix(value, tu); try { NumberFormat formatter = NumberFormat.getInstance(locale); Number num = formatter.parse(value); td = num.doubleValue(); } catch (Throwable oops) { logger.error("Invalid value " + value + " for length.", oops); return false; } unit = LengthUnit.valueOfAbbrev(tu); distance = td; return true; } public void setDistance(double distance) { this.distance = distance; } public void setExcludePercent(boolean excludePercent) { this.excludePercent = excludePercent; } public void setLength(double length) { this.distance = length; } public void setLocale(Locale locale) { this.locale = locale; } public void setLocalizedValue(String value) { processValue(getLocale(), value); } public void setUnit(LengthUnit unit) { this.unit = unit; } public double toMillimeter() { return toMillimeter(this); } public String toNormalizedString() { if (distance == null) { return null; } if (unit == LengthUnit.PERCENT) { return String.format(Locale.US, "%.0f%s", distance, unit.getAbbreviation()); } return String.format(Locale.US, "%.2f%s", distance, unit.getAbbreviation()); } public double toPoint() { double millis = toMillimeter(); return millis * 2.834645669; } @Override public String toString() { if (distance == null) { return null; } return String.format(getLocale(), "%.2f %s", distance, unit.getAbbreviation()); } } src/java/org/dbdoclet/unit/LengthUnit.java0000644000175000017500000000355212644165236020730 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.unit; public enum LengthUnit { INCH("in"), MILLIMETER("mm"), POINT("pt"), PICA("pc"), PIXEL("px"), EM("em"), CENTIMETER("cm"), PERCENT("%"); private final String abbrev; private LengthUnit(String abbrev) { this.abbrev = abbrev; } public String getAbbreviation() { return abbrev; } public static LengthUnit valueOfAbbrev(String value) { if (value == null) { return null; } value = value.trim(); if (value.equalsIgnoreCase("cm")) { return CENTIMETER; } if (value.equalsIgnoreCase("em")) { return EM; } if (value.equalsIgnoreCase("in")) { return INCH; } if (value.equalsIgnoreCase("mm")) { return MILLIMETER; } if (value.equalsIgnoreCase("pc")) { return PICA; } if (value.equalsIgnoreCase("%")) { return PERCENT; } if (value.equalsIgnoreCase("pt")) { return POINT; } return null; } } src/java/org/dbdoclet/DeleteFileException.java0000644000175000017500000000226312644165236021547 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet; import java.io.File; import java.io.IOException; public class DeleteFileException extends IOException { /** * */ private static final long serialVersionUID = 1L; private String path; public DeleteFileException(File file) { this(file.getAbsolutePath()); } public DeleteFileException(String path) { super(path); this.path = path; } public String getPath() { return path; } } src/java/org/dbdoclet/option/0000755000175000017500000000000012644165244016327 5ustar mathieumathieusrc/java/org/dbdoclet/option/OptionException.java0000644000175000017500000000377112644165236022332 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.option; import java.io.PrintWriter; import java.io.StringWriter; /** * Describe class OptionException here. * * @author Michael Fuchs * @version 1.0 */ public class OptionException extends RuntimeException { private static final long serialVersionUID = 1L; private Exception cause; private String msg; /** * Creates a new OptionException instance. * * @param msg a String value */ public OptionException(String msg) { super(msg); this.msg = msg; this.cause = null; } /** * Creates a new OptionException instance. * * @param oops an Exception value */ public OptionException(Exception oops) { super(oops.getMessage()); this.msg = ""; this.cause = oops; } /** * Describe getMessage method here. * * @return an Exception value */ public String getMessage() { if (cause == null) { return msg; } StringWriter buffer = new StringWriter(); cause.printStackTrace(new PrintWriter(buffer)); return buffer.toString(); } } /* * $Log$ */ src/java/org/dbdoclet/option/PathOption.java0000644000175000017500000000507512644165236021267 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.option; import java.io.File; import java.util.StringTokenizer; public class PathOption extends Option { private String invalidPathElement = ""; public PathOption() { super(); hasArgument(true); } public PathOption(String longName) { super(longName); hasArgument(true); } public PathOption(String longName, String shortName) { super(longName, shortName); hasArgument(true); } @Override public void addValueFromString(String value) { addValue(value); } public String getInvalidPathElement() { return invalidPathElement; } @Override public void setValueFromString(String value) { setValue(value); } protected boolean checkArgument(String arg) { if (arg == null) { throw new IllegalArgumentException("The argument arg may not be null!"); } StringTokenizer stz = new StringTokenizer(arg, System.getProperty("path.separator")); String token; File path; String pathElement; while (stz.hasMoreTokens()) { token = stz.nextToken(); pathElement = token; if (pathElement.startsWith("~")) { if (pathElement.equals("~")) { pathElement = System.getProperty("user.home"); } else { pathElement = System.getProperty("user.home") + pathElement.substring(1); } } path = new File(pathElement); if (path.exists() == false) { invalidPathElement = pathElement; return false; } } return true; } @Override public OptionType getType() { return OptionType.TEXT; } } /* * $Log$ */ src/java/org/dbdoclet/option/StringOption.java0000644000175000017500000000242012644165236021630 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.option; public class StringOption extends Option { public StringOption() { super(); hasArgument(true); } public StringOption(String longName) { super(longName); hasArgument(true); } public StringOption(String longName, String shortName) { super(longName, shortName); hasArgument(true); } @Override public void addValueFromString(String value) { addValue(value); } @Override public void setValueFromString(String value) { setValue(value); } @Override public OptionType getType() { return OptionType.TEXT; } } src/java/org/dbdoclet/option/OptionType.java0000644000175000017500000000144712644165236021313 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.option; public enum OptionType { BOOLEAN, FILE, INTEGER, TEXT } src/java/org/dbdoclet/option/BooleanOption.java0000644000175000017500000000605412644165236021750 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.option; /** *
      * The class BooleanOption implements a flag option with no * argument. * * If the flag is present on the command line, the value of the option will be * true, otherwise it will be false. * *
      * *
      Die Klasse BooleanOption realisiert die * Standardoption ohne Argument. * * Wird die Option auf der Kommandozeile gesetzt, so erhält die Option den Wert * "wahr". Andernfalls den Wert "falsch". Der Standardwert kann bei Aufruf der * Methode getFlag() überschrieben werden. * *
      * *
      *
       OptionList options = new OptionList(args);
      
       Option option = new BooleanOption("help","h");
       options.add(option);
      
       if ( options.getFlag("help",false) ) {
           printUsage();
           return;
       } 
      
       * 
      *
      * * @author Michael Fuchs * @version 1.0 */ public class BooleanOption extends Option { /** * Creates a new BooleanOption instance. */ public BooleanOption() { super(); setDefault(false); } public BooleanOption(String longName) { super(longName); setDefault(false); } /** *
      * Creates a new BooleanOption instance. *
      * *
      * Erzeugt eine neue Instanz der Klasse BooleanOption. *
      * * @param longName a String value * @param shortName a String value */ public BooleanOption(String longName, String shortName) { super(longName, shortName); setDefault(false); } @Override public void addValueFromString(String value) { addValue(Boolean.valueOf(value)); } @Override public void setValueFromString(String value) { boolean flag = false; if (value.equals("1") || value.equalsIgnoreCase("on") || value.equalsIgnoreCase("yes") || value.equalsIgnoreCase("true") || value.equalsIgnoreCase("ja") || value.equalsIgnoreCase("wahr")) { flag = true; } setValue(flag); } @Override public OptionType getType() { return OptionType.BOOLEAN; } } src/java/org/dbdoclet/option/OptionList.java0000644000175000017500000005577712644165236021324 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.option; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.PrintWriter; import java.text.MessageFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.Iterator; import java.util.Properties; import java.util.ResourceBundle; import org.dbdoclet.service.ResourceServices; /** * Die Klasse OptionList verwaltet die bekannten Optionen und * wertet die Kommandozeile aus. * *
      * *
       * 
       * OptionList options = new OptionList(args);
       * StringOption opt = new StringOption("program-name", "n");
       * opt.setMediumName("name");
       * opt.setPropertyName("program.name");
       * opt.setDefault("PROGRAM");
       * options.add(opt);
       * 
       * if (options.validate() == false) {
       * 	fail(options.getError());
       * }
       * 
       * options.setProperties(properties);
       * println("Optionen:");
       * println(options.list());
       * 
       * 
      * *
      * * @author Michael Fuchs * @version 1.0 */ public class OptionList implements Iterable> { private static ResourceBundle res = Option.getResourceBundle(); private ArrayList remainingArgs; private ArrayList args; private ArrayList> optList; private HashMap> optMap; private HashMap> deprecatedPropertiesMap; private String error = ""; /** * Erzeugt eine neue Instanz der Klasse OptionList ohne * Argumente. */ public OptionList() { String[] args = new String[0]; init(args, 0); } /** * Erzeugt eine neue Instanz der Klasse OptionList. * * @param cmdline * String[][] */ public OptionList(String[][] cmdline) { String[] args = Arrays.stream(cmdline) .flatMap(arr -> Arrays.stream(arr)) .toArray(String[]::new); init(args, 0); } /** * Erzeugt eine neue Instanz der Klasse OptionList. * * @param cmdline * a String[] value */ public OptionList(String[] cmdline) { if (cmdline == null) throw new IllegalArgumentException("Variable args is null!"); init(cmdline, 0); } /** * Erzeugt eine neue Instanz der Klasse OptionList. * * Der Parameter offset gibt an ab welchem Element der * Kommandozeile die Argumente ausgewertet werden sollen. Damit ist möglich * den Parametern Unterbefehle voranzustellen, z.B. wie in cocs update * --force. * * @param cmdline * a String[] value */ public OptionList(String[] cmdline, int offset) { if (cmdline == null) { throw new IllegalArgumentException( "The argument cmdline may not be null!"); } if (offset < 0) { throw new IllegalArgumentException( "The argument offset must be greater than 0!"); } if (offset > cmdline.length) { throw new IllegalArgumentException( "The argument offset is greater than the lehgth of the command line!"); } init(cmdline, offset); } /** * Die Methode getError liefert die letzte Fehlermeldung an den * Aufrufer zurück. * * @return String */ public String getError() { if (error == null) { error = ""; } return String.join(" ", args) + "\n\n" + error; } /** * Die Methode findOption sucht nach der angegebenen Option in * der aktuellen Liste von Optionen. * * Falls die Option nicht gefunden werden kann, wird null * zurückgegeben. * * @param option * Die Option nach der gesucht wird. * @return Die gefundene Option oder null. */ public Option findOption(Option option) { Object obj; int index = optList.indexOf(option); if (index != -1) { obj = optList.get(index); if (obj != null && obj instanceof Option) { return (Option) obj; } } return null; } /** * The method findOption tries to find the given option by * name. If the option can not be found, null is returned. * * @param name * a String value * @return The option or null if no option can be found. */ public Option findOption(String name) { if (name == null) { throw new IllegalArgumentException( " The argument name may not be null!"); } return optMap.get(name); } public Option findExistingOption(Option option) { if (option == null) { throw new IllegalArgumentException( " The argument option may not be null!"); } Option existing; existing = optMap.get(option.getLongName()); if (existing != null) { return existing; } existing = optMap.get(option.getMediumName()); if (existing != null) { return existing; } existing = optMap.get(option.getShortName()); if (existing != null) { return existing; } existing = optMap.get(option.getPropertyName()); if (existing != null) { return existing; } throw new OptionException("Can't find existing option!"); } /** * The method getOption tries to find the given option by name. * If the option can not be found, an OptionException is thrown. * * @param name * a String value * @return The option. */ public Option getOption(String name) throws OptionException { if (name == null) { throw new IllegalArgumentException( "The argument name may not be null!"); } Option option = optMap.get(name); if (option == null) { String msg = MessageFormat.format( ResourceServices.getString(res, "C_ERROR_OPTION_UNKNOWN"), name); throw new OptionException(msg); } return option; } public BooleanOption getBooleanOption(String name) { if (name == null) { throw new IllegalArgumentException( "The argument name may not be null!"); } Option option = getOption(name); if (option instanceof BooleanOption) { return (BooleanOption) option; } else { String msg = MessageFormat.format(ResourceServices.getString(res, "C_ERROR_OPTION_INVALID_TYPE"), name, "boolean", option .getClass().getName()); throw new OptionException(msg); } // end of else } public void add(Option option) throws OptionException { if (option == null) { throw new IllegalArgumentException( " The argument option may not be null!"); } if (option.isValid() == false) { throw new OptionException(ResourceServices.getString(res, "C_ERROR_INVALID_OPTION") + option.getUniqueName()); } if (exists(option)) { Option existing = findExistingOption(option); throw new OptionException(MessageFormat.format(ResourceServices .getString(res, "C_ERROR_OPTION_ALREADY_IN_USE"), option .getFQName(), existing.getFQName())); } optList.add(option); Arrays.stream(option.getNames()).forEach(n -> optMap.put(n, option)); } /** * Die Methode getRemainingArgs liefert die nach der * Validierung überzähligen Argumente. Also diejenigen Argumente, die nicht * definiert waren. * * @return String[] */ public String[] getRemainingArgs() { if (remainingArgs == null) { return new String[0]; } return remainingArgs.stream().toArray(String[]::new); } /** * Describe getString method here. * * @param name * a String value * @return a String value */ public String getString(String name) { if (name == null) throw new IllegalArgumentException("Variable name is null!"); Option option = optMap.get(name); if (option == null) { return ""; } if (option.getValue() == null) { return null; } return option.getValue().toString(); } /** * Describe getString method here. * * @param name * a String value * @param deflt * a String value * @return a String value */ public String getString(String name, String deflt) { if (name == null) throw new IllegalArgumentException("Variable name is null!"); Option option = optMap.get(name); if (option == null || option.isUnset()) return deflt; if (option.getValue() == null) { return deflt; } else { return option.getValue().toString(); } } public void addDeprecatedPropertyAlias(Option option, String alias) throws OptionException { if (option == null) { throw new IllegalArgumentException( "The argument option may not be null!"); } if (alias == null || alias.length() == 0 || alias.equals("!")) { throw new IllegalArgumentException( "The argument alias is invalid: " + alias); } if (deprecatedPropertiesMap == null) { throw new IllegalStateException( " The field deprecatedPropertiesMap may not be null!"); } String name = alias; if (name.startsWith("!")) { name = name.substring(1); } // end of if (name.startsWith("!")) Option opt = optMap.get(name); if (opt != null && opt.equals(option) == false) { throw new OptionException(MessageFormat.format(ResourceServices .getString(res, "C_ERROR_OPTION_ALREADY_IN_USE"), name)); } deprecatedPropertiesMap.put(alias, option); } public boolean setProperties(String fname) throws FileNotFoundException, IOException { if (fname == null) { throw new IllegalArgumentException( " The argument fname may not be null!"); } Properties props = new Properties(); props.load(new FileInputStream(fname)); return setProperties(props); } public boolean setProperties(Properties props) throws OptionException { if (props == null) { throw new IllegalArgumentException( " The argument props may not be null!"); } Object obj; Option option; String name; String value; String buffer = ""; // props.forEach(Property p -> System.out.println()); for (Iterator i = props.keySet().iterator(); i.hasNext();) { obj = i.next(); if (obj instanceof String) { name = (String) obj; value = props.getProperty(name); if (value == null) { continue; } option = optMap.get(name); if (option == null) { option = deprecatedPropertiesMap.get(name); if (option != null) { buffer += MessageFormat.format(ResourceServices .getString(res, "C_WARN_PROPERTY_DEPRECATED"), name, option.getPropertyName()) + "\n"; } else { option = deprecatedPropertiesMap.get("!" + name); if (option != null && (option instanceof BooleanOption)) { value = value.trim(); boolean flag = false; if (value.equals("1") || value.equalsIgnoreCase("yes") || value.equalsIgnoreCase("true") || value.equalsIgnoreCase("ja") || value.equalsIgnoreCase("wahr")) { flag = true; } ((BooleanOption) option).setValue(flag); continue; } } } if (option == null) { buffer += MessageFormat.format(ResourceServices.getString( res, "C_ERROR_PROPERTY_UNKNOWN"), name) + "\n"; continue; } if (option != null && option.isUnset()) { option.setValueFromString(value); } } } if (buffer != null && buffer.length() > 0) { error = buffer; return false; } else { return true; } } public boolean validate() { return validate(false); } /** * Die Methode validate validiert die Argumente. * * Das Validieren prüft die Argumente auf ihre syntaktische Korrektheit. * Zusätzlich werden die Optionen selbst bearbeitet. Gefundene Optionen * werden als vorhanden markiert und mit den Werten aus den Argumenten * initialisert. Überzählige Argumente werden in einem Container namens * remainingArgs gespeichert. Je nach Wert des Parameters * ignoreUnknownOptions führen überzählige Argumente zu einer * Fehlermeldung oder sie können mit Hilfe der Methode * getRemainingArgs ermittelt werden. Zusätzliche Argumente * sind sinnvoll, wenn den Optionen z.B. eine URL- oder Pfadangabe folgt, * welche nicht von einer Option eingeleitet wird. * *
      * *
      	 * cocs checkout --verbose file:///repository
      	 * 
      *

      * In diesem Beispiel wird die URL nicht von einer Option begleitet. Sie * gilt als "überzähliges Argument". *

      *
      * * @param ignoreUnknownOptions * boolean * @return boolean * @exception OptionException */ public boolean validate(boolean ignoreUnknownOptions) throws OptionException { Iterator> iterator = optList.iterator(); Option option; String arg; String str; String buffer = ""; int index = -1; int counter = 0; ArrayList argList = new ArrayList(args); while (iterator.hasNext()) { option = iterator.next(); option.isUnset(true); index = searchArgs(argList, option); if (index == -1 && option.isRequired()) { buffer += MessageFormat.format(ResourceServices.getString(res, "C_ERROR_OPTION_REQUIRED"), option.getUniqueName()) + "\n"; continue; } counter = 0; while (index != -1) { if (option.hasArgument()) { if (index == argList.size() - 1) { buffer += MessageFormat.format(ResourceServices .getString(res, "C_ERROR_OPTION_NEEDS_ARG"), option.getUniqueName()) + "\n"; argList.remove(index); index = searchArgs(argList, option); continue; } arg = argList.get(index + 1); if (arg.startsWith("-")) { buffer += MessageFormat.format(ResourceServices .getString(res, "C_ERROR_OPTION_NEEDS_ARG"), option.getUniqueName()) + "\n"; argList.remove(index); index = searchArgs(argList, option); continue; } if (option instanceof SelectOption) { SelectOption selopt = (SelectOption) option; if (selopt.checkArgument(arg) == false) { buffer += MessageFormat.format(ResourceServices .getString(res, "C_ERROR_OPTION_INVALID_VALUE"), option.getUniqueName(), arg, selopt .getListAsString()) + "\n"; argList.remove(index + 1); argList.remove(index); index = searchArgs(argList, option); continue; } } if (option instanceof PathOption) { PathOption pathopt = (PathOption) option; if (pathopt.checkArgument(arg) == false) { buffer += MessageFormat.format(ResourceServices .getString(res, "C_ERROR_OPTION_INVALID_PATH"), option.getUniqueName(), arg, pathopt .getInvalidPathElement()) + "\n"; argList.remove(index + 1); argList.remove(index); index = searchArgs(argList, option); continue; } } if (option instanceof FileOption) { FileOption fileopt = (FileOption) option; if (fileopt.checkArgument(arg) == false) { buffer += MessageFormat.format(ResourceServices .getString(res, "C_ERROR_OPTION_INVALID_FILE"), option.getUniqueName(), arg) + "\n"; argList.remove(index + 1); argList.remove(index); index = searchArgs(argList, option); continue; } } if (option instanceof DirectoryOption) { DirectoryOption diropt = (DirectoryOption) option; if (diropt.checkArgument(arg) == false) { buffer += MessageFormat .format(ResourceServices.getString(res, "C_ERROR_OPTION_INVALID_DIRECTORY"), option.getUniqueName(), arg) + "\n"; argList.remove(index + 1); argList.remove(index); index = searchArgs(argList, option); continue; } } if (option.isLowerCase()) { arg = arg.toLowerCase(); } if (option.isUnset() || option.isUnique()) { option.setValueFromString(arg); } else { option.addValueFromString(arg); } option.isPresent(true); argList.remove(index + 1); argList.remove(index); /* This option can have multiple arguments */ if (option.isUnique() == false) { int i; for (i = 0; i < argList.size(); i++) { arg = argList.get(i); if (arg.startsWith("-") == false) { option.addValueFromString(arg); } else { break; } } for (int j = 0; j < i; j++) { argList.remove(0); } } } else { String value = "true"; if (index + 1 < argList.size()) { String next = argList.get(index + 1); if (next.startsWith("-") == false) { value = next; argList.remove(index + 1); } } option.setValueFromString(value); option.isPresent(true); argList.remove(index); } // look for more appearances of this option. index = searchArgs(argList, option); if (option.isUnique() && index != -1 && counter == 0) { buffer += MessageFormat.format(ResourceServices.getString( res, "C_ERROR_OPTION_WAS_FOUND_MORE_THAN_ONCE"), option.getUniqueName()) + "\n"; } counter++; } } if (argList.size() > 0 && ignoreUnknownOptions == false) { str = ""; for (int i = 0; i < argList.size(); i++) { str += argList.get(i) + " "; } buffer += MessageFormat.format( ResourceServices.getString(res, "C_ERROR_OPTION_UNKNOWN"), str) + "\n"; } remainingArgs = new ArrayList(argList); if (buffer != null && buffer.length() > 0) { error = buffer; return false; } else { return true; } } public void write(PrintWriter writer) { Option option; String name; Object[] options = optList.toArray(); Arrays.sort(options); for (int i = 0; i < options.length; i++) { option = (Option) options[i]; name = option.getPropertyName(); if (option.getValue() != null) { if (name != null && name.length() > 0) { writer.println(option.getPropertyName() + "=" + escape(option.getValue().toString())); } } } } public Iterator> iterator() { return optList.iterator(); } /** * Describe list method here. * * @return a String value */ public String list() { StringBuffer buffer = new StringBuffer(); Object[] options = optList.toArray(); Arrays.sort(options); for (int i = 0; i < options.length; i++) { buffer.append(((Option) options[i]).toString() + "\n"); } return buffer.toString(); } /** * Describe init method here. * * @param cmdline * a String[] value */ private void init(String[] cmdline, int offset) { if (cmdline == null) { throw new IllegalArgumentException( "The argument cmdline may not be null!"); } if (offset < 0) { throw new IllegalArgumentException( "The argument offset must be greater than 0!"); } if (offset > cmdline.length) { throw new IllegalArgumentException( "The argument offset is greater than the length of the command line!"); } args = new ArrayList(); String arg; int pos; for (int i = offset; i < cmdline.length; i++) { arg = cmdline[i]; pos = arg.indexOf('='); if (arg.startsWith("--") && pos > 0) { args.add(arg.substring(0, pos)); if (pos + 1 < arg.length()) args.add(arg.substring(pos + 1)); else args.add(""); } else { args.add(cmdline[i]); } } optList = new ArrayList>(); optMap = new HashMap>(); deprecatedPropertiesMap = new HashMap>(); } /** * Describe searchArgs method here. * * @param longName * a String value * @param shortName * a String value * @return an int value */ private int searchArgs(ArrayList args, Option option) { if (args == null) { throw new IllegalArgumentException( " The argument args may not be null!"); } if (option == null) { throw new IllegalArgumentException( " The argument option may not be null!"); } String arg; for (int i = 0; i < args.size(); i++) { arg = args.get(i); if (arg.equals("--" + option.getLongName()) || arg.equals("-" + option.getMediumName()) || arg.equals("-" + option.getShortName())) { return i; } } return -1; } /** * Describe exists method here. * * @param longName * a String value * @param mediumName * a String value * @param shortName * a String value * @param propertyName * a String value * @return a boolean value */ private boolean exists(Option lookFor) { if (optList.contains(lookFor)) { return true; } if (isOptionNameAvailable(lookFor.getLongName()) == false) { return true; } if (isOptionNameAvailable(lookFor.getMediumName()) == false) { return true; } if (isOptionNameAvailable(lookFor.getShortName()) == false) { return true; } if (isOptionNameAvailable(lookFor.getPropertyName()) == false) { return true; } return false; } private boolean isOptionNameAvailable(String name) { if (name != null && name.length() > 0 && optMap.get(name) != null) { return false; } return true; } private String escape(String str) { if (str == null) { return ""; } StringBuffer buffer = new StringBuffer(); for (int i = 0; i < str.length(); i++) { char c = str.charAt(i); int n = (int) c; if (c == '\r') { continue; } if (n >= 0 && n < 128 && c != '\n' && c != '\\') { buffer.append(c); } else { buffer.append("\\u"); String hex = Integer.toHexString(n); for (int j = 0; j < 4 - hex.length(); j++) { buffer.append("0"); } buffer.append(hex); } } return buffer.toString(); } public boolean getFlag(String name, boolean def) { Option option = optMap.get(name); if (option != null && option instanceof BooleanOption) { return ((BooleanOption) option).getValue(); } return def; } public Option getTextOption(String name) { Option option = getOption(name); if (option instanceof SelectOption) { return (SelectOption) option; } if (option instanceof StringOption) { return (StringOption) option; } return null; } } /* * $Log$ */ src/java/org/dbdoclet/option/Resources_de.properties0000644000175000017500000000271312644165236023073 0ustar mathieumathieu#Created by JInto - www.guh-software.de #Wed Feb 18 12:53:36 CET 2009 C_ERROR_INVALID_NUMBER=Ung\u00FCltiger Parameter {1} f\u00FCr die Option {0}\! C_ERROR_INVALID_OPTION=Ung\u00FCltige Option\: C_ERROR_OPTION_ALREADY_IN_USE=Die Option {0} konnte nicht zur Optionsliste hinzugef\u00FCgt werden. Sie kollidiert mit {1}\! C_ERROR_OPTION_INVALID_DIRECTORY=Ung\u00FCltiges Verzeichnis {1} f\u00FCr die Option {0}\! Das Verzeichnis existiert nicht. C_ERROR_OPTION_INVALID_FILE=Ung\u00FCltige Datei {1} f\u00FCr die Option {0}\! Die Datei existiert nicht. C_ERROR_OPTION_INVALID_PATH=Ung\u00FCltiger Pfad {1} f\u00FCr die Option {0}\! Das Pfadelement {2} existiert nicht. C_ERROR_OPTION_INVALID_SHORT_NAME=Ung\u00FCltiger kurzer Optionsname\: {0}. C_ERROR_OPTION_INVALID_TYPE=Die Option {0} ist nicht vom Typ {1}, sondern vom Typ {2}. C_ERROR_OPTION_INVALID_VALUE=Ung\u00FCltiger Parameter {1} f\u00FCr die Option "{0}". M\u00F6gliche Parameter sind\: {2}. C_ERROR_OPTION_NEEDS_ARG=Die Option "{0}" ben\u00F6tigt ein Argument. C_ERROR_OPTION_REQUIRED=Die Option "{0}" ist zwingend erforderlich. C_ERROR_OPTION_UNKNOWN=Unbekannte Option(en)\: {0}. C_ERROR_OPTION_WAS_FOUND_MORE_THAN_ONCE=Die Option "{0}" trat mehr als einmal auf. C_ERROR_PROPERTY_UNKNOWN=Unbekannte Eigenschaft (Property)\: "{0}" C_ERROR_WRONG_OPTIONS=FEHLER Ung\u00FCltige Optionen\: C_WARN_PROPERTY_DEPRECATED=Die Eigenschaft (Property) "{0}" ist \u00FCberholt. Bitte verwenden Sie statt dessen die Eigenschaft "{1}". src/java/org/dbdoclet/option/Resources_en.properties0000644000175000017500000000235212644165236023104 0ustar mathieumathieu#Created by JInto - www.guh-software.de #Wed Feb 18 12:53:36 CET 2009 C_ERROR_INVALID_NUMBER=Invalid Parameter {1} for argument {0}\! Should be an integer. C_ERROR_INVALID_OPTION=Invalid option\: C_ERROR_OPTION_ALREADY_IN_USE=Can not add option {0}. There are naimng collisions with {1}\! C_ERROR_OPTION_INVALID_DIRECTORY=Invalid directory {1} for option {0}\! The directory does not exist. C_ERROR_OPTION_INVALID_FILE=Invalid file {1} for option {0}\! The file does not exist. C_ERROR_OPTION_INVALID_PATH=Invalid path {1} for option {0}\! The path element {2} does not exist. C_ERROR_OPTION_INVALID_SHORT_NAME=Invalid short option name\: {0}. C_ERROR_OPTION_INVALID_TYPE=The option {0} is not of type {1}, but of type {2}. C_ERROR_OPTION_INVALID_VALUE=The option "{0}" has an invalid value of "{1}". Possible values are\: {2}. C_ERROR_OPTION_NEEDS_ARG=The option "{0}" needs an argument. C_ERROR_OPTION_REQUIRED=The option "{0}" is required. C_ERROR_OPTION_UNKNOWN=Unknown option(s)\: {0}. C_ERROR_OPTION_WAS_FOUND_MORE_THAN_ONCE=The option "{0}" was found more than once. C_ERROR_PROPERTY_UNKNOWN=Unknown property\: "{0}" C_ERROR_WRONG_OPTIONS=ERROR Invalid options\: C_WARN_PROPERTY_DEPRECATED=The property "{0}" is deprecated. Please use "{1}" instead. src/java/org/dbdoclet/option/Option.java0000644000175000017500000002724312644165236020453 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.option; import java.util.ArrayList; import java.util.List; import java.util.ResourceBundle; import java.util.stream.Collectors; import org.dbdoclet.service.FileServices; public abstract class Option implements Comparable> { private static ResourceBundle res = ResourceBundle.getBundle("org.dbdoclet.option.Resources"); private String longName; private String shortName; private String mediumName; private String propertyName; private ArrayList values = new ArrayList(); private boolean isPresent = false; private boolean isRequired = false; private boolean isUnique = true; private boolean hasArgument = false; private boolean isLowerCase = false; private boolean isUnset = true; public Option() { this.longName = ""; this.shortName = ""; this.mediumName = ""; this.propertyName = ""; this.values = new ArrayList(); } public Option(String longName) { if (longName == null) { throw new IllegalArgumentException("Variable longName is null!"); } this.longName = longName; this.shortName = ""; this.mediumName = ""; this.propertyName = ""; this.values = new ArrayList(); } public Option(String longName, String shortName) { if (longName == null) { throw new IllegalArgumentException("Variable longName is null!"); } if (shortName == null) { throw new IllegalArgumentException("Variable shortName is null!"); } this.longName = longName; this.shortName = shortName; this.mediumName = ""; this.propertyName = ""; this.values = new ArrayList(); } public static ResourceBundle getResourceBundle() { return res; } public abstract void addValueFromString(String value); public void addValue(T value) { if (value == null) { throw new IllegalArgumentException("Variable value is null!"); } values.add(value); isUnset = false; } public int compareTo(Option other) { if (other == null) { return 1; } String name = getFQName(); return name.compareTo(other.getFQName()); } public boolean equals(Object obj) { if (obj == null) { return false; } if (obj instanceof Option) { Option option = (Option) obj; if (isValid() == false) { return false; } if (option.isValid() == false) { return false; } if (longName.equals(option.getLongName()) && mediumName.equals(option.getMediumName()) && shortName.equals(option.getShortName()) && propertyName.equals(option.getPropertyName())) { return true; } } return false; } public String getFQName() { String buffer = "("; if (propertyName != null && propertyName.length() > 0) { if (buffer.length() > 0 ) { buffer += "."; } buffer += propertyName; } if (longName != null && longName.length() > 0) { if (buffer.length() > 0 ) { buffer += "/"; } buffer += longName; } if (mediumName != null && mediumName.length() > 0) { if (buffer.length() > 0 ) { buffer += "/"; } buffer += mediumName; } if (shortName != null && shortName.length() > 0) { if (buffer.length() > 0 ) { buffer += "/"; } buffer += shortName; } buffer += ")"; return buffer; } public String getLongName() { return longName; } public String getMediumName() { return mediumName; } public String[] getNames() { ArrayList list = new ArrayList(); if (longName != null && longName.length() > 0 && list.contains(longName) == false) { list.add(longName); } if (mediumName != null && mediumName.length() > 0 && list.contains(mediumName) == false) { list.add(mediumName); } if (shortName != null && shortName.length() > 0 && list.contains(shortName) == false) { list.add(shortName); } if (propertyName != null && propertyName.length() > 0 && list.contains(propertyName) == false) { list.add(propertyName); } String[] names = new String[list.size()]; for (int i = 0; i 0) { return "--" + longName; } if (mediumName != null && mediumName.length() > 0) { return "-" + mediumName; } if (shortName != null && shortName.length() > 0) { return "-" + shortName; } if (propertyName != null && propertyName.length() > 0) { return propertyName; } return "???"; } public T getValue() { T value = null; if (values.size() > 0) { value = values.get(0); } return value; } public ArrayList getValues() { return values; } public int hashCode() { int result = 17; result = 37 * result + longName.hashCode(); result = 37 * result + mediumName.hashCode(); result = 37 * result + shortName.hashCode(); result = 37 * result + propertyName.hashCode(); return result; } public boolean isLowerCase() { return isLowerCase; } public boolean isRequired() { return isRequired; } public Option isRequired(boolean value) { isRequired = value; return this; } public boolean isUnique() { return isUnique; } public Option isUnique(boolean value) { isUnique = value; return this; } public boolean isUnset() { return isUnset; } public void isUnset(boolean isUnset) { this.isUnset = isUnset; } public boolean isValid() { if (longName == null) { return false; } if (mediumName == null) { return false; } if (shortName == null) { return false; } if (propertyName == null) { return false; } if (longName.length() == 0 && mediumName.length() == 0 && shortName.length() == 0 && propertyName.length() == 0) { return false; } return true; } public Option setDefault(T value) { if (value == null) { throw new IllegalArgumentException(" The argument value may not be null!"); } values.clear(); values.add(value); return this; } public Option setLongName(String longName) { if (longName == null) { throw new IllegalArgumentException(" The argument longName may not be null!"); } this.longName = longName; return this; } public void setLowerCase(boolean isLowerCase) { this.isLowerCase = isLowerCase; } public Option setMediumName(String mediumName) { if (mediumName == null) { throw new IllegalArgumentException(" The argument mediumName may not be null!"); } this.mediumName = mediumName; return this; } public Option setPropertyName(String propertyName) { if (propertyName == null) { throw new IllegalArgumentException(" The argument propertyName may not be null!"); } this.propertyName = propertyName; return this; } public Option setShortName(String shortName) { if (shortName == null) { throw new IllegalArgumentException(" The argument shortName may not be null!"); } this.shortName = shortName; return this; } public abstract void setValueFromString(String value); public void setValue(T value) { if (value == null) { throw new IllegalArgumentException("Variable value is null!"); } values.clear(); values.add(value); isUnset = false; } public String toString() { StringBuilder buffer = new StringBuilder(); if (propertyName != null && propertyName.length() > 0) { buffer.append(propertyName + " "); } if (longName != null && longName.length() > 0) { buffer.append(longName + " "); } if (mediumName != null && mediumName.length() > 0) { buffer.append(mediumName + " "); } if (shortName != null && shortName.length() > 0) { buffer.append(shortName + " "); } buffer.append("["); if (hasArgument) { buffer.append('A'); } else { buffer.append('a'); } if (isPresent) { buffer.append('P'); } else { buffer.append('p'); } if (isRequired) { buffer.append('R'); } else { buffer.append('r'); } buffer.append(']'); for (int j = buffer.length(); j < 32; j++) { buffer.append('.'); } buffer.append(": "); List csList = values.stream().map(T::toString).collect(Collectors.toList()); buffer.append(String.join(", ", csList)); return buffer.toString(); } protected boolean checkArgument(String arg) { return true; } protected String expandPath(String arg) { if (arg.startsWith("~") == true) { arg = FileServices.appendPath(System.getProperty("user.home"), arg .substring(1)); } return arg; } protected boolean hasArgument() { return hasArgument; } // Implementation of java.lang.Comparable protected void hasArgument(boolean value) { hasArgument = value; } protected void isPresent(boolean value) { isPresent = value; } public abstract OptionType getType(); } src/java/org/dbdoclet/option/Resources.properties0000644000175000017500000000271312644165236022423 0ustar mathieumathieu#Created by JInto - www.guh-software.de #Wed Feb 18 12:53:36 CET 2009 C_ERROR_INVALID_NUMBER=Ung\u00FCltiger Parameter {1} f\u00FCr die Option {0}\! C_ERROR_INVALID_OPTION=Ung\u00FCltige Option\: C_ERROR_OPTION_ALREADY_IN_USE=Die Option {0} konnte nicht zur Optionsliste hinzugef\u00FCgt werden. Sie kollidiert mit {1}\! C_ERROR_OPTION_INVALID_DIRECTORY=Ung\u00FCltiges Verzeichnis {1} f\u00FCr die Option {0}\! Das Verzeichnis existiert nicht. C_ERROR_OPTION_INVALID_FILE=Ung\u00FCltige Datei {1} f\u00FCr die Option {0}\! Die Datei existiert nicht. C_ERROR_OPTION_INVALID_PATH=Ung\u00FCltiger Pfad {1} f\u00FCr die Option {0}\! Das Pfadelement {2} existiert nicht. C_ERROR_OPTION_INVALID_SHORT_NAME=Ung\u00FCltiger kurzer Optionsname\: {0}. C_ERROR_OPTION_INVALID_TYPE=Die Option {0} ist nicht vom Typ {1}, sondern vom Typ {2}. C_ERROR_OPTION_INVALID_VALUE=Ung\u00FCltiger Parameter {1} f\u00FCr die Option "{0}". M\u00F6gliche Parameter sind\: {2}. C_ERROR_OPTION_NEEDS_ARG=Die Option "{0}" ben\u00F6tigt ein Argument. C_ERROR_OPTION_REQUIRED=Die Option "{0}" ist zwingend erforderlich. C_ERROR_OPTION_UNKNOWN=Unbekannte Option(en)\: {0}. C_ERROR_OPTION_WAS_FOUND_MORE_THAN_ONCE=Die Option "{0}" trat mehr als einmal auf. C_ERROR_PROPERTY_UNKNOWN=Unbekannte Eigenschaft (Property)\: "{0}" C_ERROR_WRONG_OPTIONS=FEHLER Ung\u00FCltige Optionen\: C_WARN_PROPERTY_DEPRECATED=Die Eigenschaft (Property) "{0}" ist \u00FCberholt. Bitte verwenden Sie statt dessen die Eigenschaft "{1}". src/java/org/dbdoclet/option/SelectOption.java0000644000175000017500000000472712644165236021615 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.option; /** * Die Klasse SelectOption definiert eine Option, die einen Wert * aus einer Menge vorbestimmter Werte annehmen kann. * * Das folgende Beispiel zeigt die Definition der Option "cmd", die die Werte * list, extract und create annehmen kann. * *
      *
        SelectOption optCmd = new SelectOption("cmd", "c");
       *  optCmd.isRequired(true);
       *  String[] optCmdList = { "list", "extract", "create" };
       *  optCmd.setList(optCmdList);
       *  options.add(optCmd);
      *
      * * @author Michael Fuchs * @version 1.0 */ public class SelectOption extends Option { private String[] list; public SelectOption() { super(); hasArgument(true); } public SelectOption(String longName, String shortName) { super(longName, shortName); hasArgument(true); } public void setList(String[] list) { this.list = list; } public String getListAsString() { String buffer = ""; for (int i = 0; i. */ package org.dbdoclet.option; import java.io.File; /** * Die Klasse DirectoryOption verarbeitet ein Argument auf der * Kommandozeile, das ein Verzeichnis angibt. * * @author michael * */ public class DirectoryOption extends Option { private boolean isExisting = false; private boolean createPath = false; public DirectoryOption() { super(); hasArgument(true); } public DirectoryOption(String longName) { super(longName); hasArgument(true); } public DirectoryOption(String longName, String shortName) { super(longName, shortName); hasArgument(true); } public void isExisting(boolean value) { isExisting = value; } public void setCreatePath(boolean createPath) { this.createPath = createPath; } protected boolean checkArgument(String arg) { arg = expandPath(arg); File file = new File(arg); if (file.exists() == false && createPath == true) { file.mkdirs(); } if (isExisting == true && file.exists() == false) { return false; } if (file.exists() == true && file.isDirectory() == false) { return false; } return true; } @Override public void addValueFromString(String value) { addValue(new File(expandPath(value))); } @Override public void setValueFromString(String value) { setValue(new File(expandPath(value))); } @Override public OptionType getType() { return OptionType.FILE; } } src/java/org/dbdoclet/option/FileOption.java0000644000175000017500000000354412644165236021251 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.option; import java.io.File; /** * Die Klasse FileOption verarbeitet ein Argument der * Kommandozeile, das eine Datei spezifiziert. * * @author michael * */ public class FileOption extends Option { private boolean isExisting = false; public FileOption() { super(); hasArgument(true); } public FileOption(String longName) { super(longName); hasArgument(true); } public FileOption(String longName, String shortName) { super(longName, shortName); hasArgument(true); } @Override public void addValueFromString(String value) { addValue(new File(expandPath(value))); } public void isExisting(boolean value) { isExisting = value; } @Override public void setValueFromString(String value) { setValue(new File(expandPath(value))); } protected boolean checkArgument(String arg) { arg = expandPath(arg); File file = new File(arg); if (isExisting == true && file.exists() == false) { return false; } if (file.exists() == true && file.isFile() == false) { return false; } return true; } @Override public OptionType getType() { return OptionType.FILE; } } src/java/org/dbdoclet/template/0000755000175000017500000000000012644165236016633 5ustar mathieumathieusrc/java/org/dbdoclet/template/TemplateTransformer.java0000644000175000017500000001476412644165236023510 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.template; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; import java.io.StringReader; import java.io.StringWriter; import java.util.Iterator; import java.util.Map; import org.dbdoclet.service.StringServices; public class TemplateTransformer { private BufferedReader reader; public static TemplateTransformer newInstance(File template) throws TemplateTransformException { if (template == null) { throw new IllegalArgumentException("The argument template may not be null!"); } BufferedReader reader = null; try { reader = new BufferedReader(new FileReader(template)); } catch (IOException oops) { throw new TemplateTransformException(oops.getMessage(), oops); } return new TemplateTransformer(reader); } public static TemplateTransformer newInstance(BufferedReader template) throws TemplateTransformException { if (template == null) { throw new IllegalArgumentException("The argument template may not be null!"); } return new TemplateTransformer(template); } public static TemplateTransformer newInstance(String template) throws TemplateTransformException { if (template == null) { throw new IllegalArgumentException("The argument template may not be null!"); } return new TemplateTransformer(new BufferedReader(new StringReader(template))); } private TemplateTransformer(BufferedReader reader) { this.reader = reader; } public String transform(Map vars) throws TemplateTransformException { StringWriter buffer = new StringWriter(); transform(vars, new PrintWriter(buffer)); return buffer.toString(); } public void transform(Map vars, String fileName) throws TemplateTransformException { if (fileName == null) { throw new IllegalArgumentException("The argument fileName must not be null!"); } transform(vars, new File(fileName)); } public void transform(Map vars, File file) throws TemplateTransformException { if (file == null) { throw new IllegalArgumentException("The argument file must not be null!"); } try { // if (file.getName().equals("default.css")) { // trace = true; // } transform(vars, new FileWriter(file)); } catch (IOException oops) { throw new TemplateTransformException(oops.getMessage(), oops); } } public void transform(Map vars, FileWriter fileWriter) throws TemplateTransformException { if (fileWriter == null) { throw new IllegalArgumentException("The argument fileWriter must not be null!"); } PrintWriter writer = new PrintWriter(fileWriter); transform(vars, writer); writer.close(); } public void transform(Map vars, PrintWriter writer) throws TemplateTransformException { if (reader == null) { throw new IllegalStateException("The field reader may not be null!"); } if (vars == null) { throw new IllegalArgumentException("The argument vars may not be null!"); } if (writer == null) { throw new IllegalArgumentException("The argument writer may not be null!"); } try { Iterator iterator; String name; Object value; String line; StringBuffer buffer = new StringBuffer(); while ((line = reader.readLine()) != null ) { if (line.trim().length() == 0) { buffer.append(line); buffer.append('\n'); continue; } if (line.indexOf('$') == -1) { buffer.append(line); buffer.append('\n'); continue; } // if (trace) { // System.out.println("line=" + line); // } iterator = vars.keySet().iterator(); while (iterator.hasNext()) { name = iterator.next(); value = vars.get(name); if (value != null) { name = "${" + name + "}"; // if (trace && name.equals("${css.hl1.font}")) { // System.out.println("name=" + name); // } line = StringServices.replace(line, name, value.toString()); // if (trace && name.equals("${css.hl1.font}")) { // System.out.println("new line=" + line); // } } } buffer.append(line); buffer.append('\n'); } reader.close(); // String str = ReplaceServices.replaceAll(buffer.toString(), "\\$\\{\\w*\\}", ""); String str = buffer.toString(); BufferedReader bufferReader = new BufferedReader(new StringReader(str)); while ((line = bufferReader.readLine()) != null ) { writer.println(line); } bufferReader.close(); } catch (Exception oops) { throw new TemplateTransformException(oops.getMessage(), oops); } } } src/java/org/dbdoclet/template/TemplateTransformException.java0000644000175000017500000000206212644165236025024 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.template; public class TemplateTransformException extends Exception { /** * */ private static final long serialVersionUID = 1L; public TemplateTransformException(String msg) { super(msg); } public TemplateTransformException(String msg, Throwable oops) { super(msg, oops); } } src/java/org/dbdoclet/format/0000755000175000017500000000000012644165236016310 5ustar mathieumathieusrc/java/org/dbdoclet/format/FormattedObject.java0000644000175000017500000000242612644165236022233 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.format; import java.awt.Color; import org.dbdoclet.unit.Length; public interface FormattedObject { public void setAlignment(Alignment alignment); public void setFontWeight(FontWeight fontWeight); public void setFontSize(Length value); public void setDisplay(Display value); public void setMarginTop(Length value); public void setMarginBottom(Length value); public void setMarginLeft(Length value); public void setMarginRight(Length value); public void setForeground(Color value); public void setFontFamily(String value); } src/java/org/dbdoclet/format/FontWeight.java0000644000175000017500000000145312644165236021234 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.format; public enum FontWeight { NORMAL, BOLD, BOLDER, LIGHTER } src/java/org/dbdoclet/format/Display.java0000644000175000017500000000143012644165236020556 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.format; public enum Display { BLOCK, INLINE } src/java/org/dbdoclet/format/Alignment.java0000644000175000017500000000144012644165236021070 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.format; public enum Alignment { CENTER, LEFT, RIGHT } src/java/org/dbdoclet/FileAccessDeniedException.java0000644000175000017500000000213112644165236022651 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet; import java.io.File; public class FileAccessDeniedException extends RuntimeException { /** * */ private static final long serialVersionUID = 1L; private File file; public FileAccessDeniedException(File file) { super(file.getAbsolutePath()); this.file = file; } public File getFile() { return file; } } src/java/org/dbdoclet/jive/0000755000175000017500000000000012644165244015754 5ustar mathieumathieusrc/java/org/dbdoclet/jive/JiveConstants.java0000644000175000017500000000351512644165236021416 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.jive; import java.awt.Color; public class JiveConstants { public static final Color COLOUR_BEIGE = Color.decode("#F5F5DC"); public static final Color COLOUR_GRAY_31 = Color.decode("#4f4f4f"); public static final Color COLOUR_GRAY_20 = Color.decode("#333333"); public static final Color COLOUR_BLUE_GRAY_1 = Color.decode("#6699CC"); public static final Color COLOUR_BLUE_GRAY_4 = Color.decode("#113366"); public static final Color COLOUR_DARK_ORANGE = Color.decode("#FF8C00"); public static final Color COLOUR_DARK_ORANGE_4 = Color.decode("#8B4500"); public static final Color COLOUR_FIREBRICK_1 = Color.decode("#FF3030"); public static final Color COLOUR_FIREBRICK_4 = Color.decode("#8B1A1A"); public static final Color COLOUR_RED_1 = Color.decode("#FF0000"); public static final Color COLOUR_RED_4 = Color.decode("#8B0000"); public static final Color COLOUR_SAND = Color.decode("#EDC9AF"); public static final Color COLOUR_STEEL_BLUE = Color.decode("#4682B4"); public static final Color COLOUR_STEEL_BLUE_1 = Color.decode("#63B8FF"); public static final Color COLOUR_STEEL_BLUE_4 = Color.decode("#36648B"); } src/java/org/dbdoclet/jive/Rowspan.java0000644000175000017500000000260612644165236020255 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.jive; public class Rowspan { public static final Rowspan RS_1 = new Rowspan(1); public static final Rowspan RS_2 = new Rowspan(2); public static final Rowspan RS_3 = new Rowspan(3); public static final Rowspan RS_4 = new Rowspan(4); public static final Rowspan RS_5 = new Rowspan(5); private int value = 1; public Rowspan() { this(1); } public Rowspan(int value) { if (value < 1) { value = 1; } this.value = value; } public int getValue() { return value; } public void setValue(int value) { this.value = value; } } src/java/org/dbdoclet/jive/JiveFactory.java0000644000175000017500000010043512644165236021050 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.jive; import java.awt.Color; import java.awt.Component; import java.awt.Container; import java.awt.Dimension; import java.awt.Font; import java.awt.FontFormatException; import java.awt.Frame; import java.awt.LayoutManager; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.io.IOException; import java.io.InputStream; import java.net.URL; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.Locale; import java.util.ResourceBundle; import javax.help.CSH; import javax.help.HelpBroker; import javax.help.HelpSet; import javax.swing.AbstractAction; import javax.swing.AbstractButton; import javax.swing.BorderFactory; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JCheckBox; import javax.swing.JComboBox; import javax.swing.JComponent; import javax.swing.JEditorPane; import javax.swing.JLabel; import javax.swing.JList; import javax.swing.JMenu; import javax.swing.JMenuItem; import javax.swing.JPanel; import javax.swing.JPasswordField; import javax.swing.JRadioButton; import javax.swing.JScrollPane; import javax.swing.JSpinner; import javax.swing.JSplitPane; import javax.swing.JTabbedPane; import javax.swing.JTable; import javax.swing.JTextArea; import javax.swing.JTextField; import javax.swing.JTextPane; import javax.swing.JToggleButton; import javax.swing.JToolBar; import javax.swing.JTree; import javax.swing.SpinnerNumberModel; import javax.swing.SwingConstants; import javax.swing.UIManager; import javax.swing.UIManager.LookAndFeelInfo; import javax.swing.border.Border; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; import javax.swing.text.Document; import javax.swing.text.JTextComponent; import javax.swing.text.html.HTMLDocument; import javax.swing.text.html.StyleSheet; import javax.swing.tree.TreeModel; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.dbdoclet.Identifier; import org.dbdoclet.jive.action.ActionSetLookAndFeel; import org.dbdoclet.jive.model.SpinnerDistanceModel; import org.dbdoclet.jive.sheet.Sheet; import org.dbdoclet.jive.sheet.SheetContainer; import org.dbdoclet.jive.widget.GridPanel; import org.dbdoclet.jive.widget.IdentifierTextField; import org.dbdoclet.jive.widget.LanguageListBox; import org.dbdoclet.jive.widget.MimeTypeListBox; import org.dbdoclet.jive.widget.NumberTextField; import org.dbdoclet.jive.widget.PathList; import org.dbdoclet.jive.widget.RichLabel; import org.dbdoclet.jive.widget.SpinnerDistanceEditor; import org.dbdoclet.jive.widget.UpperCaseTextField; import org.dbdoclet.service.ResourceServices; import org.dbdoclet.service.StringServices; import org.dbdoclet.unit.Length; /** * Fabrikklasse zu Erzeugung von Swing-Komponenten. JiveFactory ist eine * Singleton-Klasse die es nur einmal innerhalb einer Swing-Applikation geben * darf. Alle erzeugten Komponenten werden in einer Hashtabelle gespeichert und * können so von überall unter ihrem Namen angesprochen werden. * * @author michael */ public final class JiveFactory implements ItemListener, DocumentListener, ActionListener, ChangeListener { private static Log logger = LogFactory.getLog(JiveFactory.class); private static JiveFactory singleton; private ImageIcon applicationIcon; private URL backgroundImageUrl = null; private Font defaultFont = null; private Color defaultForeground; private Color helpAreaBackground = null; private Border helpAreaBorder = null; private HelpBroker helpBroker; private HelpSet helpSet; private final Locale locale; private ResourceBundle res = ResourceBundle .getBundle("org/dbdoclet/jive/Resources"); private ArrayList saveWidgetList; private final HashMap widgetMap; private Color defaultBackground; /** * Erzeugt eine neue Instanz der Klasse JiveFactory. Da es nur * eine Instanz dieser Klasse geben darf ist der Konstruktur für andere * Objekte nicht sichtbar. * * @param locale */ private JiveFactory(Locale locale) { if (locale == null) { throw new IllegalArgumentException( "The argument locale must not be null!"); } this.locale = locale; widgetMap = new HashMap(); res = ResourceBundle.getBundle("org/dbdoclet/jive/Resources", locale); } /** * Ermittelt die Objektinstanz des Fensterrahmens innerhalb dessen sich die * übergebene Kompontente befindet. * * @param comp * @return Frame */ public static Frame findParentFrame(JComponent comp) { if (comp == null) { return null; } Container parent = comp.getParent(); while (parent != null) { if (parent instanceof Frame) { return (Frame) parent; } parent = parent.getParent(); } return null; } /** * Liefert die Instanz der Fabrikklasse. * * @return JiveFactory */ public static JiveFactory getInstance() { if (singleton == null) { singleton = getInstance(Locale.getDefault()); } return singleton; } /** * Liefert eine Instanz der Fabrikklasse mit der angegebenen Lokalisierung. * * @param locale * @return JiveFactory */ public static JiveFactory getInstance(Locale locale) { System.setProperty("swing.aatext", "true"); if (singleton != null) { logger.warn("Changing locale of global singleton WidgetMap to " + locale.toString()); singleton.setLocale(locale); } else { singleton = new JiveFactory(locale); } return singleton; } /** * Wird derzeit nur zum Zweck des Debuggens verwendet. */ public void actionPerformed(ActionEvent event) { logger.debug("event=" + event); logger.debug("ActionEvent: \n" + " Source = '" + event.getSource().getClass().getName() + "'\n" + " ID = '" + event.getID() + "'\n" + " ActionCommand = '" + event.getActionCommand() + "'\n"); } /** * Fügt eine Komponente der Liste der Speicher-Komponenten hinzu. * * @param widget */ public void addSaveWidget(JComponent widget) { if (saveWidgetList == null) { saveWidgetList = new ArrayList(); } if (widget != null && saveWidgetList.contains(widget) == false) { saveWidgetList.add(widget); } } public void changedUpdate(DocumentEvent documentEvent) { enableSaveWidgets(); } /** * Erzeugt einen Button mit der ID key und der angegebenen * action. * * @param key * @param action * @return JButton */ public JButton createButton(Identifier key, AbstractAction action) { JButton button = new JButton(action); addWidget(key, button); return button; } /** * Erzeugt einen Button mit der ID key und der angegebenen * Aufschrift. * * @param key * @param text * @return JButton */ public JButton createButton(Identifier key, String text) { return createButton(key, text, null); } public JButton createButton(Identifier key, String text, String icon) { if (text == null) { throw new IllegalArgumentException( "The argument text must not be null!"); } URL url = null; if (icon != null && icon.length() > 0) { String location = "toolbarButtonGraphics/" + icon + "24.gif"; url = ClassLoader.getSystemResource(location); if (url == null) { url = getClass().getResource(location); } } JButton button; if (url != null) { button = new JButton(text, new ImageIcon(url)); } else { button = new JButton(text); } addWidget(key, button); return button; } public JButton createButton(String label) { return createButton(null, label); } public JCheckBox createCheckBox() { return createCheckBox(null, null); } public JCheckBox createCheckBox(Identifier key, String label) { JCheckBox checkBox = new JCheckBox(label); checkBox.addItemListener(this); addWidget(key, checkBox); return checkBox; } public JCheckBox createCheckBox(String label) { return createCheckBox(null, label); } public JComboBox createComboBox(Identifier key) { return createComboBox(key, null); } public JComboBox createComboBox(Identifier key, T[] list) { JComboBox comboBox; if (list == null) { comboBox = new JComboBox(); } else { comboBox = new JComboBox(list); } comboBox.addItemListener(this); addWidget(key, comboBox); return comboBox; } public JSpinner createDistanceSpinner() { return createDistanceSpinner(null, null); } public JSpinner createDistanceSpinner(Identifier key) { return createDistanceSpinner(key, null, true); } public JSpinner createDistanceSpinner(Identifier key, boolean excludePercent) { return createDistanceSpinner(key, null, excludePercent); } public JSpinner createDistanceSpinner(Identifier key, Length distance) { return createDistanceSpinner(key, distance, true); } public JSpinner createDistanceSpinner(Identifier key, Length distance, boolean excludePercent) { SpinnerDistanceModel model = new SpinnerDistanceModel(getLocale()); model.setExcludePercent(excludePercent); JSpinner spinner = new JSpinner(model); if (distance != null) { spinner.setValue(distance); } Dimension preferredSize = spinner.getPreferredSize(); if (preferredSize.width < 100) { preferredSize.width = 100; } spinner.setPreferredSize(preferredSize); spinner.setEditor(new SpinnerDistanceEditor(spinner)); spinner.addChangeListener(this); addWidget(key, spinner); return spinner; } public JSpinner createDistanceSpinner(Length length) { return createDistanceSpinner(null, length); } public JLabel createEntryHelp(String text) { if (text == null) { throw new IllegalArgumentException( "The argument text must not be null!"); } text = createToolTipText(text); JLabel label = new JLabel("Help24", JiveServices.getJlfgrIcon( "general", "Help24.gif"), SwingConstants.CENTER); label.setToolTipText(text); label.setForeground(new Color(0, 0, 205)); return label; } public JTextComponent createErrorArea(Identifier key, JComponent parent) { return createErrorArea(key, parent, ""); } public JTextComponent createErrorArea(Identifier key, JComponent parent, String text) { if (parent == null) { throw new IllegalArgumentException( "The argument parent must not be null!"); } if (text == null) { throw new IllegalArgumentException( "The argument text must not be null!"); } JEditorPane errorArea = new JEditorPane(); errorArea.setEditable(false); errorArea.setFocusable(false); errorArea.setBackground(Color.white); errorArea.setBorder(BorderFactory.createCompoundBorder( BorderFactory.createLineBorder(new Color(139, 0, 0)), BorderFactory.createEmptyBorder(5, 5, 5, 5))); if (text.toLowerCase().startsWith("") == true) { errorArea.setContentType("text/html"); Document doc = errorArea.getDocument(); if (doc instanceof HTMLDocument) { HTMLDocument htmlDoc = (HTMLDocument) doc; StyleSheet styleSheet = htmlDoc.getStyleSheet(); Font defaultFont = parent.getFont(); String fontFamily = defaultFont.getFamily(); int fontSize = defaultFont.getSize(); styleSheet.addRule("body {" + " color: #8b0000;" + " font-family: " + fontFamily + ";" + " font-size: " + fontSize + ";" + "}"); styleSheet.addRule("h1, h2 {" + " font-family: " + fontFamily + ";" + " font-size: " + fontSize + ";" + " margin: 2px;" + "}"); styleSheet.addRule("p {" + " text-indent: 8px;" + " margin: 2px;" + "}"); errorArea.setText(text); } } else { errorArea.setContentType("text/plain"); errorArea.setText(text); } addWidget(key, errorArea); return errorArea; } public JTextComponent createErrorArea(JComponent parent, String text) { return createErrorArea(null, parent, text); } public JLabel createHeading(Identifier key, String text) { if (text == null) { throw new IllegalArgumentException( "The argument text must not be null!"); } JLabel label = new JLabel(text); Font font = label.getFont(); String fontName = font.getName(); int fontSize = (int) (font.getSize() * 1.6); Font headingFont = new Font(fontName, Font.BOLD, fontSize); label.setFont(headingFont); label.setForeground(new Color(01, 48, 114)); addWidget(key, label); return label; } public JTextComponent createHelpArea(Identifier key, JComponent parent) { return createHelpArea(key, parent, ""); } public JTextComponent createHelpArea(Identifier key, JComponent parent, String text) { if (parent == null) { throw new IllegalArgumentException( "The argument parent must not be null!"); } if (text == null) { throw new IllegalArgumentException( "The argument text must not be null!"); } JEditorPane helpArea = new JEditorPane(); helpArea.setEditable(false); helpArea.setFocusable(false); if (helpAreaBackground == null) { helpArea.setBackground(parent.getBackground()); } else { helpArea.setBackground(helpAreaBackground); } if (helpAreaBorder == null) { helpArea.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); } else { helpArea.setBorder(helpAreaBorder); } // helpArea.setMinimumSize(new Dimension(400, 100)); // helpArea.setPreferredSize(new Dimension(400, 100)); if (text.toLowerCase().startsWith("") == true) { helpArea.setContentType("text/html"); Document doc = helpArea.getDocument(); if (doc instanceof HTMLDocument) { HTMLDocument htmlDoc = (HTMLDocument) doc; StyleSheet styleSheet = htmlDoc.getStyleSheet(); Font defaultFont = parent.getFont(); String fontFamily = defaultFont.getFamily(); int fontSize = defaultFont.getSize(); styleSheet.addRule("body {" + " font-family: " + fontFamily + ";" + " font-size: " + (fontSize - 2) + ";" + "}"); styleSheet.addRule("h1, h2 {" + " font-family: " + fontFamily + ";" + " font-size: " + (fontSize - 1) + ";" + " color: #031071;" + " margin: 2px;" + "}"); styleSheet.addRule("p {" // + " text-indent: 8px;" + " margin: 2px;" + "}"); styleSheet.addRule("p.error {" + " color: red;" + "}"); helpArea.setText(text); } } else { helpArea.setContentType("text/plain"); helpArea.setText(text); } addWidget(key, helpArea); return helpArea; } public JTextComponent createHelpArea(JComponent parent) { return createHelpArea(null, parent, ""); } public JTextComponent createHelpArea(JComponent parent, String text) { return createHelpArea(null, parent, text); } public JEditorPane createHtmlArea(Identifier key, JComponent parent, String text) { if (parent == null) { throw new IllegalArgumentException( "The argument parent must not be null!"); } if (text == null) { throw new IllegalArgumentException( "The argument text must not be null!"); } JEditorPane htmlArea = new JEditorPane("text/html", text); htmlArea.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); htmlArea.setEditable(false); // htmlArea.setFocusable(false); htmlArea.setMinimumSize(new Dimension(200, 100)); addWidget(key, htmlArea); if (text.toLowerCase().startsWith("") == true) { htmlArea.setContentType("text/html"); Document doc = htmlArea.getDocument(); if (doc instanceof HTMLDocument) { HTMLDocument htmlDoc = (HTMLDocument) doc; StyleSheet styleSheet = htmlDoc.getStyleSheet(); Font defaultFont = parent.getFont(); String fontFamily = defaultFont.getFamily(); int fontSize = defaultFont.getSize(); styleSheet.addRule("body {" + " font-family: " + fontFamily + ";" + " font-size: " + fontSize + ";" + "}"); } } return htmlArea; } public JButton createIconButton(Identifier key, ImageIcon icon) { if (icon == null) { throw new IllegalArgumentException( "The argument icon must not be null!"); } JButton button = new JButton(icon); button.setActionCommand("icon-button"); button.addActionListener(this); addWidget(key, button); return button; } public IdentifierTextField createIdentifierTextField(Identifier key, int width) { IdentifierTextField textfield = new IdentifierTextField(width); addWidget(key, textfield); return textfield; } public IdentifierTextField createIdentifierTextField(int width) { return createIdentifierTextField(null, width); } public JLabel createLabel(Identifier key, String text) { return createLabel(key, text, Font.BOLD); } public JLabel createLabel(Identifier key, String text, int style) { if (text == null) { throw new IllegalArgumentException( "The argument text must not be null!"); } JLabel label = new JLabel(text); Font font = label.getFont(); label.setFont(font.deriveFont(style)); addWidget(key, label); return label; } public JLabel createLabel(String text) { return createLabel(null, text, Font.BOLD); } public JLabel createLabel(String text, int style) { return createLabel(null, text, style); } public LanguageListBox createLanguageListBox(Identifier key, Locale locale) { LanguageListBox llb = new LanguageListBox(locale); addWidget(key, llb); return llb; } public JList createList(Identifier key) { JList list = new JList(); addWidget(key, list); if (defaultBackground != null) { list.setBackground(defaultBackground.brighter()); } return list; } public JMenu createLookAndFeelMenu(ArrayList componentList) { if (componentList == null) { throw new IllegalArgumentException( "The argument frame must not be null!"); } JMenuItem menuItem; JMenu menu = new JMenu(ResourceServices.getString(res, "C_LOOK_AND_FEEL")); LookAndFeelInfo[] infoList = UIManager.getInstalledLookAndFeels(); for (int i = 0; i < infoList.length; i++) { menuItem = new JMenuItem(infoList[i].getName()); menuItem.setAction(new ActionSetLookAndFeel(infoList[i].getName(), infoList[i], componentList)); menu.add(menuItem); } return menu; } public JMenu createMenu(Identifier key, String text) { if (text == null) { throw new IllegalArgumentException( "The argument text must not be null!"); } JMenu menu = new JMenu(text); // menu.setFont(font); addWidget(key, menu); return menu; } public JMenu createMenu(String text) { return createMenu(null, text); } /** * Erzeugt einen Menüeintrag. * * @param key * @param action * @return JMenuItem */ public JMenuItem createMenuItem(Identifier key, AbstractAction action) { JMenuItem menuItem = new JMenuItem(action); addWidget(key, menuItem); return menuItem; } public JMenuItem createMenuItem(Identifier key, String text) { if (text == null) { throw new IllegalArgumentException( "The argument text must not be null!"); } JMenuItem menuitem = new JMenuItem(text); addWidget(key, menuitem); return menuitem; } public MimeTypeListBox createMimeTypeListBox(Identifier key) { MimeTypeListBox mtlb = new MimeTypeListBox(); addWidget(key, mtlb); return mtlb; } public JSpinner createNumberSpinner(Identifier key, int value, int min, int max, int step) { JSpinner spinner = new JSpinner(new SpinnerNumberModel(value, min, max, step)); addWidget(key, spinner); return spinner; } public NumberTextField createNumberTextField(Identifier key, int width) { NumberTextField textfield = new NumberTextField(width); textfield.getDocument().addDocumentListener(this); textfield.addActionListener(this); addWidget(key, textfield); return textfield; } public NumberTextField createNumberTextField(int width) { return createNumberTextField(null, width); } public JPanel createPanel(Identifier key) { return createPanel(key, null); } public JPanel createPanel(Identifier key, LayoutManager layoutManager) { JPanel panel; if (layoutManager != null) { panel = new JPanel(layoutManager); } else { panel = new JPanel(); } addWidget(key, panel); return panel; } public JPasswordField createPasswordField(Identifier key, int width) { JPasswordField passwordfield = new JPasswordField(width); passwordfield.setMinimumSize(passwordfield.getPreferredSize()); addWidget(key, passwordfield); return passwordfield; } public PathList createPathList(Identifier key, int filterMask) { PathList pathlist = new PathList(this, filterMask); addWidget(key, pathlist); return pathlist; } public JRadioButton createRadioButton(Identifier key, ImageIcon icon) { JRadioButton button = new JRadioButton(icon); addWidget(key, button); return button; } public JRadioButton createRadioButton(Identifier key, String label) { JRadioButton button = new JRadioButton(label); addWidget(key, button); return button; } public RichLabel createRichLabel(String text) { RichLabel label = new RichLabel(text); addWidget(null, label); if (defaultForeground != null) { label.setForeground(defaultForeground); } if (defaultFont != null) { label.setFont(defaultFont.deriveFont(Font.BOLD)); } return label; } public JScrollPane createScrollPane(Component client) { return createScrollPane(null, client); } public JScrollPane createScrollPane(Identifier key, Component client) { if (client == null) { throw new IllegalArgumentException( "The argument client must not be null!"); } JScrollPane scrollPane = new JScrollPane(client); addWidget(key, scrollPane); return scrollPane; } public Sheet createSheet(SheetContainer container) { return new Sheet(container, res); } public JSplitPane createSplitPane(Identifier key) { JSplitPane splitPane = new JSplitPane(); addWidget(key, splitPane); return splitPane; } public JTabbedPane createTabbedPane() { return createTabbedPane(null); } public JTabbedPane createTabbedPane(Identifier key) { JTabbedPane tabbedPane = new JTabbedPane(); addWidget(key, tabbedPane); return tabbedPane; } public JTable createTable(Identifier key) { JTable table = new JTable(); addWidget(key, table); return table; } // public JTextField createTextField(int width) { // // return createTextField(null, width); // } public JTextArea createTextArea(Identifier key) { JTextArea textarea = new JTextArea(); textarea.getDocument().addDocumentListener(this); addWidget(key, textarea); return textarea; } public JTextArea createTextArea(Identifier key, int rows, int cols) { JTextArea textarea = new JTextArea(rows, cols); textarea.getDocument().addDocumentListener(this); addWidget(key, textarea); return textarea; } public JTextField createTextField(Identifier key, int width) { JTextField textfield = new JTextField(width); textfield.getDocument().addDocumentListener(this); textfield.addActionListener(this); textfield.setMinimumSize(textfield.getPreferredSize()); addWidget(key, textfield); return textfield; } public JTextPane createTextPane() { return createTextPane(null); } public JTextPane createTextPane(Identifier key) { JTextPane textPane = new JTextPane(); addWidget(key, textPane); return textPane; } public JToggleButton createToggleButton(Identifier key, String text) { if (text == null) { throw new IllegalArgumentException( "The argument icon must not be null!"); } JToggleButton button = new JToggleButton(text); button.setActionCommand("toggle-button"); button.addActionListener(this); addWidget(key, button); return button; } public JToolBar createToolBar(Identifier key) { JToolBar toolbar = new JToolBar(); addWidget(key, toolbar); return toolbar; } public String createToolTipText(String text) { if (text == null) { throw new IllegalArgumentException( "The argument text must not be null!"); } text = text.trim(); text = StringServices.splitAt(text, " ", 40, "
      "); if (text.startsWith("") == false) { text = "" + text; } return text; } public JTree createTree(Identifier key) { return createTree(key, null); } public JTree createTree(Identifier key, TreeModel model) { JTree tree; if (model != null) { tree = new JTree(model); } else { tree = new JTree(); } addWidget(key, tree); return tree; } public UpperCaseTextField createUpperCaseTextField(Identifier key, int width) { UpperCaseTextField textfield = new UpperCaseTextField(width); addWidget(key, textfield); return textfield; } public JSpinner createWidthSpinner(Identifier key) { return createWidthSpinner(key, null); } public JSpinner createWidthSpinner(Identifier key, Length width) { JSpinner spinner = new JSpinner(new SpinnerDistanceModel(getLocale())); if (width != null) { spinner.setValue(width); } Dimension preferredSize = spinner.getPreferredSize(); if (preferredSize.width < 75) { preferredSize.width = 75; } spinner.setPreferredSize(preferredSize); spinner.setEditor(new SpinnerDistanceEditor(spinner)); spinner.addChangeListener(this); addWidget(key, spinner); return spinner; } /** * Deaktiviert die Komponente comp und alle in ihr enthaltenen * Kindkomponenten. Kindkomponenten, die aktiv waren und deaktiviert wurden * werden markiert. Dadurch weiß die Methode {@link #enableAll} welche * Komponenten aktiviert werden müssen und welche bereits beim Aufruf von * disableAll deaktiviert waren und deshalb nicht verändert * werden dürfen. müssen. Nach der Ausführung der Methoden * disableAll und enableAll soll der * Ausgangszustand möglichst genau wiederhergestellt werden. Dazu gehört * auch, dass keine Komponente plötzlich aktiviert wurde, die es vorher * nicht war. * * @param comp */ public void disableAll(Component comp) { if (comp == null) { return; } if (comp instanceof Container) { Container parent = (Container) comp; Component[] compList = parent.getComponents(); for (int i = 0; i < compList.length; i++) { disableAll(compList[i]); } } String name; if (comp instanceof AbstractButton || comp instanceof JComboBox || comp instanceof JTextComponent) { name = comp.getName(); if (name == null) { name = ""; } logger.debug("disable name = " + name); if (comp.isEnabled() == true) { logger.debug("disabling name = " + name); comp.setEnabled(false); if (name.endsWith("toggled") == false) { comp.setName(name + ":toggled"); } } } } public void disableSaveWidgets() { if (saveWidgetList != null && saveWidgetList.size() > 0) { JComponent comp; Iterator iterator = saveWidgetList.iterator(); while (iterator.hasNext()) { comp = iterator.next(); comp.setEnabled(false); } } } public void enableAll(Component comp) { if (comp == null) { return; } if (comp instanceof Container) { Container parent = (Container) comp; Component[] compList = parent.getComponents(); for (int i = 0; i < compList.length; i++) { enableAll(compList[i]); } } String name; if (comp instanceof AbstractButton || comp instanceof JComboBox || comp instanceof JTextComponent) { name = comp.getName(); if (name == null) { name = ""; } logger.debug("enable name = " + name); if (comp.isEnabled() == false) { if (name.endsWith(":toggled") == true) { logger.debug("enabling name = " + name); comp.setEnabled(true); } else { comp.setName(name + ":enabled"); } } } } public void enableSaveWidgets() { if (saveWidgetList != null && saveWidgetList.size() > 0) { JComponent comp; Iterator iterator = saveWidgetList.iterator(); while (iterator.hasNext()) { comp = iterator.next(); comp.setEnabled(true); } } } public ImageIcon getApplicationIcon() { return applicationIcon; } public URL getBackgroundImageUrl() { return backgroundImageUrl; } public HelpBroker getHelpBroker() { return helpBroker; } public Color getLabelForeground() { return defaultForeground; } public Locale getLocale() { return locale; } // public void setLookandFeel(String laf) { // // } public ResourceBundle getResourceBundle() { return res; } public JComponent getWidget(Identifier key) { return widgetMap.get(key); } public void insertUpdate(DocumentEvent documentEvent) { enableSaveWidgets(); } public void itemStateChanged(ItemEvent itemEvent) { enableSaveWidgets(); } public Font registerEuterpeFont() { try { InputStream instr = ResourceServices.getResourceAsStream( "/fonts/Euterpe.ttf", JiveFactory.class.getClassLoader()); if (instr != null) { Font font = Font.createFont(Font.TRUETYPE_FONT, instr); // GraphicsEnvironment.getLocalGraphicsEnvironment().registerFont(font); // return new Font("Euterpe", Font.PLAIN, 12); return font; } } catch (FontFormatException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return null; } public void removeUpdate(DocumentEvent documentEvent) { enableSaveWidgets(); } public void setApplicationIcon(ImageIcon applicationIcon) { this.applicationIcon = applicationIcon; } public void setBackgroundImageUrl(URL backgroundImageUrl) { this.backgroundImageUrl = backgroundImageUrl; } public void setDefaultForeground(Color foreground) { this.defaultForeground = foreground; } public void setDefaultFont(Font defaultFont) { if (defaultFont == null) { throw new IllegalArgumentException( "Parameter font must not be null!"); } this.defaultFont = defaultFont; } public void setHelpAreaBackground(Color helpAreaBackground) { this.helpAreaBackground = helpAreaBackground; } public void setHelpAreaBorder(Border helpAreaBorder) { this.helpAreaBorder = helpAreaBorder; } public void setHelpBroker(HelpBroker helpBroker) { this.helpBroker = helpBroker; } public void setHelpSet(HelpSet helpSet) { this.helpSet = helpSet; } public void setLocale(Locale locale) { if (locale == null) { throw new IllegalArgumentException( "The argument locale must not be null!"); } res = ResourceBundle.getBundle("org/dbdoclet/jive/Resources", locale); } public void stateChanged(ChangeEvent e) { enableSaveWidgets(); } private void addContextSensitiveHelp(Identifier key, JComponent comp) { if (helpBroker != null && helpSet != null) { try { CSH.setHelpIDString(comp, key.getValue()); CSH.setHelpSet(comp, helpSet); helpBroker.enableHelpKey(comp, key.getValue(), helpSet, "javax.help.Popup", "popup"); // comp.setToolTipText(key); } catch (Throwable oops) { // logger.fatal("Can't add context sensitive help of key " + // key, oops); } } comp.setName(key.getValue()); } /** * Fügt eine Oberflächenkomponente zur globalen Hashtabelle hinzu. Der * Identifikator wird auch verwendet um den Namen der Komponente ( * {@link Component#setName(String)}) und den Schlüssel für die * kontext-sensitive Hilfe zu setzen. * * Falls bereits eine Komponente mit gleichem Namen in der Hashtabelle * existiert, wird die bereits vorhandene Komponente überschrieben. * * @param key * @param comp */ private void addWidget(Identifier key, JComponent comp) { if (defaultFont != null) { Font compFont = comp.getFont(); comp.setFont(defaultFont.deriveFont(compFont.getStyle())); } if (defaultForeground != null) { comp.setForeground(defaultForeground); } if (defaultBackground != null) { comp.setBackground(defaultBackground); } if (key != null && key.length() > 0 && comp != null) { comp.setName(key.toString()); addContextSensitiveHelp(key, comp); widgetMap.put(key, comp); } } public void setDefaultBackground(Color defaultBackground) { this.defaultBackground = defaultBackground; } public GridPanel createGridPanel(Identifier key) { GridPanel panel = new GridPanel(); addWidget(key, panel); return panel; } } src/java/org/dbdoclet/jive/dialog/0000755000175000017500000000000012644165244017213 5ustar mathieumathieusrc/java/org/dbdoclet/jive/dialog/ExceptionBox.java0000644000175000017500000001625412644165236022476 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.jive.dialog; import java.awt.Dialog; import java.awt.Font; import java.awt.Frame; import java.awt.GridBagLayout; import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.PrintWriter; import java.io.StringWriter; import java.util.ResourceBundle; import javax.swing.BorderFactory; import javax.swing.JButton; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTextArea; import org.dbdoclet.Identifier; import org.dbdoclet.jive.Anchor; import org.dbdoclet.jive.Colspan; import org.dbdoclet.jive.Fill; import org.dbdoclet.jive.JiveConstants; import org.dbdoclet.jive.JiveFactory; import org.dbdoclet.jive.widget.GridPanel; import org.dbdoclet.jive.widget.TopPanel; import org.dbdoclet.service.ResourceServices; public class ExceptionBox extends AbstractDialog implements ActionListener { private static final long serialVersionUID = 1L; private static final int BORDER_SIZE = 5; private boolean showDetails = true; private JScrollPane detailsPane; private JButton detailsButton; public ExceptionBox(Throwable oops) { super((Frame) null, "ExceptionBox", true); if (oops == null) { oops = new Throwable(); } createDialog(null, null, oops); center(); } public ExceptionBox(String title, Throwable oops) { super((Frame) null, title, true); if (oops == null) { oops = new Throwable(); } createDialog(title, null, oops); center(); } public ExceptionBox(String title, String msg, Throwable oops) { super((Frame) null, title, true); if (oops == null) { oops = new Throwable(); } createDialog(title, msg, oops); center(); } public ExceptionBox(Frame parent, Throwable oops) { this(parent, null, null, oops); } public ExceptionBox(Frame parent, String title, Throwable oops) { this(parent, title, null, oops); } public ExceptionBox(Frame parent, String title, String msg, Throwable oops) { super(parent, "Exception", true); if (oops == null) { oops = new Throwable(); } createDialog(title, msg, oops); center(parent); } public ExceptionBox(Dialog parent, Throwable oops) { this(parent, null, null, oops); } public ExceptionBox(Dialog parent, String title, String msg, Throwable oops) { super(parent, "Exception", true); if (oops == null) { oops = new Throwable(); } createDialog(title, msg, oops); center(parent); } private void createDialog(String title, String msg, Throwable oops) { if (title != null && title.length() > 0) { setTitle(title); } JiveFactory jf = JiveFactory.getInstance(); ResourceBundle res = jf.getResourceBundle(); GridPanel panel = new GridPanel(new Insets(0, 0, 0, 0)); getContentPane().add(panel); panel.setLayout(new GridBagLayout()); TopPanel topPanel = createTopPanel("Exception: " + oops.getClass().getSimpleName()); topPanel.setGradient(JiveConstants.COLOUR_RED_1, JiveConstants.COLOUR_RED_4); panel.addComponent(topPanel, Colspan.CS_2, Anchor.NORTHWEST, Fill.HORIZONTAL); panel.incrRow(); JLabel label; label = jf.createLabel(" " + ResourceServices.getString(res, "C_MESSAGE") + ":"); label.setBorder(BorderFactory.createEmptyBorder(BORDER_SIZE, BORDER_SIZE, BORDER_SIZE, BORDER_SIZE)); panel.addComponent(label); if (msg == null || msg.length() == 0) { msg = oops.getMessage(); } if (msg == null) { msg = ""; } label = jf.createLabel(" " + msg, Font.PLAIN); label.setBorder(BorderFactory.createEmptyBorder(BORDER_SIZE, BORDER_SIZE, BORDER_SIZE, BORDER_SIZE)); panel.addComponent(label); panel.incrRow(); label = jf.createLabel(" " + ResourceServices.getString(res, "C_CLASS") + ":"); label.setBorder(BorderFactory.createEmptyBorder(BORDER_SIZE, BORDER_SIZE, BORDER_SIZE, BORDER_SIZE)); panel.addComponent(label); label = jf.createLabel(" " + oops.getClass().getName(), Font.PLAIN); label.setBorder(BorderFactory.createEmptyBorder(BORDER_SIZE, BORDER_SIZE, BORDER_SIZE, BORDER_SIZE)); panel.addComponent(label); panel.incrRow(); JTextArea detailsArea = jf.createTextArea(new Identifier("details")); detailsArea.setEditable(false); detailsPane = jf.createScrollPane(detailsArea); Throwable cause; StringWriter buffer; String areaText = ""; buffer = new StringWriter(); oops.printStackTrace(new PrintWriter(buffer)); areaText = buffer.toString(); cause = oops.getCause(); while (cause != null) { buffer = new StringWriter(); cause.printStackTrace(new PrintWriter(buffer)); areaText += buffer.toString(); cause = cause.getCause(); } detailsArea.setText(areaText); detailsArea.setBorder(BorderFactory.createEmptyBorder(BORDER_SIZE, BORDER_SIZE, BORDER_SIZE, BORDER_SIZE)); panel.addComponent(detailsPane, Colspan.CS_2, Anchor.NORTHWEST, Fill.BOTH); panel.incrRow(); JPanel buttonPanel = jf.createPanel(null); JButton closeButton = jf.createButton(null, ResourceServices.getString(res, "C_CLOSE")); closeButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { dispose(); } }); buttonPanel.add(closeButton); buttonPanel.setBorder(BorderFactory.createEmptyBorder(BORDER_SIZE, BORDER_SIZE, BORDER_SIZE, BORDER_SIZE)); if (showDetails == true) { detailsButton = jf.createButton(new Identifier( "jive.dialog.exception.details"), ResourceServices.getString( res, "C_HIDE_DETAILS")); } else { detailsButton = jf.createButton(new Identifier( "jive.dialog.exception.details"), ResourceServices.getString( res, "C_SHOW_DETAILS")); detailsArea.setVisible(false); } detailsButton.addActionListener(this); detailsButton.setActionCommand("details"); buttonPanel.add(detailsButton); panel.addVerticalGlue(); panel.incrRow(); panel.addComponent(buttonPanel, Colspan.CS_2, Anchor.NORTHWEST, Fill.HORIZONTAL); pack(); } public void actionPerformed(ActionEvent event) { JiveFactory widgetMap = JiveFactory.getInstance(); ResourceBundle res = widgetMap.getResourceBundle(); String cmd = event.getActionCommand(); if (cmd != null && cmd.equals("details")) { if (showDetails == true) { showDetails = false; detailsPane.setVisible(false); detailsButton.setText(ResourceServices.getString(res, "C_SHOW_DETAILS")); pack(); } else { showDetails = true; detailsPane.setVisible(true); detailsButton.setText(ResourceServices.getString(res, "C_HIDE_DETAILS")); pack(); } } } } src/java/org/dbdoclet/jive/dialog/DialogAction.java0000644000175000017500000000213312644165236022413 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.jive.dialog; import org.dbdoclet.jive.widget.ButtonPanel; public enum DialogAction { CANCEL, NO, NONE, OK, YES; public static int getFlag(DialogAction action) { switch (action) { case CANCEL: return ButtonPanel.OK; case NO: return ButtonPanel.NO; case OK: return ButtonPanel.OK; case YES: return ButtonPanel.YES; default: return -1; } } } src/java/org/dbdoclet/jive/dialog/AbstractDialog.java0000644000175000017500000000744312644165236022752 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.jive.dialog; import java.awt.Color; import java.awt.Window; import java.awt.event.KeyEvent; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.util.ResourceBundle; import javax.swing.ActionMap; import javax.swing.InputMap; import javax.swing.JComponent; import javax.swing.JDialog; import javax.swing.JRootPane; import javax.swing.KeyStroke; import javax.swing.Timer; import org.dbdoclet.format.Alignment; import org.dbdoclet.jive.JiveConstants; import org.dbdoclet.jive.JiveFactory; import org.dbdoclet.jive.JiveServices; import org.dbdoclet.jive.dialog.action.ActionCloseDialog; import org.dbdoclet.jive.widget.TopPanel; public class AbstractDialog extends JDialog { class DialogListener extends WindowAdapter { @Override public void windowClosing(WindowEvent event) { setPerformedAction(DialogAction.CANCEL); setVisible(false); dispose(); } } private static final long serialVersionUID = 1L; private DialogAction performedAction = DialogAction.NONE; private final Window parent; protected static final int PREFERRED_HEIGHT = 800; protected static final int PREFERRED_WIDTH = 640; protected ResourceBundle res; private boolean initialized; public AbstractDialog() { this(null, "", true); } public AbstractDialog(String title) { this(null, title, true); } public AbstractDialog(Window parent, String title) { this(parent, title, true); } public AbstractDialog(Window parent, String title, boolean modal) { super(parent, title, modal ? DEFAULT_MODALITY_TYPE : ModalityType.MODELESS); this.parent = parent; } public void center() { center(null); } public void center(Window parent) { JiveServices.center(parent, this); } public Window getParentWindow() { return parent; } public DialogAction getPerformedAction() { return performedAction; } public void setPerformedAction(DialogAction action) { performedAction = action; } public void setTimeout(int delay) { Timer timer = new Timer(delay, new ActionCloseDialog(this, "close-dialog")); timer.start(); } @Override public void setVisible(boolean visible) { if (visible == true && initialized == false) { init(); } super.setVisible(visible); } protected void init() { initialized = true; JRootPane rootPane = this.getRootPane(); ActionMap actionMap = rootPane.getActionMap(); actionMap.put("cancel", new ActionCloseDialog(this, "cancel")); InputMap inputMap = rootPane .getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "cancel"); JiveFactory jive = JiveFactory.getInstance(); res = jive.getResourceBundle(); addWindowListener(new DialogListener()); } protected TopPanel createTopPanel(String title) { TopPanel topPanel = new TopPanel(); topPanel.setTitle(title); topPanel.setAlignment(Alignment.LEFT); topPanel.setBackground(getBackground()); topPanel.setGradient(JiveConstants.COLOUR_BLUE_GRAY_1, JiveConstants.COLOUR_BLUE_GRAY_4); topPanel.setForeground(Color.white); topPanel.setTitle(title); return topPanel; } } src/java/org/dbdoclet/jive/dialog/action/0000755000175000017500000000000012644165236020471 5ustar mathieumathieusrc/java/org/dbdoclet/jive/dialog/action/ActionCloseDialog.java0000644000175000017500000000441712644165236024665 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.jive.dialog.action; import java.awt.event.ActionEvent; import javax.swing.AbstractAction; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.dbdoclet.jive.dialog.AbstractDialog; import org.dbdoclet.jive.dialog.DialogAction; public class ActionCloseDialog extends AbstractAction { /** * */ private static final long serialVersionUID = 1L; private static Log logger = LogFactory.getLog(ActionCloseDialog.class); private final AbstractDialog dialog; private final String name; private Object mutex; public ActionCloseDialog(AbstractDialog dialog, String name) { super(name); if (dialog == null) { throw new IllegalArgumentException( "The argument dialog must not be null!"); } this.dialog = dialog; this.name = name; } public void setMutex(Object mutex) { this.mutex = mutex; } public Object getMutex() { return mutex; } public void actionPerformed(ActionEvent event) { logger.debug("event=" + event); if (dialog != null) { if (name != null && name.equals("ok")) { dialog.setPerformedAction(DialogAction.OK); } if (name != null && name.equals("yes")) { dialog.setPerformedAction(DialogAction.YES); } if (name != null && name.equals("cancel")) { dialog.setPerformedAction(DialogAction.CANCEL); } if (name != null && name.equals("no")) { dialog.setPerformedAction(DialogAction.NO); } dialog.setVisible(false); dialog.dispose(); if (mutex != null) { synchronized (mutex) { mutex.notify(); } } } } } src/java/org/dbdoclet/jive/border/0000755000175000017500000000000012644165244017231 5ustar mathieumathieusrc/java/org/dbdoclet/jive/border/TopEtchedBorder.java0000644000175000017500000000317312644165236023116 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.jive.border; import java.awt.Color; import java.awt.Component; import java.awt.Graphics; import java.awt.Insets; import javax.swing.border.AbstractBorder; public class TopEtchedBorder extends AbstractBorder { private static final long serialVersionUID = 1L; private static final Color darkColor = new Color(199, 199, 199); private static final Color lightColor = Color.white; public TopEtchedBorder() { super(); } @Override public void paintBorder(Component comp, Graphics g, int x, int y, int width, int height) { g.setColor(darkColor); g.drawLine(x, y, width -1, y); g.setColor(lightColor); g.drawLine(x , y + 1, width -1, y + 1); } @Override public Insets getBorderInsets(Component comp) { return new Insets(15, 1, 1, 1); } @Override public boolean isBorderOpaque() { return false; } } src/java/org/dbdoclet/jive/border/BottomEtchedBorder.java0000644000175000017500000000327112644165236023617 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.jive.border; import java.awt.Color; import java.awt.Component; import java.awt.Graphics; import java.awt.Insets; import javax.swing.border.AbstractBorder; public class BottomEtchedBorder extends AbstractBorder { private static final long serialVersionUID = 1L; private static final Color darkColor = new Color(199, 199, 199); private static final Color lightColor = Color.white; public BottomEtchedBorder() { super(); } @Override public void paintBorder(Component comp, Graphics g, int x, int y, int width, int height) { int ypos = y + height - 2; g.setColor(darkColor); g.drawLine(x, ypos, width - 1, ypos); g.setColor(lightColor); g.drawLine(x, ypos + 1, width - 1, ypos + 1); } @Override public Insets getBorderInsets(Component comp) { return new Insets(2, 2, 2, 2); } @Override public boolean isBorderOpaque() { return false; } } src/java/org/dbdoclet/jive/Resources_de.properties0000644000175000017500000001116012644165236022514 0ustar mathieumathieu#Resources_de.properties accolade.space_after=Abstand nach dem Bereich accolade.space_before=Abstand vor dem Bereich apply=Anwenden bottom=Unten C_ABOVE=\u00dcber C_ACTION=Aktion C_ACTIVATE=Aktivieren C_ADD=Hinzuf\u00fcgen C_AFTER=Nach C_ALIGNMENT_CENTER=Zentriert C_ALIGNMENT_JUSTIFY=Blocksatz C_ALIGNMENT_LEFT=Linksb\u00fcndig C_ALIGNMENT_RIGHT=Rechtsb\u00fcndig C_APPLY=\u00dcbernehmen C_BACKGROUND_COLOR=Hintergrundfarbe C_BEFORE=Vor C_BELOW=Unter C_BOLD=Fett C_BOLD_ITALIC=Fett Kursiv C_BOTTOM=Unten C_BROWSE=Ausw\u00e4hlen C_CANCEL=Abbrechen C_CASE_SENSITIVE=Buchstabengetreu C_CHOOSE_IMAGE=Bild ausw\u00e4hlen C_CLASS=Klasse C_CLOSE=Schlie\u00dfen C_COLOR=Farbe C_CONTINUE=Weiter C_CSV_EXPORT=CSV-Export C_DELETE=L\u00f6schen C_DELETE_ALL=Alle l\u00f6schen C_DELETE_IMAGES=Bilder l\u00f6schen C_DESELECT_ALL=Keine ausw\u00e4hlen C_DIRECTORY=Verzeichnis C_DONT_SHOW_THIS_DIALOG_AGAIN=Diesen Dialog nicht mehr anzeigen C_DUPLICATE=Duplikat C_EDIT=Bearbeiten C_ELAPSED_TIME=Verstrichen C_EMPTY_IMAGE_LIST=Die Liste der Bilder ist leer. C_ENABLED=Aktiviert C_ENTER_LICENSE_KEY=

      Lizenzinformation

      \n

      Um dieses Programm zu verwenden, ben\u00f6tigen Sie eine g\u00fcltige Lizenz.

      \n

      Bitte geben Sie hier Ihren Lizenzschl\u00fcssel ein.

      \n

      C_ERROR=Fehler C_ERROR_FILE_ACCESS_DENIED=Zugriff verweigert\:\n{0} C_ERROR_INVALID_LICENSE=Der eingegebene Lizenzschl\u00fcssel ist ung\u00fcltig\! Bitte versuchen Sie es noch einmal. C_ERROR_INVALID_OPTIONS_FILE=Die Eigenschaften konnten nicht geladen werden. C_ERROR_NO_JAVA_HOME=

      Ung\u00fcltiges Verzeichnis

      \n

      Das Verzeichnis {0} ist kein g\u00fcltiges JDK-Verzeichnis\! W\u00e4hlen Sie bitte ein Verzeichnis in dem ein JDK installiert wurde.

      \n C_ERROR_SAVE_OPTIONS=Die Eigenschaften konnten nicht gespeichert werden. C_ERRORS=Fehler C_ESTIMATED_TIME=Vorausichtliches Ende C_EXCLUDE_DIRECTORIES=Verzeichnisse ausschlie\u00dfen C_EXCLUDE_FILES=Dateien ausschlie\u00dfen C_EXCLUDE_PACKAGES=Packages ausschlie\u00dfen C_EXCLUDING=Ausschlie\u00dfen C_EXECUTING=Ausf\u00fchrung C_EXPORT=Export C_FILE=Datei C_FILE_NAME=Dateiname C_FILTER=Filter C_FILTER_TYPE=Filtertyp C_FINISHED=Verarbeitung abgeschlossen C_FONT=Schriftart C_FONT_ENABLED=Schriftarteinstellungen aktivieren C_FONT_SIZE=Schriftgr\u00f6\u00dfe C_FRAME=Rahmen C_FRAME_ENABLED=Rahmen verwenden C_FRAME_STYLE=Rahmenart C_HIDE_DETAILS=Details einklappen C_INCLUDE_DIRECTORIES=Verzeichnisse einbeziehen C_INCLUDE_FILES=Dateien einbeziehen C_INCLUDE_PACKAGES=Packages einbeziehen C_INCLUDING=Einbeziehen C_INFORMATION=Information C_ITALIC=Kursiv C_LANDSCAPE=Querformat C_LANGUAGE=Sprache C_LEFT=Links C_LICENSE_KEY=Lizenzschl\u00fcssel C_LINE=Zeile C_LOOK_AND_FEEL=Erscheinungsbild C_MESSAGE=Nachricht C_MONOSPACED=Feste Zeichenbreite C_NAME=Name C_NEW=Neu C_NEXT=Weiter C_NO=Nein C_NO_FILTER=Kein Filter C_NO_FOR_ALL=Nein f\u00fcr Alle C_NOT_FOUND=Nicht gefunden C_NOT_READABLE=Nicht lesbar C_OK=Ok C_OPTIONS=Einstellungen C_PADDING=Innenabstand C_PATH=Pfad C_PORTRAIT=Hochformat C_PREPARE=Analyse C_PRINT=Drucken C_PROCESS_FINISHED=Der Proze\u00df ist beendet. Klicken Sie auf die Schaltfl\u00e4che "Schlie\u00dfen" um fortzufahren. C_PROCESSBOX_HEADER=Ausf\u00fchren eines Kommandos. Bitte warten Sie... C_RECURSIVE=Rekursiv C_REGULAR=Normal C_REMOVE=Entfernen C_RESTART=Bitte starten Sie die Anwendung neu. C_RIGHT=Rechts C_SAVE=Speichern C_SAVE_BEFORE_EXIT=

      Nicht gespeicherte \u00c4nderungen

      \n

      Es wurden nicht gespeicherte \u00c4nderungen entdeckt. Wollen sie diese \u00c4nderunge jetztz speichern?

      C_SAVE_OPTIONS=Eigenschaften speichern C_SAVED_OPTIONS=Die Eigenschaften wurden gespeichert. C_SELECT_ALL=Alle ausw\u00e4hlen C_SEQUENCE=Reihenfolge C_SETTINGS=Einstellungen C_SHOW_DETAILS=Details C_SOURCE_FILES=Quelldateien C_SPACE_BEFORE_OPTIMUM=space-before.optimum C_SPACING=Abstand C_STAGE=Schritt C_STANDARD=Standard C_START=Beginn C_START_TIME=Beginn C_STATUS=Status C_STYLE=Stil C_SUCCESSFUL=Erfolgreich C_TERMINAL=Konsole C_TOP=Oben C_TOTAL=Gesamt C_UNKNOWN_FILTER_TYPE=Unbekannter Filtertyp C_UNKNOWN_STATUS=Unbekannter Status C_VARIABLE=Variabel C_VISIBLE_SIDES=Sichtbare R\u00e4nder C_WARNING=Warnung C_WARNINGS=Warnungen C_WIDTH=Breite C_YES=Ja C_YES_FOR_ALL=Ja f\u00fcr Alle cancel=Abbrechen clef=Notenschl\u00fcssel format=Format height=H\u00f6he left=Links ok=OK paper.format=Papierformat paper.margins=Seitenr\u00e4nder paper.orientation.landscape=Querformat paper.orientation.portrait=Hochformat right=Rechts staff=Notenzeile staff.space_after=Abstand nach dem Notensystem staff.space_before=Abstand vor dem Notensystem top=Oben user_defined=Benutzerdefiniert width=Breite src/java/org/dbdoclet/jive/widget/0000755000175000017500000000000012644165244017237 5ustar mathieumathieusrc/java/org/dbdoclet/jive/widget/NumberTextField.java0000644000175000017500000000410212644165236023141 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.jive.widget; import javax.swing.text.AttributeSet; import javax.swing.text.BadLocationException; import javax.swing.text.Document; import javax.swing.text.PlainDocument; public class NumberTextField extends AbstractTextField { private static final long serialVersionUID = 1L; /** * Konstruktor mit Angabe der gewünschten Anzahl an Spalten für die Eingabe. * * @param cols */ public NumberTextField(int cols) { super(cols); } public Integer getNumber() { String buffer = getText(); if (buffer == null || buffer.trim().length() == 0) { return null; } return Integer.parseInt(buffer); } @Override protected Document createDefaultModel() { return new NumberDocument(); } class NumberDocument extends PlainDocument { private static final long serialVersionUID = 1L; @Override public void insertString(int offset, String str, AttributeSet a) throws BadLocationException { char[] buffer = str.toCharArray(); boolean valid = true; boolean fit = true; if (buffer.length + getLength() <= getMaxLength()) { for (int i = 0; i < buffer.length; i++) { if (Character.isDigit(buffer[i]) == false) { valid = false; break; } } } else { fit = false; } if (valid && fit) { super.insertString(offset, str, a); } else { getToolkit().beep(); } } } } src/java/org/dbdoclet/jive/widget/GridCell.java0000644000175000017500000000311112644165236021564 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.jive.widget; public class GridCell { private int row = 0; private int col = 0; public GridCell() { this(0, 0); } public GridCell(int row, int col) { this.row = row; this.col = col; } public void setRow(int row) { this.row = row; } public int getRow() { return row; } public void setCol(int col) { this.col = col; } public int getCol() { return col; } public int incrRow() { row++; return row - 1; } public int nextRow() { col = 0; return incrRow(); } public int incrCol(int incr) { col += incr; return col - incr; } public int incrCol() { return incrCol(1); } public void resetCol() { col = 0; } } src/java/org/dbdoclet/jive/widget/MimeTypeListBox.java0000644000175000017500000000540112644165236023141 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.jive.widget; import javax.swing.DefaultComboBoxModel; import javax.swing.JComboBox; import org.dbdoclet.io.MimeType; /** * Eine ComboBox mit einer Liste von oft verwendeten MimeTypes. Im Modell der * ComboBox werden Objekte des Types {@link org.dbdoclet.io.MimeType} * gespeichert. * * @author mfuchs */ public class MimeTypeListBox extends JComboBox { private static final long serialVersionUID = 1L; private DefaultComboBoxModel model; public static final int ALL = 0x0001; public static final int PICTURES = 0x0002; public MimeTypeListBox() { model = new DefaultComboBoxModel(); addAllMimeTypes(); setModel(model); } public MimeType getSelectedMimeType() { return (MimeType) getSelectedItem(); } public void setSelectedMimeType(String mimeType) { MimeType mimeTypeItem = MimeType.valueOf(mimeType); setSelectedItem(mimeTypeItem); } public void setMimeTypeGroup(int groupMode) { if (groupMode == PICTURES) { model.removeAllElements(); model.addElement(MimeType.GIF); model.addElement(MimeType.JPEG); model.addElement(MimeType.PNG); } if (groupMode == ALL) { addAllMimeTypes(); } } private void addAllMimeTypes() { model.removeAllElements(); model.addElement(MimeType.CSV); model.addElement(MimeType.DOC); model.addElement(MimeType.DOCX); model.addElement(MimeType.GIF); model.addElement(MimeType.HTML); model.addElement(MimeType.JPEG); model.addElement(MimeType.MIDI); model.addElement(MimeType.MP3); model.addElement(MimeType.MPEG); model.addElement(MimeType.ODP); model.addElement(MimeType.ODS); model.addElement(MimeType.ODT); model.addElement(MimeType.PDF); model.addElement(MimeType.PNG); model.addElement(MimeType.POD); model.addElement(MimeType.PPT); model.addElement(MimeType.PPTX); model.addElement(MimeType.PPTM); model.addElement(MimeType.POTX); model.addElement(MimeType.WAV); model.addElement(MimeType.WMV); model.addElement(MimeType.XLS); model.addElement(MimeType.XLSX); } } src/java/org/dbdoclet/jive/widget/EncodingChooser.java0000644000175000017500000000333412644165236023157 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.jive.widget; import java.nio.charset.Charset; import java.util.Iterator; import java.util.SortedMap; import javax.swing.DefaultComboBoxModel; import javax.swing.JComboBox; public class EncodingChooser extends JComboBox { private static final long serialVersionUID = 1L; public EncodingChooser() { SortedMap map = Charset.availableCharsets(); Iterator iterator = map.keySet().iterator(); String[] encodings = new String[map.size()]; int index = 0; while (iterator.hasNext()) { encodings[index++] = iterator.next(); } DefaultComboBoxModel model = new DefaultComboBoxModel<>(encodings); setModel(model); setSelectedItem("UTF-8"); } public String getEncoding() { return (String) getSelectedItem(); } public void setEncoding(String encoding) { if (encoding == null) { return; } setSelectedItem(encoding); } }src/java/org/dbdoclet/jive/widget/AbstractTextField.java0000644000175000017500000000313712644165236023463 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.jive.widget; import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.JTextField; public abstract class AbstractTextField extends JTextField { /** * */ private static final long serialVersionUID = 1L; private int maxLength = 64; private JComponent next = null; private JLabel label; public AbstractTextField(int cols) { super(cols); this.maxLength = cols; } public void setMaxLength(int maxLength) { this.maxLength = maxLength; } public int getMaxLength() { return maxLength; } public void setNext(JComponent next) { this.next = next; } public JComponent getNext() { return next; } public void setLabel(JLabel label) { this.label = label; } public JLabel getLabel() { return label; } } /* * $Log$ */ src/java/org/dbdoclet/jive/widget/UpperCaseTextField.java0000644000175000017500000000442112644165236023604 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.jive.widget; import javax.swing.JComponent; import javax.swing.JTextField; import javax.swing.text.AttributeSet; import javax.swing.text.BadLocationException; import javax.swing.text.Document; import javax.swing.text.PlainDocument; public class UpperCaseTextField extends JTextField { /** * */ private static final long serialVersionUID = 1L; private int maxLength = 1024; private JComponent next = null; public UpperCaseTextField(int cols) { super(cols); } public void setMaxLength(int maxLength) { this.maxLength = maxLength; } public void setNext(JComponent next) { this.next = next; } @Override protected Document createDefaultModel() { return new UpperCaseDocument(); } class UpperCaseDocument extends PlainDocument { /** * */ private static final long serialVersionUID = 1L; @Override public void insertString(int offs, String str, AttributeSet a) throws BadLocationException { if ((str == null) || (getLength() >= maxLength)) { return; } char[] upper = str.toCharArray(); for (int i = 0; i < upper.length; i++) { upper[i] = Character.toUpperCase(upper[i]); } super.insertString(offs, new String(upper), a); if (getLength() >= maxLength) { if (next != null) { next.requestFocus(); } return; } } } } /* * $Log$ */ src/java/org/dbdoclet/jive/widget/PathList.java0000644000175000017500000002207512644165236021641 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.jive.widget; import java.awt.Font; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; import java.util.ArrayList; import java.util.HashMap; import java.util.ResourceBundle; import javax.swing.DefaultCellEditor; import javax.swing.JComboBox; import javax.swing.JTable; import javax.swing.table.TableCellEditor; import javax.swing.table.TableCellRenderer; import javax.swing.table.TableColumn; import javax.swing.table.TableColumnModel; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.dbdoclet.io.FileSet; import org.dbdoclet.jive.JiveFactory; import org.dbdoclet.jive.model.LabelItem; import org.dbdoclet.jive.model.PathListModel; import org.dbdoclet.jive.widget.pathlist.FilterTypeRenderer; import org.dbdoclet.jive.widget.pathlist.StatusRenderer; import org.dbdoclet.service.ResourceServices; public class PathList extends JTable implements ActionListener { private static final long serialVersionUID = 1L; public static final int FILE_FILTER_MASK = 0x01; public static final int DIRECTORY_FILTER_MASK = 0x02; public static final int PACKAGE_FILTER_MASK = 0x04; private static Log logger = LogFactory.getLog(PathList.class); private static ResourceBundle res; private final HashMap defaultFilterMap; private final PathListModel model; private final TableColumn caseSensitiveColumn; private final TableColumn filterColumn; private final TableColumn filterTypeColumn; private final TableColumn pathColumn; private final TableColumn statusColumn; private final TableColumnModel columnModel; private final JiveFactory widgetMap; private final FilterTypeRenderer filterTypeRenderer; private final DefaultCellEditor filterTypeEditor; private final StatusRenderer statusRenderer; public PathList(JiveFactory widgetMap) { this(widgetMap, FILE_FILTER_MASK); } public PathList(JiveFactory widgetMap, int filterMask) { super(); if (widgetMap == null) { throw new IllegalArgumentException( "The argument widgetMap must not be null!"); } this.widgetMap = widgetMap; Font font; res = widgetMap.getResourceBundle(); model = new PathListModel(widgetMap); setModel(model); setRowHeight(20); columnModel = getColumnModel(); columnModel.getColumn(PathListModel.COLUMN_ID); pathColumn = columnModel.getColumn(PathListModel.COLUMN_PATH); statusColumn = columnModel.getColumn(PathListModel.COLUMN_STATUS); caseSensitiveColumn = columnModel .getColumn(PathListModel.COLUMN_CASE_SENSITIVE); filterTypeColumn = columnModel .getColumn(PathListModel.COLUMN_FILTER_TYPE); filterColumn = columnModel.getColumn(PathListModel.COLUMN_FILTER); pathColumn.setPreferredWidth(300); statusColumn.setPreferredWidth(50); caseSensitiveColumn.setPreferredWidth(50); filterTypeColumn.setPreferredWidth(150); filterColumn.setPreferredWidth(150); JComboBox filterTypeBox = new JComboBox(); filterTypeBox.addActionListener(this); filterTypeBox.setActionCommand("filter-changed"); font = filterTypeBox.getFont(); font = font.deriveFont(Font.PLAIN); filterTypeBox.setFont(font); filterTypeBox.setBackground(getBackground()); filterTypeBox.addItem(new LabelItem(ResourceServices.getString(res, "C_NO_FILTER"), new Integer(FileSet.FILTER_NONE))); if ((filterMask & FILE_FILTER_MASK) != 0) { filterTypeBox.addItem(new LabelItem(ResourceServices.getString(res, "C_INCLUDE_FILES"), new Integer( FileSet.FILTER_INCLUDE_FILES))); filterTypeBox.addItem(new LabelItem(ResourceServices.getString(res, "C_EXCLUDE_FILES"), new Integer( FileSet.FILTER_EXCLUDE_FILES))); } if ((filterMask & DIRECTORY_FILTER_MASK) != 0) { filterTypeBox.addItem(new LabelItem(ResourceServices.getString(res, "C_INCLUDE_DIRECTORIES"), new Integer( FileSet.FILTER_INCLUDE_DIRECTORIES))); filterTypeBox.addItem(new LabelItem(ResourceServices.getString(res, "C_EXCLUDE_DIRECTORIES"), new Integer( FileSet.FILTER_EXCLUDE_DIRECTORIES))); } if ((filterMask & PACKAGE_FILTER_MASK) != 0) { filterTypeBox.addItem(new LabelItem(ResourceServices.getString(res, "C_INCLUDE_PACKAGES"), new Integer( FileSet.FILTER_INCLUDE_PACKAGES))); filterTypeBox.addItem(new LabelItem(ResourceServices.getString(res, "C_EXCLUDE_PACKAGES"), new Integer( FileSet.FILTER_EXCLUDE_PACKAGES))); } defaultFilterMap = new HashMap(); defaultFilterMap.put("include-files", "**/*"); defaultFilterMap.put("exclude-files", "**/*"); defaultFilterMap.put("include-packages", "**"); defaultFilterMap.put("exclude-packages", "**"); setAutoCreateRowSorter(true); filterTypeRenderer = new FilterTypeRenderer(model); filterTypeEditor = new DefaultCellEditor(filterTypeBox); statusRenderer = new StatusRenderer(model); } @Override public TableCellRenderer getCellRenderer(int row, int column) { if (column == PathListModel.COLUMN_STATUS) { return statusRenderer; } if (column == PathListModel.COLUMN_FILTER_TYPE) { return filterTypeRenderer; } return super.getCellRenderer(row, column); } @Override public TableCellEditor getCellEditor(int row, int column) { if (column == PathListModel.COLUMN_FILTER_TYPE) { return filterTypeEditor; } return super.getCellEditor(row, column); } public void actionPerformed(ActionEvent event) { String cmd = event.getActionCommand(); logger.debug("cmd=" + cmd); if (cmd.equals("filter-changed") == true) { int rowIndex = getSelectedRow(); if (rowIndex != -1) { FileSet entry = model.getEntry(rowIndex); String filter = entry.getFilter(); if (filter == null || filter.trim().length() == 0) { int filterType = entry.getFilterType(); switch (filterType) { case FileSet.FILTER_INCLUDE_FILES: entry.setFilter(defaultFilterMap.get("include-files")); break; case FileSet.FILTER_EXCLUDE_FILES: entry.setFilter(defaultFilterMap.get("exclude-files")); break; case FileSet.FILTER_INCLUDE_PACKAGES: entry.setFilter(defaultFilterMap .get("include-packages")); break; case FileSet.FILTER_EXCLUDE_PACKAGES: entry.setFilter(defaultFilterMap .get("exclude-packages")); break; default: entry.setFilter(""); break; } model.rowChanged(rowIndex); } } } } public void addEntry(FileSet fileset) { logger.debug("fileset=" + fileset); model.addEntry(fileset); if (widgetMap != null) { widgetMap.enableSaveWidgets(); } } public void addEntry(String path) { logger.debug("path=" + path); model.addEntry(path); if (widgetMap != null) { widgetMap.enableSaveWidgets(); } } public void changed() { model.changed(); } public void clear() { model.clear(); } public boolean contains(FileSet fileset) { return model.contains(fileset); } public void editSelected() { int row = getSelectedRow(); if (row >= -1) { editCellAt(row, PathListModel.COLUMN_PATH); } } public ArrayList getFileSets() { return model.getFileSets(); } public int getPathCount() { return model.size(); } public boolean isEmpty() { if (model.size() == 0) { return true; } else { return false; } } public void removeSelectedEntry() { int[] rows = getSelectedRows(); ArrayList idList = new ArrayList(); for (int row : rows) { Integer id = (Integer) getValueAt(row, 0); idList.add(id); } for (Integer id : idList) { model.removeEntry(id); } if (widgetMap != null) { widgetMap.enableSaveWidgets(); } } public void setDefaultExcludeFilesFilter(String filter) { if (filter != null) { defaultFilterMap.put("exclude-files", filter); } } public void setDefaultExcludePackagesFilter(String filter) { if (filter != null) { defaultFilterMap.put("exclude-packages", filter); } } public void setDefaultIncludeFilesFilter(String filter) { if (filter != null) { defaultFilterMap.put("include-files", filter); } } public void setDefaultIncludePackagesFilter(String filter) { if (filter != null) { defaultFilterMap.put("include-packages", filter); } } public void setWorkingDir(File cwd) { if (cwd == null) { throw new IllegalArgumentException( "The argument cwd may not be null!"); } model.setWorkingDir(cwd); } public ArrayList findEntry(File path) { return model.findEntry(path); } } src/java/org/dbdoclet/jive/widget/LanguageListBox.java0000644000175000017500000000756612644165236023151 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.jive.widget; import java.util.Iterator; import java.util.Locale; import java.util.TreeMap; import javax.swing.DefaultComboBoxModel; import javax.swing.JComboBox; import org.dbdoclet.jive.model.LabelItem; public class LanguageListBox extends JComboBox { private static final long serialVersionUID = 1L; private static Locale[] defLocaleList = null; private Locale ctxLocale; public LanguageListBox(Locale ctxLocale) { Locale[] localeList = defLocaleList; if (localeList == null) { String[] isoLanguageList = Locale.getISOLanguages(); localeList = new Locale[isoLanguageList.length]; for (int i = 0; i < isoLanguageList.length; i++) { localeList[i] = new Locale(isoLanguageList[i]); } } init(ctxLocale, localeList); } public LanguageListBox(Locale ctxLocale, Locale[] localeList) { init(ctxLocale, localeList); } public static void setDefaultLocaleList(Locale[] defLocaleList) { LanguageListBox.defLocaleList = defLocaleList; } public void setSelectedLocale(Locale locale) { if (locale == null) { return; } Locale languageLocale = new Locale(locale.getLanguage()); setSelectedItem(new LabelItem(locale.getDisplayLanguage(ctxLocale), languageLocale)); } public Locale getSelectedLocale() { Object obj = getSelectedItem(); if (obj == null) { return null; } if (obj instanceof LabelItem == false) { return null; } LabelItem item = (LabelItem) obj; obj = item.getValue(); if (obj instanceof Locale) { return (Locale) obj; } return null; } public void init(Locale ctxLocale, Locale[] localeList) { if (ctxLocale == null) { ctxLocale = Locale.getDefault(); } if (localeList == null) { throw new IllegalArgumentException("The argument localeList must not be null!"); } this.ctxLocale = ctxLocale; DefaultComboBoxModel model = new DefaultComboBoxModel(); TreeMap localeMap = new TreeMap(); Locale locale; String text; String language; for (int i = 0; i < localeList.length; i++) { language = localeList[i].getLanguage(); text = localeList[i].getDisplayLanguage(ctxLocale); locale = localeMap.get(text); if (locale == null) { localeMap.put(text, new Locale(language)); } } String name; Iterator iterator = localeMap.keySet().iterator(); while (iterator.hasNext()) { name = iterator.next(); locale = localeMap.get(name); model.addElement(new LabelItem(locale.getDisplayLanguage(ctxLocale), locale)); } setModel(model); setSelectedItem(new LabelItem(ctxLocale.getDisplayLanguage(ctxLocale), ctxLocale)); } } src/java/org/dbdoclet/jive/widget/RichLabel.java0000644000175000017500000000533212644165236021733 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.jive.widget; import java.awt.Color; import java.awt.Dimension; import java.awt.Font; import java.awt.FontMetrics; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.RenderingHints; import java.awt.image.BufferedImage; import javax.swing.JLabel; import org.dbdoclet.jive.filter.BlurFilter; public class RichLabel extends JLabel { private static final double FACTOR = 1.3; private static final long serialVersionUID = 1L; private int width; private int height; public RichLabel(String text) { super(text); } @Override public Dimension getPreferredSize() { if (width > 0 && height > 0) { return new Dimension(width, height); } Dimension dim = super.getPreferredSize(); dim = new Dimension((int) (dim.width * FACTOR), (int) (dim.height * FACTOR)); return dim; } @Override protected void paintComponent(Graphics g) { Font font = getFont(); int offset = font.getSize() / 15; FontMetrics fontMetrics = g.getFontMetrics(); width = (int) (fontMetrics.stringWidth(getText()) * FACTOR); height = (int) (fontMetrics.getHeight() * FACTOR); BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); Graphics2D g2d = (Graphics2D) image.getGraphics(); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.setFont(font); fontMetrics = g2d.getFontMetrics(); int length = fontMetrics.stringWidth(getText()); int xpos = (width / 2) - (length / 2); xpos = 0; int ypos = (height / 2) + ((fontMetrics.getAscent() - fontMetrics.getDescent()) / 2); g2d.setPaint(Color.GRAY); g2d.drawString(getText(), xpos + offset, ypos + offset); BufferedImage blurImage = BlurFilter.gaussianBlur(image, 7); g2d = (Graphics2D) blurImage.getGraphics(); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.setFont(getFont()); g2d.setPaint(getForeground()); g2d.drawString(getText(), 0, ypos); g.drawImage(blurImage, 0, 0, null); } } src/java/org/dbdoclet/jive/widget/pathlist/0000755000175000017500000000000012644165244021067 5ustar mathieumathieusrc/java/org/dbdoclet/jive/widget/pathlist/FilterTypeRenderer.java0000644000175000017500000000473412644165236025521 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.jive.widget.pathlist; import java.awt.Component; import java.io.File; import java.util.ResourceBundle; import javax.swing.JTable; import javax.swing.SwingConstants; import javax.swing.table.DefaultTableCellRenderer; import org.dbdoclet.io.FileSet; import org.dbdoclet.jive.JiveFactory; import org.dbdoclet.jive.model.PathListModel; import org.dbdoclet.service.ResourceServices; public class FilterTypeRenderer extends DefaultTableCellRenderer { private static final long serialVersionUID = 1L; private PathListModel model; public FilterTypeRenderer(PathListModel model) { super(); if (model == null) { throw new IllegalArgumentException( "The argument model may not be null!"); } this.model = model; setHorizontalAlignment(SwingConstants.CENTER); } @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { FileSet fileset = null; JiveFactory jf = JiveFactory.getInstance(); ResourceBundle res = jf.getResourceBundle(); if (row > -1) { fileset = model.getEntry(row); if (fileset.getFilterType() == FileSet.FILTER_NONE) { value = new String(""); } if (fileset != null && fileset.isDirectory() == false) { File path = fileset.getPath(); if (path != null && path.isFile()) { value = ResourceServices.getString(res, "C_FILE"); } } else { } } Component comp = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); if (fileset == null || fileset.isDirectory() == false) { comp.setEnabled(false); // comp.setBackground(Color.lightGray); } else { comp.setEnabled(true); // comp.setBackground(Color.white); } return comp; } } src/java/org/dbdoclet/jive/widget/pathlist/StatusRenderer.java0000644000175000017500000001044112644165236024705 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.jive.widget.pathlist; import java.awt.Color; import java.awt.Component; import java.net.URL; import java.util.ResourceBundle; import javax.swing.ImageIcon; import javax.swing.JTable; import javax.swing.SwingConstants; import javax.swing.table.DefaultTableCellRenderer; import org.dbdoclet.io.FileSet; import org.dbdoclet.jive.JiveFactory; import org.dbdoclet.jive.model.PathListModel; import org.dbdoclet.service.ResourceServices; public class StatusRenderer extends DefaultTableCellRenderer { /** * */ private static final long serialVersionUID = 1L; private static ResourceBundle res; private PathListModel model; private ImageIcon errorIcon; public StatusRenderer(PathListModel model) { super(); if (model == null) { throw new IllegalArgumentException("The argument model may not be null!"); } this.model = model; JiveFactory wm = JiveFactory.getInstance(); res = wm.getResourceBundle(); URL iconURL = ClassLoader.getSystemResource("images/status-error.png"); if (iconURL != null) { errorIcon = new ImageIcon(iconURL,"Error"); } setHorizontalAlignment(SwingConstants.CENTER); } @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { FileSet fileset; if (row > -1) { fileset = model.getEntry(row); value = getStatusLabel(fileset.getStatus()); setIcon(null); if (fileset.getStatus() == FileSet.STATUS_OK) { setForeground(table.getForeground()); setBackground(table.getBackground()); } if (fileset.getStatus() == FileSet.STATUS_NOT_FOUND) { if (errorIcon != null) { setIcon(errorIcon); } else { setForeground(Color.WHITE); setBackground(Color.RED); } } if (fileset.getStatus() == FileSet.STATUS_VARIABLE) { setForeground(Color.BLACK); setBackground(Color.YELLOW); } setToolTipText(getStatusLabel(fileset.getStatus())); } return super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); } private String getStatusLabel(int status) { switch (status) { case FileSet.STATUS_OK: return ResourceServices.getString(res,"C_OK"); case FileSet.STATUS_NOT_FOUND: return ResourceServices.getString(res,"C_NOT_FOUND"); case FileSet.STATUS_NOT_READABLE: return ResourceServices.getString(res,"C_NOT_READABLE"); case FileSet.STATUS_DUPLICATE: return ResourceServices.getString(res,"C_DUPLICATE"); case FileSet.STATUS_VARIABLE: return ResourceServices.getString(res,"C_VARIABLE"); } return ResourceServices.getString(res,"C_UNKNOWN_STATUS"); } } src/java/org/dbdoclet/jive/widget/ButtonPanel.java0000644000175000017500000001426712644165236022350 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.jive.widget; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import java.util.ResourceBundle; import javax.swing.JButton; import org.dbdoclet.Identifier; import org.dbdoclet.jive.JiveFactory; import org.dbdoclet.service.ResourceServices; public class ButtonPanel extends GridPanel { private static final long serialVersionUID = 1L; public static final int OK = 0x0001; public static final int CANCEL = 0x0002; public static final int CLOSE = 0x0004; public static final int HELP = 0x0008; public static final int SAVE = 0x0010; public static final int EXPORT = 0x0020; public static final int IMPORT = 0x0040; public static final int PRINT = 0x0080; public static final int CSV_EXPORT = 0x0100; public static final int YES = 0x0200; public static final int NO = 0x0400; private int flags = OK | CANCEL; private JiveFactory wm; private ResourceBundle res; private JButton cancelButton; private JButton okButton; private JButton saveButton; private JButton exportButton; private JButton importButton; private JButton printButton; private JButton csvExportButton; private JButton yesButton; private JButton noButton; private ActionListener listener; public ButtonPanel(int flags, ActionListener listener) { this.flags = flags; this.listener = listener; wm = JiveFactory.getInstance(); res = wm.getResourceBundle(); init(); } public JButton getOkButton() { return okButton; } public JButton getCancelButton() { return cancelButton; } public JButton getYesButton() { return yesButton; } public JButton getNoButton() { return noButton; } public JButton getSaveButton() { return saveButton; } public JButton getExportButton() { return exportButton; } public JButton getCsvExportButton() { return csvExportButton; } public JButton getImportButton() { return importButton; } public JButton getPrintButton() { return printButton; } private void init() { if ((flags & OK) == OK) { okButton = wm.createButton(new Identifier("button-panel.ok"), ResourceServices.getString(res,"C_OK")); okButton.setActionCommand("ok"); okButton.addActionListener(listener); okButton.setMnemonic(KeyEvent.VK_O); addComponent(okButton); } if ((flags & CANCEL) == CANCEL) { cancelButton = wm.createButton(new Identifier("button-panel.cancel"), ResourceServices.getString(res,"C_CANCEL")); cancelButton.setActionCommand("cancel"); cancelButton.addActionListener(listener); cancelButton.setMnemonic(KeyEvent.VK_C); addComponent(cancelButton); } if ((flags & YES) == YES) { yesButton = wm.createButton(new Identifier("button-panel.yes"), ResourceServices.getString(res,"C_YES")); yesButton.setActionCommand("yes"); yesButton.addActionListener(listener); yesButton.setMnemonic(KeyEvent.VK_Y); addComponent(yesButton); } if ((flags & NO) == NO) { noButton = wm.createButton(new Identifier("button-panel.no"), ResourceServices.getString(res,"C_NO")); noButton.setActionCommand("no"); noButton.addActionListener(listener); noButton.setMnemonic(KeyEvent.VK_N); addComponent(noButton); } if ((flags & SAVE) == SAVE) { saveButton = wm.createButton(new Identifier("button-panel.save"), ResourceServices.getString(res,"C_SAVE")); saveButton.setActionCommand("save"); saveButton.addActionListener(listener); saveButton.setMnemonic(KeyEvent.VK_S); addComponent(saveButton); } if ((flags & EXPORT) == EXPORT) { exportButton = wm.createButton(new Identifier("button-panel.export"), ResourceServices.getString(res,"C_EXPORT")); exportButton.setActionCommand("export"); exportButton.addActionListener(listener); exportButton.setMnemonic(KeyEvent.VK_E); addComponent(exportButton); } if ((flags & IMPORT) == IMPORT) { importButton = wm.createButton(new Identifier("button-panel.import"), ResourceServices.getString(res,"C_IMPORT")); importButton.setActionCommand("import"); importButton.addActionListener(listener); importButton.setMnemonic(KeyEvent.VK_I); addComponent(importButton); } if ((flags & CSV_EXPORT) == CSV_EXPORT) { csvExportButton = wm.createButton(new Identifier("button-panel.csv-export"), ResourceServices.getString(res,"C_CSV_EXPORT")); csvExportButton.setActionCommand("csv-export"); csvExportButton.addActionListener(listener); csvExportButton.setMnemonic(KeyEvent.VK_C); addComponent(csvExportButton); } if ((flags & PRINT) == PRINT) { printButton = wm.createButton(new Identifier("button-panel.print"), ResourceServices.getString(res,"C_PRINT")); printButton.setActionCommand("print"); printButton.addActionListener(listener); printButton.setMnemonic(KeyEvent.VK_P); addComponent(printButton); } } } src/java/org/dbdoclet/jive/widget/TopPanel.java0000644000175000017500000001610012644165236021623 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.jive.widget; import java.awt.Color; import java.awt.Dimension; import java.awt.Font; import java.awt.FontMetrics; import java.awt.GradientPaint; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Image; import java.awt.RenderingHints; import java.awt.image.BufferedImage; import java.awt.image.CropImageFilter; import java.awt.image.FilteredImageSource; import java.io.IOException; import java.net.URL; import javax.imageio.ImageIO; import javax.swing.JPanel; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.dbdoclet.format.Alignment; import org.dbdoclet.jive.filter.BlurFilter; public class TopPanel extends JPanel { private static final int BLUR_RADIUS = 9; private static Log logger = LogFactory.getLog(TopPanel.class); private static final long serialVersionUID = 1L; private static final int SHADOW_CANVAS_HEIGHT = 50; private static final int SHADOW_CANVAS_WIDTH = 4096; private static final int SHADOW_HEIGHT = 10; private Alignment alignment = Alignment.CENTER; private Color gradientColorFrom; private Color gradientColorTo; private int height = 60; private int width = 0; private BufferedImage leftImage; private BufferedImage rightImage; private Image shadowImage; private String title = ""; private boolean titleHasChanged; private BufferedImage titleImage; private final Color eraseColor; public TopPanel() { setFont(new Font("Serif", Font.PLAIN, 24)); eraseColor = getBackground(); } public Alignment getAlignment() { return alignment; } @Override public Dimension getMinimumSize() { return getPreferredSize(); } @Override public Dimension getPreferredSize() { Dimension dim = super.getPreferredSize(); if (width == 0) { width = computeWidth(getTitle()); } if (dim.height < height) { dim.height = height; } if (dim.width < width) { dim.width = width; } return dim; } public String getTitle() { if (title == null) { return "Title"; } return title; } @Override public void paintComponent(Graphics g) { Graphics2D g2d = (Graphics2D) g; g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); if (leftImage != null && leftImage.getHeight() > height) { height = leftImage.getHeight(); } if (rightImage != null && rightImage.getHeight() > height) { height = rightImage.getHeight(); } if (shadowImage == null) { createShadow(); } if (titleImage == null || titleHasChanged == true) { createTitleImage(getTitle()); titleHasChanged = false; } if (titleImage != null && titleImage.getHeight() > height) { height = titleImage.getHeight() + SHADOW_HEIGHT; } // Zeichnen g2d.setPaint(eraseColor); g2d.fillRect(0, 0, getWidth(), height); if (gradientColorFrom != null && gradientColorTo != null) { g2d.setPaint(new GradientPaint(0, 0, gradientColorFrom, getWidth(), height / 2, gradientColorTo, false)); } else { g2d.setPaint(getBackground()); } g2d.fillRect(0, 0, getWidth(), height - SHADOW_HEIGHT); if (leftImage != null) { g2d.drawImage(leftImage, 0, 0, null); } if (rightImage != null) { g2d.drawImage(rightImage, getWidth() - rightImage.getWidth(), 0, null); } g2d.drawImage(shadowImage, 0, height - SHADOW_HEIGHT, null); g2d.drawImage(titleImage, 0, 0, null); } public void setAlignment(Alignment alignment) { this.alignment = alignment; } public void setGradient(Color gradientColorFrom, Color gradientColorTo) { this.gradientColorFrom = gradientColorFrom; this.gradientColorTo = gradientColorTo; } public void setHeight(int height) { this.height = height; } public void setLeftImage(URL iconUrl) { try { if (iconUrl != null) { leftImage = readImage(iconUrl); } } catch (Throwable oops) { logger.fatal(oops); } } public void setRightImage(URL iconUrl) { try { if (iconUrl != null) { rightImage = readImage(iconUrl); } } catch (Throwable oops) { logger.fatal(oops); } } public void setTitle(String title) { this.title = title; titleHasChanged = true; repaint(); } private void createShadow() { BufferedImage image = new BufferedImage(SHADOW_CANVAS_WIDTH, SHADOW_CANVAS_HEIGHT, BufferedImage.TYPE_INT_ARGB); Graphics2D shadow2D = (Graphics2D) image.getGraphics(); shadow2D.setPaint(Color.DARK_GRAY); shadow2D.fillRect(0, SHADOW_CANVAS_HEIGHT / 2, SHADOW_CANVAS_WIDTH, BLUR_RADIUS); image = BlurFilter.boxBlur(image, BLUR_RADIUS); shadowImage = createImage(new FilteredImageSource( image.getSource(), new CropImageFilter( BLUR_RADIUS, (int) ((SHADOW_CANVAS_HEIGHT / 2) + (BLUR_RADIUS * 0.81)), SHADOW_CANVAS_WIDTH - BLUR_RADIUS, SHADOW_HEIGHT))); } private void createTitleImage(String title) { BufferedImage image; Graphics2D g2d; FontMetrics fontMetrics; width = computeWidth(title); image = new BufferedImage(width, height - SHADOW_HEIGHT, BufferedImage.TYPE_INT_ARGB); g2d = (Graphics2D) image.getGraphics(); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.setFont(getFont()); fontMetrics = g2d.getFontMetrics(); int length = fontMetrics.stringWidth(title); int offset = 1; int xpos = (width / 2) - (length / 2); if (alignment == Alignment.LEFT) { xpos = fontMetrics.getAscent(); } int ypos = (height / 2) + ((fontMetrics.getAscent() - fontMetrics.getDescent()) / 2); g2d.setPaint(Color.GRAY); g2d.drawString(title, xpos + offset, ypos + offset); BufferedImage blurImage = BlurFilter.gaussianBlur(image, 5); g2d = (Graphics2D) blurImage.getGraphics(); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.setFont(getFont()); g2d.setPaint(getForeground()); g2d.drawString(title, xpos, ypos); titleImage = blurImage; } private int computeWidth(String title) { BufferedImage image = new BufferedImage(1024, 100, BufferedImage.TYPE_INT_ARGB); Graphics2D g2d = (Graphics2D) image.getGraphics(); g2d.setFont(getFont()); FontMetrics fontMetrics = g2d.getFontMetrics(); int width = fontMetrics.getAscent() * 2 + fontMetrics.stringWidth(title); if (getWidth() > width) { width = getWidth(); } return width; } private BufferedImage readImage(URL iconUrl) { try { return ImageIO.read(iconUrl); } catch (IOException e) { return null; } } } src/java/org/dbdoclet/jive/widget/SpinnerDistanceEditor.java0000644000175000017500000000304012644165236024340 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.jive.widget; import javax.swing.JFormattedTextField; import javax.swing.JFormattedTextField.AbstractFormatter; import javax.swing.JSpinner; import javax.swing.text.DefaultFormatter; public class SpinnerDistanceEditor extends JSpinner.DefaultEditor { private static final long serialVersionUID = 1L; public SpinnerDistanceEditor(JSpinner spinner) { super(spinner); JFormattedTextField textField = super.getTextField(); AbstractFormatter formatter = textField.getFormatter(); if (formatter instanceof DefaultFormatter) { DefaultFormatter defaultFormatter = (DefaultFormatter) formatter; defaultFormatter.setOverwriteMode(false); } textField.setEnabled(true); textField.setEditable(true); } }src/java/org/dbdoclet/jive/widget/IdentifierTextField.java0000644000175000017500000000711312644165236024000 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.jive.widget; import javax.swing.text.AttributeSet; import javax.swing.text.BadLocationException; import javax.swing.text.Document; import javax.swing.text.PlainDocument; import org.dbdoclet.service.StringServices; public class IdentifierTextField extends AbstractTextField { /** * */ private static final long serialVersionUID = 1L; public IdentifierTextField(int cols) { super(cols); } @Override protected Document createDefaultModel() { return new IdentifierDocument(); } class IdentifierDocument extends PlainDocument { /** * */ private static final long serialVersionUID = 1L; @Override public void insertString(int offset, String str, AttributeSet a) throws BadLocationException { char[] buffer = str.toCharArray(); char c; boolean valid = true; boolean fit = true; if (buffer.length + getLength() <= getMaxLength()) { for (int i = 0; i < buffer.length; i++) { c = Character.toLowerCase(buffer[i]); if (c != 'a' && c != 'b' && c != 'c' && c != 'd' && c != 'e' && c != 'f' && c != 'g' && c != 'h' && c != 'i' && c != 'j' && c != 'k' && c != 'l' && c != 'm' && c != 'n' && c != 'o' && c != 'p' && c != 'q' && c != 'r' && c != 's' && c != 't' && c != 'u' && c != 'v' && c != 'w' && c != 'x' && c != 'y' && c != 'z' && c != '0' && c != '1' && c != '2' && c != '3' && c != '4' && c != '5' && c != '6' && c != '7' && c != '8' && c != '9' && c != '-' && c != '_') { valid = false; break; } } } else { fit = false; } if (valid && fit) { str = StringServices.replace(str, "_", "-"); super.insertString(offset, str, a); } else { getToolkit().beep(); } } } } /* * $Log$ */ src/java/org/dbdoclet/jive/widget/GridPanel.java0000644000175000017500000003157412644165236021762 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.jive.widget; import java.awt.Color; import java.awt.Component; import java.awt.Container; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.Font; import java.awt.GradientPaint; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Image; import java.awt.Insets; import java.util.ArrayList; import javax.swing.BorderFactory; import javax.swing.JButton; import javax.swing.JCheckBox; import javax.swing.JComboBox; import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.JList; import javax.swing.JPanel; import javax.swing.JSpinner; import javax.swing.JTable; import javax.swing.border.Border; import org.dbdoclet.jive.Anchor; import org.dbdoclet.jive.Colspan; import org.dbdoclet.jive.Fill; import org.dbdoclet.jive.JiveFactory; import org.dbdoclet.jive.Rowspan; import org.dbdoclet.jive.border.BottomEtchedBorder; import org.dbdoclet.jive.border.TopEtchedBorder; public class GridPanel extends JPanel { private static final long serialVersionUID = 1L; private ArrayList buttonList; private GridCell cell; private GridBagConstraints constraints; private Insets insets = new Insets(4, 4, 4, 4); private int maxCol = 0; private int maxRow = 0; private int columnOffset = 0; private GridPanel rowPanel; private Image backgroundImage; private Color gradientFrom; private Color gradientTo; public GridPanel() { this(null, new Insets(4, 4, 4, 4)); } public GridPanel(Insets insets) { this(null, insets); } public GridPanel(String title) { this(title, new Insets(4, 4, 4, 4)); } public GridPanel(String title, Insets insets) { super(new GridBagLayout()); constraints = new GridBagConstraints(); constraints.anchor = GridBagConstraints.WEST; if (insets != null) { this.insets = insets; } if (title != null) { setBorder(BorderFactory.createTitledBorder(title)); } cell = new GridCell(); buttonList = new ArrayList(); } public static void lock(Container container, boolean flag) { for (int i = 0; i < container.getComponentCount(); i++) { Component comp = container.getComponent(i); if (comp instanceof JList || comp instanceof JButton || comp instanceof JCheckBox || comp instanceof JComboBox || comp instanceof JSpinner || comp instanceof JTable || comp instanceof JLabel) { comp.setEnabled(flag); continue; } if (comp instanceof Container) { lock((Container) comp, flag); // comp.setEnabled(flag); continue; } comp.setEnabled(flag); } } public void addButton(JButton button) { buttonList.add(button); } public void addComponent(JComponent comp) { addComponent(comp, Colspan.CS_1, Rowspan.RS_1, Anchor.WEST, Fill.NONE); } public void addComponent(JComponent comp, Anchor anchor) { addComponent(comp, Colspan.CS_1, Rowspan.RS_1, anchor, Fill.NONE, null); } public void addComponent(JComponent comp, Anchor anchor, Fill fill) { addComponent(comp, Colspan.CS_1, Rowspan.RS_1, anchor, fill, null); } public void addComponent(JComponent comp, Anchor anchor, Fill fill, Insets insets) { addComponent(comp, Colspan.CS_1, Rowspan.RS_1, anchor, fill, insets); } public void addComponent(JComponent comp, Colspan width) { addComponent(comp, width, Rowspan.RS_1, Anchor.WEST, Fill.NONE); } public void addComponent(JComponent comp, Colspan width, Anchor anchor) { addComponent(comp, width, Rowspan.RS_1, anchor, Fill.NONE); } public void addComponent(JComponent comp, Colspan width, Anchor anchor, Fill fill) { addComponent(comp, width, Rowspan.RS_1, anchor, fill); } public void addComponent(JComponent comp, Colspan width, Rowspan height) { addComponent(comp, width, height, Anchor.WEST, Fill.NONE); } public void addComponent(JComponent comp, Colspan width, Rowspan height, Anchor anchor) { addComponent(comp, width, height, anchor, Fill.NONE); } public void addComponent(JComponent comp, Colspan width, Rowspan height, Anchor anchor, Fill fill) { addComponent(comp, width, height, anchor, fill, null); } public void addComponent(JComponent comp, Colspan width, Rowspan height, Anchor anchor, Fill fill, Insets insets) { if (comp == null) { throw new IllegalArgumentException( "The argument comp may not be null!"); } if (width == null) { throw new IllegalArgumentException( "The argument width must not be null!"); } if (height == null) { throw new IllegalArgumentException( "The argument height must not be null!"); } if (anchor == null) { throw new IllegalArgumentException( "The argument anchor must not be null!"); } if (fill == null) { throw new IllegalArgumentException( "The argument fill must not be null!"); } // comp.setBorder(BorderFactory.createLineBorder(Color.red)); if (cell.getCol() > maxCol) { maxCol = cell.getCol(); } if (cell.getRow() > maxRow) { maxRow = cell.getRow(); } constraints.gridx = cell.getCol(); constraints.gridy = cell.getRow(); constraints.gridwidth = width.getValue(); constraints.gridheight = height.getValue(); constraints.anchor = anchor.getGbc(); constraints.weightx = 0.0; constraints.weighty = 0.0; constraints.fill = fill.getGbc(); switch (constraints.fill) { case GridBagConstraints.NONE: constraints.weightx = 0.0; constraints.weighty = 0.0; break; case GridBagConstraints.BOTH: constraints.weightx = 1.0; constraints.weighty = 1.0; break; case GridBagConstraints.HORIZONTAL: constraints.weightx = 1.0; constraints.weighty = 0.0; break; case GridBagConstraints.VERTICAL: constraints.weightx = 0.0; constraints.weighty = 1.0; break; default: constraints.weightx = 0.0; constraints.weighty = 0.0; break; } if (insets != null) { constraints.insets = insets; } else { constraints.insets = this.insets; } if (rowPanel != null) { rowPanel.addComponent(comp, anchor, fill); } else { add(comp, constraints); cell.incrCol(width.getValue()); } } public void addComponent(JComponent comp, Fill fill) { addComponent(comp, Colspan.CS_1, Rowspan.RS_1, Anchor.WEST, fill, null); } public void addComponent(JComponent comp, Rowspan height, Anchor anchor) { addComponent(comp, Colspan.CS_1, height, anchor, Fill.NONE); } public void addComponent(JComponent comp, Rowspan height, Anchor anchor, Fill fill) { addComponent(comp, Colspan.CS_1, height, anchor, fill); } public void addHorizontalGlue() { JLabel label = new JLabel(); addComponent(label, new Colspan(maxCol + 1), Rowspan.RS_1, Anchor.CENTER, Fill.HORIZONTAL); } public void addLabeledComponent(JLabel label, JComponent component) { addLabeledComponent(label, component, Fill.NONE); } public void addLabeledComponent(JLabel label, JComponent component, Fill fill) { if (label == null) { throw new IllegalArgumentException( "The argument label may not be null!"); } if (component == null) { throw new IllegalArgumentException( "The argument comboBox must not be null!"); } addComponent(label); addComponent(component, fill); } public void addLabeledComponent(String labelText, JComponent component) { JiveFactory jf = JiveFactory.getInstance(); JLabel label = jf.createLabel(labelText, Font.PLAIN); addLabeledComponent(label, component, Fill.NONE); } public void addSeparator(int colspan) { addSeparator(colspan, " "); } public void addSeparator(int colspan, String text) { JLabel label = new JLabel(text); Dimension size = label.getPreferredSize(); size.setSize(size.getWidth() * 1.5, size.getHeight() * 1.5); label.setPreferredSize(size); label.setForeground(Color.darkGray); label.setBorder(new BottomEtchedBorder()); addComponent(label, new Colspan(colspan), Rowspan.RS_1, Anchor.WEST, Fill.HORIZONTAL); incrRow(); } public void addVerticalGlue() { JLabel label = new JLabel(""); // label.setBorder(BorderFactory.createLineBorder(Color.blue)); cell.nextRow(); addComponent(label, new Colspan(maxCol + 1), Rowspan.RS_1, Anchor.CENTER, Fill.BOTH); } public void addVerticalGlue(int height) { JLabel label = new JLabel(); Dimension dim = new Dimension(96, height); label.setMinimumSize(dim); label.setPreferredSize(dim); label.setMaximumSize(dim); cell.nextRow(); addComponent(label, new Colspan(maxCol + 1), Rowspan.RS_1, Anchor.CENTER, Fill.HORIZONTAL); } public void appendToRow(int rowNum, JComponent comp) { Component[] compList = this.getComponents(); int nr = 0; for (Component child : compList) { if (child instanceof GridPanel && nr == rowNum) { GridPanel rowPanel = (GridPanel) child; rowPanel.addComponent(comp); } nr++; } } public Image getBackgroundImage() { return backgroundImage; } public GridCell getLastCell() { return cell; } public void incrRow() { if (rowPanel != null) { rowPanel.incrRow(); } else { cell.nextRow(); cell.setCol(columnOffset); } // rowPanel = null; } public void leaveSubPanel() { rowPanel = null; } public void lock() { lock(this, false); } public void prepare() { if (buttonList != null && buttonList.size() > 0) { addVerticalGlue(); JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new FlowLayout(FlowLayout.RIGHT)); buttonPanel.setBorder(new TopEtchedBorder()); for (JButton button : buttonList) { buttonPanel.add(button); } cell.setRow(maxRow + 1); cell.setCol(0); addComponent(buttonPanel, new Colspan(maxCol + 1), Rowspan.RS_1, Anchor.CENTER, Fill.HORIZONTAL); } } @Override public void removeAll() { super.removeAll(); setCell(0, 0); } public void replaceComponent(JComponent oldComponent, JComponent newComponent) { GridBagLayout layout = (GridBagLayout) getLayout(); GridBagConstraints gbc = layout.getConstraints(oldComponent); remove(oldComponent); add(newComponent, gbc); } public void setBackgroundImage(Image backgroundImage) { this.backgroundImage = backgroundImage; } public void setColumnOffset(int columnOffset) { this.columnOffset = columnOffset; cell.setCol(columnOffset); } public void setGradientBackground(Color gradientFrom, Color gradientTo) { this.gradientFrom = gradientFrom; this.gradientTo = gradientTo; } public void setLock(boolean flag) { lock(this, flag); } /** * Die Methode setShowCellBorders zeichnet um alle Komponenten des Panels vom Typ * JComponent einen schwarzen Rahmen. Dabei werden alle Komponenten berücksichtigt, die sich zum * Zeitpunkt des Aufrufs im Panel befinden. Komponten, die später zum Panel hinzugefügt werden erhalten keinen * Rahmen. Die Methode dient hauptsächlich der Fehlersuche in komplexen Layouts. * * @param showCellBorders * boolean */ public void setShowCellBorders(boolean showCellBorders) { Component[] compList = getComponents(); Border border = null; if (showCellBorders == true) { border = BorderFactory.createLineBorder(Color.black, 2); } for (int i = 0; i < compList.length; i++) { if (compList[i] instanceof JComponent) { ((JComponent) compList[i]).setBorder(border); } } } public void startSubPanel() { startSubPanel(Fill.NONE); } public void startSubPanel(Fill fill) { if (rowPanel != null) { rowPanel.addHorizontalGlue(); rowPanel = null; } if (cell.getCol() != 0) { incrRow(); } GridPanel panel = new GridPanel(); // panel.setBorder(BorderFactory.createLineBorder(Color.green)); addComponent(panel, Anchor.WEST, fill, new Insets(0, 0, 0, 0)); rowPanel = panel; } public void unlock() { lock(this, true); } @Override protected void paintComponent(Graphics g) { int width = getWidth(); int height = getHeight(); if (backgroundImage != null) { g.drawImage(backgroundImage, 0, 0, null); } else if (gradientFrom != null && gradientTo != null) { GradientPaint paint = new GradientPaint(width/2, 0, gradientFrom, width/2, height, gradientTo, true); Graphics2D g2d = (Graphics2D) g; g2d.setPaint(paint); g2d.fillRect(0, 0, width, height); } else { super.paintComponent(g); } } protected void setCell(int row, int col) { cell.setRow(row); cell.setCol(col); } } src/java/org/dbdoclet/jive/Colspan.java0000644000175000017500000000267512644165236020231 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.jive; public class Colspan { public static final Colspan CS_1 = new Colspan(1); public static final Colspan CS_2 = new Colspan(2); public static final Colspan CS_3 = new Colspan(3); public static final Colspan CS_4 = new Colspan(4); public static final Colspan CS_5 = new Colspan(5); public static final Colspan CS_6 = new Colspan(6); private int value = 1; public Colspan() { this(1); } public Colspan(int value) { if (value < 1) { value = 1; } this.value = value; } public int getValue() { return value; } public void setValue(int value) { this.value = value; } } src/java/org/dbdoclet/jive/model/0000755000175000017500000000000012644165244017054 5ustar mathieumathieusrc/java/org/dbdoclet/jive/model/LabelItem.java0000644000175000017500000000467312644165236021570 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.jive.model; public class LabelItem { private String label; private Object value; public LabelItem(String label, Object value) { if (label == null) { throw new IllegalArgumentException("Parameter label is null!"); } if (value == null) { throw new IllegalArgumentException("Parameter value is null!"); } this.label = label; this.value = value; } protected LabelItem() { label = "???"; value = "???"; } public String getLabel() { return label; } protected void setLabel(String label) { this.label = label; } public Object getValue() { return value; } protected void setValue(Object value) { if (value == null) { throw new IllegalArgumentException( "The argument value may not be null!"); } this.value = value; } @Override public boolean equals(Object obj) { if (obj == null) { return false; } if (obj instanceof String) { String value = (String) obj; if (value.equals(this.value)) { return true; } else { return false; } } if (obj instanceof LabelItem) { LabelItem item = (LabelItem) obj; Object value = item.getValue(); if (value.equals(this.value)) { return true; } } return false; } @Override public int hashCode() { int hashCode = value.hashCode(); return hashCode; } @Override public String toString() { return label; } } src/java/org/dbdoclet/jive/model/PathListModel.java0000644000175000017500000002722112644165236022435 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.jive.model; import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.ResourceBundle; import javax.swing.table.AbstractTableModel; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.dbdoclet.io.FileSet; import org.dbdoclet.jive.JiveFactory; import org.dbdoclet.service.ResourceServices; public class PathListModel extends AbstractTableModel { private static final long serialVersionUID = 1L; private static Log logger = LogFactory.getLog(PathListModel.class); public static final int COLUMN_ID = 0; public static final int COLUMN_PATH = 1; public static final int COLUMN_STATUS = 2; public static final int COLUMN_FILTER_TYPE = 3; public static final int COLUMN_CASE_SENSITIVE = 4; public static final int COLUMN_FILTER = 5; public static final int COLUMN_COUNT = 6; private final ArrayList data; private final JiveFactory widgetMap; private final ResourceBundle res; /** Das aktuelle Arbeitsverzeichnis. */ private File cwd; public PathListModel(JiveFactory widgetMap) { super(); if (widgetMap == null) { throw new IllegalArgumentException( "The argument widgetMap must not be null!"); } this.widgetMap = widgetMap; res = widgetMap.getResourceBundle(); data = new ArrayList(); cwd = new File("."); } public void setWorkingDir(File cwd) { if (cwd == null) { throw new IllegalArgumentException( "The argument cwd may not be null!"); } this.cwd = cwd; } public ArrayList getFileSets() { if (data == null) { throw new IllegalStateException("The field data may not be null!"); } return data; } public void changed() { fireTableStructureChanged(); if (widgetMap != null) { widgetMap.enableSaveWidgets(); } } public void rowChanged(int rowIndex) { if (rowIndex < 0 || rowIndex >= data.size()) { return; } fireTableRowsUpdated(rowIndex, rowIndex); } public synchronized void clear() { if (data == null) { throw new IllegalStateException("The field data may not be null!"); } data.clear(); fireTableStructureChanged(); if (widgetMap != null) { widgetMap.enableSaveWidgets(); } } public boolean contains(String path) throws IOException { FileSet fileset = new FileSet(cwd, new File(path)); return contains(fileset); } public boolean contains(FileSet fileset) { if (data == null) { throw new IllegalStateException("The field data may not be null!"); } if (fileset == null) { throw new IllegalArgumentException( "The argument fileset may not be null!"); } return data.contains(fileset); } public int size() { if (data == null) { throw new IllegalStateException("The field data may not be null!"); } return data.size(); } public FileSet getEntry(int index) { if (data == null) { throw new IllegalStateException("The field data may not be null!"); } if (index < 0) { throw new IllegalArgumentException( "The argument index may not be less than 0!"); } return data.get(index); } public synchronized void addEntry(String path) { if (data == null) { throw new IllegalStateException("The field data may not be null!"); } if (path == null) { throw new IllegalArgumentException( "The argument path may not be null!"); } logger.debug("cwd=" + cwd); logger.debug("path=" + path); addEntry(new FileSet(cwd, new File(path))); } public synchronized void addEntry(FileSet fileset) { addEntry(fileset, -1); } public synchronized void addEntry(FileSet fileset, int pos) { if (data == null) { throw new IllegalStateException("The field data may not be null!"); } if (fileset == null) { throw new IllegalArgumentException( "The argument fileset may not be null!"); } if (pos > -1 && pos < data.size()) { data.add(pos, fileset); } else { data.add(fileset); } validate(); int row = data.size() - 1; fireTableRowsInserted(row, row); if (widgetMap != null) { widgetMap.enableSaveWidgets(); } } public synchronized void removeEntry(int selectedId) { if (data == null) { throw new IllegalStateException("The field data may not be null!"); } FileSet entry; Integer id; for (int i = 0; i < data.size(); i++) { entry = data.get(i); id = entry.getId(); if (id != null && id.intValue() == selectedId) { data.remove(i); fireTableStructureChanged(); break; } } if (widgetMap != null) { widgetMap.enableSaveWidgets(); } validate(); } public synchronized void removeEntry(FileSet fileset) { if (data == null) { throw new IllegalStateException("The field data may not be null!"); } FileSet entry; for (int i = 0; i < data.size(); i++) { entry = data.get(i); if (fileset.equals(entry)) { data.remove(i); fireTableStructureChanged(); break; } } if (widgetMap != null) { widgetMap.enableSaveWidgets(); } validate(); } public int getRowCount() { return data.size(); } public int getColumnCount() { return COLUMN_COUNT; } @Override public String getColumnName(int column) { if ((column < 0) || (column >= COLUMN_COUNT)) { throw new IllegalArgumentException("Illegal value " + column + " for argument column!"); } switch (column) { case COLUMN_ID: return ResourceServices.getString(res, "C_SEQUENCE"); case COLUMN_PATH: return ResourceServices.getString(res, "C_PATH"); case COLUMN_STATUS: return ResourceServices.getString(res, "C_STATUS"); case COLUMN_CASE_SENSITIVE: return ResourceServices.getString(res, "C_CASE_SENSITIVE"); case COLUMN_FILTER_TYPE: return ResourceServices.getString(res, "C_FILTER_TYPE"); case COLUMN_FILTER: return ResourceServices.getString(res, "C_FILTER"); } return "???"; } @Override public Class getColumnClass(int column) { if ((column < 0) || (column >= COLUMN_COUNT)) { throw new IllegalArgumentException("Illegal value " + column + " for argument column!"); } switch (column) { case COLUMN_ID: return Integer.class; case COLUMN_PATH: return File.class; case COLUMN_CASE_SENSITIVE: return Boolean.class; case COLUMN_STATUS: return Integer.class; case COLUMN_FILTER_TYPE: return LabelItem.class; case COLUMN_FILTER: return String.class; } return Object.class; } @Override public boolean isCellEditable(int row, int column) { if ((column < 0) || (column >= COLUMN_COUNT)) { throw new IllegalArgumentException("Illegal value " + column + " for argument column!"); } if (row < 0) { throw new IllegalArgumentException("Illegal value " + row + " for argument row!"); } FileSet fileset = getEntry(row); switch (column) { case COLUMN_ID: case COLUMN_PATH: return true; case COLUMN_STATUS: return false; case COLUMN_CASE_SENSITIVE: case COLUMN_FILTER_TYPE: case COLUMN_FILTER: if (fileset.isDirectory() == true) { return true; } else { return false; } } return false; } @Override public void setValueAt(Object obj, int row, int column) { if (data == null) { throw new IllegalStateException("The field data may not be null!"); } if (obj == null) { throw new IllegalArgumentException( "The argument obj may not be null!"); } if ((row < 0) || (row >= data.size())) { throw new IllegalArgumentException( "The argument row may not be null!"); } if ((column < 0) || (column >= COLUMN_COUNT)) { throw new IllegalArgumentException("Illegal value " + column + " for argument column!"); } FileSet entry = data.get(row); Integer id = entry.getId(); switch (column) { case COLUMN_ID: if (obj instanceof Integer) { int pos = ((Integer) obj).intValue(); if (pos < 1 || pos > data.size()) { return; } removeEntry(id); addEntry(entry, pos - 1); validate(); } else { throw new IllegalArgumentException("Invalid id type " + obj.getClass().getName() + "."); } break; case COLUMN_PATH: if (obj instanceof String) { entry.setPath(new File((String) obj)); } else if (obj instanceof File) { entry.setPath((File) obj); } else { throw new IllegalArgumentException("Invalid path type " + obj.getClass().getName() + "."); } break; case COLUMN_CASE_SENSITIVE: if (obj instanceof Boolean) { entry.setCaseSensitive((Boolean) obj); } break; case COLUMN_FILTER_TYPE: logger.info("setValueAt: Filter type = " + obj.getClass().getName()); if (obj instanceof LabelItem) { LabelItem item = (LabelItem) obj; Integer type = (Integer) item.getValue(); entry.setFilterType(type.intValue()); } break; case COLUMN_FILTER: if (obj instanceof String) { String filter = (String) obj; int filterType = entry.getFilterType(); if (filterType == FileSet.FILTER_NONE || filter.trim().length() > 0) { entry.setFilter(filter); } } break; } fireTableRowsUpdated(row, row); if (widgetMap != null) { widgetMap.enableSaveWidgets(); } } public Object getValueAt(int row, int column) { FileSet entry = data.get(row); switch (column) { case COLUMN_ID: return entry.getId(); case COLUMN_PATH: return entry.getPath(); case COLUMN_STATUS: return String.valueOf(entry.getStatus()); case COLUMN_CASE_SENSITIVE: return entry.getCaseSensitive(); case COLUMN_FILTER_TYPE: return getFilterTypeLabel(entry); case COLUMN_FILTER: return entry.getFilter(); } return "???"; } private String getFilterTypeLabel(FileSet entry) { switch (entry.getFilterType()) { case FileSet.FILTER_NONE: return ResourceServices.getString(res, "C_NO_FILTER"); case FileSet.FILTER_INCLUDE_FILES: return ResourceServices.getString(res, "C_INCLUDE_FILES"); case FileSet.FILTER_EXCLUDE_FILES: return ResourceServices.getString(res, "C_EXCLUDE_FILES"); case FileSet.FILTER_INCLUDE_DIRECTORIES: return ResourceServices.getString(res, "C_INCLUDE_DIRECTORIES"); case FileSet.FILTER_EXCLUDE_DIRECTORIES: return ResourceServices.getString(res, "C_EXCLUDE_DIRECTORIES"); case FileSet.FILTER_INCLUDE_PACKAGES: return ResourceServices.getString(res, "C_INCLUDE_PACKAGES"); case FileSet.FILTER_EXCLUDE_PACKAGES: return ResourceServices.getString(res, "C_EXCLUDE_PACKAGES"); } return ResourceServices.getString(res, "C_UNKNOWN_FILTER_TYPE"); } private void validate() { if (data == null) { throw new IllegalStateException("The field data may not be null!"); } FileSet entry; for (int i = 0; i < data.size(); i++) { entry = data.get(i); entry.setId(i + 1); try { fireTableCellUpdated(i, COLUMN_ID); } catch (Throwable oops) { // ignore } } } public ArrayList findEntry(File path) { ArrayList hits = new ArrayList(); for (int i = 0; i < data.size(); i++) { if (path.equals(data.get(i).getQualifiedPath())) { hits.add(data.get(i)); } } if (hits.size() == 0) { return null; } return hits; } } src/java/org/dbdoclet/jive/model/SpinnerDistanceModel.java0000644000175000017500000000545112644165236023777 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.jive.model; import java.util.ArrayList; import java.util.Locale; import javax.swing.SpinnerModel; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import org.dbdoclet.unit.Length; public class SpinnerDistanceModel implements SpinnerModel { private Length length; private ArrayList listenerList; private final Locale locale; private boolean excludePercent = true; public SpinnerDistanceModel(Locale locale) { this.locale = locale; length = new Length(); listenerList = new ArrayList(); } public void setExcludePercent(boolean excludePercent) { this.excludePercent = excludePercent; if (length != null) { length.setExcludePercent(excludePercent); } } public void addChangeListener(ChangeListener listener) { if (listener == null) { return; } if (listenerList.contains(listener) == false) { listenerList.add(listener); } } public Object getNextValue() { if (length != null) { length.incrDistance(0.1F); } return length; } public Object getPreviousValue() { if (length != null) { length.decrDistance(0.1F); } return length; } public Object getValue() { return length; } public void removeChangeListener(ChangeListener listener) { if (listener == null) { return; } listenerList.remove(listener); } public void setValue(Object value) { if (value == null) { length = new Length(); length.setExcludePercent(excludePercent); length.setLocale(locale); } else if (value instanceof String) { length.setLocalizedValue((String) value); } else if (value instanceof Length) { length = (Length) value; length.setExcludePercent(excludePercent); length.setLocale(locale); } else { throw new IllegalArgumentException( "Invalid type " + value.getClass().getName() + " for SpinnerDistanceModel. Only String and Distance is allowed."); } fireChangeEvent(); } private void fireChangeEvent() { for (ChangeListener listener : listenerList) { listener.stateChanged(new ChangeEvent(this)); } } } src/java/org/dbdoclet/jive/filter/0000755000175000017500000000000012644165244017241 5ustar mathieumathieusrc/java/org/dbdoclet/jive/filter/BlurFilter.java0000644000175000017500000000477212644165236022171 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.jive.filter; import java.awt.image.BufferedImage; import java.awt.image.BufferedImageOp; import java.awt.image.ConvolveOp; import java.awt.image.Kernel; public class BlurFilter { public static BufferedImage boxBlur(BufferedImage image, int radius) { if (radius < 1) { throw new IllegalArgumentException("Radius must be >= 1"); } int size = radius * radius; float[] data = new float[size]; for (int i = 0; i < data.length; i++) { data[i] = 1.0f / new Float(data.length); } Kernel kernel = new Kernel(radius, radius, data); BufferedImageOp blurFilter = new ConvolveOp(kernel, ConvolveOp.EDGE_NO_OP, null); return blurFilter.filter(image, null); } public static BufferedImage gaussianBlur(BufferedImage image, int radius) { int r = (int) Math.ceil(radius); int rows = r * 2 + 1; float[] matrix = new float[rows]; float sigma = radius / 3; float sigma22 = 2 * sigma * sigma; float sigmaPi2 = (float) (2 * Math.PI * sigma); float sqrtSigmaPi2 = (float) Math.sqrt(sigmaPi2); float radius2 = radius * radius; float total = 0; int index = 0; for (int row = -r; row <= r; row++) { float distance = row * row; if (distance > radius2) matrix[index] = 0; else matrix[index] = (float) Math.exp(-(distance) / sigma22) / sqrtSigmaPi2; total += matrix[index]; index++; } for (int i = 0; i < rows; i++) { matrix[i] /= total; } Kernel kernelVertical = new Kernel(rows, 1, matrix); Kernel kernelHorizontal = new Kernel(1, rows, matrix); BufferedImageOp blurFilter = new ConvolveOp(kernelVertical, ConvolveOp.EDGE_NO_OP, null); image = blurFilter.filter(image, null); blurFilter = new ConvolveOp(kernelHorizontal, ConvolveOp.EDGE_NO_OP, null); image = blurFilter.filter(image, null); return image; } } src/java/org/dbdoclet/jive/Anchor.java0000644000175000017500000000341112644165236020031 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.jive; import java.awt.GridBagConstraints; public enum Anchor { CENTER, NORTH, NORTHEAST, EAST, SOUTHEAST, SOUTH, SOUTHWEST, WEST, NORTHWEST; public int getGbc() { if (this == Anchor.NORTH) { return GridBagConstraints.NORTH; } if (this == Anchor.NORTHEAST) { return GridBagConstraints.NORTHEAST; } if (this == Anchor.EAST) { return GridBagConstraints.EAST; } if (this == Anchor.SOUTHEAST) { return GridBagConstraints.SOUTHEAST; } if (this == Anchor.SOUTH) { return GridBagConstraints.SOUTH; } if (this == Anchor.SOUTHWEST) { return GridBagConstraints.SOUTHWEST; } if (this == Anchor.WEST) { return GridBagConstraints.WEST; } if (this == Anchor.NORTHWEST) { return GridBagConstraints.NORTHWEST; } return GridBagConstraints.WEST; } }src/java/org/dbdoclet/jive/JiveServices.java0000644000175000017500000000625712644165236021233 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.jive; import java.awt.Dimension; import java.awt.Point; import java.awt.Toolkit; import java.awt.Window; import java.net.URL; import javax.swing.ImageIcon; import org.dbdoclet.service.StringServices; public class JiveServices { /** * Zentriert eine Fenster in einem übergeordneten Fenster, oder auf dem * Bildschirm. * * @param parent * @param wnd */ public static void center(Window parent, Window wnd) { Dimension dimension; int width = wnd.getWidth(); int height = wnd.getHeight(); int xpos; int ypos; if (parent == null || parent.isShowing() == false) { dimension = Toolkit.getDefaultToolkit().getScreenSize(); xpos = (int) ((dimension.getWidth() - width) / 2); ypos = (int) ((dimension.getHeight() - height) / 2); } else { dimension = parent.getSize(); Point point = parent.getLocationOnScreen(); xpos = (int) ((dimension.getWidth() - width) / 2); ypos = (int) ((dimension.getHeight() - height) / 2); xpos += point.x; ypos += point.y; } wnd.setSize(width, height); wnd.setLocation(xpos, ypos); } public static void center(Window wnd) { center(null, wnd); } public static ImageIcon getJlfgrIcon(String iconUrl) { String buffer = StringServices.cutPrefix(iconUrl, "jlfgr:"); String[] tokens = buffer.split("/"); if (tokens != null && tokens.length == 2) { return getJlfgrIcon(tokens[0], tokens[1]); } throw new IllegalArgumentException("Invalid iconUrl '" + iconUrl + "'!"); } public static ImageIcon getJlfgrIcon(String category, String name) { if (category == null) { throw new IllegalArgumentException("The argument category must not be null!"); } if (name == null) { throw new IllegalArgumentException("The argument name must not be null!"); } ClassLoader loader = ClassLoader.getSystemClassLoader(); String path = "/toolbarButtonGraphics/" + category + "/" + name; URL iconUrl = loader.getResource(path); if (iconUrl == null) { iconUrl = JiveFactory.class.getResource(path); } if (iconUrl == null) { return null; } ImageIcon icon = new ImageIcon(iconUrl, path); return icon; } } src/java/org/dbdoclet/jive/sheet/0000755000175000017500000000000012644165244017064 5ustar mathieumathieusrc/java/org/dbdoclet/jive/sheet/SheetContainer.java0000644000175000017500000000147212644165236022647 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.jive.sheet; public interface SheetContainer { public void show(Sheet sheet); } src/java/org/dbdoclet/jive/sheet/Bound.java0000644000175000017500000000752712644165236021012 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.jive.sheet; import org.dbdoclet.unit.Length; public class Bound { private Length top; private Length right; private Length bottom; private Length left; public Bound() { this(new Length(0), new Length(0), new Length(0), new Length(0)); } public Bound(Length top, Length right, Length bottom, Length left) { this.top = top; this.right = right; this.bottom = bottom; this.left = left; } public Length getTop() { if (top == null) { top = new Length(0); } return top; } public void setTop(Length top) { this.top = top; } public Length getRight() { if (right == null) { right = new Length(0); } return right; } public void setRight(Length right) { this.right = right; } public Length getBottom() { if (bottom == null) { bottom = new Length(0); } return bottom; } public void setBottom(Length bottom) { this.bottom = bottom; } public Length getLeft() { if (left == null) { left = new Length(0); } return left; } public void setLeft(Length left) { this.left = left; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((bottom == null) ? 0 : bottom.hashCode()); result = prime * result + ((left == null) ? 0 : left.hashCode()); result = prime * result + ((right == null) ? 0 : right.hashCode()); result = prime * result + ((top == null) ? 0 : top.hashCode()); return result; } @Override public boolean equals(Object other) { if (this == other) { return true; } if (other == null) { return false; } if (getClass() != other.getClass()) { return false; } Bound otherBound = (Bound) other; if (top == null && otherBound.top != null) { return false; } if (top.equals(otherBound.top) == false) { return false; } if (right == null && otherBound.right != null) { return false; } if (right.equals(otherBound.right) == false) { return false; } if (bottom == null && otherBound.bottom != null) { return false; } if (bottom.equals(otherBound.bottom) == false) { return false; } if (left == null && otherBound.left != null) { return false; } if (left.equals(otherBound.left) == false) { return false; } return true; } @Override public String toString() { return "Bound [top=" + top + ", right=" + right + ", bottom=" + bottom + ", left=" + left + "]"; } protected static Length[] parse(String buffer) { if (buffer == null) { return new Length[0]; } String[] tokens = buffer.split("\\s+"); if (tokens == null) { return new Length[0]; } Length[] list = new Length[tokens.length]; int index = 0; for (String token : tokens) { list[index++] = Length.valueOf(token); } return list; } public String toNormalizedString() { StringBuilder buffer = new StringBuilder(); buffer.append(getTop().toNormalizedString()); buffer.append(' '); buffer.append(getRight().toNormalizedString()); buffer.append(' '); buffer.append(getBottom().toNormalizedString()); buffer.append(' '); buffer.append(getLeft().toNormalizedString()); return buffer.toString(); } } src/java/org/dbdoclet/jive/sheet/AbstractPart.java0000644000175000017500000003242712644165236022332 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.jive.sheet; import java.awt.BasicStroke; import java.awt.Color; import java.awt.Font; import java.awt.FontMetrics; import java.awt.Graphics2D; import java.awt.Point; import java.awt.Rectangle; import java.awt.geom.Point2D; import java.awt.geom.Rectangle2D; import java.util.ArrayList; import java.util.ResourceBundle; import org.dbdoclet.format.Alignment; import org.dbdoclet.format.Display; import org.dbdoclet.format.FontWeight; import org.dbdoclet.jive.JiveConstants; import org.dbdoclet.unit.Length; import org.w3c.dom.Element; public abstract class AbstractPart implements Part { protected Rectangle2D.Double boundingBox; protected Rectangle2D.Double paddingBox; protected Rectangle2D.Double contentBox; private ArrayList children; private Color foreground; private Display display; private Part parent; protected Alignment alignment; protected Font font; protected String id; protected int index = -1; protected Margin margin = new Margin(); protected Padding padding = new Padding(); protected ResourceBundle res; protected boolean selected; protected final Sheet sheet; public AbstractPart(Sheet sheet) { if (sheet == null) { throw new IllegalArgumentException( "The argument sheet must not be null!"); } this.sheet = sheet; this.res = sheet.getResourceBundle(); children = new ArrayList(); } public void appendChild(Part part) { if (part != null) { children.add(part); part.setParent(this); } updateChildren(); } public int computeFontHeight(Graphics2D g2d, Font font) { FontMetrics fm = g2d.getFontMetrics(font); return fm.getHeight(); } public void copyProperties(Part to) { to.setMargin(getMargin().deepCopy()); to.setPadding(getPadding().deepCopy()); } public Alignment getAlignment() { return alignment; } public Rectangle2D.Double getBoundingBox() { return getMarginBox(); } public Part getChild(int index) { updateChildren(); if (index >= 0 && index < children.size()) { return children.get(index); } return null; } /** * Durchsucht die Liste der Kindelemente und liefert das Kind mit gesuchten * Id zurück, falls vorhanden. Andernfalls wird der Wert null * zurückgeliefert. * * @param id * @return Part */ public Part getChildById(String id) { if (children == null || children.size() == 0) { return null; } for (Part child : children) { if (child != null && child.getId() != null && child.getId().equals(id)) { return child; } } return null; } public ArrayList getChildren() { updateChildren(); return children; } public Rectangle2D.Double getContentBox() { if (contentBox == null) { contentBox = new Rectangle2D.Double(); } return contentBox; } public Rectangle2D.Double getCopyOfContentBox() { Rectangle2D.Double copy = new Rectangle2D.Double(); if (contentBox == null) { updateBoxes(); } copy.x = contentBox.x; copy.y = contentBox.y; copy.width = contentBox.width; copy.height = contentBox.height; return copy; } public Display getDisplay() { if (display == null) { return Display.INLINE; } return display; } public Part getFirstChild() { if (children == null || children.size() == 0) { return null; } Part part = children.get(0); part.setIndex(0); return part; } public Font getFont() { return font; } public Color getForeground() { return foreground; } public String getId() { return id; } /** * Liefert den aktuellen Index des Elements in der Liste Geschwisterknoten * zurück. */ public int getIndex() { return index; } public Part getLastChild() { if (children == null || children.size() == 0) { return null; } Part part = children.get(children.size() - 1); part.setIndex(children.size() - 1); return part; } public Margin getMargin() { return margin.deepCopy(); } public Rectangle2D.Double getMarginBox() { if (boundingBox == null) { boundingBox = new Rectangle2D.Double(); } return boundingBox; } public double getNormalizedHeight() { double height = getMargin().getTop().toMillimeter(); height += getPadding().getTop().toMillimeter(); for (Part staff : children) { height += staff.getNormalizedHeight(); } height += getPadding().getBottom().toMillimeter(); height += getMargin().getBottom().toMillimeter(); return height; } public Padding getPadding() { return padding.deepCopy(); } public Rectangle2D.Double getPaddingBox() { if (paddingBox == null) { paddingBox = new Rectangle2D.Double(); } return paddingBox; } public Part getParent() { return parent; } public ResourceBundle getResourceBundle() { return res; } public Sheet getSheet() { return sheet; } public double getSpaceAfter() { return margin.getBottom().toMillimeter() + padding.getBottom().toMillimeter(); } public double getSpaceBefore() { return margin.getTop().toMillimeter() + padding.getTop().toMillimeter(); } public String getTagName() { return this.getClass().getSimpleName().toLowerCase(); } /* * Fügt einen untergeordneten Abschnitt in den aktuellen Bereich an der * angegebenen Position ein. * * @see org.dbdoclet.jive.sheet.Part#insertChild(int, * org.dbdoclet.jive.sheet.Part) */ public void insertChild(int index, Part part) { if (part == null) { throw new IllegalArgumentException( "Argument part must not be null!"); } if (index >= 0 && index < children.size()) { children.add(index, part); part.setParent(this); } else { children.add(part); part.setParent(this); } updateChildren(); } public boolean isSelected() { return selected; } public void removeAll() { children.clear(); } public Part removeChild(int index) { Part child = children.remove(index); updateChildren(); return child; } public boolean removeChild(Part part) { boolean rc = children.remove(part); updateChildren(); return rc; } public int rzoom(double value) { return sheet.rzoom(value); } public void setAlignment(Alignment alignment) { this.alignment = alignment; } public void setBoundingBox(Rectangle2D.Double boundingBox) { this.boundingBox = new Rectangle2D.Double(); this.boundingBox.x = boundingBox.x; this.boundingBox.y = boundingBox.y; this.boundingBox.width = boundingBox.width; this.boundingBox.height = boundingBox.height; updateBoxes(); } public void setDisplay(Display display) { this.display = display; } public void setFont(Font font) { this.font = font; } public void setFontSize(Length fontSize) { if (font != null) { font = font.deriveFont((float) fontSize.toPoint()); } } public void setFontWeight(FontWeight fontWeight) { if (font != null) { if (font.isBold() == false && fontWeight == FontWeight.BOLD) { font = font.deriveFont(Font.BOLD); } } } public void setForeground(Color foreground) { this.foreground = foreground; } public void setId(String id) { this.id = id; } public void setIndex(int index) { this.index = index; } public void setMargin(Margin margin) { this.margin = margin; updateBoxes(); } public void setMarginBottom(Length marginBottom) { margin.setBottom(marginBottom); updateBoxes(); } public void setMarginLeft(Length marginLeft) { margin.setLeft(marginLeft); updateBoxes(); } public void setMarginRight(Length marginRight) { margin.setRight(marginRight); updateBoxes(); } public void setMarginTop(Length marginTop) { margin.setTop(marginTop); updateBoxes(); } public void setPadding(Padding padding) { this.padding = padding; updateBoxes(); } public void setParent(Part parent) { this.parent = parent; } public void setSelected(boolean selected) { this.selected = selected; } @Override public String toString() { return getClass().getSimpleName() + "(" + getIndex() + ")"; } public int unzoom(double value) { return sheet.unzoom(value); } public void updateBoxes() { if (boundingBox == null) { boundingBox = new Rectangle2D.Double(); } if (paddingBox == null) { paddingBox = new Rectangle2D.Double(); } if (contentBox == null) { contentBox = new Rectangle2D.Double(); } Margin margin = getMargin(); paddingBox.x = boundingBox.x + margin.getLeft().toMillimeter(); paddingBox.y = boundingBox.y + margin.getTop().toMillimeter(); paddingBox.width = boundingBox.width - (margin.getLeft().toMillimeter() + margin.getRight() .toMillimeter()); paddingBox.height = boundingBox.height - (margin.getTop().toMillimeter() + margin.getBottom() .toMillimeter()); Padding padding = getPadding(); contentBox.x = paddingBox.x + padding.getLeft().toMillimeter(); contentBox.y = paddingBox.y + padding.getTop().toMillimeter(); contentBox.width = paddingBox.width - (padding.getLeft().toMillimeter() + padding.getRight() .toMillimeter()); contentBox.height = paddingBox.height - (padding.getTop().toMillimeter() + padding.getBottom() .toMillimeter()); } public void writeElement(Element element) { if (element == null) { throw new IllegalArgumentException( "The argument element must not be null!"); } element.setAttribute("margin", getMargin().toNormalizedString()); element.setAttribute("padding", getPadding().toNormalizedString()); String id = getId(); if (id != null && id.trim().length() > 0) { element.setAttribute("id", id.trim()); } } public double zoom(double value) { return sheet.zoom(value); } public Lines zoom(Lines lines) { Lines zoomed = new Lines(); for (Line line : lines.getList()) { zoomed.add(zoom(line)); } return zoomed; } private void updateChildren() { int index = 0; for (Part part : children) { part.setIndex(index++); } } private Line zoom(Line line) { Line zoomed = new Line(zoom(line.getP1()), zoom(line.getP2())); return zoomed; } private Point2D.Double zoom(Point2D.Double p) { Point2D.Double zoomed = new Point2D.Double(rzoom(p.getX()), rzoom(p.getY())); return zoomed; } /** * @param g2d */ protected void afterPaintPart(Graphics2D g2d) { if (sheet.isVisibleSpaceEnabled() == true) { Rectangle2D.Double bb = getMarginBox(); g2d.setPaint(Color.red); g2d.setStroke(new BasicStroke(1.0f)); Rectangle zbb = sheet.rzoom(bb); g2d.drawRect(zbb.x, zbb.y, zbb.width, zbb.height); bb = getPaddingBox(); g2d.setPaint(Color.green); g2d.setStroke(new BasicStroke(1.0f)); zbb = sheet.rzoom(bb); g2d.drawRect(zbb.x, zbb.y, zbb.width, zbb.height); bb = getContentBox(); g2d.setPaint(JiveConstants.COLOUR_BLUE_GRAY_1); g2d.setStroke(new BasicStroke(1.0f)); zbb = sheet.rzoom(bb); g2d.drawRect(zbb.x, zbb.y, zbb.width, zbb.height); } } protected void beforePaintPart(Graphics2D g2d) { if (isSelected() == true) { Rectangle bb = sheet.rzoom(getMarginBox()); g2d.setPaint(JiveConstants.COLOUR_BEIGE); g2d.fillRect(bb.x, bb.y, bb.width, bb.height); } } protected int computeStringWidth(Graphics2D g2d, Font font, String content) { FontMetrics fm = g2d.getFontMetrics(font); return fm.stringWidth(content); } protected void fillCopy(AbstractPart copy) { copy.setMargin(getMargin().deepCopy()); copy.setPadding(getPadding().deepCopy()); copy.setId(getId()); copy.setIndex(getIndex()); for (Part child : getChildren()) { copy.appendChild(child.deepCopy(copy.getSheet())); } } protected Rectangle2D.Double getCopyOfBoundingBox() { Rectangle2D.Double copy = new Rectangle2D.Double(); copy.x = boundingBox.x; copy.y = boundingBox.y; copy.width = boundingBox.width; copy.height = boundingBox.height; return copy; } protected int getNumOfChildren() { return children.size(); } /** * @param g2d */ protected void paintContainer(Graphics2D g2d) { double y = 0; Rectangle2D.Double pbb = getBoundingBox(); pbb.height = 0; pbb.height = getMargin().getTop().toMillimeter() + getPadding().getTop().toMillimeter(); for (Part child : getChildren()) { Rectangle2D.Double bb = getCopyOfContentBox(); bb.height = 0; bb.y += y; child.setBoundingBox(bb); child.paintPart(g2d); y += child.getNormalizedHeight(); pbb.height += y; } pbb.height += getPadding().getBottom().toMillimeter() + getMargin().getBottom().toMillimeter(); updateBoxes(); } protected void paintLayoutInfo(Graphics2D g2d, Rectangle bb, Color color, String text) { g2d.setPaint(color); g2d.drawRect(bb.x, bb.y, bb.width, bb.height); g2d.drawString(text, bb.x, bb.y - 2); } protected Point zoom(Point p) { Point zoomed = new Point(rzoom(p.getX()), rzoom(p.getY())); return zoomed; } public void setFontFamily(String value) { // TODO Auto-generated method stub } } src/java/org/dbdoclet/jive/sheet/DocumentPart.java0000644000175000017500000000266712644165236022350 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.jive.sheet; import java.awt.Graphics2D; public class DocumentPart extends AbstractPart { private DocumentCursor cursor; public DocumentPart(Sheet sheet) { super(sheet); cursor = new DocumentCursor(sheet.getBodyLeft(), sheet.getBodyRight()); } public Part deepCopy(Sheet sheet) { AbstractPart copy = new DocumentPart(sheet); for (Part child : getChildren()) { copy.appendChild(child.deepCopy(sheet)); } return copy; } public DocumentCursor getCursor() { return cursor; } public void paintPart(Graphics2D g2d) { // paintLayoutInfo(g2d, Color.CYAN, "DOCUMENT"); paintContainer(g2d); } } src/java/org/dbdoclet/jive/sheet/Part.java0000644000175000017500000000420512644165236020637 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.jive.sheet; import java.awt.Font; import java.awt.Graphics2D; import java.awt.geom.Rectangle2D; import java.util.ArrayList; import org.dbdoclet.format.FormattedObject; import org.w3c.dom.Element; public interface Part extends FormattedObject { public void appendChild(Part newChild); public int computeFontHeight(Graphics2D g2d, Font font); public void copyProperties(Part toPart); public Part deepCopy(Sheet sheet); public ArrayList getChildren(); public String getId(); public Rectangle2D.Double getMarginBox(); public int getIndex(); public double getNormalizedHeight(); public Part getParent(); public Sheet getSheet(); public Margin getMargin(); public Padding getPadding(); public void setMargin(Margin margin); public void setPadding(Padding padding); public String getTagName(); public void insertChild(int index, Part part); public boolean isSelected(); public void paintPart(Graphics2D g2d); public boolean removeChild(Part part); public int rzoom(double value); public void setBoundingBox(Rectangle2D.Double bb); public void setIndex(int index); public void setParent(Part part); public void setSelected(boolean b); public void writeElement(Element element); public double zoom(double value); public double getSpaceBefore(); public double getSpaceAfter(); public Rectangle2D.Double getCopyOfContentBox(); } src/java/org/dbdoclet/jive/sheet/Padding.java0000644000175000017500000000254512644165236021304 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.jive.sheet; import org.dbdoclet.unit.Length; public class Padding extends Bound { public Padding() { super(); } public Padding(Length top, Length right, Length bottom, Length left) { super(top, right, bottom, left); } public Padding deepCopy() { Padding copy = new Padding(); copy.setTop(getTop().deepCopy()); copy.setRight(getRight().deepCopy()); copy.setBottom(getBottom().deepCopy()); copy.setLeft(getLeft().deepCopy()); return copy; } @Override public String toString() { return "Padding [top=" + getTop() + ", right=" + getRight() + ", bottom=" + getBottom() + ", left=" + getLeft() + "]"; } } src/java/org/dbdoclet/jive/sheet/Text.java0000644000175000017500000001261412644165236020660 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.jive.sheet; import java.awt.Color; import java.awt.Font; import java.awt.Graphics2D; import java.awt.Point; import java.awt.Rectangle; import java.awt.font.FontRenderContext; import java.util.ArrayList; import org.dbdoclet.format.Alignment; import org.dbdoclet.unit.Length; import org.dbdoclet.unit.LengthUnit; import org.dbdoclet.xiphias.XmlServices; import org.w3c.dom.Element; public class Text extends AbstractPart { private String content; private Color color; private ArrayList lines; private FontRenderContext frc; public Text(Sheet sheet, String content) { this(sheet, content, new Font("Times New Roman", Font.PLAIN, 12), Color.black, Alignment.CENTER); } public Text(Sheet sheet, String content, Font font, Color color, Alignment alignment) { super(sheet); this.content = content; this.font = font; this.color = color; this.alignment = alignment; lines = new ArrayList(); } public Part deepCopy(Sheet sheet) { AbstractPart copy = new Text(sheet, content, font, color, alignment); fillCopy(copy); return copy; } public Color getColor() { return color; } public String getContent() { return content; } public double getNormalizedHeight() { double lineHeight = 0; if (frc == null) { lineHeight = new Length(font.getSize2D(), LengthUnit.POINT) .toMillimeter(); } else { lineHeight = new Length(font.getLineMetrics("M", frc).getHeight(), LengthUnit.POINT).toMillimeter(); } double normalizedHeight = (lineHeight * lines.size()) * 1.023; return margin.getTop().toMillimeter() + padding.getTop().toMillimeter() + normalizedHeight + padding.getBottom().toMillimeter() + margin.getBottom().toMillimeter(); } public void paintPart(Graphics2D g2d) { frc = g2d.getFontRenderContext(); double scaledFontSize = new Length(font.getSize() * sheet.getZoomFactor(), LengthUnit.POINT).toMillimeter(); Font zoomedFont = font.deriveFont(new Double(scaledFontSize) .floatValue()); g2d.setFont(zoomedFont); g2d.setPaint(color); PaperFormat paperFormat = sheet.getPaperFormat(); double printableWidth = paperFormat.getPrintableWidth().toMillimeter(); double zoomedPrintableWidth = zoom(printableWidth); int zoomedFontHeight = computeFontHeight(g2d, zoomedFont); Rectangle bb = sheet.rzoom(getBoundingBox()); int ypos = bb.y + zoomedFontHeight; int xpos = bb.x; int xmax = 0; content = XmlServices.normalizeText(content); Point point = new Point(); for (String line : layoutText(g2d, zoomedFont, zoomedPrintableWidth, 0, content)) { if (alignment == Alignment.RIGHT) { xpos = (bb.x + bb.width) - computeStringWidth(g2d, zoomedFont, line); } else if (alignment == Alignment.LEFT) { xpos = bb.x; } else { xpos = bb.x + (bb.width / 2); xpos = xpos - (computeStringWidth(g2d, zoomedFont, line) / 2); } g2d.drawString(line.trim(), xpos, ypos); point.y = ypos; point.x = xpos + computeStringWidth(g2d, zoomedFont, line.trim()); if (point.x > xmax) { xmax = point.x; } ypos += zoomedFontHeight; bb.x = point.x; } boundingBox.height = getNormalizedHeight(); updateBoxes(); super.afterPaintPart(g2d); } public void setColor(Color color) { this.color = color; } public void setContent(String content) { this.content = content; } @Override public void writeElement(Element element) { super.writeElement(element); element.setTextContent(content); element.setAttribute("font", font.getFamily() + "-" + getFontStyle(font.getStyle()) + "-" + font.getSize()); // element.setAttribute("color", color.toString()); element.setAttribute("alignment", alignment.toString().toLowerCase()); } private String getFontStyle(int style) { switch (style) { case Font.PLAIN: return "plain"; case Font.BOLD: return "bold"; case Font.ITALIC: return "italic"; case Font.BOLD | Font.ITALIC: return "bold+italic"; default: return "plain"; } } private ArrayList layoutText(Graphics2D g2d, Font zoomedFont, double zoomedPrintableWidth, int xpos, String text) { lines = new ArrayList(); int cursor = 0; int lineEnd = 0; for (int i = 0; i < text.length(); i++) { char c = text.charAt(i); if (c == ' ' || c == '\t' || c == '\n' || c == '\r') { String line = text.substring(cursor, i); int lineWidth = computeStringWidth(g2d, zoomedFont, line.trim()); if (xpos + lineWidth > zoomedPrintableWidth) { lines.add(text.substring(cursor, lineEnd).trim()); cursor = lineEnd; xpos = 0; } else { lineEnd = i; } } } if (lines.size() == 0) { lines.add(text); } else { lines.add(text.substring(cursor)); } return lines; } }src/java/org/dbdoclet/jive/sheet/Lines.java0000644000175000017500000000337712644165236021014 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.jive.sheet; import java.util.ArrayList; public class Lines { ArrayList lineList; public Lines() { lineList = new ArrayList(); } public void add(Line line) { if (line != null && lineList.contains(line) == false) { lineList.add(line); } } public Line getFirstLine() { if (lineList != null && lineList.size() > 0) { return lineList.get(0); } return null; } public Line getLine(int index) { if (lineList != null && lineList.size() > index) { return lineList.get(index); } return null; } public ArrayList getList() { return lineList; } public void clear() { lineList.clear(); } public int size() { return lineList.size(); } public Line getLastLine() { if (lineList.size() > 0) { return lineList.get(lineList.size() -1); } return null; } } src/java/org/dbdoclet/jive/sheet/Margin.java0000644000175000017500000000336212644165236021151 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.jive.sheet; import org.dbdoclet.unit.Length; public class Margin extends Bound { public Margin() { super(); } public Margin(Length top, Length right, Length bottom, Length left) { super(top, right, bottom, left); } public Margin deepCopy() { Margin copy = new Margin(); copy.setTop(getTop().deepCopy()); copy.setRight(getRight().deepCopy()); copy.setBottom(getBottom().deepCopy()); copy.setLeft(getLeft().deepCopy()); return copy; } @Override public String toString() { return "Margin [top=" + getTop() + ", right=" + getRight() + ", bottom=" + getBottom() + ", left=" + getLeft() + "]"; } public static Margin valueOf(String buffer) { Margin margin = new Margin(); Length[] list = parse(buffer); for (int i = 0; i < list.length; i++) { switch (i) { case 0: margin.setTop(list[i]); break; case 1: margin.setRight(list[i]); break; case 2: margin.setBottom(list[i]); break; case 3: margin.setLeft(list[i]); break; } } return margin; } } src/java/org/dbdoclet/jive/sheet/PaperFormat.java0000644000175000017500000002546612644165236022165 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.jive.sheet; import java.util.HashMap; import org.dbdoclet.jive.RegionFrame; import org.dbdoclet.unit.Length; import org.dbdoclet.unit.LengthUnit; public class PaperFormat implements Comparable { public enum Orientation { PORTRAIT, LANDSCAPE } public static PaperFormat USER_DEFINED = new PaperFormat("---", new PaperSize(0, 0, LengthUnit.MILLIMETER)); public static PaperFormat A0 = new PaperFormat("A0", PaperSize.A0); public static PaperFormat A1 = new PaperFormat("A1", PaperSize.A1); public static PaperFormat A2 = new PaperFormat("A2", PaperSize.A2); public static PaperFormat A3 = new PaperFormat("A3", PaperSize.A3); public static PaperFormat A4 = new PaperFormat("A4", PaperSize.A4); public static PaperFormat A5 = new PaperFormat("A5", PaperSize.A5); public static PaperFormat A6 = new PaperFormat("A6", PaperSize.A6); public static PaperFormat A7 = new PaperFormat("A7", PaperSize.A7); public static PaperFormat A8 = new PaperFormat("A8", PaperSize.A8); public static PaperFormat A9 = new PaperFormat("A9", PaperSize.A9); public static PaperFormat A10 = new PaperFormat("A10", PaperSize.A10); public static PaperFormat B0 = new PaperFormat("B0", PaperSize.B0); public static PaperFormat B1 = new PaperFormat("B1", PaperSize.B1); public static PaperFormat B2 = new PaperFormat("B2", PaperSize.B2); public static PaperFormat B3 = new PaperFormat("B3", PaperSize.B3); public static PaperFormat B4 = new PaperFormat("B4", PaperSize.B4); public static PaperFormat B5 = new PaperFormat("B5", PaperSize.B5); public static PaperFormat B6 = new PaperFormat("B6", PaperSize.B6); public static PaperFormat B7 = new PaperFormat("B7", PaperSize.B7); public static PaperFormat B8 = new PaperFormat("B8", PaperSize.B8); public static PaperFormat B9 = new PaperFormat("B9", PaperSize.B9); public static PaperFormat B10 = new PaperFormat("B10", PaperSize.B10); public static PaperFormat C0 = new PaperFormat("C0", PaperSize.C0); public static PaperFormat C1 = new PaperFormat("C1", PaperSize.C1); public static PaperFormat C2 = new PaperFormat("C2", PaperSize.C2); public static PaperFormat C3 = new PaperFormat("C3", PaperSize.C3); public static PaperFormat C4 = new PaperFormat("C4", PaperSize.C4); public static PaperFormat C5 = new PaperFormat("C5", PaperSize.C5); public static PaperFormat C6 = new PaperFormat("C6", PaperSize.C6); public static PaperFormat C7 = new PaperFormat("C7", PaperSize.C7); public static PaperFormat C8 = new PaperFormat("C8", PaperSize.C8); public static PaperFormat C9 = new PaperFormat("C9", PaperSize.C9); public static PaperFormat C10 = new PaperFormat("C10", PaperSize.C10); public static PaperFormat Großpartitur1 = new PaperFormat("Großpartitur 1", PaperSize.Großpartitur1); public static PaperFormat Großpartitur2 = new PaperFormat("Großpartitur 2", PaperSize.Großpartitur2); public static PaperFormat Großpartitur3 = new PaperFormat("Großpartitur 3", PaperSize.Großpartitur3); public static PaperFormat Großpartitur4 = new PaperFormat("Großpartitur 4", PaperSize.Großpartitur4); public static PaperFormat Großpartitur5 = new PaperFormat("Großpartitur 5", PaperSize.Großpartitur5); public static PaperFormat Großpartitur6 = new PaperFormat("Großpartitur 6", PaperSize.Großpartitur6); public static PaperFormat Quartformat = new PaperFormat("Quartformat", PaperSize.Quartformat); public static PaperFormat QuartformatUS = new PaperFormat("Quartformat (US)", PaperSize.QuartformatUS); public static PaperFormat OrgelformatBach = new PaperFormat("Orgelformat (Bach)", PaperSize.OrgelformatBach); public static PaperFormat OrgelformatPeters1 = new PaperFormat("Orgelformat (Peters) 1", PaperSize.OrgelformatPeters1); public static PaperFormat OrgelformatPeters2 = new PaperFormat("Orgelformat (Peters) 2", PaperSize.OrgelformatPeters2); public static PaperFormat OrgelformatSteingräber = new PaperFormat("Orgelformat (Steingräber)", PaperSize.OrgelformatSteingräber); public static PaperFormat Bachformat = new PaperFormat("Bachformat", PaperSize.Bachformat); public static PaperFormat Oktavformat = new PaperFormat("Oktavformat", PaperSize.Oktavformat); public static PaperFormat OktavformatUS = new PaperFormat("Oktavformat (US)", PaperSize.OktavformatUS); public static PaperFormat Studienpartitur = new PaperFormat("Studienpartitur", PaperSize.Studienpartitur); public static PaperFormat Salonorchester = new PaperFormat("Salonorchester", PaperSize.Salonorchester); public static PaperFormat Klavierauszug = new PaperFormat("Klavierauszug", PaperSize.Klavierauszug); public static PaperFormat Klavierformat = new PaperFormat("Klavierformat", PaperSize.Klavierformat); public static PaperFormat Großmarsch = new PaperFormat("Großmarsch", PaperSize.Großmarsch); public static PaperFormat Marschformat = new PaperFormat("Marschformat", PaperSize.Marschformat); public static PaperFormat PaperFormatUSLetter = new PaperFormat("US Letter", PaperSize.USLetter); public static PaperFormat PaperFormatUSLegal = new PaperFormat("US Legal", PaperSize.USLegal); public static PaperFormat PaperFormatUSExecutive = new PaperFormat("US Executive", PaperSize.USExecutive); public static final PaperFormat[] FORMATS = { USER_DEFINED, A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, B0, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, Großpartitur1, Großpartitur2, Großpartitur3, Großpartitur4, Großpartitur5, Großpartitur6, Quartformat, QuartformatUS, OrgelformatBach, OrgelformatPeters1, OrgelformatPeters2, OrgelformatSteingräber, Bachformat, Oktavformat, OktavformatUS, Studienpartitur, Salonorchester, Klavierauszug, Klavierformat, Großmarsch, Marschformat, PaperFormatUSLetter, PaperFormatUSLegal, PaperFormatUSExecutive }; public static final HashMap SIZE_MAP = new HashMap(); static { for (PaperFormat pf : FORMATS) { SIZE_MAP.put(pf.getSize(), pf); } } private PaperSize size; private String name; private RegionFrame margins = new RegionFrame(10, 15, 10, 15); private RegionFrame regions = new RegionFrame(10, 0, 10, 0); private Orientation orientation = Orientation.PORTRAIT; public static PaperFormat valueOf(PaperSize size) { if (size == null) { return null; } PaperSize ps = size.deepCopy(); PaperFormat pf = SIZE_MAP.get(ps); if (pf == null) { ps.swap(); pf = SIZE_MAP.get(ps); } if (pf != null) { return new PaperFormat(pf); } return new PaperFormat("", size); } public PaperFormat(String name, PaperSize size) { if (size == null) { throw new IllegalArgumentException("The argument size must not be null!"); } this.name = name; this.size = size; } public PaperFormat(PaperFormat template) { this.name = template.getName(); this.size = template.getSize(); this.margins = template.getMargins(); this.regions = template.getRegions(); this.orientation = template.getOrientation(); } public int compareTo(PaperFormat other) { return name.compareTo(other.getName()); } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } PaperFormat other = (PaperFormat) obj; if (name == null && other.name != null) { return false; } if (name.equals(other.name) == false) { return false; } return true; } public Length getHeight() { return size.getHeight(); } public String getHeightAsText() { return size.getHeightAsText(); } public RegionFrame getMargins() { if (margins == null) { margins = new RegionFrame(0, 0, 0, 0); } return margins.deepCopy(); } public String getName() { return name; } public Orientation getOrientation() { return orientation; } public RegionFrame getRegions() { return regions.deepCopy(); } public PaperSize getSize() { return size.deepCopy(); } public Length getWidth() { return size.getWidth(); } public String getWidthAsText() { return size.getWidthAsText(); } @Override public int hashCode() { return name.hashCode(); } public boolean isUserDefined() { PaperFormat paperFormat = SIZE_MAP.get(this.getSize()); if (paperFormat == null) { return true; } else { return false; } } public void setMargins(RegionFrame margins) { this.margins = margins; } public void setName(String name) { this.name = name; } public void setOrientation(Orientation orientation) { this.orientation = orientation; } public void setRegions(RegionFrame regions) { this.regions = regions; } public void setSize(PaperSize size) { this.size = size; } @Override public String toString() { if (this == USER_DEFINED) { return getName(); } return String.format("%s (%s)", getName(), size.toString()); } public PaperFormat deepCopy() { PaperFormat copy = new PaperFormat(this); return copy; } public Length getPrintableWidth() { return size.getWidth().minus( margins.getLeft().plus(margins.getRight()).plus(regions.getLeft()).plus(regions.getRight())); } public Length getPrintableHeight() { return size.getHeight().minus( margins.getTop().plus(margins.getBottom()).plus(regions.getTop()).plus(regions.getBottom())); } } src/java/org/dbdoclet/jive/sheet/Line.java0000644000175000017500000000340412644165236020620 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.jive.sheet; import java.awt.geom.Point2D; public class Line { private final Point2D.Double p1; private final Point2D.Double p2; public Line(Point2D.Double p1, Point2D.Double p2) { if (p1 == null) { throw new IllegalArgumentException("The argument p1 must not be null!"); } if (p2 == null) { throw new IllegalArgumentException("The argument p2 must not be null!"); } this.p1 = p1; this.p2 = p2; } public Point2D.Double getP1() { return p1; } public Point2D.Double getP2() { return p2; } public double getWidth() { return p2.x - p1.x; } public double getX1() { return p1.x; } public double getX2() { return p2.x; } public double getY1() { return p1.y; } public double getY2() { return p2.y; } public void setY1(double y) { p1.y = y; } public void setY2(double y) { p2.y = y; } } src/java/org/dbdoclet/jive/sheet/PaperSize.java0000644000175000017500000002031012644165236021626 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.jive.sheet; import org.dbdoclet.unit.Length; import org.dbdoclet.unit.LengthUnit; public class PaperSize { public static PaperSize A0 = new PaperSize(841, 1189, LengthUnit.MILLIMETER); public static PaperSize A1 = new PaperSize(594, 841, LengthUnit.MILLIMETER); public static PaperSize A2 = new PaperSize(420, 594, LengthUnit.MILLIMETER); public static PaperSize A3 = new PaperSize(297, 420, LengthUnit.MILLIMETER); public static PaperSize A4 = new PaperSize(210, 297, LengthUnit.MILLIMETER); public static PaperSize A5 = new PaperSize(148, 210, LengthUnit.MILLIMETER); public static PaperSize A6 = new PaperSize(105, 148, LengthUnit.MILLIMETER); public static PaperSize A7 = new PaperSize(74, 105, LengthUnit.MILLIMETER); public static PaperSize A8 = new PaperSize(52, 74, LengthUnit.MILLIMETER); public static PaperSize A9 = new PaperSize(37, 52, LengthUnit.MILLIMETER); public static PaperSize A10 = new PaperSize(26, 37, LengthUnit.MILLIMETER); public static PaperSize B0 = new PaperSize(1000, 1414, LengthUnit.MILLIMETER); public static PaperSize B1 = new PaperSize(707, 1000, LengthUnit.MILLIMETER); public static PaperSize B2 = new PaperSize(500, 707, LengthUnit.MILLIMETER); public static PaperSize B3 = new PaperSize(353, 500, LengthUnit.MILLIMETER); public static PaperSize B4 = new PaperSize(250, 353, LengthUnit.MILLIMETER); public static PaperSize B5 = new PaperSize(176, 250, LengthUnit.MILLIMETER); public static PaperSize B6 = new PaperSize(125, 176, LengthUnit.MILLIMETER); public static PaperSize B7 = new PaperSize(88, 125, LengthUnit.MILLIMETER); public static PaperSize B8 = new PaperSize(62, 88, LengthUnit.MILLIMETER); public static PaperSize B9 = new PaperSize(44, 62, LengthUnit.MILLIMETER); public static PaperSize B10 = new PaperSize(31, 44, LengthUnit.MILLIMETER); public static PaperSize C0 = new PaperSize(917, 1297, LengthUnit.MILLIMETER); public static PaperSize C1 = new PaperSize(648, 917, LengthUnit.MILLIMETER); public static PaperSize C2 = new PaperSize(458, 648, LengthUnit.MILLIMETER); public static PaperSize C3 = new PaperSize(324, 458, LengthUnit.MILLIMETER); public static PaperSize C4 = new PaperSize(229, 324, LengthUnit.MILLIMETER); public static PaperSize C5 = new PaperSize(162, 229, LengthUnit.MILLIMETER); public static PaperSize C6 = new PaperSize(114, 162, LengthUnit.MILLIMETER); public static PaperSize C7 = new PaperSize(81, 114, LengthUnit.MILLIMETER); public static PaperSize C8 = new PaperSize(57, 81, LengthUnit.MILLIMETER); public static PaperSize C9 = new PaperSize(40, 57, LengthUnit.MILLIMETER); public static PaperSize C10 = new PaperSize(28, 40, LengthUnit.MILLIMETER); public static PaperSize Großpartitur1 = new PaperSize(420, 680, LengthUnit.MILLIMETER); public static PaperSize Großpartitur2 = new PaperSize(300, 420, LengthUnit.MILLIMETER); public static PaperSize Großpartitur3 = new PaperSize(300, 400, LengthUnit.MILLIMETER); public static PaperSize Großpartitur4 = new PaperSize(285, 400, LengthUnit.MILLIMETER); public static PaperSize Großpartitur5 = new PaperSize(300, 390, LengthUnit.MILLIMETER); public static PaperSize Großpartitur6 = new PaperSize(290, 350, LengthUnit.MILLIMETER); public static PaperSize Quartformat = new PaperSize(270, 340, LengthUnit.MILLIMETER); public static PaperSize QuartformatUS = new PaperSize(215, 275, LengthUnit.MILLIMETER); public static PaperSize OrgelformatBach = new PaperSize(330, 260, LengthUnit.MILLIMETER); public static PaperSize OrgelformatPeters1 = new PaperSize(300, 230, LengthUnit.MILLIMETER); public static PaperSize OrgelformatPeters2 = new PaperSize(305, 220, LengthUnit.MILLIMETER); public static PaperSize OrgelformatSteingräber = new PaperSize(265, 220, LengthUnit.MILLIMETER); public static PaperSize Bachformat = new PaperSize(240, 325, LengthUnit.MILLIMETER); public static PaperSize Oktavformat = new PaperSize(170, 270, LengthUnit.MILLIMETER); public static PaperSize OktavformatUS = new PaperSize(171, 267, LengthUnit.MILLIMETER); public static PaperSize Studienpartitur = new PaperSize(170, 240, LengthUnit.MILLIMETER); public static PaperSize Salonorchester = new PaperSize(190, 290, LengthUnit.MILLIMETER); public static PaperSize Klavierauszug = new PaperSize(190, 270, LengthUnit.MILLIMETER); public static PaperSize Klavierformat = new PaperSize(235, 310, LengthUnit.MILLIMETER); public static PaperSize Großmarsch = new PaperSize(135, 190, LengthUnit.MILLIMETER); public static PaperSize Marschformat = new PaperSize(135, 170, LengthUnit.MILLIMETER); public static PaperSize USLetter = new PaperSize(8.5f, 11.0f, LengthUnit.INCH); public static PaperSize USLegal = new PaperSize(8.5f, 14.0f, LengthUnit.INCH); public static PaperSize USExecutive = new PaperSize(7.2f, 10.5f, LengthUnit.INCH); private Length width; private Length height; public PaperSize(double widthLength, double heightLength, LengthUnit unit) { this.width = new Length(widthLength, unit); this.height = new Length(heightLength, unit); } public PaperSize(Length width, Length height) { this.width = width; this.height = height; } public PaperSize deepCopy() { PaperSize copy = new PaperSize(width, height); return copy; } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } PaperSize other = (PaperSize) obj; if (height == null && other.height != null) { return false; } if (height.equals(other.height) == false) { return false; } if (width == null && other.width != null) { return false; } if (width.equals(other.width) == false) { return false; } return true; } public Length getHeight() { return height; } public String getHeightAsText() { return String.format("%.2f %s", height.getLength(), height.getUnit().getAbbreviation()); } public Length getWidth() { return width; } public String getWidthAsText() { return String.format("%.2f %s", width.getLength(), width.getUnit().getAbbreviation()); } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((height == null) ? 0 : height.hashCode()); result = prime * result + ((width == null) ? 0 : width.hashCode()); return result; } public void setHeight(Length height) { this.height = height; } public void setWidth(Length width) { this.width = width; } public void swap() { Length tmp = width; width = height; height = tmp; } @Override public String toString() { String unitAbbrev = width.getUnit().getAbbreviation(); if (width.getUnit().equals(height.getUnit()) == false) { unitAbbrev = String.format("%s×%s", width.getUnit().getAbbreviation(), height.getUnit().getAbbreviation()); } return String.format("%.2f×%.2f%s", width.getLength(), height.getLength(), unitAbbrev); } } src/java/org/dbdoclet/jive/sheet/SheetModel.java0000644000175000017500000001075512644165236021771 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.jive.sheet; import java.util.ArrayList; public class SheetModel { // private static Log logger = LogFactory.getLog(SheetModel.class); private DocumentPart documentPart; private String header = ""; private String footer = ""; private int pageNumber = 1; public SheetModel(Sheet sheet) { documentPart = new DocumentPart(sheet); } public void addPart(Part part) { if (part == null) { return; } documentPart.appendChild(part); } public void clear() { documentPart.removeAll(); } public SheetModel deepCopy(Sheet copySheet) { SheetModel copy = new SheetModel(copySheet); copy.setDocumentPart((DocumentPart) documentPart.deepCopy(copySheet)); copy.setHeader(new String(header)); copy.setFooter(new String(footer)); copy.setPageNumber(pageNumber); return copy; } public DocumentPart getDocumentPart() { return documentPart; } public String getFooter() { return footer; } public String getHeader() { return header; } public int getPageNumber() { return pageNumber; } public Part getPart(int index) { ArrayList partList = documentPart.getChildren(); if (partList == null || index < 0 || index >= partList.size()) { return null; } Part part = partList.get(index); return part; } public ArrayList getPartList() { ArrayList partList = documentPart.getChildren(); return partList; } public ArrayList getTextList() { return getTextList(documentPart); } public ArrayList getTextList(Part part) { ArrayList textList = new ArrayList(); if (part instanceof Text) { textList.add((Text) part); } for (Part child : part.getChildren()) { textList.addAll(getTextList(child)); } return textList; } public void insertPart(Part newPart, int index) { documentPart.insertChild(index, newPart); } public void insertPartBefore(Part part, Part referencePart) { int index = 0; boolean found = false; for (Part p : getPartList()) { if (p == referencePart) { found = true; break; } index++; } if (found == true) { documentPart.insertChild(index, part); } } public Part removePart(int index) { ArrayList partList = documentPart.getChildren(); if (partList == null || index < 0 || index >= partList.size()) { return null; } return documentPart.removeChild(index); } public void removePart(Part part) { removePart(part, true); } public void removePart(Part part, boolean undoable) { documentPart.removeChild(part); } public void removePartById(String id) { Part foundPart = null; for (Part part : getPartList()) { if (part.getId() != null) { if (part != null && part.getId().equals(id)) { foundPart = part; break; } } } if (foundPart != null) { documentPart.removeChild(foundPart); } } public void setDocumentPart(DocumentPart documentPart) { this.documentPart = documentPart; } public void setFooter(String footer) { this.footer = footer; } public void setHeader(String header) { this.header = header; } public void setPageNumber(int pageNumber) { this.pageNumber = pageNumber; } } src/java/org/dbdoclet/jive/sheet/Sheet.java0000644000175000017500000006335012644165236021007 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.jive.sheet; import java.awt.AlphaComposite; import java.awt.BasicStroke; import java.awt.Color; import java.awt.Composite; import java.awt.Container; import java.awt.Dimension; import java.awt.Font; import java.awt.FontMetrics; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Point; import java.awt.Rectangle; import java.awt.RenderingHints; import java.awt.Stroke; import java.awt.event.MouseListener; import java.awt.geom.Rectangle2D; import java.util.ArrayList; import java.util.ResourceBundle; import javax.swing.JPanel; import javax.swing.SwingConstants; import org.dbdoclet.format.Alignment; import org.dbdoclet.jive.JiveConstants; import org.dbdoclet.jive.RegionFrame; import org.dbdoclet.unit.LengthUnit; import org.w3c.dom.Element; /** * Ein virtuelles, beschreibares Blatt, bestehend aus Schreibtischunterlage, * Rand, Seitenregionen und Textkörper. * * @author michael * */ public class Sheet extends JPanel { private static final long serialVersionUID = 1L; private int alignment; private boolean autoZoom = false; private Color backgroundColor = Color.lightGray; private BasicStroke basicStroke = new BasicStroke(1.0f); private BasicStroke boldStroke = new BasicStroke(2.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL); private BasicStroke dashedStroke = new BasicStroke(1.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 10.0f, new float[] { 5.0f, 5.0f }, 5.0f); private boolean desktopEnabled = true; private int desktopHeight = 320; private float desktopMargin = 10.0f; private int desktopWidth = 320; private RegionFrame displayMargins; private RegionFrame displayRegions; private boolean endlessPaperMode = false; private boolean fitToDesktopSize = false; private Color paperColor = Color.white; private double paperDisplayHeight; private double paperDisplayWidth; private PaperFormat paperFormat = PaperFormat.A4; private Rectangle selectionRectangle; private Color shadowColor = Color.darkGray; private boolean shadowEnabled = true; private int shadowLeftOffset = 1; private int shadowTopOffset = 1; private Font textFont; private boolean visibleMargins = false; private boolean visibleSpaceEnabled = false; private double zoomFactor = 1.0f; // private float yPosOfNextPart = 0.0f; protected SheetContainer container; protected SheetModel model; protected ResourceBundle res; public Sheet(SheetContainer container, ResourceBundle res) { this.container = container; this.res = res; setPaperFormat(new PaperFormat(PaperFormat.A4)); textFont = new Font("Serif", Font.PLAIN, 12); model = new SheetModel(this); setFocusable(true); } public boolean contains(Part part) { Rectangle boundingBox = rzoom(part.getMarginBox()); if (boundingBox.getMaxY() > zoom(getBodyBottom())) { // System.out.println("part.MaxY: " + boundingBox.getMaxY() + // ", bodyBottom: " + zoom(getBodyBottom())); return false; } return true; } public Sheet deepCopy() { Sheet copy = new Sheet(container, res); deepCopy(copy); return copy; } public void drawSelectionRectangle(Rectangle newSelectionRectangle) { Rectangle refreshRectangle; if (newSelectionRectangle == null) { refreshRectangle = selectionRectangle; } else { refreshRectangle = (Rectangle) newSelectionRectangle.clone(); if (selectionRectangle != null) { if (selectionRectangle.x < refreshRectangle.x) { refreshRectangle.x = selectionRectangle.x; } if (selectionRectangle.y < refreshRectangle.y) { refreshRectangle.y = selectionRectangle.y; } if (selectionRectangle.width > refreshRectangle.width) { refreshRectangle.width = selectionRectangle.width; } if (selectionRectangle.height > refreshRectangle.height) { refreshRectangle.height = selectionRectangle.height; } } if (newSelectionRectangle.width < 0) { newSelectionRectangle.width *= -1; newSelectionRectangle.x -= newSelectionRectangle.width; } if (newSelectionRectangle.height < 0) { newSelectionRectangle.height *= -1; newSelectionRectangle.y -= newSelectionRectangle.height; } } this.selectionRectangle = newSelectionRectangle; if (refreshRectangle != null) { refreshRectangle.x -= 3; refreshRectangle.y -= 3; refreshRectangle.width += 6; refreshRectangle.height += 6; repaint(refreshRectangle); } } public boolean endOfSheet(Part nextPart) { int cursorPos = 0; for (Part part : model.getPartList()) { cursorPos += part.getSpaceBefore() + part.getNormalizedHeight() + part.getSpaceAfter(); } if ((cursorPos + (nextPart.getNormalizedHeight() - nextPart .getSpaceAfter())) > paperFormat.getPrintableHeight() .toMillimeter()) { return true; } return false; } public void erase() { model.getPartList().clear(); } public void fillElement(Element element) { element.setAttribute("paper-width", paperFormat.getSize().getWidth() .toNormalizedString()); element.setAttribute("paper-height", paperFormat.getSize().getHeight() .toNormalizedString()); element.setAttribute("paper-format", paperFormat.getName()); element.setAttribute("orientation", paperFormat.getOrientation() .toString().toLowerCase()); element.setAttribute("margin-top", paperFormat.getMargins().getTop() .toNormalizedString()); element.setAttribute("margin-bottom", paperFormat.getMargins() .getBottom().toNormalizedString()); element.setAttribute("margin-left", paperFormat.getMargins().getLeft() .toNormalizedString()); element.setAttribute("margin-right", paperFormat.getMargins() .getRight().toNormalizedString()); element.setAttribute("region-top", paperFormat.getRegions().getTop() .toNormalizedString()); element.setAttribute("region-bottom", paperFormat.getRegions() .getBottom().toNormalizedString()); element.setAttribute("region-left", paperFormat.getRegions().getLeft() .toNormalizedString()); element.setAttribute("region-right", paperFormat.getRegions() .getRight().toNormalizedString()); } public Part findPart(Point point) { for (Part part : model.getPartList()) { Rectangle bb = rzoom(part.getMarginBox()); if (bb.contains(point)) { return part; } } return null; } public Text findText(Point point) { for (Text part : model.getTextList()) { Rectangle bb = rzoom(part.getMarginBox()); if (bb.contains(point)) { return part; } } return null; } public Text findTextById(String id) { if (id == null) { return null; } for (Part part : model.getPartList()) { String otherId = part.getId(); if (otherId != null && id.equalsIgnoreCase(part.getId()) && part instanceof Text) { return (Text) part; } for (Part child : part.getChildren()) { otherId = child.getId(); if (otherId != null && id.equalsIgnoreCase(child.getId()) && child instanceof Text) { return (Text) child; } } } return null; } public String findTextContentById(String id) { Text text = findTextById(id); if (text != null) { return text.getContent(); } return null; } public Color getBackgroundColor() { return backgroundColor; } public double getBodyBottom() { return getDesktopTop() + paperDisplayHeight - displayMargins.getBottom().toMillimeter() - displayRegions.getBottom().toMillimeter(); } /** * Liefert die Position des linken Randes des Textkörpers in Milimeter. Der * Wert muß noch an die jeweilige Auflösung angepaßt werden. * * @return double */ public double getBodyLeft() { return getDesktopLeft() + displayMargins.getLeft().toMillimeter() + displayRegions.getLeft().toMillimeter(); } /** * Liefert die Position des rechten Randes des Textkörpers in Milimeter. * * @return double */ public double getBodyRight() { return getDesktopLeft() + paperDisplayWidth - displayMargins.getRight().toMillimeter() - displayRegions.getRight().toMillimeter(); } public double getBodyTop() { return getDesktopTop() + displayMargins.getTop().toMillimeter() + displayRegions.getTop().toMillimeter(); } public Stroke getBoldStroke() { return boldStroke; } public BasicStroke getDashedStroke() { return dashedStroke; } public int getDesktopHeight() { return desktopHeight; } public int getDesktopWidth() { return desktopWidth; } public Part getDocumentPart() { return model.getDocumentPart(); } @Override public int getHeight() { if (desktopEnabled == false) { return rzoom(paperDisplayHeight); } return rzoom(desktopHeight); } public String getId() { return String.valueOf(hashCode()); } public RegionFrame getMargins() { return paperFormat.getMargins(); } public SheetModel getModel() { return model; } public Color getPaperColor() { return paperColor; } public PaperFormat getPaperFormat() { PaperFormat copy = PaperFormat.valueOf(paperFormat.getSize()); copy.setMargins(paperFormat.getMargins()); copy.setRegions(paperFormat.getRegions()); copy.setOrientation(paperFormat.getOrientation()); return copy; } @Override public Dimension getPreferredSize() { if (autoZoom == true) { Container container = getParent(); int parentWidth = container.getWidth(); double ratio = parentWidth / (getDesktopLeft() + paperDisplayWidth + getDesktopRight()); if (ratio > 1.0 && Math.abs(zoomFactor - ratio) > 0.1) { zoomFactor = ratio; } } Dimension dim = new Dimension(getWidth(), getHeight()); // System.out.println("PreferredSize: " + dim + ", parentWidth = " + // parentWidth + ", ratio = " + ratio); return dim; } public ResourceBundle getResourceBundle() { return res; } public ArrayList getSelectedPartList() { ArrayList selectedPartList = new ArrayList(); for (Part part : model.getPartList()) { selectedPartList.addAll(getSelectedPartList(part)); } return selectedPartList; } public ArrayList getSelectedPartList(Part part) { ArrayList selectedPartList = new ArrayList(); if (part.isSelected()) { selectedPartList.add(part); } for (Part child : part.getChildren()) { selectedPartList.addAll(getSelectedPartList(child)); } return selectedPartList; } public Font getTextFont() { return textFont; } @Override public int getWidth() { if (desktopEnabled == false) { return rzoom(paperDisplayWidth); } return rzoom(desktopWidth); } public double getZoomFactor() { return zoomFactor; } public void insertPart(Part text, int index) { model.insertPart(text, index); } public boolean isAutoZoom() { return autoZoom; } public boolean isEndlessPaperMode() { return endlessPaperMode; } public boolean isFitToDesktopSize() { return fitToDesktopSize; } public boolean isVisibleSpaceEnabled() { return visibleSpaceEnabled; } /** * Zeichnen des aktuellen Blatts. */ @Override public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2d = (Graphics2D) g; g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_ENABLE); g2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); if (desktopEnabled == true) { g2d.setPaint(backgroundColor); g2d.fillRect(0, 0, getWidth(), getHeight()); } if (shadowEnabled == true) { g2d.setPaint(shadowColor); g2d.fillRect(rzoom(getDesktopLeft() + getShadowLeftOffset()), rzoom(getDesktopTop() + getShadowTopOffset()), rzoom(getPaperDisplayWidth()), rzoom(getPaperDisplayHeight())); } g2d.setPaint(paperColor); g2d.fillRect(rzoom(getDesktopLeft()), rzoom(getDesktopTop()), rzoom(getPaperDisplayWidth()), rzoom(getPaperDisplayHeight())); if (visibleMargins == true) { g2d.setStroke(dashedStroke); g2d.setPaint(Color.darkGray); g2d.drawRect(rzoom(getDesktopLeft() + displayMargins.getLeft().toMillimeter()), rzoom(getDesktopTop() + displayMargins.getTop().toMillimeter()), rzoom(getPaperDisplayWidth() - displayMargins.getRight().toMillimeter() - displayMargins.getLeft().toMillimeter()), rzoom(getPaperDisplayHeight() - displayMargins.getBottom().toMillimeter() - displayMargins.getTop().toMillimeter())); g2d.setPaint(Color.green); g2d.drawRect(rzoom(getDesktopLeft() + displayMargins.getLeft().toMillimeter()), rzoom(getDesktopTop() + displayMargins.getTop().toMillimeter()), rzoom(getPaperDisplayWidth() - displayMargins.getRight().toMillimeter() - displayMargins.getLeft().toMillimeter()), rzoom(displayRegions.getTop().toMillimeter())); } DocumentPart documentPart = model.getDocumentPart(); documentPart.setBoundingBox(new Rectangle2D.Double(getBodyLeft(), getBodyTop(), getBodyRight() - getBodyLeft(), getBodyBottom() - getBodyTop())); documentPart.paintPart(g2d); paintHeader(g2d); paintPageNumber(g2d); paintSelectionRectangle(g2d); if (hasFocus() == true) { g2d.setPaint(Color.black); g2d.setStroke(boldStroke); g2d.drawRect(0, 0, getWidth(), getHeight()); } int lastYPos = +(int) Math.round(documentPart.getCursor().getTop() + (2 * desktopMargin) + paperFormat.getMargins().getBottom().toMillimeter() + paperFormat.getRegions().getBottom().toMillimeter()); if (endlessPaperMode == true && this.desktopHeight != lastYPos && lastYPos > paperFormat.getHeight().toMillimeter()) { setDesktopSize(desktopWidth, lastYPos); } } public void paintSelectionMarker(Graphics2D g2d, Part part) { Color selectionColor = new Color(0, 80, 0); g2d.setPaint(selectionColor); g2d.setStroke(boldStroke); Rectangle bb = rzoom(part.getMarginBox()); int length = 5; int lineWidth = Math.round(boldStroke.getLineWidth() - 1); // g2d.fillRect(bb.x, bb.y, bb.width, bb.height); // g2d.drawRect(bb.x, bb.y, bb.width, bb.height); g2d.drawLine(bb.x, bb.y, bb.x, bb.y + rzoom(length)); g2d.drawLine(bb.x - lineWidth, bb.y, bb.x + rzoom(length), bb.y); g2d.drawLine(bb.x + bb.width - rzoom(length), bb.y + bb.height, bb.x + bb.width, bb.y + bb.height); g2d.drawLine(bb.x + bb.width, bb.y + bb.height + lineWidth, bb.x + bb.width, bb.y + bb.height - rzoom(length)); } public void readSheet(Element element) { // } public int rzoom(double value) { return (int) Math.round(zoomFactor * value); } public Rectangle rzoom(Rectangle2D.Double rect2D) { return rzoom(rect2D, 1.0); } public Rectangle rzoom(Rectangle2D.Double rect2D, double factor) { Rectangle rect = new Rectangle(); if (factor != 1.0) { double owidth = rect2D.width; double oheight = rect2D.height; double nwidth = rect2D.width * factor; double nheight = rect2D.height * factor; double xdiff = (nwidth - owidth) / 2; double ydiff = (nheight - oheight) / 2; rect.x = rzoom(rect2D.x - xdiff); rect.y = rzoom(rect2D.y - ydiff); rect.width = rzoom(nwidth); rect.height = rzoom(nheight); } else { rect.x = rzoom(rect2D.x); rect.y = rzoom(rect2D.y); rect.width = rzoom(rect2D.width); rect.height = rzoom(rect2D.height); } return rect; } public void setAlign(int alignment) { this.alignment = alignment; } public void setAutoZoom(boolean autoZoom) { this.autoZoom = autoZoom; } public void setBackgroundColor(Color backgroundColor) { this.backgroundColor = backgroundColor; } public void setDesktopEnabled(boolean desktopEnabled) { this.desktopEnabled = desktopEnabled; } public void setDesktopMargin(float desktopMargin) { this.desktopMargin = desktopMargin; } public void setDesktopSize(int desktopWidth, int desktopHeight) { if (desktopWidth < 0) { throw new IllegalArgumentException("Invalid desktop width of " + desktopWidth + "!"); } if (desktopHeight < 0) { throw new IllegalArgumentException("Invalid desktop height of " + desktopHeight + "!"); } this.desktopHeight = desktopHeight; this.desktopWidth = desktopWidth; updateView(); } public void setEndlessPaperMode(boolean endlessPaperMode) { this.endlessPaperMode = endlessPaperMode; } public void setFitToDesktopSize(boolean fitToDesktopSize) { this.fitToDesktopSize = fitToDesktopSize; if (fitToDesktopSize == true) { fitToDesktopSize(); } } public void setMargins(RegionFrame margins) { paperFormat.setMargins(margins); updateView(); } public void setModel(SheetModel model) { this.model = model; } public void setPaperColor(Color paperColor) { this.paperColor = paperColor; } public void setPaperFormat(PaperFormat paperFormat) { this.paperFormat = paperFormat; updateView(); } public void setPaperSize(PaperSize paperSize) { paperFormat.setSize(paperSize); updateView(); } public void setScalePaperToPoint(double imageableWidth, double imageableHeight) { double ratio1 = imageableWidth / paperFormat.getPrintableWidth().toMillimeter(); double ratio2 = imageableHeight / paperFormat.getPrintableHeight().toMillimeter(); double ratio = ratio1 > ratio2 ? ratio2 : ratio1; setZoomFactor((float) ratio); setPaperSize(new PaperSize(pointToMm(imageableWidth), pointToMm(imageableHeight), LengthUnit.MILLIMETER)); recalculate(); } public void setSelection(Point point, boolean isShiftDown, boolean isControlDown) { drawSelectionRectangle(null); for (Part part : model.getPartList()) { setSelection(point, part, isShiftDown, isControlDown); } } public boolean setSelection(Point point, Part part, boolean isShiftDown, boolean isControlDown) { if (point == null) { part.setSelected(false); } else { for (Part child : part.getChildren()) { if (setSelection(point, child, isShiftDown, isControlDown)) { return true; } } if (rzoom(part.getMarginBox()).contains(point)) { if (part.isSelected() == false) { part.setSelected(true); repaint(rzoom(part.getMarginBox())); return true; } } else { if (part.isSelected() && isControlDown == false) { part.setSelected(false); repaint(rzoom(part.getMarginBox())); } } } return false; } public void setSelection(Rectangle rect) { drawSelectionRectangle(null); for (Part part : model.getPartList()) { setSelection(rect, part); } } public void setSelection(Rectangle rect, Part part) { if (rect == null) { part.setSelected(false); } else { if (rect.contains(rzoom(part.getMarginBox()))) { if (part.isSelected() == false) { part.setSelected(true); repaint(rzoom(part.getMarginBox(), 2.0)); } } else { if (part.isSelected()) { part.setSelected(false); repaint(rzoom(part.getMarginBox(), 2.0)); } } for (Part child : part.getChildren()) { setSelection(rect, child); } } } public void setShadowEnabled(boolean shadowEnabled) { this.shadowEnabled = shadowEnabled; } public void setVisibleMargins(boolean visibleMargins) { this.visibleMargins = visibleMargins; } public void setVisibleSpaceEnabled(boolean visibleSpaceEnabled) { this.visibleSpaceEnabled = visibleSpaceEnabled; } public void setZoomFactor(double zoomFactor) { this.zoomFactor = zoomFactor; } @Override public String toString() { return "Sheet(" + hashCode() + ") zoomFactor=" + getZoomFactor(); } public int unzoom(double value) { return (int) Math.round(value / zoomFactor); } public void updateView() { recalculate(); validateAndRepaint(); } public void validateAndRepaint() { validate(); repaint(); } public double zoom(double value) { return zoomFactor * value; } private void fitToDesktopSize() { double paperWidth = paperFormat.getWidth().toMillimeter(); double paperHeight = paperFormat.getHeight().toMillimeter(); if (endlessPaperMode == true) { paperHeight = getDesktopHeight(); } double widthRatio = (desktopWidth - (2 * desktopMargin)) / paperWidth; double heightRatio = (desktopHeight - (2 * desktopMargin)) / paperHeight; double ratio = widthRatio; if (heightRatio < widthRatio) { ratio = heightRatio; } paperDisplayWidth = Math.round(ratio * paperWidth); paperDisplayHeight = Math.round(ratio * paperHeight); displayMargins.scale(ratio); displayRegions.scale(ratio); } private double getDesktopLeft() { if (desktopEnabled == false) { return 0.0f; } return (desktopWidth - paperDisplayWidth) / 2; } private double getDesktopRight() { if (desktopEnabled == false) { return 0.0f; } return (desktopWidth - paperDisplayWidth) / 2; } private double getDesktopTop() { if (desktopEnabled == false) { return 0.0f; } double topX = (desktopHeight - paperDisplayHeight) / 2; if (alignment == SwingConstants.TOP) { if (topX > desktopMargin) { topX = desktopMargin; } } // System.out.println("desktopTop=" + topX + ", desktopHeight=" + // desktopHeight + ", paperDisplayHeight=" // + paperDisplayHeight); return topX; } private double getPaperDisplayHeight() { return paperDisplayHeight; } private double getPaperDisplayWidth() { return paperDisplayWidth; } private int getShadowLeftOffset() { return shadowLeftOffset; } private int getShadowTopOffset() { return shadowTopOffset; } private void paintHeader(Graphics2D g2d) { String header = String.valueOf(model.getHeader()); if (header == null || header.trim().length() == 0) { return; } Font regionFont = textFont.deriveFont(12.0f); FontMetrics fm = g2d.getFontMetrics(regionFont); g2d.setFont(regionFont); g2d.setPaint(Color.black); double printableWidth = paperFormat.getPrintableWidth().toMillimeter(); long center = Math.round(paperFormat.getMargins().getLeft() .toMillimeter() + (printableWidth / 2)); long ypos = Math.round(getDesktopTop() + displayMargins.getTop().toMillimeter() + displayRegions.getTop().toMillimeter()); // Vertikal mittige Ausrichtung int yMiddle = rzoom(displayRegions.getTop().toMillimeter()) - fm.getHeight() / 2; g2d.drawString(header, rzoom(center) - (fm.stringWidth(header) / 2), rzoom(ypos) - yMiddle); } /** * @param g2d * @param fm */ private void paintPageNumber(Graphics2D g2d) { Font regionFont = textFont.deriveFont(8.0f); FontMetrics fm = g2d.getFontMetrics(regionFont); g2d.setFont(regionFont); g2d.setPaint(Color.black); String pageNumberText = String.valueOf(model.getPageNumber()); g2d.drawString(pageNumberText, rzoom(getDesktopLeft() + getPaperDisplayWidth() - displayMargins.getRight().toMillimeter()) - fm.stringWidth(pageNumberText), rzoom(getPaperDisplayHeight() - displayMargins.getBottom().toMillimeter())); } /** * Zeichnet das Rechteck, das während des Ziehens mit der Maus die aktuell * markierte Fläche zeigt. * * @param g2d */ private void paintSelectionRectangle(Graphics2D g2d) { if (selectionRectangle != null) { g2d.setPaint(JiveConstants.COLOUR_SAND); Composite originalComposite = g2d.getComposite(); g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.33f)); //g2d.setComposite(AlphaComposite.SrcOver.derive(0.33f)); g2d.fillRect(selectionRectangle.x, selectionRectangle.y, selectionRectangle.width, selectionRectangle.height); g2d.setComposite(originalComposite); g2d.setStroke(basicStroke); g2d.drawRect(selectionRectangle.x, selectionRectangle.y, selectionRectangle.width, selectionRectangle.height); } } private float pointToMm(double imageableWidth) { return (float) (imageableWidth / 72) * 25.4f; } private void recalculate() { paperDisplayWidth = paperFormat.getWidth().toMillimeter(); paperDisplayHeight = paperFormat.getHeight().toMillimeter(); displayMargins = paperFormat.getMargins(); displayRegions = paperFormat.getRegions(); if (fitToDesktopSize == true) { fitToDesktopSize(); } } /** * @param copy */ protected void deepCopy(Sheet copy) { copy.setPaperFormat(getPaperFormat()); copy.setZoomFactor(getZoomFactor()); copy.setAutoZoom(isAutoZoom()); copy.setFitToDesktopSize(isFitToDesktopSize()); copy.setAlign(alignment); copy.setDesktopSize(desktopWidth, desktopHeight); copy.setDesktopMargin(desktopMargin); copy.setModel(model.deepCopy(copy)); for (MouseListener mouseListener : getMouseListeners()) { copy.addMouseListener(mouseListener); } } /** * @param child * @param part */ protected void readCommonAttributes(Element child, AbstractPart part) { String value; value = child.getAttribute("id"); if (value != null && value.trim().length() > 0) { part.setId(value); } value = child.getAttribute("margin"); if (value != null) { part.setMargin(Margin.valueOf(value)); } } protected Part readText(Element child) { String value; AbstractPart text = new Text(this, child.getTextContent()); readCommonAttributes(child, text); value = child.getAttribute("font"); if (value != null) { Font font = Font.decode(value); text.setFont(font); } try { value = child.getAttribute("alignment"); if (value != null) { text.setAlignment(Alignment.valueOf(value.toUpperCase())); } value = child.getAttribute("margin"); if (value != null) { text.setMargin(Margin.valueOf(value.toUpperCase())); } } catch (Exception oops) { // Keine Textausrichtung } return text; } } src/java/org/dbdoclet/jive/sheet/DocumentCursor.java0000644000175000017500000000215212644165236022704 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.jive.sheet; public class DocumentCursor { private double left; private double top; public DocumentCursor(double left, double top) { this.left = left; this.top = top; } public double getLeft() { return left; } public double getTop() { return top; } public void setLeft(double left) { this.left = left; } public void setTop(double top) { this.top = top; } } src/java/org/dbdoclet/jive/Resources.properties0000644000175000017500000000746012644165236022054 0ustar mathieumathieu#Resources.properties apply=Apply bottom=Bottom C_ABOVE=Above C_ACTION=Action C_ACTIVATE=Activate C_ADD=Add C_AFTER=After C_ALIGNMENT_CENTER=Center C_ALIGNMENT_JUSTIFY=Justify C_ALIGNMENT_LEFT=Left C_ALIGNMENT_RIGHT=Right C_APPLY=Apply C_BACKGROUND_COLOR=Background color C_BEFORE=Before C_BELOW=Below C_BOLD=Bold C_BOLD_ITALIC=Bold Italic C_BOTTOM=Bottom C_BROWSE=Browse C_CANCEL=Cancel C_CASE_SENSITIVE=Case sensitive C_CHOOSE_IMAGE=Choose image C_CLASS=Class C_CLOSE=Close C_COLOR=Color C_CONTINUE=Continue C_CSV_EXPORT=CSV Export C_DELETE=Delete C_DELETE_ALL=Delete All C_DELETE_IMAGES=Delete images C_DESELECT_ALL=Deselect All C_DIRECTORY=Directory C_DONT_SHOW_THIS_DIALOG_AGAIN=Don't show this dialog again C_DUPLICATE=Duplicate C_EDIT=Edit C_ELAPSED_TIME=Elapsed C_EMPTY_IMAGE_LIST=The list of images is empty. C_ENABLED=Enabled C_ENTER_LICENSE_KEY=

      License Information

      \n

      To use this program you need a valid license.

      \n

      Please enter your license key.

      \n

      C_ERROR=Error C_ERROR_FILE_ACCESS_DENIED=Access denied\:\n{0} C_ERROR_INVALID_LICENSE=The license you entered was invalid\! Please try again. C_ERROR_INVALID_OPTIONS_FILE=The options could not be loaded. C_ERROR_NO_JAVA_HOME=

      Invalid Directory

      \n

      The selected directory {0} is not JDK home directory\! Please choose a directory where a JDK is installed.

      \n C_ERROR_SAVE_OPTIONS=The options could not be saved. C_ERRORS=Errors C_ESTIMATED_TIME=Estimated Finish C_EXCLUDE_DIRECTORIES=Exclude directories C_EXCLUDE_FILES=Exclude files C_EXCLUDE_PACKAGES=Exclude packages C_EXCLUDING=Excluding C_EXECUTING=Executing C_EXPORT=Export C_FILE=File C_FILE_NAME=File C_FILTER=Filter C_FILTER_TYPE=Filter type C_FINISHED=Processing finished C_FONT=Font C_FONT_ENABLED=Enable font settings C_FONT_SIZE=Font size C_FRAME=Frame C_FRAME_ENABLED=Frame enabled C_FRAME_STYLE=Frame style C_HIDE_DETAILS=Hide Details C_IMPORT=Import C_INCLUDE_DIRECTORIES=Include directories C_INCLUDE_FILES=Include files C_INCLUDE_PACKAGES=Include packages C_INCLUDING=Including C_INFORMATION=Information C_ITALIC=Italic C_JAVA_HOME=Java Home C_LANDSCAPE=Landscape C_LANGUAGE=Language C_LEFT=Left C_LICENSE_KEY=License key C_LINE=Line C_LOOK_AND_FEEL=Look and Feel C_MESSAGE=Message C_MONOSPACED=Monspaced C_NAME=Name C_NEW=New C_NEXT=Next C_NO=No C_NO_FILTER=No Filter C_NO_FOR_ALL=No for all C_NOT_FOUND=Not found C_NOT_READABLE=Not readable C_OK=Ok C_OPTIONS=Options C_PADDING=Padding C_PATH=Path C_PORTRAIT=Portrait C_PREPARE=Prepare C_PRINT=Print C_PROCESS_FINISHED=Process finished. Click on the button "Close" to close this window and go on. C_PROCESSBOX_HEADER=Executing command. Please wait. C_RECURSIVE=Recursive C_REGULAR=Regular C_REMOVE=Remove C_RESTART=Please restart the application. C_RIGHT=Right C_SAVE=Save C_SAVE_BEFORE_EXIT=

      Unsaved Changes

      \n

      Unsaved changes are found. Would you like to save these changes?

      C_SAVE_OPTIONS=Save Options C_SAVED_OPTIONS=Options saved C_SELECT_ALL=Select All C_SEQUENCE=Sequence C_SETTINGS=Settings C_SHOW_DETAILS=Details C_SOURCE_FILES=Sources C_SPACE_BEFORE_OPTIMUM=space-before.optimum C_SPACING=Spacing C_STAGE=Stage C_STANDARD=Standard C_START=Start C_START_TIME=Start C_STATUS=Status C_STYLE=Style C_SUCCESSFUL=Successful C_TERMINAL=Terminal C_TOP=Top C_TOTAL=Total C_UNKNOWN_FILTER_TYPE=Unknown filter type C_UNKNOWN_STATUS=Unknown status C_VARIABLE=Variable C_VISIBLE_SIDES=Visible borders C_WARNING=Warning C_WARNINGS=Warnings C_WIDTH=Width C_YES=Yes C_YES_FOR_ALL=Yes for all cancel=Cancel clef=Clef format=Format height=Height left=Left ok=OK page=Page paper.format=Paper format paper.margins=Margins paper.orientation=Orientation paper.orientation.landscape=Landscape paper.orientation.portrait=Portrait right=Right staff=Staff top=top user_defined=User defined width=Width src/java/org/dbdoclet/jive/Fill.java0000644000175000017500000000231112644165236017503 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.jive; import java.awt.GridBagConstraints; public enum Fill { BOTH, HORIZONTAL, NONE, VERTICAL; public int getGbc() { if (this == Fill.BOTH) { return GridBagConstraints.BOTH; } if (this == Fill.HORIZONTAL) { return GridBagConstraints.HORIZONTAL; } if (this == Fill.VERTICAL) { return GridBagConstraints.VERTICAL; } return GridBagConstraints.NONE; } }src/java/org/dbdoclet/jive/RegionFrame.java0000644000175000017500000000444112644165236021021 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.jive; import org.dbdoclet.unit.Length; public class RegionFrame { private Length top; private Length right; private Length bottom; private Length left; public RegionFrame(Length top, Length right, Length bottom, Length left) { super(); this.top = top; this.right = right; this.bottom = bottom; this.left = left; } public RegionFrame(int top, int right, int bottom, int left) { this.top = new Length(top); this.right = new Length(right); this.bottom = new Length(bottom); this.left = new Length(left); } public Length getTop() { return top; } public void setTop(Length top) { this.top = top; } public Length getRight() { return right; } public void setRight(Length right) { this.right = right; } public Length getBottom() { return bottom; } public void setBottom(Length bottom) { this.bottom = bottom; } public Length getLeft() { return left; } public void setLeft(Length left) { this.left = left; } public void scale(double ratio) { top.setLength(top.getLength() * ratio); bottom.setLength(bottom.getLength() * ratio); left.setLength(left.getLength() * ratio); right.setLength(right.getLength() * ratio); } public RegionFrame deepCopy() { RegionFrame copy = new RegionFrame(top.deepCopy(), right.deepCopy(), bottom.deepCopy(), left.deepCopy()); return copy; } } src/java/org/dbdoclet/jive/PanelProvider.java0000644000175000017500000000207212644165236021373 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.jive; import javax.swing.JPanel; /** * Schnittstelle für Klassen, die eine grafische Benutzeroberfläche zur Parametrisierung bereitstellen wollen. * * @author Michael Fuchs */ public interface PanelProvider { /** * Erzeugt ein JPanel zur Eingabe benötigter Parameter. * * @return JPanel */ public JPanel getPanel(); } src/java/org/dbdoclet/jive/action/0000755000175000017500000000000012644165236017232 5ustar mathieumathieusrc/java/org/dbdoclet/jive/action/ActionSetLookAndFeel.java0000644000175000017500000000543312644165236024037 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.jive.action; import java.awt.Component; import java.awt.Window; import java.awt.event.ActionEvent; import java.util.ArrayList; import javax.swing.AbstractAction; import javax.swing.SwingUtilities; import javax.swing.UIManager; import javax.swing.UIManager.LookAndFeelInfo; import org.dbdoclet.jive.dialog.ExceptionBox; public class ActionSetLookAndFeel extends AbstractAction { private static final long serialVersionUID = 1L; private ArrayList componentList; private LookAndFeelInfo info; private String lnfClassName; public ActionSetLookAndFeel(String label, LookAndFeelInfo info, ArrayList componentList) { super(label); if (componentList == null) { throw new IllegalArgumentException("The argument frame must not be null!"); } this.componentList = componentList; this.info = info; } public ActionSetLookAndFeel(String label, String lnfClassName, ArrayList componentList) { super(label); if (componentList == null) { throw new IllegalArgumentException("The argument frame must not be null!"); } this.componentList = componentList; this.lnfClassName = lnfClassName; } public void actionPerformed(ActionEvent event) { try { if (info != null) { lnfClassName = info.getClassName(); } if (lnfClassName != null) { UIManager.setLookAndFeel(lnfClassName); for (Component component : componentList) { SwingUtilities.updateComponentTreeUI(component); if (component instanceof Window) { ((Window) component).pack(); } } } } catch (Throwable oops) { ExceptionBox ebox = new ExceptionBox(oops); ebox.setVisible(true); ebox.toFront(); } } } src/java/org/dbdoclet/progress/0000755000175000017500000000000012644165244016663 5ustar mathieumathieusrc/java/org/dbdoclet/progress/ProgressManager.java0000644000175000017500000000423612644165236022633 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.progress; import java.util.ArrayList; public class ProgressManager { private final ArrayList listeners; public ProgressManager(ArrayList listeners) { this.listeners = listeners; if (listeners == null) { listeners = new ArrayList(); } } public ProgressManager(ProgressListener listener) { this.listeners = new ArrayList(); listeners.add(listener); } public void setProgressMaximum(int max) { for (ProgressListener listener : listeners) { listener.setProgressMaximum(max); } } public void setStageCount(int stageCount) { for (ProgressListener listener : listeners) { if (listener instanceof StageProgressListener) { ((StageProgressListener) listener).setStageCount(stageCount); } } } public void nextStage() { for (ProgressListener listener : listeners) { if (listener instanceof StageProgressListener) { ((StageProgressListener) listener).nextStage(); } } } public boolean fireProgressEvent(ProgressEvent event) { boolean rc = true; if (listeners != null) { for (ProgressListener listener : listeners) { if (listener.progress(event) == false) { rc = false; } } } return rc; } public void finished(String text) { for (ProgressListener listener : listeners) { if (listener instanceof StageProgressListener) { ((StageProgressListener) listener).finished(text); } } } } src/java/org/dbdoclet/progress/ProgressListener.java0000644000175000017500000000260712644165236023046 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.progress; public interface ProgressListener { /** * Die Methode progress wird aufgerufen, wenn ein * Fortschrittsereignis ausgelöst wurde. * * @param event Das Fortschrittsereignis (ProgressEvent). * * @return boolean Der Rückgabewert muß auf false * gesetzt werden, wenn der Sender des Fortschrittsereignisses die * Verarbeitung abbrechen soll. */ public boolean progress(ProgressEvent event); /** * Setzt die maximale Anzahl von protokollierten Verarbeitungsschritten, die * ein berechenbares Fortschrittsereignis auslösen. */ public void setProgressMaximum(int max); }src/java/org/dbdoclet/progress/ProgressTimeListener.java0000644000175000017500000000206212644165236023660 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.progress; public interface ProgressTimeListener extends ProgressVetoListener { /** * Setzt die Startzeit der Verarbeitung. Die Startzeit kann dazu verwendet * werden eine Schätzung der verbleibenden Dauer der Aktion zu berechnen und * anzuzeigen. */ public void setProgressStartTime(long startTime); } src/java/org/dbdoclet/progress/StageProgressListener.java0000644000175000017500000000164312644165236024031 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.progress; public interface StageProgressListener extends ProgressVetoListener { public void setStageCount(int stageCount); public void nextStage(); public void finished(String text); } src/java/org/dbdoclet/progress/ProgressEvent.java0000644000175000017500000001164412644165236022343 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.progress; /** * Die Klasse ProgressEvent wird dazu verwendet um interessierte * Objekte über den Fortschritt einer Aktion zu unterrichten. */ public class ProgressEvent { public static final int STAGE_PREPARE = 1; public static final int STAGE_ACTION = 2; private boolean consider = true; private int max = -1; private int index = -1; private int stage = STAGE_ACTION; private String action = ""; private String item = ""; private Object userObject = null; /** * Erzeugt ein leeres Forschrittsobjekt. */ public ProgressEvent() { this(-1, -1, "", "", true); } /** * Erzeugt ein Fortschrittsobjekt. * * @param action Die Aktionsbeschreibung. */ public ProgressEvent(String action) { this(-1, -1, "", action, true); } /** * Erzeugt ein Fortschrittsobjekt. * * Der Parameter consider gibt an, ob das Ereignis in die * Berechnung des Fortschrittswertes eingehen soll oder nicht. * * @param action Die Aktionsbeschreibung. * @param consider Schalter für die Gewichtung des Ereignisses. */ public ProgressEvent(String action, boolean consider) { this(-1, -1, "", action, consider); } /** * Erzeugt ein Fortschrittsobjekt. * * @param item Beschreibung des verarbeiteten Objekts * @param action Aktionsbeschreibung. */ public ProgressEvent(String item, String action) { this(-1, -1, item, action, true); } /** * Erzeugt ein Fortschrittsobjekt. * * @param index Index des Fortschrittswertes. * @param item Beschreibung des verarbeiteten Objekts. * @param action Aktionsbeschreibung. */ public ProgressEvent(int index, String item, String action) { this(-1, index, item, action, true); } /** * Erzeugt ein Fortschrittsobjekt. * * @param max Maximalwert des Fortschrittswertes * @param index Aktueller Wert des Fortschrittswertes. */ public ProgressEvent(int max, int index) { this(max, index, "", "", true); } /** * Erzeugt ein Fortschrittsobjekt. * * @param max Maximalwert des Fortschrittswertes * @param index Aktueller Wert des Fortschrittswertes. * @param item Beschreibung des verarbeiteten Objekts. * @param action Aktionsbeschreibung. */ public ProgressEvent(int max, int index, String item, String action) { this(max, index, item, action, true); } /** * Erzeugt ein Fortschrittsobjekt. * * @param max Maximalwert des Fortschrittswertes * @param index Aktueller Wert des Fortschrittswertes. * @param item Beschreibung des verarbeiteten Objekts. * @param action Aktionsbeschreibung. */ public ProgressEvent(int max, int index, String item, String action, boolean consider) { this.max = max; this.index = index; this.item = item; this.action = action; this.consider = consider; } public int getMax() { return max; } public int getIndex() { return index; } public void setItem(String item) { this.item = item; } public String getItem() { return item; } public void setConsider(boolean consider) { this.consider = consider; } public boolean getConsider() { return consider; } public String getAction() { return action; } public void setAction(String action) { this.action = action; } public ProgressEvent setStage(int stage) { this.stage = stage; return this; } public int getStage() { return stage; } /** * Setzt ein benutzerdefiniertes Objekt. */ public ProgressEvent setUserObject(Object userObject) { this.userObject = userObject; return this; } /** * Liefert das benutzerdefinierte Objekt. */ public Object getUserObject() { return userObject; } public String toString() { StringBuilder buffer = new StringBuilder(); buffer.append(getAction()); return buffer.toString(); } } src/java/org/dbdoclet/progress/ProgressAdapter.java0000644000175000017500000000300412644165236022631 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.progress; public class ProgressAdapter implements ProgressVetoListener, ProgressTimeListener { private int progressMaximum = 0; private int progressCounter = 0; private long progressStartTime = System.currentTimeMillis(); public int getProgressCounter() { return progressCounter; } public int getProgressMaximum() { return progressMaximum; } public long getProgressStartTime() { return progressStartTime; } public boolean isCanceled() { return false; } public boolean progress(ProgressEvent event) { progressCounter++; return true; } public void setProgressMaximum(int max) { this.progressMaximum = max; } public void setProgressStartTime(long startTime) { progressStartTime = startTime; } public boolean veto(ProgressEvent event) { return false; } } src/java/org/dbdoclet/progress/InfoListener.java0000644000175000017500000000146612644165236022137 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.progress; public interface InfoListener { public void info(String text); } src/java/org/dbdoclet/progress/ProgressVetoListener.java0000644000175000017500000000456512644165236023711 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.progress; /** *

      Die Klasse ProgressListener stellt eine Schnittstelle zur * Verfügung um Fortschrittsereignisse (ProgressEvent) zu * empfangen.

      * *

      Eine Klasse, die an Fortschrittsereignissen interessiert ist, * implementiert diese Schnittstelle. Eine Instanz dieser Klasse wird dann bei * einem Objekt mit Fortschrittsbearbeitung registiert. Wenn ein * Fortschrittsereignis erzeugt wird, wird dann die Methode * progress der ProgressListener Instanz aufgerufen.

      */ public interface ProgressVetoListener extends ProgressListener { /** * Vor einem Verarbeitungsschritt kann der Sender nachfragen, ob der * Empfänger ein Veto für diesen Schritt einlegen will und eventuell die * Verarbeitung für diesen Schritt übergehen. * *

      Sollen zum Beispiel Dateien in ein Zielverzeichnis kopiert werden, * kann der Sender für jede Datei nachfragen, ob der Kopiervorgang * ausgeführt werden soll. Der Empfänger kann dann prüfen, ob die Datei im * Zielverzeichnis bereits existiert und gegebenfalls den Benutzer fragen, * ob die Datei überschrieben werden darf. Falls der Benutzer dies für diese * und vielleicht auch alle weiteren Dateien verneint, wird ein Veto * eingelegt. */ public boolean veto(ProgressEvent event); /** * Mit Hilfe der Methode isCanceled kann der ProgressListener * dem Aufrufer signalisieren, dass der Benutzer die Verarbeitung abbrechen * will, z.B. durch betätigen einer Schaltfläche "Abbrechen" einer * Fortschrittsanzeige. */ public boolean isCanceled(); } src/java/org/dbdoclet/comparator/0000755000175000017500000000000012644165236017167 5ustar mathieumathieusrc/java/org/dbdoclet/comparator/PathTokenCountComparator.java0000644000175000017500000000307712644165236024777 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.comparator; import java.io.File; import java.util.Comparator; import org.dbdoclet.service.FileServices; public class PathTokenCountComparator implements Comparator { public int compare(File f1, File f2) { int i1 = FileServices.getPathTokenCount(f1.getAbsolutePath()); int i2 = FileServices.getPathTokenCount(f2.getAbsolutePath()); if (i1 == i2) { return 0; } if (i1 < i2) { return 1; } if (i1 > i2) { return -1; } return 0; } @Override public boolean equals(Object other) { if (this == other) { return true; } if (other == null) { return false; } if (other.getClass() != getClass()) { return false; } return true; } } src/java/org/dbdoclet/Sfv.java0000644000175000017500000000246412644165236016427 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet; public class Sfv { public static final String FSEP = System.getProperty("file.separator"); public static final String LSEP = System.getProperty("line.separator"); public static final String PSEP = System.getProperty("path.separator"); public static final int FORMAT_SHORT = 1; public static final int FORMAT_MEDIUM = 2; public static final int FORMAT_LONG = 3; public static final String NS_DOCBOOK= "http://docbook.org/ns/docbook"; public static final String NS_XHTML = "http://www.w3.org/1999/xhtml"; public static final String NS_OPF = "http://www.idpf.org/2007/opf"; } src/java/org/dbdoclet/RenameFileException.java0000644000175000017500000000243112644165236021551 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet; import java.io.File; import java.io.IOException; public class RenameFileException extends IOException { /** * */ private static final long serialVersionUID = 1L; private String from; private String to; public RenameFileException(File from, File to) { super(from.getAbsolutePath() + " -> " + to.getAbsolutePath()); this.from = from.getAbsolutePath(); this.to = to.getAbsolutePath(); } public String getFrom() { return from; } public String getTo() { return to; } } src/java/org/dbdoclet/trafo/0000755000175000017500000000000012644165244016132 5ustar mathieumathieusrc/java/org/dbdoclet/trafo/script/0000755000175000017500000000000012644165236017437 5ustar mathieumathieusrc/java/org/dbdoclet/trafo/script/ScriptListener.java0000644000175000017500000000151312644165236023254 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.script; public interface ScriptListener { public void scriptChanged(ScriptEvent event); } src/java/org/dbdoclet/trafo/script/ScriptEvent.java0000644000175000017500000000243212644165236022551 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.script; import java.io.Serializable; public class ScriptEvent implements Serializable { public enum Type { INPUT_FILE_CHANGED, OUTPUT_FILE_CHANGED } private static final long serialVersionUID = 1L; private final Type type; private final T value; private final Script script; public ScriptEvent(Script script, T value, Type type) { this.script = script; this.value = value; this.type = type; } public Type getType() { return type; } public T getValue() { return value; } public Script getScript() { return script; } } src/java/org/dbdoclet/trafo/script/Script.java0000644000175000017500000002770612644165236021562 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.script; import java.util.ArrayList; import java.util.Collection; import java.util.LinkedHashMap; import java.util.List; import java.util.stream.Collectors; import org.dbdoclet.service.StringServices; import org.dbdoclet.tag.ITransformPosition; import org.dbdoclet.trafo.param.Param; import org.dbdoclet.trafo.param.TextParam; public class Script { public static final String DEFAULT_NAMESPACE = ""; private static final String DEFAULT_SECTION = "main"; private static final String SECTION_SYSTEM = "SYS PARAMS"; public static final String SYSPARAM_TRANSFORMATION_NAME = "transformation.name"; private static final String SECTION_INPUT = "input"; private static final String SECTION_OUTPUT = "output"; private static final String PARAM_FORMAT = "format"; private final LinkedHashMap> variableMap; private final LinkedHashMap namespaceMap; private ArrayList listeners; private ITransformPosition transformPosition; private ArrayList contextList; public enum SectionType { SECTION, NODE, ATTRIBUTE; }; public Script() { namespaceMap = new LinkedHashMap<>(); variableMap = new LinkedHashMap<>(); contextList = new ArrayList<>(); } public void addContext(String context) { contextList.add(0, context); } public void addScriptListener(ScriptListener listener) { if (listener == null) { return; } if (listeners == null) { listeners = new ArrayList(); } if (listeners.contains(listener) == false) { listeners.add(listener); } } public String dump() { StringBuilder buffer = new StringBuilder(); for (String namespaceName : namespaceMap.keySet()) { System.out.println("\n+++ Namespace: " + namespaceName); Namespace namespace = namespaceMap.get(namespaceName); for (Section section : namespace.getSections()) { System.out.println("> Section: " + section.getName()); for (Param param : section.getParameters()) { System.out.println(param.toString()); } } for (NodeRule nodeRule: namespace.getNodeRules()) { System.out.println("> Section: " + nodeRule.getName()); for (Param param : nodeRule.getParameters()) { System.out.println(param.toString()); } } for (Section section : namespace.getSections()) { System.out.println("> Section: " + section.getName()); for (Param param : section.getParameters()) { System.out.println(param.toString()); } } } return buffer.toString(); } private Section findSection(String namespaceName, String name) { if (namespaceName == null) { namespaceName = DEFAULT_NAMESPACE; } if (name == null) { name = DEFAULT_SECTION; } Namespace namespace = namespaceMap.get(namespaceName); if (namespace == null) { return null; } return namespace.findSection(name); } public void fireScriptEvent(ScriptEvent event) { if (listeners == null) { return; } for (ScriptListener listener : listeners) { listener.scriptChanged(event); } } public String getInputFormat() { return getInputFormat(DEFAULT_NAMESPACE); } public String getInputFormat(String namespace) { return getTextParameter(namespace, SECTION_INPUT, PARAM_FORMAT, null); } public int getIntParameter(String section, String name, int def) { return getIntParameter(DEFAULT_NAMESPACE, section, name, def); } public int getIntParameter(String namespace, String section, String name, int def) { Param param = getParameter(namespace, section, name); if (param == null) { return def; } return (Integer) param.getValue(); } public String getOutputFormat() { return getOutputFormat(DEFAULT_NAMESPACE); } public String getOutputFormat(String namespace) { return getTextParameter(namespace, SECTION_OUTPUT, PARAM_FORMAT, null); } public Collection getNodeRules(String section, String name) { return getNodeRules(DEFAULT_NAMESPACE, section, name); } private Collection getNodeRules( String namespaceName, String section, String name) { Namespace namespace = namespaceMap.get(namespaceName); if (namespace == null) { return null; } return namespace.getNodeRules(); } public Param getParameter(String section, String name) { return getParameter(DEFAULT_NAMESPACE, section, name); } public Param getParameter(String namespaceName, String sectionName, String paramName) { Namespace namespace = namespaceMap.get(namespaceName); if (namespace == null) { return null; } List

      specificSectionList = namespace.getSections().stream() .filter(section -> contextList.contains(section.getName())) .collect(Collectors.toList()); List
      regexpSectionList = namespace.getSections().stream() .filter(section -> { if (section.getName().startsWith("/") && section.getName().endsWith("/")) { String regexp = StringServices.trim(section.getName(), "/"); return contextList.stream().filter(contextName -> contextName.matches(regexp)).collect(Collectors.toList()).size() > 0; } else { return false; } }) .collect(Collectors.toList()); Section section = namespace.findSection(sectionName); if (specificSectionList != null && specificSectionList.size() > 0) { Param param = specificSectionList.get(0).findParameter(paramName); if (param != null) { return param; } } if (regexpSectionList != null && regexpSectionList.size() > 0) { Param param = regexpSectionList.get(0).findParameter(paramName); if (param != null) { return param; } } if (section == null) { return null; } return section.findParameter(paramName); } @SuppressWarnings("unchecked") public T getParameterValue(String namespace, String section, String name, T def) { Param param = getParameter(namespace, section, name); if (param == null) { return def; } T value = def; try { Object paramValue = param.getValue(); if (paramValue != null) { value = ((T) paramValue); } } catch (Throwable oops) { oops.printStackTrace(); } return value; } public T getParameterValue(String section, String name, T def) { return getParameterValue(DEFAULT_NAMESPACE, section, name, def); } public Namespace getNamespace( String namespaceName) { return namespaceMap.get(namespaceName); } public Param getSystemParameter(String namespace, String name) { Section section = findSection(namespace, SECTION_SYSTEM); if (section == null) { return null; } return section.findParameter(name); } public String getTextParameter(String section, String name, String def) { return getTextParameter(DEFAULT_NAMESPACE, section, name, def); } public String getTextParameter(String namespace, String section, String name, String def) { Param param = getParameter(namespace, section, name); if (param == null) { return def; } return param.getValueAsText(); } public List getTextParameterList(String section, String name) { return getTextParameterList(DEFAULT_NAMESPACE, section, name, new ArrayList()); } public List getTextParameterList(String section, String name, List def) { return getTextParameterList(DEFAULT_NAMESPACE, section, name, def); } public List getTextParameterList(String namespace, String section, String name, List def) { Param param = getParameter(namespace, section, name); if (param == null) { return def; } ArrayList values = param.getValues(); ArrayList list = new ArrayList(values.size()); for (Object value : values) { list.add(value.toString()); } return list; } public ITransformPosition getTransformPosition() { return transformPosition; } public Param getVariable(String param) { return variableMap.get(param); } public boolean isEnabled(String section, String name) { Param param = getParameter(section, name); if (param != null) { param.isEnabled(); } return false; } public boolean isParameterOn(String section, String name, boolean def) { return isParameterOn(DEFAULT_NAMESPACE, section, name, def); } public boolean isParameterOn(String namespace, String section, String name, boolean def) { Param param = getParameter(namespace, section, name); if (param == null) { return def; } Object value = param.getValue(); if (value == null) { return false; } if (value instanceof Boolean) { return (Boolean) value; } return Boolean.valueOf(value.toString()); } public void mergeNamespaces() { Namespace defNamespace = namespaceMap.get(DEFAULT_NAMESPACE); if (defNamespace == null) { defNamespace = new Namespace(DEFAULT_NAMESPACE); } ArrayList removeList = new ArrayList(); for (Namespace namespace : namespaceMap.values()) { if (namespace.getName().equals(DEFAULT_NAMESPACE)) { continue; } for (Section section : namespace.getSections()) { Section defSection = defNamespace.findSection(section.getName()); if (defSection == null) { defSection = new Section(section.getName()); defNamespace.addSection(defSection); } for (Param param : section.getParameters()) { defSection.addParam(param); } } removeList.add(namespace); } for (Namespace namespace : removeList) { namespaceMap.remove(namespace); } } public void removeContext(String context) { contextList.remove(context); } public void removeScriptListener(ScriptListener listener) { if (listeners == null || listener == null) { return; } if (listeners.contains(listener)) { listeners.remove(listener); } } /* public void setBoolParameter(String name, boolean flag) { if (currentMap == null) { throw new IllegalStateException( "Field currentParamMap must not be null!"); } BooleanParam param = new BooleanParam(name, flag); currentMap.put(name, param); } */ public void setEnabled(String section, String name, boolean flag) { Param param = getParameter(section, name); if (param != null) { param.setEnabled(flag); } } public void setSystemParameter(String name, String value) { setSystemParameter(DEFAULT_NAMESPACE, name, value); } public void setSystemParameter(String namespaceName, String name, String value) { Namespace namespace = namespaceMap.get(namespaceName); if (namespace == null) { namespace = new Namespace(namespaceName); namespaceMap.put(namespaceName, namespace); } Section section = namespace.findSection(SECTION_SYSTEM); if (section == null) { section = new Section(SECTION_SYSTEM); namespace.addSection(section); } section.addParam(new TextParam(name, value)); } public void setTransformPosition(ITransformPosition transformPosition) { this.transformPosition = transformPosition; } public void setVariable(Param param) { variableMap.put(param.getName(), param); } public void unsetVariable(String varname) { variableMap.remove(varname); } public void addNamespace(Namespace namespace) { namespaceMap.put(namespace.getName(), namespace); } public Namespace getNamespace() { Namespace namespace = getNamespace(DEFAULT_NAMESPACE); if (namespace == null) { namespace = new Namespace(DEFAULT_NAMESPACE); addNamespace(namespace); } return namespace; } } src/java/org/dbdoclet/trafo/script/parser/0000755000175000017500000000000012644165244020732 5ustar mathieumathieusrc/java/org/dbdoclet/trafo/script/parser/TrafoScriptBaseListener.java0000644000175000017500000000641312644165236026343 0ustar mathieumathieu// Generated from TrafoScript.g4 by ANTLR 4.5 package org.dbdoclet.trafo.script.parser; import org.antlr.v4.runtime.ParserRuleContext; import org.antlr.v4.runtime.tree.ErrorNode; import org.antlr.v4.runtime.tree.TerminalNode; /** * This class provides an empty implementation of {@link TrafoScriptListener}, * which can be extended to create a listener which only needs to handle a subset * of the available methods. */ public class TrafoScriptBaseListener implements TrafoScriptListener { /** * {@inheritDoc} * *

      The default implementation does nothing.

      */ @Override public void enterParse(TrafoScriptParser.ParseContext ctx) { } /** * {@inheritDoc} * *

      The default implementation does nothing.

      */ @Override public void exitParse(TrafoScriptParser.ParseContext ctx) { } /** * {@inheritDoc} * *

      The default implementation does nothing.

      */ @Override public void enterTransformation(TrafoScriptParser.TransformationContext ctx) { } /** * {@inheritDoc} * *

      The default implementation does nothing.

      */ @Override public void exitTransformation(TrafoScriptParser.TransformationContext ctx) { } /** * {@inheritDoc} * *

      The default implementation does nothing.

      */ @Override public void enterSection(TrafoScriptParser.SectionContext ctx) { } /** * {@inheritDoc} * *

      The default implementation does nothing.

      */ @Override public void exitSection(TrafoScriptParser.SectionContext ctx) { } /** * {@inheritDoc} * *

      The default implementation does nothing.

      */ @Override public void enterNode(TrafoScriptParser.NodeContext ctx) { } /** * {@inheritDoc} * *

      The default implementation does nothing.

      */ @Override public void exitNode(TrafoScriptParser.NodeContext ctx) { } /** * {@inheritDoc} * *

      The default implementation does nothing.

      */ @Override public void enterAttribute(TrafoScriptParser.AttributeContext ctx) { } /** * {@inheritDoc} * *

      The default implementation does nothing.

      */ @Override public void exitAttribute(TrafoScriptParser.AttributeContext ctx) { } /** * {@inheritDoc} * *

      The default implementation does nothing.

      */ @Override public void enterParam(TrafoScriptParser.ParamContext ctx) { } /** * {@inheritDoc} * *

      The default implementation does nothing.

      */ @Override public void exitParam(TrafoScriptParser.ParamContext ctx) { } /** * {@inheritDoc} * *

      The default implementation does nothing.

      */ @Override public void enterExpr(TrafoScriptParser.ExprContext ctx) { } /** * {@inheritDoc} * *

      The default implementation does nothing.

      */ @Override public void exitExpr(TrafoScriptParser.ExprContext ctx) { } /** * {@inheritDoc} * *

      The default implementation does nothing.

      */ @Override public void enterEveryRule(ParserRuleContext ctx) { } /** * {@inheritDoc} * *

      The default implementation does nothing.

      */ @Override public void exitEveryRule(ParserRuleContext ctx) { } /** * {@inheritDoc} * *

      The default implementation does nothing.

      */ @Override public void visitTerminal(TerminalNode node) { } /** * {@inheritDoc} * *

      The default implementation does nothing.

      */ @Override public void visitErrorNode(ErrorNode node) { } }src/java/org/dbdoclet/trafo/script/parser/TrafoScriptListener.java0000644000175000017500000000513612644165236025551 0ustar mathieumathieu// Generated from TrafoScript.g4 by ANTLR 4.5 package org.dbdoclet.trafo.script.parser; import org.antlr.v4.runtime.tree.ParseTreeListener; /** * This interface defines a complete listener for a parse tree produced by * {@link TrafoScriptParser}. */ public interface TrafoScriptListener extends ParseTreeListener { /** * Enter a parse tree produced by {@link TrafoScriptParser#parse}. * @param ctx the parse tree */ void enterParse(TrafoScriptParser.ParseContext ctx); /** * Exit a parse tree produced by {@link TrafoScriptParser#parse}. * @param ctx the parse tree */ void exitParse(TrafoScriptParser.ParseContext ctx); /** * Enter a parse tree produced by {@link TrafoScriptParser#transformation}. * @param ctx the parse tree */ void enterTransformation(TrafoScriptParser.TransformationContext ctx); /** * Exit a parse tree produced by {@link TrafoScriptParser#transformation}. * @param ctx the parse tree */ void exitTransformation(TrafoScriptParser.TransformationContext ctx); /** * Enter a parse tree produced by {@link TrafoScriptParser#section}. * @param ctx the parse tree */ void enterSection(TrafoScriptParser.SectionContext ctx); /** * Exit a parse tree produced by {@link TrafoScriptParser#section}. * @param ctx the parse tree */ void exitSection(TrafoScriptParser.SectionContext ctx); /** * Enter a parse tree produced by {@link TrafoScriptParser#node}. * @param ctx the parse tree */ void enterNode(TrafoScriptParser.NodeContext ctx); /** * Exit a parse tree produced by {@link TrafoScriptParser#node}. * @param ctx the parse tree */ void exitNode(TrafoScriptParser.NodeContext ctx); /** * Enter a parse tree produced by {@link TrafoScriptParser#attribute}. * @param ctx the parse tree */ void enterAttribute(TrafoScriptParser.AttributeContext ctx); /** * Exit a parse tree produced by {@link TrafoScriptParser#attribute}. * @param ctx the parse tree */ void exitAttribute(TrafoScriptParser.AttributeContext ctx); /** * Enter a parse tree produced by {@link TrafoScriptParser#param}. * @param ctx the parse tree */ void enterParam(TrafoScriptParser.ParamContext ctx); /** * Exit a parse tree produced by {@link TrafoScriptParser#param}. * @param ctx the parse tree */ void exitParam(TrafoScriptParser.ParamContext ctx); /** * Enter a parse tree produced by {@link TrafoScriptParser#expr}. * @param ctx the parse tree */ void enterExpr(TrafoScriptParser.ExprContext ctx); /** * Exit a parse tree produced by {@link TrafoScriptParser#expr}. * @param ctx the parse tree */ void exitExpr(TrafoScriptParser.ExprContext ctx); }src/java/org/dbdoclet/trafo/script/parser/TrafoScriptLexer.java0000644000175000017500000002072612644165236025045 0ustar mathieumathieu// Generated from TrafoScript.g4 by ANTLR 4.5 package org.dbdoclet.trafo.script.parser; import org.antlr.v4.runtime.CharStream; import org.antlr.v4.runtime.Lexer; import org.antlr.v4.runtime.RuleContext; import org.antlr.v4.runtime.RuntimeMetaData; import org.antlr.v4.runtime.Vocabulary; import org.antlr.v4.runtime.VocabularyImpl; import org.antlr.v4.runtime.atn.ATN; import org.antlr.v4.runtime.atn.ATNDeserializer; import org.antlr.v4.runtime.atn.LexerATNSimulator; import org.antlr.v4.runtime.atn.PredictionContextCache; import org.antlr.v4.runtime.dfa.DFA; @SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"}) public class TrafoScriptLexer extends Lexer { static { RuntimeMetaData.checkVersion("4.5", RuntimeMetaData.VERSION); } protected static final DFA[] _decisionToDFA; protected static final PredictionContextCache _sharedContextCache = new PredictionContextCache(); public static final int BO=1, BC=2, SBO=3, SBC=4, BOOL=5, EQ=6, EOS=7, COMMA=8, NUMBER=9, NODE=10, ATTRIBUTE=11, SECTION=12, TRAN=13, ID=14, REGEXP=15, TEXT=16, MULTILINE=17, WS=18, COMMENT=19, LINE_COMMENT=20; public static String[] modeNames = { "DEFAULT_MODE" }; public static final String[] ruleNames = { "BO", "BC", "SBO", "SBC", "BOOL", "EQ", "EOS", "COMMA", "NUMBER", "NODE", "ATTRIBUTE", "SECTION", "TRAN", "ID", "REGEXP", "TEXT", "MULTILINE", "WS", "COMMENT", "LINE_COMMENT" }; private static final String[] _LITERAL_NAMES = { null, "'{'", "'}'", "'['", "']'", null, "'='", "';'", "','", null, "'node'", "'attribute'", "'section'", "'transformation'" }; private static final String[] _SYMBOLIC_NAMES = { null, "BO", "BC", "SBO", "SBC", "BOOL", "EQ", "EOS", "COMMA", "NUMBER", "NODE", "ATTRIBUTE", "SECTION", "TRAN", "ID", "REGEXP", "TEXT", "MULTILINE", "WS", "COMMENT", "LINE_COMMENT" }; public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES); /** * @deprecated Use {@link #VOCABULARY} instead. */ @Deprecated public static final String[] tokenNames; static { tokenNames = new String[_SYMBOLIC_NAMES.length]; for (int i = 0; i < tokenNames.length; i++) { tokenNames[i] = VOCABULARY.getLiteralName(i); if (tokenNames[i] == null) { tokenNames[i] = VOCABULARY.getSymbolicName(i); } if (tokenNames[i] == null) { tokenNames[i] = ""; } } } @Override @Deprecated public String[] getTokenNames() { return tokenNames; } @Override public Vocabulary getVocabulary() { return VOCABULARY; } public TrafoScriptLexer(CharStream input) { super(input); _interp = new LexerATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache); } @Override public String getGrammarFileName() { return "TrafoScript.g4"; } @Override public String[] getRuleNames() { return ruleNames; } @Override public String getSerializedATN() { return _serializedATN; } @Override public String[] getModeNames() { return modeNames; } @Override public ATN getATN() { return _ATN; } @Override public void action(RuleContext _localctx, int ruleIndex, int actionIndex) { switch (ruleIndex) { case 15: TEXT_action((RuleContext)_localctx, actionIndex); break; case 16: MULTILINE_action((RuleContext)_localctx, actionIndex); break; case 17: WS_action((RuleContext)_localctx, actionIndex); break; } } private void TEXT_action(RuleContext _localctx, int actionIndex) { switch (actionIndex) { case 0: setText(getText().substring(1, getText().length()-1)); break; } } private void MULTILINE_action(RuleContext _localctx, int actionIndex) { switch (actionIndex) { case 1: setText(getText().substring(3, getText().length()-3)); break; } } private void WS_action(RuleContext _localctx, int actionIndex) { switch (actionIndex) { case 2: skip(); break; } } public static final String _serializedATN = "\3\u0430\ud6d1\u8206\uad2d\u4417\uaef1\u8d80\uaadd\2\26\u00c0\b\1\4\2"+ "\t\2\4\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7\4\b\t\b\4\t\t\t\4\n\t\n\4"+ "\13\t\13\4\f\t\f\4\r\t\r\4\16\t\16\4\17\t\17\4\20\t\20\4\21\t\21\4\22"+ "\t\22\4\23\t\23\4\24\t\24\4\25\t\25\3\2\3\2\3\3\3\3\3\4\3\4\3\5\3\5\3"+ "\6\3\6\3\6\3\6\3\6\3\6\3\6\3\6\3\6\5\6=\n\6\3\7\3\7\3\b\3\b\3\t\3\t\3"+ "\n\6\nF\n\n\r\n\16\nG\3\13\3\13\3\13\3\13\3\13\3\f\3\f\3\f\3\f\3\f\3\f"+ "\3\f\3\f\3\f\3\f\3\r\3\r\3\r\3\r\3\r\3\r\3\r\3\r\3\16\3\16\3\16\3\16\3"+ "\16\3\16\3\16\3\16\3\16\3\16\3\16\3\16\3\16\3\16\3\16\3\17\3\17\6\17r"+ "\n\17\r\17\16\17s\3\20\3\20\3\20\3\20\3\20\7\20{\n\20\f\20\16\20~\13\20"+ "\3\20\3\20\3\21\3\21\7\21\u0084\n\21\f\21\16\21\u0087\13\21\3\21\3\21"+ "\3\21\3\22\3\22\3\22\3\22\3\22\7\22\u0091\n\22\f\22\16\22\u0094\13\22"+ "\3\22\3\22\3\22\3\22\3\22\3\22\3\23\6\23\u009d\n\23\r\23\16\23\u009e\3"+ "\23\3\23\3\24\3\24\3\24\3\24\7\24\u00a7\n\24\f\24\16\24\u00aa\13\24\3"+ "\24\3\24\3\24\3\24\3\24\3\25\3\25\3\25\3\25\7\25\u00b5\n\25\f\25\16\25"+ "\u00b8\13\25\3\25\5\25\u00bb\n\25\3\25\3\25\3\25\3\25\4\u0092\u00a8\2"+ "\26\3\3\5\4\7\5\t\6\13\7\r\b\17\t\21\n\23\13\25\f\27\r\31\16\33\17\35"+ "\20\37\21!\22#\23%\24\'\25)\26\3\2\t\5\2C\\aac|\7\2/\60\62;C\\aac|\3\2"+ ",,\3\2\61\61\5\2\f\f\17\17$$\5\2\13\f\17\17\"\"\4\2\f\f\17\17\u00ca\2"+ "\3\3\2\2\2\2\5\3\2\2\2\2\7\3\2\2\2\2\t\3\2\2\2\2\13\3\2\2\2\2\r\3\2\2"+ "\2\2\17\3\2\2\2\2\21\3\2\2\2\2\23\3\2\2\2\2\25\3\2\2\2\2\27\3\2\2\2\2"+ "\31\3\2\2\2\2\33\3\2\2\2\2\35\3\2\2\2\2\37\3\2\2\2\2!\3\2\2\2\2#\3\2\2"+ "\2\2%\3\2\2\2\2\'\3\2\2\2\2)\3\2\2\2\3+\3\2\2\2\5-\3\2\2\2\7/\3\2\2\2"+ "\t\61\3\2\2\2\13<\3\2\2\2\r>\3\2\2\2\17@\3\2\2\2\21B\3\2\2\2\23E\3\2\2"+ "\2\25I\3\2\2\2\27N\3\2\2\2\31X\3\2\2\2\33`\3\2\2\2\35o\3\2\2\2\37u\3\2"+ "\2\2!\u0081\3\2\2\2#\u008b\3\2\2\2%\u009c\3\2\2\2\'\u00a2\3\2\2\2)\u00b0"+ "\3\2\2\2+,\7}\2\2,\4\3\2\2\2-.\7\177\2\2.\6\3\2\2\2/\60\7]\2\2\60\b\3"+ "\2\2\2\61\62\7_\2\2\62\n\3\2\2\2\63\64\7v\2\2\64\65\7t\2\2\65\66\7w\2"+ "\2\66=\7g\2\2\678\7h\2\289\7c\2\29:\7n\2\2:;\7u\2\2;=\7g\2\2<\63\3\2\2"+ "\2<\67\3\2\2\2=\f\3\2\2\2>?\7?\2\2?\16\3\2\2\2@A\7=\2\2A\20\3\2\2\2BC"+ "\7.\2\2C\22\3\2\2\2DF\4\62;\2ED\3\2\2\2FG\3\2\2\2GE\3\2\2\2GH\3\2\2\2"+ "H\24\3\2\2\2IJ\7p\2\2JK\7q\2\2KL\7f\2\2LM\7g\2\2M\26\3\2\2\2NO\7c\2\2"+ "OP\7v\2\2PQ\7v\2\2QR\7t\2\2RS\7k\2\2ST\7d\2\2TU\7w\2\2UV\7v\2\2VW\7g\2"+ "\2W\30\3\2\2\2XY\7u\2\2YZ\7g\2\2Z[\7e\2\2[\\\7v\2\2\\]\7k\2\2]^\7q\2\2"+ "^_\7p\2\2_\32\3\2\2\2`a\7v\2\2ab\7t\2\2bc\7c\2\2cd\7p\2\2de\7u\2\2ef\7"+ "h\2\2fg\7q\2\2gh\7t\2\2hi\7o\2\2ij\7c\2\2jk\7v\2\2kl\7k\2\2lm\7q\2\2m"+ "n\7p\2\2n\34\3\2\2\2oq\t\2\2\2pr\t\3\2\2qp\3\2\2\2rs\3\2\2\2sq\3\2\2\2"+ "st\3\2\2\2t\36\3\2\2\2uv\7\61\2\2v|\n\4\2\2wx\7^\2\2x{\7\61\2\2y{\n\5"+ "\2\2zw\3\2\2\2zy\3\2\2\2{~\3\2\2\2|z\3\2\2\2|}\3\2\2\2}\177\3\2\2\2~|"+ "\3\2\2\2\177\u0080\7\61\2\2\u0080 \3\2\2\2\u0081\u0085\7$\2\2\u0082\u0084"+ "\n\6\2\2\u0083\u0082\3\2\2\2\u0084\u0087\3\2\2\2\u0085\u0083\3\2\2\2\u0085"+ "\u0086\3\2\2\2\u0086\u0088\3\2\2\2\u0087\u0085\3\2\2\2\u0088\u0089\7$"+ "\2\2\u0089\u008a\b\21\2\2\u008a\"\3\2\2\2\u008b\u008c\7$\2\2\u008c\u008d"+ "\7$\2\2\u008d\u008e\7$\2\2\u008e\u0092\3\2\2\2\u008f\u0091\13\2\2\2\u0090"+ "\u008f\3\2\2\2\u0091\u0094\3\2\2\2\u0092\u0093\3\2\2\2\u0092\u0090\3\2"+ "\2\2\u0093\u0095\3\2\2\2\u0094\u0092\3\2\2\2\u0095\u0096\7$\2\2\u0096"+ "\u0097\7$\2\2\u0097\u0098\7$\2\2\u0098\u0099\3\2\2\2\u0099\u009a\b\22"+ "\3\2\u009a$\3\2\2\2\u009b\u009d\t\7\2\2\u009c\u009b\3\2\2\2\u009d\u009e"+ "\3\2\2\2\u009e\u009c\3\2\2\2\u009e\u009f\3\2\2\2\u009f\u00a0\3\2\2\2\u00a0"+ "\u00a1\b\23\4\2\u00a1&\3\2\2\2\u00a2\u00a3\7\61\2\2\u00a3\u00a4\7,\2\2"+ "\u00a4\u00a8\3\2\2\2\u00a5\u00a7\13\2\2\2\u00a6\u00a5\3\2\2\2\u00a7\u00aa"+ "\3\2\2\2\u00a8\u00a9\3\2\2\2\u00a8\u00a6\3\2\2\2\u00a9\u00ab\3\2\2\2\u00aa"+ "\u00a8\3\2\2\2\u00ab\u00ac\7,\2\2\u00ac\u00ad\7\61\2\2\u00ad\u00ae\3\2"+ "\2\2\u00ae\u00af\b\24\5\2\u00af(\3\2\2\2\u00b0\u00b1\7\61\2\2\u00b1\u00b2"+ "\7\61\2\2\u00b2\u00b6\3\2\2\2\u00b3\u00b5\n\b\2\2\u00b4\u00b3\3\2\2\2"+ "\u00b5\u00b8\3\2\2\2\u00b6\u00b4\3\2\2\2\u00b6\u00b7\3\2\2\2\u00b7\u00ba"+ "\3\2\2\2\u00b8\u00b6\3\2\2\2\u00b9\u00bb\7\17\2\2\u00ba\u00b9\3\2\2\2"+ "\u00ba\u00bb\3\2\2\2\u00bb\u00bc\3\2\2\2\u00bc\u00bd\7\f\2\2\u00bd\u00be"+ "\3\2\2\2\u00be\u00bf\b\25\5\2\u00bf*\3\2\2\2\16\2. */ package org.dbdoclet.trafo.script.parser; import org.dbdoclet.trafo.param.BooleanParam; import org.dbdoclet.trafo.param.NumberParam; import org.dbdoclet.trafo.param.TextParam; import org.dbdoclet.trafo.script.AttributeRule; import org.dbdoclet.trafo.script.Namespace; import org.dbdoclet.trafo.script.NodeRule; import org.dbdoclet.trafo.script.Script; import org.dbdoclet.trafo.script.Section; import org.dbdoclet.trafo.script.parser.TrafoScriptParser.AttributeContext; import org.dbdoclet.trafo.script.parser.TrafoScriptParser.ExprContext; import org.dbdoclet.trafo.script.parser.TrafoScriptParser.NodeContext; import org.dbdoclet.trafo.script.parser.TrafoScriptParser.ParamContext; import org.dbdoclet.trafo.script.parser.TrafoScriptParser.SectionContext; import org.dbdoclet.trafo.script.parser.TrafoScriptParser.TransformationContext; public class TrafoScriptListenerImpl extends TrafoScriptBaseListener { private Script script; private Namespace namespace; private String currentParamId; private Section currentSection; public TrafoScriptListenerImpl(Script script, String namespaceName) { this.script = script; if (namespaceName == null || namespaceName.trim().length() == 0) { namespaceName = Script.DEFAULT_NAMESPACE; } this.namespace = new Namespace(namespaceName); script.addNamespace(namespace); } @Override public void enterTransformation(TransformationContext ctx) { script.addNamespace(namespace); script.setSystemParameter(namespace.getName(), Script.SYSPARAM_TRANSFORMATION_NAME, ctx.ID().getText()); } @Override public void enterSection(SectionContext ctx) { Section section = new Section(); if (ctx.ID() != null) { section.setName(ctx.ID().getText()); } if (ctx.REGEXP() != null) { section.setName(ctx.REGEXP().getText()); } namespace.addSection(section); currentSection = section; } @Override public void enterParam(ParamContext ctx) { currentParamId = ctx.ID().getText(); } @Override public void enterNode(NodeContext ctx) { NodeRule nodeRule = new NodeRule(); if (ctx.TEXT() != null) { nodeRule.setName(ctx.TEXT().getText()); } namespace.addNodeRule(nodeRule); currentSection = nodeRule; } @Override public void enterAttribute(AttributeContext ctx) { AttributeRule attributeRule = new AttributeRule(); if (ctx.TEXT() != null) { attributeRule.setName(ctx.TEXT().getText()); } namespace.addAttributeRule(attributeRule); currentSection = attributeRule; } @Override public void enterExpr(ExprContext ctx) { if (ctx.BOOL() != null) { currentSection.addParam(new BooleanParam(currentParamId, Boolean .valueOf(ctx.BOOL().getText()))); } if (ctx.NUMBER() != null) { currentSection.addParam(new NumberParam(currentParamId, Integer.valueOf(ctx.NUMBER().getText()))); } if (ctx.TEXT() != null) { currentSection.addParam(new TextParam(currentParamId, ctx.TEXT().getText())); } if (ctx.MULTILINE() != null) { currentSection.addParam(new TextParam(currentParamId, ctx.MULTILINE().getText())); } } } src/java/org/dbdoclet/trafo/script/parser/TrafoScriptParser.java0000644000175000017500000004462412644165236025225 0ustar mathieumathieu// Generated from TrafoScript.g4 by ANTLR 4.5 package org.dbdoclet.trafo.script.parser; import java.util.List; import org.antlr.v4.runtime.NoViableAltException; import org.antlr.v4.runtime.Parser; import org.antlr.v4.runtime.ParserRuleContext; import org.antlr.v4.runtime.RecognitionException; import org.antlr.v4.runtime.RuntimeMetaData; import org.antlr.v4.runtime.TokenStream; import org.antlr.v4.runtime.Vocabulary; import org.antlr.v4.runtime.VocabularyImpl; import org.antlr.v4.runtime.atn.ATN; import org.antlr.v4.runtime.atn.ATNDeserializer; import org.antlr.v4.runtime.atn.ParserATNSimulator; import org.antlr.v4.runtime.atn.PredictionContextCache; import org.antlr.v4.runtime.dfa.DFA; import org.antlr.v4.runtime.tree.ParseTreeListener; import org.antlr.v4.runtime.tree.TerminalNode; @SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"}) public class TrafoScriptParser extends Parser { static { RuntimeMetaData.checkVersion("4.5", RuntimeMetaData.VERSION); } protected static final DFA[] _decisionToDFA; protected static final PredictionContextCache _sharedContextCache = new PredictionContextCache(); public static final int BO=1, BC=2, SBO=3, SBC=4, BOOL=5, EQ=6, EOS=7, COMMA=8, NUMBER=9, NODE=10, ATTRIBUTE=11, SECTION=12, TRAN=13, ID=14, REGEXP=15, TEXT=16, MULTILINE=17, WS=18, COMMENT=19, LINE_COMMENT=20; public static final int RULE_parse = 0, RULE_transformation = 1, RULE_section = 2, RULE_node = 3, RULE_attribute = 4, RULE_param = 5, RULE_expr = 6; public static final String[] ruleNames = { "parse", "transformation", "section", "node", "attribute", "param", "expr" }; private static final String[] _LITERAL_NAMES = { null, "'{'", "'}'", "'['", "']'", null, "'='", "';'", "','", null, "'node'", "'attribute'", "'section'", "'transformation'" }; private static final String[] _SYMBOLIC_NAMES = { null, "BO", "BC", "SBO", "SBC", "BOOL", "EQ", "EOS", "COMMA", "NUMBER", "NODE", "ATTRIBUTE", "SECTION", "TRAN", "ID", "REGEXP", "TEXT", "MULTILINE", "WS", "COMMENT", "LINE_COMMENT" }; public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES); /** * @deprecated Use {@link #VOCABULARY} instead. */ @Deprecated public static final String[] tokenNames; static { tokenNames = new String[_SYMBOLIC_NAMES.length]; for (int i = 0; i < tokenNames.length; i++) { tokenNames[i] = VOCABULARY.getLiteralName(i); if (tokenNames[i] == null) { tokenNames[i] = VOCABULARY.getSymbolicName(i); } if (tokenNames[i] == null) { tokenNames[i] = ""; } } } @Override @Deprecated public String[] getTokenNames() { return tokenNames; } @Override public Vocabulary getVocabulary() { return VOCABULARY; } @Override public String getGrammarFileName() { return "TrafoScript.g4"; } @Override public String[] getRuleNames() { return ruleNames; } @Override public String getSerializedATN() { return _serializedATN; } @Override public ATN getATN() { return _ATN; } public TrafoScriptParser(TokenStream input) { super(input); _interp = new ParserATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache); } public static class ParseContext extends ParserRuleContext { public TransformationContext transformation() { return getRuleContext(TransformationContext.class,0); } public TerminalNode EOF() { return getToken(TrafoScriptParser.EOF, 0); } public List section() { return getRuleContexts(SectionContext.class); } public SectionContext section(int i) { return getRuleContext(SectionContext.class,i); } public List node() { return getRuleContexts(NodeContext.class); } public NodeContext node(int i) { return getRuleContext(NodeContext.class,i); } public List attribute() { return getRuleContexts(AttributeContext.class); } public AttributeContext attribute(int i) { return getRuleContext(AttributeContext.class,i); } public ParseContext(ParserRuleContext parent, int invokingState) { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_parse; } @Override public void enterRule(ParseTreeListener listener) { if ( listener instanceof TrafoScriptListener ) ((TrafoScriptListener)listener).enterParse(this); } @Override public void exitRule(ParseTreeListener listener) { if ( listener instanceof TrafoScriptListener ) ((TrafoScriptListener)listener).exitParse(this); } } public final ParseContext parse() throws RecognitionException { ParseContext _localctx = new ParseContext(_ctx, getState()); enterRule(_localctx, 0, RULE_parse); int _la; try { enterOuterAlt(_localctx, 1); { setState(14); transformation(); setState(20); _errHandler.sync(this); _la = _input.LA(1); while ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << NODE) | (1L << ATTRIBUTE) | (1L << SECTION))) != 0)) { { setState(18); switch (_input.LA(1)) { case SECTION: { setState(15); section(); } break; case NODE: { setState(16); node(); } break; case ATTRIBUTE: { setState(17); attribute(); } break; default: throw new NoViableAltException(this); } } setState(22); _errHandler.sync(this); _la = _input.LA(1); } setState(23); match(EOF); } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { exitRule(); } return _localctx; } public static class TransformationContext extends ParserRuleContext { public TerminalNode TRAN() { return getToken(TrafoScriptParser.TRAN, 0); } public TerminalNode ID() { return getToken(TrafoScriptParser.ID, 0); } public TerminalNode EOS() { return getToken(TrafoScriptParser.EOS, 0); } public TransformationContext(ParserRuleContext parent, int invokingState) { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_transformation; } @Override public void enterRule(ParseTreeListener listener) { if ( listener instanceof TrafoScriptListener ) ((TrafoScriptListener)listener).enterTransformation(this); } @Override public void exitRule(ParseTreeListener listener) { if ( listener instanceof TrafoScriptListener ) ((TrafoScriptListener)listener).exitTransformation(this); } } public final TransformationContext transformation() throws RecognitionException { TransformationContext _localctx = new TransformationContext(_ctx, getState()); enterRule(_localctx, 2, RULE_transformation); try { enterOuterAlt(_localctx, 1); { setState(25); match(TRAN); setState(26); match(ID); setState(27); match(EOS); } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { exitRule(); } return _localctx; } public static class SectionContext extends ParserRuleContext { public TerminalNode SECTION() { return getToken(TrafoScriptParser.SECTION, 0); } public TerminalNode BO() { return getToken(TrafoScriptParser.BO, 0); } public TerminalNode BC() { return getToken(TrafoScriptParser.BC, 0); } public TerminalNode ID() { return getToken(TrafoScriptParser.ID, 0); } public TerminalNode REGEXP() { return getToken(TrafoScriptParser.REGEXP, 0); } public List param() { return getRuleContexts(ParamContext.class); } public ParamContext param(int i) { return getRuleContext(ParamContext.class,i); } public SectionContext(ParserRuleContext parent, int invokingState) { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_section; } @Override public void enterRule(ParseTreeListener listener) { if ( listener instanceof TrafoScriptListener ) ((TrafoScriptListener)listener).enterSection(this); } @Override public void exitRule(ParseTreeListener listener) { if ( listener instanceof TrafoScriptListener ) ((TrafoScriptListener)listener).exitSection(this); } } public final SectionContext section() throws RecognitionException { SectionContext _localctx = new SectionContext(_ctx, getState()); enterRule(_localctx, 4, RULE_section); int _la; try { enterOuterAlt(_localctx, 1); { setState(29); match(SECTION); setState(30); _la = _input.LA(1); if ( !(_la==ID || _la==REGEXP) ) { _errHandler.recoverInline(this); } else { consume(); } setState(31); match(BO); setState(35); _errHandler.sync(this); _la = _input.LA(1); while (_la==ID) { { { setState(32); param(); } } setState(37); _errHandler.sync(this); _la = _input.LA(1); } setState(38); match(BC); } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { exitRule(); } return _localctx; } public static class NodeContext extends ParserRuleContext { public TerminalNode NODE() { return getToken(TrafoScriptParser.NODE, 0); } public TerminalNode TEXT() { return getToken(TrafoScriptParser.TEXT, 0); } public TerminalNode BO() { return getToken(TrafoScriptParser.BO, 0); } public TerminalNode BC() { return getToken(TrafoScriptParser.BC, 0); } public List param() { return getRuleContexts(ParamContext.class); } public ParamContext param(int i) { return getRuleContext(ParamContext.class,i); } public NodeContext(ParserRuleContext parent, int invokingState) { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_node; } @Override public void enterRule(ParseTreeListener listener) { if ( listener instanceof TrafoScriptListener ) ((TrafoScriptListener)listener).enterNode(this); } @Override public void exitRule(ParseTreeListener listener) { if ( listener instanceof TrafoScriptListener ) ((TrafoScriptListener)listener).exitNode(this); } } public final NodeContext node() throws RecognitionException { NodeContext _localctx = new NodeContext(_ctx, getState()); enterRule(_localctx, 6, RULE_node); int _la; try { enterOuterAlt(_localctx, 1); { setState(40); match(NODE); setState(41); match(TEXT); setState(42); match(BO); setState(46); _errHandler.sync(this); _la = _input.LA(1); while (_la==ID) { { { setState(43); param(); } } setState(48); _errHandler.sync(this); _la = _input.LA(1); } setState(49); match(BC); } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { exitRule(); } return _localctx; } public static class AttributeContext extends ParserRuleContext { public TerminalNode ATTRIBUTE() { return getToken(TrafoScriptParser.ATTRIBUTE, 0); } public TerminalNode TEXT() { return getToken(TrafoScriptParser.TEXT, 0); } public TerminalNode BO() { return getToken(TrafoScriptParser.BO, 0); } public TerminalNode BC() { return getToken(TrafoScriptParser.BC, 0); } public List param() { return getRuleContexts(ParamContext.class); } public ParamContext param(int i) { return getRuleContext(ParamContext.class,i); } public AttributeContext(ParserRuleContext parent, int invokingState) { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_attribute; } @Override public void enterRule(ParseTreeListener listener) { if ( listener instanceof TrafoScriptListener ) ((TrafoScriptListener)listener).enterAttribute(this); } @Override public void exitRule(ParseTreeListener listener) { if ( listener instanceof TrafoScriptListener ) ((TrafoScriptListener)listener).exitAttribute(this); } } public final AttributeContext attribute() throws RecognitionException { AttributeContext _localctx = new AttributeContext(_ctx, getState()); enterRule(_localctx, 8, RULE_attribute); int _la; try { enterOuterAlt(_localctx, 1); { setState(51); match(ATTRIBUTE); setState(52); match(TEXT); setState(53); match(BO); setState(57); _errHandler.sync(this); _la = _input.LA(1); while (_la==ID) { { { setState(54); param(); } } setState(59); _errHandler.sync(this); _la = _input.LA(1); } setState(60); match(BC); } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { exitRule(); } return _localctx; } public static class ParamContext extends ParserRuleContext { public TerminalNode ID() { return getToken(TrafoScriptParser.ID, 0); } public TerminalNode EQ() { return getToken(TrafoScriptParser.EQ, 0); } public ExprContext expr() { return getRuleContext(ExprContext.class,0); } public TerminalNode EOS() { return getToken(TrafoScriptParser.EOS, 0); } public ParamContext(ParserRuleContext parent, int invokingState) { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_param; } @Override public void enterRule(ParseTreeListener listener) { if ( listener instanceof TrafoScriptListener ) ((TrafoScriptListener)listener).enterParam(this); } @Override public void exitRule(ParseTreeListener listener) { if ( listener instanceof TrafoScriptListener ) ((TrafoScriptListener)listener).exitParam(this); } } public final ParamContext param() throws RecognitionException { ParamContext _localctx = new ParamContext(_ctx, getState()); enterRule(_localctx, 10, RULE_param); try { enterOuterAlt(_localctx, 1); { setState(62); match(ID); setState(63); match(EQ); setState(64); expr(); setState(65); match(EOS); } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { exitRule(); } return _localctx; } public static class ExprContext extends ParserRuleContext { public TerminalNode BOOL() { return getToken(TrafoScriptParser.BOOL, 0); } public TerminalNode NUMBER() { return getToken(TrafoScriptParser.NUMBER, 0); } public TerminalNode TEXT() { return getToken(TrafoScriptParser.TEXT, 0); } public TerminalNode MULTILINE() { return getToken(TrafoScriptParser.MULTILINE, 0); } public TerminalNode SBO() { return getToken(TrafoScriptParser.SBO, 0); } public TerminalNode SBC() { return getToken(TrafoScriptParser.SBC, 0); } public List expr() { return getRuleContexts(ExprContext.class); } public ExprContext expr(int i) { return getRuleContext(ExprContext.class,i); } public List COMMA() { return getTokens(TrafoScriptParser.COMMA); } public TerminalNode COMMA(int i) { return getToken(TrafoScriptParser.COMMA, i); } public ExprContext(ParserRuleContext parent, int invokingState) { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_expr; } @Override public void enterRule(ParseTreeListener listener) { if ( listener instanceof TrafoScriptListener ) ((TrafoScriptListener)listener).enterExpr(this); } @Override public void exitRule(ParseTreeListener listener) { if ( listener instanceof TrafoScriptListener ) ((TrafoScriptListener)listener).exitExpr(this); } } public final ExprContext expr() throws RecognitionException { ExprContext _localctx = new ExprContext(_ctx, getState()); enterRule(_localctx, 12, RULE_expr); int _la; try { setState(81); switch ( getInterpreter().adaptivePredict(_input,6,_ctx) ) { case 1: enterOuterAlt(_localctx, 1); { setState(67); _la = _input.LA(1); if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << BOOL) | (1L << NUMBER) | (1L << TEXT) | (1L << MULTILINE))) != 0)) ) { _errHandler.recoverInline(this); } else { consume(); } } break; case 2: enterOuterAlt(_localctx, 2); { setState(68); match(SBO); setState(69); match(SBC); } break; case 3: enterOuterAlt(_localctx, 3); { setState(70); match(SBO); setState(71); expr(); setState(76); _errHandler.sync(this); _la = _input.LA(1); while (_la==COMMA) { { { setState(72); match(COMMA); setState(73); expr(); } } setState(78); _errHandler.sync(this); _la = _input.LA(1); } setState(79); match(SBC); } break; } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { exitRule(); } return _localctx; } public static final String _serializedATN = "\3\u0430\ud6d1\u8206\uad2d\u4417\uaef1\u8d80\uaadd\3\26V\4\2\t\2\4\3\t"+ "\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7\4\b\t\b\3\2\3\2\3\2\3\2\7\2\25\n\2"+ "\f\2\16\2\30\13\2\3\2\3\2\3\3\3\3\3\3\3\3\3\4\3\4\3\4\3\4\7\4$\n\4\f\4"+ "\16\4\'\13\4\3\4\3\4\3\5\3\5\3\5\3\5\7\5/\n\5\f\5\16\5\62\13\5\3\5\3\5"+ "\3\6\3\6\3\6\3\6\7\6:\n\6\f\6\16\6=\13\6\3\6\3\6\3\7\3\7\3\7\3\7\3\7\3"+ "\b\3\b\3\b\3\b\3\b\3\b\3\b\7\bM\n\b\f\b\16\bP\13\b\3\b\3\b\5\bT\n\b\3"+ "\b\2\2\t\2\4\6\b\n\f\16\2\4\3\2\20\21\5\2\7\7\13\13\22\23W\2\20\3\2\2"+ "\2\4\33\3\2\2\2\6\37\3\2\2\2\b*\3\2\2\2\n\65\3\2\2\2\f@\3\2\2\2\16S\3"+ "\2\2\2\20\26\5\4\3\2\21\25\5\6\4\2\22\25\5\b\5\2\23\25\5\n\6\2\24\21\3"+ "\2\2\2\24\22\3\2\2\2\24\23\3\2\2\2\25\30\3\2\2\2\26\24\3\2\2\2\26\27\3"+ "\2\2\2\27\31\3\2\2\2\30\26\3\2\2\2\31\32\7\2\2\3\32\3\3\2\2\2\33\34\7"+ "\17\2\2\34\35\7\20\2\2\35\36\7\t\2\2\36\5\3\2\2\2\37 \7\16\2\2 !\t\2\2"+ "\2!%\7\3\2\2\"$\5\f\7\2#\"\3\2\2\2$\'\3\2\2\2%#\3\2\2\2%&\3\2\2\2&(\3"+ "\2\2\2\'%\3\2\2\2()\7\4\2\2)\7\3\2\2\2*+\7\f\2\2+,\7\22\2\2,\60\7\3\2"+ "\2-/\5\f\7\2.-\3\2\2\2/\62\3\2\2\2\60.\3\2\2\2\60\61\3\2\2\2\61\63\3\2"+ "\2\2\62\60\3\2\2\2\63\64\7\4\2\2\64\t\3\2\2\2\65\66\7\r\2\2\66\67\7\22"+ "\2\2\67;\7\3\2\28:\5\f\7\298\3\2\2\2:=\3\2\2\2;9\3\2\2\2;<\3\2\2\2<>\3"+ "\2\2\2=;\3\2\2\2>?\7\4\2\2?\13\3\2\2\2@A\7\20\2\2AB\7\b\2\2BC\5\16\b\2"+ "CD\7\t\2\2D\r\3\2\2\2ET\t\3\2\2FG\7\5\2\2GT\7\6\2\2HI\7\5\2\2IN\5\16\b"+ "\2JK\7\n\2\2KM\5\16\b\2LJ\3\2\2\2MP\3\2\2\2NL\3\2\2\2NO\3\2\2\2OQ\3\2"+ "\2\2PN\3\2\2\2QR\7\6\2\2RT\3\2\2\2SE\3\2\2\2SF\3\2\2\2SH\3\2\2\2T\17\3"+ "\2\2\2\t\24\26%\60;NS"; public static final ATN _ATN = new ATNDeserializer().deserialize(_serializedATN.toCharArray()); static { _decisionToDFA = new DFA[_ATN.getNumberOfDecisions()]; for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) { _decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i); } } }src/java/org/dbdoclet/trafo/script/parser/TrafoScriptParserErrorListener.java0000644000175000017500000000264412644165236027741 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.script.parser; import java.util.ArrayList; import java.util.List; import org.antlr.v4.runtime.BaseErrorListener; import org.antlr.v4.runtime.RecognitionException; import org.antlr.v4.runtime.Recognizer; public class TrafoScriptParserErrorListener extends BaseErrorListener { private ArrayList errorList = new ArrayList<>(); @Override public void syntaxError(Recognizer recognizer, Object offendingSymbol, int line, int charPositionInLine, String msg, RecognitionException e) { errorList.add(String.format("%s:%d:%d %s", recognizer.getInputStream().getSourceName(), line, charPositionInLine, msg)); } public List getErrors() { return errorList; } } src/java/org/dbdoclet/trafo/script/Namespace.java0000644000175000017500000000521712644165236022203 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.script; import java.util.Collection; import java.util.HashMap; public class Namespace { private HashMap attributeRuleMap; private String name; private HashMap nodeRuleMap; private HashMap sectionMap; public Namespace(String name) { this.setName(name); sectionMap = new HashMap<>(); nodeRuleMap = new HashMap<>(); attributeRuleMap = new HashMap<>(); } public void addAttributeRule(AttributeRule attributeRule) { if (attributeRule == null) { return; } attributeRuleMap.put(attributeRule.getName(), attributeRule); } public void addNodeRule(NodeRule nodeRule) { if (nodeRule == null) { return; } nodeRuleMap.put(nodeRule.getName(), nodeRule); } public void addSection(Section section) { if (section == null) { return; } sectionMap.put(section.getName(), section); } public AttributeRule findAttributeRule(String name) { return attributeRuleMap.get(name); } public NodeRule findNodeRule(String name) { return nodeRuleMap.get(name); } public Section findSection(String name) { return sectionMap.get(name); } public Collection getAttributeRules() { return attributeRuleMap.values(); } public String getName() { return name; } public Collection getNodeRules() { return nodeRuleMap.values(); } public Collection
      getSections() { return sectionMap.values(); } public void setName(String name) { this.name = name; } public Section addSection(String sectionName) { if (sectionName == null || sectionName.trim().length() == 0) { return null; } Section section = new Section(sectionName); addSection(section); return section; } public Section findOrCreateSection(String name) { Section section = findSection(name); if (section == null) { section = new Section(name); addSection(section); } return section; } }src/java/org/dbdoclet/trafo/script/AttributeRule.java0000644000175000017500000000144412644165236023100 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.script; public class AttributeRule extends Section { } src/java/org/dbdoclet/trafo/script/Section.java0000644000175000017500000000462712644165236021717 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.script; import java.util.ArrayList; import java.util.Collection; import java.util.TreeMap; import org.dbdoclet.trafo.param.Param; import org.dbdoclet.trafo.param.TextParam; public class Section { private String name; private final TreeMap> parameterMap = new TreeMap<>(); public Section() { } public Section(String name) { this.name = name; } @SuppressWarnings("unchecked") public void addParam(Param param) { if (param == null) { return; } Param p = parameterMap.get(param.getName()); if (p == null) { parameterMap.put(param.getName(), param); } else { if (param.getClass().isInstance(p)) { ((Param) p).addValue(param.getValue()); } else { throw new IllegalStateException( String.format( "Parameter %s is defined twice with different types %s and %s!", param.getName(), param.getClass() .getSimpleName(), p.getClass() .getSimpleName())); } } } public String getName() { return name; } public void setName(String name) { this.name = name; } public Collection> getParameters() { return parameterMap.values(); } public Param findParameter(String paramName) { return parameterMap.get(paramName); } public void setParam(Param param) { parameterMap.put(param.getName(), param); } public void setListParam(String name, ArrayList textList) { Param> param = new Param<>(name, textList); parameterMap.put(name, param); } public TextParam findTextParameter(String paramName) { Param p = findParameter(paramName); if (TextParam.class.isInstance(p)) { return (TextParam) p; } return null; } } src/java/org/dbdoclet/trafo/script/NodeRule.java0000644000175000017500000000143712644165236022024 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.script; public class NodeRule extends Section { } src/java/org/dbdoclet/trafo/SpaceNormalizer.java0000644000175000017500000000325712644165236022103 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo; import org.dbdoclet.xiphias.XmlServices; import org.dbdoclet.xiphias.dom.INodeVisitor; import org.w3c.dom.Attr; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.w3c.dom.Text; public class SpaceNormalizer implements INodeVisitor { public void accept(Node node) { if (node instanceof Text) { Text textNode = (Text) node; textNode.setData(XmlServices.normalizeText(textNode)); } if (node instanceof Element) { Element elem = (Element) node; NamedNodeMap namedNodeMap = elem.getAttributes(); for (int i = 0; i < namedNodeMap.getLength(); i++) { Node attrNode = namedNodeMap.item(i); if (attrNode instanceof Attr) { Attr attr = (Attr) attrNode; attr.setValue(XmlServices.normalizeText(attr.getValue())); } } } } @Override public void openTag(Node node) throws Exception { // } @Override public void closeTag(Node node) throws Exception { // } } src/java/org/dbdoclet/trafo/TrafoException.java0000644000175000017500000000214712644165236021734 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo; public class TrafoException extends Exception { private static final long serialVersionUID = 1L; public TrafoException() { super(); } public TrafoException(String message) { super(message); } public TrafoException(String message, Throwable cause) { super(message, cause); } public TrafoException(Throwable cause) { super(cause); } } src/java/org/dbdoclet/trafo/TrafoScriptManager.java0000644000175000017500000001475012644165236022540 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.Writer; import java.util.List; import org.antlr.v4.runtime.ANTLRFileStream; import org.antlr.v4.runtime.ANTLRInputStream; import org.antlr.v4.runtime.CommonTokenStream; import org.antlr.v4.runtime.RecognitionException; import org.antlr.v4.runtime.tree.ParseTree; import org.antlr.v4.runtime.tree.ParseTreeWalker; import org.dbdoclet.trafo.param.Param; import org.dbdoclet.trafo.script.AttributeRule; import org.dbdoclet.trafo.script.Namespace; import org.dbdoclet.trafo.script.NodeRule; import org.dbdoclet.trafo.script.Script; import org.dbdoclet.trafo.script.Section; import org.dbdoclet.trafo.script.parser.TrafoScriptLexer; import org.dbdoclet.trafo.script.parser.TrafoScriptListener; import org.dbdoclet.trafo.script.parser.TrafoScriptListenerImpl; import org.dbdoclet.trafo.script.parser.TrafoScriptParser; import org.dbdoclet.trafo.script.parser.TrafoScriptParserErrorListener; public class TrafoScriptManager { /** * Parsen einer Skript-Datei. * * @param scriptFile * @return Script * @throws TrafoException */ public Script parseScript(File scriptFile) throws TrafoException { Script script = new Script(); parseScript(script, scriptFile, ""); return script; } public void parseScript(Script script, File scriptFile) throws TrafoException { parseScript(script, scriptFile, ""); } public void parseScript(Script script, File scriptFile, String namespace) throws TrafoException { try { TrafoScriptLexer lex = new TrafoScriptLexer(new ANTLRFileStream( scriptFile.getAbsolutePath(), "UTF8")); parseScript(script, lex, namespace); } catch (Exception oops) { throw new TrafoException(oops); } } public void parseScript(Script script, InputStream instr, String namespace) throws TrafoException { try { TrafoScriptLexer lex = new TrafoScriptLexer(new ANTLRInputStream( instr)); parseScript(script, lex, namespace); } catch (Exception oops) { throw new TrafoException(oops); } } /** * Parsen eines Skript-Puffers. * * @param scriptBuffer * @return Script * @throws IOException * @throws RecognitionException * @throws TrafoException */ public Script parseScript(String scriptBuffer) throws IOException, RecognitionException, TrafoException { TrafoScriptLexer lex = new TrafoScriptLexer(new ANTLRInputStream(scriptBuffer)); Script script = new Script(); parseScript(script, lex, ""); return script; } private Script parseScript(Script script, TrafoScriptLexer lex, String namespace) throws RecognitionException, TrafoException { CommonTokenStream tokens = new CommonTokenStream(lex); TrafoScriptParser parser = new TrafoScriptParser(tokens); parser.removeErrorListeners(); TrafoScriptParserErrorListener errorListener = new TrafoScriptParserErrorListener(); parser.addErrorListener(errorListener); ParseTree parserTree = parser.parse(); List errors = errorListener.getErrors(); if (errors != null && errors.size() > 0) { throw new TrafoException(errors.get(0)); } ParseTreeWalker walker = new ParseTreeWalker(); TrafoScriptListener listener = new TrafoScriptListenerImpl(script, namespace); walker.walk(listener, parserTree); return script; } public void parseScript(Script script, String scriptBuffer) throws TrafoException { try { TrafoScriptLexer lex = new TrafoScriptLexer(new ANTLRInputStream( scriptBuffer)); parseScript(script, lex, ""); } catch (Exception oops) { throw new TrafoException(oops); } } public void writeScript(Script script, File file) throws IOException { writeScript(Script.DEFAULT_NAMESPACE, script, file); } public void writeScript(String namespace, Script script, File file) throws IOException { writeScript(namespace, script, new FileWriter(file)); } public void writeScript(Script script, Writer writer) throws IOException { writeScript(Script.DEFAULT_NAMESPACE, script, writer); } public void writeScript(String namespaceName, Script script, Writer writer) throws IOException { PrintWriter printWriter = null; try { printWriter = new PrintWriter(writer); String transformationName = "trafo"; Param sysparam = script.getSystemParameter(namespaceName, Script.SYSPARAM_TRANSFORMATION_NAME); if (sysparam != null) { transformationName = (String) sysparam.getValue(); } printWriter.println(String.format("transformation %s;", transformationName)); Namespace namespace = script.getNamespace(namespaceName); if (namespace == null) { return; } for (Section section: namespace.getSections()) { if (section.getName().startsWith("SYS ")) { continue; } printWriter.println(String.format("%nsection %s {", section.getName())); for (Param param : section.getParameters()) { printWriter.println(String.format("\t%s;", param.toString())); } printWriter.println("}"); } for (NodeRule nodeRule : namespace.getNodeRules()) { printWriter.println(String.format("%nnode %s {", nodeRule.getName())); for (Param param : nodeRule.getParameters()) { printWriter.println(String.format("\t%s;", param.toString())); } printWriter.println("}"); } for (AttributeRule attributeRule : namespace.getAttributeRules()) { printWriter.println(String.format("%nattribute %s {", attributeRule.getName())); for (Param param : attributeRule.getParameters()) { printWriter.println(String.format("\t%s;", param.toString())); } printWriter.println("}"); } } finally { printWriter.close(); } } public void mergeNamespaces(Script script) { script.mergeNamespaces(); } } src/java/org/dbdoclet/trafo/SectionNumberRemover.java0000644000175000017500000000474712644165236023127 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.dbdoclet.service.StringServices; import org.dbdoclet.xiphias.dom.INodeVisitor; import org.w3c.dom.Attr; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.w3c.dom.Text; public class SectionNumberRemover implements INodeVisitor { private String regex = null; public String getRegex() { return regex; } public void setRegex(String regex) { this.regex = regex; } @Override public void accept(Node node) { if (regex == null) { return; } if (node instanceof Text) { Text textNode = (Text) node; String text = textNode.getData(); text = stripSectionNumber(text, regex); if (text != null) { textNode.setData(text); } } if (node instanceof Element) { Element elem = (Element) node; NamedNodeMap namedNodeMap = elem.getAttributes(); for (int i = 0; i < namedNodeMap.getLength(); i++) { Node attrNode = namedNodeMap.item(i); if (attrNode instanceof Attr) { Attr attr = (Attr) attrNode; String value = stripSectionNumber(attr.getValue(), regex); attr.setValue(value); } } } } public static String stripSectionNumber(String title, String regex) { if (title == null) { return null; } if (regex == null) { return title; } regex = "(" + regex + ").*"; Pattern pattern = Pattern.compile(regex, Pattern.DOTALL); Matcher matcher = pattern.matcher(title); if (matcher.matches()) { String sectionNumber = matcher.group(1); title = StringServices.cutPrefix(title, sectionNumber); } return title; } @Override public void openTag(Node node) throws Exception { // } @Override public void closeTag(Node node) throws Exception { // } } src/java/org/dbdoclet/trafo/TrafoExceptionHandler.java0000644000175000017500000000167712644165236023241 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo; public class TrafoExceptionHandler { public static Throwable getCause(Throwable oops) { Throwable cause = oops; while (cause.getCause() != null) { cause = cause.getCause(); } return cause; } } src/java/org/dbdoclet/trafo/param/0000755000175000017500000000000012644165236017233 5ustar mathieumathieusrc/java/org/dbdoclet/trafo/param/TextParam.java0000644000175000017500000000155612644165236022012 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.param; public class TextParam extends Param { public TextParam(String name, String value) { super(name, value); } } src/java/org/dbdoclet/trafo/param/Param.java0000644000175000017500000000656512644165236021152 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.param; import java.util.ArrayList; import org.dbdoclet.service.StringServices; public class Param { private String name; private final ArrayList valueList; private boolean enabled = true; public Param(String name, T value) { this.name = name; valueList = new ArrayList(); valueList.add(value); } public String getName() { return name; } public void setName(String name) { this.name = name; } public T getValue() { if (valueList.size() == 0) { return null; } return valueList.get(0); } public T getValue(int index) { if (index < 0 && index >= valueList.size()) { return null; } return valueList.get(index); } public ArrayList getValues() { return valueList; } public void setValue(T value) { valueList.clear(); valueList.add(value); } public boolean isArray() { return valueList.size() > 1; } // public boolean isEnabled() { // // T value = getValue(); // // if (value instanceof Boolean) { // return ((Boolean) value).booleanValue(); // } // // if (value instanceof String) { // return Boolean.valueOf((String) value); // } // // if (value instanceof Number) { // return ((Number) value).doubleValue() != 0; // } // // return false; // } public String getValueAsText() { if (valueList == null || valueList.size() == 0) { return null; } if (valueList.size() == 1) { return getValue().toString(); } StringBuilder buffer = new StringBuilder(); for (T value : valueList) { if (value == null) { continue; } buffer.append(value.toString()); buffer.append(", "); } String ret = buffer.toString().trim(); return StringServices.cutSuffix(ret, ","); } @Override public String toString() { StringBuilder buffer = new StringBuilder(); buffer.append(name); buffer.append(" = "); if (valueList != null) { if (valueList.size() == 1) { Object valueObject = valueList.get(0); appendValueObject(buffer, valueObject); } if (valueList.size() > 1) { buffer.append("[ "); for (Object valueObject : valueList) { appendValueObject(buffer, valueObject); buffer.append(", "); } buffer.replace(buffer.length() - 2, buffer.length(), " ]"); } } return buffer.toString(); } private void appendValueObject(StringBuilder buffer, Object valueObject) { if (valueObject instanceof String) { buffer.append('"'); buffer.append(valueObject); buffer.append('"'); } else { buffer.append(valueObject); } } public void setEnabled(boolean enabled) { this.enabled = enabled; } public boolean isEnabled() { return enabled; } public void addValue(T value) { valueList.add(value); } } src/java/org/dbdoclet/trafo/param/NumberParam.java0000644000175000017500000000156412644165236022315 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.param; public class NumberParam extends Param { public NumberParam(String name, Integer value) { super(name, value); } } src/java/org/dbdoclet/trafo/param/BooleanParam.java0000644000175000017500000000167412644165236022446 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.param; /** * Parameter mit boolschem Wert. * * @author Michael Fuchs */ public class BooleanParam extends Param { public BooleanParam(String name, Boolean value) { super(name, value); } } src/java/org/dbdoclet/trafo/TrafoConstants.java0000644000175000017500000001113212644165236021744 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo; public class TrafoConstants { public static final boolean DEFAULT_DECOMPOSE_TABLES = false; public static final String DEFAULT_DESTINATION_ENCODING = "UTF-8"; public static final String DEFAULT_EMPHASIS_ROLE_BOLD = "bold"; public static final String DEFAULT_EMPHASIS_ROLE_ITALIC = "italic"; public static final String DEFAULT_EMPHASIS_ROLE_UNDERLINE = "underline"; public static final String DEFAULT_IMAGE_PATH = "./"; public static final int DEFAULT_MAX_LINE_WIDTH = 75; public static final String DEFAULT_SOURCE_ENCODING = "UTF-8"; public static final String DEFAULT_TABLE_STYLE = "all"; // public static final String DEFAULT_SECTION_NUMBERING_PATTERN = // "(((\\d\\.)+)?\\d*\\.?\\p{Z}*).*"; public static final String PARAM_ABSTRACT = "abstract"; public static final String PARAM_ADD_INDEX = "add-index"; public static final String PARAM_ATTRIBUTE_CLASS = "attribute-class"; public static final String PARAM_AUTHOR_EMAIL = "author-email"; public static final String PARAM_AUTHOR_FIRSTNAME = "author-firstname"; public static final String PARAM_AUTHOR_SURNAME = "author-surname"; public static final String PARAM_CHUNK_ELEMENTS = "chunk-elements"; public static final String PARAM_COLLAPSE_PROTECTED_SPACE = "collapse-protected-space"; public static final String PARAM_COPYRIGHT_HOLDER = "copyright-holder"; public static final String PARAM_COPYRIGHT_YEAR = "copyright-year"; public static final String PARAM_CORPORATION = "corporation"; public static final String PARAM_CREATE_CONDITION_ATTRIBUTE = "create-condition-attribute"; public static final String PARAM_CREATE_PROLOG = "create-prolog"; public static final String PARAM_CREATE_REMAP_ATTRIBUTE = "create-remap-attribute"; public static final String PARAM_CREATE_XREF_LABEL = "create-xref-label"; public static final String PARAM_DECOMPOSE_TABLES = "decompose-tables"; public static final String PARAM_DETECT_TRAPPED_BR = "detect-trapped-br"; public static final String PARAM_DOCBOOK_VERSION = "docbook-version"; public static final String PARAM_DOCUMENT_ELEMENT = "document-element"; public static final String PARAM_DOCUMENTATION_ID = "documentation-id"; public static final String PARAM_ENCODING = "encoding"; public static final String PARAM_EXCLUDE = "exclude"; public static final String PARAM_FILE = "file"; public static final String PARAM_HYPHENATION_CHAR = "hyphenation-char"; public static final String PARAM_IMAGE_PATH = "image-path"; public static final String PARAM_IMAGEDATA_FORMATS = "image-data-formats"; public static final String PARAM_ITEMIZED_ATTRIBUTE_CLASS = "itemized-attribute-class"; public static final String PARAM_ITEMIZED_STRIP_PREFIX = "itemized-strip-prefix"; public static final String PARAM_LANGUAGE = "language"; public static final String PARAM_ORDERED_ATTRIBUTE_CLASS = "ordered-attribute-class"; public static final String PARAM_ORDERED_STRIP_PREFIX = "ordered-strip-prefix"; public static final String PARAM_RELEASE_INFO = "release-info"; public static final String PARAM_SECTION_NUMBERING_PATTERN = "section-numbering-pattern"; public static final String PARAM_TABLE_STYLE = "table-style"; public static final String PARAM_TITLE = "title"; public static final String PARAM_TITLE_NORMALIZE_SPACE = "title-normalize-space"; public static final String PARAM_USE_ABSOLUTE_IMAGE_PATH = "use-absolute-image-path"; public static final String SECTION_DITA = "DITA"; public static final String SECTION_DOCBOOK = "DocBook"; public static final String SECTION_HTML = "HTML"; public static final String SECTION_IMPORT = "import"; public static final String SECTION_INPUT = "input"; public static final String SECTION_LIST_DETECTION = "list-detection"; public static final String SECTION_MAIN = "main"; public static final String SECTION_OUTPUT = "output"; public static final String SECTION_SECTION_DETECTION = "section-detection"; public static final String VAR_IMAGE_SUBPATH = "image-subpath"; } src/java/org/dbdoclet/trafo/TrafoService.java0000644000175000017500000000257212644165236021400 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo; import java.io.File; import java.io.InputStream; import java.io.OutputStream; import org.dbdoclet.progress.ProgressListener; import org.dbdoclet.trafo.script.Script; public interface TrafoService { public String getId(); /** * Transformation auf Basis einer TrafoScript-Datei. * * @param script * @param listener * @return TrafoResult */ public TrafoResult transform(Script script); public void addProgressListener(ProgressListener listener); public void removeProgressListener(ProgressListener listener); public void setInputStream(InputStream in); public void setOutputStream(OutputStream out); public File getSystemId(); } src/java/org/dbdoclet/trafo/TrafoResult.java0000644000175000017500000000705712644165236021261 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo; import java.io.File; import java.io.FileNotFoundException; import java.io.PrintWriter; import java.io.StringWriter; import javax.xml.transform.ErrorListener; import javax.xml.transform.TransformerException; import org.dbdoclet.service.StringServices; import org.dbdoclet.xiphias.dom.NodeImpl; /** * Die Klasse TrafoResult speichert das Protokoll einer * Transformation. * * @author michael * */ public class TrafoResult implements ErrorListener { private File file; private StringBuffer buffer; private byte[] data; private Throwable throwable; private boolean failed = false; private NodeImpl rootNode; public TrafoResult() { super(); buffer = new StringBuffer(); } public TrafoResult(File file) { if (file == null) { throw new IllegalArgumentException( "The argument file must not be null!"); } this.file = file; buffer = new StringBuffer(); } public void append(String line) { buffer.append(line); } public void error(TransformerException exception) throws TransformerException { buffer.append("[error] " + exception.getMessage()); buffer.append('\n'); } public void fatalError(TransformerException exception) throws TransformerException { buffer.append("[fatal] " + exception.getMessage()); buffer.append('\n'); failed = true; } public String getBuffer() { return buffer.toString(); } public byte[] getData() { return data; } public File getFile() { return file; } public NodeImpl getRootNode() { return rootNode; } public Throwable getThrowable() { return throwable; } public boolean isFailed() { return failed; } public void setData(byte[] data) { this.data = data; } public void setRootNode(NodeImpl rootNode) { this.rootNode = rootNode; } public void setThrowable(Throwable throwable) { this.throwable = throwable; if (throwable != null) { failed = true; } } /** * Generiert eine Zusammenfassung des Protokolls */ @Override public String toString() { StringBuilder builder = new StringBuilder(); builder.append('\n'); builder.append(StringServices.createBox("TRANSFORMATION PROTOCOL")); if (buffer != null) { builder.append("=== STDOUT/STDERR ===\n"); builder.append(buffer); } if (throwable != null) { if (throwable instanceof FileNotFoundException) { builder.append("[ERROR] File not found: " + throwable.getMessage()); } else { builder.append("\n=== EXCEPTION ===\n"); StringWriter strBuffer = new StringWriter(); throwable.printStackTrace(new PrintWriter(strBuffer)); builder.append(strBuffer.toString()); } } builder.append(">>TRANSFORMATION FINISHED.\n\n"); return builder.toString(); } public void warning(TransformerException exception) throws TransformerException { buffer.append(exception.getMessage()); buffer.append('\n'); } } src/java/org/dbdoclet/trafo/AbstractTrafoService.java0000644000175000017500000000203612644165236023057 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo; import java.io.File; public abstract class AbstractTrafoService implements TrafoService { private File systemId; @Override public File getSystemId() { return systemId; } public void setSystemId(File systemId) { this.systemId = systemId; } public String toString() { return getId(); } } src/java/org/dbdoclet/trafo/internal/0000755000175000017500000000000012644165236017747 5ustar mathieumathieusrc/java/org/dbdoclet/trafo/internal/html/0000755000175000017500000000000012644165236020713 5ustar mathieumathieusrc/java/org/dbdoclet/trafo/internal/html/docbook/0000755000175000017500000000000012644165236022333 5ustar mathieumathieusrc/java/org/dbdoclet/trafo/internal/html/docbook/PostprocessStage2.java0000644000175000017500000000611612644165236026574 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.docbook; import java.util.ArrayList; import org.dbdoclet.progress.ProgressEvent; import org.dbdoclet.progress.ProgressListener; import org.dbdoclet.tag.docbook.BaseTagFactory; import org.dbdoclet.tag.docbook.SectionElement; import org.dbdoclet.trafo.SectionNumberRemover; import org.dbdoclet.trafo.SpaceNormalizer; import org.dbdoclet.trafo.TrafoConstants; import org.dbdoclet.trafo.script.Script; import org.dbdoclet.xiphias.dom.AbstractNodeVisitor; import org.dbdoclet.xiphias.dom.ElementImpl; import org.dbdoclet.xiphias.dom.NodeImpl; import org.w3c.dom.Node; public class PostprocessStage2 extends AbstractNodeVisitor { private final BaseTagFactory dbfactory; private final ArrayList removeList; private final Script script; public PostprocessStage2(BaseTagFactory dbfactory, Script script, ArrayList listeners) { super(listeners); this.dbfactory = dbfactory; this.script = script; removeList = new ArrayList(); } public void finish() { removeNodes(removeList); } @Override public void accept(Node node) throws Exception { fireProgressEvent(node.toString(), ProgressEvent.STAGE_ACTION); if (node instanceof ElementImpl) { NodeImpl elem = (NodeImpl) node; if (elem instanceof SectionElement) { SectionElement sect = (SectionElement) elem; NodeImpl title = sect.findChildElement("title"); if (title != null) { SectionNumberRemover snr = new SectionNumberRemover(); snr.setRegex(script.getTextParameter( TrafoConstants.SECTION_SECTION_DETECTION, TrafoConstants.PARAM_SECTION_NUMBERING_PATTERN, null)); title.traverse(snr); if (script.isParameterOn(TrafoConstants.SECTION_DOCBOOK, TrafoConstants.PARAM_TITLE_NORMALIZE_SPACE, false)) { SpaceNormalizer sn = new SpaceNormalizer(); title.traverse(sn); } } String titleText = sect.getTitle(); if (titleText.length() == 0 && sect.hasContentChildren() == false) { removeList.add(sect); return; } if (titleText.length() > 0 && sect.hasContentChildren() == false) { sect.appendChild(dbfactory.createPara("")); return; } } } } @Override public void openTag(Node node) throws Exception { // Auto-generated method stub } @Override public void closeTag(Node node) throws Exception { // Auto-generated method stub } } src/java/org/dbdoclet/trafo/internal/html/docbook/PostprocessStage3.java0000644000175000017500000000442612644165236026577 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.docbook; import java.util.HashMap; import org.dbdoclet.tag.docbook.DocBookElement; import org.dbdoclet.tag.docbook.DocBookTagFactory; import org.dbdoclet.tag.docbook.Entrytbl; import org.dbdoclet.tag.docbook.Informaltable; import org.dbdoclet.tag.docbook.Tgroup; import org.dbdoclet.tag.docbook.Xref; public class PostprocessStage3 { private final DocBookTagFactory dbfactory; private final HashMap subtables; public PostprocessStage3(DocBookTagFactory dbfactory, HashMap subtables) { this.dbfactory = dbfactory; this.subtables = subtables; } public void process() { if ((subtables != null) && (subtables.size() > 0)) { int index = 1; for (Entrytbl entrytbl : subtables.keySet()) { String id = "subtable." + index; Xref xref = dbfactory.createXref(id); DocBookElement table = subtables.get(entrytbl); DocBookElement entryTblParent = (DocBookElement) entrytbl .getParentNode(); entryTblParent.replaceChild(dbfactory.createEntry() .appendChild(xref), entrytbl); Informaltable it = dbfactory.createInformaltable(); it.setId(id); it.setXrefLabel("#" + index); Tgroup tgroup = dbfactory.createTgroup(); tgroup.setChildNodes(entrytbl.getChildNodes()); tgroup.setTrafoAttributes(entrytbl.getAttributesAsMap()); it.appendChild(tgroup); DocBookElement tableParent = (DocBookElement) table .getParentNode(); if (tableParent != null) { tableParent.insertAfter(it, table); } index++; } } } } src/java/org/dbdoclet/trafo/internal/html/docbook/LinkManager.java0000644000175000017500000000461412644165236025373 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.docbook; import java.util.ArrayList; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.dbdoclet.service.StringServices; import org.dbdoclet.xiphias.dom.ElementImpl; public class LinkManager { private static Log logger = LogFactory.getLog(LinkManager.class); private final ArrayList anchorIdList; private final ArrayList linkList; private final ArrayList usedIdList; public LinkManager() { linkList = new ArrayList(); anchorIdList = new ArrayList(); usedIdList = new ArrayList(); } public void addLink(ElementImpl link) { linkList.add(link); } public String createUniqueId(String str) { String id = str; id = ElementImpl.hardenId(id); String key = id; int counter = 1; while (anchorIdList.contains(key)) { key = id + "." + counter; counter++; } anchorIdList.add(key); logger.debug("Added reference " + key + "."); return key; } public ArrayList getLinkList() { return linkList; } public String getUniqueId(String str) { String id = str; logger.debug("#1 id=" + id); id = StringServices.cutPrefix(id, "#"); id = ElementImpl.hardenId(id); logger.debug("#2 id=" + id); if (id == null || id.length() == 0) { id = "dbdoclet.id"; } if (usedIdList.contains(id) == false) { usedIdList.add(id); } logger.debug("#3 id=" + id); return id; } public ArrayList getUnresolvedIds() { ArrayList list = new ArrayList(usedIdList); list.removeAll(anchorIdList); return list; } public ArrayList getUsedIdList() { return anchorIdList; } } src/java/org/dbdoclet/trafo/internal/html/docbook/editor/0000755000175000017500000000000012644165236023621 5ustar mathieumathieusrc/java/org/dbdoclet/trafo/internal/html/docbook/editor/UlEditor.java0000644000175000017500000000324612644165236026220 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.docbook.editor; import org.dbdoclet.tag.docbook.BaseTagFactory; import org.dbdoclet.trafo.html.EditorException; import org.dbdoclet.trafo.html.EditorInstruction; import org.dbdoclet.xiphias.dom.NodeListImpl; public class UlEditor extends DocBookEditor { @Override public EditorInstruction edit(EditorInstruction values) throws EditorException { setValues(super.edit(values)); BaseTagFactory dbfactory = getTagFactory(); NodeListImpl children = getHtmlElement().getTrafoChildNodes(); if (children.size() == 0) { return finalizeValues(); } if (isList(getParent())) { setCurrent(dbfactory.createListitem()); getCurrent().setParentNode(getParent()); getParent().appendChild(getCurrent()); setParent(getCurrent()); } setCurrent(dbfactory.createItemizedlist()); getCurrent().setParentNode(getParent()); getParent().appendChild(getCurrent()); traverse(true); return finalizeValues(); } } src/java/org/dbdoclet/trafo/internal/html/docbook/editor/StrikeEditor.java0000644000175000017500000000346612644165236027105 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.docbook.editor; import org.dbdoclet.tag.docbook.BaseTagFactory; import org.dbdoclet.tag.docbook.Emphasis; import org.dbdoclet.tag.docbook.Simpara; import org.dbdoclet.trafo.html.EditorException; import org.dbdoclet.trafo.html.EditorInstruction; public class StrikeEditor extends DocBookEditor { @Override public EditorInstruction edit(EditorInstruction values) throws EditorException { setValues(super.edit(values)); BaseTagFactory dbfactory = getTagFactory(); traverse(true); Emphasis emphasis = dbfactory.createEmphasis(); emphasis.setRole("strikethrough"); setCurrent(emphasis); if (emphasis.isValidParent(script.getTransformPosition(), getParent()) == false) { Simpara candidate = dbfactory.createSimpara(); candidate.setParentNode(getParent()); if (candidate.isValidParent(script.getTransformPosition(), getParent())) { getParent().appendChild(candidate); candidate.appendChild(getCurrent()); } } else { getCurrent().setParentNode(getParent()); getParent().appendChild(getCurrent()); } return finalizeValues(); } } src/java/org/dbdoclet/trafo/internal/html/docbook/editor/HeadingEditor.java0000644000175000017500000000574312644165236027203 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.docbook.editor; import java.util.HashMap; import org.dbdoclet.option.OptionException; import org.dbdoclet.tag.docbook.DocBookTagFactory; import org.dbdoclet.tag.docbook.Title; import org.dbdoclet.tag.html.HtmlDocument; import org.dbdoclet.tag.html.HtmlElement; import org.dbdoclet.trafo.html.EditorException; import org.dbdoclet.trafo.html.EditorInstruction; import org.dbdoclet.trafo.html.docbook.SectionDetector; import org.dbdoclet.xiphias.dom.ElementImpl; public class HeadingEditor extends DocBookEditor { public static HashMap> validHtmlParentPathMap; static { validHtmlParentPathMap = new HashMap>(); validHtmlParentPathMap.put(new HtmlDocument().getNodeName(), HtmlElement.getAttributeMap()); validHtmlParentPathMap.put(org.dbdoclet.tag.html.Html.getTag(), HtmlElement.getAttributeMap()); validHtmlParentPathMap.put(org.dbdoclet.tag.html.Body.getTag(), HtmlElement.getAttributeMap()); validHtmlParentPathMap.put(org.dbdoclet.tag.html.Center.getTag(), HtmlElement.getAttributeMap()); validHtmlParentPathMap.put(org.dbdoclet.tag.html.Div.getTag(), HtmlElement.getAttributeMap()); validHtmlParentPathMap.put(org.dbdoclet.tag.html.A.getTag(), HtmlElement.getAttributeMap()); } // private HeaderElement header; @Override public EditorInstruction edit(EditorInstruction values) throws EditorException { try { setValues(super.edit(values)); DocBookTagFactory dbfactory = getTagFactory(); ElementImpl headElement = values.getHtmlElement(); HtmlElement parent = (HtmlElement) headElement.getParentNode(); if (parent instanceof org.dbdoclet.tag.html.Section || parent instanceof org.dbdoclet.tag.html.Article || parent instanceof org.dbdoclet.tag.html.Header) { Title title = dbfactory.createTitle(); getCurrent().appendChild(title); setCurrent(title); return finalizeValues(); } SectionDetector sectionDetector = new SectionDetector(); sectionDetector.setScript(script); sectionDetector.setTagFactory(dbfactory); sectionDetector.edit(values, dbfactory); return finalizeValues(); } catch (OptionException oops) { throw new EditorException(oops); } // end of try-catch } } src/java/org/dbdoclet/trafo/internal/html/docbook/editor/H5Editor.java0000644000175000017500000000150112644165236026104 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.docbook.editor; public class H5Editor extends HeadingEditor { } src/java/org/dbdoclet/trafo/internal/html/docbook/editor/AcronymEditor.java0000644000175000017500000000264512644165236027252 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.docbook.editor; import org.dbdoclet.tag.docbook.Acronym; import org.dbdoclet.tag.docbook.BaseTagFactory; import org.dbdoclet.trafo.html.EditorException; import org.dbdoclet.trafo.html.EditorInstruction; public class AcronymEditor extends DocBookEditor { @Override public EditorInstruction edit(EditorInstruction values) throws EditorException { setValues(super.edit(values)); BaseTagFactory dbfactory = getTagFactory(); Acronym candidate = dbfactory.createAcronym(); if (candidate.isValidParent(script.getTransformPosition(), getParent())) { setCurrent(candidate); getParent().appendChild(getCurrent()); } traverse(true); return finalizeValues(); } } src/java/org/dbdoclet/trafo/internal/html/docbook/editor/AbbrEditor.java0000644000175000017500000000264112644165236026504 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.docbook.editor; import org.dbdoclet.tag.docbook.Abbrev; import org.dbdoclet.tag.docbook.BaseTagFactory; import org.dbdoclet.trafo.html.EditorException; import org.dbdoclet.trafo.html.EditorInstruction; public class AbbrEditor extends DocBookEditor { @Override public EditorInstruction edit(EditorInstruction values) throws EditorException { setValues(super.edit(values)); BaseTagFactory dbfactory = getTagFactory(); Abbrev candidate = dbfactory.createAbbrev(); if (candidate.isValidParent(script.getTransformPosition(), getParent())) { setCurrent(candidate); getParent().appendChild(getCurrent()); } traverse(true); return finalizeValues(); } } src/java/org/dbdoclet/trafo/internal/html/docbook/editor/H1Editor.java0000644000175000017500000000147312644165236026110 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.docbook.editor; public class H1Editor extends HeadingEditor { } src/java/org/dbdoclet/trafo/internal/html/docbook/editor/HtmlEditor.java0000644000175000017500000000346412644165236026546 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.docbook.editor; import org.dbdoclet.tag.docbook.Article; import org.dbdoclet.tag.docbook.BaseTagFactory; import org.dbdoclet.tag.html.HtmlElement; import org.dbdoclet.trafo.html.EditorException; import org.dbdoclet.trafo.html.EditorInstruction; import org.dbdoclet.xiphias.XmlConstants; public class HtmlEditor extends DocBookEditor { @Override public EditorInstruction edit(EditorInstruction values) throws EditorException { setValues(super.edit(values)); BaseTagFactory dbfactory = getTagFactory(); Article article = dbfactory.createArticle(); HtmlElement child = getHtmlElement(); String lang = child.getAttribute("lang"); if (lang == null) { lang = child.getAttributeNS(XmlConstants.NAMESPACE_XML, "lang"); } setCurrent(article); traverse(true); article.setAttribute("xmlns", "http://docbook.org/ns/docbook"); article.setAttribute("version", "5.0"); if (lang != null) { article.setAttributeNS(XmlConstants.NAMESPACE_XML, "xml:lang", lang.toLowerCase()); } getParent().appendChild(getCurrent()); return finalizeValues(); } } src/java/org/dbdoclet/trafo/internal/html/docbook/editor/DivEditor.java0000644000175000017500000001326112644165236026360 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.docbook.editor; import org.dbdoclet.tag.docbook.Anchor; import org.dbdoclet.tag.docbook.Book; import org.dbdoclet.tag.docbook.Chapter; import org.dbdoclet.tag.docbook.DocBookElement; import org.dbdoclet.tag.docbook.DocBookTagFactory; import org.dbdoclet.tag.docbook.Para; import org.dbdoclet.tag.docbook.Part; import org.dbdoclet.tag.docbook.Refentry; import org.dbdoclet.tag.docbook.Refnamediv; import org.dbdoclet.tag.docbook.Refsection; import org.dbdoclet.tag.docbook.Reference; import org.dbdoclet.tag.html.Div; import org.dbdoclet.trafo.html.EditorException; import org.dbdoclet.trafo.html.EditorInstruction; import org.dbdoclet.trafo.html.docbook.SectionDetector; import org.dbdoclet.trafo.script.Script; import org.dbdoclet.xiphias.dom.NodeImpl; public class DivEditor extends DocBookEditor { private static final int TIP = 1; private static final int NOTE = 2; private static final int WARNING = 3; private static final int CAUTION = 4; private static final int IMPORTANT = 5; private void addAdmonition(DocBookTagFactory dbfactory, int type, String title) { DocBookElement admon; NodeImpl parent = getParent(); switch (type) { case CAUTION: admon = dbfactory.createCaution(); break; case IMPORTANT: admon = dbfactory.createImportant(); break; case NOTE: admon = dbfactory.createNote(); break; case TIP: admon = dbfactory.createTip(); break; case WARNING: admon = dbfactory.createWarning(); break; default: admon = null; break; } if (admon == null) { return; } if (title != null && title.length() > 0) { admon.appendChild(dbfactory.createTitle(title)); } Para para = dbfactory.createPara(); admon.appendChild(para); parent.appendChild(admon); setCurrent(para); } @Override public EditorInstruction edit(EditorInstruction values) throws EditorException { setValues(super.edit(values)); Script script = values.getScript(); DocBookTagFactory dbfactory = getTagFactory(); Div div = (Div) getHtmlElement(); SectionDetector sectionDetector = new SectionDetector(); sectionDetector.setScript(script); sectionDetector.setTagFactory(dbfactory); if (sectionDetector.isSection(div)) { sectionDetector.edit(values, dbfactory); setValues(values); return finalizeValues(); } String type = null; String id = div.getId(); String clazz = div.getCssClass(); String title = div.getTitle(); NodeImpl parent = getParent(); traverse(true); ignore(false); if ((id != null) && (id.length() > 0)) { type = id.toLowerCase(); } if ((type == null) && (clazz != null) && (clazz.length() > 0)) { type = clazz.toLowerCase(); } if ((type != null) && (type.length() > 0)) { if (type.startsWith("example")) { if ((title != null) && (title.length() > 0)) { setCurrent(dbfactory.createExample(title)); } else { setCurrent(dbfactory.createInformalexample()); } parent.appendChild(getCurrent()); getCurrent().setParentNode(parent); return finalizeValues(); } if (type.startsWith("formalpara")) { if ((title != null) && (title.length() > 0)) { setCurrent(dbfactory.createFormalpara(title)); } else { setCurrent(dbfactory.createFormalpara()); } parent.appendChild(getCurrent()); return finalizeValues(); } if (type.startsWith("caution")) { addAdmonition(dbfactory, CAUTION, title); return finalizeValues(); } if (type.startsWith("important")) { addAdmonition(dbfactory, IMPORTANT, title); return finalizeValues(); } if (type.startsWith("note")) { addAdmonition(dbfactory, NOTE, title); return finalizeValues(); } if (type.startsWith("tip") || type.startsWith("hint")) { addAdmonition(dbfactory, TIP, title); return finalizeValues(); } if (type.startsWith("warning")) { addAdmonition(dbfactory, WARNING, title); return finalizeValues(); } } if (parent instanceof Book || parent instanceof Part) { Chapter chapter = dbfactory.createChapter(AUTOMATICALLY_INSERTED); parent.appendChild(chapter); Para para = dbfactory.createPara(); chapter.appendChild(para); parent = para; setCurrent(para); } if (parent instanceof Reference) { Refentry refEntry = dbfactory.createRefentry(); parent.appendChild(refEntry); Refnamediv refNameDiv = dbfactory.createRefnamediv(); refNameDiv.appendChild(dbfactory .createRefname(AUTOMATICALLY_INSERTED)); refNameDiv.appendChild(dbfactory.createRefpurpose()); refEntry.appendChild(refNameDiv); Refsection refSection = dbfactory .createRefsection(AUTOMATICALLY_INSERTED); refEntry.appendChild(refSection); Para para = dbfactory.createPara(); refSection.appendChild(para); parent = para; setCurrent(para); } if (id != null) { Anchor anchor = dbfactory.createAnchor(); copyCommonAttributes(getHtmlElement(), anchor); parent.appendChild(anchor); } traverse(true); ignore(true); return finalizeValues(); } } src/java/org/dbdoclet/trafo/internal/html/docbook/editor/TextEditor.java0000644000175000017500000000426212644165236026563 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.docbook.editor; import org.dbdoclet.tag.docbook.BaseTagFactory; import org.dbdoclet.tag.docbook.Listitem; import org.dbdoclet.tag.docbook.Para; import org.dbdoclet.trafo.TrafoConstants; import org.dbdoclet.trafo.html.EditorException; import org.dbdoclet.trafo.html.EditorInstruction; import org.dbdoclet.xiphias.dom.NodeImpl; public class TextEditor extends DocBookEditor { @Override public EditorInstruction edit(EditorInstruction values) throws EditorException { try { setValues(super.edit(values)); BaseTagFactory dbfactory = getTagFactory(); NodeImpl current = getCurrent(); NodeImpl parent = getParent(); if (isSection(parent)) { if (getCharacterDataNode().getNodeType() == NodeImpl.TEXT_NODE) { Para para = dbfactory.createPara(); parent.appendChild(para); setParent(para); parent = para; setCurrent(para); current = para; } } if (isList(parent)) { Listitem item = dbfactory.createListitem(); parent.appendChild(item); setParent(item); parent = item; setCurrent(item); current = item; } String text = getCharacterDataNode().getData(); if (script.isParameterOn(TrafoConstants.SECTION_DOCBOOK, TrafoConstants.PARAM_COLLAPSE_PROTECTED_SPACE, false)) { text = text.replace('\u00a0', ' '); } current.appendChild(text); return finalizeValues(); } catch (Exception oops) { throw new EditorException(oops); } } } src/java/org/dbdoclet/trafo/internal/html/docbook/editor/javadoc/0000755000175000017500000000000012644165236025230 5ustar mathieumathieusrc/java/org/dbdoclet/trafo/internal/html/docbook/editor/javadoc/CodeEditor.java0000644000175000017500000000254112644165236030116 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.docbook.editor.javadoc; import org.dbdoclet.tag.docbook.DocBookTagFactory; import org.dbdoclet.trafo.html.EditorInstruction; import org.dbdoclet.trafo.internal.html.docbook.editor.DocBookEditor; public class CodeEditor extends DocBookEditor { @Override public EditorInstruction edit(EditorInstruction values) { setValues(values); DocBookTagFactory dbfactory = getTagFactory(); org.dbdoclet.tag.javadoc.Code code = (org.dbdoclet.tag.javadoc.Code) getHtmlElement(); getCurrent().appendChild(dbfactory.createComputeroutput(code.getTextContent())); traverse(false); return finalizeValues(); } } src/java/org/dbdoclet/trafo/internal/html/docbook/editor/javadoc/LinkEditor.java0000644000175000017500000000472012644165236030142 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.docbook.editor.javadoc; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.dbdoclet.tag.docbook.DocBookTagFactory; import org.dbdoclet.tag.docbook.Emphasis; import org.dbdoclet.tag.docbook.Literal; import org.dbdoclet.trafo.html.EditorInstruction; import org.dbdoclet.trafo.internal.html.docbook.editor.DocBookEditor; import org.dbdoclet.xiphias.dom.NodeImpl; /** * The class LinkEditor is reponsible for transforming @link tags * into DocBook code. * * @author Michael Fuchs * @version $Revision$ */ public class LinkEditor extends DocBookEditor { private static Log logger = LogFactory.getLog(LinkEditor.class); @Override public EditorInstruction edit(EditorInstruction values) { setValues(values); DocBookTagFactory dbfactory = getTagFactory(); NodeImpl parent = getParent(); org.dbdoclet.tag.javadoc.Link link = (org.dbdoclet.tag.javadoc.Link) getHtmlElement(); String ref = link.getRef(); logger.debug("ref=" + ref); if ((ref != null) && (ref.length() > 0)) { String name = link.getName(); String label = link.getTextContent(); Literal elem; if (parent instanceof Literal) { elem = (Literal) parent; } else { elem = dbfactory.createLiteral(); setCurrent(elem); parent.appendChild(getCurrent()); } if ((label != null) && (label.length() > 0)) { elem.appendChild(dbfactory.createLink(label, ref)); } else { elem.appendChild(dbfactory.createLink(name, ref)); } } else { Emphasis elem = dbfactory.createEmphasis(link.getName()); setCurrent(elem); parent.appendChild(getCurrent()); } traverse(false); return finalizeValues(); } } src/java/org/dbdoclet/trafo/internal/html/docbook/editor/javadoc/LinkplainEditor.java0000644000175000017500000000433412644165236031167 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.docbook.editor.javadoc; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.dbdoclet.tag.docbook.DocBookTagFactory; import org.dbdoclet.tag.docbook.Emphasis; import org.dbdoclet.tag.docbook.Link; import org.dbdoclet.tag.docbook.Xref; import org.dbdoclet.tag.javadoc.Linkplain; import org.dbdoclet.trafo.html.EditorInstruction; import org.dbdoclet.trafo.internal.html.docbook.editor.DocBookEditor; public class LinkplainEditor extends DocBookEditor { private static Log logger = LogFactory.getLog(LinkplainEditor.class); @Override public EditorInstruction edit(EditorInstruction values) { setValues(values); DocBookTagFactory dbfactory = getTagFactory(); Linkplain linkplain = (Linkplain) getHtmlElement(); String ref = linkplain.getRef(); logger.debug("ref=" + ref); if ((ref != null) && (ref.length() > 0)) { String label = linkplain.getTextContent(); String name = linkplain.getAttribute("name"); if (label != null && label.length() > 0) { Link elem = dbfactory.createLink(label, ref); setCurrent(elem); } else if (name != null && name.length() > 0) { Link elem = dbfactory.createLink(name, ref); setCurrent(elem); } else { Xref elem = dbfactory.createXref(ref); setCurrent(elem); } } else { Emphasis elem = dbfactory.createEmphasis(linkplain.getName()); setCurrent(elem); } getParent().appendChild(getCurrent()); traverse(false); return finalizeValues(); } }src/java/org/dbdoclet/trafo/internal/html/docbook/editor/javadoc/LiteralEditor.java0000644000175000017500000000270412644165236030641 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.docbook.editor.javadoc; import org.dbdoclet.trafo.html.EditorInstruction; import org.dbdoclet.trafo.internal.html.docbook.editor.DocBookEditor; /** * The class CodeEditor is reponsible for transforming @literal * tags into DocBook code. * * @author Michael Fuchs * @version $Revision$ */ public class LiteralEditor extends DocBookEditor { @Override public EditorInstruction edit(EditorInstruction values) { setValues(values); org.dbdoclet.tag.javadoc.Literal literal = (org.dbdoclet.tag.javadoc.Literal) getHtmlElement(); getCurrent().appendChild(literal.getTextContent()); traverse(false); return finalizeValues(); } } src/java/org/dbdoclet/trafo/internal/html/docbook/editor/javadoc/ValueEditor.java0000644000175000017500000000267112644165236030324 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.docbook.editor.javadoc; import org.dbdoclet.trafo.html.EditorInstruction; import org.dbdoclet.trafo.internal.html.docbook.editor.DocBookEditor; /** * The class ValueEditor is reponsible for transforming @value tags * into DocBook code. * * @author Michael Fuchs * @version $Revision$ */ public class ValueEditor extends DocBookEditor { @Override public EditorInstruction edit(EditorInstruction values) { setValues(values); org.dbdoclet.tag.javadoc.Value value = (org.dbdoclet.tag.javadoc.Value) getHtmlElement(); getCurrent().appendChild(value.getTextContent()); traverse(false); return finalizeValues(); } } src/java/org/dbdoclet/trafo/internal/html/docbook/editor/PreEditor.java0000644000175000017500000000467712644165236026377 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.docbook.editor; import org.dbdoclet.tag.docbook.BaseTagFactory; import org.dbdoclet.tag.docbook.DocBookElement; import org.dbdoclet.tag.docbook.Entry; import org.dbdoclet.tag.docbook.Example; import org.dbdoclet.tag.docbook.Informalexample; import org.dbdoclet.tag.docbook.SectionElement; import org.dbdoclet.tag.html.HtmlElement; import org.dbdoclet.trafo.html.EditorException; import org.dbdoclet.trafo.html.EditorInstruction; import org.dbdoclet.xiphias.dom.NodeImpl; public class PreEditor extends DocBookEditor { @Override public EditorInstruction edit(EditorInstruction values) throws EditorException { setValues(super.edit(values)); BaseTagFactory dbfactory = getTagFactory(); HtmlElement pre = values.getHtmlElement(); DocBookElement candidate; NodeImpl parent = getParent(); if (getParent() instanceof Entry) { candidate = dbfactory.createScreen(); } else if (getParent() instanceof Example || getParent() instanceof Informalexample) { candidate = dbfactory.createProgramlisting(); } else { candidate = dbfactory.createScreen(); } String attrLang = pre.getAttribute("lang"); if (attrLang != null) { candidate.setAttribute("language", attrLang); } candidate.setParentNode(parent); if (candidate.isValidParent(script.getTransformPosition(), parent)) { setCurrent(candidate); parent.appendChild(candidate); } else { if (isSection(parent)) { SectionElement sect = (SectionElement) parent; SectionElement firstSectionChild = sect.getFirstSectionChild(); if (firstSectionChild != null) { setCurrent(candidate); parent.insertBefore(candidate, firstSectionChild); } } } traverse(true); return finalizeValues(); } } src/java/org/dbdoclet/trafo/internal/html/docbook/editor/ThEditor.java0000644000175000017500000000463712644165236026220 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.docbook.editor; import org.dbdoclet.tag.docbook.BaseTagFactory; import org.dbdoclet.trafo.TrafoConstants; import org.dbdoclet.trafo.html.EditorException; import org.dbdoclet.trafo.html.EditorInstruction; import org.dbdoclet.xiphias.dom.ElementImpl; public class ThEditor extends DocBookEditor { @Override public EditorInstruction edit(EditorInstruction values) throws EditorException { setValues(super.edit(values)); BaseTagFactory dbfactory = getTagFactory(); boolean decomposeTables = script.isParameterOn( TrafoConstants.SECTION_DOCBOOK, TrafoConstants.PARAM_DECOMPOSE_TABLES, TrafoConstants.DEFAULT_DECOMPOSE_TABLES); if (decomposeTables || getHtmlElement().isMute()) { traverse(true); return finalizeValues(); } org.dbdoclet.tag.html.Th th = (org.dbdoclet.tag.html.Th) getHtmlElement(); org.dbdoclet.tag.docbook.Entry entry = dbfactory.createEntry(); entry.setAlign(th.getAlign()); entry.setChar(th.getChar()); entry.setCharOff(th.getCharOff()); entry.setVAlign(th.getVAlign()); int colspan = th.getColspan(); if (colspan > 1) { entry.setNameSt("c" + th.getIndex()); entry.setNameEnd("c" + ((th.getIndex() + colspan) - 1)); } int rowspan = th.getRowspan(); if (rowspan > 0) { entry.setMorerows(rowspan); } org.dbdoclet.tag.docbook.Para para = dbfactory.createPara(); para.setFormatType(ElementImpl.FORMAT_INLINE); org.dbdoclet.tag.docbook.Emphasis emph = dbfactory .createEmphasis(); emph.setRole(TrafoConstants.DEFAULT_EMPHASIS_ROLE_BOLD); entry.appendChild(para); para.appendChild(emph); getParent().appendChild(entry); setCurrent(emph); traverse(true); return finalizeValues(); } } src/java/org/dbdoclet/trafo/internal/html/docbook/editor/LiEditor.java0000644000175000017500000000355312644165236026205 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.docbook.editor; import org.dbdoclet.tag.docbook.BaseTagFactory; import org.dbdoclet.tag.docbook.DocBookElement; import org.dbdoclet.tag.docbook.Listitem; import org.dbdoclet.trafo.html.EditorException; import org.dbdoclet.trafo.html.EditorInstruction; import org.dbdoclet.xiphias.dom.NodeImpl; public class LiEditor extends DocBookEditor { @Override public EditorInstruction edit(EditorInstruction values) throws EditorException { setValues(super.edit(values)); BaseTagFactory dbfactory = getTagFactory(); NodeImpl parent = getParent(); if (parent instanceof Listitem) { setParent((DocBookElement) getParent().getParentNode()); parent = getParent(); } DocBookElement item = dbfactory.createListitem(); copyCommonAttributes(getHtmlElement(), item); item.setParentNode(parent); parent.appendChild(item); setCurrent(dbfactory.createPara()); getCurrent().setParentNode(item); item.appendChild(getCurrent()); traverse(true); return finalizeValues(); } } src/java/org/dbdoclet/trafo/internal/html/docbook/editor/MenuEditor.java0000644000175000017500000000277212644165236026547 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.docbook.editor; import org.dbdoclet.tag.docbook.BaseTagFactory; import org.dbdoclet.trafo.html.EditorException; import org.dbdoclet.trafo.html.EditorInstruction; public class MenuEditor extends DocBookEditor { @Override public EditorInstruction edit(EditorInstruction values) throws EditorException { setValues(super.edit(values)); BaseTagFactory dbfactory = getTagFactory(); if (isList(getParent())) { setCurrent(dbfactory.createListitem()); getCurrent().setParentNode(getParent()); getParent().appendChild(getCurrent()); setParent(getCurrent()); } setCurrent(dbfactory.createItemizedlist()); getCurrent().setParentNode(getParent()); getParent().appendChild(getCurrent()); traverse(true); return finalizeValues(); } } src/java/org/dbdoclet/trafo/internal/html/docbook/editor/DtEditor.java0000644000175000017500000000452412644165236026207 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.docbook.editor; import org.dbdoclet.tag.docbook.BaseTagFactory; import org.dbdoclet.tag.docbook.DocBookElement; import org.dbdoclet.tag.docbook.Term; import org.dbdoclet.tag.docbook.Varlistentry; import org.dbdoclet.tag.docbook.Variablelist; import org.dbdoclet.trafo.html.EditorException; import org.dbdoclet.trafo.html.EditorInstruction; import org.dbdoclet.xiphias.dom.ElementImpl; public class DtEditor extends DocBookEditor { @Override public EditorInstruction edit(EditorInstruction values) throws EditorException { DocBookElement entry = null; setValues(super.edit(values)); BaseTagFactory dbfactory = getTagFactory(); if (getParent() instanceof Variablelist) { entry = dbfactory.createVarlistentry(); entry.setParentNode(getParent()); getParent().appendChild(entry); } else if (getParent() instanceof Varlistentry) { setParent((DocBookElement) getParent().getParentNode()); if ((getParent() != null) && getParent() instanceof Variablelist) { getCurrent().appendChild( dbfactory.createListitem().appendChild( dbfactory.createPara().setFormatType( ElementImpl.FORMAT_INLINE))); entry = dbfactory.createVarlistentry(); entry.setParentNode(getParent()); getParent().appendChild(entry); } else { return finalizeValues(); } } else { return finalizeValues(); } Term term = dbfactory.createTerm(); copyCommonAttributes(getHtmlElement(), term); setCurrent(term); getCurrent().setParentNode(entry); entry.appendChild(getCurrent()); setParent(entry); traverse(true); return finalizeValues(); } } src/java/org/dbdoclet/trafo/internal/html/docbook/editor/SupEditor.java0000644000175000017500000000302012644165236026375 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.docbook.editor; import org.dbdoclet.tag.docbook.BaseTagFactory; import org.dbdoclet.tag.docbook.Superscript; import org.dbdoclet.trafo.html.EditorException; import org.dbdoclet.trafo.html.EditorInstruction; public class SupEditor extends DocBookEditor { @Override public EditorInstruction edit(EditorInstruction values) throws EditorException { setValues(super.edit(values)); BaseTagFactory dbfactory = getTagFactory(); Superscript candidate = dbfactory.createSuperscript(); candidate.setParentNode(getParent()); copyCommonAttributes(getHtmlElement(), candidate); if (candidate.isValidParent(script.getTransformPosition(), getParent())) { setCurrent(candidate); getParent().appendChild(getCurrent()); } traverse(true); return finalizeValues(); } } src/java/org/dbdoclet/trafo/internal/html/docbook/editor/CaptionEditor.java0000644000175000017500000000252212644165236027231 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.docbook.editor; import org.dbdoclet.tag.docbook.BaseTagFactory; import org.dbdoclet.tag.docbook.Title; import org.dbdoclet.trafo.html.EditorException; import org.dbdoclet.trafo.html.EditorInstruction; public class CaptionEditor extends DocBookEditor { @Override public EditorInstruction edit(EditorInstruction values) throws EditorException { setValues(super.edit(values)); BaseTagFactory dbfactory = getTagFactory(); Title title = dbfactory.createTitle(); getParent().getTrafoParentNode().insertChild(0, title); setCurrent(title); traverse(true); return finalizeValues(); } } src/java/org/dbdoclet/trafo/internal/html/docbook/editor/CodeEditor.java0000644000175000017500000000457012644165236026513 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.docbook.editor; import org.dbdoclet.tag.docbook.DocBookElement; import org.dbdoclet.tag.docbook.DocBookTagFactory; import org.dbdoclet.tag.docbook.Literal; import org.dbdoclet.tag.html.Code; import org.dbdoclet.trafo.html.EditorException; import org.dbdoclet.trafo.html.EditorInstruction; import org.dbdoclet.xiphias.dom.NodeImpl; /** * Verarbeitung des HTML-Elements code. * *

      *

        *
      • Falls das DocBook-Vaterelement vom Typ literal ist, wird nur der * Textinhalt eingefügt.
      • *
      • Andernfalls wird überprüft, ob sich an dieser Stelle ein Element des Typs * literal einfügen läßt.
      • *
      *

      * * @author michael * */ public class CodeEditor extends DocBookEditor { @Override public EditorInstruction edit(EditorInstruction values) throws EditorException { setValues(super.edit(values)); DocBookTagFactory dbfactory = getTagFactory(); Code code = (Code) getHtmlElement(); NodeImpl parent = getParent(); if (parent instanceof Literal) { parent.appendChild(code.getTextContent()); return finalizeValues(); } DocBookElement candidate = dbfactory.createLiteral(code .getTextContent()); if (candidate.isValidParent(script.getTransformPosition(), parent)) { parent.appendChild(candidate); traverse(false); return finalizeValues(); } candidate = dbfactory.createProgramlisting(); if (candidate.isValidParent(script.getTransformPosition(), parent)) { setCurrent(candidate); parent.appendChild(getCurrent()); traverse(true); return finalizeValues(); } parent.appendChild(code.getTextContent()); return finalizeValues(); } } src/java/org/dbdoclet/trafo/internal/html/docbook/editor/MetaEditor.java0000644000175000017500000001246612644165236026532 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.docbook.editor; import java.util.List; import org.dbdoclet.tag.docbook.Abstract; import org.dbdoclet.tag.docbook.Author; import org.dbdoclet.tag.docbook.BaseTagFactory; import org.dbdoclet.tag.docbook.Date; import org.dbdoclet.tag.docbook.Info; import org.dbdoclet.tag.docbook.Keyword; import org.dbdoclet.tag.docbook.Keywordset; import org.dbdoclet.tag.docbook.Para; import org.dbdoclet.tag.docbook.Personname; import org.dbdoclet.tag.docbook.Subject; import org.dbdoclet.tag.docbook.Subjectset; import org.dbdoclet.tag.docbook.Subjectterm; import org.dbdoclet.tag.html.Meta; import org.dbdoclet.trafo.html.EditorException; import org.dbdoclet.trafo.html.EditorInstruction; import org.dbdoclet.xiphias.dom.ElementImpl; import org.dbdoclet.xiphias.dom.NodeImpl; public class MetaEditor extends DocBookEditor { @Override public EditorInstruction edit(EditorInstruction values) throws EditorException { setValues(super.edit(values)); BaseTagFactory dbfactory = getTagFactory(); traverse(false); NodeImpl current = getCurrent(); NodeImpl root = current.getRoot(); ElementImpl info = (ElementImpl) root.getFirstChildElement(); if (info == null) { info = dbfactory.createInfo(); root.appendChild(info); } if (info instanceof Info == false) { info = dbfactory.createInfo(); root.insertChild(0, info); } Meta meta = (Meta) getHtmlElement(); String name = meta.getName(); String content = meta.getContent(); if (name != null && name.trim().equalsIgnoreCase("author")) { insertAuthor(dbfactory, info, content); } if (name != null && name.trim().equalsIgnoreCase("date")) { insertDate(dbfactory, info, content); } if (name != null && name.trim().equalsIgnoreCase("description")) { insertAbstract(dbfactory, info, content); } if (name != null && name.trim().equalsIgnoreCase("keywords")) { insertKeywordset(dbfactory, info, content); } if (name != null && name.trim().equalsIgnoreCase("subject")) { insertSubjectset(dbfactory, info, content); } return finalizeValues(); } private void insertAuthor(BaseTagFactory dbfactory, ElementImpl info, String content) { Author author = dbfactory.createAuthor(); Personname personname = dbfactory.createPersonname(); author.appendChild(personname); personname.setTextContent(content); List authorList = info.findChildren(Author.class); if (authorList.size() == 0) { info.appendChild(author); } else { info.insertAfter(author, authorList.get(authorList.size() - 1)); } } private void insertDate(BaseTagFactory dbfactory, ElementImpl info, String content) { Date date = dbfactory.createDate(); date.setTextContent(content); List dateList = info.findChildren(Date.class); if (dateList.size() == 0) { info.appendChild(date); } else { info.insertAfter(date, dateList.get(dateList.size() - 1)); } } private void insertAbstract(BaseTagFactory dbfactory, ElementImpl info, String content) { Abstract description = dbfactory.createAbstract(); Para para = dbfactory.createPara(content); description.appendChild(para); List abstractList = info.findChildren(Abstract.class); if (abstractList.size() == 0) { info.appendChild(description); } else { info.insertAfter(description, abstractList.get(abstractList.size() - 1)); } } private void insertKeywordset(BaseTagFactory dbfactory, ElementImpl info, String content) { if (content == null || content.trim().length() == 0) { return; } Keywordset keywordset = dbfactory.createKeywordset(); for (String token : content.split(",")) { Keyword keyword = dbfactory.createKeyword(); keyword.setTextContent(token.trim()); keywordset.appendChild(keyword); } List keywordsetList = info.findChildren(Keywordset.class); if (keywordsetList.size() == 0) { info.appendChild(keywordset); } else { info.insertAfter(keywordset, keywordsetList.get(keywordsetList.size() - 1)); } } private void insertSubjectset(BaseTagFactory dbfactory, ElementImpl info, String content) { if (content == null || content.trim().length() == 0) { return; } List subjectsetList = info.findChildren(Subjectset.class); Subjectset subjectset = null; if (subjectsetList.size() == 0) { subjectset = dbfactory.createSubjectset(); } else { subjectset = subjectsetList.get(0); } Subject subject = dbfactory.createSubject(); subjectset.appendChild(subject); Subjectterm subjectterm = dbfactory.createSubjectterm(); subjectterm.setTextContent(content); subject.appendChild(subjectterm); info.appendChild(subjectset); } } src/java/org/dbdoclet/trafo/internal/html/docbook/editor/CenterEditor.java0000644000175000017500000000215112644165236027052 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.docbook.editor; import org.dbdoclet.trafo.html.EditorException; import org.dbdoclet.trafo.html.EditorInstruction; public class CenterEditor extends DocBookEditor { @Override public EditorInstruction edit(EditorInstruction values) throws EditorException { setValues(super.edit(values)); traverse(true); ignore(true); return finalizeValues(); } } src/java/org/dbdoclet/trafo/internal/html/docbook/editor/OlEditor.java0000644000175000017500000000317312644165236026211 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.docbook.editor; import org.dbdoclet.tag.docbook.BaseTagFactory; import org.dbdoclet.trafo.html.EditorException; import org.dbdoclet.trafo.html.EditorInstruction; import org.dbdoclet.xiphias.dom.NodeListImpl; public class OlEditor extends DocBookEditor { @Override public EditorInstruction edit(EditorInstruction values) throws EditorException { setValues(super.edit(values)); BaseTagFactory dbfactory = getTagFactory(); NodeListImpl children = getHtmlElement().getTrafoChildNodes(); if (children.size() == 0) { return finalizeValues(); } if (isList(getParent())) { setCurrent(dbfactory.createListitem()); getCurrent().setParentNode(getParent()); getParent().appendChild(getCurrent()); setParent(getCurrent()); } setCurrent(dbfactory.createOrderedlist()); getParent().appendChild(getCurrent()); traverse(true); return finalizeValues(); } } src/java/org/dbdoclet/trafo/internal/html/docbook/editor/SubEditor.java0000644000175000017500000000272412644165236026371 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.docbook.editor; import org.dbdoclet.tag.docbook.BaseTagFactory; import org.dbdoclet.tag.docbook.Subscript; import org.dbdoclet.trafo.html.EditorException; import org.dbdoclet.trafo.html.EditorInstruction; public class SubEditor extends DocBookEditor { @Override public EditorInstruction edit(EditorInstruction values) throws EditorException { setValues(super.edit(values)); BaseTagFactory dbfactory = getTagFactory(); Subscript candidate = dbfactory.createSubscript(); candidate.setParentNode(getParent()); if (candidate.isValidParent(script.getTransformPosition(), getParent())) { setCurrent(candidate); getParent().appendChild(getCurrent()); } traverse(true); return finalizeValues(); } } src/java/org/dbdoclet/trafo/internal/html/docbook/editor/H2Editor.java0000644000175000017500000000147312644165236026111 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.docbook.editor; public class H2Editor extends HeadingEditor { } src/java/org/dbdoclet/trafo/internal/html/docbook/editor/DefaultEditor.java0000644000175000017500000000310212644165236027213 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.docbook.editor; import org.dbdoclet.tag.docbook.Anchor; import org.dbdoclet.tag.docbook.BaseTagFactory; import org.dbdoclet.tag.html.HtmlElement; import org.dbdoclet.trafo.html.EditorException; import org.dbdoclet.trafo.html.EditorInstruction; public class DefaultEditor extends DocBookEditor { @Override public EditorInstruction edit(EditorInstruction values) throws EditorException { EditorInstruction evo = super.edit(values); HtmlElement html = getHtmlElement(); String htmlId = html.getId(); if (htmlId != null) { BaseTagFactory dbf = getTagFactory(); Anchor anchor = dbf.createAnchor(); copyCommonAttributes(html, anchor); getParent().appendChild(anchor); } return evo; } } src/java/org/dbdoclet/trafo/internal/html/docbook/editor/HeadEditor.java0000644000175000017500000000212412644165236026473 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.docbook.editor; import org.dbdoclet.trafo.html.EditorException; import org.dbdoclet.trafo.html.EditorInstruction; public class HeadEditor extends DocBookEditor { @Override public EditorInstruction edit(EditorInstruction values) throws EditorException { setValues(super.edit(values)); traverse(true); return finalizeValues(); } } src/java/org/dbdoclet/trafo/internal/html/docbook/editor/ArticleEditor.java0000644000175000017500000000341012644165236027214 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.docbook.editor; import org.dbdoclet.tag.docbook.BaseTagFactory; import org.dbdoclet.tag.docbook.Section; import org.dbdoclet.tag.html.Header; import org.dbdoclet.tag.html.HeadingElement; import org.dbdoclet.tag.html.HtmlElement; import org.dbdoclet.trafo.html.EditorException; import org.dbdoclet.trafo.html.EditorInstruction; import org.dbdoclet.xiphias.dom.NodeImpl; import org.w3c.dom.Element; public class ArticleEditor extends DocBookEditor { @Override public EditorInstruction edit(EditorInstruction values) throws EditorException { setValues(super.edit(values)); BaseTagFactory dbfactory = getTagFactory(); NodeImpl parent = getParent(); HtmlElement article = values.getHtmlElement(); Element firstElement = article.getFirstChildElement(); if (isSection(parent) && (firstElement instanceof HeadingElement || firstElement instanceof Header)) { Section sect = dbfactory.createSection(); parent.appendChild(sect); values.setCurrent(sect); } setValues(values); return finalizeValues(); } } src/java/org/dbdoclet/trafo/internal/html/docbook/editor/VarEditor.java0000644000175000017500000000335012644165236026364 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.docbook.editor; import org.dbdoclet.tag.docbook.BaseTagFactory; import org.dbdoclet.tag.docbook.Blockquote; import org.dbdoclet.tag.docbook.DocBookElement; import org.dbdoclet.trafo.html.EditorException; import org.dbdoclet.trafo.html.EditorInstruction; import org.dbdoclet.xiphias.dom.NodeImpl; public class VarEditor extends DocBookEditor { @Override public EditorInstruction edit(EditorInstruction values) throws EditorException { setValues(super.edit(values)); BaseTagFactory dbfactory = getTagFactory(); NodeImpl parent = getParent(); if (parent instanceof Blockquote) { setCurrent(dbfactory.createProgramlisting()); traverse(true); } else { NodeImpl ancestor = parent; DocBookElement candidate = dbfactory.createLiteral(); candidate.setParentNode(ancestor); if (candidate.isValidParent(script.getTransformPosition(), ancestor)) { setCurrent(candidate); ancestor.appendChild(candidate); } traverse(true); } return finalizeValues(); } } src/java/org/dbdoclet/trafo/internal/html/docbook/editor/DocBookEditorFactory.java0000644000175000017500000000704412644165236030510 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.docbook.editor; import org.dbdoclet.tag.docbook.DocBookTagFactory; import org.dbdoclet.tag.html.HtmlElement; import org.dbdoclet.tag.javadoc.JavaDocElement; import org.dbdoclet.trafo.html.EditorFactoryException; import org.dbdoclet.trafo.html.IEditor; import org.dbdoclet.trafo.html.IEditorFactory; import org.dbdoclet.trafo.internal.html.docbook.LinkManager; import org.dbdoclet.trafo.script.Script; public class DocBookEditorFactory implements IEditorFactory { private LinkManager linkManager; private DocBookTagFactory tagFactory; /* * (non-Javadoc) * * @see * org.dbdoclet.trafo.internal.html.docbook.editor.IEditorFactory#getChildEditor * (org.dbdoclet.tag.html.HtmlElement) */ @Override public IEditor getChildEditor(HtmlElement child) throws EditorFactoryException { if (child == null) { throw new EditorFactoryException( "Can't create editor for child null!"); } String str = child.getClass().getName(); if (child instanceof JavaDocElement) { str = "org.dbdoclet.trafo.internal.html.docbook.editor.javadoc" + str.substring(str.lastIndexOf('.'), str.length()) + "Editor"; } else { str = "org.dbdoclet.trafo.internal.html.docbook.editor" + str.substring(str.lastIndexOf('.'), str.length()) + "Editor"; } Class c; Object o; try { c = Class.forName(str); o = c.newInstance(); DocBookEditor editor = (DocBookEditor) o; editor.setLinkManager(linkManager); editor.setTagFactory(tagFactory); } catch (ClassNotFoundException oops) { DefaultEditor editor = new DefaultEditor(); editor.setLinkManager(linkManager); editor.setTagFactory(tagFactory); return editor; } catch (InstantiationException oops) { throw new EditorFactoryException("Can't create editor for " + child.getNodeName()); } catch (IllegalAccessException oops) { throw new EditorFactoryException( "No permission to create editor for " + child.getNodeName()); } return (IEditor) o; } /* * (non-Javadoc) * * @see org.dbdoclet.trafo.internal.html.docbook.editor.IEditorFactory# * getCommentEditor() */ @Override public IEditor getCommentEditor() { CommentEditor editor = new CommentEditor(); editor.setLinkManager(linkManager); editor.setTagFactory(tagFactory); return editor; } /* * (non-Javadoc) * * @see * org.dbdoclet.trafo.internal.html.docbook.editor.IEditorFactory#getTextEditor * () */ @Override public IEditor getTextEditor() { TextEditor editor = new TextEditor(); editor.setLinkManager(linkManager); editor.setTagFactory(tagFactory); return editor; } public void setLinkManager(LinkManager linkManager) { this.linkManager = linkManager; } public void setScript(Script script) { } public void setTagFactory(DocBookTagFactory tagFactory) { this.tagFactory = tagFactory; } } src/java/org/dbdoclet/trafo/internal/html/docbook/editor/BigEditor.java0000644000175000017500000000212112644165236026330 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.docbook.editor; import org.dbdoclet.trafo.html.EditorException; import org.dbdoclet.trafo.html.EditorInstruction; public class BigEditor extends DocBookEditor { @Override public EditorInstruction edit(EditorInstruction values) throws EditorException { setValues(super.edit(values)); traverse(true); return finalizeValues(); } } src/java/org/dbdoclet/trafo/internal/html/docbook/editor/StyleEditor.java0000644000175000017500000000213012644165236026727 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.docbook.editor; import org.dbdoclet.trafo.html.EditorException; import org.dbdoclet.trafo.html.EditorInstruction; public class StyleEditor extends DocBookEditor { @Override public EditorInstruction edit(EditorInstruction values) throws EditorException { setValues(super.edit(values)); traverse(false); return finalizeValues(); } } src/java/org/dbdoclet/trafo/internal/html/docbook/editor/DdEditor.java0000644000175000017500000000416312644165236026166 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.docbook.editor; import org.dbdoclet.tag.docbook.BaseTagFactory; import org.dbdoclet.tag.docbook.DocBookElement; import org.dbdoclet.tag.docbook.Para; import org.dbdoclet.tag.docbook.Term; import org.dbdoclet.tag.docbook.Varlistentry; import org.dbdoclet.tag.docbook.Variablelist; import org.dbdoclet.trafo.html.EditorException; import org.dbdoclet.trafo.html.EditorInstruction; public class DdEditor extends DocBookEditor { @Override public EditorInstruction edit(EditorInstruction values) throws EditorException { DocBookElement list = null; setValues(super.edit(values)); BaseTagFactory dbfactory = getTagFactory(); // Try to detect two sequenced dd tags. if (getParent() instanceof Variablelist) { Varlistentry entry = dbfactory.createVarlistentry(); getParent().appendChild(entry); Term term = dbfactory.createTerm(); entry.appendChild(term); list = dbfactory.createListitem(); entry.appendChild(list); } else if (getParent() instanceof Varlistentry) { list = dbfactory.createListitem(); getParent().appendChild(list); setParent((DocBookElement) getParent().getParentNode()); } if (list == null) { return finalizeValues(); } // end of else Para para = dbfactory.createPara(); copyCommonAttributes(getHtmlElement(), para); setCurrent(para); list.appendChild(getCurrent()); traverse(true); return finalizeValues(); } } src/java/org/dbdoclet/trafo/internal/html/docbook/editor/BodyEditor.java0000644000175000017500000000212312644165236026526 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.docbook.editor; import org.dbdoclet.trafo.html.EditorException; import org.dbdoclet.trafo.html.EditorInstruction; public class BodyEditor extends DocBookEditor { @Override public EditorInstruction edit(EditorInstruction values) throws EditorException { setValues(super.edit(values)); traverse(true); return finalizeValues(); } } src/java/org/dbdoclet/trafo/internal/html/docbook/editor/SpanEditor.java0000644000175000017500000000552512644165236026543 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.docbook.editor; import org.dbdoclet.service.StringServices; import org.dbdoclet.tag.docbook.Anchor; import org.dbdoclet.tag.docbook.DocBookTagFactory; import org.dbdoclet.tag.docbook.Indexterm; import org.dbdoclet.tag.docbook.Primary; import org.dbdoclet.tag.docbook.Secondary; import org.dbdoclet.tag.html.Span; import org.dbdoclet.trafo.html.EditorException; import org.dbdoclet.trafo.html.EditorInstruction; import org.dbdoclet.xiphias.dom.NodeImpl; public class SpanEditor extends DocBookEditor { @Override public EditorInstruction edit(EditorInstruction values) throws EditorException { setValues(super.edit(values)); DocBookTagFactory dbfactory = getTagFactory(); Span span = (Span) getHtmlElement(); NodeImpl parent = getParent(); String title = span.getTitle(); String border1 = ":primary="; String border2 = ":secondary="; if ((title != null) && title.startsWith("indexterm:")) { String buffer = StringServices.cutPrefix(title, "indexterm"); if (buffer.startsWith(border1)) { String primaryText = StringServices.cutPrefix(buffer, border1); String secondaryText = null; int indexSecondary = primaryText.indexOf(border2); if (indexSecondary != -1) { int index = indexSecondary + border2.length(); if (index < primaryText.length()) { secondaryText = primaryText.substring(indexSecondary + border2.length()); } primaryText = primaryText.substring(0, indexSecondary); } Indexterm indexTerm = dbfactory.createIndexterm(); indexTerm.setParentNode(getParent()); Primary primary = dbfactory.createPrimary(primaryText); indexTerm.appendChild(primary); if ((secondaryText != null) && (secondaryText.length() > 0)) { Secondary secondary = dbfactory .createSecondary(secondaryText); indexTerm.appendChild(secondary); } parent.appendChild(indexTerm); } } String id = span.getId(); if (id != null) { Anchor anchor = dbfactory.createAnchor(); anchor.setId(getLinkManager().createUniqueId(id)); parent.appendChild(anchor); } traverse(true); return finalizeValues(); } } src/java/org/dbdoclet/trafo/internal/html/docbook/editor/BEditor.java0000644000175000017500000000242212644165236026014 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.docbook.editor; import org.dbdoclet.tag.docbook.Emphasis; import org.dbdoclet.trafo.TrafoConstants; import org.dbdoclet.trafo.html.EditorException; import org.dbdoclet.trafo.html.EditorInstruction; public class BEditor extends EmEditor { @Override public EditorInstruction edit(EditorInstruction values) throws EditorException { EditorInstruction evo = super.edit(values); Emphasis emphasis = getEmphasis(); if (emphasis != null) { emphasis.setRole(TrafoConstants.DEFAULT_EMPHASIS_ROLE_BOLD); } return evo; } } src/java/org/dbdoclet/trafo/internal/html/docbook/editor/H4Editor.java0000644000175000017500000000150112644165236026103 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.docbook.editor; public class H4Editor extends HeadingEditor { } src/java/org/dbdoclet/trafo/internal/html/docbook/editor/ImgEditor.java0000644000175000017500000001363312644165236026355 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.docbook.editor; import java.io.File; import java.io.IOException; import java.util.HashMap; import java.util.List; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.dbdoclet.service.FileServices; import org.dbdoclet.tag.docbook.DocBookElement; import org.dbdoclet.tag.docbook.DocBookTagFactory; import org.dbdoclet.tag.docbook.Emphasis; import org.dbdoclet.tag.docbook.Entry; import org.dbdoclet.tag.docbook.Link; import org.dbdoclet.tag.docbook.Para; import org.dbdoclet.tag.docbook.Screen; import org.dbdoclet.tag.docbook.Term; import org.dbdoclet.tag.docbook.ULink; import org.dbdoclet.tag.html.Img; import org.dbdoclet.trafo.TrafoConstants; import org.dbdoclet.trafo.html.EditorException; import org.dbdoclet.trafo.html.EditorInstruction; import org.dbdoclet.trafo.param.Param; import org.dbdoclet.xiphias.dom.NodeImpl; public class ImgEditor extends DocBookEditor { private static Log logger = LogFactory.getLog(ImgEditor.class); private static HashMap validFormatMap; static { validFormatMap = new HashMap(); validFormatMap.put("BASE64", "BASE64"); validFormatMap.put("BMP", "BMP"); validFormatMap.put("CGM-BINARY", "CGM-BINARY"); validFormatMap.put("CGM-CHAR", "CGM-CHAR"); validFormatMap.put("CGM-CLEAR", "CGM-CLEAR"); validFormatMap.put("DITROFF", "DITROFF"); validFormatMap.put("DVI", "DVI"); validFormatMap.put("EPS", "EPS"); validFormatMap.put("EQN", "EQN"); validFormatMap.put("FAX", "FAX"); validFormatMap.put("GIF", "GIF"); validFormatMap.put("GIF87a", "GIF87a"); validFormatMap.put("GIF89a", "GIF89a"); validFormatMap.put("IGES", "IGES"); validFormatMap.put("JPEG", "JPEG"); validFormatMap.put("JPG", "JPG"); validFormatMap.put("linespecific", "linespecific"); validFormatMap.put("PCX", "PCX"); validFormatMap.put("PIC", "PIC"); validFormatMap.put("PNG", "PNG"); validFormatMap.put("PS", "PS"); validFormatMap.put("SGML", "SGML"); validFormatMap.put("SVG", "SVG"); validFormatMap.put("TBL", "TBL"); validFormatMap.put("TEX", "TEX"); validFormatMap.put("TIFF", "TIFF"); validFormatMap.put("WMF", "WMF"); validFormatMap.put("WPG", "WPG"); } @Override public EditorInstruction edit(EditorInstruction values) throws EditorException { setValues(super.edit(values)); DocBookTagFactory dbfactory = getTagFactory(); Img img = (Img) getHtmlElement(); Boolean useAbsoluteImagePath = script.isParameterOn( TrafoConstants.SECTION_DOCBOOK, TrafoConstants.PARAM_USE_ABSOLUTE_IMAGE_PATH, false); logger.debug("Parameter use-absolute-image-path is set to " + useAbsoluteImagePath); String imagePath = script.getTextParameter( TrafoConstants.SECTION_DOCBOOK, TrafoConstants.PARAM_IMAGE_PATH, TrafoConstants.DEFAULT_IMAGE_PATH); Param param = script.getVariable(TrafoConstants.VAR_IMAGE_SUBPATH); if (imagePath != null && param != null) { imagePath = FileServices.appendPath(imagePath, param.getValueAsText()); } List additionalFormats = script.getTextParameterList( TrafoConstants.SECTION_DOCBOOK, TrafoConstants.PARAM_IMAGEDATA_FORMATS); logger.debug("Configuration property imagePath is set to " + imagePath); String src = img.getSrc(); logger.debug("Attribute src has a value of " + src); if ((src == null) || (src.length() == 0)) { return finalizeValues(); } if (imagePath != null && imagePath.length() > 0 && FileServices.isAbsolutePath(src) == false) { src = FileServices.appendFileName(imagePath, src); } validateSrc(src); File file = new File(src); if (useAbsoluteImagePath) { file = file.getAbsoluteFile(); } DocBookElement media; NodeImpl parent = getParent(); if (parent instanceof Emphasis || parent instanceof Entry || parent instanceof Para || parent instanceof Screen || parent instanceof Term || parent instanceof ULink || parent instanceof Link) { media = dbfactory.createInlinemediaobject(); parent.appendChild(media); media.setParentNode(getCurrent()); try { dbfactory.createHtmlImageData(media, dbfactory, img, file, additionalFormats); dbfactory.createFoImageData(media, dbfactory, img, file, additionalFormats); } catch (IOException oops) { throw new EditorException(oops); } } else { DocBookElement figure; String title = img.getTitle(); if ((title != null) && (title.length() > 0)) { figure = dbfactory.createFigure(title); } else { figure = dbfactory.createInformalfigure(); } media = dbfactory.createMediaobject(); parent.appendChild(figure); figure.appendChild(media); try { dbfactory.createHtmlImageData(media, dbfactory, img, file, additionalFormats); dbfactory.createFoImageData(media, dbfactory, img, file, additionalFormats); } catch (IOException oops) { throw new EditorException(oops); } } traverse(false); setCurrent(parent); return finalizeValues(); } public String validateFormat(String format) { if (format == null) { throw new IllegalArgumentException("Parameter format is null!"); } format = format.toUpperCase(); if (validFormatMap.get(format) != null) { return format; } else { return "JPG"; } } } src/java/org/dbdoclet/trafo/internal/html/docbook/editor/ScriptEditor.java0000644000175000017500000000213212644165236027075 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.docbook.editor; import org.dbdoclet.trafo.html.EditorException; import org.dbdoclet.trafo.html.EditorInstruction; public class ScriptEditor extends DocBookEditor { @Override public EditorInstruction edit(EditorInstruction values) throws EditorException { setValues(super.edit(values)); traverse(false); return finalizeValues(); } } src/java/org/dbdoclet/trafo/internal/html/docbook/editor/PEditor.java0000644000175000017500000000701712644165236026037 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.docbook.editor; import org.dbdoclet.tag.docbook.Book; import org.dbdoclet.tag.docbook.Chapter; import org.dbdoclet.tag.docbook.DocBookTagFactory; import org.dbdoclet.tag.docbook.Entry; import org.dbdoclet.tag.docbook.Para; import org.dbdoclet.tag.docbook.Part; import org.dbdoclet.tag.docbook.Refentry; import org.dbdoclet.tag.docbook.Refnamediv; import org.dbdoclet.tag.docbook.Refsection; import org.dbdoclet.tag.docbook.Reference; import org.dbdoclet.tag.docbook.SectionElement; import org.dbdoclet.tag.html.P; import org.dbdoclet.trafo.html.EditorException; import org.dbdoclet.trafo.html.EditorInstruction; import org.dbdoclet.xiphias.dom.ElementImpl; import org.dbdoclet.xiphias.dom.NodeImpl; import org.dbdoclet.xiphias.dom.TextImpl; public class PEditor extends DocBookEditor { @Override public EditorInstruction edit(EditorInstruction values) throws EditorException { setValues(super.edit(values)); DocBookTagFactory dbfactory = getTagFactory(); P p = (P) getHtmlElement(); NodeImpl parent = getParent(); Para candidate = dbfactory.createPara(); copyCommonAttributes(p, candidate); candidate.setParentNode(parent); if (parent instanceof Entry) { candidate.setFormatType(ElementImpl.FORMAT_INLINE); } if (parent instanceof Para == false && candidate.isValidParent(script.getTransformPosition(), parent)) { setCurrent(candidate); parent.appendChild(getCurrent()); } else { setCurrent(parent); if (parent instanceof Para && parent.getParentNode() != null) { parent.appendChild(new TextImpl(" ")); setParent((NodeImpl) parent.getParentNode()); } if (isSection(parent)) { if (parent instanceof Book || parent instanceof Part) { Chapter chapter = dbfactory .createChapter("Automatically inserted chapter"); parent.appendChild(chapter); setCurrent(candidate); chapter.appendChild(getCurrent()); } else if (parent instanceof Reference) { setCurrent(candidate); Refentry refEntry = dbfactory.createRefentry(); parent.appendChild(refEntry); Refnamediv refNameDiv = dbfactory.createRefnamediv(); refNameDiv.appendChild(dbfactory .createRefname(AUTOMATICALLY_INSERTED)); refNameDiv.appendChild(dbfactory.createRefpurpose()); refEntry.appendChild(refNameDiv); Refsection refSection = dbfactory.createRefsection(); refEntry.appendChild(refSection); refSection.appendChild(getCurrent()); // TODO Auto-generated method stub } else { SectionElement sect = (SectionElement) parent; SectionElement firstSectionChild = sect .getFirstSectionChild(); if (firstSectionChild != null) { setCurrent(candidate); parent.insertBefore(getCurrent(), firstSectionChild); } } } } traverse(true); return finalizeValues(); } } src/java/org/dbdoclet/trafo/internal/html/docbook/editor/UEditor.java0000644000175000017500000000253212644165236026041 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.docbook.editor; import org.dbdoclet.tag.docbook.Emphasis; import org.dbdoclet.trafo.TrafoConstants; import org.dbdoclet.trafo.html.EditorException; import org.dbdoclet.trafo.html.EditorInstruction; public class UEditor extends EmEditor { @Override public EditorInstruction edit(EditorInstruction values) throws EditorException { EditorInstruction evo = super.edit(values); Emphasis emphasis = getEmphasis(); if (emphasis != null) { emphasis.setRole(TrafoConstants.DEFAULT_EMPHASIS_ROLE_UNDERLINE); } return evo; } } src/java/org/dbdoclet/trafo/internal/html/docbook/editor/EmEditor.java0000644000175000017500000000260612644165236026200 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.docbook.editor; import org.dbdoclet.tag.docbook.BaseTagFactory; import org.dbdoclet.tag.docbook.Emphasis; import org.dbdoclet.trafo.html.EditorException; import org.dbdoclet.trafo.html.EditorInstruction; public class EmEditor extends AbstractInlineEditor { private Emphasis emphasis; @Override public EditorInstruction edit(EditorInstruction values) throws EditorException { BaseTagFactory dbfactory = getTagFactory(); emphasis = dbfactory.createEmphasis(); setInlineElement(emphasis); return super.edit(values); } public Emphasis getEmphasis() { return emphasis; } } src/java/org/dbdoclet/trafo/internal/html/docbook/editor/H3Editor.java0000644000175000017500000000147212644165236026111 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.docbook.editor; public class H3Editor extends HeadingEditor { } src/java/org/dbdoclet/trafo/internal/html/docbook/editor/TfootEditor.java0000644000175000017500000000312512644165236026727 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.docbook.editor; import org.dbdoclet.tag.docbook.BaseTagFactory; import org.dbdoclet.trafo.TrafoConstants; import org.dbdoclet.trafo.html.EditorException; import org.dbdoclet.trafo.html.EditorInstruction; public class TfootEditor extends DocBookEditor { @Override public EditorInstruction edit(EditorInstruction values) throws EditorException { setValues(super.edit(values)); BaseTagFactory dbfactory = getTagFactory(); boolean decomposeTables = script.isParameterOn( TrafoConstants.SECTION_DOCBOOK, TrafoConstants.PARAM_DECOMPOSE_TABLES, TrafoConstants.DEFAULT_DECOMPOSE_TABLES); if (decomposeTables) { traverse(true); return finalizeValues(); } setCurrent(dbfactory.createTfoot()); getCurrent().setParentNode(getParent()); getParent().appendChild(getCurrent()); traverse(true); return finalizeValues(); } } src/java/org/dbdoclet/trafo/internal/html/docbook/editor/TitleEditor.java0000644000175000017500000000213012644165236026710 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.docbook.editor; import org.dbdoclet.trafo.html.EditorException; import org.dbdoclet.trafo.html.EditorInstruction; public class TitleEditor extends DocBookEditor { @Override public EditorInstruction edit(EditorInstruction values) throws EditorException { setValues(super.edit(values)); traverse(false); return finalizeValues(); } } src/java/org/dbdoclet/trafo/internal/html/docbook/editor/TrEditor.java0000644000175000017500000000451612644165236026226 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.docbook.editor; import org.dbdoclet.tag.docbook.BaseTagFactory; import org.dbdoclet.tag.docbook.Row; import org.dbdoclet.tag.html.Tr; import org.dbdoclet.trafo.TrafoConstants; import org.dbdoclet.trafo.html.EditorException; import org.dbdoclet.trafo.html.EditorInstruction; public class TrEditor extends DocBookEditor { @Override public EditorInstruction edit(EditorInstruction values) throws EditorException { setValues(super.edit(values)); BaseTagFactory dbfactory = getTagFactory(); boolean decomposeTables = script.isParameterOn( TrafoConstants.SECTION_DOCBOOK, TrafoConstants.PARAM_DECOMPOSE_TABLES, TrafoConstants.DEFAULT_DECOMPOSE_TABLES); if (decomposeTables || getHtmlElement().isMute()) { traverse(true); return finalizeValues(); } Tr tr = (Tr) values.getHtmlElement(); Integer height = tr.getHeight(); if (height != null && height == 0) { traverse(false); return finalizeValues(); } if (getParent() instanceof org.dbdoclet.tag.docbook.Tgroup || getParent() instanceof org.dbdoclet.tag.docbook.Entrytbl) { setCurrent(dbfactory.createTbody()); getCurrent().setParentNode(getParent()); getParent().appendChild(getCurrent()); setParent(getCurrent()); } Row row = dbfactory.createRow(); copyCommonAttributes(getHtmlElement(), row); setCurrent(row); getParent().appendChild(getCurrent()); traverse(true); return finalizeValues(); } } src/java/org/dbdoclet/trafo/internal/html/docbook/editor/EditorProperties.java0000644000175000017500000000175012644165236027772 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.docbook.editor; import java.util.Properties; public class EditorProperties extends Properties { private static final long serialVersionUID = 1L; public String getEmphasisRoleBold() { // strong or bold return "bold"; } } src/java/org/dbdoclet/trafo/internal/html/docbook/editor/MapEditor.java0000644000175000017500000000212612644165236026351 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.docbook.editor; import org.dbdoclet.trafo.html.EditorException; import org.dbdoclet.trafo.html.EditorInstruction; public class MapEditor extends DocBookEditor { @Override public EditorInstruction edit(EditorInstruction values) throws EditorException { setValues(super.edit(values)); traverse(true); return finalizeValues(); } } src/java/org/dbdoclet/trafo/internal/html/docbook/editor/TheadEditor.java0000644000175000017500000000312512644165236026661 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.docbook.editor; import org.dbdoclet.tag.docbook.BaseTagFactory; import org.dbdoclet.trafo.TrafoConstants; import org.dbdoclet.trafo.html.EditorException; import org.dbdoclet.trafo.html.EditorInstruction; public class TheadEditor extends DocBookEditor { @Override public EditorInstruction edit(EditorInstruction values) throws EditorException { setValues(super.edit(values)); BaseTagFactory dbfactory = getTagFactory(); boolean decomposeTables = script.isParameterOn( TrafoConstants.SECTION_DOCBOOK, TrafoConstants.PARAM_DECOMPOSE_TABLES, TrafoConstants.DEFAULT_DECOMPOSE_TABLES); if (decomposeTables) { traverse(true); return finalizeValues(); } setCurrent(dbfactory.createThead()); getCurrent().setParentNode(getParent()); getParent().appendChild(getCurrent()); traverse(true); return finalizeValues(); } } src/java/org/dbdoclet/trafo/internal/html/docbook/editor/H6Editor.java0000644000175000017500000000150112644165236026105 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.docbook.editor; public class H6Editor extends HeadingEditor { } src/java/org/dbdoclet/trafo/internal/html/docbook/editor/DirEditor.java0000644000175000017500000000336012644165236026353 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.docbook.editor; import org.dbdoclet.tag.docbook.BaseTagFactory; import org.dbdoclet.trafo.html.EditorException; import org.dbdoclet.trafo.html.EditorInstruction; import org.dbdoclet.xiphias.dom.NodeImpl; import org.dbdoclet.xiphias.dom.NodeListImpl; public class DirEditor extends DocBookEditor { @Override public EditorInstruction edit(EditorInstruction values) throws EditorException { setValues(super.edit(values)); BaseTagFactory dbfactory = getTagFactory(); NodeListImpl children = getHtmlElement().getTrafoChildNodes(); if (children.size() == 0) { return finalizeValues(); } NodeImpl parentNode = getParent(); if (isList(parentNode)) { setCurrent(dbfactory.createListitem()); getCurrent().setParentNode(getParent()); parentNode.appendChild(getCurrent()); setParent(getCurrent()); } setCurrent(dbfactory.createItemizedlist()); getCurrent().setParentNode(getParent()); getParent().appendChild(getCurrent()); traverse(true); return finalizeValues(); } } src/java/org/dbdoclet/trafo/internal/html/docbook/editor/TdEditor.java0000644000175000017500000000541112644165236026203 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.docbook.editor; import java.util.Iterator; import org.dbdoclet.tag.docbook.BaseTagFactory; import org.dbdoclet.trafo.TrafoConstants; import org.dbdoclet.trafo.html.EditorException; import org.dbdoclet.trafo.html.EditorInstruction; import org.dbdoclet.xiphias.dom.ElementImpl; import org.dbdoclet.xiphias.dom.NodeImpl; import org.dbdoclet.xiphias.dom.NodeListImpl; public class TdEditor extends DocBookEditor { @Override public EditorInstruction edit(EditorInstruction values) throws EditorException { setValues(super.edit(values)); BaseTagFactory dbfactory = getTagFactory(); boolean decomposeTables = script.isParameterOn( TrafoConstants.SECTION_DOCBOOK, TrafoConstants.PARAM_DECOMPOSE_TABLES, TrafoConstants.DEFAULT_DECOMPOSE_TABLES); if (decomposeTables || getHtmlElement().isMute()) { traverse(true); return finalizeValues(); } org.dbdoclet.tag.html.Td td = (org.dbdoclet.tag.html.Td) getHtmlElement(); org.dbdoclet.tag.docbook.Entry entry = dbfactory.createEntry(); copyCommonAttributes(getHtmlElement(), entry); NodeListImpl children = td.getTrafoChildNodes(); Iterator iterator = children.iterator(); NodeImpl node; while (iterator.hasNext()) { node = iterator.next(); if (node instanceof org.dbdoclet.tag.html.Table) { traverse(true); return finalizeValues(); } } entry.setAlign(td.getAlign()); entry.setChar(td.getChar()); entry.setCharOff(td.getCharOff()); entry.setVAlign(td.getVAlign()); int colspan = td.getColspan(); if (colspan > 1) { entry.setNameSt("c" + td.getIndex()); entry.setNameEnd("c" + ((td.getIndex() + colspan) - 1)); } int rowspan = td.getRowspan(); if (rowspan > 0) { entry.setMorerows(rowspan); } org.dbdoclet.tag.docbook.Para para = dbfactory.createPara(); para.setFormatType(ElementImpl.FORMAT_INLINE); entry.appendChild(para); para.setParentNode(entry); getParent().appendChild(entry); entry.setParentNode(getParent()); setCurrent(para); traverse(true); return finalizeValues(); } } src/java/org/dbdoclet/trafo/internal/html/docbook/editor/SectionEditor.java0000644000175000017500000000264112644165236027242 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.docbook.editor; import org.dbdoclet.tag.docbook.BaseTagFactory; import org.dbdoclet.tag.docbook.Section; import org.dbdoclet.trafo.html.EditorException; import org.dbdoclet.trafo.html.EditorInstruction; import org.dbdoclet.xiphias.dom.NodeImpl; public class SectionEditor extends DocBookEditor { @Override public EditorInstruction edit(EditorInstruction values) throws EditorException { setValues(super.edit(values)); BaseTagFactory dbfactory = getTagFactory(); NodeImpl parent = getParent(); if (isSection(parent)) { Section sect = dbfactory.createSection(); parent.appendChild(sect); setCurrent(sect); } return finalizeValues(); } } src/java/org/dbdoclet/trafo/internal/html/docbook/editor/HrEditor.java0000644000175000017500000000212612644165236026205 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.docbook.editor; import org.dbdoclet.trafo.html.EditorException; import org.dbdoclet.trafo.html.EditorInstruction; public class HrEditor extends DocBookEditor { @Override public EditorInstruction edit(EditorInstruction values) throws EditorException { setValues(super.edit(values)); traverse(false); return finalizeValues(); } } src/java/org/dbdoclet/trafo/internal/html/docbook/editor/TableEditor.java0000644000175000017500000001356512644165236026674 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.docbook.editor; import java.util.ArrayList; import java.util.Iterator; import org.dbdoclet.tag.docbook.DocBookTagFactory; import org.dbdoclet.tag.docbook.Entry; import org.dbdoclet.tag.docbook.Entrytbl; import org.dbdoclet.tag.html.Td; import org.dbdoclet.trafo.TrafoConstants; import org.dbdoclet.trafo.html.EditorException; import org.dbdoclet.trafo.html.EditorInstruction; import org.dbdoclet.xiphias.dom.NodeImpl; import org.w3c.dom.Element; public class TableEditor extends DocBookEditor { @Override public EditorInstruction edit(EditorInstruction values) throws EditorException { setValues(super.edit(values)); DocBookTagFactory dbfactory = getTagFactory(); boolean decomposeTables = script.isParameterOn( TrafoConstants.SECTION_DOCBOOK, TrafoConstants.PARAM_DECOMPOSE_TABLES, TrafoConstants.DEFAULT_DECOMPOSE_TABLES); if (decomposeTables || getHtmlElement().isMute()) { traverse(true); return finalizeValues(); } org.dbdoclet.tag.html.Table htmlTable = (org.dbdoclet.tag.html.Table) getHtmlElement(); NodeImpl htmlTableParent = htmlTable.getTrafoParentNode(); ArrayList htmlParentChildList = htmlTableParent .getChildElementList(); /* * Falls sich die HTML-Tabelle innerhalb einer sie umgebenden * Tabellenzelle liegt und diese mehrere Kindelemente ent */ NodeImpl tdParent = htmlTable.findParent(Td.class); if (tdParent != null) { htmlParentChildList = tdParent.getChildElementList(); } NodeImpl parent = getParent(); NodeImpl grandParent = parent.getTrafoParentNode(); if (parent instanceof org.dbdoclet.tag.docbook.Row) { if (htmlParentChildList.size() > 1) { Entry entry = dbfactory.createEntry(); parent.appendChild(entry); parent = entry; setParent(entry); setCurrent(entry); addTable(dbfactory, htmlTable, parent); } else { addSubtable(dbfactory, htmlTable, parent); } } else if ((grandParent != null) && parent instanceof org.dbdoclet.tag.docbook.Entry) { if (htmlParentChildList.size() > 1) { addTable(dbfactory, htmlTable, parent); } else { addSubtable(dbfactory, htmlTable, grandParent); } } else { addTable(dbfactory, htmlTable, parent); } return finalizeValues(); } private void addSubtable(DocBookTagFactory dbfactory, org.dbdoclet.tag.html.Table htmlTable, NodeImpl parent) { ArrayList colWidthList = htmlTable.getColWidths(); Entrytbl entrytbl = dbfactory.createEntrytbl(); entrytbl.setCols(htmlTable.getNumOfCols()); Iterator iterator = colWidthList.iterator(); int index = 1; String width; while (iterator.hasNext()) { width = iterator.next(); entrytbl.appendChild(dbfactory.createColspec("c" + index, width)); index++; } entrytbl.setParentNode(parent); parent.appendChild(entrytbl); setCurrent(entrytbl); traverse(true); } private void addTable(DocBookTagFactory dbfactory, org.dbdoclet.tag.html.Table htmlTable, NodeImpl parent) { ArrayList colWidthList = htmlTable.getColWidths(); org.dbdoclet.tag.docbook.Table table = null; String caption = htmlTable.getCaption(); if ((caption != null) && (caption.length() > 0)) { table = dbfactory.createTable(); } else { table = dbfactory.createInformaltable(); } copyCommonAttributes(htmlTable, table); String tableStyle = script.getTextParameter( TrafoConstants.SECTION_DOCBOOK, TrafoConstants.PARAM_TABLE_STYLE, TrafoConstants.DEFAULT_TABLE_STYLE); table.setFrame(tableStyle); org.dbdoclet.tag.docbook.Tgroup tgroup = dbfactory.createTgroup(); colWidthList = editWidths(colWidthList); Iterator iterator = colWidthList.iterator(); int index = 1; String width; while (iterator.hasNext()) { width = iterator.next(); tgroup.appendChild(dbfactory.createColspec("c" + index, width)); index++; } if (htmlTable.hasBorder() == false) { table.setFrame("none"); } else { table.setFrame("all"); } transferId(htmlTable, table); tgroup.setCols(colWidthList.size()); table.appendChild(tgroup); parent.appendChild(table); setCurrent(tgroup); traverse(true); } private ArrayList editWidths(ArrayList list) { int percent = 0; int i; int withoutWidth = 0; String width; Iterator iterator; int index = 0; iterator = list.iterator(); while (iterator.hasNext()) { width = iterator.next(); if ((width == null) || (width.length() == 0)) { withoutWidth++; continue; } width = width.trim(); if (width.endsWith("%") || width.matches("\\d+")) { width = width.substring(0, width.length() - 1); try { i = Integer.parseInt(width); } catch (NumberFormatException oops) { continue; } percent += i; list.set(index, String.valueOf(i) + "*"); } index++; } index = 0; if ((percent < 100) && (withoutWidth > 0)) { percent = (100 - percent) / withoutWidth; } else { percent = 10; } iterator = list.iterator(); while (iterator.hasNext()) { width = iterator.next(); if ((width == null) || (width.length() == 0)) { list.set(index, String.valueOf(percent) + "*"); } index++; } return list; } } src/java/org/dbdoclet/trafo/internal/html/docbook/editor/DlEditor.java0000644000175000017500000000352212644165236026174 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.docbook.editor; import org.dbdoclet.tag.docbook.DocBookTagFactory; import org.dbdoclet.trafo.html.EditorException; import org.dbdoclet.trafo.html.EditorInstruction; import org.dbdoclet.xiphias.dom.NodeListImpl; public class DlEditor extends DocBookEditor { @Override public EditorInstruction edit(EditorInstruction values) throws EditorException { setValues(super.edit(values)); DocBookTagFactory dbfactory = getTagFactory(); org.dbdoclet.tag.html.Dl dl = (org.dbdoclet.tag.html.Dl) getHtmlElement(); String title = dl.getTitle(); NodeListImpl children = dl.getTrafoChildNodes(); if (children.size() == 0) { return finalizeValues(); } if (isList(getParent())) { setCurrent(dbfactory.createListitem()); getCurrent().setParentNode(getParent()); getParent().appendChild(getCurrent()); setParent(getCurrent()); } setCurrent(dbfactory.createVariablelist()); if ((title != null) && (title.length() > 0)) { getCurrent().appendChild(dbfactory.createTitle(title)); } getParent().appendChild(getCurrent()); traverse(true); return finalizeValues(); } } src/java/org/dbdoclet/trafo/internal/html/docbook/editor/SmallEditor.java0000644000175000017500000000213012644165236026677 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.docbook.editor; import org.dbdoclet.trafo.html.EditorException; import org.dbdoclet.trafo.html.EditorInstruction; public class SmallEditor extends DocBookEditor { @Override public EditorInstruction edit(EditorInstruction values) throws EditorException { setValues(super.edit(values)); traverse(true); return finalizeValues(); } } src/java/org/dbdoclet/trafo/internal/html/docbook/editor/AbstractInlineEditor.java0000644000175000017500000000466412644165236030547 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.docbook.editor; import org.dbdoclet.tag.docbook.BaseTagFactory; import org.dbdoclet.tag.docbook.DocBookElement; import org.dbdoclet.tag.docbook.Para; import org.dbdoclet.tag.docbook.Subscript; import org.dbdoclet.tag.docbook.Superscript; import org.dbdoclet.trafo.html.EditorException; import org.dbdoclet.trafo.html.EditorInstruction; import org.dbdoclet.xiphias.dom.NodeImpl; public abstract class AbstractInlineEditor extends DocBookEditor { private DocBookElement inlineElement; public DocBookElement getInlineElement() { return inlineElement; } public void setInlineElement(DocBookElement inlineElement) { this.inlineElement = inlineElement; } @Override public EditorInstruction edit(EditorInstruction values) throws EditorException { setValues(super.edit(values)); setCurrent(inlineElement); copyCommonAttributes(getHtmlElement(), inlineElement); BaseTagFactory dbfactory = getTagFactory(); traverse(true); NodeImpl parent = getParent(); if (parent instanceof Subscript || parent instanceof Superscript) { NodeImpl ancestor = parent.getTrafoParentNode(); if (ancestor != null) { ancestor.replaceChild(inlineElement, parent); inlineElement.appendChild(parent); setCurrent(parent); return finalizeValues(); } } if (inlineElement.isValidParent(script.getTransformPosition(), parent) == false) { Para candidate = dbfactory.createPara(); if (candidate.isValidParent(script.getTransformPosition(), parent)) { setParent(candidate); parent.appendChild(candidate); candidate.appendChild(getCurrent()); } } else { getCurrent().setParentNode(parent); parent.appendChild(getCurrent()); } return finalizeValues(); } } src/java/org/dbdoclet/trafo/internal/html/docbook/editor/BlockquoteEditor.java0000644000175000017500000000312412644165236027743 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.docbook.editor; import org.dbdoclet.tag.docbook.BaseTagFactory; import org.dbdoclet.tag.docbook.Blockquote; import org.dbdoclet.tag.docbook.Para; import org.dbdoclet.trafo.html.EditorException; import org.dbdoclet.trafo.html.EditorInstruction; import org.dbdoclet.xiphias.dom.NodeImpl; public class BlockquoteEditor extends DocBookEditor { @Override public EditorInstruction edit(EditorInstruction values) throws EditorException { setValues(super.edit(values)); BaseTagFactory dbfactory = getTagFactory(); Blockquote blockquote = dbfactory.createBlockquote(); NodeImpl parent = getParent(); parent.appendChild(blockquote); blockquote.setParentNode(parent); Para para = dbfactory.createPara(); blockquote.appendChild(para); para.setParentNode(blockquote); setCurrent(para); traverse(true); return finalizeValues(); } } src/java/org/dbdoclet/trafo/internal/html/docbook/editor/HeaderEditor.java0000644000175000017500000000267012644165236027030 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.docbook.editor; import org.dbdoclet.tag.docbook.BaseTagFactory; import org.dbdoclet.tag.docbook.DocBookElement; import org.dbdoclet.tag.docbook.Info; import org.dbdoclet.trafo.html.EditorException; import org.dbdoclet.trafo.html.EditorInstruction; public class HeaderEditor extends DocBookEditor { @Override public EditorInstruction edit(EditorInstruction values) throws EditorException { setValues(super.edit(values)); BaseTagFactory dbfactory = getTagFactory(); DocBookElement parent = (DocBookElement) values.getParent(); if (parent.isSection()) { Info info = dbfactory.createInfo(); parent.appendChild(info); setCurrent(info); } return finalizeValues(); } } src/java/org/dbdoclet/trafo/internal/html/docbook/editor/TtEditor.java0000644000175000017500000000243012644165236026221 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.docbook.editor; import org.dbdoclet.tag.docbook.BaseTagFactory; import org.dbdoclet.tag.docbook.Literal; import org.dbdoclet.trafo.html.EditorException; import org.dbdoclet.trafo.html.EditorInstruction; public class TtEditor extends AbstractInlineEditor { @Override public EditorInstruction edit(EditorInstruction values) throws EditorException { BaseTagFactory dbfactory = getTagFactory(); Literal literal = dbfactory.createLiteral(); setInlineElement(literal); return super.edit(values); } } src/java/org/dbdoclet/trafo/internal/html/docbook/editor/AEditor.java0000644000175000017500000000763512644165236026026 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.docbook.editor; import org.dbdoclet.service.StringServices; import org.dbdoclet.tag.docbook.Anchor; import org.dbdoclet.tag.docbook.DocBookElement; import org.dbdoclet.tag.docbook.DocBookTagFactory; import org.dbdoclet.tag.docbook.Link; import org.dbdoclet.tag.docbook.Para; import org.dbdoclet.tag.docbook.Simpara; import org.dbdoclet.tag.docbook.ULink; import org.dbdoclet.tag.docbook.Xref; import org.dbdoclet.tag.html.A; import org.dbdoclet.trafo.TrafoConstants; import org.dbdoclet.trafo.html.EditorException; import org.dbdoclet.trafo.html.EditorInstruction; import org.dbdoclet.xiphias.dom.NodeImpl; public class AEditor extends DocBookEditor { @Override public EditorInstruction edit(EditorInstruction values) throws EditorException { setValues(super.edit(values)); DocBookTagFactory dbfactory = getTagFactory(); NodeImpl ancestor; NodeImpl parent = getParent(); traverse(true); ancestor = parent; if (parent instanceof DocBookElement) { DocBookElement dbParent = (DocBookElement) parent; if (dbParent.isSection()) { Para para = dbfactory.createPara(); parent.appendChild(para); ancestor = para; } } A htmlA = (A) getHtmlElement(); String name = htmlA.getName(); String href = htmlA.getHref(); if (name != null && name.length() > 0) { Anchor anchor = dbfactory.createAnchor(); anchor.setId(getLinkManager().createUniqueId(name)); boolean createXrefLabel = script.isParameterOn( TrafoConstants.SECTION_DOCBOOK, TrafoConstants.PARAM_CREATE_XREF_LABEL, true); if (createXrefLabel == true) { anchor.setXrefLabel(StringServices.replace( htmlA.getTextContent(), "\"", """)); } ancestor.appendChild(anchor); } else if (href != null && href.equals("#") == false && href.startsWith("#")) { String label = htmlA.getTextContent(); if ((label != null) && (label.length() > 0)) { Link link = dbfactory.createLink(getLinkManager().getUniqueId( href)); link.setParentNode(ancestor); ancestor.appendChild(link); setCurrent(link); } else { Xref xref = dbfactory.createXref(getLinkManager().getUniqueId( href)); xref.setParentNode(ancestor); ancestor.appendChild(xref); setCurrent(ancestor); } } else { DocBookElement linkElement; if (isDocBook5()) { Link link = dbfactory.createLink(); link.setParentNode(ancestor); if (href != null) { link.setHref(href); } else { link.setHref(""); } linkElement = link; } else { ULink ulink = dbfactory.createULink(); ulink.setParentNode(ancestor); ulink.setUrl(href);// public Script getScript() { // return script; // } linkElement = ulink; } if (linkElement.isValidParent(script.getTransformPosition(), ancestor)) { setCurrent(linkElement); ancestor.appendChild(getCurrent()); getLinkManager().addLink(linkElement); } else { Simpara candidate = dbfactory.createSimpara(); candidate.setParentNode(ancestor); if (candidate.isValidParent(script.getTransformPosition(), ancestor)) { ancestor.appendChild(candidate); candidate.appendChild(ancestor); } } } return finalizeValues(); } } src/java/org/dbdoclet/trafo/internal/html/docbook/editor/TbodyEditor.java0000644000175000017500000000366112644165236026722 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.docbook.editor; import org.dbdoclet.tag.docbook.BaseTagFactory; import org.dbdoclet.tag.docbook.Tbody; import org.dbdoclet.tag.docbook.Tgroup; import org.dbdoclet.trafo.TrafoConstants; import org.dbdoclet.trafo.html.EditorException; import org.dbdoclet.trafo.html.EditorInstruction; import org.dbdoclet.xiphias.dom.NodeImpl; public class TbodyEditor extends DocBookEditor { @Override public EditorInstruction edit(EditorInstruction values) throws EditorException { setValues(super.edit(values)); BaseTagFactory dbfactory = getTagFactory(); boolean decomposeTables = script.isParameterOn(TrafoConstants.SECTION_DOCBOOK, TrafoConstants.PARAM_DECOMPOSE_TABLES, TrafoConstants.DEFAULT_DECOMPOSE_TABLES); if (decomposeTables) { traverse(true); return finalizeValues(); } NodeImpl parent = getParent(); if (parent != null && parent instanceof Tgroup) { Tbody tbody = (Tbody) parent.getLastChild(Tbody.class); if (tbody == null) { setCurrent(dbfactory.createTbody()); getCurrent().setParentNode(getParent()); getParent().appendChild(getCurrent()); } else { setCurrent(tbody); } } traverse(true); return finalizeValues(); } } src/java/org/dbdoclet/trafo/internal/html/docbook/editor/BrEditor.java0000644000175000017500000000626112644165236026203 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.docbook.editor; import org.dbdoclet.service.StringServices; import org.dbdoclet.tag.docbook.BaseTagFactory; import org.dbdoclet.tag.docbook.Para; import org.dbdoclet.tag.html.Br; import org.dbdoclet.trafo.TrafoConstants; import org.dbdoclet.trafo.html.EditorException; import org.dbdoclet.trafo.html.EditorInstruction; import org.dbdoclet.trafo.script.Script; import org.dbdoclet.xiphias.dom.NodeImpl; import org.dbdoclet.xiphias.dom.TextImpl; import org.w3c.dom.Node; import org.w3c.dom.Text; public class BrEditor extends DocBookEditor { @Override public EditorInstruction edit(EditorInstruction values) throws EditorException { setValues(super.edit(values)); BaseTagFactory dbfactory = getTagFactory(); traverse(false); Br brElement = (Br) values.getHtmlElement(); Script script = values.getScript(); boolean detectTrappedBrEnabled = script.isParameterOn( TrafoConstants.SECTION_DOCBOOK, TrafoConstants.PARAM_DETECT_TRAPPED_BR, true); if (detectTrappedBrEnabled && isTrapped(brElement, values.getCurrent())) { return finalizeValues(); } if (getCurrent() instanceof Para) { Node parent = getCurrent().getParentNode(); if (parent != null) { Para para = dbfactory.createPara(); parent.appendChild(para); setParent(para); setCurrent(para); } } else { getCurrent().appendChild(new TextImpl("\n")); } return finalizeValues(); } private boolean isTrapped(Br brElement, NodeImpl nodeImpl) { Node prevSibling = brElement.getPreviousSibling(); Node nextSibling = brElement.getNextSibling(); if (prevSibling == null || nextSibling == null) { return false; } if (prevSibling instanceof Text == false || nextSibling instanceof Text == false) { return false; } String prevText = prevSibling.getTextContent(); String nextText = nextSibling.getTextContent(); if (prevText == null || nextText == null) { return false; } if (nextText.matches("(?s)^[\\w\\u00A0].*$") == false) { return false; } if (prevText.matches("(?s)^.*[\\w\\u00A0-]$") == false) { return false; } if (prevText.endsWith("-")) { Node lastChild = nodeImpl.getLastChild(); if (lastChild instanceof Text) { Text lastChildText = (Text) lastChild; String buffer = lastChildText.getTextContent(); if (buffer != null && buffer.endsWith("-")) { buffer = StringServices.cutSuffix(buffer, "-"); lastChildText.setTextContent(buffer); } } } return true; } } src/java/org/dbdoclet/trafo/internal/html/docbook/editor/FontEditor.java0000644000175000017500000000404212644165236026541 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.docbook.editor; import org.dbdoclet.tag.docbook.BaseTagFactory; import org.dbdoclet.tag.docbook.Emphasis; import org.dbdoclet.tag.docbook.Simpara; import org.dbdoclet.tag.html.Font; import org.dbdoclet.trafo.html.EditorException; import org.dbdoclet.trafo.html.EditorInstruction; public class FontEditor extends DocBookEditor { @Override public EditorInstruction edit(EditorInstruction values) throws EditorException { setValues(super.edit(values)); BaseTagFactory dbfactory = getTagFactory(); traverse(true); Font font = (Font) values.getHtmlElement(); String color = font.getAttribute("color"); if (color == null || color.trim().length() == 0) { return finalizeValues(); } Emphasis emphasis = dbfactory.createEmphasis(); emphasis.setRole("color"); emphasis.setCondition(color); setCurrent(emphasis); if (emphasis.isValidParent(script.getTransformPosition(), getParent()) == false) { Simpara candidate = dbfactory.createSimpara(); candidate.setParentNode(getParent()); if (candidate.isValidParent(script.getTransformPosition(), getParent())) { getParent().appendChild(candidate); candidate.appendChild(getCurrent()); } } else { getCurrent().setParentNode(getParent()); getParent().appendChild(getCurrent()); } return finalizeValues(); } } src/java/org/dbdoclet/trafo/internal/html/docbook/editor/DocBookEditor.java0000644000175000017500000002274112644165236027161 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.docbook.editor; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.dbdoclet.ValidationResult; import org.dbdoclet.service.StringServices; import org.dbdoclet.tag.docbook.BaseTagFactory; import org.dbdoclet.tag.docbook.DocBookElement; import org.dbdoclet.tag.docbook.DocBookSchemaValidator; import org.dbdoclet.tag.docbook.DocBookTagFactory; import org.dbdoclet.tag.docbook.DocBookVersion; import org.dbdoclet.tag.docbook.Para; import org.dbdoclet.tag.docbook.Row; import org.dbdoclet.tag.html.HtmlElement; import org.dbdoclet.tag.html.Table; import org.dbdoclet.tag.html.Td; import org.dbdoclet.tag.html.Th; import org.dbdoclet.trafo.TrafoConstants; import org.dbdoclet.trafo.html.EditorException; import org.dbdoclet.trafo.html.EditorInstruction; import org.dbdoclet.trafo.html.IEditor; import org.dbdoclet.trafo.html.docbook.DocumentElementType; import org.dbdoclet.trafo.internal.html.docbook.LinkManager; import org.dbdoclet.trafo.script.Script; import org.dbdoclet.xiphias.dom.CharacterDataImpl; import org.dbdoclet.xiphias.dom.NodeImpl; import org.dbdoclet.xiphias.dom.TextImpl; import org.w3c.dom.Node; import org.xml.sax.SAXException; public abstract class DocBookEditor implements IEditor { protected static final String FSEP = System.getProperty("file.separator"); protected static final Log logger = LogFactory.getLog(DocBookEditor.class); protected static final String AUTOMATICALLY_INSERTED = "Automatically inserted"; private NodeImpl current; private NodeImpl parent; private HtmlElement child; private CharacterDataImpl characterDataNode; private boolean doIgnore; private boolean doTraverse; private LinkManager linkManager; private DocumentElementType documentElementType; private DocBookTagFactory tagFactory; protected Script script; protected void checkNode(Node node) { try { DocBookSchemaValidator validator = DocBookSchemaValidator .getInstance(); ValidationResult result = validator.validate( script.getTransformPosition(), node); if (result.isValid() == false) { logger.debug(result.getMessage()); } } catch (SAXException oops) { logger.fatal("Checking Node failed!", oops); } } public void copyCommonAttributes(HtmlElement html, DocBookElement dbk) { logger.debug("Copy common attributes from " + html + " to " + dbk); if (html == null || dbk == null) { return; } String htmlId = html.getId(); if (htmlId != null) { if (linkManager != null) { dbk.setId(linkManager.createUniqueId(htmlId)); } else { logger.warn("Attribute linkManager must not be null! " + html + ", " + toString()); } } if (script.isParameterOn(TrafoConstants.SECTION_DOCBOOK, TrafoConstants.PARAM_CREATE_CONDITION_ATTRIBUTE, false)) { StringBuilder buffer = new StringBuilder(); String htmlClass = html.getCssClass(); if (htmlClass != null) { buffer.append(htmlClass); buffer.append(","); } String htmlTitle = html.getTitle(); if (htmlTitle != null) { buffer.append(htmlTitle); buffer.append(","); } String condition = buffer.toString(); if (condition.trim().length() > 0) { condition = StringServices.cutSuffix(condition, ","); dbk.setCondition(condition); } } if (script.isParameterOn(TrafoConstants.SECTION_DOCBOOK, TrafoConstants.PARAM_CREATE_REMAP_ATTRIBUTE, false)) { createRemapAttribute(html, dbk); dbk.setLine(html.getLine()); dbk.setColumn(html.getColumn()); } dbk.setUserData("html", html, null); } private void createRemapAttribute(HtmlElement html, DocBookElement dbk) { String remap = String.format("%s:%d:%d", html.getTagName(), html.getLine(), html.getColumn()); dbk.setRemap(remap); } public EditorInstruction edit(EditorInstruction vo) throws EditorException { if (vo == null) { throw new IllegalArgumentException("Variable vo is null!"); } setValues(vo); BaseTagFactory dbfactory = getTagFactory(); if (parent instanceof Row) { if ((child != null) && !(child instanceof Td) && !(child instanceof Th) && !(child instanceof Table)) { Para para = dbfactory.createPara(); parent.appendChild(dbfactory.createEntry().appendChild(para)); parent = para; current = parent; } if (characterDataNode != null && characterDataNode instanceof TextImpl) { Para para = dbfactory.createPara(); parent.appendChild(dbfactory.createEntry().appendChild(para)); parent = para; current = parent; } } return finalizeValues(); } protected EditorInstruction finalizeValues() { EditorInstruction values = new EditorInstruction(script); values.doIgnore(doIgnore); values.doTraverse(doTraverse); values.setHtmlElement(child); values.setCurrent(current); values.setParent(parent); values.setCharacterDataNode(characterDataNode); checkNode(current); return values; } public CharacterDataImpl getCharacterDataNode() { return characterDataNode; } public NodeImpl getCurrent() { return current; } private DocBookVersion getDocBookVersion() { DocBookTagFactory dbfactory = getTagFactory(); if (dbfactory == null) { throw new IllegalStateException( "The field dbfactory must not be null!"); } DocBookVersion docBookVersion = dbfactory.getDocBookVersion(); if (docBookVersion == null) { throw new IllegalStateException( "The field docBookVersion must not be null!"); } return docBookVersion; } public DocumentElementType getDocumentElementType() { return documentElementType; } public HtmlElement getHtmlElement() { return child; } public LinkManager getLinkManager() { return linkManager; } public NodeImpl getParent() { return parent; } public DocBookTagFactory getTagFactory() { if (tagFactory == null) { tagFactory = new DocBookTagFactory(); } return tagFactory; } public boolean ignore() { return doIgnore; } public void ignore(boolean newDoIgnore) { this.doIgnore = newDoIgnore; } public boolean isDocBook5() { DocBookVersion docBookVersion = getDocBookVersion(); if (docBookVersion == DocBookVersion.V5_0) { return true; } else { return false; } } public boolean isDocBookVersion(DocBookVersion version) { if (version == null) { throw new IllegalArgumentException( "The argument version must not be null!"); } DocBookVersion docBookVersion = getDocBookVersion(); if (docBookVersion.equals(version)) { return true; } else { return false; } } protected boolean isList(NodeImpl parentNode) { if (parentNode instanceof DocBookElement) { DocBookElement parent = (DocBookElement) parentNode; if (parent.isList()) { return true; } } return false; } protected boolean isSection(NodeImpl parentNode) { if (parentNode instanceof DocBookElement) { DocBookElement parent = (DocBookElement) parentNode; if (parent.isSection()) { return true; } } return false; } public void setChild(HtmlElement newChild) { this.child = newChild; } public void setCurrent(NodeImpl current) { this.current = current; } public void setLinkManager(LinkManager linkManager) { this.linkManager = linkManager; } public void setParent(NodeImpl newParent) { this.parent = newParent; } public void setTagFactory(DocBookTagFactory tagFactory) { this.tagFactory = tagFactory; } public void setTextNode(TextImpl newTextNode) { this.characterDataNode = newTextNode; } public void setValues(EditorInstruction values) { script = values.getScript(); if (script == null) { throw new IllegalStateException( "Der Parameter Script darf nicht null sein!"); } child = values.getHtmlElement(); current = values.getCurrent(); doIgnore = values.doIgnore(); doTraverse = values.doTraverse(); parent = values.getParent(); characterDataNode = values.getCharacterDataNode(); } @Override public String toString() { String buffer = ""; buffer += ("editor[" + getClass().getName() + "]"); return buffer; } protected void transferId(HtmlElement html, DocBookElement db) { if (html == null) { throw new IllegalArgumentException( "The argument html must not be null!"); } if (db == null) { throw new IllegalArgumentException( "The argument db must not be null!"); } String id = html.getId(); if (id != null && id.length() > 0) { db.setId(id); } } public boolean traverse() { return doTraverse; } public void traverse(boolean newDoTraverse) { this.doTraverse = newDoTraverse; } protected String validateAlign(String align) { return tagFactory.validateAlign(align); } protected String validateSrc(String src) { if (src == null) { throw new IllegalArgumentException("Parameter src is null!"); } if (src.startsWith("http:") && (src.indexOf("?") > 0)) { src = src.substring(0, src.indexOf("?")); } return src; } } src/java/org/dbdoclet/trafo/internal/html/docbook/editor/StrongEditor.java0000644000175000017500000000340212644165236027106 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.docbook.editor; import org.dbdoclet.tag.docbook.DocBookElement; import org.dbdoclet.tag.docbook.DocBookTagFactory; import org.dbdoclet.trafo.TrafoConstants; import org.dbdoclet.trafo.html.EditorException; import org.dbdoclet.trafo.html.EditorInstruction; import org.dbdoclet.xiphias.dom.ElementImpl; import org.dbdoclet.xiphias.dom.NodeImpl; public class StrongEditor extends DocBookEditor { @Override public EditorInstruction edit(EditorInstruction values) throws EditorException { setValues(super.edit(values)); DocBookTagFactory dbfactory = getTagFactory(); ElementImpl child = getHtmlElement(); NodeImpl parent = getParent(); DocBookElement candidate; candidate = dbfactory.createEmphasis(child.getTextContent()); candidate.setParentNode(parent); candidate.setRole(TrafoConstants.DEFAULT_EMPHASIS_ROLE_BOLD); if (candidate.isValidParent(script.getTransformPosition(), parent)) { parent.appendChild(candidate); setCurrent(candidate); } traverse(false); return finalizeValues(); } } src/java/org/dbdoclet/trafo/internal/html/docbook/editor/CommentEditor.java0000644000175000017500000000446112644165236027242 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.docbook.editor; import org.dbdoclet.service.StringServices; import org.dbdoclet.trafo.html.EditorException; import org.dbdoclet.trafo.html.EditorInstruction; import org.dbdoclet.xiphias.XmlServices; import org.dbdoclet.xiphias.dom.CharacterDataImpl; import org.dbdoclet.xiphias.dom.CommentImpl; import org.dbdoclet.xiphias.dom.NodeImpl; public class CommentEditor extends DocBookEditor { @Override public EditorInstruction edit(EditorInstruction values) throws EditorException { try { setValues(super.edit(values)); NodeImpl parent = getParent(); getCurrent(); CharacterDataImpl node = getCharacterDataNode(); if (node instanceof CommentImpl == false) { return finalizeValues(); } CommentImpl comment = (CommentImpl) node; String text = comment.getData(); if (text == null) { return finalizeValues(); } text = text.trim(); text = StringServices.cutPrefix(text, ""); text = text.trim(); text = StringServices.cutPrefix(text, "[:dbdoclet:]"); text = text.trim(); if (text.startsWith("insert ")) { text = StringServices.cutPrefix(text, "insert"); text = text.trim(); text = XmlServices.textToXml(text); text = StringServices.replace(text, "(", "<"); text = StringServices.replace(text, ")", ">"); text = StringServices.replace(text, "<<", "("); text = StringServices.replace(text, ">>", ")"); parent.appendChild(text, false); } return finalizeValues(); } catch (Exception oops) { throw new EditorException(oops); } } } src/java/org/dbdoclet/trafo/internal/html/docbook/editor/IEditor.java0000644000175000017500000000242412644165236026025 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.docbook.editor; import org.dbdoclet.tag.docbook.Emphasis; import org.dbdoclet.trafo.TrafoConstants; import org.dbdoclet.trafo.html.EditorException; import org.dbdoclet.trafo.html.EditorInstruction; public class IEditor extends EmEditor { @Override public EditorInstruction edit(EditorInstruction values) throws EditorException { EditorInstruction evo = super.edit(values); Emphasis emphasis = getEmphasis(); if (emphasis != null) { emphasis.setRole(TrafoConstants.DEFAULT_EMPHASIS_ROLE_ITALIC); } return evo; } } src/java/org/dbdoclet/trafo/internal/html/docbook/editor/AddressEditor.java0000644000175000017500000000246312644165236027225 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.docbook.editor; import org.dbdoclet.tag.docbook.BaseTagFactory; import org.dbdoclet.trafo.html.EditorException; import org.dbdoclet.trafo.html.EditorInstruction; public class AddressEditor extends DocBookEditor { @Override public EditorInstruction edit(EditorInstruction values) throws EditorException { setValues(super.edit(values)); BaseTagFactory dbfactory = getTagFactory(); setCurrent(dbfactory.createAddress()); getCurrent().setParentNode(getParent()); getParent().appendChild(getCurrent()); traverse(true); return finalizeValues(); } } src/java/org/dbdoclet/trafo/internal/html/docbook/HtmlDocBookPanel.java0000644000175000017500000000763212644165236026333 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.docbook; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Locale; import java.util.PropertyResourceBundle; import java.util.ResourceBundle; import javax.swing.BorderFactory; import javax.swing.JCheckBox; import javax.swing.JComboBox; import org.dbdoclet.Identifier; import org.dbdoclet.jive.JiveFactory; import org.dbdoclet.jive.widget.EncodingChooser; import org.dbdoclet.jive.widget.GridPanel; import org.dbdoclet.jive.widget.LanguageListBox; import org.dbdoclet.service.ResourceServices; public class HtmlDocBookPanel extends GridPanel implements ActionListener { private static final long serialVersionUID = 1L; private final EncodingChooser sourceEncodingChooser; private final LanguageListBox languageChooser; private final JCheckBox useAbsoluteImagePath; private final JComboBox documentTypeComboBox; private final JComboBox profileComboBox; private final JiveFactory jf; private final ResourceBundle res; public HtmlDocBookPanel() { res = PropertyResourceBundle .getBundle("org/dbdoclet/trafo/html/docbook/Resources"); jf = JiveFactory.getInstance(); setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); sourceEncodingChooser = new EncodingChooser(); sourceEncodingChooser.addActionListener(jf); addLabeledComponent(jf.createLabel(ResourceServices.getString(res, "C_ENCODING_SOURCE")), sourceEncodingChooser); incrRow(); languageChooser = new LanguageListBox(Locale.getDefault()); languageChooser.addActionListener(jf); addLabeledComponent( jf.createLabel(ResourceServices.getString(res, "C_LANGUAGE")), languageChooser); incrRow(); useAbsoluteImagePath = jf.createCheckBox(new Identifier( "use.absolute.imagepath"), ResourceServices.getString(res, "C_USE_ABSOLUTE_IMAGE_PATH")); addComponent(useAbsoluteImagePath); incrRow(); String[] documentElementList = { "article", "book", "part" }; documentTypeComboBox = jf.createComboBox( new Identifier("document.type"), documentElementList); documentTypeComboBox.addActionListener(this); addLabeledComponent(jf.createLabel(ResourceServices.getString(res, "C_DOCUMENT_ELEMENT")), documentTypeComboBox); String[] profileList = { "Default", "Word", "LibreOffice" }; profileComboBox = jf.createComboBox(new Identifier("profile"), profileList); profileComboBox.addActionListener(this); addLabeledComponent( jf.createLabel(ResourceServices.getString(res, "C_PROFILE")), profileComboBox); leaveSubPanel(); addVerticalGlue(); languageChooser.setSelectedLocale(Locale.getDefault()); } @Override public void actionPerformed(ActionEvent e) { } public String getSourceEncoding() { return sourceEncodingChooser.getEncoding(); } public String getProfile() { Object selectedItem = profileComboBox.getSelectedItem(); if (selectedItem == null) { return null; } return selectedItem.toString(); } public String getLanguage() { return languageChooser.getSelectedLocale().getLanguage(); } public Boolean useAbsoluteImagePath() { return useAbsoluteImagePath.isSelected(); } public String getDocumentType() { return (String) documentTypeComboBox.getSelectedItem(); } } src/java/org/dbdoclet/trafo/internal/html/docbook/PostprocessStage1.java0000644000175000017500000001114712644165236026573 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.docbook; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import org.dbdoclet.progress.ProgressEvent; import org.dbdoclet.progress.ProgressListener; import org.dbdoclet.service.StringServices; import org.dbdoclet.tag.docbook.BaseTagFactory; import org.dbdoclet.tag.docbook.DocBookElement; import org.dbdoclet.tag.docbook.Entrytbl; import org.dbdoclet.tag.docbook.Informaltable; import org.dbdoclet.tag.docbook.Itemizedlist; import org.dbdoclet.tag.docbook.Listitem; import org.dbdoclet.tag.docbook.Orderedlist; import org.dbdoclet.tag.docbook.Para; import org.dbdoclet.tag.docbook.Table; import org.dbdoclet.trafo.TrafoConstants; import org.dbdoclet.trafo.script.Script; import org.dbdoclet.xiphias.HtmlServices; import org.dbdoclet.xiphias.dom.AbstractNodeVisitor; import org.dbdoclet.xiphias.dom.ElementImpl; import org.dbdoclet.xiphias.dom.NodeImpl; import org.w3c.dom.Node; import org.w3c.dom.Text; public class PostprocessStage1 extends AbstractNodeVisitor { private final ArrayList removeList; private final HashMap subtables; private final Script script; public PostprocessStage1(BaseTagFactory dbfactory, Script script, ArrayList listeners) { super(listeners); this.script = script; removeList = new ArrayList(); subtables = new HashMap(); } @Override public void accept(Node node) { fireProgressEvent(node.toString(), ProgressEvent.STAGE_ACTION); if (node instanceof Text) { replaceHtmlEntities((Text) node); } if (node instanceof ElementImpl) { NodeImpl elem = (NodeImpl) node; processPara(elem); processEntryTbl(elem); processListItem(elem); } } private void processListItem(NodeImpl elem) { if (elem == null || elem.getParentNode() == null) { return; } List stripPrefixesList = new ArrayList(); String text = elem.getTextContent(); if (elem instanceof Listitem && elem.getParentNode() instanceof Itemizedlist) { stripPrefixesList = script.getTextParameterList( TrafoConstants.SECTION_LIST_DETECTION, TrafoConstants.PARAM_ITEMIZED_STRIP_PREFIX); } if (elem instanceof Listitem && elem.getParentNode() instanceof Orderedlist) { stripPrefixesList = script.getTextParameterList( TrafoConstants.SECTION_LIST_DETECTION, TrafoConstants.PARAM_ORDERED_STRIP_PREFIX); } for (String stripPrefix : stripPrefixesList) { if (text.startsWith(stripPrefix)) { Text firstText = elem.findFirstText(); String firstContent = firstText.getData(); firstText.setData(StringServices.cutPrefix(firstContent, stripPrefix)); } } } private void processEntryTbl(NodeImpl elem) { Node node; if (elem instanceof Entrytbl) { node = NodeImpl.findParent(elem.getParentNode(), Entrytbl.class); if (node != null) { DocBookElement parentTable = (DocBookElement) NodeImpl .findParent(elem, Table.class); if (parentTable == null) { parentTable = (DocBookElement) NodeImpl.findParent(elem, Informaltable.class); } if (parentTable != null) { subtables.put((Entrytbl) elem, parentTable); } } } } private void processPara(NodeImpl elem) { if (elem instanceof Para && elem.hasSiblingElements() == true && elem.hasElementChildren() == false) { String text = elem.getTextContent(); text = text.replace((char) 160, ' '); if (text.length() == 0) { removeList.add(elem); } } } public void finish() { removeNodes(removeList); } public HashMap getSubtables() { return subtables; } private void replaceHtmlEntities(Text child) { String buffer = HtmlServices.replaceEntities(child.getTextContent()); child.setTextContent(buffer); } @Override public void openTag(Node node) throws Exception { // } @Override public void closeTag(Node node) throws Exception { // } } src/java/org/dbdoclet/trafo/internal/html/docbook/PreprocessStage1.java0000644000175000017500000000315312644165236026372 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.docbook; import java.util.ArrayList; import org.dbdoclet.progress.ProgressEvent; import org.dbdoclet.progress.ProgressListener; import org.dbdoclet.tag.html.HtmlElement; import org.dbdoclet.xiphias.dom.AbstractNodeVisitor; import org.w3c.dom.Node; public class PreprocessStage1 extends AbstractNodeVisitor { private ArrayList removeList; public PreprocessStage1(ArrayList listeners) { super(listeners); removeList = new ArrayList(); } public void accept(Node node) { fireProgressEvent(node.toString(), ProgressEvent.STAGE_ACTION); if (node instanceof HtmlElement) { HtmlElement htmlElement = (HtmlElement) node; htmlElement.init(); } } public void finish() { removeNodes(removeList); } public void openTag(Node node) throws Exception { // } public void closeTag(Node node) throws Exception { // } } src/java/org/dbdoclet/trafo/internal/html/docbook/DocBookVisitor.java0000644000175000017500000002171312644165236026102 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.docbook; import java.io.StringReader; import java.util.ArrayList; import java.util.Locale; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.dbdoclet.progress.ProgressListener; import org.dbdoclet.tag.docbook.Abstract; import org.dbdoclet.tag.docbook.DocBookFragment; import org.dbdoclet.tag.docbook.DocBookTagFactory; import org.dbdoclet.tag.docbook.Info; import org.dbdoclet.tag.html.HtmlDocument; import org.dbdoclet.tag.html.HtmlElement; import org.dbdoclet.tag.html.HtmlFragment; import org.dbdoclet.trafo.TrafoConstants; import org.dbdoclet.trafo.html.EditorInstruction; import org.dbdoclet.trafo.html.IEditorFactory; import org.dbdoclet.trafo.html.IHtmlVisitor; import org.dbdoclet.trafo.html.docbook.ListDetector; import org.dbdoclet.trafo.html.docbook.SectionDetector; import org.dbdoclet.trafo.internal.html.docbook.editor.DocBookEditorFactory; import org.dbdoclet.trafo.script.Script; import org.dbdoclet.xiphias.XPathServices; import org.dbdoclet.xiphias.XmlConstants; import org.dbdoclet.xiphias.dom.DocumentFragmentImpl; import org.dbdoclet.xiphias.dom.DocumentImpl; import org.dbdoclet.xiphias.dom.ElementImpl; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.w3c.dom.Text; import org.xml.sax.InputSource; public class DocBookVisitor implements IHtmlVisitor { private static Log logger = LogFactory.getLog(DocBookVisitor.class); private ArrayList listeners; private LinkManager linkManager; private DocBookTagFactory dbfactory; private Script script; private ListDetector listDetector; private DocBookEditorFactory docBookEditorFactory; public DocBookVisitor() { listDetector = new ListDetector(); linkManager = new LinkManager(); } public void addProgressListener(ProgressListener listener) { if (listener == null) { return; } if (listeners == null) { listeners = new ArrayList(); } listeners.add(listener); } @Override public boolean beforeEdit(EditorInstruction values) { listDetector.edit(values, dbfactory); SectionDetector sectionDetector = new SectionDetector(); sectionDetector.setScript(script); sectionDetector.setTagFactory(dbfactory); sectionDetector.setLinkManager(linkManager); HtmlElement htmlElement = values.getHtmlElement(); if (sectionDetector.isSection(htmlElement)) { sectionDetector.edit(values, dbfactory); return false; } return true; } @Override public DocumentFragmentImpl createDocumentFragment(HtmlFragment htmlFragment) { DocumentFragmentImpl fragment = new DocBookFragment(); ElementImpl documentElement = createDocumentElement(); fragment.setUserData("documentElement", documentElement, null); return fragment; } @Override public DocumentImpl createDocument(HtmlDocument htmlDoc) { DocumentImpl document = new DocumentImpl(); ElementImpl documentElement = createDocumentElement(); Info info = dbfactory.createInfo(); documentElement.appendChild(info); String title = script.getTextParameter(TrafoConstants.SECTION_DOCBOOK, TrafoConstants.PARAM_TITLE, null); if (title != null && title.trim().length() > 0) { info.appendChild(dbfactory.createTitle(title)); } else { generateTitle(htmlDoc, dbfactory, info); } String abstractText = script.getTextParameter( TrafoConstants.SECTION_DOCBOOK, TrafoConstants.PARAM_ABSTRACT, null); if (abstractText != null) { Abstract abstractElement = dbfactory.createAbstract(); info.appendChild(abstractElement); createAbstract(document, abstractElement, abstractText); } document.setDocumentElement(documentElement); documentElement.setDocument(document); return document; } public ElementImpl createDocumentElement() { ElementImpl documentElement = dbfactory.createSection(); String tagName = "article"; if (script != null) { tagName = script.getTextParameter(TrafoConstants.SECTION_DOCBOOK, TrafoConstants.PARAM_DOCUMENT_ELEMENT, "article"); tagName = tagName.toLowerCase(); } documentElement = dbfactory.createElementByName(tagName); if (documentElement == null) { throw new IllegalStateException("Can't create document element " + tagName); } documentElement.setNamespaceURI(XmlConstants.NAMESPACE_DOCBOOK); documentElement.setAttribute("xmlns", XmlConstants.NAMESPACE_DOCBOOK); documentElement.setAttribute("version", "5.0"); documentElement.setAttribute("xmlns:xl", XmlConstants.NAMESPACE_XLINK); documentElement.setAttribute("xmlns:xi", XmlConstants.NAMESPACE_XINCLUDE); String language = script.getTextParameter( TrafoConstants.SECTION_DOCBOOK, TrafoConstants.PARAM_LANGUAGE, null); logger.debug("Profile: Parameter language = " + language); if (language == null) { language = detectLanguage(documentElement); logger.debug("Detected language from HTML = " + language); if (language == null) { language = Locale.getDefault().getLanguage().toLowerCase(); logger.debug("Using default language from JVM = " + language); } } if (language != null) { documentElement.setAttributeNS(XmlConstants.NAMESPACE_XML, "xml:lang", language); } return documentElement; } @Override public IEditorFactory getEditorFactory() { if (docBookEditorFactory == null) { docBookEditorFactory = new DocBookEditorFactory(); docBookEditorFactory.setLinkManager(linkManager); docBookEditorFactory.setScript(script); docBookEditorFactory.setTagFactory(dbfactory); } return docBookEditorFactory; } @Override public Script getScript() { return script; } public void setScript(Script script) { this.script = script; } public void setTagFactory(DocBookTagFactory dbfactory) { this.dbfactory = dbfactory; } private void createAbstract(Document doc, Abstract abstractElement, String abstractText) { if (abstractText.trim().startsWith("<")) { abstractText = "" + abstractText + ""; } else { abstractText = "" + abstractText + ""; } try { DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory .newInstance(); DocumentBuilder documentBuilder = documentBuilderFactory .newDocumentBuilder(); Document docAbstract = documentBuilder.parse(new InputSource( new StringReader(abstractText))); Element documentElement = docAbstract.getDocumentElement(); documentElement = (Element) doc.importNode(documentElement, true); if (documentElement != null && documentElement.hasChildNodes()) { NodeList childList = documentElement.getChildNodes(); for (int i = 0; i < childList.getLength(); i++) { Node child = childList.item(i); abstractElement.appendChild(child); } } } catch (Exception oops) { logger.error("Parsing abstract failed!", oops); } } private void generateTitle(HtmlDocument htmlDoc, DocBookTagFactory dbf, Info info) { ElementImpl elem = (ElementImpl) XPathServices.getNode(htmlDoc, "/html/head/title"); if (elem == null) { for (int i = 1; i <= 6; i++) { if (elem == null) { elem = (ElementImpl) XPathServices.getNode(htmlDoc, "/html/body/h" + i + "[1]"); } } } if (elem != null) { info.appendChild(dbf.createTitle(elem.getTextContent())); } else { Text text = (Text) XPathServices.getNode(htmlDoc, "//text()[1]"); if (text != null) { info.appendChild(dbf.createTitle(text.getData())); } else { info.appendChild(dbf.createTitle("Herold")); } } } private String detectLanguage(Element documentElement) { String lang = documentElement.getAttributeNS( XmlConstants.NAMESPACE_XML, "lang"); if (lang == null) { lang = documentElement.getAttribute("lang"); } if (lang == null) { HtmlElement elem = (HtmlElement) XPathServices.getNode( documentElement, "//meta[@http-equiv='Content-Language']"); if (elem != null) { lang = elem.getAttribute("content"); } } return lang; } public void addProgressListeners(ArrayList newListeners) { if (newListeners == null) { return; } if (listeners == null) { listeners = new ArrayList(); } listeners.addAll(newListeners); } } src/java/org/dbdoclet/trafo/internal/html/dita/0000755000175000017500000000000012644165236021634 5ustar mathieumathieusrc/java/org/dbdoclet/trafo/internal/html/dita/HtmlDitaPanel.java0000644000175000017500000000754012644165236025173 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.dita; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Locale; import java.util.ResourceBundle; import javax.swing.BorderFactory; import javax.swing.JCheckBox; import javax.swing.JComboBox; import org.dbdoclet.Identifier; import org.dbdoclet.jive.JiveFactory; import org.dbdoclet.jive.widget.EncodingChooser; import org.dbdoclet.jive.widget.GridPanel; import org.dbdoclet.jive.widget.LanguageListBox; import org.dbdoclet.service.ResourceServices; public class HtmlDitaPanel extends GridPanel implements ActionListener { private static final long serialVersionUID = 1L; private final EncodingChooser sourceEncodingChooser; private final LanguageListBox languageChooser; private final JCheckBox useAbsoluteImagePath; private final JComboBox documentTypeComboBox; private final JComboBox profileComboBox; private final JiveFactory jf; private final ResourceBundle res; public HtmlDitaPanel() { res = ResourceBundle .getBundle("org/dbdoclet/trafo/html/docbook/Resources"); jf = JiveFactory.getInstance(); setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); sourceEncodingChooser = new EncodingChooser(); sourceEncodingChooser.addActionListener(jf); addLabeledComponent(jf.createLabel(ResourceServices.getString(res, "C_ENCODING_SOURCE")), sourceEncodingChooser); incrRow(); languageChooser = new LanguageListBox(Locale.getDefault()); languageChooser.addActionListener(jf); addLabeledComponent( jf.createLabel(ResourceServices.getString(res, "C_LANGUAGE")), languageChooser); incrRow(); useAbsoluteImagePath = jf.createCheckBox(new Identifier( "use.absolute.imagepath"), ResourceServices.getString(res, "C_USE_ABSOLUTE_IMAGE_PATH")); addComponent(useAbsoluteImagePath); incrRow(); String[] documentElementList = { "article", "book", "part" }; documentTypeComboBox = jf.createComboBox( new Identifier("document.type"), documentElementList); documentTypeComboBox.addActionListener(this); addLabeledComponent(jf.createLabel(ResourceServices.getString(res, "C_DOCUMENT_ELEMENT")), documentTypeComboBox); String[] profileList = { "Default", "Word", "LibreOffice" }; profileComboBox = jf.createComboBox(new Identifier("profile"), profileList); profileComboBox.addActionListener(this); addLabeledComponent( jf.createLabel(ResourceServices.getString(res, "C_PROFILE")), profileComboBox); leaveSubPanel(); addVerticalGlue(); languageChooser.setSelectedLocale(Locale.getDefault()); } @Override public void actionPerformed(ActionEvent e) { } public String getSourceEncoding() { return sourceEncodingChooser.getEncoding(); } public String getProfile() { Object selectedItem = profileComboBox.getSelectedItem(); if (selectedItem == null) { return null; } return selectedItem.toString(); } public String getLanguage() { return languageChooser.getSelectedLocale().getLanguage(); } public Boolean useAbsoluteImagePath() { return useAbsoluteImagePath.isSelected(); } public String getDocumentType() { return (String) documentTypeComboBox.getSelectedItem(); } } src/java/org/dbdoclet/trafo/internal/html/dita/PostprocessStage2.java0000644000175000017500000000610712644165236026075 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.dita; import java.util.ArrayList; import org.dbdoclet.progress.ProgressEvent; import org.dbdoclet.progress.ProgressListener; import org.dbdoclet.tag.dita.DitaTagFactory; import org.dbdoclet.tag.docbook.SectionElement; import org.dbdoclet.trafo.SectionNumberRemover; import org.dbdoclet.trafo.SpaceNormalizer; import org.dbdoclet.trafo.TrafoConstants; import org.dbdoclet.trafo.script.Script; import org.dbdoclet.xiphias.dom.AbstractNodeVisitor; import org.dbdoclet.xiphias.dom.ElementImpl; import org.dbdoclet.xiphias.dom.NodeImpl; import org.w3c.dom.Node; public class PostprocessStage2 extends AbstractNodeVisitor { private final DitaTagFactory tagFactory; private final ArrayList removeList; private final Script script; public PostprocessStage2(DitaTagFactory dbfactory, Script script, ArrayList listeners) { super(listeners); this.tagFactory = dbfactory; this.script = script; removeList = new ArrayList(); } public void finish() { removeNodes(removeList); } @Override public void accept(Node node) throws Exception { fireProgressEvent(node.toString(), ProgressEvent.STAGE_ACTION); if (node instanceof ElementImpl) { NodeImpl elem = (NodeImpl) node; if (elem instanceof SectionElement) { SectionElement sect = (SectionElement) elem; NodeImpl title = sect.findChildElement("title"); if (title != null) { SectionNumberRemover snr = new SectionNumberRemover(); snr.setRegex(script.getTextParameter( TrafoConstants.SECTION_SECTION_DETECTION, TrafoConstants.PARAM_SECTION_NUMBERING_PATTERN, null)); title.traverse(snr); if (script.isParameterOn(TrafoConstants.SECTION_DOCBOOK, TrafoConstants.PARAM_TITLE_NORMALIZE_SPACE, false)) { SpaceNormalizer sn = new SpaceNormalizer(); title.traverse(sn); } } String titleText = sect.getTitle(); if (titleText.length() == 0 && sect.hasContentChildren() == false) { removeList.add(sect); return; } if (titleText.length() > 0 && sect.hasContentChildren() == false) { sect.appendChild(tagFactory.createP("")); return; } } } } @Override public void openTag(Node node) throws Exception { // Auto-generated method stub } @Override public void closeTag(Node node) throws Exception { // Auto-generated method stub } } src/java/org/dbdoclet/trafo/internal/html/dita/PostprocessStage3.java0000644000175000017500000000446012644165236026076 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.dita; import java.util.HashMap; import org.dbdoclet.tag.dita.DitaTagFactory; import org.dbdoclet.tag.docbook.DocBookElement; import org.dbdoclet.tag.docbook.DocBookTagFactory; import org.dbdoclet.tag.docbook.Entrytbl; import org.dbdoclet.tag.docbook.Informaltable; import org.dbdoclet.tag.docbook.Tgroup; import org.dbdoclet.tag.docbook.Xref; public class PostprocessStage3 { private final HashMap subtables; public PostprocessStage3(DitaTagFactory tagFactory, HashMap subtables) { this.subtables = subtables; } public void process() { DocBookTagFactory dbfactory = new DocBookTagFactory(); if ((subtables != null) && (subtables.size() > 0)) { int index = 1; for (Entrytbl entrytbl : subtables.keySet()) { String id = "subtable." + index; Xref xref = dbfactory.createXref(id); DocBookElement table = subtables.get(entrytbl); DocBookElement entryTblParent = (DocBookElement) entrytbl .getParentNode(); entryTblParent.replaceChild(dbfactory.createEntry() .appendChild(xref), entrytbl); Informaltable it = dbfactory.createInformaltable(); it.setId(id); it.setXrefLabel("#" + index); Tgroup tgroup = dbfactory.createTgroup(); tgroup.setChildNodes(entrytbl.getChildNodes()); tgroup.setTrafoAttributes(entrytbl.getAttributesAsMap()); it.appendChild(tgroup); DocBookElement tableParent = (DocBookElement) table .getParentNode(); if (tableParent != null) { tableParent.insertAfter(it, table); } index++; } } } } src/java/org/dbdoclet/trafo/internal/html/dita/LinkManager.java0000644000175000017500000000461112644165236024671 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.dita; import java.util.ArrayList; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.dbdoclet.service.StringServices; import org.dbdoclet.xiphias.dom.ElementImpl; public class LinkManager { private static Log logger = LogFactory.getLog(LinkManager.class); private final ArrayList anchorIdList; private final ArrayList linkList; private final ArrayList usedIdList; public LinkManager() { linkList = new ArrayList(); anchorIdList = new ArrayList(); usedIdList = new ArrayList(); } public void addLink(ElementImpl link) { linkList.add(link); } public String createUniqueId(String str) { String id = str; id = ElementImpl.hardenId(id); String key = id; int counter = 1; while (anchorIdList.contains(key)) { key = id + "." + counter; counter++; } anchorIdList.add(key); logger.debug("Added reference " + key + "."); return key; } public ArrayList getLinkList() { return linkList; } public String getUniqueId(String str) { String id = str; logger.debug("#1 id=" + id); id = StringServices.cutPrefix(id, "#"); id = ElementImpl.hardenId(id); logger.debug("#2 id=" + id); if (id == null || id.length() == 0) { id = "dbdoclet.id"; } if (usedIdList.contains(id) == false) { usedIdList.add(id); } logger.debug("#3 id=" + id); return id; } public ArrayList getUnresolvedIds() { ArrayList list = new ArrayList(usedIdList); list.removeAll(anchorIdList); return list; } public ArrayList getUsedIdList() { return anchorIdList; } } src/java/org/dbdoclet/trafo/internal/html/dita/editor/0000755000175000017500000000000012644165244023121 5ustar mathieumathieusrc/java/org/dbdoclet/trafo/internal/html/dita/editor/HeadingEditor.java0000644000175000017500000000450612644165236026500 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.dita.editor; import java.util.HashMap; import org.dbdoclet.option.OptionException; import org.dbdoclet.tag.dita.DitaTagFactory; import org.dbdoclet.tag.html.HtmlDocument; import org.dbdoclet.tag.html.HtmlElement; import org.dbdoclet.trafo.html.EditorException; import org.dbdoclet.trafo.html.EditorInstruction; import org.dbdoclet.trafo.html.dita.SectionDetector; public class HeadingEditor extends DitaEditor { public static HashMap> validHtmlParentPathMap; static { validHtmlParentPathMap = new HashMap>(); validHtmlParentPathMap.put(new HtmlDocument().getNodeName(), HtmlElement.getAttributeMap()); validHtmlParentPathMap.put(org.dbdoclet.tag.html.Html.getTag(), HtmlElement.getAttributeMap()); validHtmlParentPathMap.put(HtmlElement.getTag(), HtmlElement.getAttributeMap()); validHtmlParentPathMap.put(HtmlElement.getTag(), HtmlElement.getAttributeMap()); validHtmlParentPathMap.put(HtmlElement.getTag(), HtmlElement.getAttributeMap()); validHtmlParentPathMap.put(HtmlElement.getTag(), HtmlElement.getAttributeMap()); } @Override public EditorInstruction edit(EditorInstruction values) throws EditorException { try { DitaTagFactory tagFactory = getTagFactory(); SectionDetector sectionDetector = new SectionDetector(); sectionDetector.setScript(script); sectionDetector.setTagFactory(tagFactory); sectionDetector.edit(values); setValues(super.edit(values)); return finalizeValues(); } catch (OptionException oops) { throw new EditorException(oops); } } } src/java/org/dbdoclet/trafo/internal/html/dita/editor/TextEditor.java0000644000175000017500000000370412644165236026064 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.dita.editor; import org.dbdoclet.tag.dita.DitaTagFactory; import org.dbdoclet.tag.dita.P; import org.dbdoclet.trafo.TrafoConstants; import org.dbdoclet.trafo.html.EditorException; import org.dbdoclet.trafo.html.EditorInstruction; import org.dbdoclet.xiphias.dom.NodeImpl; import org.w3c.dom.Node; public class TextEditor extends DitaEditor { @Override public EditorInstruction edit(EditorInstruction values) throws EditorException { try { setValues(super.edit(values)); DitaTagFactory tagFactory = getTagFactory(); NodeImpl parent = getParent(); NodeImpl current = getCurrent(); if (isContentModel(parent)) { if (getCharacterDataNode().getNodeType() == Node.TEXT_NODE) { P para = tagFactory.createP(); parent.appendChild(para); setParent(para); parent = para; setCurrent(para); current = para; } } String text = getCharacterDataNode().getData(); if (script.isParameterOn(TrafoConstants.SECTION_DOCBOOK, TrafoConstants.PARAM_COLLAPSE_PROTECTED_SPACE, false)) { text = text.replace('\u00a0', ' '); } current.appendChild(text); return finalizeValues(); } catch (Exception oops) { throw new EditorException(oops); } } } src/java/org/dbdoclet/trafo/internal/html/dita/editor/DitaEditorFactory.java0000644000175000017500000000700312644165236027345 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.dita.editor; import org.dbdoclet.tag.dita.DitaTagFactory; import org.dbdoclet.tag.html.HtmlElement; import org.dbdoclet.tag.javadoc.JavaDocElement; import org.dbdoclet.trafo.html.EditorFactoryException; import org.dbdoclet.trafo.html.IEditor; import org.dbdoclet.trafo.html.IEditorFactory; import org.dbdoclet.trafo.internal.html.dita.LinkManager; import org.dbdoclet.trafo.script.Script; public class DitaEditorFactory implements IEditorFactory { private LinkManager linkManager; private DitaTagFactory tagFactory; /* * (non-Javadoc) * * @see * org.dbdoclet.trafo.internal.html.docbook.editor.IEditorFactory#getChildEditor * (org.dbdoclet.tag.html.HtmlElement) */ @Override public IEditor getChildEditor(HtmlElement child) throws EditorFactoryException { if (child == null) { throw new EditorFactoryException( "Can't create editor for child null!"); } String str = child.getClass().getName(); if (child instanceof JavaDocElement) { str = "org.dbdoclet.trafo.internal.html.dita.editor.javadoc" + str.substring(str.lastIndexOf('.'), str.length()) + "Editor"; } else { str = "org.dbdoclet.trafo.internal.html.dita.editor" + str.substring(str.lastIndexOf('.'), str.length()) + "Editor"; } Class c; Object o; try { c = Class.forName(str); o = c.newInstance(); DitaEditor editor = (DitaEditor) o; editor.setLinkManager(linkManager); editor.setTagFactory(tagFactory); } catch (ClassNotFoundException oops) { DefaultEditor editor = new DefaultEditor(); editor.setLinkManager(linkManager); editor.setTagFactory(tagFactory); return editor; } catch (InstantiationException oops) { throw new EditorFactoryException("Can't create editor for " + child.getNodeName()); } catch (IllegalAccessException oops) { throw new EditorFactoryException( "No permission to create editor for " + child.getNodeName()); } return (IEditor) o; } /* * (non-Javadoc) * * @see org.dbdoclet.trafo.internal.html.docbook.editor.IEditorFactory# * getCommentEditor() */ @Override public IEditor getCommentEditor() { CommentEditor editor = new CommentEditor(); editor.setLinkManager(linkManager); editor.setTagFactory(tagFactory); return editor; } /* * (non-Javadoc) * * @see * org.dbdoclet.trafo.internal.html.docbook.editor.IEditorFactory#getTextEditor * () */ @Override public IEditor getTextEditor() { TextEditor editor = new TextEditor(); editor.setLinkManager(linkManager); editor.setTagFactory(tagFactory); return editor; } public void setLinkManager(LinkManager linkManager) { this.linkManager = linkManager; } public void setScript(Script script) { } public void setTagFactory(DitaTagFactory tagFactory) { this.tagFactory = tagFactory; } } src/java/org/dbdoclet/trafo/internal/html/dita/editor/DefaultEditor.java0000644000175000017500000000211712644165236026521 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.dita.editor; import org.dbdoclet.trafo.html.EditorException; import org.dbdoclet.trafo.html.EditorInstruction; public class DefaultEditor extends DitaEditor { @Override public EditorInstruction edit(EditorInstruction values) throws EditorException { EditorInstruction evo = super.edit(values); return evo; } } src/java/org/dbdoclet/trafo/internal/html/dita/editor/DitaEditor.java0000644000175000017500000002031112644165236026012 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.dita.editor; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.dbdoclet.tag.dita.DitaElement; import org.dbdoclet.tag.dita.DitaTagFactory; import org.dbdoclet.tag.dita.P; import org.dbdoclet.tag.docbook.DocBookElement; import org.dbdoclet.tag.docbook.Row; import org.dbdoclet.tag.html.HtmlElement; import org.dbdoclet.tag.html.Table; import org.dbdoclet.tag.html.Td; import org.dbdoclet.tag.html.Th; import org.dbdoclet.trafo.TrafoConstants; import org.dbdoclet.trafo.html.EditorException; import org.dbdoclet.trafo.html.EditorInstruction; import org.dbdoclet.trafo.html.IEditor; import org.dbdoclet.trafo.html.dita.DocumentElementType; import org.dbdoclet.trafo.internal.html.dita.LinkManager; import org.dbdoclet.trafo.script.Script; import org.dbdoclet.xiphias.dom.CharacterDataImpl; import org.dbdoclet.xiphias.dom.ElementImpl; import org.dbdoclet.xiphias.dom.NodeImpl; import org.dbdoclet.xiphias.dom.TextImpl; public abstract class DitaEditor implements IEditor { protected static final String FSEP = System.getProperty("file.separator"); protected static final Log logger = LogFactory.getLog(DitaEditor.class); protected static final String AUTOMATICALLY_INSERTED = "Automatically inserted"; private NodeImpl current; private NodeImpl parent; private HtmlElement child; private Object anything; private CharacterDataImpl characterDataNode; private boolean doIgnore; private boolean doTraverse; private LinkManager linkManager; private DocumentElementType documentElementType; private DitaTagFactory tagFactory; // protected DocBookTagFactory dbfactory = new DocBookTagFactory(); protected Script script; public void copyCommonAttributes(HtmlElement html, DitaElement ditaElement) { logger.debug("Copy common attributes from " + html + " to " + ditaElement); if (html == null || ditaElement == null) { return; } String htmlId = html.getId(); if (htmlId != null) { if (linkManager != null) { ditaElement.setId(linkManager.createUniqueId(htmlId)); } else { logger.warn("Attribute linkManager must not be null! " + html + ", " + toString()); } } if (script.isParameterOn(TrafoConstants.SECTION_DOCBOOK, TrafoConstants.PARAM_CREATE_REMAP_ATTRIBUTE, false)) { createRemapAttribute(html, ditaElement); ditaElement.setLine(html.getLine()); ditaElement.setColumn(html.getColumn()); } ditaElement.setUserData("html", html, null); } protected void copyCommonAttributes(ElementImpl htmlElement, DocBookElement anchor) { // TODO Auto-generated method stub } private void createRemapAttribute(HtmlElement html, DitaElement dbk) { String remap = String.format("%s:%d:%d", html.getTagName(), html.getLine(), html.getColumn()); dbk.setRemap(remap); } @Override public EditorInstruction edit(EditorInstruction vo) throws EditorException { if (vo == null) { throw new IllegalArgumentException("Variable vo is null!"); } setValues(vo); DitaTagFactory tagFactory = (DitaTagFactory) getTagFactory(); if (parent instanceof Row) { if ((child != null) && !(child instanceof Td) && !(child instanceof Th) && !(child instanceof Table)) { P para = tagFactory.createP(); // parent.appendChild(dbfactory.createEntry().appendChild(para)); parent = para; current = parent; } if (characterDataNode != null && characterDataNode instanceof TextImpl) { P para = tagFactory.createP(); // parent.appendChild(dbfactory.createEntry().appendChild(para)); parent = para; current = parent; } } return finalizeValues(); } protected EditorInstruction finalizeValues() { EditorInstruction values = new EditorInstruction(script); values.doIgnore(doIgnore); values.doTraverse(doTraverse); values.setHtmlElement(child); values.setCurrent(current); values.setParent(parent); values.setCharacterDataNode(characterDataNode); return values; } public Object getAnything() { return anything; } public CharacterDataImpl getCharacterDataNode() { return characterDataNode; } public NodeImpl getCurrent() { return current; } public DocumentElementType getDocumentElementType() { return documentElementType; } public HtmlElement getHtmlElement() { return child; } public LinkManager getLinkManager() { return linkManager; } public NodeImpl getParent() { return parent; } // @Override public DitaTagFactory getTagFactory() { if (tagFactory == null) { tagFactory = new DitaTagFactory(); } return tagFactory; } public boolean ignore() { return doIgnore; } public void ignore(boolean newDoIgnore) { this.doIgnore = newDoIgnore; } public void setAnything(Object newAnything) { this.anything = newAnything; } public void setChild(HtmlElement newChild) { this.child = newChild; } public void setCurrent(NodeImpl current) { this.current = current; } public void setLinkManager(LinkManager linkManager) { this.linkManager = linkManager; } public void setParent(NodeImpl newParent) { this.parent = newParent; } public void setTagFactory(DitaTagFactory tagFactory) { this.tagFactory = tagFactory; } public void setTextNode(TextImpl newTextNode) { this.characterDataNode = newTextNode; } public void setValues(EditorInstruction values) { script = values.getScript(); if (script == null) { throw new IllegalStateException("Der Parameter Script darf nicht null sein!"); } child = values.getHtmlElement(); current = values.getCurrent(); doIgnore = values.doIgnore(); doTraverse = values.doTraverse(); parent = values.getParent(); characterDataNode = values.getCharacterDataNode(); } @Override public String toString() { String buffer = ""; buffer += ("editor[" + getClass().getName() + "]"); return buffer; } protected void transferId(HtmlElement html, DocBookElement db) { if (html == null) { throw new IllegalArgumentException( "The argument html must not be null!"); } if (db == null) { throw new IllegalArgumentException( "The argument db must not be null!"); } String id = html.getId(); if (id != null && id.length() > 0) { db.setId(id); } } public boolean traverse() { return doTraverse; } public void traverse(boolean newDoTraverse) { this.doTraverse = newDoTraverse; } protected String validateAlign(String align) { //return dbfactory.validateAlign(align); return "left"; } protected String validateSrc(String src) { if (src == null) { throw new IllegalArgumentException("Parameter src is null!"); } if (src.startsWith("http:") && (src.indexOf("?") > 0)) { src = src.substring(0, src.indexOf("?")); } return src; } protected boolean isList(NodeImpl parentNode) { if (parentNode instanceof DocBookElement) { DocBookElement parent = (DocBookElement) parentNode; if (parent.isList()) { return true; } } return false; } protected DitaElement getDitaElementParent() { NodeImpl parent = getParent(); if (parent instanceof DitaElement) { return (DitaElement) parent; } return null; } protected boolean isSection(NodeImpl parentNode) { if (parentNode instanceof DocBookElement) { DocBookElement parent = (DocBookElement) parentNode; if (parent.isSection()) { return true; } } return false; } protected boolean isContentModel(NodeImpl parentNode) { if (parentNode instanceof DitaElement) { DitaElement parent = (DitaElement) parentNode; if (parent.isContentModel()) { return true; } } return false; } } src/java/org/dbdoclet/trafo/internal/html/dita/editor/CommentEditor.java0000644000175000017500000000444712644165236026547 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.dita.editor; import org.dbdoclet.service.StringServices; import org.dbdoclet.tag.dita.DitaElement; import org.dbdoclet.trafo.html.EditorException; import org.dbdoclet.trafo.html.EditorInstruction; import org.dbdoclet.xiphias.XmlServices; import org.dbdoclet.xiphias.dom.CharacterDataImpl; import org.dbdoclet.xiphias.dom.CommentImpl; public class CommentEditor extends DitaEditor { @Override public EditorInstruction edit(EditorInstruction values) throws EditorException { try { setValues(super.edit(values)); DitaElement parent = getDitaElementParent(); CharacterDataImpl node = getCharacterDataNode(); if (node instanceof CommentImpl == false) { return finalizeValues(); } CommentImpl comment = (CommentImpl) node; String text = comment.getData(); if (text == null) { return finalizeValues(); } text = text.trim(); text = StringServices.cutPrefix(text, ""); text = text.trim(); text = StringServices.cutPrefix(text, "[:dbdoclet:]"); text = text.trim(); if (text.startsWith("insert ")) { text = StringServices.cutPrefix(text, "insert"); text = text.trim(); text = XmlServices.textToXml(text); text = StringServices.replace(text, "(", "<"); text = StringServices.replace(text, ")", ">"); text = StringServices.replace(text, "<<", "("); text = StringServices.replace(text, ">>", ")"); parent.appendChild(text, false); } return finalizeValues(); } catch (Exception oops) { throw new EditorException(oops); } } } src/java/org/dbdoclet/trafo/internal/html/dita/DitaVisitor.java0000644000175000017500000002021312644165236024736 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.dita; import java.io.StringReader; import java.util.ArrayList; import java.util.Locale; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.dbdoclet.progress.ProgressListener; import org.dbdoclet.tag.dita.Abstract; import org.dbdoclet.tag.dita.DitaTagFactory; import org.dbdoclet.tag.docbook.BaseTagFactory; import org.dbdoclet.tag.docbook.DocBookTagFactory; import org.dbdoclet.tag.html.HtmlDocument; import org.dbdoclet.tag.html.HtmlElement; import org.dbdoclet.tag.html.HtmlFragment; import org.dbdoclet.trafo.TrafoConstants; import org.dbdoclet.trafo.html.EditorInstruction; import org.dbdoclet.trafo.html.IEditorFactory; import org.dbdoclet.trafo.html.IHtmlVisitor; import org.dbdoclet.trafo.html.dita.ListDetector; import org.dbdoclet.trafo.html.dita.SectionDetector; import org.dbdoclet.trafo.internal.html.dita.editor.DitaEditorFactory; import org.dbdoclet.trafo.script.Script; import org.dbdoclet.xiphias.XPathServices; import org.dbdoclet.xiphias.XmlConstants; import org.dbdoclet.xiphias.dom.DocumentFragmentImpl; import org.dbdoclet.xiphias.dom.DocumentImpl; import org.dbdoclet.xiphias.dom.ElementImpl; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.w3c.dom.Text; import org.xml.sax.InputSource; public class DitaVisitor implements IHtmlVisitor { private static Log logger = LogFactory.getLog(DitaVisitor.class); private ArrayList listeners; private LinkManager linkManager; private BaseTagFactory dbfactory = new DocBookTagFactory(); private DitaTagFactory tagFactory; private Script script; private ListDetector listDetector; private DitaEditorFactory editorFactory; public DitaVisitor() { listDetector = new ListDetector(); linkManager = new LinkManager(); } public void addProgressListener(ProgressListener listener) { if (listener == null) { return; } if (listeners == null) { listeners = new ArrayList(); } listeners.add(listener); } @Override public boolean beforeEdit(EditorInstruction values) { listDetector.edit(values, dbfactory); SectionDetector sectionDetector = new SectionDetector(); sectionDetector.setScript(script); sectionDetector.setTagFactory(tagFactory); sectionDetector.setLinkManager(linkManager); HtmlElement htmlElement = values.getHtmlElement(); if (sectionDetector.isSection(htmlElement)) { sectionDetector.edit(values); return false; } return true; } @Override public DocumentFragmentImpl createDocumentFragment(HtmlFragment htmlFragment) { DocumentFragmentImpl fragment = new DocumentFragmentImpl(); // ElementImpl documentElement = createDocumentElement(); // fragment.appendChild(documentElement); return fragment; } @Override public DocumentImpl createDocument(HtmlDocument htmlDoc) { ElementImpl topic = createDocumentElement(); DocumentImpl document = new DocumentImpl(); String title = script.getTextParameter(TrafoConstants.SECTION_DITA, TrafoConstants.PARAM_TITLE, null); if (title != null && title.trim().length() > 0) { topic.appendChild(tagFactory.createTitle(title)); } else { generateTitle(htmlDoc, tagFactory, topic); } String abstractText = script .getTextParameter(TrafoConstants.SECTION_DOCBOOK, TrafoConstants.PARAM_ABSTRACT, null); if (abstractText != null) { Abstract abstractElement = tagFactory.createAbstract(); topic.appendChild(abstractElement); createAbstract(document, abstractElement, abstractText); } document.setDocumentElement(topic); topic.setDocument(document); return document; } private ElementImpl createDocumentElement() { ElementImpl documentElement = tagFactory.createTopic(); documentElement.setId("topic"); String language = script.getTextParameter(TrafoConstants.SECTION_DITA, TrafoConstants.PARAM_LANGUAGE, null); logger.debug("Profile: Parameter language = " + language); if (language == null) { language = detectLanguage(documentElement); logger.debug("Detected language from HTML = " + language); if (language == null) { language = Locale.getDefault().getLanguage().toLowerCase(); logger.debug("Using default language from JVM = " + language); } } if (language != null) { documentElement.setAttributeNS( XmlConstants.NAMESPACE_XML, "xml:lang", language); } return documentElement; } @Override public IEditorFactory getEditorFactory() { if (editorFactory == null) { editorFactory = new DitaEditorFactory(); editorFactory.setLinkManager(linkManager); editorFactory.setScript(script); editorFactory.setTagFactory(tagFactory); } return editorFactory; } @Override public Script getScript() { return script; } public void setScript(Script script) { this.script = script; } public void setTagFactory(DitaTagFactory tagFactory) { this.tagFactory = tagFactory; } private void createAbstract(Document doc, Abstract abstractElement, String abstractText) { if (abstractText.trim().startsWith("<")) { abstractText = "" + abstractText + ""; } else { abstractText = "" + abstractText + ""; } try { DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory .newInstance(); DocumentBuilder documentBuilder = documentBuilderFactory .newDocumentBuilder(); Document docAbstract = documentBuilder.parse(new InputSource( new StringReader(abstractText))); Element documentElement = docAbstract.getDocumentElement(); documentElement = (Element) doc.importNode(documentElement, true); if (documentElement != null && documentElement.hasChildNodes()) { NodeList childList = documentElement.getChildNodes(); for (int i = 0; i < childList.getLength(); i++) { Node child = childList.item(i); abstractElement.appendChild(child); } } } catch (Exception oops) { logger.error("Parsing abstract failed!", oops); } } private void generateTitle(HtmlDocument htmlDoc, DitaTagFactory dbf, ElementImpl parent) { ElementImpl elem = (ElementImpl) XPathServices.getNode(htmlDoc, "/html/head/title"); if (elem == null) { for (int i = 1; i <= 6; i++) { if (elem == null) { elem = (ElementImpl) XPathServices.getNode(htmlDoc, "/html/body/h" + i + "[1]"); } } } if (elem != null) { parent.appendChild(dbf.createTitle(elem.getTextContent())); } else { Text text = (Text) XPathServices.getNode(htmlDoc, "//text()[1]"); if (text != null) { parent.appendChild(dbf.createTitle(text.getData())); } else { parent.appendChild(dbf.createTitle("Herold")); } } } private String detectLanguage(Element documentElement) { String lang = documentElement.getAttributeNS(XmlConstants.NAMESPACE_XML, "lang"); if (lang == null) { lang = documentElement.getAttribute("lang"); } if (lang == null) { HtmlElement elem = (HtmlElement) XPathServices.getNode( documentElement, "//meta[@http-equiv='Content-Language']"); if (elem != null) { lang = elem.getAttribute("content"); } } return lang; } public void addProgressListeners(ArrayList newListeners) { if (newListeners == null) { return; } if (listeners == null) { listeners = new ArrayList(); } listeners.addAll(newListeners); } } src/java/org/dbdoclet/trafo/internal/html/dita/PostprocessStage1.java0000644000175000017500000001117112644165236026071 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.dita; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import org.dbdoclet.progress.ProgressEvent; import org.dbdoclet.progress.ProgressListener; import org.dbdoclet.service.StringServices; import org.dbdoclet.tag.dita.DitaTagFactory; import org.dbdoclet.tag.docbook.DocBookElement; import org.dbdoclet.tag.docbook.Entrytbl; import org.dbdoclet.tag.docbook.Informaltable; import org.dbdoclet.tag.docbook.Itemizedlist; import org.dbdoclet.tag.docbook.Listitem; import org.dbdoclet.tag.docbook.Orderedlist; import org.dbdoclet.tag.docbook.Para; import org.dbdoclet.tag.docbook.Table; import org.dbdoclet.trafo.TrafoConstants; import org.dbdoclet.trafo.script.Script; import org.dbdoclet.xiphias.HtmlServices; import org.dbdoclet.xiphias.dom.AbstractNodeVisitor; import org.dbdoclet.xiphias.dom.ElementImpl; import org.dbdoclet.xiphias.dom.NodeImpl; import org.w3c.dom.Node; import org.w3c.dom.Text; public class PostprocessStage1 extends AbstractNodeVisitor { private final ArrayList removeList; private final HashMap subtables; private final Script script; public PostprocessStage1(DitaTagFactory tagFactory, Script script, ArrayList listeners) { super(listeners); this.script = script; removeList = new ArrayList(); subtables = new HashMap(); } @Override public void accept(Node node) { fireProgressEvent(node.toString(), ProgressEvent.STAGE_ACTION); if (node instanceof Text) { replaceHtmlEntities((Text) node); } if (node instanceof ElementImpl) { NodeImpl elem = (NodeImpl) node; processPara(elem); processEntryTbl(elem); processListItem(elem); } } private void processListItem(NodeImpl elem) { if (elem == null || elem.getParentNode() == null) { return; } List stripPrefixesList = new ArrayList(); String text = elem.getTextContent(); if (elem instanceof Listitem && elem.getParentNode() instanceof Itemizedlist) { stripPrefixesList = script.getTextParameterList( TrafoConstants.SECTION_LIST_DETECTION, TrafoConstants.PARAM_ITEMIZED_STRIP_PREFIX); } if (elem instanceof Listitem && elem.getParentNode() instanceof Orderedlist) { stripPrefixesList = script.getTextParameterList( TrafoConstants.SECTION_LIST_DETECTION, TrafoConstants.PARAM_ORDERED_STRIP_PREFIX); } for (String stripPrefix : stripPrefixesList) { if (text.startsWith(stripPrefix)) { Text firstText = elem.findFirstText(); String firstContent = firstText.getData(); firstText.setData(StringServices.cutPrefix(firstContent, stripPrefix)); } } } private void processEntryTbl(NodeImpl elem) { Node node; if (elem instanceof Entrytbl) { node = NodeImpl.findParent(elem.getParentNode(), Entrytbl.class); if (node != null) { DocBookElement parentTable = (DocBookElement) NodeImpl .findParent(elem, Table.class); if (parentTable == null) { parentTable = (DocBookElement) NodeImpl.findParent(elem, Informaltable.class); } if (parentTable != null) { subtables.put((Entrytbl) elem, parentTable); } } } } private void processPara(NodeImpl elem) { if (elem instanceof Para && elem.hasSiblingElements() == true && elem.hasElementChildren() == false) { String text = elem.getTextContent(); text = text.replace((char) 160, ' '); text = text.trim(); if (text.length() == 0) { removeList.add(elem); } } } public void finish() { removeNodes(removeList); } public HashMap getSubtables() { return subtables; } private void replaceHtmlEntities(Text child) { String buffer = HtmlServices.replaceEntities(child.getTextContent()); child.setTextContent(buffer); } @Override public void openTag(Node node) throws Exception { // } @Override public void closeTag(Node node) throws Exception { // } } src/java/org/dbdoclet/trafo/internal/html/dita/PreprocessStage1.java0000644000175000017500000000321112644165236025666 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.internal.html.dita; import java.util.ArrayList; import org.dbdoclet.progress.ProgressEvent; import org.dbdoclet.progress.ProgressListener; import org.dbdoclet.tag.html.HtmlElement; import org.dbdoclet.xiphias.dom.AbstractNodeVisitor; import org.w3c.dom.Node; public class PreprocessStage1 extends AbstractNodeVisitor { private ArrayList removeList; public PreprocessStage1(ArrayList listeners) { super(listeners); removeList = new ArrayList(); } @Override public void accept(Node node) { fireProgressEvent(node.toString(), ProgressEvent.STAGE_ACTION); if (node instanceof HtmlElement) { HtmlElement htmlElement = (HtmlElement) node; htmlElement.init(); } } public void finish() { removeNodes(removeList); } @Override public void openTag(Node node) throws Exception { // } @Override public void closeTag(Node node) throws Exception { // } } src/java/org/dbdoclet/trafo/html/0000755000175000017500000000000012644165236017077 5ustar mathieumathieusrc/java/org/dbdoclet/trafo/html/EditorException.java0000644000175000017500000000332112644165236023046 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.html; import java.io.PrintStream; import java.io.PrintWriter; public class EditorException extends Exception { private static final long serialVersionUID = 1L; private Exception cause; public EditorException(Exception oops) { super(oops.getClass().getName() + ": " + oops.getMessage()); cause = oops; } public EditorException(String msg) { super(msg); } @Override public void printStackTrace() { if (cause != null) { System.err.println("\nCause:"); cause.printStackTrace(); System.err.println("-------"); } super.printStackTrace(); } @Override public void printStackTrace(PrintStream stream) { printStackTrace(new PrintWriter(stream)); } @Override public void printStackTrace(PrintWriter writer) { if (writer == null) { return; } if (cause != null) { writer.println("\nCause:"); cause.printStackTrace(writer); writer.println("-------"); } super.printStackTrace(writer); } } src/java/org/dbdoclet/trafo/html/IEditorFactory.java0000644000175000017500000000173512644165236022637 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.html; import org.dbdoclet.tag.html.HtmlElement; public interface IEditorFactory { public IEditor getChildEditor(HtmlElement child) throws EditorFactoryException; public IEditor getCommentEditor(); public IEditor getTextEditor(); }src/java/org/dbdoclet/trafo/html/EditorFactoryException.java0000644000175000017500000000165212644165236024403 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.html; public class EditorFactoryException extends Exception { private static final long serialVersionUID = 1L; public EditorFactoryException(String msg) { super(msg); } } src/java/org/dbdoclet/trafo/html/IHtmlProvider.java0000644000175000017500000000313412644165236022473 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.html; import java.io.IOException; import java.util.ArrayList; import org.dbdoclet.html.parser.ParserException; import org.dbdoclet.html.tokenizer.TokenizerException; import org.dbdoclet.progress.ProgressListener; import org.dbdoclet.tag.html.HtmlDocument; import org.dbdoclet.tag.html.HtmlFragment; import org.w3c.dom.Document; import org.w3c.dom.DocumentFragment; public interface IHtmlProvider { public Document traverse(HtmlDocument htmlDocument, IHtmlVisitor visitor) throws Exception; public DocumentFragment traverse(HtmlFragment htmlFragment, IHtmlVisitor visitor); public HtmlDocument parseDocument(String htmlCode) throws IOException, ParserException, TokenizerException; public HtmlFragment parseFragment(String htmlCode) throws IOException, ParserException, TokenizerException; public void setProgressListeners(ArrayList listeners); } src/java/org/dbdoclet/trafo/html/docbook/0000755000175000017500000000000012644165236020517 5ustar mathieumathieusrc/java/org/dbdoclet/trafo/html/docbook/ListDetector.java0000644000175000017500000002355612644165236024002 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.html.docbook; import java.util.Stack; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.dbdoclet.tag.docbook.BaseTagFactory; import org.dbdoclet.tag.docbook.Itemizedlist; import org.dbdoclet.tag.docbook.Listitem; import org.dbdoclet.tag.docbook.Orderedlist; import org.dbdoclet.tag.html.HtmlElement; import org.dbdoclet.trafo.TrafoConstants; import org.dbdoclet.trafo.html.EditorInstruction; import org.dbdoclet.trafo.param.TextParam; import org.dbdoclet.trafo.script.Script; import org.dbdoclet.xiphias.XmlServices; import org.dbdoclet.xiphias.dom.ElementImpl; import org.dbdoclet.xiphias.dom.NodeImpl; import org.w3c.dom.Element; import org.w3c.dom.Node; public class ListDetector { private static final Log logger = LogFactory.getLog(ListDetector.class); private final Stack cssClassStack = new Stack(); public enum ListType { ITEMIZED, ORDERED }; public void closeList(EditorInstruction values) { HtmlElement child = values.getHtmlElement(); String cssClass = child.getCssClass(); logger.trace(String.format("Closing list %s, %s.", cssClass, child)); NodeImpl parent = values.getParent(); Script script = values.getScript(); if (isItemizedListElement(child, script) || isOrderedListElement(child, script)) { return; } if (cssClassStack.size() > 1) { closeNestedList(cssClass, values); parent = values.getParent(); } Node previous = child.getPreviousSibling(); while (previous != null && previous instanceof Element == false) { previous = previous.getNextSibling(); } // Das Geschwisterelement vor dem aktuellen Element war ein // Listenelement. Die Liste wird abgeschlossen. // if (previous != null // && (isItemizedListElement((HtmlElement) previous, script) || // isOrderedListElement( // (HtmlElement) previous, script))) { if (parent instanceof Listitem) { parent = (ElementImpl) parent.getParentNode(); } if (parent instanceof Itemizedlist || parent instanceof Orderedlist) { values.setParent((ElementImpl) parent.getParentNode()); values.setCurrent((ElementImpl) parent.getParentNode()); } cssClassStack.clear(); // } } private void closeNestedList(String cssClass, EditorInstruction values) { logger.trace(String.format("closeNestedList %s %s", cssClass, values.getHtmlElement())); if (cssClassStack.empty() == true) { return; } String currentCssClass = cssClassStack.peek(); while (cssClassStack.size() > 1 && currentCssClass.equals(cssClass) == false) { cssClassStack.pop(); NodeImpl parent = values.getParent(); // Eingebettete Liste finden while (parent != null && parent instanceof Itemizedlist == false && parent instanceof Orderedlist == false) { Node parentNode = parent.getParentNode(); if (parentNode instanceof ElementImpl == false) { logger.warn("Couldn't find nested list element for HTML element " + values.getHtmlElement() + ". DocBookParent = " + XmlServices.printPath(values.getParent()) + ". Stack = " + cssClassStack); parent = null; break; } parent = (ElementImpl) parentNode; } if (parent != null) { // Übergeordnete Liste suchen parent = (ElementImpl) parent.getParentNode(); while (parent != null && parent instanceof Itemizedlist == false && parent instanceof Orderedlist == false) { Node parentNode = parent.getParentNode(); if (parentNode instanceof ElementImpl == false) { logger.warn("Couldn't find parent list for a nested list for HTML element " + values.getHtmlElement() + ". DocBookParent = " + XmlServices.printPath(values.getParent()) + ". Stack = " + cssClassStack); parent = null; break; } parent = (ElementImpl) parentNode; } // Falls eine übergeordnete Liste gefunden wurde, wird diese zum // neuen Vaterelement gemacht. if (parent != null) { values.setParent(parent); values.setCurrent(parent); } } } } public void edit(EditorInstruction values, BaseTagFactory dbfactory) { HtmlElement htmlElement = values.getHtmlElement(); Script script = values.getScript(); if (isItemizedListElement(htmlElement, script)) { edit(values, dbfactory, ListDetector.ListType.ITEMIZED); } else if (isOrderedListElement(htmlElement, script)) { edit(values, dbfactory,ListDetector.ListType.ORDERED); } else if (isEndOfList(values, script)) { closeList(values); } } private boolean isEndOfList(EditorInstruction values, Script script) { if (cssClassStack.size() == 0) { return false; } HtmlElement htmlElement = values.getHtmlElement(); while (htmlElement != null) { if (isItemizedListElement(htmlElement, script) || isOrderedListElement(htmlElement, script)) { return false; } Node node = htmlElement.getParentNode(); if (node instanceof HtmlElement) { htmlElement = (HtmlElement) node; } else { return true; } } return true; } public void edit(EditorInstruction values, BaseTagFactory dbfactory, ListType type) { HtmlElement htmlElement = values.getHtmlElement(); String cssClass = htmlElement.getCssClass(); logger.trace(String.format("Editing list element %s, %s.", cssClass, htmlElement)); NodeImpl parent = values.getParent(); if (isNestedList(cssClass) == false && parent instanceof Listitem) { parent = (ElementImpl) parent.getParentNode(); } parent = createListElement(type, cssClass, dbfactory, parent); if (isParentList(cssClass)) { closeNestedList(cssClass, values); parent = values.getParent(); } Listitem listItem = dbfactory.createListitem(); parent.appendChild(listItem); values.setParent(listItem); values.setCurrent(listItem); } private NodeImpl createListElement(ListType type, String cssClass, BaseTagFactory dbfactory, NodeImpl parent) { if (type == ListType.ITEMIZED && parent instanceof Itemizedlist == false) { Itemizedlist itemizedList = dbfactory.createItemizedlist(); parent.appendChild(itemizedList); parent = itemizedList; cssClassStack.push(cssClass); } if (type == ListType.ORDERED && parent instanceof Orderedlist == false) { Orderedlist orderedList = dbfactory.createOrderedlist(); parent.appendChild(orderedList); parent = orderedList; cssClassStack.push(cssClass); } return parent; } /** * Die Methode prüft, ob das übergebene HTML-Element eine CSS-Klasse * besitzt, die auf einen der regulären Ausdrücke aus der Liste des * Parameters itemized-attribute-class passt. Ist dies der Fall wird mit * Hilfe des Rückgabewerts true signalisiert, dass das Element eigentlich * ein Listenelement einer ungeordneten Liste ist. * * @param element * @param script * @return */ public boolean isItemizedListElement(HtmlElement element, Script script) { TextParam paramClasses = (TextParam) script.getParameter( TrafoConstants.SECTION_LIST_DETECTION, TrafoConstants.PARAM_ITEMIZED_ATTRIBUTE_CLASS); String cssClass = element.getCssClass(); if (cssClass == null || paramClasses == null) { return false; } for (String regex : paramClasses.getValues()) { Pattern pattern = Pattern.compile(regex); Matcher matcher = pattern.matcher(cssClass); if (matcher.matches()) { return true; } } return false; } /** * Die Methode prüft, ob das übergebene HTML-Element eine CSS-Klasse * besitzt, die auf einen der regulären Ausdrücke aus der Liste des * Parameters ordered-attribute-class passt. Ist dies der Fall wird mit * Hilfe des Rückgabewerts true signalisiert, dass das Element eigentlich * ein Listenelement einer geordneten Liste ist. * * @param element * @param script * @return */ public boolean isOrderedListElement(HtmlElement element, Script script) { TextParam paramClasses = (TextParam) script.getParameter( TrafoConstants.SECTION_LIST_DETECTION, TrafoConstants.PARAM_ORDERED_ATTRIBUTE_CLASS); String cssClass = element.getCssClass(); if (cssClass == null || paramClasses == null) { return false; } for (String regex : paramClasses.getValues()) { Pattern pattern = Pattern.compile(regex); Matcher matcher = pattern.matcher(cssClass); if (matcher.matches()) { return true; } } return false; } /** * Ermittelt, ob die CSS-Klasse zu einer neuen geschachtelten Liste gehört. * Dazu wird geprüft, ob sich die CSS-Klasse geändert hat und nicht einer * übergeordneten Liste zu geordnet ist. * * @param cssClass * @return */ private boolean isNestedList(String cssClass) { if (cssClass == null) { return false; } if (cssClassStack.size() == 0 || cssClass.equals(cssClassStack.peek()) == false) { for (String elem : cssClassStack) { if (elem.equals(cssClass)) { return false; } } return true; } return false; } private boolean isParentList(String cssClass) { if (cssClass == null) { return false; } if (cssClassStack.size() == 0 || cssClass.equals(cssClassStack.peek()) == false) { for (String elem : cssClassStack) { if (elem.equals(cssClass)) { return true; } } } return false; } } src/java/org/dbdoclet/trafo/html/docbook/Resources_de.properties0000644000175000017500000000024112644165236025254 0ustar mathieumathieuC_DOCUMENT_ELEMENT=Dokumenttyp C_ENCODING_SOURCE=Zeichencodierung der Quelldatei C_LANGUAGE=Sprache C_PROFILE=Profil C_USE_ABSOLUTE_IMAGE_PATH=Absolute Bildpfadesrc/java/org/dbdoclet/trafo/html/docbook/Resources.properties0000644000175000017500000000023412644165236024606 0ustar mathieumathieuC_DOCUMENT_ELEMENT=Document Type C_ENCODING_SOURCE=Source File Encoding C_LANGUAGE=Language C_PROFILE=Profile C_USE_ABSOLUTE_IMAGE_PATH=Absolute Image Pathssrc/java/org/dbdoclet/trafo/html/docbook/SectionDetector.java0000644000175000017500000003603512644165236024467 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.html.docbook; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.dbdoclet.option.OptionException; import org.dbdoclet.service.StringServices; import org.dbdoclet.tag.docbook.Article; import org.dbdoclet.tag.docbook.Book; import org.dbdoclet.tag.docbook.Bridgehead; import org.dbdoclet.tag.docbook.Chapter; import org.dbdoclet.tag.docbook.DocBookDocument; import org.dbdoclet.tag.docbook.DocBookElement; import org.dbdoclet.tag.docbook.DocBookFragment; import org.dbdoclet.tag.docbook.DocBookTagFactory; import org.dbdoclet.tag.docbook.Para; import org.dbdoclet.tag.docbook.Part; import org.dbdoclet.tag.docbook.Partintro; import org.dbdoclet.tag.docbook.Refentry; import org.dbdoclet.tag.docbook.Refname; import org.dbdoclet.tag.docbook.Refnamediv; import org.dbdoclet.tag.docbook.Refpurpose; import org.dbdoclet.tag.docbook.Refsect1; import org.dbdoclet.tag.docbook.Refsect2; import org.dbdoclet.tag.docbook.Refsect3; import org.dbdoclet.tag.docbook.Refsect4; import org.dbdoclet.tag.docbook.Refsect5; import org.dbdoclet.tag.docbook.Reference; import org.dbdoclet.tag.docbook.Sect1; import org.dbdoclet.tag.docbook.Sect2; import org.dbdoclet.tag.docbook.Sect3; import org.dbdoclet.tag.docbook.Sect4; import org.dbdoclet.tag.docbook.Sect5; import org.dbdoclet.tag.docbook.Section; import org.dbdoclet.tag.docbook.Title; import org.dbdoclet.tag.html.HeadingElement; import org.dbdoclet.tag.html.HtmlElement; import org.dbdoclet.trafo.TrafoConstants; import org.dbdoclet.trafo.html.EditorInstruction; import org.dbdoclet.trafo.internal.html.docbook.LinkManager; import org.dbdoclet.trafo.internal.html.docbook.editor.DefaultEditor; import org.dbdoclet.trafo.internal.html.docbook.editor.HeadingEditor; import org.dbdoclet.trafo.param.TextParam; import org.dbdoclet.trafo.script.Script; import org.dbdoclet.xiphias.dom.NodeImpl; import org.w3c.dom.DocumentFragment; import org.w3c.dom.Element; import org.w3c.dom.Node; public class SectionDetector { private static Class[] bookMap = { Book.class, Chapter.class, Section.class, Section.class, Section.class, Section.class }; private static Class[] articleMap = { Article.class, Section.class, Section.class, Section.class, Section.class, Section.class }; private static Class[] partIntroMap = { Partintro.class, Section.class, Section.class, Section.class, Section.class, Section.class }; private static Class[] chapterMap = { Chapter.class, Section.class, Section.class, Section.class, Section.class, Section.class }; private static Class[] sect1Map = { Sect1.class, Sect2.class, Sect3.class, Sect4.class, Sect5.class, Sect5.class }; private static Class[] sect2Map = { Sect2.class, Sect3.class, Sect4.class, Sect5.class, Sect5.class, Sect5.class }; private static Class[] sect3Map = { Sect3.class, Sect4.class, Sect5.class, Sect5.class, Sect5.class, Sect5.class }; private static Class[] referenceMap = { Reference.class, Refentry.class, Refsect1.class, Refsect2.class, Refsect3.class, Refsect4.class }; private static Class[] refSect1Map = { Refsect1.class, Refsect2.class, Refsect3.class, Refsect4.class, Refsect5.class, Refsect5.class }; private static Class[] refSect2Map = { Refsect2.class, Refsect3.class, Refsect4.class, Refsect5.class, Refsect5.class, Refsect5.class }; private static Class[] refSect3Map = { Refsect3.class, Refsect4.class, Refsect5.class, Refsect5.class, Refsect5.class, Refsect5.class }; private Class[] map; private EditorInstruction values; private Script script; private DocBookTagFactory dbfactory; private LinkManager linkManager; public boolean isSection(HtmlElement element) { /* * H1-6 Elemente, die als erste Kindelemente von Article oder Section * auftreten, werden als einfache Titelelemente verarbeitet. Der gleiche * Fall gilt für Kindelemente von Header. */ Node parentNode = element.getParentNode(); if (element instanceof HeadingElement && parentNode != null && parentNode instanceof DocumentFragment == false) { String tagName = ((Element) parentNode) .getTagName(); if (tagName != null && tagName.equalsIgnoreCase("header")) { return false; } if (tagName != null && (tagName.equalsIgnoreCase("section") || tagName .equalsIgnoreCase("article"))) { if (element.isFirstChildElement()) { return false; } } } return getSectionLevel(element) > 0 ? true : false; } public int getSectionLevel(HtmlElement element) { if (element == null) { return 0; } if (element instanceof HeadingElement) { return ((HeadingElement) element).getLevel(); } String tagName = element.getTagName(); tagName = tagName.trim().toLowerCase(); if (tagName.startsWith("h")) { tagName = StringServices.cutPrefix(tagName, "h"); int level = -1; try { level = Integer.parseInt(tagName); } catch (NumberFormatException oops) { return -1; } return level; } TextParam paramClasses = (TextParam) script.getParameter( TrafoConstants.SECTION_SECTION_DETECTION, TrafoConstants.PARAM_ATTRIBUTE_CLASS); String cssClass = element.getCssClass(); if (cssClass == null || paramClasses == null) { return 0; } for (String regex : paramClasses.getValues()) { Pattern pattern = Pattern.compile(regex); Matcher matcher = pattern.matcher(cssClass); if (matcher.matches()) { int level = 7; int groupCount = matcher.groupCount(); if (groupCount > 0) { String group = matcher.group(groupCount); try { level = Integer.parseInt(group); } catch (NumberFormatException oops) { level = 7; } } return level; } } return 0; } public void edit(EditorInstruction values, DocBookTagFactory dbfactory) { this.values = values; DocBookElement sect; HtmlElement child = values.getHtmlElement(); NodeImpl parent = values.getParent(); if (parent != null) { values.setCurrent(parent); } values.doTraverse(true); NodeImpl levelParent = null; int level = 7; if (child instanceof HeadingElement) { level = ((HeadingElement) child).getLevel(); } else { level = getSectionLevel(child); } Element root = initMap(); levelParent = findParentForLevel(child, level); if (levelParent instanceof DocumentFragment) { NodeImpl documentElement = (NodeImpl) levelParent .getUserData("documentElement"); sect = createSectionChild(child, documentElement); } else { sect = createSectionChild(child, levelParent); } if (sect != null) { if (sect instanceof Para) { values.doTraverse(false); // Try to force a new paragraph after the header. if (parent instanceof Para && (parent.getParentNode() != null)) { values.setParent((DocBookElement) parent.getParentNode()); } values.setCurrent(values.getParent()); } else { if (levelParent != null) { levelParent.appendChild(sect); if (sect instanceof Refentry) { Refnamediv refNameDiv = dbfactory.createRefnamediv(); Refname refName = dbfactory.createRefname(""); Refpurpose refPurpose = dbfactory.createRefpurpose(); refNameDiv.appendChild(refName); refNameDiv.appendChild(refPurpose); Refsect1 refSect1 = dbfactory.createRefsect1(); sect.appendChild(refNameDiv); sect.appendChild(refSect1); sect = refSect1; } if (sect instanceof Bridgehead) { // setParent(sect); values.setCurrent(sect); } else { Title title = dbfactory.createTitle(); sect.appendChild(title); values.setParent(sect); values.setCurrent(title); } } } } else { NodeImpl current = values.getCurrent(); if (current instanceof DocBookElement) { sect = (DocBookElement) current; } } String id = child.getId(); if (sect != null && id != null && id.length() > 0) { sect.setId(linkManager.createUniqueId(id)); } if (root != null) { root.getClass().getName(); } } private Element initMap() { Element root = getDocumentElement(); if (map != null) { return root; } if (isRootBook() || isRoot(Part.getTag())) { map = bookMap; } if (isRootArticle()) { map = articleMap; } if (isRoot(Chapter.getTag())) { map = chapterMap; } if (isRoot(Partintro.getTag())) { map = partIntroMap; } if (isRoot(Sect1.tagName)) { map = sect1Map; } if (isRoot(Sect2.getTag())) { map = sect2Map; } if (isRoot(Sect3.getTag())) { map = sect3Map; } if (isRoot(Reference.getTag())) { map = referenceMap; } if (isRoot(Refsect1.tagName)) { map = refSect1Map; } if (isRoot(Refsect2.tagName)) { map = refSect2Map; } if (isRoot(Refsect3.tagName)) { map = refSect3Map; } if (map == null) { map = articleMap; } return root; } public boolean isRoot(String tagName) { Node root = getDocumentElement(); if (root instanceof DocBookFragment) { Node firstChild = ((DocBookFragment) root).getFirstChildElement(); if (firstChild != null) { root = firstChild; } } if (root == null) { throw new IllegalStateException("The field root must not be null!"); } if (tagName.equalsIgnoreCase(root.getNodeName())) { return true; } else { return false; } } public boolean isRootArticle() { Node root = getDocumentElement(); if (root instanceof DocBookFragment) { root = (Element) root.getUserData("documentElement"); } if (root instanceof Article) { return true; } else { return false; } } public boolean isRootBook() { Element root = getDocumentElement(); if (root instanceof DocBookFragment) { root = (Element) root.getUserData("documentElement"); } if (root instanceof Book) { return true; } else { return false; } } private Element getDocumentElement() { NodeImpl rootNode = values.getCurrent().getRoot(); Element root = null; if (rootNode instanceof DocBookDocument) { DocBookDocument doc = (DocBookDocument) rootNode; root = doc.getDocumentElement(); } else if (rootNode instanceof Element) { root = (Element) rootNode; } else { throw new IllegalStateException( "Root node must be of type DocBookDocument or Element." + "Found root node of type " + rootNode.getClass().getName() + "!"); } return root; } public NodeImpl findParentForLevel(HtmlElement header, int level) { NodeImpl parent = null; Class parentClass = null; if (level < 0) { level = 0; } if (level > map.length) { level = map.length - 1; } for (int i = (level - 1); i >= 0; i--) { parentClass = map[i]; parent = values.getCurrent(); if (parent != null) { int tagLevel = getSectionLevel(header); int parentLevel = getSectionLevel((HtmlElement) parent .getUserData("html")); while (tagLevel != -1 && parentLevel != -1 && parentLevel >= tagLevel) { NodeImpl ancestor = NodeImpl .findParent(parent, parentClass); if (ancestor == null) { ancestor = NodeImpl .findParent(parent, DocumentFragment.class); } if (ancestor == null) { break; } parent = ancestor; parentLevel = getSectionLevel((HtmlElement) parent .getUserData("html")); } break; } } return parent; } public DocBookElement createSectionChild(HtmlElement header, NodeImpl levelParent) throws OptionException { DocBookElement section = null; if (levelParent == null || levelParent instanceof Para || isValidHeader(header) == false) { section = dbfactory.createBridgehead(); } if (levelParent instanceof Book || levelParent instanceof Part) { section = dbfactory.createChapter(); } if (levelParent instanceof Chapter || levelParent instanceof Partintro) { section = dbfactory.createSection(); } if (levelParent instanceof Article) { section = dbfactory.createSection(); } if (levelParent instanceof Section) { section = dbfactory.createSection(); } if (levelParent instanceof Sect1) { section = dbfactory.createSect2(); } if (levelParent instanceof Sect2) { section = dbfactory.createSect3(); } if (levelParent instanceof Sect3) { section = dbfactory.createSect4(); } if (levelParent instanceof Sect4) { section = dbfactory.createSect5(); } if (levelParent instanceof Sect5) { section = dbfactory.createSimplesect(); } if (levelParent instanceof Reference) { section = dbfactory.createRefentry(); } if (levelParent instanceof Refentry) { section = dbfactory.createRefsect1(); } if (levelParent instanceof Refsect1) { section = dbfactory.createRefsect2(); } if (levelParent instanceof Refsect2) { section = dbfactory.createRefsect3(); } if (levelParent instanceof Refsect3) { section = dbfactory.createRefsect4(); } if (levelParent instanceof Refsect4) { section = dbfactory.createRefsect5(); } if (levelParent instanceof Refsect5) { section = dbfactory.createSimplesect(); } if (section != null) { DefaultEditor editor = new DefaultEditor(); editor.setLinkManager(linkManager); editor.setTagFactory(dbfactory); editor.setValues(values); editor.copyCommonAttributes(header, section); } return section; } public DocBookElement createSectionPara(Element parent) throws OptionException { DocBookElement para; if ((parent != null) && parent instanceof Para) { para = (DocBookElement) parent; } else { para = dbfactory.createPara(); if (((Para) para) .isValidParent(script.getTransformPosition(), (DocBookElement) values.getParent())) { values.getParent().appendChild(para); } else { para = (DocBookElement) values.getParent(); } } Bridgehead Bridgehead = dbfactory.createBridgehead(); Bridgehead.appendChild(values.getHtmlElement().getTextContent()); para.appendChild(Bridgehead); // Emphasis emph = dbfactory.createEmphasis(); // emph.setRole(getOptions().getEmphasisBoldRole()); // emph.setParentNode(para); // emph.setRemap(header.getNodeName()); // emph.appendChild(getChild().getText()); // para.appendChild(emph); return para; } private boolean isValidHeader(HtmlElement header) { boolean rc = header .validateParentPath(HeadingEditor.validHtmlParentPathMap); return rc; } public void setScript(Script script) { this.script = script; } public void setTagFactory(DocBookTagFactory dbfactory) { this.dbfactory = dbfactory; } public void setLinkManager(LinkManager linkManager) { this.linkManager = linkManager; } } src/java/org/dbdoclet/trafo/html/docbook/DocumentElementType.java0000644000175000017500000000153412644165236025317 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.html.docbook; public enum DocumentElementType { ARTICLE, BOOK, CHAPTER, PARAGRAPH, PART, REFERENCE, SECTION; } src/java/org/dbdoclet/trafo/html/docbook/HtmlDocBookTrafo.java0000644000175000017500000002442012644165236024525 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.html.docbook; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.util.ArrayList; import java.util.List; import javax.swing.JPanel; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.dbdoclet.jive.PanelProvider; import org.dbdoclet.progress.ProgressEvent; import org.dbdoclet.progress.ProgressListener; import org.dbdoclet.progress.ProgressManager; import org.dbdoclet.service.ResourceServices; import org.dbdoclet.tag.docbook.BaseTagFactory; import org.dbdoclet.tag.docbook.DocBookTagFactory; import org.dbdoclet.tag.docbook.Index; import org.dbdoclet.tag.html.HtmlDocument; import org.dbdoclet.tag.html.HtmlFragment; import org.dbdoclet.trafo.AbstractTrafoService; import org.dbdoclet.trafo.TrafoConstants; import org.dbdoclet.trafo.TrafoResult; import org.dbdoclet.trafo.TrafoScriptManager; import org.dbdoclet.trafo.html.HtmlProvider; import org.dbdoclet.trafo.internal.html.docbook.DocBookVisitor; import org.dbdoclet.trafo.internal.html.docbook.HtmlDocBookPanel; import org.dbdoclet.trafo.internal.html.docbook.PostprocessStage1; import org.dbdoclet.trafo.internal.html.docbook.PostprocessStage2; import org.dbdoclet.trafo.internal.html.docbook.PostprocessStage3; import org.dbdoclet.trafo.internal.html.docbook.PreprocessStage1; import org.dbdoclet.trafo.param.TextParam; import org.dbdoclet.trafo.script.Namespace; import org.dbdoclet.trafo.script.Script; import org.dbdoclet.trafo.script.ScriptEvent; import org.dbdoclet.trafo.script.ScriptEvent.Type; import org.dbdoclet.trafo.script.ScriptListener; import org.dbdoclet.trafo.script.Section; import org.dbdoclet.xiphias.NodeSerializer; import org.dbdoclet.xiphias.dom.DocumentImpl; import org.dbdoclet.xiphias.dom.ElementImpl; import org.dbdoclet.xiphias.dom.NodeCountVisitor; import org.dbdoclet.xiphias.dom.NodeImpl; import org.osgi.service.component.ComponentContext; import org.w3c.dom.Document; import org.w3c.dom.DocumentFragment; public class HtmlDocBookTrafo extends AbstractTrafoService implements PanelProvider, ScriptListener { private final Log logger = LogFactory.getLog(HtmlDocBookTrafo.class); private HtmlDocBookPanel htmlDocBookPanel; private DocBookTagFactory dbfactory = new DocBookTagFactory(); private Script script; private InputStream in; private OutputStream out; private ArrayList listeners = new ArrayList(); protected void activate(ComponentContext context) { logger.info("Activierung des Bundles " + getId()); } @Override public String getId() { return "html2docbook"; } @Override public JPanel getPanel() { htmlDocBookPanel = new HtmlDocBookPanel(); return htmlDocBookPanel; } public Script getScript() { return script; } public BaseTagFactory getTagFactory() { return dbfactory; } @Override public void scriptChanged(ScriptEvent event) { if (event.getType() == Type.INPUT_FILE_CHANGED) { System.out.println("Input File Changed"); } } @Override public void setInputStream(InputStream in) { this.in = in; } @Override public void setOutputStream(OutputStream out) { this.out = out; } public void setTagFactory(DocBookTagFactory dbfactory) { if (dbfactory != null) { this.dbfactory = dbfactory; } } @Override public TrafoResult transform(Script script) { TrafoResult result = new TrafoResult(); try { String encoding = script.getTextParameter( TrafoConstants.SECTION_HTML, TrafoConstants.PARAM_ENCODING, "UTF-8"); if (htmlDocBookPanel != null) { String profileName = htmlDocBookPanel.getProfile(); if (profileName != null && profileName.trim().length() > 0) { String profileText = ResourceServices.getResourceAsString( "profiles/" + profileName + ".her", HtmlDocBookTrafo.class.getClassLoader()); if (profileText != null) { TrafoScriptManager mgr = new TrafoScriptManager(); mgr.parseScript(script, profileText); } } Namespace namespace = script.getNamespace(); Section section = namespace.findOrCreateSection(TrafoConstants.SECTION_HTML); section.setParam(new TextParam(TrafoConstants.PARAM_ENCODING, htmlDocBookPanel.getSourceEncoding())); section = namespace.findOrCreateSection(TrafoConstants.SECTION_DOCBOOK); section.setParam(new TextParam(TrafoConstants.PARAM_LANGUAGE, htmlDocBookPanel.getLanguage())); section.setParam(new TextParam(TrafoConstants.PARAM_DOCUMENT_ELEMENT, htmlDocBookPanel.getDocumentType())); } DocBookVisitor visitor = new DocBookVisitor(); visitor.addProgressListeners(listeners); visitor.setTagFactory(dbfactory); visitor.setScript(script); HtmlProvider htmlProvider = new HtmlProvider(script); htmlProvider.setProgressListeners(listeners); NodeImpl htmlDoc = null; ElementImpl documentElement = null; String htmlCode = retrieveHtmlCode(in, encoding); boolean isFragment = htmlProvider.isFragment(htmlCode); if (isFragment) { htmlDoc = htmlProvider.parseFragment(htmlCode); } else { htmlDoc = htmlProvider.parseDocument(htmlCode); } ProgressManager pm = new ProgressManager(listeners); pm.nextStage(); NodeCountVisitor nodeCounter = new NodeCountVisitor(listeners); htmlDoc.traverse(nodeCounter); pm.setProgressMaximum(nodeCounter.getNumberOfNodes()); pm.fireProgressEvent(new ProgressEvent("Preprocess HTML tree...", false)); PreprocessStage1 preprocessStage1 = new PreprocessStage1(listeners); htmlDoc.traverse(preprocessStage1); preprocessStage1.finish(); pm.nextStage(); pm.fireProgressEvent(new ProgressEvent("Transformation...", false)); pm.setProgressMaximum(nodeCounter.getNumberOfNodes()); if (isFragment) { DocumentFragment fragment = htmlProvider.traverse( (HtmlFragment) htmlDoc, visitor); documentElement = (ElementImpl) fragment; } else { Document document = htmlProvider.traverse( (HtmlDocument) htmlDoc, visitor); documentElement = (ElementImpl) document.getDocumentElement(); } pm.nextStage(); nodeCounter = new NodeCountVisitor(listeners); pm.fireProgressEvent(new ProgressEvent("Postprocess stage 1...", false)); documentElement.traverse(nodeCounter); pm.setProgressMaximum(nodeCounter.getNumberOfNodes()); PostprocessStage1 postprocessStage1 = new PostprocessStage1( dbfactory, script, listeners); documentElement.traverse(postprocessStage1); postprocessStage1.finish(); pm.nextStage(); pm.fireProgressEvent(new ProgressEvent("Postprocess stage 2...", false)); documentElement.traverse(nodeCounter.reset()); pm.setProgressMaximum(nodeCounter.getNumberOfNodes()); PostprocessStage2 postprocessStage2 = new PostprocessStage2( dbfactory, script, listeners); documentElement.traverse(postprocessStage2); postprocessStage2.finish(); new PostprocessStage3(dbfactory, postprocessStage1.getSubtables()) .process(); boolean addIndex = script.isParameterOn( TrafoConstants.SECTION_DOCBOOK, TrafoConstants.PARAM_ADD_INDEX, false); Index index = dbfactory.createIndex(); if (addIndex == true && documentElement instanceof DocumentFragment == false && index.isValidParent(script.getTransformPosition(), documentElement)) { documentElement.appendChild(index); } encoding = script.getTextParameter(TrafoConstants.SECTION_DOCBOOK, TrafoConstants.PARAM_ENCODING, "UTF-8"); if (isFragment) { result.setRootNode(documentElement); } else { DocumentImpl document = documentElement.getDocument(); document.setXmlEncoding(encoding); result.setRootNode(document); } if (out != null) { NodeSerializer serializer = new NodeSerializer(); // serializer.setValidationEnabled(true); // serializer.setIndentationEnabled(false); serializer.addProgressListeners(listeners); serializer.setSystemId(getSystemId()); serializer.setEncoding(encoding); List chunkElementList = script.getTextParameterList( TrafoConstants.SECTION_DOCBOOK, TrafoConstants.PARAM_CHUNK_ELEMENTS, new ArrayList()); for (String chunkElement : chunkElementList) { logger.debug(String.format("Adding chunk element %s", chunkElement)); int depth = script.getIntParameter( TrafoConstants.SECTION_DOCBOOK, String.format("chunk-%s-depth", chunkElement), 1); serializer.addChunkElement(chunkElement, depth); } OutputStreamWriter writer = new OutputStreamWriter(out, encoding); if (isFragment) { serializer.write(documentElement, writer); } else { DocumentImpl document = documentElement.getDocument(); document.setXmlEncoding(encoding); serializer.write(document, writer); } writer.close(); } } catch (Throwable oops) { result.setThrowable(oops); } return result; } private String retrieveHtmlCode(InputStream in, String encoding) throws IOException { ByteArrayOutputStream out = new ByteArrayOutputStream(); byte[] buffer = new byte[4096]; int n = in.read(buffer); while (n != -1) { out.write(buffer, 0, n); n = in.read(buffer); } in.close(); out.close(); return new String(out.toByteArray(), encoding); } @Override public void addProgressListener(ProgressListener listener) { if (listener == null) { return; } if (listeners == null) { listeners = new ArrayList(); } listeners.add(listener); } @Override public void removeProgressListener(ProgressListener listener) { if (listener == null) { return; } listeners.remove(listener); } } src/java/org/dbdoclet/trafo/html/dita/0000755000175000017500000000000012644165236020020 5ustar mathieumathieusrc/java/org/dbdoclet/trafo/html/dita/HtmlDitaTrafo.java0000644000175000017500000002176612644165236023401 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.html.dita; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.util.ArrayList; import javax.swing.JPanel; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.dbdoclet.jive.PanelProvider; import org.dbdoclet.progress.ProgressEvent; import org.dbdoclet.progress.ProgressListener; import org.dbdoclet.progress.ProgressManager; import org.dbdoclet.service.ResourceServices; import org.dbdoclet.tag.dita.DitaTagFactory; import org.dbdoclet.tag.html.HtmlDocument; import org.dbdoclet.tag.html.HtmlFragment; import org.dbdoclet.trafo.AbstractTrafoService; import org.dbdoclet.trafo.TrafoConstants; import org.dbdoclet.trafo.TrafoResult; import org.dbdoclet.trafo.TrafoScriptManager; import org.dbdoclet.trafo.html.HtmlProvider; import org.dbdoclet.trafo.internal.html.dita.DitaVisitor; import org.dbdoclet.trafo.internal.html.dita.HtmlDitaPanel; import org.dbdoclet.trafo.internal.html.dita.PostprocessStage1; import org.dbdoclet.trafo.internal.html.dita.PostprocessStage2; import org.dbdoclet.trafo.internal.html.dita.PostprocessStage3; import org.dbdoclet.trafo.internal.html.dita.PreprocessStage1; import org.dbdoclet.trafo.param.TextParam; import org.dbdoclet.trafo.script.Namespace; import org.dbdoclet.trafo.script.Script; import org.dbdoclet.trafo.script.ScriptEvent; import org.dbdoclet.trafo.script.ScriptEvent.Type; import org.dbdoclet.trafo.script.ScriptListener; import org.dbdoclet.trafo.script.Section; import org.dbdoclet.xiphias.NodeSerializer; import org.dbdoclet.xiphias.dom.DocumentImpl; import org.dbdoclet.xiphias.dom.ElementImpl; import org.dbdoclet.xiphias.dom.NodeCountVisitor; import org.dbdoclet.xiphias.dom.NodeImpl; import org.osgi.service.component.ComponentContext; import org.w3c.dom.Document; import org.w3c.dom.DocumentFragment; public class HtmlDitaTrafo extends AbstractTrafoService implements PanelProvider, ScriptListener { private final Log logger = LogFactory.getLog(HtmlDitaTrafo.class); private HtmlDitaPanel htmlDitaPanel; private DitaTagFactory tagFactory = new DitaTagFactory(); private Script script; private InputStream in; private OutputStream out; private ArrayList listeners = new ArrayList(); protected void activate(ComponentContext context) { logger.info("Activierung des Bundles " + getId()); } @Override public String getId() { return "html2dita"; } @Override public JPanel getPanel() { htmlDitaPanel = new HtmlDitaPanel(); return htmlDitaPanel; } public Script getScript() { return script; } public DitaTagFactory getTagFactory() { return tagFactory; } @Override public void scriptChanged(ScriptEvent event) { if (event.getType() == Type.INPUT_FILE_CHANGED) { System.out.println("Input File Changed"); } } @Override public void setInputStream(InputStream in) { this.in = in; } @Override public void setOutputStream(OutputStream out) { this.out = out; } public void setTagFactory(DitaTagFactory tagFactory) { if (tagFactory != null) { this.tagFactory = tagFactory; } } @Override public TrafoResult transform(Script script) { TrafoResult result = new TrafoResult(); try { String encoding = script.getTextParameter( TrafoConstants.SECTION_HTML, TrafoConstants.PARAM_ENCODING, "UTF-8"); if (htmlDitaPanel != null) { String profileName = htmlDitaPanel.getProfile(); if (profileName != null && profileName.trim().length() > 0) { String profileText = ResourceServices.getResourceAsString( "profiles/" + profileName + ".her", HtmlDitaTrafo.class.getClassLoader()); if (profileText != null) { TrafoScriptManager mgr = new TrafoScriptManager(); mgr.parseScript(script, profileText); } } Namespace namespace = script.getNamespace(); Section section = namespace .findSection(TrafoConstants.SECTION_HTML); section.setParam(new TextParam(TrafoConstants.PARAM_ENCODING, htmlDitaPanel.getSourceEncoding())); section = namespace.findSection(TrafoConstants.SECTION_DOCBOOK); section.setParam(new TextParam(TrafoConstants.PARAM_LANGUAGE, htmlDitaPanel.getLanguage())); section.setParam(new TextParam( TrafoConstants.PARAM_DOCUMENT_ELEMENT, htmlDitaPanel .getDocumentType())); } DitaVisitor visitor = new DitaVisitor(); visitor.addProgressListeners(listeners); visitor.setTagFactory(tagFactory); visitor.setScript(script); HtmlProvider htmlProvider = new HtmlProvider(script); NodeImpl htmlDoc = null; ElementImpl documentElement = null; String htmlCode = retrieveHtmlCode(in, encoding); boolean isFragment = htmlProvider.isFragment(htmlCode); if (isFragment) { htmlDoc = htmlProvider.parseFragment(htmlCode); } else { htmlDoc = htmlProvider.parseDocument(htmlCode); } ProgressManager pm = new ProgressManager(listeners); pm.nextStage(); NodeCountVisitor nodeCounter = new NodeCountVisitor(listeners); htmlDoc.traverse(nodeCounter); pm.setProgressMaximum(nodeCounter.getNumberOfNodes()); pm.fireProgressEvent(new ProgressEvent("Preprocess HTML tree...", false)); PreprocessStage1 preprocessStage1 = new PreprocessStage1(listeners); htmlDoc.traverse(preprocessStage1); preprocessStage1.finish(); pm.nextStage(); pm.fireProgressEvent(new ProgressEvent("Transformation...", false)); pm.setProgressMaximum(nodeCounter.getNumberOfNodes()); if (isFragment) { DocumentFragment fragment = htmlProvider.traverse( (HtmlFragment) htmlDoc, visitor); documentElement = (ElementImpl) fragment; } else { Document document = htmlProvider.traverse( (HtmlDocument) htmlDoc, visitor); documentElement = (ElementImpl) document.getDocumentElement(); } pm.nextStage(); nodeCounter = new NodeCountVisitor(listeners); pm.fireProgressEvent(new ProgressEvent("Postprocess stage 1...", false)); documentElement.traverse(nodeCounter); pm.setProgressMaximum(nodeCounter.getNumberOfNodes()); PostprocessStage1 postprocessStage1 = new PostprocessStage1( tagFactory, script, listeners); documentElement.traverse(postprocessStage1); postprocessStage1.finish(); pm.nextStage(); pm.fireProgressEvent(new ProgressEvent("Postprocess stage 2...", false)); documentElement.traverse(nodeCounter.reset()); pm.setProgressMaximum(nodeCounter.getNumberOfNodes()); PostprocessStage2 postprocessStage2 = new PostprocessStage2( tagFactory, script, listeners); documentElement.traverse(postprocessStage2); postprocessStage2.finish(); new PostprocessStage3(tagFactory, postprocessStage1.getSubtables()) .process(); encoding = script.getTextParameter(TrafoConstants.SECTION_DOCBOOK, TrafoConstants.PARAM_ENCODING, "UTF-8"); if (isFragment) { result.setRootNode(documentElement); } else { DocumentImpl document = documentElement.getDocument(); document.setXmlEncoding(encoding); result.setRootNode(document); } if (out != null) { NodeSerializer serializer = new NodeSerializer(); serializer.addProgressListeners(listeners); OutputStreamWriter writer = new OutputStreamWriter(out, encoding); if (isFragment) { serializer.write(documentElement, writer); } else { DocumentImpl document = documentElement.getDocument(); document.setXmlEncoding(encoding); serializer.write(document, writer); } writer.close(); } } catch (Throwable oops) { result.setThrowable(oops); } return result; } private String retrieveHtmlCode(InputStream in, String encoding) throws IOException { ByteArrayOutputStream out = new ByteArrayOutputStream(); byte[] buffer = new byte[4096]; int n = in.read(buffer); while (n != -1) { out.write(buffer, 0, n); n = in.read(buffer); } in.close(); out.close(); return new String(out.toByteArray(), encoding); } @Override public void addProgressListener(ProgressListener listener) { if (listener == null) { return; } if (listeners == null) { listeners = new ArrayList(); } listeners.add(listener); } @Override public void removeProgressListener(ProgressListener listener) { if (listener == null) { return; } listeners.remove(listener); } } src/java/org/dbdoclet/trafo/html/dita/ListDetector.java0000644000175000017500000002355312644165236023300 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.html.dita; import java.util.Stack; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.dbdoclet.tag.docbook.BaseTagFactory; import org.dbdoclet.tag.docbook.Itemizedlist; import org.dbdoclet.tag.docbook.Listitem; import org.dbdoclet.tag.docbook.Orderedlist; import org.dbdoclet.tag.html.HtmlElement; import org.dbdoclet.trafo.TrafoConstants; import org.dbdoclet.trafo.html.EditorInstruction; import org.dbdoclet.trafo.param.TextParam; import org.dbdoclet.trafo.script.Script; import org.dbdoclet.xiphias.XmlServices; import org.dbdoclet.xiphias.dom.ElementImpl; import org.dbdoclet.xiphias.dom.NodeImpl; import org.w3c.dom.Element; import org.w3c.dom.Node; public class ListDetector { private static final Log logger = LogFactory.getLog(ListDetector.class); private final Stack cssClassStack = new Stack(); public enum ListType { ITEMIZED, ORDERED }; public void closeList(EditorInstruction values) { HtmlElement child = values.getHtmlElement(); String cssClass = child.getCssClass(); logger.trace(String.format("Closing list %s, %s.", cssClass, child)); NodeImpl parent = values.getParent(); Script script = values.getScript(); if (isItemizedListElement(child, script) || isOrderedListElement(child, script)) { return; } if (cssClassStack.size() > 1) { closeNestedList(cssClass, values); parent = values.getParent(); } Node previous = child.getPreviousSibling(); while (previous != null && previous instanceof Element == false) { previous = previous.getNextSibling(); } // Das Geschwisterelement vor dem aktuellen Element war ein // Listenelement. Die Liste wird abgeschlossen. // if (previous != null // && (isItemizedListElement((HtmlElement) previous, script) || // isOrderedListElement( // (HtmlElement) previous, script))) { if (parent instanceof Listitem) { parent = (ElementImpl) parent.getParentNode(); } if (parent instanceof Itemizedlist || parent instanceof Orderedlist) { values.setParent((ElementImpl) parent.getParentNode()); values.setCurrent((ElementImpl) parent.getParentNode()); } cssClassStack.clear(); // } } private void closeNestedList(String cssClass, EditorInstruction values) { logger.trace(String.format("closeNestedList %s %s", cssClass, values.getHtmlElement())); if (cssClassStack.empty() == true) { return; } String currentCssClass = cssClassStack.peek(); while (cssClassStack.size() > 1 && currentCssClass.equals(cssClass) == false) { cssClassStack.pop(); NodeImpl parent = values.getParent(); // Eingebettete Liste finden while (parent != null && parent instanceof Itemizedlist == false && parent instanceof Orderedlist == false) { Node parentNode = parent.getParentNode(); if (parentNode instanceof ElementImpl == false) { logger.warn("Couldn't find nested list element for HTML element " + values.getHtmlElement() + ". DocBookParent = " + XmlServices.printPath(values.getParent()) + ". Stack = " + cssClassStack); parent = null; break; } parent = (ElementImpl) parentNode; } if (parent != null) { // Übergeordnete Liste suchen parent = (ElementImpl) parent.getParentNode(); while (parent != null && parent instanceof Itemizedlist == false && parent instanceof Orderedlist == false) { Node parentNode = parent.getParentNode(); if (parentNode instanceof ElementImpl == false) { logger.warn("Couldn't find parent list for a nested list for HTML element " + values.getHtmlElement() + ". DocBookParent = " + XmlServices.printPath(values.getParent()) + ". Stack = " + cssClassStack); parent = null; break; } parent = (ElementImpl) parentNode; } // Falls eine übergeordnete Liste gefunden wurde, wird diese zum // neuen Vaterelement gemacht. if (parent != null) { values.setParent(parent); values.setCurrent(parent); } } } } public void edit(EditorInstruction values, BaseTagFactory dbfactory) { HtmlElement htmlElement = values.getHtmlElement(); Script script = values.getScript(); if (isItemizedListElement(htmlElement, script)) { edit(values, dbfactory, ListDetector.ListType.ITEMIZED); } else if (isOrderedListElement(htmlElement, script)) { edit(values, dbfactory,ListDetector.ListType.ORDERED); } else if (isEndOfList(values, script)) { closeList(values); } } private boolean isEndOfList(EditorInstruction values, Script script) { if (cssClassStack.size() == 0) { return false; } HtmlElement htmlElement = values.getHtmlElement(); while (htmlElement != null) { if (isItemizedListElement(htmlElement, script) || isOrderedListElement(htmlElement, script)) { return false; } Node node = htmlElement.getParentNode(); if (node instanceof HtmlElement) { htmlElement = (HtmlElement) node; } else { return true; } } return true; } public void edit(EditorInstruction values, BaseTagFactory dbfactory, ListType type) { HtmlElement htmlElement = values.getHtmlElement(); String cssClass = htmlElement.getCssClass(); logger.trace(String.format("Editing list element %s, %s.", cssClass, htmlElement)); NodeImpl parent = values.getParent(); if (isNestedList(cssClass) == false && parent instanceof Listitem) { parent = (ElementImpl) parent.getParentNode(); } parent = createListElement(type, cssClass, dbfactory, parent); if (isParentList(cssClass)) { closeNestedList(cssClass, values); parent = values.getParent(); } Listitem listItem = dbfactory.createListitem(); parent.appendChild(listItem); values.setParent(listItem); values.setCurrent(listItem); } private NodeImpl createListElement(ListType type, String cssClass, BaseTagFactory dbfactory, NodeImpl parent) { if (type == ListType.ITEMIZED && parent instanceof Itemizedlist == false) { Itemizedlist itemizedList = dbfactory.createItemizedlist(); parent.appendChild(itemizedList); parent = itemizedList; cssClassStack.push(cssClass); } if (type == ListType.ORDERED && parent instanceof Orderedlist == false) { Orderedlist orderedList = dbfactory.createOrderedlist(); parent.appendChild(orderedList); parent = orderedList; cssClassStack.push(cssClass); } return parent; } /** * Die Methode prüft, ob das übergebene HTML-Element eine CSS-Klasse * besitzt, die auf einen der regulären Ausdrücke aus der Liste des * Parameters itemized-attribute-class passt. Ist dies der Fall wird mit * Hilfe des Rückgabewerts true signalisiert, dass das Element eigentlich * ein Listenelement einer ungeordneten Liste ist. * * @param element * @param script * @return */ public boolean isItemizedListElement(HtmlElement element, Script script) { TextParam paramClasses = (TextParam) script.getParameter( TrafoConstants.SECTION_LIST_DETECTION, TrafoConstants.PARAM_ITEMIZED_ATTRIBUTE_CLASS); String cssClass = element.getCssClass(); if (cssClass == null || paramClasses == null) { return false; } for (String regex : paramClasses.getValues()) { Pattern pattern = Pattern.compile(regex); Matcher matcher = pattern.matcher(cssClass); if (matcher.matches()) { return true; } } return false; } /** * Die Methode prüft, ob das übergebene HTML-Element eine CSS-Klasse * besitzt, die auf einen der regulären Ausdrücke aus der Liste des * Parameters ordered-attribute-class passt. Ist dies der Fall wird mit * Hilfe des Rückgabewerts true signalisiert, dass das Element eigentlich * ein Listenelement einer geordneten Liste ist. * * @param element * @param script * @return */ public boolean isOrderedListElement(HtmlElement element, Script script) { TextParam paramClasses = (TextParam) script.getParameter( TrafoConstants.SECTION_LIST_DETECTION, TrafoConstants.PARAM_ORDERED_ATTRIBUTE_CLASS); String cssClass = element.getCssClass(); if (cssClass == null || paramClasses == null) { return false; } for (String regex : paramClasses.getValues()) { Pattern pattern = Pattern.compile(regex); Matcher matcher = pattern.matcher(cssClass); if (matcher.matches()) { return true; } } return false; } /** * Ermittelt, ob die CSS-Klasse zu einer neuen geschachtelten Liste gehört. * Dazu wird geprüft, ob sich die CSS-Klasse geändert hat und nicht einer * übergeordneten Liste zu geordnet ist. * * @param cssClass * @return */ private boolean isNestedList(String cssClass) { if (cssClass == null) { return false; } if (cssClassStack.size() == 0 || cssClass.equals(cssClassStack.peek()) == false) { for (String elem : cssClassStack) { if (elem.equals(cssClass)) { return false; } } return true; } return false; } private boolean isParentList(String cssClass) { if (cssClass == null) { return false; } if (cssClassStack.size() == 0 || cssClass.equals(cssClassStack.peek()) == false) { for (String elem : cssClassStack) { if (elem.equals(cssClass)) { return true; } } } return false; } } src/java/org/dbdoclet/trafo/html/dita/Resources_de.properties0000644000175000017500000000024112644165236024555 0ustar mathieumathieuC_DOCUMENT_ELEMENT=Dokumenttyp C_ENCODING_SOURCE=Zeichencodierung der Quelldatei C_LANGUAGE=Sprache C_PROFILE=Profil C_USE_ABSOLUTE_IMAGE_PATH=Absolute Bildpfadesrc/java/org/dbdoclet/trafo/html/dita/Resources.properties0000644000175000017500000000023412644165236024107 0ustar mathieumathieuC_DOCUMENT_ELEMENT=Document Type C_ENCODING_SOURCE=Source File Encoding C_LANGUAGE=Language C_PROFILE=Profile C_USE_ABSOLUTE_IMAGE_PATH=Absolute Image Pathssrc/java/org/dbdoclet/trafo/html/dita/SectionDetector.java0000644000175000017500000001621312644165236023764 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.html.dita; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.dbdoclet.option.OptionException; import org.dbdoclet.service.StringServices; import org.dbdoclet.tag.dita.DitaElement; import org.dbdoclet.tag.dita.DitaTagFactory; import org.dbdoclet.tag.dita.P; import org.dbdoclet.tag.dita.Title; import org.dbdoclet.tag.html.HeadingElement; import org.dbdoclet.tag.html.HtmlElement; import org.dbdoclet.trafo.TrafoConstants; import org.dbdoclet.trafo.html.EditorInstruction; import org.dbdoclet.trafo.internal.html.dita.LinkManager; import org.dbdoclet.trafo.internal.html.dita.editor.DefaultEditor; import org.dbdoclet.trafo.internal.html.dita.editor.HeadingEditor; import org.dbdoclet.trafo.param.TextParam; import org.dbdoclet.trafo.script.Script; import org.dbdoclet.xiphias.dom.DocumentFragmentImpl; import org.dbdoclet.xiphias.dom.DocumentImpl; import org.dbdoclet.xiphias.dom.ElementImpl; import org.dbdoclet.xiphias.dom.NodeImpl; import org.w3c.dom.Element; import org.w3c.dom.Node; public class SectionDetector { private EditorInstruction values; private Script script; private DocumentElementType documentElementType; private DitaTagFactory tagFactory; private LinkManager linkManager; public boolean isSection(HtmlElement element) { return getSectionLevel(element) > 0 ? true : false; } public int getSectionLevel(HtmlElement element) { if (element == null) { return 0; } if (element instanceof HeadingElement) { return ((HeadingElement) element).getLevel(); } String tagName = element.getTagName(); tagName = tagName.trim().toLowerCase(); if (tagName.startsWith("h")) { tagName = StringServices.cutPrefix(tagName, "h"); int level = -1; try { level = Integer.parseInt(tagName); } catch (NumberFormatException oops) { return -1; } return level; } TextParam paramClasses = (TextParam) script.getParameter( TrafoConstants.SECTION_SECTION_DETECTION, TrafoConstants.PARAM_ATTRIBUTE_CLASS); String cssClass = element.getCssClass(); if (cssClass == null || paramClasses == null) { return 0; } for (String regex : paramClasses.getValues()) { Pattern pattern = Pattern.compile(regex); Matcher matcher = pattern.matcher(cssClass); if (matcher.matches()) { int level = 7; int groupCount = matcher.groupCount(); if (groupCount > 0) { String group = matcher.group(groupCount); try { level = Integer.parseInt(group); } catch (NumberFormatException oops) { level = 7; } } return level; } } return 0; } public void edit(EditorInstruction values) { this.values = values; ElementImpl sect; HtmlElement child = values.getHtmlElement(); NodeImpl parent = values.getParent(); if (parent != null) { values.setCurrent(parent); } values.doTraverse(true); NodeImpl levelParent = null; int level = 7; if (child instanceof HeadingElement) { level = ((HeadingElement) child).getLevel(); } else { level = getSectionLevel(child); } levelParent = findParentForLevel(child, level); if ((levelParent == null) && ((documentElementType == DocumentElementType.OVERVIEW) || (documentElementType == DocumentElementType.BOOK))) { sect = tagFactory.createTopic(); // levelParent = (NodeImpl) root; } else { sect = createSectionChild(child, levelParent); } if (sect != null) { if (sect instanceof P) { values.doTraverse(false); // Try to force a new paragraph after the header. if (parent instanceof P && (parent.getParentNode() != null)) { values.setParent((NodeImpl) parent.getParentNode()); } values.setCurrent(values.getParent()); } else { if (levelParent != null) { levelParent.appendChild(sect); Title title = tagFactory.createTitle(); sect.appendChild(title); values.setParent(sect); values.setCurrent(title); } } } else { sect = (ElementImpl) values.getCurrent(); } String id = child.getId(); if ((id != null) && (id.length() > 0)) { sect.setId(linkManager.createUniqueId(id)); } } public boolean isRoot(String tagName) { Node root = getDocumentElement(); if (root instanceof DocumentFragmentImpl) { Node firstChild = ((DocumentFragmentImpl) root).getFirstChildElement(); if (firstChild != null) { root = firstChild; } } if (root == null) { throw new IllegalStateException("The field root must not be null!"); } if (tagName.equalsIgnoreCase(root.getNodeName())) { return true; } else { return false; } } private Element getDocumentElement() { NodeImpl rootNode = values.getCurrent().getRoot(); Element root = null; if (rootNode instanceof DocumentImpl) { DocumentImpl doc = (DocumentImpl) rootNode; root = doc.getDocumentElement(); } else if (rootNode instanceof Element) { root = (Element) rootNode; } else { throw new IllegalStateException( "Root node must be of type DocumentImpl or Element." + "Found root node of type " + rootNode.getClass().getName() + "!"); } return root; } public NodeImpl findParentForLevel(ElementImpl header, int level) { NodeImpl parent = null; if (level < 0) { level = 0; } parent = values.getCurrent(); return parent; } public DitaElement createSectionChild(HtmlElement header, NodeImpl levelParent) throws OptionException { DitaElement section = null; if (levelParent == null || levelParent instanceof P || isValidHeader(header) == false) { section = tagFactory.createSection(); } else { section = tagFactory.createTopic(); } if (section != null) { DefaultEditor editor = new DefaultEditor(); editor.setLinkManager(linkManager); editor.setTagFactory(tagFactory); editor.setValues(values); editor.copyCommonAttributes(header, section); } return section; } private boolean isValidHeader(HtmlElement header) { boolean rc = header .validateParentPath(HeadingEditor.validHtmlParentPathMap); return rc; } public void setScript(Script script) { this.script = script; if (script != null) { String value = script.getTextParameter( TrafoConstants.SECTION_DOCBOOK, TrafoConstants.PARAM_DOCUMENT_ELEMENT, "article"); documentElementType = DocumentElementType.valueOf(value .toUpperCase()); } } public void setTagFactory(DitaTagFactory tagFactory) { this.tagFactory = tagFactory; } public void setLinkManager(LinkManager linkManager) { this.linkManager = linkManager; } } src/java/org/dbdoclet/trafo/html/dita/DocumentElementType.java0000644000175000017500000000154312644165236024620 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.html.dita; public enum DocumentElementType { ARTICLE, BOOK, CHAPTER, OVERVIEW, PARAGRAPH, PART, REFERENCE, SECTION; } src/java/org/dbdoclet/trafo/html/HtmlProvider.java0000644000175000017500000003357412644165236022375 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.html; import java.io.IOException; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.dbdoclet.html.parser.HtmlParser; import org.dbdoclet.html.parser.ParserException; import org.dbdoclet.html.tokenizer.TokenizerException; import org.dbdoclet.progress.ProgressEvent; import org.dbdoclet.progress.ProgressListener; import org.dbdoclet.progress.ProgressManager; import org.dbdoclet.service.StringServices; import org.dbdoclet.tag.html.HtmlDocument; import org.dbdoclet.tag.html.HtmlElement; import org.dbdoclet.tag.html.HtmlFragment; import org.dbdoclet.trafo.TrafoConstants; import org.dbdoclet.trafo.param.TextParam; import org.dbdoclet.trafo.script.AttributeRule; import org.dbdoclet.trafo.script.Namespace; import org.dbdoclet.trafo.script.NodeRule; import org.dbdoclet.trafo.script.Script; import org.dbdoclet.trafo.script.Section; import org.dbdoclet.xiphias.XPathServices; import org.dbdoclet.xiphias.annotation.MapToAttributeAnnotation; import org.dbdoclet.xiphias.annotation.MapToNodeAnnotation; import org.dbdoclet.xiphias.dom.CommentImpl; import org.dbdoclet.xiphias.dom.DocumentFragmentImpl; import org.dbdoclet.xiphias.dom.ElementImpl; import org.dbdoclet.xiphias.dom.NodeImpl; import org.dbdoclet.xiphias.dom.NodeListImpl; import org.dbdoclet.xiphias.dom.TextImpl; import org.w3c.dom.Attr; import org.w3c.dom.Document; import org.w3c.dom.DocumentFragment; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.Text; public class HtmlProvider implements IHtmlProvider { private static Log logger = LogFactory.getLog(HtmlProvider.class); public ArrayList listeners; private IEditorFactory editorFactory; private String indent = ""; private ProgressManager pm; private Script script; private IHtmlVisitor visitor; public HtmlProvider(Script script) { this.script = script; listeners = new ArrayList(); pm = new ProgressManager(listeners); } public boolean isFragment(String htmlCode) throws IOException, TokenizerException { HtmlParser parser = new HtmlParser(); return parser.isFragment(htmlCode); } @Override public HtmlDocument parseDocument(String htmlCode) throws IOException, ParserException, TokenizerException { HtmlParser parser = new HtmlParser(); if (listeners != null && listeners.size() > 0) { parser.addProgressListener(listeners.get(0)); } HtmlDocument htmlDocument = parser.parseDocument(htmlCode); ElementImpl documentElement = (ElementImpl) htmlDocument .getDocumentElement(); documentElement.removeAttribute("xmlns"); parseAfter(documentElement); return htmlDocument; } @Override public HtmlFragment parseFragment(String htmlCode) throws IOException, ParserException, TokenizerException { HtmlParser parser = new HtmlParser(); if (listeners != null && listeners.size() > 0) { parser.addProgressListener(listeners.get(0)); } HtmlFragment htmlFragment = parser.parseFragment(htmlCode); parseAfter(htmlFragment); return htmlFragment; } @Override public void setProgressListeners(ArrayList listeners) { this.listeners = listeners; } @Override public Document traverse(HtmlDocument htmlDocument, IHtmlVisitor visitor) throws Exception { this.visitor = visitor; if (htmlDocument == null) { return null; } editorFactory = visitor.getEditorFactory(); Document doc = visitor.createDocument(htmlDocument); edit((ElementImpl) htmlDocument.getDocumentElement(), (ElementImpl) doc.getDocumentElement()); return doc; } @Override public DocumentFragment traverse(HtmlFragment htmlFragment, IHtmlVisitor visitor) { this.visitor = visitor; if (htmlFragment == null) { return null; } editorFactory = visitor.getEditorFactory(); DocumentFragmentImpl fragment = visitor .createDocumentFragment(htmlFragment); edit((ElementImpl) htmlFragment, fragment); return fragment; } private void afterEdit(EditorInstruction values) { } private boolean beforeEdit(EditorInstruction values) { return visitor.beforeEdit(values); } private NodeImpl edit(NodeImpl htmlNode, NodeImpl targetNode) { logger.debug("-> edit " + htmlNode); if (htmlNode == null) { logger.error("[DocBookDoclet.edit] - Parameter node is null!"); return null; } if (targetNode == null) { logger.error("[DocBookDoclet.edit] - Parameter dbParent is null!"); return null; } NodeListImpl htmlChildren = htmlNode.getTrafoChildNodes(); Iterator iterator = htmlChildren.iterator(); boolean doTraverse = true; boolean doIgnore = false; NodeImpl child = null; NodeImpl oldParent = targetNode; logger.debug(indent + "\n>>>=================================================="); logger.debug(indent + " HTML Vaterelement " + htmlNode + "."); logger.debug(indent + " DocBook Vaterelement " + targetNode + "."); indent += "."; while (iterator.hasNext()) { child = iterator.next(); pm.fireProgressEvent(new ProgressEvent("Transforming " + child.toString())); logger.debug(indent + " HTML element is " + child + "."); NodeImpl element = targetNode; doTraverse = true; EditorInstruction editorInstruction = null; if (child instanceof CommentImpl) { editorInstruction = editComment(child, targetNode); } if (child instanceof TextImpl) { editorInstruction = editText(child, targetNode); } if (child instanceof HtmlElement) { editorInstruction = editElement(child, targetNode); } if (editorInstruction == null) { continue; } element = editorInstruction.getCurrent(); doTraverse = editorInstruction.doTraverse(); doIgnore = editorInstruction.doIgnore(); targetNode = editorInstruction.getParent(); if (targetNode == null) { throw new NullPointerException("[Node]" + " DocBook parent element for element " + child + " is null!"); } if (doTraverse == true) { NodeImpl childParent = edit(child, element); logger.debug(indent + "\n<<<=================================================="); if (doIgnore == true) { targetNode = childParent; } } else { int num = HtmlParser.computeSize(child); for (int i = 0; i < num; i++) { pm.fireProgressEvent(new ProgressEvent("Transforming node " + htmlNode.getNodeName())); } // System.out.println("doTraverse == false " + num + " "); } logger.debug(indent + "[Teilbaum bearbeitet] HTML: " + child + ", DocBook: " + element + ", Vater: " + targetNode); if (targetNode != oldParent) { logger.debug(indent + "Parent changed. Old parent was " + oldParent + ". New parent is " + targetNode + "."); NodeImpl dbelem = oldParent; logger.debug(indent + "Closing old parent " + dbelem + ". HTML Element is " + child + "."); oldParent = targetNode; } } if (indent.length() > 2) { indent = indent.substring(0, indent.length() - 2); } logger.debug(indent + "[Vaterknoten bearbeitet] HTML: " + child + ", Vaterknoten: " + targetNode); logger.debug("<- edit "); return targetNode; } private EditorInstruction editComment(NodeImpl child, NodeImpl targetNode) { try { CommentImpl comment = (CommentImpl) child; if (isInstruction(comment)) { EditorInstruction values = new EditorInstruction( visitor.getScript()); values.setHtmlElement(null); values.setCurrent(targetNode); values.setParent(targetNode); values.setCharacterDataNode((CommentImpl) child); IEditor editor = editorFactory.getCommentEditor(); logger.debug(indent + " Vor der Kommentarbearbeitung: " + child + ".\n"); values = editor.edit(values); logger.debug(indent + " Nach der Kommentarbearbeitung: " + child + ".\n"); targetNode = values.getParent(); if (targetNode == null) { throw new NullPointerException("[Node]" + "DocBook parent element for element '" + child + "' is null!"); } return values; } else { pm.fireProgressEvent(new ProgressEvent("Comment")); targetNode.appendChild(child); return null; } } catch (EditorException oops) { logger.debug(indent + " EditorException " + oops.getMessage()); } return null; } private EditorInstruction editElement(NodeImpl child, NodeImpl targetNode) { try { HtmlElement htmlElement = (HtmlElement) child; IEditor editor = editorFactory.getChildEditor(htmlElement); logger.debug("Setting editor values."); EditorInstruction values = new EditorInstruction( visitor.getScript()); values.setHtmlElement((HtmlElement) child); values.setCurrent(targetNode); values.setParent(targetNode); values.setCharacterDataNode(null); logger.debug(indent + " Vor der Transformation: " + child + ".\n" + "Editor " + editor + "\n" + values); MapToNodeAnnotation mapToAnnotation = child .getAnnotation(MapToNodeAnnotation.class); if (mapToAnnotation != null) { NodeImpl parent = values.getParent(); String mapTo = mapToAnnotation.getMapTo(); Element mapToElement = editor.getTagFactory().createElement( mapTo); parent.appendChild(mapToElement); values.setCurrent((ElementImpl) mapToElement); } else { if (beforeEdit(values)) { values = editor.edit(values); afterEdit(values); } } NodeImpl current = values.getCurrent(); List mapToAttributeList = child .getAnnotations(MapToAttributeAnnotation.class); mapToAttributeList.stream().forEach( annotation -> { String attrValue = htmlElement.getAttribute(annotation .getAttribute()); if (attrValue != null && current != null && current instanceof Element) { ((Element) current).setAttribute(annotation.getMapTo(), attrValue); } }); logger.debug(indent + " Nach der Transformation: " + child + ".\n" + "Editor " + editor + "\n" + values); return values; } catch (EditorFactoryException oops) { logger.fatal("EditorFactoryException", oops); } catch (EditorException oops) { logger.fatal("EditorException", oops); } return null; } private EditorInstruction editText(NodeImpl child, NodeImpl targetNode) { logger.debug("Text='" + ((Text) child).toString() + "'"); try { EditorInstruction values = new EditorInstruction( visitor.getScript()); values.setHtmlElement(null); values.setCurrent(targetNode); values.setParent(targetNode); values.setCharacterDataNode((TextImpl) child); IEditor editor = editorFactory.getTextEditor(); logger.debug(indent + " Vor der Textbearbeitung: " + child + ".\n"); values = editor.edit(values); logger.debug(indent + " Nach der Textbearbeitung: " + child + ".\n"); targetNode = values.getParent(); if (targetNode == null) { throw new NullPointerException("[Node] " + "DocBook parent element for element '" + child + "' is null!"); } return values; } catch (EditorException oops) { logger.fatal("EditorException", oops); } return null; } private boolean isInstruction(CommentImpl comment) { if (comment == null) { return false; } String text = comment.getData(); if (text == null) { return false; } text = text.trim(); text = StringServices.cutPrefix(text, ""); text = text.trim(); if (text.startsWith("[:dbdoclet:]")) { return true; } return false; } private void parseAfter(NodeImpl contextNode) { Namespace namespace = script.getNamespace(); Section section = namespace.findSection(TrafoConstants.SECTION_HTML); if (section != null) { TextParam excludeParam = section .findTextParameter(TrafoConstants.PARAM_EXCLUDE); if (excludeParam != null) { for (String excludeXpath : excludeParam.getValues()) { ArrayList nodeList = XPathServices.getNodes( contextNode, excludeXpath); for (Node node : nodeList) { if (node.getParentNode() != null) { node.getParentNode().removeChild(node); } } } } } for (NodeRule nodeRule : namespace.getNodeRules()) { String xpath = nodeRule.getName(); ArrayList nodes = XPathServices.getNodes(contextNode, xpath); for (Node node : nodes) { if (node instanceof HtmlElement) { HtmlElement htmlElement = (HtmlElement) node; TextParam paramMapTo = nodeRule.findTextParameter("map-to"); MapToNodeAnnotation annotation = new MapToNodeAnnotation(); annotation.setMapTo(paramMapTo.getValue()); htmlElement.addAnnotation(annotation); } } } for (AttributeRule attributeRule : namespace.getAttributeRules()) { String xpath = attributeRule.getName(); ArrayList nodes = XPathServices.getNodes(contextNode, xpath); for (Node node : nodes) { if (node instanceof Attr) { Attr attribute = (Attr) node; HtmlElement htmlElement = (HtmlElement) attribute .getOwnerElement(); TextParam paramMapTo = attributeRule .findTextParameter("map-to"); MapToAttributeAnnotation annotation = new MapToAttributeAnnotation(); annotation.setMapTo(paramMapTo.getValue()); annotation.setAttribute(attribute.getName()); htmlElement.addAnnotation(annotation); } } } } } src/java/org/dbdoclet/trafo/html/EditorInstruction.java0000644000175000017500000000474712644165236023446 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.html; import org.dbdoclet.tag.html.HtmlElement; import org.dbdoclet.trafo.script.Script; import org.dbdoclet.xiphias.dom.CharacterDataImpl; import org.dbdoclet.xiphias.dom.NodeImpl; public class EditorInstruction { private NodeImpl current; private NodeImpl parent; private HtmlElement htmlElement; private CharacterDataImpl characterDataNode; private boolean doIgnore = false; private boolean doTraverse = true; private Script script; public EditorInstruction(Script script) { this.script = script; } public boolean doIgnore() { return doIgnore; } public void doIgnore(boolean ignore) { this.doIgnore = ignore; } public boolean doTraverse() { return doTraverse; } public void doTraverse(boolean traverse) { this.doTraverse = traverse; } public HtmlElement getHtmlElement() { return htmlElement; } public NodeImpl getCurrent() { return current; } public NodeImpl getParent() { return parent; } public CharacterDataImpl getCharacterDataNode() { return characterDataNode; } public void setHtmlElement(HtmlElement htmlElement) { this.htmlElement = htmlElement; } public void setCurrent(NodeImpl current) { this.current = current; } public void setParent(NodeImpl targetNode) { this.parent = targetNode; } public void setCharacterDataNode(CharacterDataImpl characterDataNode) { this.characterDataNode = characterDataNode; } @Override public String toString() { String buffer = ""; buffer += ("\nEditor values:\n" + "current.........: " + current + "\n" + "parent..........: " + parent + "\n" + "child...........: " + htmlElement + "\n" +"do ignore.......: " + doIgnore + "\n" + "do traverse.....: " + doTraverse + "\n"); return buffer; } public Script getScript() { return script; } } src/java/org/dbdoclet/trafo/html/IHtmlVisitor.java0000644000175000017500000000240212644165236022335 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.html; import org.dbdoclet.tag.html.HtmlDocument; import org.dbdoclet.tag.html.HtmlFragment; import org.dbdoclet.trafo.script.Script; import org.dbdoclet.xiphias.dom.DocumentFragmentImpl; import org.dbdoclet.xiphias.dom.DocumentImpl; public interface IHtmlVisitor { public DocumentImpl createDocument(HtmlDocument htmlDoc); public DocumentFragmentImpl createDocumentFragment(HtmlFragment htmlFragment); public IEditorFactory getEditorFactory(); public boolean beforeEdit(EditorInstruction values); public Script getScript(); } src/java/org/dbdoclet/trafo/html/IEditor.java0000644000175000017500000000163612644165236021307 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.trafo.html; import org.dbdoclet.tag.TagFactory; public interface IEditor { EditorInstruction edit(EditorInstruction values) throws EditorException; TagFactory getTagFactory(); } src/java/org/dbdoclet/CreatePathException.java0000644000175000017500000000362112644165236021564 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet; import java.io.IOException; public class CreatePathException extends IOException { /** * */ private static final long serialVersionUID = 1L; public static final int UNKNOWN = 0; public static final int FILE_PARENT = 1; public static final int PERMISSION_DENIED = 2; public static final int PATH_TOO_LONG = 3; private String path; private int reason; public CreatePathException(String path) { super(path); this.path = path; } public CreatePathException(String path, int reason) { super(path); this.path = path; this.reason = reason; } public String getPath() { return path; } public int getReason() { return reason; } public boolean hasFileParent() { if (reason == FILE_PARENT) { return true; } return false; } public boolean isPermissionDenied() { if (reason == PERMISSION_DENIED) { return true; } return false; } public boolean isPathTooLong() { if (reason == PATH_TOO_LONG) { return true; } return false; } } src/java/org/dbdoclet/Identifier.java0000644000175000017500000000411512644165236017746 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet; /** * Die Klasse Identifier realisiert einen Identifikator. Der Zweck dieser Klasse * ist es Variablen, die einen Identifikator repräsentieren auch als solche * kenntlich zu machen und von Zeichenketten abzugrenzen. Dies führt .z.B. zur * mehr Klarheit bei den Methiodenaufrufen. * * @author michael */ public class Identifier { private final String value; public Identifier(String value) { if (value == null) { throw new IllegalArgumentException( "Argument value must not be null!"); } this.value = value; } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } Identifier other = (Identifier) obj; if (value == null && other.value != null) { return false; } if (value != null && other.value == null) { return false; } if (value.equals(other.value) == false) { return false; } return true; } /** * Liefert den aktuellen Wert des Identifikators. * * @return String */ public String getValue() { return value; } @Override public int hashCode() { return value.hashCode(); } /** * Liefert die Länge des Identifikators. * * @return int */ public int length() { return value.length(); } @Override public String toString() { return value; } } src/java/org/dbdoclet/io/0000755000175000017500000000000012644165244015426 5ustar mathieumathieusrc/java/org/dbdoclet/io/StartsWithFilter.java0000644000175000017500000000431212644165236021554 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.io; import java.io.File; import java.io.FilenameFilter; /** * Die Klasse EndsWithFilter überprüft ob der Name einer * Datei mit dem definierten Anfang übereinstimmt. * * @author Michael Fuchs * @version 1.0 */ public class StartsWithFilter implements FilenameFilter { /** Der Anfang, der überprüft werden soll. */ private String start; /** * Erzeugt eine neue Instanz der Klasse * StartsWithFileNameFilter. * * @param start String */ public StartsWithFilter(String start) { this.start = start; } /** * Die Methode accept überprüft ob der angegebene Dateiname auf * den definierten Anfang passt. * * Die Überprüfung des Anfangs erfolgt ohne Beachtung der Groß- und * Kleinschreibung. * * @param file File * @param name String * @return boolean */ public boolean accept(File file, String name) { String s1 = name.toLowerCase(); String s2 = start.toLowerCase(); return s1.startsWith(s2); } } /* * $Log: StartsWithFileNameFilter.java,v $ * Revision 1.1.1.1 2004/12/21 14:06:38 mfuchs * Reimport * * Revision 1.3 2004/09/03 08:26:54 mfuchs * Sicherung * * Revision 1.2 2004/08/27 19:30:32 mfuchs * Dokumentation * * Revision 1.1.1.1 2004/05/13 17:14:37 mfuchs * Services * */ src/java/org/dbdoclet/io/EndsWithFilter.java0000644000175000017500000000473212644165236021173 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.io; import java.io.File; import java.io.FilenameFilter; /** * Die Klasse EndsWithFilter überprüft ob der Name einer Datei mit * der definierten Endung übereinstimmt. * * @author Michael Fuchs * @version 1.0 */ public class EndsWithFilter implements FilenameFilter { /** Die Endung, die überprüft werden soll. */ private String[] extensions; /** * Erzeugt eine neue Instanz der Klasse EndsWithFileNameFilter. * * @param extensions * Die Endung, die überprüft werden soll. */ public EndsWithFilter(String... extensions) { if (extensions == null) { throw new IllegalArgumentException("The argument extensions may not be null!"); } this.extensions = extensions; } /** * Die Methode accept überprüft ob der angegebene Dateiname auf * die definierte Endung endet. * * Die Überprüfung der Endung erfolgt ohne Beachtung der Groß- und * Kleinschreibung. * * @param file * File * @param name * String * @return boolean */ public boolean accept(File file, String name) { String s1 = name.toLowerCase(); for (String extension : extensions) { String s2 = extension.toLowerCase(); if (s1.endsWith(s2)) { return true; } } return false; } } /* * $Log: EndsWithFileNameFilter.java,v $ Revision 1.1.1.1 2004/12/21 14:06:38 * mfuchs Reimport * * Revision 1.2 2004/08/27 19:30:32 mfuchs Dokumentation * * Revision 1.1.1.1 2004/05/13 17:14:37 mfuchs Services */ src/java/org/dbdoclet/io/FileSet.java0000644000175000017500000001533512644165236017634 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.io; import java.io.File; import java.io.IOException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.dbdoclet.service.FileServices; import org.dbdoclet.service.StringServices; public class FileSet { public static final int FILTER_NONE = 0; public static final int FILTER_INCLUDE_FILES = 1; public static final int FILTER_EXCLUDE_FILES = 2; public static final int FILTER_INCLUDE_DIRECTORIES = 3; public static final int FILTER_EXCLUDE_DIRECTORIES = 4; public static final int FILTER_INCLUDE_PACKAGES = 5; public static final int FILTER_EXCLUDE_PACKAGES = 6; public static final int STATUS_OK = 0; public static final int STATUS_NOT_FOUND = 1; public static final int STATUS_NOT_READABLE = 2; public static final int STATUS_DUPLICATE = 3; public static final int STATUS_VARIABLE = 4; private static Log logger = LogFactory.getLog(FileSet.class); private Integer id; private File cwd = null; private File path = null; private File canonicalPath = null; private Boolean caseSensitive = Boolean.TRUE; private int filterType = FILTER_NONE; private int status = STATUS_OK; private String filter = ""; public FileSet() throws IOException { this(new File("."), new File(".")); } public FileSet(File cwd, File path) { if (cwd == null) { throw new IllegalArgumentException( "The argument cwd may not be null!"); } if (path == null) { throw new IllegalArgumentException( "The argument path may not be null!"); } this.cwd = cwd; this.caseSensitive = Boolean.TRUE; this.filterType = FILTER_NONE; this.filter = ""; setPath(path); } public FileSet(File cwd, String path) { this(cwd, new File(path)); } @Override public boolean equals(Object obj) { if (obj == null) { return false; } if (obj instanceof FileSet == false) { return false; } FileSet comp = (FileSet) obj; if (id == comp.getId()) { return true; } return false; } public Boolean getCaseSensitive() { return caseSensitive; } public String getDirName() { if (path == null) { throw new IllegalStateException("The field path may not be null!"); } String dirName = path.getPath(); dirName = StringServices.replace(dirName, File.separator, "/"); return dirName; } public String getFilter() { return filter; } public int getFilterType() { return filterType; } public Integer getId() { return id; } public String getPackageFilter() { String str = filter; if (str != null && str.length() > 0) { str = StringServices.replace(str, ".", "/"); } return str; } public File getPath() { return path; } public File getRelativePath() { String relativePath; try { relativePath = FileServices.relativePath(cwd, getQualifiedPath()); } catch (IOException e) { relativePath = path.getAbsolutePath(); } return new File(relativePath); } public File getQualifiedPath() { return canonicalPath; } public int getStatus() { return status; } @Override public int hashCode() { return id.intValue(); } public boolean isCaseSensitive() { return caseSensitive.booleanValue(); } public boolean isDirectory() { return canonicalPath.isDirectory(); } public boolean isDirectoryFilter() { if (filterType == FILTER_INCLUDE_DIRECTORIES || filterType == FILTER_EXCLUDE_DIRECTORIES) { return true; } return false; } public boolean isFileFilter() { if (filterType == FILTER_INCLUDE_FILES || filterType == FILTER_EXCLUDE_FILES) { return true; } return false; } public boolean isPackageFilter() { if (filterType == FILTER_NONE || filterType == FILTER_INCLUDE_PACKAGES || filterType == FILTER_EXCLUDE_PACKAGES) { return true; } return false; } public boolean isVariable() { int status = getStatus(); if (status == STATUS_VARIABLE) { return true; } return false; } public void setCaseSensitive(boolean caseSensitive) { this.caseSensitive = new Boolean(caseSensitive); } public void setCaseSensitive(Boolean caseSensitive) { this.caseSensitive = caseSensitive; } public void setFilter(String filter) { this.filter = filter; } public void setFilterType(int filterType) { this.filterType = filterType; } public void setId(int id) { this.id = new Integer(id); } public void setId(Integer id) { this.id = id; } /** * Der Pfad eines FileSets wird als relativer und als absoluter Pfad * gespeichert. Einzige Ausnahme ist ein Pfad der mit einer Variablen * beginnt. In diesem Fall sind relativer und absoluter Pfad identisch, da * hier keine Aussage über den Inhalt der Variablen gemacht werden kann. * * @param file */ public void setPath(File file) { path = file; canonicalPath = file; String strPath = file.getPath(); if (strPath.matches("^.*\\$\\{\\p{Graph}+\\}.*$") == true) { status = STATUS_VARIABLE; return; } strPath = FileServices.normalizePath(strPath); if (FileServices.isAbsolutePath(strPath) == false) { if (strPath.endsWith("/")) { strPath = FileServices.appendPath(cwd, strPath); } else { strPath = FileServices.appendFileName(cwd, strPath); } } logger.debug("path = " + strPath); canonicalPath = new File(strPath); status = STATUS_OK; if (canonicalPath.canRead() == false) { status = STATUS_NOT_READABLE; } if (canonicalPath.exists() == false) { logger.error(String.format("Path %s not found!", canonicalPath.getAbsolutePath())); status = STATUS_NOT_FOUND; } try { canonicalPath = canonicalPath.getCanonicalFile(); } catch (IOException oops) { oops.printStackTrace(); } } public void setPath(File cwd, File path) { if (cwd == null) { throw new IllegalArgumentException( "The argument cwd may not be null!"); } if (path == null) { throw new IllegalArgumentException( "The argument path may not be null!"); } this.cwd = cwd; setPath(path); } @Override public String toString() { String str = path.getPath() + "[cwd=" + cwd.getAbsolutePath() + ",filterType=" + filterType + "]"; return str; } } src/java/org/dbdoclet/io/MimeType.java0000644000175000017500000002425412644165236020032 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.io; import java.util.HashMap; import org.dbdoclet.service.StringServices; public class MimeType { public static final MimeType COMP = new MimeType("COMP", "Cocs Stock File (.comp)", "text/comp", ".comp", "\\.comp$", false); public static final MimeType CSV = new MimeType("CSV", "CSV File (.csv)", "text/csv", ".csv", "\\.csv$", true); public static final MimeType DOC = new MimeType("DOC", "Microsoft Word (.doc)", "application/msword", ".doc", "\\.doc$", true); public static final MimeType DOCX = new MimeType("DOCX", "Microsoft Word (.docx)", "application/msword (xml)", ".docx", "\\.docx$", true); public static final MimeType GIF = new MimeType("GIF", "GIF Image (.gif)", "image/gif", ".gif", "\\.gif$", true); public static final MimeType PNG = new MimeType("PNG", "PNG Image (.png)", "image/png", ".png", "\\.png$", true); public static final MimeType JPEG = new MimeType("JPEG", "JPEG Image (.jpg)", "image/jpeg", ".jpg", "\\.jpg$", true); public static final MimeType HTML = new MimeType("HTML", "HTML (.html)", "text/html", ".html", "\\.htm(l)?$", false); public static final MimeType MIDI = new MimeType("MIDI", "Audio MIDI (.midi)", "audio/midi", ".midi", "\\.mid(i)?$", true); public static final MimeType MP3 = new MimeType("MP3", "Audio MP3 (.mp3)", "audio/mpeg", ".mp3", "\\.mp3$", true); public static final MimeType MPEG = new MimeType("MPEG", "Video MPEG (.mpeg)", "video/mpeg", ".mpeg", "\\.mp(e)?g$", true); public static final MimeType ODP = new MimeType("ODP", "OpenOffice Impress (.odp)", "application/vnd.oasis.opendocument.presentation", ".odp", "\\.odp$", true); public static final MimeType ODS = new MimeType("ODS", "OpenOffice Calc (.ods)", "application/vnd.oasis.opendocument.spreadsheet", ".ods", "\\.ods$", true); public static final MimeType ODT = new MimeType("ODT", "OpenOffice Writer (.odt)", "application/vnd.oasis.opendocument.text", ".odt", "\\.odt$", true); public static final MimeType PDF = new MimeType("PDF", "PDF - Portable Document Format (.pdf)", "application/pdf", ".pdf", "\\.pdf$", true); public static final MimeType POD = new MimeType("POD", "OpenProj Format (.pod)", "application/pod", ".pod", "\\.pod$", true); public static final MimeType PPT = new MimeType("PPT", "Microsoft Powerpoint (.ppt)", "application/mspowerpoint", ".ppt", "\\.ppt$", true); public static final MimeType PPTX = new MimeType("PPTX", "Microsoft Powerpoint (.pptx)", "application/mspowerpoint (xml)", ".pptx", "\\.pptx$", true); public static final MimeType PPTM = new MimeType("PPTM", "Microsoft Powerpoint with Macros (.pptm)", "application/mspowerpoint with macros (xml)", ".pptm", "\\.pptm$", true); public static final MimeType POTX = new MimeType("POTX", "Microsoft Powerpoint (.potx)", "application/mspowerpoint template (xml)", ".potx", "\\.potx$", true); public static final MimeType WAV = new MimeType("WAV", "Audio WAV (.wav)", "audio/wav", ".wav", "\\.wav$", true); public static final MimeType WMV = new MimeType("WMV", "Video WMV (.wmv)", "video/x-ms-wmv", ".wmv", "\\.wmv$", true); public static final MimeType XLS = new MimeType("XLS", "Microsoft Excel (.xls)", "application/msexcel", ".xls", "\\.xls", true); public static final MimeType XLSX = new MimeType("XLSX", "Microsoft Excel (.xlsx)", "application/msexcel (xml)", ".xlsx", "\\.xlsx", true); public static final MimeType XML = new MimeType("XML", "XML (.xml)", "application/xml", ".xml", "\\.xml$", false); private static HashMap mimeTypeMap = initMimeTypeMap(); private static HashMap extensionMap = initExtensionMap(); private String extension; private String id; private String label; private String mimeType; private boolean binary; private final String regexp; public MimeType(String id, String label, String mimeType, String extension, String regexp, boolean binary) { if (id == null) { throw new IllegalArgumentException("The argument id must not be null!"); } if (label == null) { throw new IllegalArgumentException("The argument label must not be null!"); } if (mimeType == null) { throw new IllegalArgumentException("The argument mimeType must not be null!"); } if (extension == null) { throw new IllegalArgumentException("The argument extension must not be null!"); } if (regexp == null) { throw new IllegalArgumentException("The parameter regexp must not be null!"); } this.id = id; this.label = label; this.mimeType = mimeType; this.extension = extension; this.regexp = regexp; this.binary = binary; } public static MimeType valueOf(String mime) { if (mime == null) { throw new IllegalArgumentException("The argument mime must not be null!"); } MimeType mimeType = mimeTypeMap.get(mime); if (mimeType == null) { throw new IllegalArgumentException("'" + mime + "' is not a valid MimeType!"); } return mimeType; } public static MimeType findByExtension(String extension) { if (extension == null) { throw new IllegalArgumentException("The argument extension must not be null!"); } extension = StringServices.cutPrefix(extension, "."); extension = extension.toLowerCase(); MimeType mimeType = extensionMap.get(extension ); return mimeType; } public void setId(String id) { this.id = id; } public String getId() { return id; } public String getLabel() { return label; } public String getDescription() { return label; } protected void setLabel(String label) { this.label = label; } public void setExtension(String extension) { this.extension = extension; } public String getExtension() { if (extension.startsWith(".") == false) { return "." + extension; } return extension; } public boolean isBinary() { return binary; } public void setBinary(boolean binary) { this.binary = binary; } public String getRegexp() { return regexp; } public void setMimeType(String mimeType) { this.mimeType = mimeType; } public String getMimeType() { return mimeType; } @Override public boolean equals(Object obj) { if (obj == null) { return false; } if (obj instanceof String) { String mimeType = (String) obj; if (mimeType.equals(this.mimeType)) { return true; } else { return false; } } if (obj instanceof MimeType) { MimeType item = (MimeType) obj; String mimeType = item.getMimeType(); if (mimeType.equals(this.mimeType)) { return true; } } return false; } @Override public int hashCode() { int hashCode = mimeType.hashCode(); return hashCode; } @Override public String toString() { return label; } private static HashMap initExtensionMap() { HashMap map = new HashMap(); map.put("comp", COMP); map.put("csv", CSV); map.put("doc", DOC); map.put("docx", DOCX); map.put("gif", GIF); map.put("html", HTML); map.put("jpg", JPEG); map.put("midi", MIDI); map.put("mp3", MP3); map.put("mpeg", MPEG); map.put("odp", ODP); map.put("ods", ODS); map.put("odt", ODT); map.put("pdf", PDF); map.put("pod", POD); map.put("png", PNG); map.put("ppt", PPT); map.put("pptx", PPTX); map.put("pptm", PPTM); map.put("potx", POTX); map.put("wav", WAV); map.put("wmv", WMV); map.put("xml", XML); map.put("xsl", XLS); map.put("xslx", XLSX); return map; } private static HashMap initMimeTypeMap() { HashMap map = new HashMap(); map.put("application/msexcel", XLS); map.put("application/mspowerpoint", PPT); map.put("application/msword", DOC); map.put("application/msexcel (xml)", XLSX); map.put("application/mspowerpoint (xml)", PPTX); map.put("application/mspowerpoint with macros (xml)", PPTM); map.put("application/mspowerpoint template (xml)", POTX); map.put("application/msword (xml)", DOCX); map.put("application/pdf", PDF); map.put("application/pod", POD); map.put("application/vnd.oasis.opendocument.presentation", ODP); map.put("application/vnd.oasis.opendocument.spreadsheet", ODS); map.put("application/vnd.oasis.opendocument.text", ODT); map.put("application/xml", XML); map.put("audio/midi", MIDI); map.put("audio/mpeg", MP3); map.put("audio/wav", WAV); map.put("image/gif", GIF); map.put("image/jpeg", JPEG); map.put("image/png", PNG); map.put("text/comp", COMP); map.put("text/csv", CSV); map.put("text/html", HTML); map.put("video/mpeg", MPEG); map.put("video/x-ms-wmv", WMV); return map; } } src/java/org/dbdoclet/io/DirectoryFilter.java0000644000175000017500000000176412644165236021414 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.io; import java.io.File; import java.io.FileFilter; public class DirectoryFilter implements FileFilter { public boolean accept(File file) { if (file.isDirectory()) { return true; } else { return false; } } } src/java/org/dbdoclet/tag/0000755000175000017500000000000012644165244015572 5ustar mathieumathieusrc/java/org/dbdoclet/tag/javadoc/0000755000175000017500000000000012644165236017202 5ustar mathieumathieusrc/java/org/dbdoclet/tag/javadoc/JavaDocElement.java0000644000175000017500000000305112644165236022665 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.javadoc; import org.dbdoclet.tag.html.HtmlElement; public abstract class JavaDocElement extends HtmlElement { } /* * $Log: JavaDocElement.java,v $ * Revision 1.1.1.1 2004/12/21 14:01:00 mfuchs * Reimport * * Revision 1.2 2004/10/05 13:13:18 mfuchs * Sicherung * * Revision 1.1.1.1 2004/02/17 22:50:30 mfuchs * dbdoclet * * Revision 1.1.1.1 2004/01/05 14:58:10 cvs * dbdoclet * * Revision 1.1.1.1 2003/08/01 13:17:29 cvs * DocBook Doclet * * Revision 1.1.1.1 2003/07/31 17:05:39 mfuchs * DocBook Doclet since 0.46 * * Revision 1.1.1.1 2003/05/30 11:09:40 mfuchs * dbdoclet * * Revision 1.2 2003/04/18 12:22:41 mfuchs * Changes for release 0.41. * * Revision 1.1.1.1 2003/03/18 07:41:37 mfuchs * DocBook Doclet 0.40 * * Revision 1.1.1.1 2003/03/17 20:49:55 cvs * dbdoclet * */ src/java/org/dbdoclet/tag/javadoc/Value.java0000644000175000017500000000215312644165236021122 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.javadoc; /** * The class Link represents a javadoc link tag. * * @author Michael Fuchs * @version 1.0 */ public class Value extends JavaDocElement { public Value() { super(); setNodeName("javadoc:value"); setFormatType(FORMAT_INLINE); } public String getRef() { return getAttribute("ref"); } } src/java/org/dbdoclet/tag/javadoc/Link.java0000644000175000017500000000233112644165236020741 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.javadoc; /** * The class Link represents a javadoc link tag. * * @author Michael Fuchs * @version 1.0 */ public class Link extends JavaDocElement { public Link() { super(); setNodeName("javadoc:link"); setFormatType(FORMAT_INLINE); } public String getName() { return getAttribute("name"); } public String getRef() { return getAttribute("ref"); } @Override public void init() { } } src/java/org/dbdoclet/tag/javadoc/Linkplain.java0000644000175000017500000000267412644165236021777 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.javadoc; /** * The class Linkplain represents a javadoc linkplain tag. * *
      This is an examples for an embedded * javadoc linkplain tag: The type of the return code is a * {@linkplain org.dbdoclet.xiphias.dom.NodeImpl Node}.
      * * @author Michael Fuchs * @version 1.0 */ public class Linkplain extends JavaDocElement { public Linkplain() { super(); setNodeName("javadoc:linkplain"); setFormatType(FORMAT_INLINE); } public String getName() { return getAttribute("name"); } public String getRef() { return getAttribute("ref"); } @Override public void init() { } } src/java/org/dbdoclet/tag/javadoc/Code.java0000644000175000017500000000205012644165236020714 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.javadoc; /** * The class Link represents a javadoc link tag. * * @author Michael Fuchs * @version 1.0 */ public class Code extends JavaDocElement { public Code() { super(); setNodeName("javadoc:code"); setFormatType(FORMAT_INLINE); } } src/java/org/dbdoclet/tag/javadoc/Literal.java0000644000175000017500000000206012644165236021437 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.javadoc; /** * The class Link represents a javadoc link tag. * * @author Michael Fuchs * @version 1.0 */ public class Literal extends JavaDocElement { public Literal() { super(); setNodeName("javadoc:literal"); setFormatType(FORMAT_INLINE); } } src/java/org/dbdoclet/tag/ITransformPosition.java0000644000175000017500000000146612644165236022256 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag; public interface ITransformPosition { public String getDescription(); } src/java/org/dbdoclet/tag/docbook/0000755000175000017500000000000012644165236017213 5ustar mathieumathieusrc/java/org/dbdoclet/tag/docbook/Videodata.java0000644000175000017500000000170612644165236021762 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Videodata extends DocBookElement { private static String tag = "videodata"; public static String getTag() { return tag; } Videodata() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Msgexplan.java0000644000175000017500000000170612644165236022020 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Msgexplan extends DocBookElement { private static String tag = "msgexplan"; public static String getTag() { return tag; } Msgexplan() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Refnamediv.java0000644000175000017500000000160512644165236022140 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Refnamediv extends DocBookElement { Refnamediv() { super("refnamediv"); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Filename.java0000644000175000017500000000170312644165236021577 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Filename extends DocBookElement { private static String tag = "filename"; public static String getTag() { return tag; } Filename() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Fax.java0000644000175000017500000000166412644165236020603 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Fax extends DocBookElement { private static String tag = "fax"; public static String getTag() { return tag; } Fax() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Revnumber.java0000644000175000017500000000170612644165236022027 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Revnumber extends DocBookElement { private static String tag = "revnumber"; public static String getTag() { return tag; } Revnumber() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Note.java0000644000175000017500000000236412644165236020770 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; import java.util.HashMap; public class Note extends DocBookElement { private static String tag = "note"; public static HashMap getAttributeMap() { return new HashMap(); } public static String getTag() { return tag; } Note() { super("note"); setFormatType(FORMAT_BLOCK); } Note(String strTitle) { super("note"); Title title = new Title(strTitle); title.setParentNode(this); appendChild(title); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Refentry.java0000644000175000017500000000157612644165236021665 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Refentry extends DocBookElement { Refentry() { super("refentry"); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Guiicon.java0000644000175000017500000000170012644165236021451 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Guiicon extends DocBookElement { private static String tag = "guiicon"; public static String getTag() { return tag; } Guiicon() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Textobject.java0000644000175000017500000000217012644165236022171 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; import java.util.HashMap; public class Textobject extends DocBookElement { private static String tag = "textobject"; Textobject() { super(tag); setFormatType(FORMAT_BLOCK); } public static String getTag() { return tag; } public static HashMap getAttributeMap() { return new HashMap(); } } src/java/org/dbdoclet/tag/docbook/Conftitle.java0000644000175000017500000000170612644165236022011 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Conftitle extends DocBookElement { private static String tag = "conftitle"; public static String getTag() { return tag; } Conftitle() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/ArticleInfo.java0000644000175000017500000000176212644165236022263 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class ArticleInfo extends DocBookElement { private static final String tag = "articleinfo"; ArticleInfo() { super(tag); setFormatType(FORMAT_BLOCK); } public static String getTag() { return tag; } } src/java/org/dbdoclet/tag/docbook/Refmiscinfo.java0000644000175000017500000000152412644165236022324 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Refmiscinfo extends DocBookElement { Refmiscinfo() { super("refmiscinfo"); } } src/java/org/dbdoclet/tag/docbook/Subject.java0000644000175000017500000000167612644165236021467 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Subject extends DocBookElement { private static String tag = "subject"; Subject() { super(tag); setFormatType(FORMAT_BLOCK); } public static String getTag() { return tag; } } src/java/org/dbdoclet/tag/docbook/Varargs.java0000644000175000017500000000170012644165236021461 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Varargs extends DocBookElement { private static String tag = "varargs"; public static String getTag() { return tag; } Varargs() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Answer.java0000644000175000017500000000167512644165236021326 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Answer extends DocBookElement { private static String tag = "answer"; public static String getTag() { return tag; } Answer() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Set.java0000644000175000017500000000166412644165236020620 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Set extends DocBookElement { private static String tag = "set"; public static String getTag() { return tag; } Set() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Thead.java0000644000175000017500000000155512644165236021111 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Thead extends Telem { Thead() { super("thead"); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Copyright.java0000644000175000017500000000165712644165236022037 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Copyright extends DocBookElement { private static String tagName = "copyright"; Copyright() { super(tagName); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Glossentry.java0000644000175000017500000000171112644165236022227 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Glossentry extends DocBookElement { private static String tag = "glossentry"; public static String getTag() { return tag; } Glossentry() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Itemizedlist.java0000644000175000017500000000213112644165236022521 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; import java.util.HashMap; public class Itemizedlist extends DocBookElement { private static String tag = "itemizedlist"; public static HashMap getAttributeMap() { return new HashMap(); } public static String getTag() { return tag; } Itemizedlist() { super("itemizedlist"); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Th.java0000644000175000017500000000166112644165236020435 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Th extends DocBookElement { private static String tag = "th"; public static String getTag() { return tag; } Th() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Oointerface.java0000644000175000017500000000163712644165236022323 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Oointerface extends DocBookElement { private static String tagName = "oointerface"; Oointerface() { super(tagName); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Important.java0000644000175000017500000000234712644165236022041 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; import java.util.HashMap; public class Important extends DocBookElement { private static String tag = "important"; public static HashMap getAttributeMap() { return new HashMap(); } public static String getTag() { return tag; } Important() { super("important"); setFormatType(FORMAT_BLOCK); } Important(String strTitle) { this(); Title title = new Title(strTitle); title.setParentNode(this); appendChild(title); } } src/java/org/dbdoclet/tag/docbook/Wordasword.java0000644000175000017500000000171112644165236022211 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Wordasword extends DocBookElement { private static String tag = "wordasword"; public static String getTag() { return tag; } Wordasword() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Tasksummary.java0000644000175000017500000000171412644165236022401 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Tasksummary extends DocBookElement { private static String tag = "tasksummary"; public static String getTag() { return tag; } Tasksummary() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Subjectterm.java0000644000175000017500000000171212644165236022346 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Subjectterm extends DocBookElement { private static String tag = "subjectterm"; Subjectterm() { super(tag); setFormatType(FORMAT_BLOCK); } public static String getTag() { return tag; } } src/java/org/dbdoclet/tag/docbook/Foreignphrase.java0000644000175000017500000000172212644165236022654 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Foreignphrase extends DocBookElement { private static String tag = "foreignphrase"; public static String getTag() { return tag; } Foreignphrase() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Shortcut.java0000644000175000017500000000170312644165236021672 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Shortcut extends DocBookElement { private static String tag = "shortcut"; public static String getTag() { return tag; } Shortcut() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Guilabel.java0000644000175000017500000000170312644165236021603 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Guilabel extends DocBookElement { private static String tag = "guilabel"; public static String getTag() { return tag; } Guilabel() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Cover.java0000644000175000017500000000167212644165236021142 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Cover extends DocBookElement { private static String tag = "cover"; public static String getTag() { return tag; } Cover() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Othercredit.java0000644000175000017500000000171412644165236022335 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Othercredit extends DocBookElement { private static String tag = "othercredit"; public static String getTag() { return tag; } Othercredit() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Varlistentry.java0000644000175000017500000000305112644165236022563 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; import org.dbdoclet.xiphias.dom.NodeImpl; public class Varlistentry extends DocBookElement { Varlistentry() { super("varlistentry"); setFormatType(FORMAT_BLOCK); } @Override public void closed() { if (hasChildNodes() == false) { appendChild(new Term()); appendChild(new Listitem().appendChild(new Simpara())); return; } if (getNumberOfChildNodes() == 1) { NodeImpl node = (NodeImpl) getTrafoChildNodes().get(0); if (node instanceof Term) { appendChild(new Listitem().appendChild(new Simpara())); return; } if (node instanceof Listitem) { insertChild(0, new Term()); return; } } } } src/java/org/dbdoclet/tag/docbook/Refsect2.java0000644000175000017500000000166012644165236021536 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Refsect2 extends DocBookElement { public static final String tagName = "refsect2"; Refsect2() { super(tagName); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Glossdiv.java0000644000175000017500000000170312644165236021651 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Glossdiv extends DocBookElement { private static String tag = "glossdiv"; public static String getTag() { return tag; } Glossdiv() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Emphasis.java0000644000175000017500000000237212644165236021633 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Emphasis extends DocBookElement { private final static String tag = "emphasis"; Emphasis() { super(tag); setFormatType(FORMAT_INLINE); } Emphasis(String text) { this(); appendChild(text); } Emphasis(String text, String role) { super(tag); appendChild(text); setAttribute("role", role); setFormatType(FORMAT_INLINE); } Emphasis(DocBookElement elem) { super(tag); appendChild(elem); setFormatType(FORMAT_INLINE); } public static String getTag() { return tag; } } src/java/org/dbdoclet/tag/docbook/Partinfo.java0000644000175000017500000000175112644165236021644 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Partinfo extends DocBookElement { private static final String tag = "partinfo"; Partinfo() { super(tag); setFormatType(FORMAT_BLOCK); } public static String getTag() { return tag; } } src/java/org/dbdoclet/tag/docbook/BaseTagFactory.java0000644000175000017500000020007612644165236022721 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; import java.text.SimpleDateFormat; import org.dbdoclet.tag.TagFactory; import org.w3c.dom.Element; public abstract class BaseTagFactory extends TagFactory { public Abbrev createAbbrev() { Abbrev abbrev = new Abbrev(); initialize(abbrev); return abbrev; } public Abstract createAbstract() { Abstract _abstract = new Abstract(); initialize(_abstract); return _abstract; } public Accel createAccel() { Accel accel = new Accel(); initialize(accel); return accel; } public Acknowledgements createAcknowledgements() { Acknowledgements acknowledgements = new Acknowledgements(); initialize(acknowledgements); return acknowledgements; } public Acronym createAcronym() { Acronym acronym = new Acronym(); initialize(acronym); return acronym; } public Address createAddress() { Address address = new Address(); initialize(address); return address; } public Affiliation createAffiliation() { Affiliation affiliation = new Affiliation(); initialize(affiliation); return affiliation; } public Alt createAlt() { Alt alt = new Alt(); initialize(alt); return alt; } public Anchor createAnchor() { Anchor anchor = new Anchor(); initialize(anchor); return anchor; } public Annotation createAnnotation() { Annotation annotation = new Annotation(); initialize(annotation); return annotation; } public Answer createAnswer() { Answer answer = new Answer(); initialize(answer); return answer; } public Appendix createAppendix() { Appendix appendix = new Appendix(); initialize(appendix); return appendix; } public Application createApplication() { Application application = new Application(); initialize(application); return application; } public Arc createArc() { Arc arc = new Arc(); initialize(arc); return arc; } public Area createArea() { Area area = new Area(); initialize(area); return area; } public Areaset createAreaset() { Areaset areaset = new Areaset(); initialize(areaset); return areaset; } public Areaspec createAreaspec() { Areaspec areaspec = new Areaspec(); initialize(areaspec); return areaspec; } public Arg createArg() { Arg arg = new Arg(); initialize(arg); return arg; } public Article createArticle() { Article article = new Article(); initialize(article); return article; } public ArticleInfo createArticleInfo() { ArticleInfo articleInfo = new ArticleInfo(); initialize(articleInfo); return articleInfo; } public Artpagenums createArtpagenums() { Artpagenums artpagenums = new Artpagenums(); initialize(artpagenums); return artpagenums; } public Attribution createAttribution() { Attribution attribution = new Attribution(); initialize(attribution); return attribution; } public Audiodata createAudiodata() { Audiodata audiodata = new Audiodata(); initialize(audiodata); return audiodata; } public Audioobject createAudioobject() { Audioobject audioobject = new Audioobject(); initialize(audioobject); return audioobject; } public Author createAuthor() { Author author = new Author(); initialize(author); return author; } public Authorgroup createAuthorgroup() { Authorgroup authorgroup = new Authorgroup(); initialize(authorgroup); return authorgroup; } public Authorinitials createAuthorinitials() { Authorinitials authorinitials = new Authorinitials(); initialize(authorinitials); return authorinitials; } public Bibliocoverage createBibliocoverage() { Bibliocoverage bibliocoverage = new Bibliocoverage(); initialize(bibliocoverage); return bibliocoverage; } public Bibliodiv createBibliodiv() { Bibliodiv bibliodiv = new Bibliodiv(); initialize(bibliodiv); return bibliodiv; } public Biblioentry createBiblioentry() { Biblioentry biblioentry = new Biblioentry(); initialize(biblioentry); return biblioentry; } public Bibliography createBibliography() { Bibliography bibliography = new Bibliography(); initialize(bibliography); return bibliography; } public Biblioid createBiblioid() { Biblioid biblioid = new Biblioid(); initialize(biblioid); return biblioid; } public Bibliolist createBibliolist() { Bibliolist bibliolist = new Bibliolist(); initialize(bibliolist); return bibliolist; } public Bibliomisc createBibliomisc() { Bibliomisc bibliomisc = new Bibliomisc(); initialize(bibliomisc); return bibliomisc; } public Bibliomixed createBibliomixed() { Bibliomixed bibliomixed = new Bibliomixed(); initialize(bibliomixed); return bibliomixed; } public Bibliomset createBibliomset() { Bibliomset bibliomset = new Bibliomset(); initialize(bibliomset); return bibliomset; } public Biblioref createBiblioref() { Biblioref biblioref = new Biblioref(); initialize(biblioref); return biblioref; } public Bibliorelation createBibliorelation() { Bibliorelation bibliorelation = new Bibliorelation(); initialize(bibliorelation); return bibliorelation; } public Biblioset createBiblioset() { Biblioset biblioset = new Biblioset(); initialize(biblioset); return biblioset; } public Bibliosource createBibliosource() { Bibliosource bibliosource = new Bibliosource(); initialize(bibliosource); return bibliosource; } public Blockquote createBlockquote() { Blockquote blockquote = new Blockquote(); initialize(blockquote); return blockquote; } public Book createBook() { Book book = new Book(); initialize(book); return book; } public BookInfo createBookInfo() { BookInfo bookInfo = new BookInfo(); initialize(bookInfo); return bookInfo; } public Bridgehead createBridgehead() { Bridgehead Bridgehead = new Bridgehead(); initialize(Bridgehead); return Bridgehead; } public Callout createCallout() { Callout callout = new Callout(); initialize(callout); return callout; } public Calloutlist createCalloutlist() { Calloutlist calloutlist = new Calloutlist(); initialize(calloutlist); return calloutlist; } public Caption createCaption() { Caption caption = new Caption(); initialize(caption); return caption; } public Caution createCaution() { Caution caution = new Caution(); initialize(caution); return caution; } public Chapter createChapter() { Chapter chapter = new Chapter(); initialize(chapter); return chapter; } public Citation createCitation() { Citation citation = new Citation(); initialize(citation); return citation; } public Citebiblioid createCitebiblioid() { Citebiblioid citebiblioid = new Citebiblioid(); initialize(citebiblioid); return citebiblioid; } public Citerefentry createCiterefentry() { Citerefentry citerefentry = new Citerefentry(); initialize(citerefentry); return citerefentry; } public Citetitle createCitetitle() { Citetitle citetitle = new Citetitle(); initialize(citetitle); return citetitle; } public City createCity() { City city = new City(); initialize(city); return city; } public Classname createClassname() { Classname classname = new Classname(); initialize(classname); return classname; } public Classsynopsis createClasssynopsis() { Classsynopsis classsynopsis = new Classsynopsis(); initialize(classsynopsis); return classsynopsis; } public Classsynopsisinfo createClasssynopsisinfo() { Classsynopsisinfo classsynopsisinfo = new Classsynopsisinfo(); initialize(classsynopsisinfo); return classsynopsisinfo; } public Cmdsynopsis createCmdsynopsis() { Cmdsynopsis cmdsynopsis = new Cmdsynopsis(); initialize(cmdsynopsis); return cmdsynopsis; } public Co createCo() { Co co = new Co(); initialize(co); return co; } public Code createCode() { Code code = new Code(); initialize(code); return code; } public Col createCol() { Col col = new Col(); initialize(col); return col; } public Colgroup createColgroup() { Colgroup colgroup = new Colgroup(); initialize(colgroup); return colgroup; } public Collab createCollab() { Collab collab = new Collab(); initialize(collab); return collab; } public Colophon createColophon() { Colophon colophon = new Colophon(); initialize(colophon); return colophon; } public Colspec createColspec() { Colspec colspec = new Colspec(); initialize(colspec); return colspec; } public Command createCommand() { Command command = new Command(); initialize(command); return command; } public Computeroutput createComputeroutput() { Computeroutput computeroutput = new Computeroutput(); initialize(computeroutput); return computeroutput; } public Confdates createConfdates() { Confdates confdates = new Confdates(); initialize(confdates); return confdates; } public Confgroup createConfgroup() { Confgroup confgroup = new Confgroup(); initialize(confgroup); return confgroup; } public Confnum createConfnum() { Confnum confnum = new Confnum(); initialize(confnum); return confnum; } public Confsponsor createConfsponsor() { Confsponsor confsponsor = new Confsponsor(); initialize(confsponsor); return confsponsor; } public Conftitle createConftitle() { Conftitle conftitle = new Conftitle(); initialize(conftitle); return conftitle; } public Constant createConstant() { Constant constant = new Constant(); initialize(constant); return constant; } public Constraint createConstraint() { Constraint constraint = new Constraint(); initialize(constraint); return constraint; } public Constraintdef createConstraintdef() { Constraintdef constraintdef = new Constraintdef(); initialize(constraintdef); return constraintdef; } public Constructorsynopsis createConstructorsynopsis() { Constructorsynopsis constructorsynopsis = new Constructorsynopsis(); initialize(constructorsynopsis); return constructorsynopsis; } public Contractnum createContractnum() { Contractnum contractnum = new Contractnum(); initialize(contractnum); return contractnum; } public Contractsponsor createContractsponsor() { Contractsponsor contractsponsor = new Contractsponsor(); initialize(contractsponsor); return contractsponsor; } public Contrib createContrib() { Contrib contrib = new Contrib(); initialize(contrib); return contrib; } public Copyright createCopyright() { Copyright copyright = new Copyright(); initialize(copyright); return copyright; } public Coref createCoref() { Coref coref = new Coref(); initialize(coref); return coref; } public Country createCountry() { Country country = new Country(); initialize(country); return country; } public Cover createCover() { Cover cover = new Cover(); initialize(cover); return cover; } public Database createDatabase() { Database database = new Database(); initialize(database); return database; } public Date createDate() { java.util.Date today = new java.util.Date(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); Date date = new Date(sdf.format(today)); initialize(date); return date; } public Dedication createDedication() { Dedication dedication = new Dedication(); initialize(dedication); return dedication; } public Destructorsynopsis createDestructorsynopsis() { Destructorsynopsis destructorsynopsis = new Destructorsynopsis(); initialize(destructorsynopsis); return destructorsynopsis; } public Edition createEdition() { Edition edition = new Edition(); initialize(edition); return edition; } public Editor createEditor() { Editor editor = new Editor(); initialize(editor); return editor; } public Element createElement(String elementName) { if (elementName == null || elementName.trim().length() == 0) { return null; } switch (elementName) { case "abbrev": return createAbbrev(); case "abstract": return createAbstract(); case "accel": return createAccel(); case "acknowledgements": return createAcknowledgements(); case "acronym": return createAcronym(); case "address": return createAddress(); case "affiliation": return createAffiliation(); case "alt": return createAlt(); case "anchor": return createAnchor(); case "annotation": return createAnnotation(); case "answer": return createAnswer(); case "appendix": return createAppendix(); case "application": return createApplication(); case "arc": return createArc(); case "area": return createArea(); case "areaset": return createAreaset(); case "areaspec": return createAreaspec(); case "arg": return createArg(); case "article": return createArticle(); case "artpagenums": return createArtpagenums(); case "attribution": return createAttribution(); case "audiodata": return createAudiodata(); case "audioobject": return createAudioobject(); case "author": return createAuthor(); case "authorgroup": return createAuthorgroup(); case "authorinitials": return createAuthorinitials(); case "bibliocoverage": return createBibliocoverage(); case "bibliodiv": return createBibliodiv(); case "biblioentry": return createBiblioentry(); case "bibliography": return createBibliography(); case "biblioid": return createBiblioid(); case "bibliolist": return createBibliolist(); case "bibliomisc": return createBibliomisc(); case "bibliomixed": return createBibliomixed(); case "bibliomset": return createBibliomset(); case "biblioref": return createBiblioref(); case "bibliorelation": return createBibliorelation(); case "biblioset": return createBiblioset(); case "bibliosource": return createBibliosource(); case "blockquote": return createBlockquote(); case "book": return createBook(); case "Bridgehead": return createBridgehead(); case "callout": return createCallout(); case "calloutlist": return createCalloutlist(); case "caption": return createCaption(); case "caution": return createCaution(); case "chapter": return createChapter(); case "citation": return createCitation(); case "citebiblioid": return createCitebiblioid(); case "citerefentry": return createCiterefentry(); case "citetitle": return createCitetitle(); case "city": return createCity(); case "classname": return createClassname(); case "classsynopsis": return createClasssynopsis(); case "classsynopsisinfo": return createClasssynopsisinfo(); case "cmdsynopsis": return createCmdsynopsis(); case "co": return createCo(); case "code": return createCode(); case "col": return createCol(); case "colgroup": return createColgroup(); case "collab": return createCollab(); case "colophon": return createColophon(); case "colspec": return createColspec(); case "command": return createCommand(); case "computeroutput": return createComputeroutput(); case "confdates": return createConfdates(); case "confgroup": return createConfgroup(); case "confnum": return createConfnum(); case "confsponsor": return createConfsponsor(); case "conftitle": return createConftitle(); case "constant": return createConstant(); case "constraint": return createConstraint(); case "constraintdef": return createConstraintdef(); case "constructorsynopsis": return createConstructorsynopsis(); case "contractnum": return createContractnum(); case "contractsponsor": return createContractsponsor(); case "contrib": return createContrib(); case "copyright": return createCopyright(); case "coref": return createCoref(); case "country": return createCountry(); case "cover": return createCover(); case "database": return createDatabase(); case "date": return createDate(); case "dedication": return createDedication(); case "destructorsynopsis": return createDestructorsynopsis(); case "edition": return createEdition(); case "editor": return createEditor(); case "email": return createEmail(); case "emphasis": return createEmphasis(); case "entry": return createEntry(); case "entrytbl": return createEntrytbl(); case "envar": return createEnvar(); case "epigraph": return createEpigraph(); case "equation": return createEquation(); case "errorcode": return createErrorcode(); case "errorname": return createErrorname(); case "errortext": return createErrortext(); case "errortype": return createErrortype(); case "example": return createExample(); case "exceptionname": return createExceptionname(); case "extendedlink": return createExtendedlink(); case "fax": return createFax(); case "fieldsynopsis": return createFieldsynopsis(); case "figure": return createFigure(); case "filename": return createFilename(); case "firstname": return createFirstname(); case "firstterm": return createFirstterm(); case "footnote": return createFootnote(); case "footnoteref": return createFootnoteref(); case "foreignphrase": return createForeignphrase(); case "formalpara": return createFormalpara(); case "funcdef": return createFuncdef(); case "funcparams": return createFuncparams(); case "funcprototype": return createFuncprototype(); case "funcsynopsis": return createFuncsynopsis(); case "funcsynopsisinfo": return createFuncsynopsisinfo(); case "function": return createFunction(); case "glossary": return createGlossary(); case "glossdef": return createGlossdef(); case "glossdiv": return createGlossdiv(); case "glossentry": return createGlossentry(); case "glosslist": return createGlosslist(); case "glosssee": return createGlosssee(); case "glossseealso": return createGlossseealso(); case "glossterm": return createGlossterm(); case "group": return createGroup(); case "guibutton": return createGuibutton(); case "guiicon": return createGuiicon(); case "guilabel": return createGuilabel(); case "guimenu": return createGuimenu(); case "guimenuitem": return createGuimenuitem(); case "guisubmenu": return createGuisubmenu(); case "hardware": return createHardware(); case "holder": return createHolder(); case "honorific": return createHonorific(); case "imagedata": return createImagedata(); case "imageobject": return createImageobject(); case "imageobjectco": return createImageobjectco(); case "important": return createImportant(); case "index": return createIndex(); case "indexdiv": return createIndexdiv(); case "indexentry": return createIndexentry(); case "indexterm": return createIndexterm(); case "info": return createInfo(); case "informalequation": return createInformalequation(); case "informalexample": return createInformalexample(); case "informalfigure": return createInformalfigure(); case "informaltable": return createInformaltable(); case "initializer": return createInitializer(); case "inlineequation": return createInlineequation(); case "inlinemediaobject": return createInlinemediaobject(); case "interfacename": return createInterfacename(); case "issuenum": return createIssuenum(); case "itemizedlist": return createItemizedlist(); case "itermset": return createItermset(); case "jobtitle": return createJobtitle(); case "keycap": return createKeycap(); case "keycode": return createKeycode(); case "keycombo": return createKeycombo(); case "keysym": return createKeysym(); case "keyword": return createKeyword(); case "keywordset": return createKeywordset(); case "label": return createLabel(); case "legalnotice": return createLegalnotice(); case "lhs": return createLhs(); case "lineage": return createLineage(); case "lineannotation": return createLineannotation(); case "link": return createLink(); case "listitem": return createListitem(); case "literal": return createLiteral(); case "literallayout": return createLiterallayout(); case "locator": return createLocator(); case "manvolnum": return createManvolnum(); case "markup": return createMarkup(); case "mathphrase": return createMathphrase(); case "mediaobject": return createMediaobject(); case "member": return createMember(); case "menuchoice": return createMenuchoice(); case "methodname": return createMethodname(); case "methodparam": return createMethodparam(); case "methodsynopsis": return createMethodsynopsis(); case "modifier": return createModifier(); case "mousebutton": return createMousebutton(); case "msg": return createMsg(); case "msgaud": return createMsgaud(); case "msgentry": return createMsgentry(); case "msgexplan": return createMsgexplan(); case "msginfo": return createMsginfo(); case "msglevel": return createMsglevel(); case "msgmain": return createMsgmain(); case "msgorig": return createMsgorig(); case "msgrel": return createMsgrel(); case "msgset": return createMsgset(); case "msgsub": return createMsgsub(); case "msgtext": return createMsgtext(); case "nonterminal": return createNonterminal(); case "note": return createNote(); case "olink": return createOlink(); case "ooclass": return createOoclass(); case "ooexception": return createOoexception(); case "oointerface": return createOointerface(); case "option": return createOption(); case "optional": return createOptional(); case "orderedlist": return createOrderedlist(); case "org": return createOrg(); case "orgdiv": return createOrgdiv(); case "orgname": return createOrgname(); case "otheraddr": return createOtheraddr(); case "othercredit": return createOthercredit(); case "othername": return createOthername(); case "package": return createPackage(); case "pagenums": return createPagenums(); case "para": return createPara(); case "paramdef": return createParamdef(); case "parameter": return createParameter(); case "part": return createPart(); case "partintro": return createPartintro(); case "person": return createPerson(); case "personblurb": return createPersonblurb(); case "personname": return createPersonname(); case "phone": return createPhone(); case "phrase": return createPhrase(); case "pob": return createPob(); case "postcode": return createPostcode(); case "preface": return createPreface(); case "primary": return createPrimary(); case "primaryie": return createPrimaryie(); case "printhistory": return createPrinthistory(); case "procedure": return createProcedure(); case "production": return createProduction(); case "productionrecap": return createProductionrecap(); case "productionset": return createProductionset(); case "productname": return createProductname(); case "productnumber": return createProductnumber(); case "programlisting": return createProgramlisting(); case "programlistingco": return createProgramlistingco(); case "prompt": return createPrompt(); case "property": return createProperty(); case "pubdate": return createPubdate(); case "publisher": return createPublisher(); case "publishername": return createPublishername(); case "qandadiv": return createQandadiv(); case "qandaentry": return createQandaentry(); case "qandaset": return createQandaset(); case "question": return createQuestion(); case "quote": return createQuote(); case "refclass": return createRefclass(); case "refdescriptor": return createRefdescriptor(); case "refentry": return createRefentry(); case "refentrytitle": return createRefentrytitle(); case "reference": return createReference(); case "refmeta": return createRefmeta(); case "refmiscinfo": return createRefmiscinfo(); case "refname": return createRefname(); case "refnamediv": return createRefnamediv(); case "refpurpose": return createRefpurpose(); case "refsect1": return createRefsect1(); case "refsect2": return createRefsect2(); case "refsect3": return createRefsect3(); case "refsection": return createRefsection(); case "refsynopsisdiv": return createRefsynopsisdiv(); case "releaseinfo": return createReleaseinfo(); case "remark": return createRemark(); case "replaceable": return createReplaceable(); case "returnvalue": return createReturnvalue(); case "revdescription": return createRevdescription(); case "revhistory": return createRevhistory(); case "revision": return createRevision(); case "revnumber": return createRevnumber(); case "revremark": return createRevremark(); case "rhs": return createRhs(); case "row": return createRow(); case "sbr": return createSbr(); case "screen": return createScreen(); case "screenco": return createScreenco(); case "screenshot": return createScreenshot(); case "secondary": return createSecondary(); case "secondaryie": return createSecondaryie(); case "sect1": return createSect1(); case "sect2": return createSect2(); case "sect3": return createSect3(); case "sect4": return createSect4(); case "sect5": return createSect5(); case "section": return createSection(); case "see": return createSee(); case "seealso": return createSeealso(); case "seealsoie": return createSeealsoie(); case "seeie": return createSeeie(); case "seg": return createSeg(); case "seglistitem": return createSeglistitem(); case "segmentedlist": return createSegmentedlist(); case "segtitle": return createSegtitle(); case "seriesvolnums": return createSeriesvolnums(); case "set": return createSet(); case "setindex": return createSetindex(); case "shortaffil": return createShortaffil(); case "shortcut": return createShortcut(); case "sidebar": return createSidebar(); case "simpara": return createSimpara(); case "simplelist": return createSimplelist(); case "simplemsgentry": return createSimplemsgentry(); case "simplesect": return createSimplesect(); case "spanspec": return createSpanspec(); case "state": return createState(); case "step": return createStep(); case "stepalternatives": return createStepalternatives(); case "street": return createStreet(); case "subject": return createSubject(); case "subjectset": return createSubjectset(); case "subjectterm": return createSubjectterm(); case "subscript": return createSubscript(); case "substeps": return createSubsteps(); case "subtitle": return createSubtitle(); case "superscript": return createSuperscript(); case "surname": return createSurname(); case "symbol": return createSymbol(); case "synopfragment": return createSynopfragment(); case "synopfragmentref": return createSynopfragmentref(); case "synopsis": return createSynopsis(); case "systemitem": return createSystemitem(); case "table": return createTable(); case "tag": return createTag(); case "task": return createTask(); case "taskprerequisites": return createTaskprerequisites(); case "taskrelated": return createTaskrelated(); case "tasksummary": return createTasksummary(); case "tbody": return createTbody(); case "td": return createTd(); case "term": return createTerm(); case "termdef": return createTermdef(); case "tertiary": return createTertiary(); case "tertiaryie": return createTertiaryie(); case "textdata": return createTextdata(); case "textobject": return createTextobject(); case "tfoot": return createTfoot(); case "tgroup": return createTgroup(); case "th": return createTh(); case "thead": return createThead(); case "tip": return createTip(); case "title": return createTitle(); case "titleabbrev": return createTitleabbrev(); case "toc": return createToc(); case "tocdiv": return createTocdiv(); case "tocentry": return createTocentry(); case "token": return createToken(); case "tr": return createTr(); case "trademark": return createTrademark(); case "type": return createType(); case "uri": return createUri(); case "userinput": return createUserinput(); case "varargs": return createVarargs(); case "variablelist": return createVariablelist(); case "varlistentry": return createVarlistentry(); case "varname": return createVarname(); case "videodata": return createVideodata(); case "videoobject": return createVideoobject(); case "void": return createVoid(); case "volumenum": return createVolumenum(); case "warning": return createWarning(); case "wordasword": return createWordasword(); case "xref": return createXref(); case "year": return createYear(); } return null; } public Email createEmail() { Email email = new Email(); initialize(email); return email; } public Emphasis createEmphasis() { Emphasis emphasis = new Emphasis(); initialize(emphasis); return emphasis; } public Entry createEntry() { Entry entry = new Entry(); initialize(entry); return entry; } public Entrytbl createEntrytbl() { Entrytbl entrytbl = new Entrytbl(); initialize(entrytbl); return entrytbl; } public Envar createEnvar() { Envar envar = new Envar(); initialize(envar); return envar; } public Epigraph createEpigraph() { Epigraph epigraph = new Epigraph(); initialize(epigraph); return epigraph; } public Equation createEquation() { Equation equation = new Equation(); initialize(equation); return equation; } public Errorcode createErrorcode() { Errorcode errorcode = new Errorcode(); initialize(errorcode); return errorcode; } public Errorname createErrorname() { Errorname errorname = new Errorname(); initialize(errorname); return errorname; } public Errortext createErrortext() { Errortext errortext = new Errortext(); initialize(errortext); return errortext; } public Errortype createErrortype() { Errortype errortype = new Errortype(); initialize(errortype); return errortype; } public Example createExample() { Example example = new Example(); initialize(example); return example; } public Exceptionname createExceptionname() { Exceptionname exceptionname = new Exceptionname(); initialize(exceptionname); return exceptionname; } public Extendedlink createExtendedlink() { Extendedlink extendedlink = new Extendedlink(); initialize(extendedlink); return extendedlink; } public Fax createFax() { Fax fax = new Fax(); initialize(fax); return fax; } public Fieldsynopsis createFieldsynopsis() { Fieldsynopsis fieldsynopsis = new Fieldsynopsis(); initialize(fieldsynopsis); return fieldsynopsis; } public Figure createFigure() { Figure figure = new Figure(); initialize(figure); return figure; } public Filename createFilename() { Filename filename = new Filename(); initialize(filename); return filename; } public Firstname createFirstname() { Firstname firstname = new Firstname(); initialize(firstname); return firstname; } public Firstterm createFirstterm() { Firstterm firstterm = new Firstterm(); initialize(firstterm); return firstterm; } public Footnote createFootnote() { Footnote footnote = new Footnote(); initialize(footnote); return footnote; } public Footnoteref createFootnoteref() { Footnoteref footnoteref = new Footnoteref(); initialize(footnoteref); return footnoteref; } public Foreignphrase createForeignphrase() { Foreignphrase foreignphrase = new Foreignphrase(); initialize(foreignphrase); return foreignphrase; } public Formalpara createFormalpara() { Formalpara formalpara = new Formalpara(); initialize(formalpara); return formalpara; } public Funcdef createFuncdef() { Funcdef funcdef = new Funcdef(); initialize(funcdef); return funcdef; } public Funcparams createFuncparams() { Funcparams funcparams = new Funcparams(); initialize(funcparams); return funcparams; } public Funcprototype createFuncprototype() { Funcprototype funcprototype = new Funcprototype(); initialize(funcprototype); return funcprototype; } public Funcsynopsis createFuncsynopsis() { Funcsynopsis funcsynopsis = new Funcsynopsis(); initialize(funcsynopsis); return funcsynopsis; } public Funcsynopsisinfo createFuncsynopsisinfo() { Funcsynopsisinfo funcsynopsisinfo = new Funcsynopsisinfo(); initialize(funcsynopsisinfo); return funcsynopsisinfo; } public Function createFunction() { Function function = new Function(); initialize(function); return function; } public Glossary createGlossary() { Glossary glossary = new Glossary(); initialize(glossary); return glossary; } public Glossdef createGlossdef() { Glossdef glossdef = new Glossdef(); initialize(glossdef); return glossdef; } public Glossdiv createGlossdiv() { Glossdiv glossdiv = new Glossdiv(); initialize(glossdiv); return glossdiv; } public Glossentry createGlossentry() { Glossentry glossentry = new Glossentry(); initialize(glossentry); return glossentry; } public Glosslist createGlosslist() { Glosslist glosslist = new Glosslist(); initialize(glosslist); return glosslist; } public Glosssee createGlosssee() { Glosssee glosssee = new Glosssee(); initialize(glosssee); return glosssee; } public Glossseealso createGlossseealso() { Glossseealso glossseealso = new Glossseealso(); initialize(glossseealso); return glossseealso; } public Glossterm createGlossterm() { Glossterm glossterm = new Glossterm(); initialize(glossterm); return glossterm; } public Group createGroup() { Group group = new Group(); initialize(group); return group; } public Guibutton createGuibutton() { Guibutton guibutton = new Guibutton(); initialize(guibutton); return guibutton; } public Guiicon createGuiicon() { Guiicon guiicon = new Guiicon(); initialize(guiicon); return guiicon; } public Guilabel createGuilabel() { Guilabel guilabel = new Guilabel(); initialize(guilabel); return guilabel; } public Guimenu createGuimenu() { Guimenu guimenu = new Guimenu(); initialize(guimenu); return guimenu; } public Guimenuitem createGuimenuitem() { Guimenuitem guimenuitem = new Guimenuitem(); initialize(guimenuitem); return guimenuitem; } public Guisubmenu createGuisubmenu() { Guisubmenu guisubmenu = new Guisubmenu(); initialize(guisubmenu); return guisubmenu; } public Hardware createHardware() { Hardware hardware = new Hardware(); initialize(hardware); return hardware; } public Holder createHolder() { Holder holder = new Holder(); initialize(holder); return holder; } public Honorific createHonorific() { Honorific honorific = new Honorific(); initialize(honorific); return honorific; } public Imagedata createImagedata() { Imagedata imagedata = new Imagedata(); initialize(imagedata); return imagedata; } public Imageobject createImageobject() { Imageobject imageobject = new Imageobject(); initialize(imageobject); return imageobject; } public Imageobjectco createImageobjectco() { Imageobjectco imageobjectco = new Imageobjectco(); initialize(imageobjectco); return imageobjectco; } public Important createImportant() { Important important = new Important(); initialize(important); return important; } public Index createIndex() { Index index = new Index(); initialize(index); return index; } public Indexdiv createIndexdiv() { Indexdiv indexdiv = new Indexdiv(); initialize(indexdiv); return indexdiv; } public Indexentry createIndexentry() { Indexentry indexentry = new Indexentry(); initialize(indexentry); return indexentry; } public Indexterm createIndexterm() { Indexterm indexterm = new Indexterm(); initialize(indexterm); return indexterm; } public Info createInfo() { Info info = new Info(); initialize(info); return info; } public Informalequation createInformalequation() { Informalequation informalequation = new Informalequation(); initialize(informalequation); return informalequation; } public Informalexample createInformalexample() { Informalexample informalexample = new Informalexample(); initialize(informalexample); return informalexample; } public Informalfigure createInformalfigure() { Informalfigure informalfigure = new Informalfigure(); initialize(informalfigure); return informalfigure; } public Informaltable createInformaltable() { Informaltable informaltable = new Informaltable(); initialize(informaltable); return informaltable; } public Initializer createInitializer() { Initializer initializer = new Initializer(); initialize(initializer); return initializer; } public Inlineequation createInlineequation() { Inlineequation inlineequation = new Inlineequation(); initialize(inlineequation); return inlineequation; } public Inlinemediaobject createInlinemediaobject() { Inlinemediaobject inlinemediaobject = new Inlinemediaobject(); initialize(inlinemediaobject); return inlinemediaobject; } public Interfacename createInterfacename() { Interfacename interfacename = new Interfacename(); initialize(interfacename); return interfacename; } public Issuenum createIssuenum() { Issuenum issuenum = new Issuenum(); initialize(issuenum); return issuenum; } public Itemizedlist createItemizedlist() { Itemizedlist itemizedlist = new Itemizedlist(); initialize(itemizedlist); return itemizedlist; } public Itermset createItermset() { Itermset itermset = new Itermset(); initialize(itermset); return itermset; } public Jobtitle createJobtitle() { Jobtitle jobtitle = new Jobtitle(); initialize(jobtitle); return jobtitle; } public Keycap createKeycap() { Keycap keycap = new Keycap(); initialize(keycap); return keycap; } public Keycode createKeycode() { Keycode keycode = new Keycode(); initialize(keycode); return keycode; } public Keycombo createKeycombo() { Keycombo keycombo = new Keycombo(); initialize(keycombo); return keycombo; } public Keysym createKeysym() { Keysym keysym = new Keysym(); initialize(keysym); return keysym; } public Keyword createKeyword() { Keyword keyword = new Keyword(); initialize(keyword); return keyword; } public Keywordset createKeywordset() { Keywordset keywordset = new Keywordset(); initialize(keywordset); return keywordset; } public Label createLabel() { Label label = new Label(); initialize(label); return label; } public Legalnotice createLegalnotice() { Legalnotice legalnotice = new Legalnotice(); initialize(legalnotice); return legalnotice; } public Lhs createLhs() { Lhs lhs = new Lhs(); initialize(lhs); return lhs; } public Lineage createLineage() { Lineage lineage = new Lineage(); initialize(lineage); return lineage; } public Lineannotation createLineannotation() { Lineannotation lineannotation = new Lineannotation(); initialize(lineannotation); return lineannotation; } public Link createLink() { Link link = new Link(); initialize(link); return link; } public Listitem createListitem() { Listitem listitem = new Listitem(); initialize(listitem); return listitem; } public Literal createLiteral() { Literal literal = new Literal(); initialize(literal); return literal; } public Literallayout createLiterallayout() { Literallayout literallayout = new Literallayout(); initialize(literallayout); return literallayout; } public Locator createLocator() { Locator locator = new Locator(); initialize(locator); return locator; } public Manvolnum createManvolnum() { Manvolnum manvolnum = new Manvolnum(); initialize(manvolnum); return manvolnum; } public Markup createMarkup() { Markup markup = new Markup(); initialize(markup); return markup; } public Mathphrase createMathphrase() { Mathphrase mathphrase = new Mathphrase(); initialize(mathphrase); return mathphrase; } public Mediaobject createMediaobject() { Mediaobject mediaobject = new Mediaobject(); initialize(mediaobject); return mediaobject; } public Member createMember() { Member member = new Member(); initialize(member); return member; } public Menuchoice createMenuchoice() { Menuchoice menuchoice = new Menuchoice(); initialize(menuchoice); return menuchoice; } public Methodname createMethodname() { Methodname methodname = new Methodname(); initialize(methodname); return methodname; } public Methodparam createMethodparam() { Methodparam methodparam = new Methodparam(); initialize(methodparam); return methodparam; } public Methodsynopsis createMethodsynopsis() { Methodsynopsis methodsynopsis = new Methodsynopsis(); initialize(methodsynopsis); return methodsynopsis; } public Modifier createModifier() { Modifier modifier = new Modifier(); initialize(modifier); return modifier; } public Mousebutton createMousebutton() { Mousebutton mousebutton = new Mousebutton(); initialize(mousebutton); return mousebutton; } public Msg createMsg() { Msg msg = new Msg(); initialize(msg); return msg; } public Msgaud createMsgaud() { Msgaud msgaud = new Msgaud(); initialize(msgaud); return msgaud; } public Msgentry createMsgentry() { Msgentry msgentry = new Msgentry(); initialize(msgentry); return msgentry; } public Msgexplan createMsgexplan() { Msgexplan msgexplan = new Msgexplan(); initialize(msgexplan); return msgexplan; } public Msginfo createMsginfo() { Msginfo msginfo = new Msginfo(); initialize(msginfo); return msginfo; } public Msglevel createMsglevel() { Msglevel msglevel = new Msglevel(); initialize(msglevel); return msglevel; } public Msgmain createMsgmain() { Msgmain msgmain = new Msgmain(); initialize(msgmain); return msgmain; } public Msgorig createMsgorig() { Msgorig msgorig = new Msgorig(); initialize(msgorig); return msgorig; } public Msgrel createMsgrel() { Msgrel msgrel = new Msgrel(); initialize(msgrel); return msgrel; } public Msgset createMsgset() { Msgset msgset = new Msgset(); initialize(msgset); return msgset; } public Msgsub createMsgsub() { Msgsub msgsub = new Msgsub(); initialize(msgsub); return msgsub; } public Msgtext createMsgtext() { Msgtext msgtext = new Msgtext(); initialize(msgtext); return msgtext; } public Nonterminal createNonterminal() { Nonterminal nonterminal = new Nonterminal(); initialize(nonterminal); return nonterminal; } public Note createNote() { Note note = new Note(); initialize(note); return note; } public Olink createOlink() { Olink olink = new Olink(); initialize(olink); return olink; } public Ooclass createOoclass() { Ooclass ooClass = new Ooclass(); initialize(ooClass); return ooClass; } public Ooexception createOoexception() { Ooexception ooexception = new Ooexception(); initialize(ooexception); return ooexception; } public Ooexception createOoException() { Ooexception ooException = new Ooexception(); initialize(ooException); return ooException; } public Oointerface createOointerface() { Oointerface oointerface = new Oointerface(); initialize(oointerface); return oointerface; } public Option createOption() { Option option = new Option(); initialize(option); return option; } public Optional createOptional() { Optional optional = new Optional(); initialize(optional); return optional; } public Orderedlist createOrderedlist() { Orderedlist orderedlist = new Orderedlist(); initialize(orderedlist); return orderedlist; } public Org createOrg() { Org org = new Org(); initialize(org); return org; } public Orgdiv createOrgdiv() { Orgdiv orgdiv = new Orgdiv(); initialize(orgdiv); return orgdiv; } public Orgname createOrgname() { Orgname orgname = new Orgname(); initialize(orgname); return orgname; } public Otheraddr createOtheraddr() { Otheraddr otheraddr = new Otheraddr(); initialize(otheraddr); return otheraddr; } public Othercredit createOthercredit() { Othercredit othercredit = new Othercredit(); initialize(othercredit); return othercredit; } public Othername createOthername() { Othername othername = new Othername(); initialize(othername); return othername; } public Package createPackage() { Package _package = new Package(); initialize(_package); return _package; } public Pagenums createPagenums() { Pagenums pagenums = new Pagenums(); initialize(pagenums); return pagenums; } public Para createPara() { Para para = new Para(); initialize(para); return para; } public Para createPara(String text) { Para para = new Para(text); initialize(para); return para; } public Paramdef createParamdef() { Paramdef paramdef = new Paramdef(); initialize(paramdef); return paramdef; } public Parameter createParameter() { Parameter parameter = new Parameter(); initialize(parameter); return parameter; } public Part createPart() { Part part = new Part(); initialize(part); return part; } public Partinfo createPartinfo() { Partinfo partInfo = new Partinfo(); initialize(partInfo); return partInfo; } public Partintro createPartintro() { Partintro partintro = new Partintro(); initialize(partintro); return partintro; } public Person createPerson() { Person person = new Person(); initialize(person); return person; } public Personblurb createPersonblurb() { Personblurb personblurb = new Personblurb(); initialize(personblurb); return personblurb; } public Personname createPersonname() { Personname personname = new Personname(); initialize(personname); return personname; } public Phone createPhone() { Phone phone = new Phone(); initialize(phone); return phone; } public Phrase createPhrase() { Phrase phrase = new Phrase(); initialize(phrase); return phrase; } public Pob createPob() { Pob pob = new Pob(); initialize(pob); return pob; } public Postcode createPostcode() { Postcode postcode = new Postcode(); initialize(postcode); return postcode; } public Preface createPreface() { Preface preface = new Preface(); initialize(preface); return preface; } public Primary createPrimary() { Primary primary = new Primary(); initialize(primary); return primary; } public Primaryie createPrimaryie() { Primaryie primaryie = new Primaryie(); initialize(primaryie); return primaryie; } public Printhistory createPrinthistory() { Printhistory printhistory = new Printhistory(); initialize(printhistory); return printhistory; } public Procedure createProcedure() { Procedure procedure = new Procedure(); initialize(procedure); return procedure; } public Production createProduction() { Production production = new Production(); initialize(production); return production; } public Productionrecap createProductionrecap() { Productionrecap productionrecap = new Productionrecap(); initialize(productionrecap); return productionrecap; } public Productionset createProductionset() { Productionset productionset = new Productionset(); initialize(productionset); return productionset; } public Productname createProductname() { Productname productname = new Productname(); initialize(productname); return productname; } public Productnumber createProductnumber() { Productnumber productnumber = new Productnumber(); initialize(productnumber); return productnumber; } public Programlisting createProgramlisting() { Programlisting programlisting = new Programlisting(); initialize(programlisting); return programlisting; } public Programlistingco createProgramlistingco() { Programlistingco programlistingco = new Programlistingco(); initialize(programlistingco); return programlistingco; } public Prompt createPrompt() { Prompt prompt = new Prompt(); initialize(prompt); return prompt; } public Property createProperty() { Property property = new Property(); initialize(property); return property; } public Pubdate createPubdate() { Pubdate pubdate = new Pubdate(); initialize(pubdate); return pubdate; } public Publisher createPublisher() { Publisher publisher = new Publisher(); initialize(publisher); return publisher; } public Publishername createPublishername() { Publishername publishername = new Publishername(); initialize(publishername); return publishername; } public Qandadiv createQandadiv() { Qandadiv qandadiv = new Qandadiv(); initialize(qandadiv); return qandadiv; } public Qandaentry createQandaentry() { Qandaentry qandaentry = new Qandaentry(); initialize(qandaentry); return qandaentry; } public Qandaset createQandaset() { Qandaset qandaset = new Qandaset(); initialize(qandaset); return qandaset; } public Question createQuestion() { Question question = new Question(); initialize(question); return question; } public Quote createQuote() { Quote quote = new Quote(); initialize(quote); return quote; } public Refclass createRefclass() { Refclass refclass = new Refclass(); initialize(refclass); return refclass; } public Refdescriptor createRefdescriptor() { Refdescriptor refdescriptor = new Refdescriptor(); initialize(refdescriptor); return refdescriptor; } public Refentry createRefentry() { Refentry refentry = new Refentry(); initialize(refentry); return refentry; } public Refentryinfo createRefentryinfo() { Refentryinfo refEntryInfo = new Refentryinfo(); initialize(refEntryInfo); return refEntryInfo; } public Refentrytitle createRefentrytitle() { Refentrytitle refentrytitle = new Refentrytitle(); initialize(refentrytitle); return refentrytitle; } public Reference createReference() { Reference reference = new Reference(); initialize(reference); return reference; } public Refmeta createRefmeta() { Refmeta refmeta = new Refmeta(); initialize(refmeta); return refmeta; } public Refmiscinfo createRefmiscinfo() { Refmiscinfo refmiscinfo = new Refmiscinfo(); initialize(refmiscinfo); return refmiscinfo; } public Refname createRefname() { Refname refname = new Refname(); initialize(refname); return refname; } public Refnamediv createRefnamediv() { Refnamediv refnamediv = new Refnamediv(); initialize(refnamediv); return refnamediv; } public Refpurpose createRefpurpose() { Refpurpose refpurpose = new Refpurpose(); initialize(refpurpose); return refpurpose; } public Refsect1 createRefsect1() { Refsect1 refsect1 = new Refsect1(); initialize(refsect1); return refsect1; } public Refsect2 createRefsect2() { Refsect2 refsect2 = new Refsect2(); initialize(refsect2); return refsect2; } public Refsect3 createRefsect3() { Refsect3 refsect3 = new Refsect3(); initialize(refsect3); return refsect3; } public Refsect4 createRefsect4() { Refsect4 refSect4 = new Refsect4(); initialize(refSect4); return refSect4; } public Refsect5 createRefsect5() { Refsect5 refSect5 = new Refsect5(); initialize(refSect5); return refSect5; } public Refsection createRefsection() { Refsection refSection = new Refsection(); initialize(refSection); return refSection; } public Refsynopsisdiv createRefsynopsisdiv() { Refsynopsisdiv refsynopsisdiv = new Refsynopsisdiv(); initialize(refsynopsisdiv); return refsynopsisdiv; } public Releaseinfo createReleaseinfo() { Releaseinfo releaseinfo = new Releaseinfo(); initialize(releaseinfo); return releaseinfo; } public Remark createRemark() { Remark remark = new Remark(); initialize(remark); return remark; } public Replaceable createReplaceable() { Replaceable replaceable = new Replaceable(); initialize(replaceable); return replaceable; } public Returnvalue createReturnvalue() { Returnvalue returnvalue = new Returnvalue(); initialize(returnvalue); return returnvalue; } public Revdescription createRevdescription() { Revdescription revdescription = new Revdescription(); initialize(revdescription); return revdescription; } public Revhistory createRevhistory() { Revhistory revhistory = new Revhistory(); initialize(revhistory); return revhistory; } public Revision createRevision() { Revision revision = new Revision(); initialize(revision); return revision; } public Revnumber createRevnumber() { Revnumber revnumber = new Revnumber(); initialize(revnumber); return revnumber; } public Revremark createRevremark() { Revremark revremark = new Revremark(); initialize(revremark); return revremark; } public Rhs createRhs() { Rhs rhs = new Rhs(); initialize(rhs); return rhs; } public Row createRow() { Row row = new Row(); initialize(row); return row; } public Sbr createSbr() { Sbr sbr = new Sbr(); initialize(sbr); return sbr; } public Screen createScreen() { Screen screen = new Screen(); initialize(screen); return screen; } public Screenco createScreenco() { Screenco screenco = new Screenco(); initialize(screenco); return screenco; } public Screenshot createScreenshot() { Screenshot screenshot = new Screenshot(); initialize(screenshot); return screenshot; } public Secondary createSecondary() { Secondary secondary = new Secondary(); initialize(secondary); return secondary; } public Secondaryie createSecondaryie() { Secondaryie secondaryie = new Secondaryie(); initialize(secondaryie); return secondaryie; } public Sect1 createSect1() { Sect1 sect1 = new Sect1(); initialize(sect1); return sect1; } public Sect2 createSect2() { Sect2 sect2 = new Sect2(); initialize(sect2); return sect2; } public Sect3 createSect3() { Sect3 sect3 = new Sect3(); initialize(sect3); return sect3; } public Sect4 createSect4() { Sect4 sect4 = new Sect4(); initialize(sect4); return sect4; } public Sect5 createSect5() { Sect5 sect5 = new Sect5(); initialize(sect5); return sect5; } public Section createSection() { Section section = new Section(); initialize(section); return section; } public See createSee() { See see = new See(); initialize(see); return see; } public Seealso createSeealso() { Seealso seealso = new Seealso(); initialize(seealso); return seealso; } public Seealsoie createSeealsoie() { Seealsoie seealsoie = new Seealsoie(); initialize(seealsoie); return seealsoie; } public Seeie createSeeie() { Seeie seeie = new Seeie(); initialize(seeie); return seeie; } public Seg createSeg() { Seg seg = new Seg(); initialize(seg); return seg; } public Seglistitem createSeglistitem() { Seglistitem seglistitem = new Seglistitem(); initialize(seglistitem); return seglistitem; } public Segmentedlist createSegmentedlist() { Segmentedlist segmentedlist = new Segmentedlist(); initialize(segmentedlist); return segmentedlist; } public Segtitle createSegtitle() { Segtitle segtitle = new Segtitle(); initialize(segtitle); return segtitle; } public Seriesvolnums createSeriesvolnums() { Seriesvolnums seriesvolnums = new Seriesvolnums(); initialize(seriesvolnums); return seriesvolnums; } public Set createSet() { Set set = new Set(); initialize(set); return set; } public Setindex createSetindex() { Setindex setindex = new Setindex(); initialize(setindex); return setindex; } public Shortaffil createShortaffil() { Shortaffil shortaffil = new Shortaffil(); initialize(shortaffil); return shortaffil; } public Shortcut createShortcut() { Shortcut shortcut = new Shortcut(); initialize(shortcut); return shortcut; } public Sidebar createSidebar() { Sidebar sidebar = new Sidebar(); initialize(sidebar); return sidebar; } public Simpara createSimpara() { Simpara simpara = new Simpara(); initialize(simpara); return simpara; } public Simplelist createSimplelist() { Simplelist simplelist = new Simplelist(); initialize(simplelist); return simplelist; } public Simplemsgentry createSimplemsgentry() { Simplemsgentry simplemsgentry = new Simplemsgentry(); initialize(simplemsgentry); return simplemsgentry; } public Simplesect createSimplesect() { Simplesect simpleSect = new Simplesect(); initialize(simpleSect); return simpleSect; } public Spanspec createSpanspec() { Spanspec spanspec = new Spanspec(); initialize(spanspec); return spanspec; } public State createState() { State state = new State(); initialize(state); return state; } public Step createStep() { Step step = new Step(); initialize(step); return step; } public Stepalternatives createStepalternatives() { Stepalternatives stepalternatives = new Stepalternatives(); initialize(stepalternatives); return stepalternatives; } public Street createStreet() { Street street = new Street(); initialize(street); return street; } public Subject createSubject() { Subject subject = new Subject(); initialize(subject); return subject; } public Subjectset createSubjectset() { Subjectset subjectset = new Subjectset(); initialize(subjectset); return subjectset; } public Subjectterm createSubjectterm() { Subjectterm subjectterm = new Subjectterm(); initialize(subjectterm); return subjectterm; } public Subscript createSubscript() { Subscript subscript = new Subscript(); initialize(subscript); return subscript; } public Substeps createSubsteps() { Substeps substeps = new Substeps(); initialize(substeps); return substeps; } public Subtitle createSubtitle() { Subtitle subtitle = new Subtitle(); initialize(subtitle); return subtitle; } public Superscript createSuperscript() { Superscript superscript = new Superscript(); initialize(superscript); return superscript; } public Surname createSurname() { Surname surname = new Surname(); initialize(surname); return surname; } public Symbol createSymbol() { Symbol symbol = new Symbol(); initialize(symbol); return symbol; } public Synopfragment createSynopfragment() { Synopfragment synopfragment = new Synopfragment(); initialize(synopfragment); return synopfragment; } public Synopfragmentref createSynopfragmentref() { Synopfragmentref synopfragmentref = new Synopfragmentref(); initialize(synopfragmentref); return synopfragmentref; } public Synopsis createSynopsis() { Synopsis synopsis = new Synopsis(); initialize(synopsis); return synopsis; } public Systemitem createSystemitem() { Systemitem systemitem = new Systemitem(); initialize(systemitem); return systemitem; } public Table createTable() { Table table = new Table(); initialize(table); return table; } public Tag createTag() { Tag tag = new Tag(); initialize(tag); return tag; } public Task createTask() { Task task = new Task(); initialize(task); return task; } public Taskprerequisites createTaskprerequisites() { Taskprerequisites taskprerequisites = new Taskprerequisites(); initialize(taskprerequisites); return taskprerequisites; } public Taskrelated createTaskrelated() { Taskrelated taskrelated = new Taskrelated(); initialize(taskrelated); return taskrelated; } public Tasksummary createTasksummary() { Tasksummary tasksummary = new Tasksummary(); initialize(tasksummary); return tasksummary; } public Tbody createTbody() { Tbody tbody = new Tbody(); initialize(tbody); return tbody; } public Td createTd() { Td td = new Td(); initialize(td); return td; } public Term createTerm() { Term term = new Term(); initialize(term); return term; } public Termdef createTermdef() { Termdef termdef = new Termdef(); initialize(termdef); return termdef; } public Tertiary createTertiary() { Tertiary tertiary = new Tertiary(); initialize(tertiary); return tertiary; } public Tertiaryie createTertiaryie() { Tertiaryie tertiaryie = new Tertiaryie(); initialize(tertiaryie); return tertiaryie; } public Textdata createTextdata() { Textdata textdata = new Textdata(); initialize(textdata); return textdata; } public Textobject createTextobject() { Textobject textobject = new Textobject(); initialize(textobject); return textobject; } public Tfoot createTfoot() { Tfoot tfoot = new Tfoot(); initialize(tfoot); return tfoot; } public Tgroup createTgroup() { Tgroup tgroup = new Tgroup(); initialize(tgroup); return tgroup; } public Th createTh() { Th th = new Th(); initialize(th); return th; } public Thead createThead() { Thead thead = new Thead(); initialize(thead); return thead; } public Tip createTip() { Tip tip = new Tip(); initialize(tip); return tip; } public Title createTitle() { Title title = new Title(); initialize(title); return title; } public Titleabbrev createTitleabbrev() { Titleabbrev titleabbrev = new Titleabbrev(); initialize(titleabbrev); return titleabbrev; } public Toc createToc() { Toc toc = new Toc(); initialize(toc); return toc; } public Tocdiv createTocdiv() { Tocdiv tocdiv = new Tocdiv(); initialize(tocdiv); return tocdiv; } public Tocentry createTocentry() { Tocentry tocentry = new Tocentry(); initialize(tocentry); return tocentry; } public Token createToken() { Token token = new Token(); initialize(token); return token; } public Tr createTr() { Tr tr = new Tr(); initialize(tr); return tr; } public Trademark createTrademark() { Trademark trademark = new Trademark(); initialize(trademark); return trademark; } public Type createType() { Type type = new Type(); initialize(type); return type; } public ULink createULink() { ULink uLink = new ULink(); initialize(uLink); return uLink; } public Uri createUri() { Uri uri = new Uri(); initialize(uri); return uri; } public Userinput createUserinput() { Userinput userinput = new Userinput(); initialize(userinput); return userinput; } public Varargs createVarargs() { Varargs varargs = new Varargs(); initialize(varargs); return varargs; } public Variablelist createVariablelist() { Variablelist variablelist = new Variablelist(); initialize(variablelist); return variablelist; } public Varlistentry createVarlistentry() { Varlistentry varlistentry = new Varlistentry(); initialize(varlistentry); return varlistentry; } public Varname createVarname() { Varname varname = new Varname(); initialize(varname); return varname; } public Videodata createVideodata() { Videodata videodata = new Videodata(); initialize(videodata); return videodata; } public Videoobject createVideoobject() { Videoobject videoobject = new Videoobject(); initialize(videoobject); return videoobject; } public Void createVoid() { Void _void = new Void(); initialize(_void); return _void; } public Volumenum createVolumenum() { Volumenum volumenum = new Volumenum(); initialize(volumenum); return volumenum; } public Warning createWarning() { Warning warning = new Warning(); initialize(warning); return warning; } public Wordasword createWordasword() { Wordasword wordasword = new Wordasword(); initialize(wordasword); return wordasword; } public Xref createXref() { Xref xref = new Xref(); initialize(xref); return xref; } public Year createYear() { Year year = new Year(); initialize(year); return year; } } src/java/org/dbdoclet/tag/docbook/Citetitle.java0000644000175000017500000000170612644165236022010 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Citetitle extends DocBookElement { private static String tag = "citetitle"; public static String getTag() { return tag; } Citetitle() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Quote.java0000644000175000017500000000176012644165236021157 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Quote extends DocBookElement { Quote() { super("quote"); setFormatType(FORMAT_INLINE); } Quote(String text) { super("quote"); appendChild(text); setFormatType(FORMAT_INLINE); } } src/java/org/dbdoclet/tag/docbook/Secondary.java0000644000175000017500000000160312644165236022005 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Secondary extends DocBookElement { Secondary() { super("secondary"); setFormatType(FORMAT_INLINE); } } src/java/org/dbdoclet/tag/docbook/Variablelist.java0000644000175000017500000000256112644165236022503 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; import java.util.HashMap; public class Variablelist extends DocBookElement { private static String tag = "variablelist"; Variablelist() { super(tag); setFormatType(FORMAT_BLOCK); } public static String getTag() { return tag; } public static HashMap getAttributeMap() { return new HashMap(); } @Override public void closed() { if (hasChildNodes() == false) { appendChild(new Varlistentry().appendChild(new Term()).appendChild( new Listitem().appendChild(new Simpara()))); } } } src/java/org/dbdoclet/tag/docbook/Optional.java0000644000175000017500000000170312644165236021644 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Optional extends DocBookElement { private static String tag = "optional"; public static String getTag() { return tag; } Optional() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Refentryinfo.java0000644000175000017500000000161212644165236022530 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Refentryinfo extends DocBookElement { Refentryinfo() { super("refentryinfo"); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Guibutton.java0000644000175000017500000000170612644165236022042 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Guibutton extends DocBookElement { private static String tag = "guibutton"; public static String getTag() { return tag; } Guibutton() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Computeroutput.java0000644000175000017500000000177112644165236023143 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Computeroutput extends DocBookElement { Computeroutput() { super("computeroutput"); setFormatType(FORMAT_INLINE); isLiteral(true); } Computeroutput(String text) { this(); appendChild(text); } } src/java/org/dbdoclet/tag/docbook/Orgname.java0000644000175000017500000000170012644165236021444 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Orgname extends DocBookElement { private static String tag = "orgname"; public static String getTag() { return tag; } Orgname() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Initializer.java0000644000175000017500000000203712644165236022343 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Initializer extends DocBookElement { private static final String tag = "initializer"; Initializer() { super(tag); setFormatType(FORMAT_CONTENT); } Initializer(String text) { this(); appendChild(hardenText(text)); } public static String getTag() { return tag; } } src/java/org/dbdoclet/tag/docbook/Hardware.java0000644000175000017500000000170312644165236021614 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Hardware extends DocBookElement { private static String tag = "hardware"; public static String getTag() { return tag; } Hardware() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Database.java0000644000175000017500000000170312644165236021563 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Database extends DocBookElement { private static String tag = "database"; public static String getTag() { return tag; } Database() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Glossseealso.java0000644000175000017500000000171712644165236022527 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Glossseealso extends DocBookElement { private static String tag = "glossseealso"; public static String getTag() { return tag; } Glossseealso() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Revision.java0000644000175000017500000000170312644165236021655 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Revision extends DocBookElement { private static String tag = "revision"; public static String getTag() { return tag; } Revision() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Caution.java0000644000175000017500000000245512644165236021466 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; import java.util.HashMap; public class Caution extends DocBookElement { private static String tag = "caution"; Caution() { super("caution"); setFormatType(FORMAT_BLOCK); } Caution(String strTitle) { this(); Title title = new Title(strTitle); title.setParentNode(this); appendChild(title); } public static String getTag() { return tag; } public static HashMap getAttributeMap() { return new HashMap(); } } src/java/org/dbdoclet/tag/docbook/Collab.java0000644000175000017500000000167512644165236021263 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Collab extends DocBookElement { private static String tag = "collab"; public static String getTag() { return tag; } Collab() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Tip.java0000644000175000017500000000245312644165236020616 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; import java.util.HashMap; public class Tip extends DocBookElement { private static String tag = "tip"; Tip() { super(tag); setFormatType(FORMAT_BLOCK); } Tip(String strTitle) { super(tag); Title title = new Title(strTitle); title.setParentNode(this); appendChild(title); setFormatType(FORMAT_BLOCK); } public static String getTag() { return tag; } public static HashMap getAttributeMap() { return new HashMap(); } } src/java/org/dbdoclet/tag/docbook/Revdescription.java0000644000175000017500000000172512644165236023063 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Revdescription extends DocBookElement { private static String tag = "revdescription"; public static String getTag() { return tag; } Revdescription() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Productnumber.java0000644000175000017500000000172212644165236022711 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Productnumber extends DocBookElement { private static String tag = "productnumber"; public static String getTag() { return tag; } Productnumber() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Person.java0000644000175000017500000000167512644165236021335 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Person extends DocBookElement { private static String tag = "person"; public static String getTag() { return tag; } Person() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/City.java0000644000175000017500000000166712644165236021000 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class City extends DocBookElement { private static String tag = "city"; public static String getTag() { return tag; } City() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Firstname.java0000644000175000017500000000207712644165236022014 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; import org.dbdoclet.xiphias.XmlServices; public class Firstname extends DocBookElement { private static String tagName = "firstname"; Firstname() { super(tagName); setFormatType(FORMAT_INLINE); } Firstname(String text) { this(); appendChild(XmlServices.textToXml(text)); } } src/java/org/dbdoclet/tag/docbook/Constraintdef.java0000644000175000017500000000172212644165236022663 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Constraintdef extends DocBookElement { private static String tag = "constraintdef"; public static String getTag() { return tag; } Constraintdef() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Accel.java0000644000175000017500000000167212644165236021073 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Accel extends DocBookElement { private static String tag = "accel"; public static String getTag() { return tag; } Accel() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Dedication.java0000644000175000017500000000171112644165236022121 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Dedication extends DocBookElement { private static String tag = "dedication"; public static String getTag() { return tag; } Dedication() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Biblioid.java0000644000175000017500000000170312644165236021574 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Biblioid extends DocBookElement { private static String tag = "biblioid"; public static String getTag() { return tag; } Biblioid() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Contractnum.java0000644000175000017500000000171412644165236022356 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Contractnum extends DocBookElement { private static String tag = "contractnum"; public static String getTag() { return tag; } Contractnum() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/XMLDocument.java0000644000175000017500000000142312644165236022215 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class XMLDocument { } src/java/org/dbdoclet/tag/docbook/Orderedlist.java0000644000175000017500000000175412644165236022345 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Orderedlist extends DocBookElement { private static String tag = "orderedlist"; Orderedlist() { super(tag); setFormatType(FORMAT_BLOCK); } public static String getTag() { return tag; } } src/java/org/dbdoclet/tag/docbook/Partintro.java0000644000175000017500000000212612644165236022041 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Partintro extends SectionElement { private static final String tagName = "partintro"; Partintro() { super(tagName); setFormatType(FORMAT_BLOCK); } Partintro(String title) { this(); appendChild(new Title(title)); } public static String getTag() { return tagName; } } src/java/org/dbdoclet/tag/docbook/Annotation.java0000644000175000017500000000171112644165236022170 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Annotation extends DocBookElement { private static String tag = "annotation"; public static String getTag() { return tag; } Annotation() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Seealsoie.java0000644000175000017500000000170612644165236021773 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Seealsoie extends DocBookElement { private static String tag = "seealsoie"; public static String getTag() { return tag; } Seealsoie() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/SectionElement.java0000644000175000017500000000636512644165236023006 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; import org.dbdoclet.xiphias.dom.CommentImpl; import org.dbdoclet.xiphias.dom.ElementImpl; import org.dbdoclet.xiphias.dom.NodeImpl; import org.dbdoclet.xiphias.dom.TextImpl; import org.w3c.dom.Node; import org.w3c.dom.NodeList; public class SectionElement extends DocBookElement { SectionElement(String name) { super(name); } public SectionElement getFirstSectionChild() { NodeList children = getChildNodes(); int length = children.getLength(); for (int i = 0; i < length; i++) { Node node = children.item(i); if (node != null && node instanceof SectionElement) { return (SectionElement) node; } } return null; } SectionElement getLastSectionChild() { NodeList children = getChildNodes(); int length = children.getLength(); SectionElement sectionChild = null; for (int i = 0; i < length; i++) { Node node = children.item(i); if (node != null && node instanceof SectionElement) { sectionChild = (SectionElement) node; } } return sectionChild; } public String getTitle() { NodeImpl titleElement = (NodeImpl) findChildElement("title"); if (titleElement != null) { return titleElement.getTextContent(); } return ""; } public void setTitle(String title) { NodeImpl titleElement = (NodeImpl) findChildElement("title"); if (titleElement != null) { titleElement.setTextContent(title); } } public boolean hasContentChildren() { NodeList children = getChildNodes(); int counter = 0; int length = children.getLength(); for (int i = 0; i < length; i++) { Node node = children.item(i); if (node != null && node instanceof ElementImpl) { if (node instanceof Title || node instanceof Indexterm || node instanceof CommentImpl) { continue; } if (node instanceof TextImpl) { TextImpl text = (TextImpl) node; String buffer = text.getData(); if ((buffer == null) || (buffer.trim().length() == 0)) { continue; } } if (node instanceof Para) { if (node.hasChildNodes() == false) { continue; } } counter++; } } if (counter > 0) { return true; } else { return false; } } public boolean hasSectionChildren() { NodeList children = getChildNodes(); int length = children.getLength(); for (int i = 0; i < length; i++) { Node node = children.item(i); if (node != null && node instanceof DocBookElement) { DocBookElement elem = (DocBookElement) node; if (elem.isSection()) { return true; } } } return false; } } src/java/org/dbdoclet/tag/docbook/Package.java0000644000175000017500000000170012644165236021407 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Package extends DocBookElement { private static String tag = "package"; public static String getTag() { return tag; } Package() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Arg.java0000644000175000017500000000166412644165236020576 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Arg extends DocBookElement { private static String tag = "arg"; public static String getTag() { return tag; } Arg() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Property.java0000644000175000017500000000170312644165236021703 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Property extends DocBookElement { private static String tag = "property"; public static String getTag() { return tag; } Property() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Citerefentry.java0000644000175000017500000000171712644165236022527 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Citerefentry extends DocBookElement { private static String tag = "citerefentry"; public static String getTag() { return tag; } Citerefentry() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Substeps.java0000644000175000017500000000170312644165236021667 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Substeps extends DocBookElement { private static String tag = "substeps"; public static String getTag() { return tag; } Substeps() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Setindex.java0000644000175000017500000000170312644165236021642 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Setindex extends DocBookElement { private static String tag = "setindex"; public static String getTag() { return tag; } Setindex() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Question.java0000644000175000017500000000170312644165236021666 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Question extends DocBookElement { private static String tag = "question"; public static String getTag() { return tag; } Question() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Indexentry.java0000644000175000017500000000171112644165236022207 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Indexentry extends DocBookElement { private static String tag = "indexentry"; public static String getTag() { return tag; } Indexentry() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Orgdiv.java0000644000175000017500000000167512644165236021321 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Orgdiv extends DocBookElement { private static String tag = "orgdiv"; public static String getTag() { return tag; } Orgdiv() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Methodparam.java0000644000175000017500000000174412644165236022325 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Methodparam extends DocBookElement { private static String tagName = "methodparam"; public static String getTag() { return tagName; } Methodparam() { super(tagName); setFormatType(FORMAT_INLINE); } } src/java/org/dbdoclet/tag/docbook/Epigraph.java0000644000175000017500000000170312644165236021616 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Epigraph extends DocBookElement { private static String tag = "epigraph"; public static String getTag() { return tag; } Epigraph() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Editor.java0000644000175000017500000000167512644165236021315 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Editor extends DocBookElement { private static String tag = "editor"; public static String getTag() { return tag; } Editor() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Tfoot.java0000644000175000017500000000155512644165236021157 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Tfoot extends Telem { Tfoot() { super("tfoot"); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Menuchoice.java0000644000175000017500000000171112644165236022135 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Menuchoice extends DocBookElement { private static String tag = "menuchoice"; public static String getTag() { return tag; } Menuchoice() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Imagedata.java0000644000175000017500000000523312644165236021735 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; import org.dbdoclet.service.StringServices; public class Imagedata extends DocBookElement { Imagedata() { super("imagedata"); isEmpty(true); setFormatType(FORMAT_BLOCK); } public DocBookElement setAlign(String align) { if (align == null) { throw new IllegalArgumentException("Parameter align is null!"); } setAttribute("align", align); return this; } public DocBookElement setContentDepth(String depth) { if (depth == null || depth.trim().length() == 0) { removeAttribute("contentdepth"); } setAttribute("contentdepth", depth); return this; } public DocBookElement setContentWidth(String width) { if (width == null || width.trim().length() == 0) { removeAttribute("contentwidth"); } setAttribute("contentwidth", width); return this; } public DocBookElement setDepth(String depth) { if (depth == null || depth.trim().length() == 0) { removeAttribute("depth"); } setAttribute("depth", depth); return this; } public DocBookElement setFileRef(String fileref) { if (fileref == null) { throw new IllegalArgumentException("Parameter fileref is null!"); } fileref = StringServices.replace(fileref, "\\", "/"); setAttribute("fileref", fileref); return this; } public DocBookElement setFormat(String format) { if (format == null) { throw new IllegalArgumentException("Parameter format is null!"); } setAttribute("format", format.toUpperCase()); return this; } public DocBookElement setScale(int scale) { setAttribute("scale", String.valueOf(scale)); return this; } public DocBookElement setScaleFit(boolean scalefit) { if (scalefit == true) { setAttribute("scalefit", "1"); } else { setAttribute("scalefit", "0"); } return this; } public DocBookElement setWidth(String width) { if (width == null) { throw new IllegalArgumentException("Parameter width is null!"); } setAttribute("width", width); return this; } } src/java/org/dbdoclet/tag/docbook/Keycombo.java0000644000175000017500000000170312644165236021627 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Keycombo extends DocBookElement { private static String tag = "keycombo"; public static String getTag() { return tag; } Keycombo() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Guisubmenu.java0000644000175000017500000000171112644165236022201 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Guisubmenu extends DocBookElement { private static String tag = "guisubmenu"; public static String getTag() { return tag; } Guisubmenu() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Taskprerequisites.java0000644000175000017500000000173612644165236023614 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Taskprerequisites extends DocBookElement { private static String tag = "taskprerequisites"; public static String getTag() { return tag; } Taskprerequisites() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Errorname.java0000644000175000017500000000170612644165236022014 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Errorname extends DocBookElement { private static String tag = "errorname"; public static String getTag() { return tag; } Errorname() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Link.java0000644000175000017500000000265712644165236020765 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; import org.dbdoclet.xiphias.XmlConstants; import org.dbdoclet.xiphias.XmlServices; public class Link extends DocBookElement { private static final String tag = "link"; Link() { super(tag); } Link(DocBookElement label, String linkend) { this(linkend); appendChild(label); } Link(String linkend) { this(); setAttribute("linkend", hardenId(linkend)); setFormatType(FORMAT_INLINE); } Link(String label, String linkend) { this(linkend); appendChild(XmlServices.textToXml(label)); } public void setHref(String href) { if (isDocBook5() == true) { setAttributeNS(XmlConstants.NAMESPACE_XLINK, "xl:href", href); } else { setAttribute("linkend", href); } } } src/java/org/dbdoclet/tag/docbook/Toc.java0000644000175000017500000000166412644165236020612 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Toc extends DocBookElement { private static String tag = "toc"; public static String getTag() { return tag; } Toc() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Pubdate.java0000644000175000017500000000170012644165236021440 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Pubdate extends DocBookElement { private static String tag = "pubdate"; public static String getTag() { return tag; } Pubdate() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Address.java0000644000175000017500000000210112644165236021435 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; import org.dbdoclet.xiphias.XmlServices; public class Address extends DocBookElement { private static final String tag = "address"; Address() { super(tag); setFormatType(FORMAT_BLOCK); } Address(String text) { this(); appendChild(XmlServices.textToXml(text)); } public static String getTag() { return tag; } } src/java/org/dbdoclet/tag/docbook/Superscript.java0000644000175000017500000000205712644165236022405 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Superscript extends DocBookElement { private static String tag = "superscript"; Superscript() { super(tag); setFormatType(FORMAT_INLINE); } Superscript(String text) { super(tag); appendChild(text); setFormatType(FORMAT_INLINE); } public static String getTag() { return tag; } } src/java/org/dbdoclet/tag/docbook/Colophon.java0000644000175000017500000000170312644165236021640 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Colophon extends DocBookElement { private static String tag = "colophon"; public static String getTag() { return tag; } Colophon() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Msglevel.java0000644000175000017500000000170312644165236021635 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Msglevel extends DocBookElement { private static String tag = "msglevel"; public static String getTag() { return tag; } Msglevel() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Screen.java0000644000175000017500000000166412644165236021304 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Screen extends DocBookElement { Screen() { super("screen"); setFormatType(FORMAT_CONTENT); isLiteral(true); } Screen(String text) { this(); appendChild(text); } } src/java/org/dbdoclet/tag/docbook/Refsynopsisdiv.java0000644000175000017500000000213712644165236023110 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; import java.util.HashMap; public class Refsynopsisdiv extends DocBookElement { private static String tag = "refsynopsisdiv"; Refsynopsisdiv() { super(tag); } public static String getTag() { return tag; } public static HashMap getAttributeMap() { return new HashMap(); } } src/java/org/dbdoclet/tag/docbook/Lineage.java0000644000175000017500000000170012644165236021420 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Lineage extends DocBookElement { private static String tag = "lineage"; public static String getTag() { return tag; } Lineage() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Affiliation.java0000644000175000017500000000166512644165236022313 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Affiliation extends DocBookElement { private static String tagName = "affiliation"; Affiliation() { super(tagName); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Otheraddr.java0000644000175000017500000000170612644165236021776 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Otheraddr extends DocBookElement { private static String tag = "otheraddr"; public static String getTag() { return tag; } Otheraddr() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Errortype.java0000644000175000017500000000170612644165236022055 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Errortype extends DocBookElement { private static String tag = "errortype"; public static String getTag() { return tag; } Errortype() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Subtitle.java0000644000175000017500000000170312644165236021652 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Subtitle extends DocBookElement { private static String tag = "subtitle"; public static String getTag() { return tag; } Subtitle() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Row.java0000644000175000017500000000156012644165236020627 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Row extends DocBookElement { Row() { super("row"); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Secondaryie.java0000644000175000017500000000171412644165236022326 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Secondaryie extends DocBookElement { private static String tag = "secondaryie"; public static String getTag() { return tag; } Secondaryie() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Footnote.java0000644000175000017500000000170312644165236021654 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Footnote extends DocBookElement { private static String tag = "footnote"; public static String getTag() { return tag; } Footnote() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Author.java0000644000175000017500000000174312644165236021325 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Author extends DocBookElement { private static final String tag = "author"; Author() { super(tag); setFormatType(FORMAT_BLOCK); } public static String getTag() { return tag; } } src/java/org/dbdoclet/tag/docbook/Constructorsynopsis.java0000644000175000017500000000206712644165236024220 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Constructorsynopsis extends DocBookElement { private static final String tagName = "constructorsynopsis"; Constructorsynopsis() { super(tagName); setFormatType(FORMAT_BLOCK); setAttribute("language", "java"); } public void setLanguage(String language) { setAttribute("language", language); } } src/java/org/dbdoclet/tag/docbook/Contractsponsor.java0000644000175000017500000000173012644165236023260 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Contractsponsor extends DocBookElement { private static String tag = "contractsponsor"; public static String getTag() { return tag; } Contractsponsor() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Varname.java0000644000175000017500000000166112644165236021453 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Varname extends DocBookElement { Varname() { super("varname"); } Varname(String varname) { super("varname"); appendChild(varname); } } src/java/org/dbdoclet/tag/docbook/Classsynopsis.java0000644000175000017500000000247512644165236022743 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Classsynopsis extends DocBookElement { private static final String tag = "classsynopsis"; Classsynopsis() { super(tag); setFormatType(FORMAT_BLOCK); setAttribute("class", "class"); setAttribute("language", "java"); } public void setLanguage(String language) { setAttribute("language", language); } public void setInterface(boolean value) { if (value == true) { setAttribute("class", "interface"); } else { setAttribute("class", "class"); } } } src/java/org/dbdoclet/tag/docbook/Bibliosource.java0000644000175000017500000000171712644165236022505 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Bibliosource extends DocBookElement { private static String tag = "bibliosource"; public static String getTag() { return tag; } Bibliosource() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Imageobject.java0000644000175000017500000000156312644165236022274 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Imageobject extends DocBookElement { Imageobject() { super("imageobject"); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Msgmain.java0000644000175000017500000000170012644165236021447 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Msgmain extends DocBookElement { private static String tag = "msgmain"; public static String getTag() { return tag; } Msgmain() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Sect4.java0000644000175000017500000000167212644165236021046 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Sect4 extends SectionElement { private final static String tag = "sect4"; Sect4() { super(tag); } public static String getTag() { return tag; } } src/java/org/dbdoclet/tag/docbook/Confsponsor.java0000644000175000017500000000171412644165236022372 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Confsponsor extends DocBookElement { private static String tag = "confsponsor"; public static String getTag() { return tag; } Confsponsor() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Bibliocoverage.java0000644000175000017500000000172512644165236022777 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Bibliocoverage extends DocBookElement { private static String tag = "bibliocoverage"; public static String getTag() { return tag; } Bibliocoverage() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Qandadiv.java0000644000175000017500000000170312644165236021606 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Qandadiv extends DocBookElement { private static String tag = "qandadiv"; public static String getTag() { return tag; } Qandadiv() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Warning.java0000644000175000017500000000307112644165236021464 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; import java.util.HashMap; public class Warning extends DocBookElement { private static String tag = "warning"; Warning() { super(tag); setFormatType(FORMAT_BLOCK); } Warning(String strTitle) { super(tag); Title title = new Title(strTitle); title.setParentNode(this); appendChild(title); setFormatType(FORMAT_BLOCK); } Warning(String strTitle, String text) { super(tag); Title title = new Title(strTitle); title.setParentNode(this); appendChild(title); appendChild(new Para(text)); setFormatType(FORMAT_BLOCK); } public static String getTag() { return tag; } public static HashMap getAttributeMap() { return new HashMap(); } } src/java/org/dbdoclet/tag/docbook/Glossterm.java0000644000175000017500000000170612644165236022041 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Glossterm extends DocBookElement { private static String tag = "glossterm"; public static String getTag() { return tag; } Glossterm() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Table.java0000644000175000017500000000220212644165236021101 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Table extends DocBookElement { Table() { super("table"); setFormatType(FORMAT_BLOCK); setFrame("none"); } Table(String tagname) { super(tagname); setFormatType(FORMAT_BLOCK); setFrame("none"); } public DocBookElement setFrame(String frame) { setAttribute("frame", frame); return this; } } src/java/org/dbdoclet/tag/docbook/Textdata.java0000644000175000017500000000170312644165236021635 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Textdata extends DocBookElement { private static String tag = "textdata"; public static String getTag() { return tag; } Textdata() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Programlistingco.java0000644000175000017500000000173312644165236023405 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Programlistingco extends DocBookElement { private static String tag = "programlistingco"; public static String getTag() { return tag; } Programlistingco() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Spanspec.java0000644000175000017500000000221112644165236021626 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Spanspec extends DocBookElement { Spanspec() { super("spanspec"); isEmpty(true); } Spanspec(String name, String start, String end, String align) { super("spanspec"); setAttribute("spanname", name); setAttribute("namest", start); setAttribute("nameend", end); setAttribute("align", align); isEmpty(true); } } src/java/org/dbdoclet/tag/docbook/Alt.java0000644000175000017500000000166412644165236020605 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Alt extends DocBookElement { private static String tag = "alt"; public static String getTag() { return tag; } Alt() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Tgroup.java0000644000175000017500000000205312644165236021336 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Tgroup extends DocBookElement { Tgroup() { super("tgroup"); setFormatType(FORMAT_BLOCK); } Tgroup setAlign(String align) { setAttribute("align", align); return this; } public Tgroup setCols(int cols) { setAttribute("cols", new Integer(cols)); return this; } } src/java/org/dbdoclet/tag/docbook/Paramdef.java0000644000175000017500000000172212644165236021577 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Paramdef extends DocBookElement { private static final String tagName = "paramdef"; Paramdef() { super(tagName); } public static String getTag() { return tagName; } } src/java/org/dbdoclet/tag/docbook/Prompt.java0000644000175000017500000000167512644165236021350 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Prompt extends DocBookElement { private static String tag = "prompt"; public static String getTag() { return tag; } Prompt() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Org.java0000644000175000017500000000166412644165236020614 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Org extends DocBookElement { private static String tag = "org"; public static String getTag() { return tag; } Org() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Keyword.java0000644000175000017500000000167712644165236021515 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Keyword extends DocBookElement { private static String tag = "keyword"; Keyword() { super(tag); setFormatType(FORMAT_BLOCK); } public static String getTag() { return tag; } } src/java/org/dbdoclet/tag/docbook/Citebiblioid.java0000644000175000017500000000171712644165236022446 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Citebiblioid extends DocBookElement { private static String tag = "citebiblioid"; public static String getTag() { return tag; } Citebiblioid() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Part.java0000644000175000017500000000174312644165236020771 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Part extends DocBookElement { private static String tagName = "part"; Part() { super(tagName); setFormatType(FORMAT_BLOCK); } public static String getTag() { return tagName; } } src/java/org/dbdoclet/tag/docbook/Methodname.java0000644000175000017500000000203012644165236022132 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Methodname extends DocBookElement { private static final String tagName = "methodname"; public static String getTag() { return tagName; } Methodname() { super(tagName); } Methodname(String methodname) { this(); appendChild(methodname); } } src/java/org/dbdoclet/tag/docbook/Command.java0000644000175000017500000000170012644165236021432 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Command extends DocBookElement { private static String tag = "command"; public static String getTag() { return tag; } Command() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Info.java0000644000175000017500000000172712644165236020760 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Info extends DocBookElement { private static String tag = "info"; Info() { super(tag); setFormatType(FORMAT_BLOCK); } public static String getTag() { return tag; } } src/java/org/dbdoclet/tag/docbook/Term.java0000644000175000017500000000163712644165236020774 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Term extends DocBookElement { Term() { super("term"); } Term(String text) { super("term"); appendChild(text); } } src/java/org/dbdoclet/tag/docbook/Refmeta.java0000644000175000017500000000157312644165236021447 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Refmeta extends DocBookElement { Refmeta() { super("refmeta"); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Classsynopsisinfo.java0000644000175000017500000000207212644165236023610 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Classsynopsisinfo extends DocBookElement { private static final String tag = "classsynopsisinfo"; Classsynopsisinfo() { super(tag); setFormatType(FORMAT_CONTENT); isLiteral(true); } Classsynopsisinfo(String text) { this(); appendChild(text); } } src/java/org/dbdoclet/tag/docbook/Coref.java0000644000175000017500000000167212644165236021122 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Coref extends DocBookElement { private static String tag = "coref"; public static String getTag() { return tag; } Coref() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Seriesvolnums.java0000644000175000017500000000172212644165236022736 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Seriesvolnums extends DocBookElement { private static String tag = "seriesvolnums"; public static String getTag() { return tag; } Seriesvolnums() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Abbrev.java0000644000175000017500000000204012644165236021253 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Abbrev extends DocBookElement { private static final String tag = "abbrev"; Abbrev() { super(tag); setFormatType(FORMAT_INLINE); } Abbrev(String text) { super(tag); appendChild(text); setFormatType(FORMAT_INLINE); } public static String getTag() { return tag; } } src/java/org/dbdoclet/tag/docbook/Qandaset.java0000644000175000017500000000170312644165236021617 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Qandaset extends DocBookElement { private static String tag = "qandaset"; public static String getTag() { return tag; } Qandaset() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Printhistory.java0000644000175000017500000000171712644165236022602 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Printhistory extends DocBookElement { private static String tag = "printhistory"; public static String getTag() { return tag; } Printhistory() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Revremark.java0000644000175000017500000000170612644165236022020 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Revremark extends DocBookElement { private static String tag = "revremark"; public static String getTag() { return tag; } Revremark() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/DocBookFragment.java0000644000175000017500000000257212644165236023070 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; import org.dbdoclet.xiphias.XmlConstants; import org.dbdoclet.xiphias.dom.DocumentFragmentImpl; public class DocBookFragment extends DocumentFragmentImpl { public DocBookFragment() { super(); setNodeType(DOCUMENT_FRAGMENT_NODE); setParentNode(null); } public Section addSection() { Section section = new Section(); section.setAttribute("xmlns", XmlConstants.NAMESPACE_DOCBOOK); section.setAttribute("xmlns:xl", XmlConstants.NAMESPACE_XLINK); section.setAttribute("xmlns:xi", XmlConstants.NAMESPACE_XINCLUDE); section.setAttribute("version", "5.0"); appendChild(section); return section; } } src/java/org/dbdoclet/tag/docbook/Bibliorelation.java0000644000175000017500000000172512644165236023021 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Bibliorelation extends DocBookElement { private static String tag = "bibliorelation"; public static String getTag() { return tag; } Bibliorelation() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Production.java0000644000175000017500000000171112644165236022204 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Production extends DocBookElement { private static String tag = "production"; public static String getTag() { return tag; } Production() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Funcsynopsisinfo.java0000644000175000017500000000173312644165236023441 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Funcsynopsisinfo extends DocBookElement { private static String tag = "funcsynopsisinfo"; public static String getTag() { return tag; } Funcsynopsisinfo() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Colgroup.java0000644000175000017500000000170312644165236021651 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Colgroup extends DocBookElement { private static String tag = "colgroup"; public static String getTag() { return tag; } Colgroup() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Screenco.java0000644000175000017500000000170312644165236021620 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Screenco extends DocBookElement { private static String tag = "screenco"; public static String getTag() { return tag; } Screenco() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Token.java0000644000175000017500000000167212644165236021144 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Token extends DocBookElement { private static String tag = "token"; public static String getTag() { return tag; } Token() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Informaltable.java0000644000175000017500000000201512644165236022633 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Informaltable extends Table { private static final String tag = "informaltable"; Informaltable() { super(tag); setFormatType(FORMAT_BLOCK); setFrame("none"); } public static String getTag() { return tag; } } src/java/org/dbdoclet/tag/docbook/Glosslist.java0000644000175000017500000000170612644165236022045 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Glosslist extends DocBookElement { private static String tag = "glosslist"; public static String getTag() { return tag; } Glosslist() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Lhs.java0000644000175000017500000000166412644165236020613 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Lhs extends DocBookElement { private static String tag = "lhs"; public static String getTag() { return tag; } Lhs() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Funcprototype.java0000644000175000017500000000154712644165236022746 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Funcprototype extends DocBookElement { Funcprototype() { super("funcprototype"); } } src/java/org/dbdoclet/tag/docbook/Sect1.java0000644000175000017500000000165012644165236021037 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Sect1 extends SectionElement { public final static String tagName = "sect1"; Sect1() { super(tagName); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Imageobjectco.java0000644000175000017500000000172212644165236022613 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Imageobjectco extends DocBookElement { private static String tag = "imageobjectco"; public static String getTag() { return tag; } Imageobjectco() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Refsect1.java0000644000175000017500000000163312644165236021535 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Refsect1 extends DocBookElement { public static final String tagName = "refsect1"; Refsect1() { super(tagName); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Releaseinfo.java0000644000175000017500000000211012644165236022304 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; import org.dbdoclet.xiphias.XmlServices; public class Releaseinfo extends DocBookElement { private static String tagName = "releaseinfo"; Releaseinfo() { super(tagName); setFormatType(FORMAT_INLINE); } Releaseinfo(String text) { this(); appendChild(XmlServices.textToXml(text)); } } src/java/org/dbdoclet/tag/docbook/Subjectset.java0000644000175000017500000000170712644165236022176 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Subjectset extends DocBookElement { private static String tag = "subjectset"; Subjectset() { super(tag); setFormatType(FORMAT_BLOCK); } public static String getTag() { return tag; } } src/java/org/dbdoclet/tag/docbook/DocBookVersion.java0000644000175000017500000000144212644165236022745 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public enum DocBookVersion { V4_5, V5_0; } src/java/org/dbdoclet/tag/docbook/Tocdiv.java0000644000175000017500000000167512644165236021317 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Tocdiv extends DocBookElement { private static String tag = "tocdiv"; public static String getTag() { return tag; } Tocdiv() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Taskrelated.java0000644000175000017500000000171412644165236022324 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Taskrelated extends DocBookElement { private static String tag = "taskrelated"; public static String getTag() { return tag; } Taskrelated() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Book.java0000644000175000017500000000167312644165236020757 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Book extends SectionElement { private static final String tag = "book"; Book() { super(tag); setFormatType(FORMAT_BLOCK); } public static String getTag() { return tag; } } src/java/org/dbdoclet/tag/docbook/Parameter.java0000644000175000017500000000160112644165236021774 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Parameter extends DocBookElement { Parameter() { super("parameter"); setFormatType(FORMAT_INLINE); } } src/java/org/dbdoclet/tag/docbook/Tertiaryie.java0000644000175000017500000000171112644165236022177 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Tertiaryie extends DocBookElement { private static String tag = "tertiaryie"; public static String getTag() { return tag; } Tertiaryie() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Uri.java0000644000175000017500000000166412644165236020624 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Uri extends DocBookElement { private static String tag = "uri"; public static String getTag() { return tag; } Uri() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Col.java0000644000175000017500000000166412644165236020602 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Col extends DocBookElement { private static String tag = "col"; public static String getTag() { return tag; } Col() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Refsect5.java0000644000175000017500000000211312644165236021533 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; import java.util.HashMap; public class Refsect5 extends DocBookElement { private static String tag = "refsect3"; Refsect5() { super(tag); } public static String getTag() { return tag; } public static HashMap getAttributeMap() { return new HashMap(); } } src/java/org/dbdoclet/tag/docbook/Glosssee.java0000644000175000017500000000170312644165236021643 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Glosssee extends DocBookElement { private static String tag = "glosssee"; public static String getTag() { return tag; } Glosssee() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Artpagenums.java0000644000175000017500000000171412644165236022347 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Artpagenums extends DocBookElement { private static String tag = "artpagenums"; public static String getTag() { return tag; } Artpagenums() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Informalexample.java0000644000175000017500000000215012644165236023177 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; import java.util.HashMap; public class Informalexample extends DocBookElement { private static String tag = "informalexample"; public static HashMap getAttributeMap() { return new HashMap(); } public static String getTag() { return tag; } Informalexample() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Areaset.java0000644000175000017500000000170012644165236021440 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Areaset extends DocBookElement { private static String tag = "areaset"; public static String getTag() { return tag; } Areaset() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Envar.java0000644000175000017500000000167212644165236021137 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Envar extends DocBookElement { private static String tag = "envar"; public static String getTag() { return tag; } Envar() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Publisher.java0000644000175000017500000000170612644165236022017 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Publisher extends DocBookElement { private static String tag = "publisher"; public static String getTag() { return tag; } Publisher() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Primaryie.java0000644000175000017500000000170612644165236022023 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Primaryie extends DocBookElement { private static String tag = "primaryie"; public static String getTag() { return tag; } Primaryie() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Productionrecap.java0000644000175000017500000000173012644165236023220 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Productionrecap extends DocBookElement { private static String tag = "productionrecap"; public static String getTag() { return tag; } Productionrecap() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Personblurb.java0000644000175000017500000000171412644165236022356 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Personblurb extends DocBookElement { private static String tag = "personblurb"; public static String getTag() { return tag; } Personblurb() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Refsect3.java0000644000175000017500000000157312644165236021542 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Refsect3 extends DocBookElement { public static final String tagName = "refsect3"; Refsect3() { super(tagName); } } src/java/org/dbdoclet/tag/docbook/Bibliolist.java0000644000175000017500000000171112644165236022152 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Bibliolist extends DocBookElement { private static String tag = "bibliolist"; public static String getTag() { return tag; } Bibliolist() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Indexdiv.java0000644000175000017500000000170312644165236021631 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Indexdiv extends DocBookElement { private static String tag = "indexdiv"; public static String getTag() { return tag; } Indexdiv() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Termdef.java0000644000175000017500000000170012644165236021442 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Termdef extends DocBookElement { private static String tag = "termdef"; public static String getTag() { return tag; } Termdef() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Article.java0000644000175000017500000000174512644165236021450 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Article extends SectionElement { private static final String tag = "article"; Article() { super(tag); setFormatType(FORMAT_BLOCK); } public static String getTag() { return tag; } } src/java/org/dbdoclet/tag/docbook/Blockquote.java0000644000175000017500000000174712644165236022177 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Blockquote extends DocBookElement { private static String tag = "blockquote"; Blockquote() { super(tag); setFormatType(FORMAT_BLOCK); } public static String getTag() { return tag; } } src/java/org/dbdoclet/tag/docbook/Keywordset.java0000644000175000017500000000171012644165236022215 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Keywordset extends DocBookElement { private static String tag = "keywordset"; Keywordset() { super(tag); setFormatType(FORMAT_BLOCK); } public static String getTag() { return tag; } } src/java/org/dbdoclet/tag/docbook/Synopsis.java0000644000175000017500000000153212644165236021706 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Synopsis extends DocBookElement { Synopsis() { super("synopsis"); } } src/java/org/dbdoclet/tag/docbook/Returnvalue.java0000644000175000017500000000171412644165236022375 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Returnvalue extends DocBookElement { private static String tag = "returnvalue"; public static String getTag() { return tag; } Returnvalue() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Member.java0000644000175000017500000000176712644165236021300 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Member extends DocBookElement { private static String tag = "member"; public static String getTag() { return tag; } Member() { super(tag); setFormatType(FORMAT_CONTENT); } Member(String text) { this(); appendChild(text); } } src/java/org/dbdoclet/tag/docbook/Videoobject.java0000644000175000017500000000171412644165236022316 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Videoobject extends DocBookElement { private static String tag = "videoobject"; public static String getTag() { return tag; } Videoobject() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Msginfo.java0000644000175000017500000000170012644165236021456 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Msginfo extends DocBookElement { private static String tag = "msginfo"; public static String getTag() { return tag; } Msginfo() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Audiodata.java0000644000175000017500000000170612644165236021755 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Audiodata extends DocBookElement { private static String tag = "audiodata"; public static String getTag() { return tag; } Audiodata() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Pagenums.java0000644000175000017500000000170312644165236021636 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Pagenums extends DocBookElement { private static String tag = "pagenums"; public static String getTag() { return tag; } Pagenums() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Preface.java0000644000175000017500000000164612644165236021432 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Preface extends SectionElement { private static final String tag = "preface"; Preface() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Entry.java0000644000175000017500000000522112644165236021157 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; import org.dbdoclet.xiphias.dom.ElementImpl; public class Entry extends DocBookElement { private static String tag = "entry"; public static String getTag() { return tag; } Entry() { super(tag); } Entry(String text) { super(tag); appendChild(new Para(text).setFormatType(ElementImpl.FORMAT_INLINE)); } public Entry setAlign(String align) { if (align != null) { align = align.toLowerCase(); } setAttribute("align", align); return this; } public Entry setChar(String charAttr) { setAttribute("char", charAttr); return this; } public Entry setCharOff(String charOff) { setAttribute("charOff", charOff); return this; } public Entry setMorerows(int mr) { setAttribute("morerows", new Integer(mr)); return this; } public Entry setNameEnd(String s) { setAttribute("nameend", s); return this; } public Entry setNameSt(String s) { setAttribute("namest", s); return this; } Entry setSpanname(String sn) { setAttribute("spanname", sn); return this; } public Entry setVAlign(String valign) { if (valign != null) { valign = valign.toLowerCase(); } setAttribute("valign", valign); return this; } @Override protected boolean validateAttributes() { String attr; attr = getAttribute("align"); if ((attr != null) && (attr.equalsIgnoreCase("left") == false) && (attr.equalsIgnoreCase("right") == false) && (attr.equalsIgnoreCase("center") == false) && (attr.equalsIgnoreCase("justify") == false) && (attr.equalsIgnoreCase("char") == false)) { setAttribute("align", "center"); } attr = getAttribute("valign"); if ((attr != null) && (attr.equalsIgnoreCase("top") == false) && (attr.equalsIgnoreCase("middle") == false) && (attr.equalsIgnoreCase("baseline") == false) && (attr.equalsIgnoreCase("bottom") == false)) { setAttribute("valign", "middle"); } return true; } } src/java/org/dbdoclet/tag/docbook/DocBookTagFactoryException.java0000644000175000017500000000165712644165236025252 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class DocBookTagFactoryException extends Exception { private static final long serialVersionUID = 1L; DocBookTagFactoryException(String msg) { super(msg); } } src/java/org/dbdoclet/tag/docbook/Date.java0000644000175000017500000000205412644165236020734 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; import org.dbdoclet.xiphias.XmlServices; public class Date extends DocBookElement { private static String tagName = "date"; Date() { super(tagName); setFormatType(FORMAT_INLINE); } Date(String text) { this(); appendChild(XmlServices.textToXml(text)); } } src/java/org/dbdoclet/tag/docbook/Othername.java0000644000175000017500000000170612644165236022004 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Othername extends DocBookElement { private static String tag = "othername"; public static String getTag() { return tag; } Othername() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/DocBookSchemaValidator.java0000644000175000017500000000633312644165236024372 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; import java.io.IOException; import java.net.URL; import javax.xml.XMLConstants; import javax.xml.transform.dom.DOMSource; import javax.xml.validation.Schema; import javax.xml.validation.SchemaFactory; import javax.xml.validation.Validator; import org.dbdoclet.ValidationResult; import org.dbdoclet.service.ResourceServices; import org.dbdoclet.service.StringServices; import org.dbdoclet.tag.ITransformPosition; import org.dbdoclet.xiphias.NodeSerializer; import org.w3c.dom.Node; import org.xml.sax.ErrorHandler; import org.xml.sax.SAXException; import org.xml.sax.SAXParseException; public class DocBookSchemaValidator { // private static Log logger = LogFactory.getLog(DocBookSchemaValidator.class); private static DocBookSchemaValidator singleton; private Validator validator; private DocBookSchemaValidator() throws SAXException { SchemaFactory schemaFactory = SchemaFactory .newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); URL schemaUrl = ResourceServices .getResourceAsUrl("/xsd/docbook/docbook.xsd"); Schema schema = schemaFactory.newSchema(schemaUrl); validator = schema.newValidator(); validator.setErrorHandler(new DocBookSchemaValidatorErrorHandler()); } public ValidationResult validate(ITransformPosition pos, Node node) { ValidationResult result = new ValidationResult(); try { validator.validate(new DOMSource(node)); result.setValid(true); return result; } catch (SAXException | IOException oops) { String description = ""; if (pos != null) { description = pos.getDescription(); } result.setMessage(String.format("[%s] %s:\nXML::%s::\n%s\n", description, oops.getClass() .getSimpleName(), new NodeSerializer().toXML(node), StringServices.splitAt(oops.getMessage(), " "))); result.setValid(false); return result; } } public static DocBookSchemaValidator getInstance() throws SAXException { if (singleton == null) { singleton = new DocBookSchemaValidator(); } return singleton; } } class DocBookSchemaValidatorErrorHandler implements ErrorHandler { @Override public void warning(SAXParseException exception) throws SAXException { throw(exception); } @Override public void error(SAXParseException exception) throws SAXException { String msg = exception.getMessage(); if (msg != null) { if (msg.startsWith("cvc-id")) { return; } } throw(exception); } @Override public void fatalError(SAXParseException exception) throws SAXException { throw(exception); } }src/java/org/dbdoclet/tag/docbook/Listitem.java0000644000175000017500000000220712644165236021651 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; import java.util.HashMap; public class Listitem extends DocBookElement { private static String tag = "listitem"; public static HashMap getAttributeMap() { return new HashMap(); } public static String getTag() { return tag; } Listitem() { super("listitem"); setFormatType(FORMAT_BLOCK); } Listitem(String text) { this(); appendChild(text); } } src/java/org/dbdoclet/tag/docbook/ULink.java0000644000175000017500000000227012644165236021101 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class ULink extends DocBookElement { private static final String tag = "ulink"; ULink() { super(tag); setFormatType(FORMAT_INLINE); } ULink(String text) { this(); appendChild(text); } public void setUrl(String url) { if ((url == null) || (url.length() == 0)) { url = "#"; } setAttribute("url", url); } public String getUrl() { return getAttribute("url"); } public static String getTag() { return tag; } } src/java/org/dbdoclet/tag/docbook/Code.java0000644000175000017500000000204412644165236020730 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; import org.dbdoclet.xiphias.XmlServices; public class Code extends DocBookElement { private static String tag = "code"; Code() { super(tag); setFormatType(FORMAT_INLINE); } Code(String text) { this(); appendChild(XmlServices.textToXml(text)); } } src/java/org/dbdoclet/tag/docbook/Nonterminal.java0000644000175000017500000000171412644165236022347 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Nonterminal extends DocBookElement { private static String tag = "nonterminal"; public static String getTag() { return tag; } Nonterminal() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Refentrytitle.java0000644000175000017500000000172212644165236022720 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Refentrytitle extends DocBookElement { private static String tag = "refentrytitle"; public static String getTag() { return tag; } Refentrytitle() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Refpurpose.java0000644000175000017500000000205612644165236022213 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Refpurpose extends DocBookElement { private static String tagName = "refpurpose"; Refpurpose() { super(tagName); } Refpurpose(String refpurpose) { this(); appendChild(refpurpose); } public static String getTag() { return tagName; } } src/java/org/dbdoclet/tag/docbook/Itermset.java0000644000175000017500000000170312644165236021653 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Itermset extends DocBookElement { private static String tag = "itermset"; public static String getTag() { return tag; } Itermset() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Tag.java0000644000175000017500000000166412644165236020600 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Tag extends DocBookElement { private static String tag = "tag"; public static String getTag() { return tag; } Tag() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Title.java0000644000175000017500000000207412644165236021142 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; import org.dbdoclet.xiphias.XmlServices; public class Title extends DocBookElement { private static final String tag = "title"; public static String getTag() { return tag; } Title() { super(tag); } Title(String title) { super(tag); if (title != null) { appendChild(XmlServices.textToXml(title)); } } } src/java/org/dbdoclet/tag/docbook/Areaspec.java0000644000175000017500000000170312644165236021602 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Areaspec extends DocBookElement { private static String tag = "areaspec"; public static String getTag() { return tag; } Areaspec() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Task.java0000644000175000017500000000166712644165236020772 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Task extends DocBookElement { private static String tag = "task"; public static String getTag() { return tag; } Task() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Informalfigure.java0000644000175000017500000000174512644165236023036 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Informalfigure extends DocBookElement { private static final String TAG = "informalfigure"; public static String getTag() { return TAG; } Informalfigure() { super("informalfigure"); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/BookInfo.java0000644000175000017500000000174312644165236021571 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class BookInfo extends DocBookElement { private static String tag = "bookinfo"; BookInfo() { super(tag); setFormatType(FORMAT_BLOCK); } public static String getTag() { return tag; } } src/java/org/dbdoclet/tag/docbook/Titleabbrev.java0000644000175000017500000000171412644165236022324 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Titleabbrev extends DocBookElement { private static String tag = "titleabbrev"; public static String getTag() { return tag; } Titleabbrev() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Simplelist.java0000644000175000017500000000205512644165236022205 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Simplelist extends DocBookElement { final static public int FORMAT_INLINE = 1; Simplelist() { super("simplelist"); } Simplelist setType(int type) { if (type == FORMAT_INLINE) { setAttribute("type", "inline"); } return this; } } src/java/org/dbdoclet/tag/docbook/Procedure.java0000644000175000017500000000170612644165236022012 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Procedure extends DocBookElement { private static String tag = "procedure"; public static String getTag() { return tag; } Procedure() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/AttributeAlign.java0000644000175000017500000000146712644165236023004 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public enum AttributeAlign { CENTER, CHAR, JUSTIFY, LEFT, RIGHT; } src/java/org/dbdoclet/tag/docbook/Simpara.java0000644000175000017500000000276412644165236021463 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; import java.util.HashMap; public class Simpara extends DocBookElement { private static final String tag = "simpara"; private static HashMap> invalidParentMap; static { invalidParentMap = new HashMap>(); invalidParentMap.put(Address.getTag(), Address.getAttributeMap()); invalidParentMap.put(Subscript.getTag(), Subscript.getAttributeMap()); invalidParentMap.put(Superscript.getTag(), Superscript.getAttributeMap()); } Simpara() { super(tag); setFormatType(FORMAT_BLOCK); } Simpara(String text) { this(); appendChild(text); } public static String getTag() { return tag; } } src/java/org/dbdoclet/tag/docbook/Caption.java0000644000175000017500000000231712644165236021456 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; import java.util.HashMap; public class Caption extends DocBookElement { private static String tag = "caption"; Caption() { super("caption"); setFormatType(FORMAT_BLOCK); } Caption(String caption) { this(); appendChild(new Para(caption)); } public static String getTag() { return tag; } public static HashMap getAttributeMap() { return new HashMap(); } } src/java/org/dbdoclet/tag/docbook/Biblioset.java0000644000175000017500000000170612644165236021776 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Biblioset extends DocBookElement { private static String tag = "biblioset"; public static String getTag() { return tag; } Biblioset() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Mousebutton.java0000644000175000017500000000171412644165236022405 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Mousebutton extends DocBookElement { private static String tag = "mousebutton"; public static String getTag() { return tag; } Mousebutton() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Ooclass.java0000644000175000017500000000162312644165236021463 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Ooclass extends DocBookElement { private static String tagName = "ooclass"; Ooclass() { super(tagName); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Keycode.java0000644000175000017500000000170012644165236021437 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Keycode extends DocBookElement { private static String tag = "keycode"; public static String getTag() { return tag; } Keycode() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Olink.java0000644000175000017500000000275012644165236021136 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; import org.dbdoclet.xiphias.XmlServices; public class Olink extends DocBookElement { Olink() { super("olink"); } Olink(DocBookElement label, String targetdoc, String targetptr) { this(targetdoc, targetptr); appendChild(label); } Olink(String targetdoc, String targetptr) { this(); setAttribute("targetdoc", hardenId(targetdoc)); setAttribute("targetptr", hardenId(targetptr)); setFormatType(FORMAT_INLINE); } Olink(String label, String targetdoc, String targetptr) { this(targetdoc, targetptr); appendChild(XmlServices.textToXml(label)); } public void setTargetDoc(String targetdoc) { setAttribute("targetdoc", targetdoc); } public void setTargetPtr(String targetptr) { setAttribute("targetptr", targetptr); } } src/java/org/dbdoclet/tag/docbook/Fieldsynopsis.java0000644000175000017500000000222612644165236022713 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Fieldsynopsis extends DocBookElement { private static final String tagName = "fieldsynopsis"; Fieldsynopsis() { super(tagName); setFormatType(FORMAT_BLOCK); setAttribute("language", "java"); } public static String getTag() { return tagName; } public void setLanguage(String language) { setAttribute("language", language); } } src/java/org/dbdoclet/tag/docbook/Application.java0000644000175000017500000000171412644165236022324 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Application extends DocBookElement { private static String tag = "application"; public static String getTag() { return tag; } Application() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Firstterm.java0000644000175000017500000000170612644165236022041 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Firstterm extends DocBookElement { private static String tag = "firstterm"; public static String getTag() { return tag; } Firstterm() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Refname.java0000644000175000017500000000151012644165236021430 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Refname extends DocBookElement { Refname() { super("refname"); } } src/java/org/dbdoclet/tag/docbook/Productname.java0000644000175000017500000000171412644165236022342 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Productname extends DocBookElement { private static String tag = "productname"; public static String getTag() { return tag; } Productname() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Acknowledgements.java0000644000175000017500000000173312644165236023354 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Acknowledgements extends DocBookElement { private static String tag = "acknowledgements"; public static String getTag() { return tag; } Acknowledgements() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/See.java0000644000175000017500000000166412644165236020601 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class See extends DocBookElement { private static String tag = "see"; public static String getTag() { return tag; } See() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Literal.java0000644000175000017500000000177212644165236021461 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Literal extends DocBookElement { private static String tag = "literal"; public static String getTag() { return tag; } Literal() { super(tag); setFormatType(FORMAT_INLINE); } Literal(String text) { this(); appendChild(text); } } src/java/org/dbdoclet/tag/docbook/Informalequation.java0000644000175000017500000000173312644165236023377 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Informalequation extends DocBookElement { private static String tag = "informalequation"; public static String getTag() { return tag; } Informalequation() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Entrytbl.java0000644000175000017500000000167012644165236021665 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Entrytbl extends DocBookElement { Entrytbl() { super("entrytbl"); } public Entrytbl setCols(int cols) { setAttribute("cols", new Integer(cols)); return this; } } src/java/org/dbdoclet/tag/docbook/State.java0000644000175000017500000000167212644165236021144 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class State extends DocBookElement { private static String tag = "state"; public static String getTag() { return tag; } State() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Group.java0000644000175000017500000000167212644165236021160 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Group extends DocBookElement { private static String tag = "group"; public static String getTag() { return tag; } Group() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Holder.java0000644000175000017500000000206412644165236021275 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; import org.dbdoclet.xiphias.XmlServices; public class Holder extends DocBookElement { private static String tagName = "holder"; Holder() { super(tagName); setFormatType(FORMAT_INLINE); } Holder(String text) { this(); appendChild(XmlServices.textToXml(text)); } } src/java/org/dbdoclet/tag/docbook/Exceptionname.java0000644000175000017500000000222312644165236022654 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; import org.dbdoclet.xiphias.XmlServices; public class Exceptionname extends DocBookElement { private static String tagName = "exceptionname"; Exceptionname() { super(tagName); setFormatType(FORMAT_INLINE); } Exceptionname(String text) { this(); appendChild(XmlServices.textToXml(text)); } public static String getTag() { return tagName; } } src/java/org/dbdoclet/tag/docbook/Step.java0000644000175000017500000000166712644165236021003 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Step extends DocBookElement { private static String tag = "step"; public static String getTag() { return tag; } Step() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Msgrel.java0000644000175000017500000000167512644165236021320 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Msgrel extends DocBookElement { private static String tag = "msgrel"; public static String getTag() { return tag; } Msgrel() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Equation.java0000644000175000017500000000170312644165236021644 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Equation extends DocBookElement { private static String tag = "equation"; public static String getTag() { return tag; } Equation() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Refdescriptor.java0000644000175000017500000000172212644165236022673 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Refdescriptor extends DocBookElement { private static String tag = "refdescriptor"; public static String getTag() { return tag; } Refdescriptor() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Extendedlink.java0000644000175000017500000000171712644165236022502 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Extendedlink extends DocBookElement { private static String tag = "extendedlink"; public static String getTag() { return tag; } Extendedlink() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Refclass.java0000644000175000017500000000170312644165236021621 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Refclass extends DocBookElement { private static String tag = "refclass"; public static String getTag() { return tag; } Refclass() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Calloutlist.java0000644000175000017500000000171412644165236022360 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Calloutlist extends DocBookElement { private static String tag = "calloutlist"; public static String getTag() { return tag; } Calloutlist() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Void.java0000644000175000017500000000154512644165236020764 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Void extends DocBookElement { Void() { super("void"); isEmpty(true); } } src/java/org/dbdoclet/tag/docbook/Manvolnum.java0000644000175000017500000000164412644165236022037 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Manvolnum extends DocBookElement { private static String tag = "manvolnum"; public static String getTag() { return tag; } Manvolnum() { super(tag); } } src/java/org/dbdoclet/tag/docbook/Glossary.java0000644000175000017500000000170312644165236021662 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Glossary extends DocBookElement { private static String tag = "glossary"; public static String getTag() { return tag; } Glossary() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Funcdef.java0000644000175000017500000000157312644165236021436 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Funcdef extends DocBookElement { Funcdef() { super("funcdef"); setFormatType(FORMAT_INLINE); } } src/java/org/dbdoclet/tag/docbook/DocBookDocument.java0000644000175000017500000000302012644165236023070 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; import org.dbdoclet.xiphias.XmlConstants; import org.dbdoclet.xiphias.dom.DocumentImpl; public class DocBookDocument extends DocumentImpl { public void setDocumentElement(DocBookElement documentElement) { if (documentElement == null) { throw new IllegalArgumentException("The argument documentElement must not be null!"); } super.setDocumentElement(documentElement); if (documentElement.isDocBook5()) { documentElement.setAttribute("xmlns", XmlConstants.NAMESPACE_DOCBOOK); documentElement.setAttribute("xmlns:xl", XmlConstants.NAMESPACE_XLINK); documentElement.setAttribute("xmlns:xi", XmlConstants.NAMESPACE_XINCLUDE); documentElement.setAttribute("version", "5.0"); } } } src/java/org/dbdoclet/tag/docbook/Tbody.java0000644000175000017500000000155512644165236021145 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Tbody extends Telem { Tbody() { super("tbody"); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Keycap.java0000644000175000017500000000167512644165236021303 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Keycap extends DocBookElement { private static String tag = "keycap"; public static String getTag() { return tag; } Keycap() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Bridgehead.java0000644000175000017500000000232312644165236022074 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Bridgehead extends DocBookElement { Bridgehead() { super("bridgehead"); setFormatType(FORMAT_BLOCK); } Bridgehead(String Bridgehead) { this(); appendChild(Bridgehead); } Bridgehead(String Bridgehead, String renderAs) { this(); setAttribute("renderas", renderAs); appendChild(Bridgehead); } public void setRenderAs(String renderAs) { setAttribute("renderas", renderAs); } } src/java/org/dbdoclet/tag/docbook/Programlisting.java0000644000175000017500000000274212644165236023064 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Programlisting extends DocBookElement { private static final String tag = "programlisting"; Programlisting() { super(tag); setFormatType(FORMAT_CONTENT); isLiteral(true); } Programlisting(String text) { this(); appendChild(text); } Programlisting setWidth(int width) { setAttribute("width", new Integer(width)); return this; } public static String getTag() { return tag; } public void setLinenumberingEnabled(boolean linenumbering) { if (linenumbering == true) { setAttribute("linenumbering", "numbered"); } else { setAttribute("linenumbering", "unnumbered"); } } } src/java/org/dbdoclet/tag/docbook/Synopfragment.java0000644000175000017500000000172212644165236022714 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Synopfragment extends DocBookElement { private static String tag = "synopfragment"; public static String getTag() { return tag; } Synopfragment() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Chapter.java0000644000175000017500000000174512644165236021453 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Chapter extends SectionElement { private static final String tag = "chapter"; Chapter() { super(tag); setFormatType(FORMAT_BLOCK); } public static String getTag() { return tag; } } src/java/org/dbdoclet/tag/docbook/Refsection.java0000644000175000017500000000163412644165236022163 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Refsection extends DocBookElement { private static String tagName = "refsection"; Refsection() { super(tagName); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Markup.java0000644000175000017500000000241612644165236021320 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Markup extends DocBookElement { private static String tag = "markup"; Markup() { super(tag); setFormatType(FORMAT_INLINE); } Markup(String text) { super(tag); appendChild(text); setFormatType(FORMAT_INLINE); } Markup(String text, String role) { super(tag); appendChild(text); setAttribute("role", role); setFormatType(FORMAT_INLINE); } Markup(DocBookElement elem) { super(tag); appendChild(elem); setFormatType(FORMAT_INLINE); } public static String getTag() { return tag; } } src/java/org/dbdoclet/tag/docbook/Area.java0000644000175000017500000000166712644165236020740 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Area extends DocBookElement { private static String tag = "area"; public static String getTag() { return tag; } Area() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Co.java0000644000175000017500000000166112644165236020423 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Co extends DocBookElement { private static String tag = "co"; public static String getTag() { return tag; } Co() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Xref.java0000644000175000017500000000156212644165236020766 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Xref extends DocBookElement { Xref() { super("xref"); setFormatType(FORMAT_INLINE); } } src/java/org/dbdoclet/tag/docbook/Classname.java0000644000175000017500000000167212644165236021772 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Classname extends DocBookElement { Classname() { super("classname"); } Classname(String classname) { this(); appendChild(classname); } } src/java/org/dbdoclet/tag/docbook/Publishername.java0000644000175000017500000000172212644165236022656 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Publishername extends DocBookElement { private static String tag = "publishername"; public static String getTag() { return tag; } Publishername() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Phrase.java0000644000175000017500000000157012644165236021303 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Phrase extends DocBookElement { Phrase() { super("phrase"); setFormatType(FORMAT_INLINE); } } src/java/org/dbdoclet/tag/docbook/Funcsynopsis.java0000644000175000017500000000154412644165236022565 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Funcsynopsis extends DocBookElement { Funcsynopsis() { super("funcsynopsis"); } } src/java/org/dbdoclet/tag/docbook/Citation.java0000644000175000017500000000170312644165236021631 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Citation extends DocBookElement { private static String tag = "citation"; public static String getTag() { return tag; } Citation() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Phone.java0000644000175000017500000000167212644165236021135 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Phone extends DocBookElement { private static String tag = "phone"; public static String getTag() { return tag; } Phone() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Msgaud.java0000644000175000017500000000167512644165236021307 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Msgaud extends DocBookElement { private static String tag = "msgaud"; public static String getTag() { return tag; } Msgaud() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Volumenum.java0000644000175000017500000000170612644165236022051 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Volumenum extends DocBookElement { private static String tag = "volumenum"; public static String getTag() { return tag; } Volumenum() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Bibliomixed.java0000644000175000017500000000171412644165236022310 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Bibliomixed extends DocBookElement { private static String tag = "bibliomixed"; public static String getTag() { return tag; } Bibliomixed() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Seeie.java0000644000175000017500000000167212644165236021116 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Seeie extends DocBookElement { private static String tag = "seeie"; public static String getTag() { return tag; } Seeie() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Constant.java0000644000175000017500000000170312644165236021650 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Constant extends DocBookElement { private static String tag = "constant"; public static String getTag() { return tag; } Constant() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Colspec.java0000644000175000017500000000203512644165236021446 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Colspec extends DocBookElement { Colspec() { super("colspec"); isEmpty(true); } Colspec(String name, String width) { super("colspec"); setAttribute("colname", name); setAttribute("colwidth", width); isEmpty(true); } } src/java/org/dbdoclet/tag/docbook/Anchor.java0000644000175000017500000000161712644165236021275 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Anchor extends DocBookElement { Anchor() { super("anchor"); isEmpty(true); setFormatType(FORMAT_INLINE); } } src/java/org/dbdoclet/tag/docbook/Seg.java0000644000175000017500000000166412644165236020603 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Seg extends DocBookElement { private static String tag = "seg"; public static String getTag() { return tag; } Seg() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Guimenu.java0000644000175000017500000000170012644165236021465 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Guimenu extends DocBookElement { private static String tag = "guimenu"; public static String getTag() { return tag; } Guimenu() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Msgset.java0000644000175000017500000000167512644165236021331 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Msgset extends DocBookElement { private static String tag = "msgset"; public static String getTag() { return tag; } Msgset() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Replaceable.java0000644000175000017500000000171412644165236022260 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Replaceable extends DocBookElement { private static String tag = "replaceable"; public static String getTag() { return tag; } Replaceable() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Type.java0000644000175000017500000000163212644165236021001 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Type extends DocBookElement { Type() { super("type"); } Type(String type) { this(); appendChild(type); } } src/java/org/dbdoclet/tag/docbook/Errortext.java0000644000175000017500000000170612644165236022060 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Errortext extends DocBookElement { private static String tag = "errortext"; public static String getTag() { return tag; } Errortext() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Literallayout.java0000644000175000017500000000172212644165236022712 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Literallayout extends DocBookElement { private static String tag = "literallayout"; public static String getTag() { return tag; } Literallayout() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Callout.java0000644000175000017500000000170012644165236021457 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Callout extends DocBookElement { private static String tag = "callout"; public static String getTag() { return tag; } Callout() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Street.java0000644000175000017500000000167512644165236021335 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Street extends DocBookElement { private static String tag = "street"; public static String getTag() { return tag; } Street() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Option.java0000644000175000017500000000167512644165236021337 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Option extends DocBookElement { private static String tag = "option"; public static String getTag() { return tag; } Option() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Constraint.java0000644000175000017500000000171112644165236022202 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Constraint extends DocBookElement { private static String tag = "constraint"; public static String getTag() { return tag; } Constraint() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Tertiary.java0000644000175000017500000000170312644165236021662 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Tertiary extends DocBookElement { private static String tag = "tertiary"; public static String getTag() { return tag; } Tertiary() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Guimenuitem.java0000644000175000017500000000171412644165236022351 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Guimenuitem extends DocBookElement { private static String tag = "guimenuitem"; public static String getTag() { return tag; } Guimenuitem() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Arc.java0000644000175000017500000000166412644165236020572 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Arc extends DocBookElement { private static String tag = "arc"; public static String getTag() { return tag; } Arc() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Segtitle.java0000644000175000017500000000170312644165236021637 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Segtitle extends DocBookElement { private static String tag = "segtitle"; public static String getTag() { return tag; } Segtitle() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Primary.java0000644000175000017500000000157312644165236021507 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Primary extends DocBookElement { Primary() { super("primary"); setFormatType(FORMAT_INLINE); } } src/java/org/dbdoclet/tag/docbook/Honorific.java0000644000175000017500000000170612644165236022002 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Honorific extends DocBookElement { private static String tag = "honorific"; public static String getTag() { return tag; } Honorific() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Year.java0000644000175000017500000000205312644165236020756 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; import org.dbdoclet.xiphias.XmlServices; public class Year extends DocBookElement { private static String tagName = "year"; Year() { super(tagName); setFormatType(FORMAT_INLINE); } Year(String text) { this(); appendChild(XmlServices.textToXml(text)); } } src/java/org/dbdoclet/tag/docbook/Seealso.java0000644000175000017500000000170012644165236021447 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Seealso extends DocBookElement { private static String tag = "seealso"; public static String getTag() { return tag; } Seealso() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Inlineequation.java0000644000175000017500000000172512644165236023047 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Inlineequation extends DocBookElement { private static String tag = "inlineequation"; public static String getTag() { return tag; } Inlineequation() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Tr.java0000644000175000017500000000166112644165236020447 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Tr extends DocBookElement { private static String tag = "tr"; public static String getTag() { return tag; } Tr() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Destructorsynopsis.java0000644000175000017500000000174112644165236024027 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Destructorsynopsis extends DocBookElement { private static String tag = "destructorsynopsis"; public static String getTag() { return tag; } Destructorsynopsis() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Reference.java0000644000175000017500000000176212644165236021762 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Reference extends DocBookElement { private static String tagName = "reference"; Reference() { super(tagName); setFormatType(FORMAT_BLOCK); } public static String getTag() { return tagName; } } src/java/org/dbdoclet/tag/docbook/Msgorig.java0000644000175000017500000000170012644165236021463 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Msgorig extends DocBookElement { private static String tag = "msgorig"; public static String getTag() { return tag; } Msgorig() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Methodsynopsis.java0000644000175000017500000000205112644165236023104 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Methodsynopsis extends DocBookElement { private static final String tagName = "methodsynopsis"; Methodsynopsis() { super(tagName); setFormatType(FORMAT_BLOCK); setAttribute("language", "java"); } public void setLanguage(String language) { setAttribute("language", language); } } src/java/org/dbdoclet/tag/docbook/Biblioentry.java0000644000175000017500000000171412644165236022343 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Biblioentry extends DocBookElement { private static String tag = "biblioentry"; public static String getTag() { return tag; } Biblioentry() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Bibliography.java0000644000175000017500000000171712644165236022477 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Bibliography extends DocBookElement { private static String tag = "bibliography"; public static String getTag() { return tag; } Bibliography() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Confgroup.java0000644000175000017500000000170612644165236022024 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Confgroup extends DocBookElement { private static String tag = "confgroup"; public static String getTag() { return tag; } Confgroup() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Errorcode.java0000644000175000017500000000170612644165236022006 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Errorcode extends DocBookElement { private static String tag = "errorcode"; public static String getTag() { return tag; } Errorcode() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Sect5.java0000644000175000017500000000157212644165236021046 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Sect5 extends SectionElement { private final static String tag = "sect5"; Sect5() { super(tag); } } src/java/org/dbdoclet/tag/docbook/Abstract.java0000644000175000017500000000165612644165236021631 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Abstract extends DocBookElement { private static String tagName = "abstract"; Abstract() { super(tagName); setFormatType(FORMAT_CONTENT); } } src/java/org/dbdoclet/tag/docbook/Msgentry.java0000644000175000017500000000170312644165236021667 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Msgentry extends DocBookElement { private static String tag = "msgentry"; public static String getTag() { return tag; } Msgentry() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Interfacename.java0000644000175000017500000000174512644165236022626 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Interfacename extends DocBookElement { private static String tagName = "interfacename"; Interfacename() { super(tagName); } Interfacename(String interfacename) { this(); appendChild(interfacename); } } src/java/org/dbdoclet/tag/docbook/Userinput.java0000644000175000017500000000170612644165236022060 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Userinput extends DocBookElement { private static String tag = "userinput"; public static String getTag() { return tag; } Userinput() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Synopfragmentref.java0000644000175000017500000000173312644165236023413 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Synopfragmentref extends DocBookElement { private static String tag = "synopfragmentref"; public static String getTag() { return tag; } Synopfragmentref() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Confdates.java0000644000175000017500000000170612644165236021770 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Confdates extends DocBookElement { private static String tag = "confdates"; public static String getTag() { return tag; } Confdates() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Screenshot.java0000644000175000017500000000171112644165236022173 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Screenshot extends DocBookElement { private static String tag = "screenshot"; public static String getTag() { return tag; } Screenshot() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Qandaentry.java0000644000175000017500000000171112644165236022164 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Qandaentry extends DocBookElement { private static String tag = "qandaentry"; public static String getTag() { return tag; } Qandaentry() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Inlinemediaobject.java0000644000175000017500000000161412644165236023465 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Inlinemediaobject extends DocBookElement { Inlinemediaobject() { super("inlinemediaobject"); setFormatType(FORMAT_INLINE); } } src/java/org/dbdoclet/tag/docbook/Acronym.java0000644000175000017500000000204412644165236021466 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Acronym extends DocBookElement { private static final String tag = "acronym"; Acronym() { super(tag); setFormatType(FORMAT_INLINE); } Acronym(String text) { super(tag); appendChild(text); setFormatType(FORMAT_INLINE); } public static String getTag() { return tag; } } src/java/org/dbdoclet/tag/docbook/Index.java0000644000175000017500000000157512644165236021135 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Index extends DocBookElement { private static final String tag = "index"; Index() { super(tag); isEmpty(true); } } src/java/org/dbdoclet/tag/docbook/Contrib.java0000644000175000017500000000170012644165236021454 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Contrib extends DocBookElement { private static String tag = "contrib"; public static String getTag() { return tag; } Contrib() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Attribution.java0000644000175000017500000000171412644165236022365 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Attribution extends DocBookElement { private static String tag = "attribution"; public static String getTag() { return tag; } Attribution() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/DocBookTagFactory.java0000644000175000017500000003612712644165236023373 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; import java.io.File; import java.io.IOException; import java.util.HashSet; import java.util.List; import org.dbdoclet.service.FileServices; import org.dbdoclet.tag.html.Img; import org.dbdoclet.xiphias.ImageServices; import org.dbdoclet.xiphias.NodeSerializer; import org.dbdoclet.xiphias.XmlConstants; import org.dbdoclet.xiphias.dom.ElementImpl; public class DocBookTagFactory extends BaseTagFactory { // private static Log log = LogFactory.getLog(DocBookTagFactory.class); protected DocBookVersion docBookVersion = DocBookVersion.V5_0; public DocBookTagFactory() { this(DocBookVersion.V5_0); } public DocBookTagFactory(DocBookVersion docBookVersion) { this.docBookVersion = docBookVersion; } public Chapter createChapter(String titleText) { Chapter chapter = new Chapter(); initialize(chapter); Info info = createInfo(); chapter.appendChild(info); Title title = createTitle(titleText); info.appendChild(title); return chapter; } public Classname createClassName(String name) { Classname className = new Classname(name); initialize(className); return className; } public Classsynopsisinfo createClasssynopsisinfo(String text) { Classsynopsisinfo classSynopsisInfo = new Classsynopsisinfo(text); initialize(classSynopsisInfo); return classSynopsisInfo; } public Colspec createColspec(String string, String width) { Colspec colspec = new Colspec(string, width); initialize(colspec); return colspec; } public Computeroutput createComputeroutput(String text) { Computeroutput computeroutput = new Computeroutput(text); initialize(computeroutput); return computeroutput; } public Date createDate(String text) { Date date = new Date(text); initialize(date); return date; } public DocBookElement createElementByName(String tagName) { String pkg = "org.dbdoclet.tag.docbook."; String lowerCase = tagName.toLowerCase(); DocBookElement elem = null; Class clazz = null; for (int i = 0; i < lowerCase.length(); i++) { String name = upcase(lowerCase, 0, i); try { clazz = Class.forName(pkg + name); if (clazz != null) { elem = (DocBookElement) clazz.newInstance(); if (elem != null) { break; } } } catch (Throwable e) { } } return elem; } public Email createEmail(String address) { Email email = createEmail(); email.appendChild(address); return email; } public Emphasis createEmphasis(String str) { Emphasis emphasis = new Emphasis(str); initialize(emphasis); return emphasis; } public Emphasis createEmphasis(String str, String role) { Emphasis emphasis = createEmphasis(str); emphasis.setRole(role); return emphasis; } public Entry createEntry(String text) { Entry entry = new Entry(text); initialize(entry); return entry; } public Example createExample(String title) { Example example = new Example(); initialize(example); example.appendChild(createTitle(title)); return example; } public Exceptionname createExceptionname(String text) { Exceptionname exceptionName = new Exceptionname(text); initialize(exceptionName); return exceptionName; } public Figure createFigure(String title) { Figure figure = new Figure(); initialize(figure); figure.appendChild(createTitle(title)); return figure; } public Firstname createFirstname(String name) { Firstname firstName = createFirstname(); firstName.appendChild(name); return firstName; } public void createFoImageData(DocBookElement parent, BaseTagFactory dbfactory, Img img, File file, List additionalFormats) throws IOException { String fileRef = FileServices.normalizePath(file.getPath()); String imgFormat = getImagedataFormat(fileRef); fileRef = FileServices.getFileBase(fileRef); if (FileServices.isAbsolutePath(fileRef)) { fileRef = FileServices.normalizePath(fileRef); if (fileRef.startsWith("/")) { fileRef = "file://" + fileRef; } else { fileRef = "file:///" + fileRef; } } HashSet formatList = new HashSet<>(); formatList.add(imgFormat); if (additionalFormats != null) { additionalFormats.forEach(f -> formatList.add(f.toUpperCase())); } for (String format : formatList) { Imageobject image = dbfactory.createImageobject(); if (format.equals(imgFormat)) { image.setRole("fo"); } else { image.setRole("fo-" + format.toLowerCase()); } String align = img.getAlign(); Imagedata data = dbfactory.createImagedata(); data.setScaleFit(true); data.setWidth("100%"); data.setContentDepth("100%"); data.setFormat(format); if (align != null && align.length() > 0) { data.setAlign(validateAlign(align)); } data.setFileRef(fileRef + "." + format.toLowerCase()); image.appendChild(data); parent.appendChild(image); } } public DocBookElement createFormalpara(String text) { Formalpara formalPara = createFormalpara(); formalPara.appendChild(text); return formalPara; } public Function createFunction(String func) { Function function = new Function(); function.appendChild(func); initialize(function); return function; } public Holder createHolder(String text) { Holder holder = new Holder(); holder.appendChild(text); initialize(holder); return holder; } public void createHtmlImageData(DocBookElement parent, BaseTagFactory dbfactory, Img img, File file, List additionalFormats) throws IOException { String fileRef = FileServices.normalizePath(file.getPath()); if (FileServices.isAbsolutePath(fileRef)) { fileRef = FileServices.normalizePath(fileRef); if (fileRef.startsWith("/")) { fileRef = "file://" + fileRef; } else { fileRef = "file:///" + fileRef; } } String imgFormat = getImagedataFormat(fileRef); fileRef = FileServices.getFileBase(fileRef); if (imgFormat == null) { return; } String width = img.getWidth(); String height = img.getHeight(); String align = img.getAlign(); HashSet formatList = new HashSet<>(); formatList.add(imgFormat); if (additionalFormats != null) { additionalFormats.forEach(f -> formatList.add(f.toUpperCase())); } for (String format : formatList) { Imageobject image = dbfactory.createImageobject(); if (format.equals(imgFormat)) { image.setRole("html"); } else { image.setRole("html-" + format.toLowerCase()); } Imagedata data = dbfactory.createImagedata(); data.setScaleFit(true); if (width != null && width.length() > 0) { data.setContentWidth(width); } if (height != null && height.length() > 0) { data.setContentDepth(height); } if (file.exists() && format.equalsIgnoreCase("BASE64")) { String fileName = FileServices.getFileBase(file) + ".base64"; FileServices.writeFromString(new File(fileName), ImageServices.toXml(file)); } data.setFormat(format); if (align != null && align.length() > 0) { data.setAlign(validateAlign(align)); } String attr = fileRef + "." + format.toLowerCase(); data.setFileRef(attr); image.appendChild(data); parent.appendChild(image); } } public Mediaobject createImage(String image) { return createImage(image, null, null); } public Mediaobject createImage(String image, String width, String height) { Mediaobject mediaObject = createMediaobject(); Imageobject imageObject = createImageobject(); mediaObject.appendChild(imageObject); Imagedata imageData = createImagedata(); imageObject.appendChild(imageData); imageData.setFileRef(image); if (width != null && width.trim().length() > 0) { imageData.setWidth(String.valueOf(width)); } if (height != null && height.trim().length() > 0) { imageData.setDepth(String.valueOf(height)); } return mediaObject; } public Initializer createInitializer(String text) { Initializer initializer = new Initializer(text); initialize(initializer); return initializer; } public Interfacename createInterfacename(String name) { Interfacename interfaceName = new Interfacename(name); initialize(interfaceName); return interfaceName; } public Link createLink(Literal literal, String ref) { Link link = new Link(literal, ref); initialize(link); return link; } public Link createLink(String linkend) { Link link = new Link(linkend); initialize(link); return link; } public Link createLink(String label, String ref) { Link link = new Link(label, ref); initialize(link); return link; } public Link createLink(Varname varName, String ref) { Link link = new Link(varName, ref); initialize(link); return link; } public String createLinkAsString(String label, String ref) throws IOException { Link link = new Link(label, ref); initialize(link); return new NodeSerializer().toXML(link); } public Literal createLiteral(String text) { Literal literal = new Literal(text); initialize(literal); return literal; } public Manvolnum createManvolnum(String num) { Manvolnum manVolNum = new Manvolnum(); initialize(manVolNum); manVolNum.appendChild(num); return manVolNum; } public Methodname createMethodname(String name) { Methodname methodName = createMethodname(); methodName.appendChild(name); return methodName; } public Modifier createModifier(String text) { Modifier modifier = new Modifier(); modifier.appendChild(text); initialize(modifier); return modifier; } public Olink createOlink(String label, String targetdoc, String targetptr) { Olink olink = new Olink(label, targetdoc, targetptr); initialize(olink); return olink; } public Parameter createParameter(String name) { Parameter parameter = new Parameter(); initialize(parameter); parameter.appendChild(name); return parameter; } public Primary createPrimary(String key) { Primary primary = new Primary(); initialize(primary); primary.appendChild(key); return primary; } public Programlisting createProgramlisting(String str) { Programlisting programListing = new Programlisting(str); initialize(programListing); return programListing; } public Refmiscinfo createRefmiscinfo(String clazz, String info) { Refmiscinfo refMiscInfo = new Refmiscinfo(); initialize(refMiscInfo); refMiscInfo.setAttribute("class", clazz); refMiscInfo.appendChild(refMiscInfo); return refMiscInfo; } public Refname createRefname(String name) { Refname refname = createRefname(); refname.appendChild(name); return refname; } public Refsect1 createRefsect1(String title) { Refsect1 refSect1 = createRefsect1(); refSect1.appendChild(createTitle(title)); return refSect1; } public Refsect2 createRefsect2(String title) { Refsect2 refSect2 = createRefsect2(); refSect2.appendChild(createTitle(title)); initialize(refSect2); return refSect2; } public Refsection createRefsection(String title) { Refsection refSection = createRefsection(); refSection.appendChild(createTitle(title)); return refSection; } public Releaseinfo createReleaseinfo(String text) { Releaseinfo releaseInfo = new Releaseinfo(); releaseInfo.appendChild(text); initialize(releaseInfo); return releaseInfo; } public Secondary createSecondary(String key) { Secondary secondary = new Secondary(); initialize(secondary); secondary.appendChild(key); return secondary; } public Sect1 createSect1(String title) { Sect1 sect1 = createSect1(); sect1.appendChild(createTitle(title)); return sect1; } public Sect2 createSect2(String str) { Sect2 sect2 = createSect2(); sect2.appendChild(createTitle(str)); return sect2; } public Sect3 createSect3(String str) { Sect3 sect3 = createSect3(); sect3.appendChild(createTitle(str)); return sect3; } public Section createSection(String title) { Section section = createSection(); section.appendChild(createTitle(title)); return section; } public Simpara createSimpara(String text) { Simpara simPara = new Simpara(); initialize(simPara); simPara.appendChild(text); return simPara; } public Simplelist createSimplelist(int type) { Simplelist simpleList = createSimplelist(); simpleList.setType(type); return simpleList; } public Surname createSurname(String name) { Surname surname = new Surname(); surname.appendChild(name); initialize(surname); return surname; } public DocBookElement createTag(String name) throws DocBookTagFactoryException { DocBookElement docBookElement = new DocBookElement(name); initialize(docBookElement); return docBookElement; } public Tgroup createTgroup(int cols) { Tgroup tgroup = new Tgroup(); initialize(tgroup); tgroup.setCols(2); tgroup.appendChild(createColspec("c1", "1*")); tgroup.appendChild(createColspec("c2", "1*")); return tgroup; } public Title createTitle(String str) { Title title = new Title(str); initialize(title); return title; } public Varname createVarname(String text) { Varname varName = new Varname(text); initialize(varName); return varName; } public Warning createWarning(String text) { Warning warning = new Warning(text); initialize(warning); return warning; } public Xref createXref(String linkend) { Xref xref = new Xref(); initialize(xref); xref.setAttribute("linkend", ElementImpl.hardenId(linkend)); xref.isEmpty(true); xref.needsPadding(false); return xref; } public Year createYear(String text) { Year year = new Year(); year.appendChild(text); initialize(year); return year; } public DocBookVersion getDocBookVersion() { return docBookVersion; } public String getImagedataFormat(String src) { if (src != null) { String value = FileServices.getExtension(src); if (value != null && value.trim().length() > 0) { return value.toUpperCase(); } } return null; } public boolean isDocBook5() { if (docBookVersion != null && docBookVersion == DocBookVersion.V5_0) { return true; } return false; } public String validateAlign(String align) { if (align == null) { return align; } align = align.toLowerCase(); try { AttributeAlign.valueOf(align.toUpperCase()); } catch (IllegalArgumentException oops) { return AttributeAlign.CENTER.toString().toLowerCase(); } return align; } private String upcase(String lowerCase, int... indices) { char[] chars = lowerCase.toCharArray(); for (int index : indices) { chars[index] = Character.toUpperCase(chars[index]); } return new String(chars); } protected void initialize(DocBookElement elem) { elem.setDocBookVersion(docBookVersion); elem.setNamespaceURI(XmlConstants.NAMESPACE_DOCBOOK); } }src/java/org/dbdoclet/tag/docbook/Simplemsgentry.java0000644000175000017500000000172512644165236023105 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Simplemsgentry extends DocBookElement { private static String tag = "simplemsgentry"; public static String getTag() { return tag; } Simplemsgentry() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Refsect4.java0000644000175000017500000000211312644165236021532 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; import java.util.HashMap; public class Refsect4 extends DocBookElement { private static String tag = "refsect3"; Refsect4() { super(tag); } public static String getTag() { return tag; } public static HashMap getAttributeMap() { return new HashMap(); } } src/java/org/dbdoclet/tag/docbook/Appendix.java0000644000175000017500000000176512644165236021637 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Appendix extends SectionElement { private static final String tagName = "appendix"; Appendix() { super(tagName); setFormatType(FORMAT_BLOCK); } public static String getTag() { return tagName; } }src/java/org/dbdoclet/tag/docbook/Rhs.java0000644000175000017500000000166412644165236020621 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Rhs extends DocBookElement { private static String tag = "rhs"; public static String getTag() { return tag; } Rhs() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Glossdef.java0000644000175000017500000000170312644165236021625 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Glossdef extends DocBookElement { private static String tag = "glossdef"; public static String getTag() { return tag; } Glossdef() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Msgtext.java0000644000175000017500000000170012644165236021507 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Msgtext extends DocBookElement { private static String tag = "msgtext"; public static String getTag() { return tag; } Msgtext() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Mediaobject.java0000644000175000017500000000157012644165236022267 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Mediaobject extends DocBookElement { Mediaobject() { super("mediaobject"); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Country.java0000644000175000017500000000170012644165236021517 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Country extends DocBookElement { private static String tag = "country"; public static String getTag() { return tag; } Country() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Seglistitem.java0000644000175000017500000000171412644165236022352 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Seglistitem extends DocBookElement { private static String tag = "seglistitem"; public static String getTag() { return tag; } Seglistitem() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Para.java0000644000175000017500000000176012644165236020745 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Para extends DocBookElement { private static String tag = "para"; public static String getTag() { return tag; } Para() { super(tag); setFormatType(FORMAT_CONTENT); } Para(String text) { this(); appendChild(text); } } src/java/org/dbdoclet/tag/docbook/Symbol.java0000644000175000017500000000167512644165236021334 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Symbol extends DocBookElement { private static String tag = "symbol"; public static String getTag() { return tag; } Symbol() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Systemitem.java0000644000175000017500000000171112644165236022221 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Systemitem extends DocBookElement { private static String tag = "systemitem"; public static String getTag() { return tag; } Systemitem() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Subscript.java0000644000175000017500000000214112644165236022032 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Subscript extends DocBookElement { private static String tag = "subscript"; Subscript() { super(tag); setFormatType(FORMAT_INLINE); } Subscript(String text) { super(tag); appendChild(text); setFormatType(FORMAT_INLINE); } public static String getTag() { return tag; } } src/java/org/dbdoclet/tag/docbook/Audioobject.java0000644000175000017500000000171412644165236022311 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Audioobject extends DocBookElement { private static String tag = "audioobject"; public static String getTag() { return tag; } Audioobject() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Bibliomset.java0000644000175000017500000000171112644165236022147 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Bibliomset extends DocBookElement { private static String tag = "bibliomset"; public static String getTag() { return tag; } Bibliomset() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Revhistory.java0000644000175000017500000000171112644165236022234 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Revhistory extends DocBookElement { private static String tag = "revhistory"; public static String getTag() { return tag; } Revhistory() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Formalpara.java0000644000175000017500000000212112644165236022136 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; import java.util.HashMap; public class Formalpara extends DocBookElement { private static String tag = "formalpara"; Formalpara() { super("formalpara"); setFormatType(FORMAT_BLOCK); } public static String getTag() { return tag; } public static HashMap getAttributeMap() { return new HashMap(); } } src/java/org/dbdoclet/tag/docbook/Function.java0000644000175000017500000000171612644165236021650 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Function extends DocBookElement { private static String tag = "function"; public static String getTag() { return tag; } Function() { super(tag); setFormatType(FORMAT_INLINE); } } src/java/org/dbdoclet/tag/docbook/Simplesect.java0000644000175000017500000000157212644165236022173 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Simplesect extends SectionElement { private final static String tag = "simplesect"; Simplesect() { super(tag); } } src/java/org/dbdoclet/tag/docbook/Ooexception.java0000644000175000017500000000163712644165236022361 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Ooexception extends DocBookElement { private static String tagName = "ooexception"; Ooexception() { super(tagName); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Locator.java0000644000175000017500000000170012644165236021457 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Locator extends DocBookElement { private static String tag = "locator"; public static String getTag() { return tag; } Locator() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Msg.java0000644000175000017500000000166412644165236020613 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Msg extends DocBookElement { private static String tag = "msg"; public static String getTag() { return tag; } Msg() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Email.java0000644000175000017500000000205712644165236021111 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; import org.dbdoclet.xiphias.XmlServices; public class Email extends DocBookElement { private static String tagName = "email"; Email() { super(tagName); setFormatType(FORMAT_INLINE); } Email(String text) { this(); appendChild(XmlServices.textToXml(text)); } }src/java/org/dbdoclet/tag/docbook/Section.java0000644000175000017500000000165612644165236021472 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Section extends SectionElement { private final static String tagName = "section"; Section() { super(tagName); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Sidebar.java0000644000175000017500000000170012644165236021425 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Sidebar extends DocBookElement { private static String tag = "sidebar"; public static String getTag() { return tag; } Sidebar() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Indexterm.java0000644000175000017500000000156312644165236022022 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Indexterm extends DocBookElement { Indexterm() { super("indexterm"); setFormatType(FORMAT_INLINE); } } src/java/org/dbdoclet/tag/docbook/Sect3.java0000644000175000017500000000173612644165236021046 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Sect3 extends SectionElement { private final static String tag = "sect3"; Sect3() { super(tag); setFormatType(FORMAT_BLOCK); } public static String getTag() { return tag; } } src/java/org/dbdoclet/tag/docbook/Figure.java0000644000175000017500000000171112644165236021277 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Figure extends DocBookElement { private static final String tag = "figure"; public static String getTag() { return tag; } Figure() { super("figure"); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Remark.java0000644000175000017500000000167512644165236021310 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Remark extends DocBookElement { private static String tag = "remark"; public static String getTag() { return tag; } Remark() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Example.java0000644000175000017500000000215112644165236021450 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; import java.util.HashMap; public class Example extends DocBookElement { private static String tag = "example"; Example() { super(tag); setFormatType(FORMAT_BLOCK); } public static String getTag() { return tag; } public static HashMap getAttributeMap() { return new HashMap(); } } src/java/org/dbdoclet/tag/docbook/Footnoteref.java0000644000175000017500000000171412644165236022353 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Footnoteref extends DocBookElement { private static String tag = "footnoteref"; public static String getTag() { return tag; } Footnoteref() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Confnum.java0000644000175000017500000000170012644165236021461 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Confnum extends DocBookElement { private static String tag = "confnum"; public static String getTag() { return tag; } Confnum() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Surname.java0000644000175000017500000000206712644165236021475 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; import org.dbdoclet.xiphias.XmlServices; public class Surname extends DocBookElement { private static String tagName = "surname"; Surname() { super(tagName); setFormatType(FORMAT_INLINE); } Surname(String text) { this(); appendChild(XmlServices.textToXml(text)); } } src/java/org/dbdoclet/tag/docbook/Cmdsynopsis.java0000644000175000017500000000171412644165236022374 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Cmdsynopsis extends DocBookElement { private static String tag = "cmdsynopsis"; public static String getTag() { return tag; } Cmdsynopsis() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Sbr.java0000644000175000017500000000166412644165236020613 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Sbr extends DocBookElement { private static String tag = "sbr"; public static String getTag() { return tag; } Sbr() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Msgsub.java0000644000175000017500000000167512644165236021327 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Msgsub extends DocBookElement { private static String tag = "msgsub"; public static String getTag() { return tag; } Msgsub() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Tocentry.java0000644000175000017500000000170312644165236021666 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Tocentry extends DocBookElement { private static String tag = "tocentry"; public static String getTag() { return tag; } Tocentry() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Personname.java0000644000175000017500000000175112644165236022171 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Personname extends DocBookElement { private static String tag = "personname"; Personname() { super(tag); setFormatType(FORMAT_BLOCK); } public static String getTag() { return tag; } } src/java/org/dbdoclet/tag/docbook/Lineannotation.java0000644000175000017500000000172512644165236023045 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Lineannotation extends DocBookElement { private static String tag = "lineannotation"; public static String getTag() { return tag; } Lineannotation() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Shortaffil.java0000644000175000017500000000171112644165236022157 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Shortaffil extends DocBookElement { private static String tag = "shortaffil"; public static String getTag() { return tag; } Shortaffil() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Jobtitle.java0000644000175000017500000000170312644165236021633 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Jobtitle extends DocBookElement { private static String tag = "jobtitle"; public static String getTag() { return tag; } Jobtitle() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/DocBookElement.java0000644000175000017500000001266212644165236022717 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; import java.util.HashMap; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.dbdoclet.tag.ITransformPosition; import org.dbdoclet.xiphias.XmlConstants; import org.dbdoclet.xiphias.dom.ElementImpl; import org.w3c.dom.DocumentFragment; import org.w3c.dom.Node; import org.xml.sax.SAXException; public class DocBookElement extends ElementImpl { private static Log logger = LogFactory.getLog(DocBookElement.class); private DocBookVersion docBookVersion = DocBookVersion.V5_0; public static HashMap getAttributeMap() { return new HashMap(); } public boolean isValidParent(ITransformPosition pos, Node node) { if (node == null) { throw new IllegalArgumentException("Variable parent is null!"); } if (node instanceof DocumentFragment) { return true; } try { node.appendChild(this); return DocBookSchemaValidator.getInstance().validate(pos, node).isValid(); } catch (SAXException e) { logger.error("", e); return false; } finally { node.removeChild(this); } } public static void setFlavour(String flavour) { if (flavour == null) { throw new IllegalArgumentException( " The argument flavour must not be null!"); } if (flavour.equalsIgnoreCase("xml") || flavour.equalsIgnoreCase("sgml")) { flavour.toLowerCase(); } } DocBookElement(String name) { super(name); } public String getCondition() { return getAttribute("condition"); } public DocBookVersion getDocBookVersion() { return docBookVersion; } @Override public String getId() { if (docBookVersion == DocBookVersion.V4_5) { return getAttribute("id"); } else { return getAttribute("xml:id"); } } public String getRemap() { return getAttribute("remap"); } protected boolean isDocBook5() { if (docBookVersion == DocBookVersion.V5_0) { return true; } else { return false; } } public boolean isList() { String name = getNodeName(); if (name == null) { return false; } if (name.equalsIgnoreCase("orderedlist")) { return true; } if (name.equalsIgnoreCase("itemizedlist")) { return true; } if (name.equalsIgnoreCase("variablelist")) { return true; } return false; } public boolean isSection() { String name = getNodeName(); if (name.equalsIgnoreCase("book") || name.equalsIgnoreCase("article") || name.equalsIgnoreCase("chapter") || name.equalsIgnoreCase("sect1") || name.equalsIgnoreCase("sect2") || name.equalsIgnoreCase("sect3") || name.equalsIgnoreCase("sect4") || name.equalsIgnoreCase("sect5") || name.equalsIgnoreCase("section") || name.equalsIgnoreCase("refsect1") || name.equalsIgnoreCase("refsect2") || name.equalsIgnoreCase("refsect3") || name.equalsIgnoreCase("refsect4") || name.equalsIgnoreCase("refsect5") || name.equalsIgnoreCase("refsection")) { return true; } if (name.equalsIgnoreCase("sect3")) { return true; } if (name.equalsIgnoreCase("sect4")) { return true; } if (name.equalsIgnoreCase("sect5")) { return true; } if (name.equalsIgnoreCase("section")) { return true; } if (name.equalsIgnoreCase("simplesect")) { return true; } return false; } public DocBookElement setCondition(String condition) { if (condition == null) { return this; } setAttribute("condition", condition); return this; } public void setDocBookVersion(DocBookVersion docBookVersion) { this.docBookVersion = docBookVersion; } @Override public void setId(int number) { if (docBookVersion == DocBookVersion.V4_5) { setAttribute("id", String.valueOf(number)); } else { setAttribute("xml:id", String.valueOf(number)); } } @Override public void setId(String id) { if (id == null || id.length() == 0) { return; } if (docBookVersion == DocBookVersion.V5_0) { setAttributeNS(XmlConstants.NAMESPACE_XML, "xml:id", hardenId(id)); } else { setAttribute("id", hardenId(id)); } } public void setLang(String lang) { if (lang == null || lang.length() == 0) { return; } if (docBookVersion == DocBookVersion.V5_0) { setAttributeNS(XmlConstants.NAMESPACE_XML, "xml:lang", lang); } else { setAttribute("lang", lang); } } public DocBookElement setRemap(String remap) { if (remap == null) { return this; } setAttribute("remap", remap); return this; } public DocBookElement setRole(String role) { if (role == null) { return this; } setAttribute("role", role); return this; } public DocBookElement setXrefLabel(String label) { if (label == null) { return this; } setAttribute("xreflabel", label); return this; } public boolean isInline() { return getFormatType() == FORMAT_INLINE; } } src/java/org/dbdoclet/tag/docbook/Pob.java0000644000175000017500000000166412644165236020605 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Pob extends DocBookElement { private static String tag = "pob"; public static String getTag() { return tag; } Pob() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Legalnotice.java0000644000175000017500000000166512644165236022314 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Legalnotice extends DocBookElement { private static String tagName = "legalnotice"; Legalnotice() { super(tagName); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Td.java0000644000175000017500000000166112644165236020431 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Td extends DocBookElement { private static String tag = "td"; public static String getTag() { return tag; } Td() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Segmentedlist.java0000644000175000017500000000172212644165236022667 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Segmentedlist extends DocBookElement { private static String tag = "segmentedlist"; public static String getTag() { return tag; } Segmentedlist() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Trademark.java0000644000175000017500000000170612644165236021774 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Trademark extends DocBookElement { private static String tag = "trademark"; public static String getTag() { return tag; } Trademark() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Telem.java0000644000175000017500000000432412644165236021127 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; import org.dbdoclet.xiphias.dom.ElementImpl; public class Telem extends DocBookElement { Telem(String name) { super(name); } public DocBookElement addRow(DocBookElement elem) { elem.setFormatType(ElementImpl.FORMAT_INLINE); appendChild(new Row().appendChild(new Entry().appendChild(elem))); return this; } public DocBookElement addRow(Entry entry) { appendChild(new Row().appendChild(entry)); return this; } public DocBookElement addRow(String str1) { appendChild(new Row().appendChild(new Entry().appendChild( new Para(str1).setFormatType(ElementImpl.FORMAT_INLINE)))); return this; } public DocBookElement addRow(String str1, String str2) { appendChild(new Row().appendChild(new Entry().appendChild( new Para(str1).setFormatType(ElementImpl.FORMAT_INLINE))) .appendChild(new Entry().appendChild( new Para(str2).setFormatType(ElementImpl.FORMAT_INLINE)))); return this; } public DocBookElement addRow(String str1, String str2, String str3) { appendChild(new Row().appendChild(new Entry().appendChild( new Para(str1).setFormatType(ElementImpl.FORMAT_INLINE))) .appendChild(new Entry().appendChild( new Para(str2).setFormatType(ElementImpl.FORMAT_INLINE))) .appendChild(new Entry().appendChild( new Para(str3).setFormatType(ElementImpl.FORMAT_INLINE)))); return this; } } src/java/org/dbdoclet/tag/docbook/Postcode.java0000644000175000017500000000170312644165236021637 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Postcode extends DocBookElement { private static String tag = "postcode"; public static String getTag() { return tag; } Postcode() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Sect2.java0000644000175000017500000000173712644165236021046 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Sect2 extends SectionElement { private final static String tag = "sect2"; Sect2() { super(tag); setFormatType(FORMAT_BLOCK); } public static String getTag() { return tag; } } src/java/org/dbdoclet/tag/docbook/Authorinitials.java0000644000175000017500000000172512644165236023062 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Authorinitials extends DocBookElement { private static String tag = "authorinitials"; public static String getTag() { return tag; } Authorinitials() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Bibliodiv.java0000644000175000017500000000170612644165236021765 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Bibliodiv extends DocBookElement { private static String tag = "bibliodiv"; public static String getTag() { return tag; } Bibliodiv() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Bibliomisc.java0000644000175000017500000000171112644165236022132 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Bibliomisc extends DocBookElement { private static String tag = "bibliomisc"; public static String getTag() { return tag; } Bibliomisc() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Stepalternatives.java0000644000175000017500000000173312644165236023417 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Stepalternatives extends DocBookElement { private static String tag = "stepalternatives"; public static String getTag() { return tag; } Stepalternatives() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Modifier.java0000644000175000017500000000171112644165236021614 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Modifier extends DocBookElement { private static String tagName = "modifier"; Modifier() { super(tagName); } Modifier(String modifier) { this(); appendChild(modifier); } } src/java/org/dbdoclet/tag/docbook/Keysym.java0000644000175000017500000000167512644165236021350 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Keysym extends DocBookElement { private static String tag = "keysym"; public static String getTag() { return tag; } Keysym() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Label.java0000644000175000017500000000167212644165236021103 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Label extends DocBookElement { private static String tag = "label"; public static String getTag() { return tag; } Label() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Mathphrase.java0000644000175000017500000000171112644165236022152 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Mathphrase extends DocBookElement { private static String tag = "mathphrase"; public static String getTag() { return tag; } Mathphrase() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Edition.java0000644000175000017500000000170012644165236021447 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Edition extends DocBookElement { private static String tag = "edition"; public static String getTag() { return tag; } Edition() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Biblioref.java0000644000175000017500000000170612644165236021757 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Biblioref extends DocBookElement { private static String tag = "biblioref"; public static String getTag() { return tag; } Biblioref() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Authorgroup.java0000644000175000017500000000171412644165236022400 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Authorgroup extends DocBookElement { private static String tag = "authorgroup"; public static String getTag() { return tag; } Authorgroup() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Productionset.java0000644000175000017500000000172212644165236022722 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Productionset extends DocBookElement { private static String tag = "productionset"; public static String getTag() { return tag; } Productionset() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Funcparams.java0000644000175000017500000000171112644165236022155 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Funcparams extends DocBookElement { private static String tag = "funcparams"; public static String getTag() { return tag; } Funcparams() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/docbook/Issuenum.java0000644000175000017500000000170312644165236021667 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.docbook; public class Issuenum extends DocBookElement { private static String tag = "issuenum"; public static String getTag() { return tag; } Issuenum() { super(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/dita/0000755000175000017500000000000012644165236016514 5ustar mathieumathieusrc/java/org/dbdoclet/tag/dita/DitaTagFactory.java0000644000175000017500000000353512644165236022232 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.dita; import org.dbdoclet.tag.TagFactory; import org.dbdoclet.tag.docbook.DocBookElement; import org.dbdoclet.xiphias.dom.TextImpl; import org.w3c.dom.Element; public class DitaTagFactory extends TagFactory { public Abstract createAbstract() { Abstract _abstract = new Abstract(); return _abstract; } public B createB() { return new B(); } public Body createBody() { return new Body(); } public P createP() { return new P(); } public P createP(String text) { P p = new P(); p.appendChild(new TextImpl(text)); return p; } public Prolog createProlog() { return new Prolog(); } public Section createSection() { return new Section(); } public Title createTitle() { Title title = new Title(); return title; } public Title createTitle(String str) { Title title = new Title(str); return title; } public Topic createTopic() { return new Topic(); } public Tt createTt() { return new Tt(); } public U createU() { return new U(); } @Override public Element createElement(String mapTo) { return null; } @Override protected void initialize(DocBookElement elem) { } } src/java/org/dbdoclet/tag/dita/DitaElement.java0000644000175000017500000000274212644165236021557 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.dita; import org.dbdoclet.xiphias.dom.ElementImpl; public class DitaElement extends ElementImpl { public static final String DITA_NAMESPACE = "http://dita.oasis-open.org/architecture/2005/"; private boolean contentModel = false; public DitaElement(String name) { super(name); } public boolean isContentModel() { return contentModel; } protected void isContentModel(boolean contentModel) { this.contentModel = contentModel; } public boolean isValidParent(DitaElement parent) { return true; } public void setRemap(String remap) { String value = getAttribute("otherprops"); if (value == null) { value = "remap(" + remap + ")"; } else { value += " remap(" + remap + ")"; } setAttribute("otherprops", value); } } src/java/org/dbdoclet/tag/dita/Topic.java0000644000175000017500000000163012644165236020435 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.dita; public class Topic extends DitaElement { private static int topicCounter = 1; Topic() { super("topic"); setId(String.format("topic_%d", topicCounter++)); } } src/java/org/dbdoclet/tag/dita/Tt.java0000644000175000017500000000156612644165236017756 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.dita; public class Tt extends DitaElement { private static String tag = "tt"; Tt() { super(tag); setFormatType(FORMAT_INLINE); } } src/java/org/dbdoclet/tag/dita/Title.java0000644000175000017500000000227012644165236020441 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.dita; import java.util.HashMap; import org.dbdoclet.xiphias.XmlServices; public class Title extends DitaElement { private static final String tag = "title"; public static HashMap getAttributeMap() { return new HashMap(); } public static String getTag() { return tag; } Title() { super(tag); } Title(String title) { super(tag); if (title != null) { appendChild(XmlServices.textToXml(title)); } } } src/java/org/dbdoclet/tag/dita/Body.java0000644000175000017500000000147112644165236020257 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.dita; public class Body extends DitaElement { Body() { super("body"); } } src/java/org/dbdoclet/tag/dita/B.java0000644000175000017500000000156312644165236017545 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.dita; public class B extends DitaElement { private static String tag = "b"; B() { super(tag); setFormatType(FORMAT_INLINE); } } src/java/org/dbdoclet/tag/dita/U.java0000644000175000017500000000156312644165236017570 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.dita; public class U extends DitaElement { private static String tag = "u"; U() { super(tag); setFormatType(FORMAT_INLINE); } } src/java/org/dbdoclet/tag/dita/Abstract.java0000644000175000017500000000170412644165236021124 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.dita; public class Abstract extends DitaElement { private static String tagName = "abstract"; Abstract() { super(tagName); setFormatType(FORMAT_BLOCK); isContentModel(true); } } src/java/org/dbdoclet/tag/dita/P.java0000644000175000017500000000161012644165236017554 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.dita; public class P extends DitaElement { private static String tag = "p"; P() { super(tag); setNodeName(tag); setFormatType(FORMAT_CONTENT); } } src/java/org/dbdoclet/tag/dita/Prolog.java0000644000175000017500000000147712644165236020632 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.dita; public class Prolog extends DitaElement { Prolog() { super("prolog"); } } src/java/org/dbdoclet/tag/dita/Section.java0000644000175000017500000000150212644165236020761 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.dita; public class Section extends DitaElement { Section() { super("section"); } } src/java/org/dbdoclet/tag/TagFactory.java0000644000175000017500000000172012644165236020501 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag; import org.dbdoclet.tag.docbook.DocBookElement; import org.w3c.dom.Element; public abstract class TagFactory { public abstract Element createElement(String mapTo); protected abstract void initialize(DocBookElement elem); } src/java/org/dbdoclet/tag/html/0000755000175000017500000000000012644165236016537 5ustar mathieumathieusrc/java/org/dbdoclet/tag/html/Cite.java0000644000175000017500000000165112644165236020271 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; public class Cite extends InlineElement { private static final String tag = "cite"; public Cite() { setNodeName(tag); setFormatType(FORMAT_INLINE); } } src/java/org/dbdoclet/tag/html/Thead.java0000644000175000017500000000362212644165236020432 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; import java.util.HashMap; import org.dbdoclet.xiphias.dom.ElementImpl; import org.dbdoclet.xiphias.dom.NodeImpl; public class Thead extends StrictElement { private static String tag = "thead"; private static HashMap> validParentMap; static { validParentMap = new HashMap>(); validParentMap.put(Table.getTag(), HtmlElement.getAttributeMap()); } public static String getTag() { return tag; } public Thead() { setNodeName(tag); } @Override public void closed() { boolean hasRows = false; if (hasChildNodes() == true && getNumberOfChildNodes() > 0) { for (NodeImpl node : getTrafoChildNodes()) { if (node instanceof HtmlElement) { ElementImpl elem = (ElementImpl) node; if (elem instanceof Tr) { hasRows = true; } } } } if (hasRows == false) { appendChild(new Tr().appendChild(new Td())); } } @Override public void init() { } } src/java/org/dbdoclet/tag/html/BlockElement.java0000644000175000017500000000145512644165236021753 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; abstract public class BlockElement extends HtmlElement { } src/java/org/dbdoclet/tag/html/Dfn.java0000644000175000017500000000164612644165236020120 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; public class Dfn extends InlineElement { private static final String tag = "dfn"; public Dfn() { setNodeName(tag); setFormatType(FORMAT_INLINE); } } src/java/org/dbdoclet/tag/html/Param.java0000644000175000017500000000313512644165236020444 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; import java.util.HashMap; public class Param extends StrictElement { private static final String tag = "param"; private static HashMap> validParentMap; private static HashMap attributeMap; static { validParentMap = new HashMap>(); validParentMap.put(Applet.getTag(), Applet.getAttributeMap()); validParentMap.put(HtmlObject.getTag(), HtmlObject.getAttributeMap()); attributeMap = new HashMap(); } public Param() { setNodeName(tag); isEmpty(true); setAttribute("name", "param"); } public static String getTag() { return tag; } public static HashMap getAttributeMap() { return attributeMap; } @Override public void init() { } } src/java/org/dbdoclet/tag/html/Th.java0000644000175000017500000000243212644165236017756 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; import java.util.HashMap; public class Th extends TableColumnElement { private static String tag = "th"; private static HashMap> validParentMap; static { validParentMap = new HashMap>(); validParentMap.put(Tr.getTag(), HtmlElement.getAttributeMap()); } public Th() { setNodeName(tag); setFormatType(FORMAT_CONTENT); } public static String getTag() { return tag; } @Override public void init() { } } src/java/org/dbdoclet/tag/html/Small.java0000644000175000017500000000247612644165236020463 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; import java.util.HashMap; public class Small extends InlineElement { private static String tag = "small"; private static HashMap> validParentMap; static { validParentMap = new HashMap>(); validParentMap.putAll(blockElementMap); validParentMap.putAll(inlineElementMap); validParentMap.remove(Pre.getTag()); } public static String getTag() { return tag; } public Small() { super(); setNodeName(tag); setFormatType(FORMAT_INLINE); } @Override public void init() { } } src/java/org/dbdoclet/tag/html/Q.java0000644000175000017500000000246112644165236017605 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; import java.util.HashMap; public class Q extends InlineElement { private static final String tag = "q"; private static HashMap> validParentMap; static { validParentMap = new HashMap>(); validParentMap.putAll(blockElementMap); validParentMap.putAll(inlineElementMap); } public Q() { setNodeName(tag); setFormatType(FORMAT_INLINE); } @Override public void init() { } public static String getTag() { return tag; } } src/java/org/dbdoclet/tag/html/Dir.java0000644000175000017500000000211512644165236020117 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; public class Dir extends Inline2Element { private static final String tag = "dir"; public Dir() { setNodeName(tag); setFormatType(FORMAT_BLOCK); } @Override public void closed() { if ((hasChildNodes() == false) || (getNumberOfChildNodes() == 0)) { appendChild(new Li()); } } } src/java/org/dbdoclet/tag/html/Button.java0000644000175000017500000000165712644165236020666 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; public class Button extends InlineElement { private static final String tag = "button"; public Button() { setNodeName(tag); setFormatType(FORMAT_INLINE); } } src/java/org/dbdoclet/tag/html/Embed.java0000644000175000017500000000231712644165236020421 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; import java.util.HashMap; public class Embed extends InlineElement { private static final String tag = "embed"; public Embed() { setNodeName(tag); setFormatType(FORMAT_INLINE); } public static String getTag() { return tag; } @Override public void init() { if (validParentMap == null) { validParentMap = new HashMap>(); validParentMap.putAll(blockElementMap); validParentMap.putAll(inlineElementMap); } } } src/java/org/dbdoclet/tag/html/Footer.java0000644000175000017500000000253312644165236020643 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; import java.util.HashMap; public class Footer extends BlockElement { private static final String tag = "Footer"; public Footer() { setNodeName(tag); setFormatType(FORMAT_BLOCK); } public static String getTag() { return tag; } @Override public void init() { if (validParentMap == null) { validParentMap = new HashMap>(); validParentMap.putAll(blockElementMap); validParentMap.putAll(inlineElementMap); validParentMap.remove(Header.getTag()); validParentMap.remove(Footer.getTag()); } } } src/java/org/dbdoclet/tag/html/Ul.java0000644000175000017500000000527612644165236017774 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; import java.util.HashMap; public class Ul extends Inline2Element { private static String tag = "ul"; private static HashMap> validParentMap; static { validParentMap = new HashMap>(); validParentMap.put(Applet.getTag(), Applet.getAttributeMap()); validParentMap.put(Blockquote.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Body.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Button.getTag(), Button.getAttributeMap()); validParentMap.put(Center.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Dd.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Del.getTag(), Del.getAttributeMap()); validParentMap.put(Div.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Fieldset.getTag(), Fieldset.getAttributeMap()); validParentMap.put(Form.getTag(), Form.getAttributeMap()); validParentMap.put(Iframe.getTag(), Iframe.getAttributeMap()); validParentMap.put(Ins.getTag(), Ins.getAttributeMap()); validParentMap.put(Li.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Map.getTag(), Map.getAttributeMap()); validParentMap.put(Noframes.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Noscript.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(HtmlObject.getTag(), HtmlObject.getAttributeMap()); validParentMap.put(Td.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Th.getTag(), HtmlElement.getAttributeMap()); } public Ul() { super(); setNodeName(tag); setFormatType(FORMAT_BLOCK); } public static String getTag() { return tag; } @Override public void init() { } @Override public void closed() { if (hasChildNodes() == false) { appendChild(new Li()); } } } src/java/org/dbdoclet/tag/html/ReplaceElement.java0000644000175000017500000000145612644165236022275 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; abstract public class ReplaceElement extends HtmlElement { } src/java/org/dbdoclet/tag/html/HtmlElement.java0000644000175000017500000000721612644165236021626 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; import java.util.HashMap; import org.dbdoclet.xiphias.dom.ElementImpl; import org.dbdoclet.xiphias.dom.NodeImpl; import org.dbdoclet.xiphias.dom.NodeStack; public abstract class HtmlElement extends ElementImpl { protected static HashMap> blockElementMap = new HashMap>(); protected static HashMap> inlineElementMap = new HashMap>(); protected static HashMap> validParentMap; static { initBlockElementMap(); initInlineElementMap(); } public static HashMap getAttributeMap() { return new HashMap(); } public NodeStack getValidateStack() { return nodeStack; } public static String getTag() { return "HTMLElement"; } private static void initBlockElementMap() { String[] blockElements = { Address.getTag(), Article.getTag(), Aside.getTag(), Blockquote.getTag(), Body.getTag(), Center.getTag(), Dd.getTag(), Del.getTag(), Div.getTag(), Dt.getTag(), Form.getTag(), H1.getTag(), H2.getTag(), H3.getTag(), H4.getTag(), H5.getTag(), H6.getTag(), Ins.getTag(), Isindex.getTag(), Li.getTag(), Noframes.getTag(), Noscript.getTag(), P.getTag(), Pre.getTag(), Section.getTag(), Td.getTag(), Th.getTag() }; for (String blockElement : blockElements) { blockElementMap.put(blockElement, new HashMap()); } } private static void initInlineElementMap() { String[] inlineElements = { A.getTag(), Abbr.getTag(), Acronym.getTag(), Applet.getTag(), Area.getTag(), B.getTag(), Base.getTag(), Basefont.getTag(), Bdi.getTag(), Bdo.getTag(), Big.getTag(), Br.getTag(), Button.getTag(), Caption.getTag(), Cite.getTag(), Code.getTag(), Col.getTag(), Colgroup.getTag(), Command.getTag(), Datalist.getTag(), Details.getTag(), Dfn.getTag(), Em.getTag(), Embed.getTag(), Font.getTag(), I.getTag(), Img.getTag(), Input.getTag(), Iframe.getTag(), Kbd.getTag(), Label.getTag(), Legend.getTag(), HtmlObject.getTag(), Q.getTag(), S.getTag(), Samp.getTag(), Small.getTag(), Span.getTag(), Strike.getTag(), Strong.getTag(), Sub.getTag(), Sup.getTag(), Tt.getTag(), U.getTag(), Var.getTag() }; for (String inlineElement : inlineElements) { inlineElementMap.put(inlineElement, new HashMap()); } } protected NodeStack nodeStack = new NodeStack(); public HtmlElement() { super(); isCaseInsensitive(true); init(); } public HtmlElement(String name, NodeImpl parent) { super(name, parent); isCaseInsensitive(true); init(); } public void closed() { } public String getCssClass() { return getAttribute("class"); } public String getStyle() { return getAttribute("style"); } @Override public String getId() { return getAttribute("id"); } public String getTitle() { return getAttribute("title"); } public void init() { } } src/java/org/dbdoclet/tag/html/Strong.java0000644000175000017500000000164712644165236020666 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; public class Strong extends InlineElement { private static String tag = "strong"; public Strong() { setNodeName(tag); setFormatType(FORMAT_INLINE); } } src/java/org/dbdoclet/tag/html/Form.java0000644000175000017500000000171712644165236020313 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; public class Form extends ReplaceElement { private static final String tag = "form"; public Form() { setNodeName(tag); setFormatType(FORMAT_INLINE); setAttribute("action", "#"); } } src/java/org/dbdoclet/tag/html/Br.java0000644000175000017500000000162412644165236017750 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; public class Br extends InlineElement { private static final String tag = "br"; public Br() { setNodeName(tag); isEmpty(true); } } src/java/org/dbdoclet/tag/html/Noscript.java0000644000175000017500000000504712644165236021211 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; import java.util.HashMap; public class Noscript extends Inline2Element { private static final String tag = "noscript"; private static HashMap> validParentMap; static { validParentMap = new HashMap>(); validParentMap.put(Applet.getTag(), Applet.getAttributeMap()); validParentMap.put(Blockquote.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Body.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Button.getTag(), Button.getAttributeMap()); validParentMap.put(Center.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Dd.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Del.getTag(), Del.getAttributeMap()); validParentMap.put(Div.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Fieldset.getTag(), Fieldset.getAttributeMap()); validParentMap.put(Form.getTag(), Form.getAttributeMap()); validParentMap.put(Iframe.getTag(), Iframe.getAttributeMap()); validParentMap.put(Ins.getTag(), Ins.getAttributeMap()); validParentMap.put(Li.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Map.getTag(), Map.getAttributeMap()); validParentMap.put(Noframes.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Noscript.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(HtmlObject.getTag(), HtmlObject.getAttributeMap()); validParentMap.put(Td.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Th.getTag(), HtmlElement.getAttributeMap()); } public Noscript() { setNodeName("noscript"); } public static String getTag() { return tag; } @Override public void init() { } } src/java/org/dbdoclet/tag/html/Kbd.java0000644000175000017500000000246712644165236020113 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; import java.util.HashMap; public class Kbd extends InlineElement { private static final String tag = "kbd"; private static HashMap> validParentMap; static { validParentMap = new HashMap>(); validParentMap.putAll(blockElementMap); validParentMap.putAll(inlineElementMap); } public Kbd() { setNodeName(tag); setFormatType(FORMAT_INLINE); } @Override public void init() { } public static String getTag() { return tag; } } src/java/org/dbdoclet/tag/html/HtmlFragment.java0000644000175000017500000000174112644165236021775 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; import org.dbdoclet.xiphias.dom.DocumentFragmentImpl; public class HtmlFragment extends DocumentFragmentImpl { public HtmlFragment() { super(); setNodeType(DOCUMENT_FRAGMENT_NODE); setParentNode(null); } } src/java/org/dbdoclet/tag/html/Details.java0000644000175000017500000000163412644165236020773 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; public class Details extends InlineElement { private static final String tag = "details"; public Details() { setNodeName(tag); setFormatType(FORMAT_INLINE); } } src/java/org/dbdoclet/tag/html/Iframe.java0000644000175000017500000000167012644165236020611 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; public class Iframe extends InlineElement { private static final String tagName = "iframe"; public Iframe() { setNodeName(tagName); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/html/S.java0000644000175000017500000000246112644165236017607 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; import java.util.HashMap; public class S extends InlineElement { private static final String tag = "s"; private static HashMap> validParentMap; static { validParentMap = new HashMap>(); validParentMap.putAll(blockElementMap); validParentMap.putAll(inlineElementMap); } public S() { setNodeName(tag); setFormatType(FORMAT_INLINE); } @Override public void init() { } public static String getTag() { return tag; } } src/java/org/dbdoclet/tag/html/HeadingElement.java0000644000175000017500000000152212644165236022253 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; abstract public class HeadingElement extends StrictElement { abstract public int getLevel(); } src/java/org/dbdoclet/tag/html/Tfoot.java0000644000175000017500000000362212644165236020500 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; import java.util.HashMap; import org.dbdoclet.xiphias.dom.ElementImpl; import org.dbdoclet.xiphias.dom.NodeImpl; public class Tfoot extends StrictElement { private static String tag = "tfoot"; private static HashMap> validParentMap; static { validParentMap = new HashMap>(); validParentMap.put(Table.getTag(), HtmlElement.getAttributeMap()); } public static String getTag() { return tag; } public Tfoot() { setNodeName(tag); } @Override public void closed() { boolean hasRows = false; if (hasChildNodes() == true && getNumberOfChildNodes() > 0) { for (NodeImpl node : getTrafoChildNodes()) { if (node instanceof HtmlElement) { ElementImpl elem = (ElementImpl) node; if (elem instanceof Tr) { hasRows = true; } } } } if (hasRows == false) { appendChild(new Tr().appendChild(new Td())); } } @Override public void init() { } } src/java/org/dbdoclet/tag/html/Textarea.java0000644000175000017500000000315312644165236021161 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; import java.util.HashMap; public class Textarea extends InlineElement { private static final String tag = "textarea"; private static HashMap> validParentMap; private static HashMap attributeMap; static { validParentMap = new HashMap>(); validParentMap.putAll(blockElementMap); validParentMap.putAll(inlineElementMap); validParentMap.remove(Button.getTag()); attributeMap = new HashMap(); } public Textarea() { setNodeName(tag); setAttribute("cols", "80"); setAttribute("rows", "25"); } public static String getTag() { return tag; } public static HashMap getAttributeMap() { return attributeMap; } @Override public void init() { } } src/java/org/dbdoclet/tag/html/A.java0000644000175000017500000000206212644165236017562 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; public class A extends InlineElement { private static final String tag = "a"; public A() { setNodeName(tag); setFormatType(FORMAT_INLINE); } public String getHref() { return getAttribute("href"); } public String getName() { return getAttribute("name"); } } src/java/org/dbdoclet/tag/html/Link.java0000644000175000017500000000247412644165236020306 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; import java.util.HashMap; public class Link extends ReplaceElement { private static final String tag = "link"; private static HashMap> validParentMap; static { validParentMap = new HashMap>(); validParentMap.put(Head.getTag(), HtmlElement.getAttributeMap()); } public Link() { setNodeName(tag); setFormatType(FORMAT_CONTENT); isEmpty(true); } @Override public void init() { } public static String getTag() { return tag; } } src/java/org/dbdoclet/tag/html/Address.java0000644000175000017500000000175712644165236021001 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; public class Address extends Inline2Element { private static final String tag = "address"; public Address() { setNodeName(tag); setFormatType(FORMAT_INLINE); } public static String getTag() { return tag; } } src/java/org/dbdoclet/tag/html/HtmlDocument.java0000644000175000017500000000152212644165236022005 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; import org.dbdoclet.xiphias.dom.DocumentImpl; public class HtmlDocument extends DocumentImpl { } src/java/org/dbdoclet/tag/html/Li.java0000644000175000017500000000277012644165236017754 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; import java.util.HashMap; public class Li extends StrictElement { private static final String tag = "li"; private static HashMap> validParentMap; static { validParentMap = new HashMap>(); validParentMap.put(Dir.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Menu.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Ol.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Ul.getTag(), HtmlElement.getAttributeMap()); } public Li() { setNodeName("li"); setFormatType(FORMAT_CONTENT); } @Override public void init() { } public static String getTag() { return tag; } } src/java/org/dbdoclet/tag/html/H6.java0000644000175000017500000000517512644165236017667 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; import java.util.HashMap; public class H6 extends HeadingElement { protected static final int level = 6; private static final String tag = "h6"; private static HashMap> validParentMap; static { validParentMap = new HashMap>(); validParentMap.put(Applet.getTag(), Applet.getAttributeMap()); validParentMap.put(Blockquote.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Body.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Button.getTag(), Button.getAttributeMap()); validParentMap.put(Center.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Dd.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Del.getTag(), Del.getAttributeMap()); validParentMap.put(Div.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Fieldset.getTag(), Fieldset.getAttributeMap()); validParentMap.put(Form.getTag(), Form.getAttributeMap()); validParentMap.put(Iframe.getTag(), Iframe.getAttributeMap()); validParentMap.put(Ins.getTag(), Ins.getAttributeMap()); validParentMap.put(Li.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Map.getTag(), Map.getAttributeMap()); validParentMap.put(Noframes.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Noscript.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(HtmlObject.getTag(), HtmlObject.getAttributeMap()); validParentMap.put(Td.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Th.getTag(), HtmlElement.getAttributeMap()); } public H6() { setNodeName(tag); } public static String getTag() { return tag; } @Override public void init() { } @Override public int getLevel() { return level; } } src/java/org/dbdoclet/tag/html/Head.java0000644000175000017500000000244312644165236020246 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; import java.util.HashMap; public class Head extends ReplaceElement { private static final String tag = "head"; private static HashMap> validParentMap; static { validParentMap = new HashMap>(); validParentMap.put(Html.getTag(), HtmlElement.getAttributeMap()); } public Head() { setNodeName(tag); setFormatType(FORMAT_BLOCK); } public static String getTag() { return tag; } @Override public void init() { } } src/java/org/dbdoclet/tag/html/Samp.java0000644000175000017500000000160412644165236020303 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; public class Samp extends InlineElement { private static final String tag = "samp"; public Samp() { setNodeName(tag); } } src/java/org/dbdoclet/tag/html/Var.java0000644000175000017500000000246112644165236020135 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; import java.util.HashMap; public class Var extends InlineElement { private static String tag = "var"; private static HashMap> validParentMap; static { validParentMap = new HashMap>(); validParentMap.putAll(blockElementMap); validParentMap.putAll(inlineElementMap); } public Var() { setNodeName(tag); setFormatType(FORMAT_INLINE); } public static String getTag() { return tag; } @Override public void init() { } } src/java/org/dbdoclet/tag/html/Style.java0000644000175000017500000000304312644165236020502 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; import java.util.HashMap; public class Style extends ReplaceElement { private static final String tag = "style"; private static HashMap> validParentMap; private static HashMap attributeMap; static { validParentMap = new HashMap>(); validParentMap.put(Head.getTag(), HtmlElement.getAttributeMap()); attributeMap = new HashMap(); } public Style() { setNodeName(tag); setFormatType(FORMAT_BLOCK); setAttribute("type", "text/css"); } public static String getTag() { return tag; } public static HashMap getAttributeMap() { return attributeMap; } @Override public void init() { } } src/java/org/dbdoclet/tag/html/Font.java0000644000175000017500000000164712644165236020320 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; public class Font extends InlineElement { private static final String tag = "font"; public Font() { setNodeName(tag); setFormatType(FORMAT_INLINE); } } src/java/org/dbdoclet/tag/html/Table.java0000644000175000017500000001501112644165236020427 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; import java.util.ArrayList; import java.util.HashMap; import org.dbdoclet.xiphias.dom.ElementImpl; import org.dbdoclet.xiphias.dom.NodeImpl; import org.dbdoclet.xiphias.dom.NodeListImpl; public class Table extends Inline2Element { private static String tag = "table"; private static HashMap> validParentMap; static { validParentMap = new HashMap>(); validParentMap.put(Applet.getTag(), Applet.getAttributeMap()); validParentMap.put(Blockquote.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Body.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Button.getTag(), Button.getAttributeMap()); validParentMap.put(Center.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Dd.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Del.getTag(), Del.getAttributeMap()); validParentMap.put(Div.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Fieldset.getTag(), Fieldset.getAttributeMap()); validParentMap.put(Form.getTag(), Form.getAttributeMap()); validParentMap.put(Iframe.getTag(), Iframe.getAttributeMap()); validParentMap.put(Ins.getTag(), Ins.getAttributeMap()); validParentMap.put(Li.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Map.getTag(), Map.getAttributeMap()); validParentMap.put(Noframes.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Noscript.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(HtmlObject.getTag(), HtmlObject.getAttributeMap()); validParentMap.put(Td.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Th.getTag(), HtmlElement.getAttributeMap()); } public static String getTag() { return tag; } private boolean hasHead = false; private boolean hasFoot = false; private String caption = ""; private final ArrayList widthList = new ArrayList(); public Table() { setNodeName(tag); setFormatType(FORMAT_BLOCK); } @Override public void closed() { boolean hasRows = false; if (hasChildNodes() == true && getNumberOfChildNodes() > 0) { for (NodeImpl child : getTrafoChildNodes()) { if (child instanceof HtmlElement) { ElementImpl elem = (ElementImpl) child; if (elem instanceof Tr || elem instanceof Tbody) { hasRows = true; } } } } if (hasRows == false) { appendChild(new Tr().appendChild(new Td())); } } private String cmpWidth(String width1, String width2) { if (((width1 == null) || (width1.length() == 0)) && ((width2 == null) || (width2.length() == 0))) { return ""; } // end of if () if ((width1 == null) || (width1.length() == 0)) { return width2; } if ((width2 == null) || (width2.length() == 0)) { return width1; } if (width1.endsWith("%") && !width2.endsWith("%")) { return width1; } if (width2.endsWith("%") && !width1.endsWith("%")) { return width2; } int w1 = widthToNumber(width1); int w2 = widthToNumber(width2); if (w1 > w2) { return width1; } else { return width2; } } public String getCaption() { return caption; } public ArrayList getColWidths() { getNumOfCols(); return widthList; } public int getNumOfCols() { int n; int cols = 0; widthList.clear(); for (NodeImpl child : getTrafoChildNodes()) { if (child instanceof Caption) { caption = child.getTextContent(); } if (child instanceof Thead) { hasHead = true; for (NodeImpl row : child.getTrafoChildNodes()) { if (row instanceof Tr) { n = getNumOfColsInRow((Tr) row); if (n > cols) { cols = n; } } } } if (child instanceof Tfoot) { hasFoot = true; for (NodeImpl row : child.getTrafoChildNodes()) { if (row instanceof Tr) { n = getNumOfColsInRow((Tr) row); if (n > cols) { cols = n; } } } } if (child instanceof Tbody) { for (NodeImpl row : child.getTrafoChildNodes()) { if (row instanceof Tr) { n = getNumOfColsInRow((Tr) row); if (n > cols) { cols = n; } } } } if (child instanceof Tr) { n = getNumOfColsInRow((Tr) child); if (n > cols) { cols = n; } } } if (cols < 0) { return 0; } return cols; } private int getNumOfColsInRow(Tr row) { int index = 0; int colspans = 0; String width; String val; NodeListImpl cols = row.getTrafoChildNodes(); widthList.ensureCapacity(cols.size()); for (NodeImpl node : cols) { if (node instanceof TableColumnElement) { TableColumnElement col = (TableColumnElement) node; width = col.getWidth(); if (widthList.size() >= (index + 1)) { val = widthList.get(index); } else { val = ""; } if (widthList.size() <= index) { widthList.add(index, cmpWidth(val, width)); } else { widthList.set(index, cmpWidth(val, width)); } index++; col.setIndex(index + colspans); if (col.getColspan() > 1) { /* Eine Spalte wird standardmäßig hinzugefügt. Deshalb muß eine von colspan abgezogen werden. */ colspans += col.getColspan() - 1; } } } return index; } public boolean hasBorder() { String attr = getAttribute("border"); if ((attr == null) || (attr.length() == 0) || attr.equals("0")) { return false; } else { return true; } } public boolean hasFoot() { return hasFoot; } public boolean hasHead() { return hasHead; } private int widthToNumber(String width) { StringBuffer buffer = new StringBuffer(); char c; for (int i = 0; i < width.length(); i++) { c = width.charAt(i); if (Character.isDigit(c)) { buffer.append(c); } else { break; } } int w; try { w = Integer.parseInt(buffer.toString()); } catch (NumberFormatException oops) { w = 1; } return w; } } src/java/org/dbdoclet/tag/html/H5.java0000644000175000017500000000517512644165236017666 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; import java.util.HashMap; public class H5 extends HeadingElement { protected static final int level = 5; private static final String tag = "h5"; private static HashMap> validParentMap; static { validParentMap = new HashMap>(); validParentMap.put(Applet.getTag(), Applet.getAttributeMap()); validParentMap.put(Blockquote.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Body.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Button.getTag(), Button.getAttributeMap()); validParentMap.put(Center.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Dd.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Del.getTag(), Del.getAttributeMap()); validParentMap.put(Div.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Fieldset.getTag(), Fieldset.getAttributeMap()); validParentMap.put(Form.getTag(), Form.getAttributeMap()); validParentMap.put(Iframe.getTag(), Iframe.getAttributeMap()); validParentMap.put(Ins.getTag(), Ins.getAttributeMap()); validParentMap.put(Li.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Map.getTag(), Map.getAttributeMap()); validParentMap.put(Noframes.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Noscript.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(HtmlObject.getTag(), HtmlObject.getAttributeMap()); validParentMap.put(Td.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Th.getTag(), HtmlElement.getAttributeMap()); } public H5() { setNodeName(tag); } public static String getTag() { return tag; } @Override public void init() { } @Override public int getLevel() { return level; } } src/java/org/dbdoclet/tag/html/Fieldset.java0000644000175000017500000000234412644165236021144 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; import org.dbdoclet.xiphias.dom.NodeImpl; import org.dbdoclet.xiphias.dom.TextImpl; public class Fieldset extends ReplaceElement { private static final String tag = "fieldset"; public Fieldset() { setNodeName(tag); setFormatType(FORMAT_BLOCK); } @Override public void closed() { NodeImpl child = getFirstChild(); if (!(child instanceof Legend)) { insertChild(0, new Legend().appendChild(new TextImpl("Legend"))); } } } src/java/org/dbdoclet/tag/html/Command.java0000644000175000017500000000163412644165236020764 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; public class Command extends InlineElement { private static final String tag = "command"; public Command() { setNodeName(tag); setFormatType(FORMAT_INLINE); } } src/java/org/dbdoclet/tag/html/H3.java0000644000175000017500000000517512644165236017664 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; import java.util.HashMap; public class H3 extends HeadingElement { protected static final int level = 3; private static final String tag = "h3"; private static HashMap> validParentMap; static { validParentMap = new HashMap>(); validParentMap.put(Applet.getTag(), Applet.getAttributeMap()); validParentMap.put(Blockquote.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Body.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Button.getTag(), Button.getAttributeMap()); validParentMap.put(Center.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Dd.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Del.getTag(), Del.getAttributeMap()); validParentMap.put(Div.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Fieldset.getTag(), Fieldset.getAttributeMap()); validParentMap.put(Form.getTag(), Form.getAttributeMap()); validParentMap.put(Iframe.getTag(), Iframe.getAttributeMap()); validParentMap.put(Ins.getTag(), Ins.getAttributeMap()); validParentMap.put(Li.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Map.getTag(), Map.getAttributeMap()); validParentMap.put(Noframes.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Noscript.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(HtmlObject.getTag(), HtmlObject.getAttributeMap()); validParentMap.put(Td.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Th.getTag(), HtmlElement.getAttributeMap()); } public H3() { setNodeName(tag); } public static String getTag() { return tag; } @Override public void init() { } @Override public int getLevel() { return level; } } src/java/org/dbdoclet/tag/html/Inline2Element.java0000644000175000017500000000156712644165236022225 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; public abstract class Inline2Element extends HtmlElement { public Inline2Element() { super(); setFormatType(FORMAT_INLINE); } } src/java/org/dbdoclet/tag/html/Tt.java0000644000175000017500000000243612644165236017776 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; import java.util.HashMap; public class Tt extends InlineElement { private static String tag = "tt"; private static HashMap> validParentMap; static { validParentMap = new HashMap>(); validParentMap.putAll(blockElementMap); validParentMap.putAll(inlineElementMap); } public Tt() { setNodeName(tag); } public static String getTag() { return tag; } @Override public void init() { super.init(); } } src/java/org/dbdoclet/tag/html/TableColumnElement.java0000644000175000017500000000563312644165236023130 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; public abstract class TableColumnElement extends StrictElement { private int index = -1; public String getWidth() { String width = getAttribute("width"); if ((width == null) || (width.length() == 0)) { return ""; } else { return width; } } public int getColspan() { String str = getAttribute("colspan"); if ((str == null) || (str.length() == 0)) { return 1; } int colspan; try { colspan = Integer.parseInt(str); } catch (NumberFormatException oops) { colspan = 1; } return colspan; } public int getRowspan() { String str = getAttribute("rowspan"); if ((str == null) || (str.length() == 0)) { return 0; } int rowspan; try { rowspan = Integer.parseInt(str); rowspan--; } catch (NumberFormatException oops) { rowspan = 0; } // end of catch if (rowspan < 0) { rowspan = 0; } return rowspan; } public String getAlign() { return getAttribute("align"); } public String getVAlign() { String valign = getAttribute("valign"); if ((valign == null) || (valign.length() == 0)) { return null; } if (valign.equalsIgnoreCase("top") || valign.equalsIgnoreCase("middle") || valign.equalsIgnoreCase("bottom") || valign.equalsIgnoreCase("baseline")) { return valign; } if (valign.equalsIgnoreCase("head")) { return "top"; } return "middle"; } public String getChar() { return getAttribute("char"); } public String getCharOff() { return getAttribute("charoff"); } public void setIndex(int i) { index = i; } public int getIndex() { return index; } @Override public boolean validateAttributes() { String valign = getVAlign(); if (valign != null) { setAttribute("valign", valign); } return true; } } src/java/org/dbdoclet/tag/html/Colgroup.java0000644000175000017500000000166512644165236021204 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; public class Colgroup extends ReplaceElement { private static final String tag = "colgroup"; public Colgroup() { setNodeName(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/html/Select.java0000644000175000017500000000331412644165236020622 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; import java.util.HashMap; import org.dbdoclet.xiphias.dom.ElementImpl; import org.dbdoclet.xiphias.dom.NodeImpl; public class Select extends InlineElement { private static String tag = "select"; private static HashMap> validParentMap; static { validParentMap = new HashMap>(); validParentMap.putAll(blockElementMap); validParentMap.putAll(inlineElementMap); validParentMap.remove(Button.getTag()); } public Select() { setNodeName(tag); setFormatType(FORMAT_BLOCK); } @Override public void closed() { boolean hasOptions = false; if (hasChildNodes() == true && getNumberOfChildNodes() > 0) { for (NodeImpl node : getTrafoChildNodes()) { if (node instanceof HtmlElement) { ElementImpl elem = (ElementImpl) node; if (elem instanceof Option) { hasOptions = true; } } } } if (hasOptions == false) { appendChild(new Option()); } } } src/java/org/dbdoclet/tag/html/H4.java0000644000175000017500000000517512644165236017665 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; import java.util.HashMap; public class H4 extends HeadingElement { protected static final int level = 4; private static final String tag = "h4"; private static HashMap> validParentMap; static { validParentMap = new HashMap>(); validParentMap.put(Applet.getTag(), Applet.getAttributeMap()); validParentMap.put(Blockquote.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Body.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Button.getTag(), Button.getAttributeMap()); validParentMap.put(Center.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Dd.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Del.getTag(), Del.getAttributeMap()); validParentMap.put(Div.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Fieldset.getTag(), Fieldset.getAttributeMap()); validParentMap.put(Form.getTag(), Form.getAttributeMap()); validParentMap.put(Iframe.getTag(), Iframe.getAttributeMap()); validParentMap.put(Ins.getTag(), Ins.getAttributeMap()); validParentMap.put(Li.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Map.getTag(), Map.getAttributeMap()); validParentMap.put(Noframes.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Noscript.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(HtmlObject.getTag(), HtmlObject.getAttributeMap()); validParentMap.put(Td.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Th.getTag(), HtmlElement.getAttributeMap()); } public H4() { setNodeName(tag); } public static String getTag() { return tag; } @Override public void init() { } @Override public int getLevel() { return level; } } src/java/org/dbdoclet/tag/html/Col.java0000644000175000017500000000167612644165236020131 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; public class Col extends ReplaceElement { private static final String tag = "col"; public Col() { setNodeName(tag); setFormatType(FORMAT_INLINE); isEmpty(true); } } src/java/org/dbdoclet/tag/html/Map.java0000644000175000017500000000333312644165236020121 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; import java.util.HashMap; public class Map extends InlineElement { private static final String tag = "map"; private static HashMap> validParentMap; private static HashMap attributeMap; static { validParentMap = new HashMap>(); validParentMap.putAll(blockElementMap); validParentMap.putAll(inlineElementMap); attributeMap = new HashMap(); } public Map() { setNodeName(tag); setFormatType(FORMAT_BLOCK); setAttribute("name", "map"); } public static String getTag() { return tag; } public static HashMap getAttributeMap() { return attributeMap; } @Override public void init() { } @Override public void closed() { if ((getChildNodes() == null) || (getChildNodes().getLength() == 0)) { appendChild(new Area()); } } } src/java/org/dbdoclet/tag/html/Em.java0000644000175000017500000000164212644165236017746 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; public class Em extends InlineElement { private static final String tag = "em"; public Em() { setNodeName(tag); setFormatType(FORMAT_INLINE); } } src/java/org/dbdoclet/tag/html/Sup.java0000644000175000017500000000245712644165236020161 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; import java.util.HashMap; public class Sup extends InlineElement { private static String tag = "sup"; private static HashMap> validParentMap; static { validParentMap = new HashMap>(); validParentMap.putAll(blockElementMap); validParentMap.putAll(inlineElementMap); validParentMap.remove(Pre.getTag()); } public static String getTag() { return tag; } public Sup() { setNodeName(tag); setFormatType(FORMAT_INLINE); } @Override public void init() { } } src/java/org/dbdoclet/tag/html/Bdi.java0000644000175000017500000000171012644165236020077 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; public class Bdi extends InlineElement { private static final String tag = "bdi"; public Bdi() { setNodeName(tag); setFormatType(FORMAT_INLINE); setAttribute("dir", "ltr"); } } src/java/org/dbdoclet/tag/html/Input.java0000644000175000017500000000525612644165236020511 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; import java.util.HashMap; public class Input extends InlineElement { private static final String tag = "input"; private static HashMap> validParentMap; private static HashMap attributeMap; static { validParentMap = new HashMap>(); validParentMap.putAll(blockElementMap); validParentMap.putAll(inlineElementMap); validParentMap.remove("button"); attributeMap = new HashMap(); attributeMap.put("accept", ""); attributeMap.put("accesskey", ""); attributeMap.put("align", "top, middle, bottom, left, center, right"); attributeMap.put("alt", ""); attributeMap.put("checked", ""); attributeMap.put("datafld", ""); attributeMap.put("datasrc", ""); attributeMap.put("dataformatas", ""); attributeMap.put("disabled", ""); attributeMap.put("id", ""); attributeMap.put("ismap", ""); attributeMap.put("maxlength", ""); attributeMap.put("name", ""); attributeMap.put("onblur", ""); attributeMap.put("onchange", ""); attributeMap.put("onfocus", ""); attributeMap.put("onselect", ""); attributeMap.put("readonly", ""); attributeMap.put("size", ""); attributeMap.put("src", ""); attributeMap.put("tabindex", ""); attributeMap.put("", ""); attributeMap.put("type", "text, password, checkbox, radio, submit, reset, file, hidden, image, button"); attributeMap.put("usemap", ""); attributeMap.put("value", ""); } public Input() { setNodeName(tag); setFormatType(FORMAT_INLINE); isEmpty(true); } public static String getTag() { return tag; } public static HashMap getAttributeMap() { return attributeMap; } @Override public void init() { } } src/java/org/dbdoclet/tag/html/Article.java0000644000175000017500000000171712644165236020773 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; public class Article extends Inline2Element { private static final String tag = "article"; public Article() { setNodeName(tag); setFormatType(FORMAT_BLOCK); } public static String getTag() { return tag; } } src/java/org/dbdoclet/tag/html/Blockquote.java0000644000175000017500000000472512644165236021522 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; import java.util.HashMap; public class Blockquote extends Inline2Element { private static final String tag = "blockquote"; private static HashMap> validParentMap; static { validParentMap = new HashMap>(); validParentMap.put(Applet.getTag(), Applet.getAttributeMap()); validParentMap.put(Blockquote.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Body.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Button.getTag(), Button.getAttributeMap()); validParentMap.put(Center.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Dd.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Del.getTag(), Del.getAttributeMap()); validParentMap.put(Div.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Form.getTag(), Form.getAttributeMap()); validParentMap.put(Iframe.getTag(), Iframe.getAttributeMap()); validParentMap.put(Ins.getTag(), Ins.getAttributeMap()); validParentMap.put(Li.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Map.getTag(), Map.getAttributeMap()); validParentMap.put(Noframes.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Noscript.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(HtmlObject.getTag(), HtmlObject.getAttributeMap()); validParentMap.put(Td.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Th.getTag(), HtmlElement.getAttributeMap()); } public Blockquote() { setNodeName(tag); setFormatType(FORMAT_BLOCK); } public static String getTag() { return tag; } } src/java/org/dbdoclet/tag/html/I.java0000644000175000017500000000264412644165236017600 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; import java.util.HashMap; public class I extends InlineElement { private static final String tag = "i"; private static HashMap> validParentMap; static { validParentMap = new HashMap>(); validParentMap.putAll(blockElementMap); validParentMap.putAll(inlineElementMap); validParentMap.put(Caption.getTag(), HtmlElement.getAttributeMap()); validParentMap.remove("var"); } public I() { setNodeName(tag); setFormatType(FORMAT_INLINE); } @Override public void init() { } public static String getTag() { return tag; } } src/java/org/dbdoclet/tag/html/Code.java0000644000175000017500000000165112644165236020257 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; public class Code extends InlineElement { private static final String tag = "code"; public Code() { setNodeName(tag); setFormatType(FORMAT_INLINE); } } src/java/org/dbdoclet/tag/html/Html.java0000644000175000017500000000170312644165236020307 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; public class Html extends StrictElement { private static final String tag = "html"; public static String getTag() { return tag; } public Html() { setNodeName(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/html/Title.java0000644000175000017500000000244712644165236020472 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; import java.util.HashMap; public class Title extends StrictElement { private static final String tag = "title"; private static HashMap> validParentMap; static { validParentMap = new HashMap>(); validParentMap.put(Head.getTag(), HtmlElement.getAttributeMap()); } public Title() { setNodeName(tag); setFormatType(FORMAT_CONTENT); } @Override public void init() { } public static String getTag() { return tag; } } src/java/org/dbdoclet/tag/html/Strike.java0000644000175000017500000000232012644165236020640 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; import java.util.HashMap; public class Strike extends InlineElement { private static String tag = "strike"; private static HashMap> validParentMap; static { validParentMap = new HashMap>(); validParentMap.putAll(blockElementMap); validParentMap.putAll(inlineElementMap); } public static String getTag() { return tag; } public Strike() { setNodeName(tag); setFormatType(FORMAT_INLINE); } } src/java/org/dbdoclet/tag/html/Body.java0000644000175000017500000000252612644165236020304 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; import java.util.HashMap; public class Body extends ReplaceElement { private static final String tag = "body"; private static HashMap> validParentMap; private static HashMap attributeMap; static { validParentMap = new HashMap>(); validParentMap.put(Html.getTag(), HtmlElement.getAttributeMap()); attributeMap = new HashMap(); attributeMap.put("bgcolor", "white"); } public Body() { setNodeName(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/html/Caption.java0000644000175000017500000000164612644165236021006 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; public class Caption extends ReplaceElement { private static final String tag = "caption"; public Caption() { setNodeName(tag); setFormatType(FORMAT_CONTENT); } } src/java/org/dbdoclet/tag/html/Ins.java0000644000175000017500000000306212644165236020134 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; import java.util.HashMap; public class Ins extends InlineElement { private static final String tag = "ins"; private static HashMap> validParentMap; private static HashMap attributeMap; static { validParentMap = new HashMap>(); validParentMap.putAll(blockElementMap); validParentMap.putAll(inlineElementMap); validParentMap.remove("button"); attributeMap = new HashMap(); } public Ins() { setNodeName(tag); setFormatType(FORMAT_INLINE); } public static String getTag() { return tag; } public static HashMap getAttributeMap() { return attributeMap; } @Override public void init() { } } src/java/org/dbdoclet/tag/html/Optgroup.java0000644000175000017500000000432012644165236021220 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; import java.util.HashMap; import org.dbdoclet.xiphias.dom.ElementImpl; import org.dbdoclet.xiphias.dom.NodeImpl; public class Optgroup extends StrictElement { private static final String tag = "optgroup"; private static HashMap> validParentMap; private static HashMap attributeMap; static { validParentMap = new HashMap>(); validParentMap.put(Select.getTag(), HtmlElement.getAttributeMap()); attributeMap = new HashMap(); } public static HashMap getAttributeMap() { return attributeMap; } public static String getTag() { return tag; } public Optgroup() { setNodeName(tag); setFormatType(FORMAT_BLOCK); setAttribute("label", "Optgroup"); } @Override public void closed() { boolean hasOptions = false; if (hasChildNodes() == true && getNumberOfChildNodes() > 0) { for (NodeImpl node : getTrafoChildNodes()) { if (node instanceof HtmlElement) { ElementImpl elem = (ElementImpl) node; if (elem instanceof Option) { hasOptions = true; } } } } if (hasOptions == false) { appendChild(new Option()); } } @Override public void init() { } } src/java/org/dbdoclet/tag/html/Noframes.java0000644000175000017500000000473112644165236021161 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; import java.util.HashMap; public class Noframes extends Inline2Element { private static final String tag = "noframes"; private static HashMap> validParentMap; static { validParentMap = new HashMap>(); validParentMap.put(Applet.getTag(), Applet.getAttributeMap()); validParentMap.put(Blockquote.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Body.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Button.getTag(), Button.getAttributeMap()); validParentMap.put(Center.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Dd.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Del.getTag(), Del.getAttributeMap()); validParentMap.put(Div.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Fieldset.getTag(), Fieldset.getAttributeMap()); validParentMap.put(Form.getTag(), Form.getAttributeMap()); validParentMap.put(Iframe.getTag(), Iframe.getAttributeMap()); validParentMap.put(Ins.getTag(), Ins.getAttributeMap()); validParentMap.put(Li.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Map.getTag(), Map.getAttributeMap()); validParentMap.put(Noscript.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(HtmlObject.getTag(), HtmlObject.getAttributeMap()); validParentMap.put(Td.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Th.getTag(), HtmlElement.getAttributeMap()); } public Noframes() { setNodeName("noframes"); } public static String getTag() { return tag; } @Override public void init() { } } src/java/org/dbdoclet/tag/html/Legend.java0000644000175000017500000000245312644165236020604 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; import java.util.HashMap; public class Legend extends StrictElement { private static final String tag = "legend"; private static HashMap> validParentMap; static { validParentMap = new HashMap>(); validParentMap.put(Fieldset.getTag(), Fieldset.getAttributeMap()); } public Legend() { setNodeName(tag); setFormatType(FORMAT_CONTENT); } @Override public void init() { } public static String getTag() { return tag; } } src/java/org/dbdoclet/tag/html/Center.java0000644000175000017500000000166012644165236020625 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; public class Center extends Inline2Element { private static final String tag = "center"; public Center() { setNodeName(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/html/B.java0000644000175000017500000000161112644165236017562 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; public class B extends InlineElement { private static final String tag = "b"; public B() { setNodeName(tag); setFormatType(FORMAT_INLINE); } } src/java/org/dbdoclet/tag/html/StrictElement.java0000644000175000017500000000145612644165236022172 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; public abstract class StrictElement extends HtmlElement { } src/java/org/dbdoclet/tag/html/Tbody.java0000644000175000017500000000362212644165236020466 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; import java.util.HashMap; import org.dbdoclet.xiphias.dom.ElementImpl; import org.dbdoclet.xiphias.dom.NodeImpl; public class Tbody extends StrictElement { private static String tag = "tbody"; private static HashMap> validParentMap; static { validParentMap = new HashMap>(); validParentMap.put(Table.getTag(), HtmlElement.getAttributeMap()); } public static String getTag() { return tag; } public Tbody() { setNodeName(tag); } @Override public void closed() { boolean hasRows = false; if (hasChildNodes() == true && getNumberOfChildNodes() > 0) { for (NodeImpl node : getTrafoChildNodes()) { if (node instanceof HtmlElement) { ElementImpl elem = (ElementImpl) node; if (elem instanceof Tr) { hasRows = true; } } } } if (hasRows == false) { appendChild(new Tr().appendChild(new Td())); } } @Override public void init() { } } src/java/org/dbdoclet/tag/html/Script.java0000644000175000017500000000277012644165236020654 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; import java.util.HashMap; public class Script extends InlineElement { private static final String tag = "script"; private static HashMap> validParentMap; private static HashMap attributeMap; static { validParentMap = new HashMap>(); validParentMap.putAll(blockElementMap); validParentMap.putAll(inlineElementMap); validParentMap.put(Head.getTag(), HtmlElement.getAttributeMap()); attributeMap = new HashMap(); } public Script() { setNodeName(tag); setAttribute("type", "javascript"); } public static HashMap getAttributeMap() { return attributeMap; } } src/java/org/dbdoclet/tag/html/Basefont.java0000644000175000017500000000176212644165236021151 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; public class Basefont extends InlineElement { private static final String tag = "basefont"; public Basefont() { setNodeName(tag); setFormatType(FORMAT_INLINE); isEmpty(true); setAttribute("size", "12px"); } } src/java/org/dbdoclet/tag/html/Dt.java0000644000175000017500000000164312644165236017755 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; public class Dt extends ReplaceElement { private static final String tag = "dt"; public Dt() { setNodeName(tag); setFormatType(FORMAT_CONTENT); } } src/java/org/dbdoclet/tag/html/InlineElement.java0000644000175000017500000000156512644165236022141 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; abstract public class InlineElement extends HtmlElement { public InlineElement() { super(); setFormatType(FORMAT_INLINE); } }src/java/org/dbdoclet/tag/html/Area.java0000644000175000017500000000163412644165236020256 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; public class Area extends ReplaceElement { public Area() { setNodeName("area"); setFormatType(FORMAT_CONTENT); isEmpty(true); setAttribute("alt", "area"); } } src/java/org/dbdoclet/tag/html/H2.java0000644000175000017500000000175412644165236017662 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; public class H2 extends HeadingElement { protected static final int level = 2; private static final String tag = "h2"; public H2() { setNodeName(tag); } @Override public int getLevel() { return level; } } src/java/org/dbdoclet/tag/html/Dd.java0000644000175000017500000000157612644165236017742 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; public class Dd extends ReplaceElement { private static final String tag = "dd"; public Dd() { setNodeName(tag); } } src/java/org/dbdoclet/tag/html/Del.java0000644000175000017500000000164612644165236020115 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; public class Del extends InlineElement { private static final String tag = "del"; public Del() { setNodeName(tag); setFormatType(FORMAT_INLINE); } } src/java/org/dbdoclet/tag/html/Isindex.java0000644000175000017500000000476312644165236021017 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; import java.util.HashMap; public class Isindex extends Inline2Element { private static final String tag = "isindex"; private static HashMap> validParentMap; static { validParentMap = new HashMap>(); validParentMap.put(Applet.getTag(), Applet.getAttributeMap()); validParentMap.put(Blockquote.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Body.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Center.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Dd.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Del.getTag(), Del.getAttributeMap()); validParentMap.put(Div.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Fieldset.getTag(), Fieldset.getAttributeMap()); validParentMap.put(Form.getTag(), Form.getAttributeMap()); validParentMap.put(Iframe.getTag(), Iframe.getAttributeMap()); validParentMap.put(Ins.getTag(), Ins.getAttributeMap()); validParentMap.put(Li.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Map.getTag(), Map.getAttributeMap()); validParentMap.put(Noframes.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Noscript.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(HtmlObject.getTag(), HtmlObject.getAttributeMap()); validParentMap.put(Td.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Th.getTag(), HtmlElement.getAttributeMap()); } public Isindex() { setNodeName("isindex"); isEmpty(true); } public static String getTag() { return tag; } @Override public void init() { } } src/java/org/dbdoclet/tag/html/Meta.java0000644000175000017500000000252712644165236020276 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; import java.util.HashMap; public class Meta extends ReplaceElement { private static final String tag = "meta"; private static HashMap> validParentMap; static { validParentMap = new HashMap>(); validParentMap.put(Head.getTag(), HtmlElement.getAttributeMap()); } public Meta() { setNodeName("meta"); setFormatType(FORMAT_CONTENT); isEmpty(true); } public static String getTag() { return tag; } public String getName() { return getAttribute("name"); } public String getContent() { return getAttribute("content"); } } src/java/org/dbdoclet/tag/html/Dl.java0000644000175000017500000000215412644165236017743 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; public class Dl extends Inline2Element { private static final String tag = "dl"; public Dl() { setNodeName(tag); setFormatType(FORMAT_BLOCK); } @Override public void closed() { if (hasChildNodes() == false || getNumberOfChildNodes() == 0) { appendChild(new Dt()); appendChild(new Dd()); } } } src/java/org/dbdoclet/tag/html/H1.java0000644000175000017500000000176212644165236017660 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; public class H1 extends HeadingElement { private static final String tag = "h1"; protected static final int level = 1; public H1() { setNodeName(tag); setFormatType(FORMAT_BLOCK); } @Override public int getLevel() { return level; } } src/java/org/dbdoclet/tag/html/Menu.java0000644000175000017500000000531312644165236020310 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; import java.util.HashMap; public class Menu extends Inline2Element { private static final String tag = "menu"; private static HashMap> validParentMap; static { validParentMap = new HashMap>(); validParentMap.put(Applet.getTag(), Applet.getAttributeMap()); validParentMap.put(Blockquote.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Body.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Button.getTag(), Button.getAttributeMap()); validParentMap.put(Center.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Dd.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Del.getTag(), Del.getAttributeMap()); validParentMap.put(Div.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Fieldset.getTag(), Fieldset.getAttributeMap()); validParentMap.put(Form.getTag(), Form.getAttributeMap()); validParentMap.put(Iframe.getTag(), Iframe.getAttributeMap()); validParentMap.put(Ins.getTag(), Ins.getAttributeMap()); validParentMap.put(Li.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Map.getTag(), Map.getAttributeMap()); validParentMap.put(Noframes.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Noscript.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(HtmlObject.getTag(), HtmlObject.getAttributeMap()); validParentMap.put(Td.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Th.getTag(), HtmlElement.getAttributeMap()); } public Menu() { setNodeName("menu"); } public static String getTag() { return tag; } @Override public void init() { } @Override public void closed() { if (hasChildNodes() == false || getNumberOfChildNodes() == 0) { appendChild(new Li()); } // end of if () } } src/java/org/dbdoclet/tag/html/U.java0000644000175000017500000000252012644165236017605 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; import java.util.HashMap; public class U extends InlineElement { private static String tag = "u"; private static HashMap> validParentMap; static { validParentMap = new HashMap>(); validParentMap.putAll(blockElementMap); validParentMap.putAll(inlineElementMap); validParentMap.remove("var"); } public U() { setNodeName(tag); setFormatType(FORMAT_INLINE); } public static String getTag() { return tag; } @Override public void init() { } } src/java/org/dbdoclet/tag/html/Option.java0000644000175000017500000000304312644165236020652 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; import java.util.HashMap; public class Option extends StrictElement { private static final String tag = "option"; private static HashMap> validParentMap; private static HashMap attributeMap; static { validParentMap = new HashMap>(); validParentMap.put(Select.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Optgroup.getTag(), Optgroup.getAttributeMap()); attributeMap = new HashMap(); } public Option() { setNodeName(tag); } public static String getTag() { return tag; } public static HashMap getAttributeMap() { return attributeMap; } @Override public void init() { } } src/java/org/dbdoclet/tag/html/Frame.java0000644000175000017500000000165412644165236020442 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; public class Frame extends StrictElement { private static final String tag = "frame"; public Frame() { setNodeName(tag); setFormatType(FORMAT_CONTENT); } } src/java/org/dbdoclet/tag/html/Tr.java0000644000175000017500000000526112644165236017773 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; import java.util.HashMap; import org.dbdoclet.xiphias.dom.ElementImpl; import org.dbdoclet.xiphias.dom.NodeImpl; public class Tr extends StrictElement { private static String tagName = "tr"; private static HashMap> validParentMap; static { validParentMap = new HashMap>(); validParentMap.put(Table.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Tbody.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Thead.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Tfoot.getTag(), HtmlElement.getAttributeMap()); } public static String getTag() { return tagName; } public Tr() { setNodeName(tagName); setFormatType(FORMAT_BLOCK); } @Override public void closed() { boolean hasColumns = false; if (hasChildNodes() == true && getNumberOfChildNodes() > 0) { for (NodeImpl node : getTrafoChildNodes()) { if (node instanceof HtmlElement) { ElementImpl elem = (ElementImpl) node; if (elem instanceof TableColumnElement) { hasColumns = true; } } } } if (hasColumns == false) { appendChild(new Td()); } } @Override public void init() { } @Override public boolean validateAttributes() { String valign = getAttribute("valign"); if (valign != null) { if (valign.equalsIgnoreCase("top") == false && valign.equalsIgnoreCase("middle") == false && valign.equalsIgnoreCase("bottom") == false && valign.equalsIgnoreCase("baseline") == false) { setAttribute("valign", "middle"); } } return true; } public Integer getHeight() { return getIntAttribute("height"); } } src/java/org/dbdoclet/tag/html/Bdo.java0000644000175000017500000000246112644165236020111 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; import java.util.HashMap; public class Bdo extends InlineElement { private static final String tag = "bdo"; private static HashMap> validParentMap; static { validParentMap = new HashMap>(); validParentMap.putAll(blockElementMap); validParentMap.putAll(inlineElementMap); } public Bdo() { setNodeName(tag); setFormatType(FORMAT_INLINE); setAttribute("dir", "ltr"); } public static String getTag() { return tag; } } src/java/org/dbdoclet/tag/html/Aside.java0000644000175000017500000000175112644165236020433 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; public class Aside extends Inline2Element { private static final String tag = "aside"; public Aside() { setNodeName(tag); setFormatType(FORMAT_BLOCK); } public static String getTag() { return tag; } } src/java/org/dbdoclet/tag/html/Span.java0000644000175000017500000000274712644165236020315 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; import java.util.HashMap; public class Span extends InlineElement { private static final String tag = "span"; private static HashMap> validParentMap; private static HashMap attributeMap; static { validParentMap = new HashMap>(); validParentMap.putAll(blockElementMap); validParentMap.putAll(inlineElementMap); attributeMap = new HashMap(); } public Span() { setNodeName(tag); } public static String getTag() { return tag; } public static HashMap getAttributeMap() { return attributeMap; } @Override public void init() { } } src/java/org/dbdoclet/tag/html/Div.java0000644000175000017500000000164512644165236020132 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; public class Div extends Inline2Element { private static final String tag = "div"; public Div() { setNodeName(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/html/P.java0000644000175000017500000000172112644165236017602 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; public class P extends Inline2Element { private static String tag = "p"; public static String getTag() { return tag; } public P() { setNodeName(tag); setFormatType(FORMAT_CONTENT); } } src/java/org/dbdoclet/tag/html/Frameset.java0000644000175000017500000000166312644165236021156 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; public class Frameset extends StrictElement { private static final String tag = "frameset"; public Frameset() { setNodeName(tag); setFormatType(FORMAT_BLOCK); } } src/java/org/dbdoclet/tag/html/Acronym.java0000644000175000017500000000175612644165236021023 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; public class Acronym extends InlineElement { private static final String tag = "acronym"; public static String getTag() { return tag; } public Acronym() { setNodeName(tag); setFormatType(FORMAT_INLINE); } } src/java/org/dbdoclet/tag/html/Img.java0000644000175000017500000000466112644165236020125 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; import java.util.HashMap; public class Img extends InlineElement { private static final String tagName = "img"; private static HashMap> validParentMap; private static HashMap attributeMap; static { validParentMap = new HashMap>(); validParentMap.putAll(blockElementMap); validParentMap.putAll(inlineElementMap); validParentMap.remove("var"); attributeMap = new HashMap(); attributeMap.put("align", "top, middle, bottom, left, center, right"); attributeMap.put("alt", ""); attributeMap.put("border", ""); attributeMap.put("height", ""); attributeMap.put("hspace", ""); attributeMap.put("ismap", ""); attributeMap.put("longdesc", ""); attributeMap.put("name", ""); attributeMap.put("src", ""); attributeMap.put("usemap", ""); attributeMap.put("vspace", ""); attributeMap.put("width", ""); } public Img() { setNodeName("img"); setFormatType(FORMAT_INLINE); isEmpty(true); setAttribute("alt", "image"); setAttribute("src", "image.png"); } public static String getTag() { return tagName; } @Override public void init() { } public String getSrc() { return getAttribute("src"); } public String getAlt() { return getAttribute("alt"); } public String getWidth() { return getAttribute("width"); } public String getHeight() { return getAttribute("height"); } public String getAlign() { return getAttribute("align"); } } src/java/org/dbdoclet/tag/html/Header.java0000644000175000017500000000253312644165236020575 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; import java.util.HashMap; public class Header extends BlockElement { private static final String tag = "header"; public Header() { setNodeName(tag); setFormatType(FORMAT_BLOCK); } public static String getTag() { return tag; } @Override public void init() { if (validParentMap == null) { validParentMap = new HashMap>(); validParentMap.putAll(blockElementMap); validParentMap.putAll(inlineElementMap); validParentMap.remove(Header.getTag()); validParentMap.remove(Footer.getTag()); } } } src/java/org/dbdoclet/tag/html/Section.java0000644000175000017500000000240512644165236021007 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; import java.util.HashMap; public class Section extends Inline2Element { private static final String tag = "section"; public Section() { setNodeName(tag); setFormatType(FORMAT_BLOCK); } public static String getTag() { return tag; } @Override public void init() { if (validParentMap == null) { validParentMap = new HashMap>(); validParentMap.putAll(blockElementMap); validParentMap.putAll(inlineElementMap); } } } src/java/org/dbdoclet/tag/html/HtmlObject.java0000644000175000017500000000321312644165236021434 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; import java.util.HashMap; public class HtmlObject extends InlineElement { private static final String tag = "object"; private static HashMap> validParentMap; private static HashMap attributeMap; static { validParentMap = new HashMap>(); validParentMap.putAll(blockElementMap); validParentMap.putAll(inlineElementMap); validParentMap.put(Head.getTag(), HtmlElement.getAttributeMap()); validParentMap.remove("pre"); attributeMap = new HashMap(); } public HtmlObject() { setNodeName(tag); setFormatType(FORMAT_INLINE); } public static String getTag() { return tag; } public static HashMap getAttributeMap() { return attributeMap; } @Override public void init() { } } src/java/org/dbdoclet/tag/html/Big.java0000644000175000017500000000301412644165236020101 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; import java.util.HashMap; public class Big extends InlineElement { private static final String tag = "big"; private static HashMap> validParentMap; private static HashMap attributeMap; static { validParentMap = new HashMap>(); validParentMap.putAll(blockElementMap); validParentMap.putAll(inlineElementMap); validParentMap.remove(Pre.getTag()); attributeMap = new HashMap(); } public Big() { setNodeName(tag); setFormatType(FORMAT_INLINE); } public static String getTag() { return tag; } public static HashMap getAttributeMap() { return attributeMap; } } src/java/org/dbdoclet/tag/html/Base.java0000644000175000017500000000165112644165236020257 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; public class Base extends ReplaceElement { private static final String tag = "base"; public Base() { setNodeName(tag); setFormatType(FORMAT_INLINE); } } src/java/org/dbdoclet/tag/html/Datalist.java0000644000175000017500000000163712644165236021156 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; public class Datalist extends InlineElement { private static final String tag = "datalist"; public Datalist() { setNodeName(tag); setFormatType(FORMAT_INLINE); } } src/java/org/dbdoclet/tag/html/Td.java0000644000175000017500000000243212644165236017752 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; import java.util.HashMap; public class Td extends TableColumnElement { private static String tag = "td"; private static HashMap> validParentMap; static { validParentMap = new HashMap>(); validParentMap.put(Tr.getTag(), HtmlElement.getAttributeMap()); } public Td() { setNodeName(tag); setFormatType(FORMAT_CONTENT); } public static String getTag() { return tag; } @Override public void init() { } } src/java/org/dbdoclet/tag/html/Sub.java0000644000175000017500000000246112644165236020136 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; import java.util.HashMap; public class Sub extends InlineElement { private static String tag = "sub"; private static HashMap> validParentMap; static { validParentMap = new HashMap>(); validParentMap.putAll(blockElementMap); validParentMap.putAll(inlineElementMap); validParentMap.remove(Pre.getTag()); } public Sub() { setNodeName(tag); setFormatType(FORMAT_INLINE); } public static String getTag() { return tag; } } src/java/org/dbdoclet/tag/html/Ol.java0000644000175000017500000000506712644165236017764 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; import java.util.HashMap; public class Ol extends Inline2Element { private static String tag = "ol"; private static HashMap> validParentMap; static { validParentMap = new HashMap>(); validParentMap.put(Applet.getTag(), Applet.getAttributeMap()); validParentMap.put(Blockquote.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Body.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Button.getTag(), Button.getAttributeMap()); validParentMap.put(Center.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Dd.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Del.getTag(), Del.getAttributeMap()); validParentMap.put(Div.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Fieldset.getTag(), Fieldset.getAttributeMap()); validParentMap.put(Form.getTag(), Form.getAttributeMap()); validParentMap.put(Iframe.getTag(), Iframe.getAttributeMap()); validParentMap.put(Ins.getTag(), Ins.getAttributeMap()); validParentMap.put(Li.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Map.getTag(), Map.getAttributeMap()); validParentMap.put(Noframes.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Noscript.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(HtmlObject.getTag(), HtmlObject.getAttributeMap()); validParentMap.put(Td.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Th.getTag(), HtmlElement.getAttributeMap()); } public static String getTag() { return tag; } public Ol() { setNodeName(tag); setFormatType(FORMAT_BLOCK); } @Override public void closed() { if ((getChildNodes() == null) || (getChildNodes().getLength() == 0)) { appendChild(new Li()); } // end of if () } @Override public void init() { } } src/java/org/dbdoclet/tag/html/Pre.java0000644000175000017500000000463212644165236020135 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; import java.util.HashMap; public class Pre extends Inline2Element { private static final String tag = "pre"; private static HashMap> validParentMap; static { validParentMap = new HashMap>(); validParentMap.put(Applet.getTag(), Applet.getAttributeMap()); validParentMap.put(Blockquote.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Body.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Button.getTag(), Button.getAttributeMap()); validParentMap.put(Center.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Dd.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Del.getTag(), Del.getAttributeMap()); validParentMap.put(Div.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Fieldset.getTag(), Fieldset.getAttributeMap()); validParentMap.put(Form.getTag(), Form.getAttributeMap()); validParentMap.put(Iframe.getTag(), Iframe.getAttributeMap()); validParentMap.put(Ins.getTag(), Ins.getAttributeMap()); validParentMap.put(Li.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Map.getTag(), Map.getAttributeMap()); validParentMap.put(Noframes.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Noscript.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(HtmlObject.getTag(), HtmlObject.getAttributeMap()); validParentMap.put(Td.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Th.getTag(), HtmlElement.getAttributeMap()); new HashMap(); } public static String getTag() { return tag; } public Pre() { setNodeName(tag); } @Override public void init() { } } src/java/org/dbdoclet/tag/html/Abbr.java0000644000175000017500000000164712644165236020260 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; public class Abbr extends InlineElement { private static final String tag = "abbr"; public Abbr() { setNodeName(tag); setFormatType(FORMAT_INLINE); } } src/java/org/dbdoclet/tag/html/Label.java0000644000175000017500000000314112644165236020420 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; import java.util.HashMap; public class Label extends InlineElement { private static final String tag = "label"; private static HashMap> validParentMap; private static HashMap attributeMap; static { validParentMap = new HashMap>(); validParentMap.putAll(blockElementMap); validParentMap.putAll(inlineElementMap); validParentMap.remove("button"); validParentMap.remove("label"); attributeMap = new HashMap(); } public Label() { setNodeName(tag); setFormatType(FORMAT_INLINE); } public static String getTag() { return tag; } public static HashMap getAttributeMap() { return attributeMap; } @Override public void init() { } } src/java/org/dbdoclet/tag/html/Hr.java0000644000175000017500000000505012644165236017753 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; import java.util.HashMap; public class Hr extends Inline2Element { private static final String tag = "hr"; private static HashMap> validParentMap; static { validParentMap = new HashMap>(); validParentMap.put(Applet.getTag(), Applet.getAttributeMap()); validParentMap.put(Blockquote.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Body.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Button.getTag(), Button.getAttributeMap()); validParentMap.put(Center.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Dd.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Del.getTag(), Del.getAttributeMap()); validParentMap.put(Div.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Fieldset.getTag(), Fieldset.getAttributeMap()); validParentMap.put(Form.getTag(), Form.getAttributeMap()); validParentMap.put(Iframe.getTag(), Iframe.getAttributeMap()); validParentMap.put(Ins.getTag(), Ins.getAttributeMap()); validParentMap.put(Li.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Map.getTag(), Map.getAttributeMap()); validParentMap.put(Noframes.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Noscript.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(HtmlObject.getTag(), HtmlObject.getAttributeMap()); validParentMap.put(Td.getTag(), HtmlElement.getAttributeMap()); validParentMap.put(Th.getTag(), HtmlElement.getAttributeMap()); } public Hr() { setNodeName("hr"); isEmpty(true); } public static String getTag() { return tag; } @Override public void init() { } } src/java/org/dbdoclet/tag/html/Applet.java0000644000175000017500000000207112644165236020627 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.tag.html; public class Applet extends InlineElement { private static final String tag = "applet"; public Applet() { setNodeName(tag); setFormatType(FORMAT_INLINE); setAttribute("width", "400"); setAttribute("height", "300"); } public static String getTag() { return tag; } } src/java/org/dbdoclet/ServiceException.java0000644000175000017500000000166212644165236021147 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet; public class ServiceException extends Exception { private static final long serialVersionUID = 1L; public ServiceException(Throwable oops) { super(oops.getMessage()); } } src/java/org/dbdoclet/ValidationResult.java0000644000175000017500000000207312644165236021156 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet; public class ValidationResult { private boolean valid = false; private String message = null; public boolean isValid() { return valid; } public void setValid(boolean valid) { this.valid = valid; } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } } src/java/org/dbdoclet/xiphias/0000755000175000017500000000000012644165244016464 5ustar mathieumathieusrc/java/org/dbdoclet/xiphias/NodeSerializer.java0000644000175000017500000004073612644165236022261 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.xiphias; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.StringWriter; import java.io.Writer; import java.util.ArrayList; import java.util.HashMap; import java.util.Stack; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.dbdoclet.Sfv; import org.dbdoclet.progress.ProgressEvent; import org.dbdoclet.progress.ProgressListener; import org.dbdoclet.xiphias.dom.DocumentImpl; import org.dbdoclet.xiphias.dom.ElementImpl; import org.dbdoclet.xiphias.dom.NodeImpl; import org.dbdoclet.xiphias.dom.TextImpl; import org.w3c.dom.CDATASection; import org.w3c.dom.Comment; import org.w3c.dom.Document; import org.w3c.dom.DocumentType; import org.w3c.dom.Element; import org.w3c.dom.Entity; import org.w3c.dom.EntityReference; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.w3c.dom.ProcessingInstruction; import org.w3c.dom.Text; public class NodeSerializer { private static final String INDENT = " "; private static Log logger = LogFactory.getLog(NodeSerializer.class); private HashMap chunkElementSet; private HashMap chunkOutMap; private Stack chunkElementStack; private ArrayList listeners; private int literalContext = 0; private String encoding = "UTF-8"; private File systemId; private Element documentElement; private boolean validation = false; private boolean indentation = true; public NodeSerializer() { chunkElementSet = new HashMap(); chunkOutMap = new HashMap(); chunkElementStack = new Stack(); } private Writer addChunk(String indent, Node node, Writer out) throws IOException { if (systemId == null) { return out; } File baseDir = systemId.getParentFile(); String tagName = node.getNodeName(); int maxDepth = chunkElementSet.get(tagName); int depth = getDepth(node); /* Die Schachtelungstiefe ist tiefer als der eingestellte Wert für die maximale Tiefe. * Es wird kein Chunk erstellt. */ if (depth > maxDepth) { return out; } int pos = getChunkIndex(node); chunkElementStack.push(new Integer(pos)); String fileName = ""; for (Integer i : chunkElementStack) { if (fileName.equals("")) { fileName = String.valueOf(i); } else { fileName = String.format("%s.%d", fileName, i); } } fileName = String.format("%s-%s.xml", tagName, fileName); File incFile = new File(baseDir, fileName); logger.debug(String.format("Creating chunk file %s", fileName)); out.write(indent + "" + Sfv.LSEP); out = new OutputStreamWriter(new FileOutputStream(incFile), encoding); writeXmlDeclaration(out); if (node instanceof Element) { Element element = (Element) node; if (documentElement != null) { W3cServices.copyNamespaces(documentElement, element); } String version = documentElement.getAttribute("version"); if (version != null) { element.setAttribute("version", version); } String lang = documentElement.getAttributeNS(XmlConstants.NAMESPACE_XML, "lang"); if (lang != null) { element.setAttributeNS(XmlConstants.NAMESPACE_XML, "xml:lang", lang); } if (W3cServices.hasNamespace(element, XmlConstants.NAMESPACE_XINCLUDE) == false) { W3cServices.setAttribute(node, "xmlns:xi", XmlConstants.NAMESPACE_XINCLUDE); } } chunkOutMap.put(node, out); return out; } private int getChunkIndex(Node node) { Node parentNode = node.getParentNode(); if (parentNode == null) { return 0; } NodeList childList = parentNode.getChildNodes(); int pos = 0; for (int i = 0; i < childList.getLength(); i++) { Node child = childList.item(i); if (chunkElementSet.get(child.getNodeName()) != null) { pos++; } if (child == node) { break; } } return pos; } private int getDepth(Node node) { int depth = 0; String tagName = node.getNodeName(); if (tagName == null) { return depth; } Node parentNode = node; while (parentNode != null) { if (tagName.equals(parentNode.getNodeName())) { depth++; } parentNode = parentNode.getParentNode(); } return depth; } public void addChunkElement(String nodeName) { addChunkElement(nodeName, 1); } public void addChunkElement(String nodeName, int depth) { chunkElementSet.put(nodeName, depth); } public void addProgressListener(ProgressListener listener) { if (listener == null) { return; } if (listeners == null) { listeners = new ArrayList(); } listeners.add(listener); } public void addProgressListeners(ArrayList newListeners) { if (newListeners == null) { return; } if (listeners == null) { listeners = new ArrayList(); } listeners.addAll(newListeners); } private void fireProgressEvent(ProgressEvent event) { if (listeners != null) { for (ProgressListener listener : listeners) { listener.progress(event); } } } private boolean isInsideLiteralElement() { if (literalContext > 0) { return true; } return false; } protected boolean isInsideLiteralElement(Text text) { Node parent = text.getParentNode(); while (parent != null) { if (parent instanceof ElementImpl) { ElementImpl elem = (ElementImpl) parent; if (elem.isLiteral()) { return true; } } } return false; } private String resolveEntityReference(String entityName) { if (entityName == null) { return null; } if (entityName.equals("linefeed")) { return "#x0A"; } return entityName; } public void setProgressListeners(ArrayList listeners) { this.listeners = listeners; } public String toXML(Node node) { try { StringWriter buffer = new StringWriter(); NodeSerializer serializer = new NodeSerializer(); serializer.write(node, buffer); return buffer.toString(); } catch (IOException oops) { return oops.getMessage(); } } public void write(Node node, File file) throws IOException { if (node == null) { throw new IllegalArgumentException( "The argument node must not be null!"); } if (file == null) { throw new IllegalArgumentException( "The argument file must not be null!"); } FileOutputStream fos = null; OutputStreamWriter out = null; try { this.systemId = file; fos = new FileOutputStream(file); out = new OutputStreamWriter(fos, encoding); write(node, out, ""); } finally { if (out != null) { out.close(); } this.systemId = null; this.encoding = "UTF-8"; this.documentElement = null; } } public void write(Node node, OutputStream out) throws IOException { write(node, new OutputStreamWriter(out)); } public void write(Node node, Writer out) throws IOException { write(node, out, ""); } public void write(Node node, Writer out, boolean inMixedContent, String indent) throws IOException { if (node == null) { throw new IllegalArgumentException( "The argument node must not be null!"); } if (out == null) { throw new IllegalArgumentException( "The argument out must not be null!"); } ProgressEvent event = new ProgressEvent(node.toString()); fireProgressEvent(event); if (isValidationEnabled()) { Node parent = node.getParentNode(); StringBuilder buffer = new StringBuilder(); buffer.append(node.getNodeName()); while (parent != null) { buffer.insert(0, parent.getNodeName() + " -> "); if (parent == node) { logger.fatal(String.format("Endless self referncing loop ! %s", buffer.toString())); return; } parent = parent.getParentNode(); } } if (chunkElementSet.get(node.getNodeName()) != null) { out = addChunk(indent, node, out); indent = ""; } // logger.debug("node=" + node); switch (node.getNodeType()) { case Node.DOCUMENT_FRAGMENT_NODE: writeFragmentNode(node, out); break; case Node.DOCUMENT_NODE: writeDocumentNode(node, out); break; case Node.DOCUMENT_TYPE_NODE: writeDocumentTypeNode((DocumentType) node, out); break; case Node.ENTITY_NODE: writeEntityNode(node, out); break; case Node.ENTITY_REFERENCE_NODE: writeEntityReferenceNode(node, out); break; case Node.ELEMENT_NODE: try { writeElementNode(node, out, inMixedContent, indent); } catch (StackOverflowError oops) { logger.fatal("[NodeSerializer.write] StackOverflowError. Self referencing recursive structure detected!!! Node: " + node.toString()); } break; case Node.TEXT_NODE: writeTextNode(node, out); break; case Node.CDATA_SECTION_NODE: writeDataSectionNode(node, out); break; case Node.COMMENT_NODE: writeCommentNode(node, out, indent); break; case Node.PROCESSING_INSTRUCTION_NODE: writeProcessingInstructionNode(node, out, indent); break; } closeChunk(node); } private void closeChunk(Node node) throws IOException { Writer out = chunkOutMap.get(node); if (out != null) { logger.debug(String.format("Closing chunk for Node %s:%s", node.getNodeName(), node.hashCode())); out.close(); if (chunkElementStack.empty() == false) { chunkElementStack.pop(); } } } public void write(Node node, Writer out, String indent) throws IOException { write(node, out, false, indent); } private void writeCommentNode(Node node, Writer out, String indent) throws IOException { Comment comment = (Comment) node; out.write(indent + ""); out.write(Sfv.LSEP); } private void writeDataSectionNode(Node node, Writer out) throws IOException { CDATASection cdata = (CDATASection) node; out.write(""); } private void writeDocumentNode(Node node, Writer out) throws IOException { Document tdoc = (Document) node; Element documentElement = tdoc.getDocumentElement(); if (documentElement != null) { this.documentElement = documentElement; if (tdoc instanceof DocumentImpl) { out.write(((DocumentImpl) tdoc).createXmlDeclaration()); } else { writeXmlDeclaration(out); } DocumentType docType = tdoc.getDoctype(); if (docType != null) { writeDocumentTypeNode(docType, out); } if (W3cServices.hasNamespace(documentElement, XmlConstants.NAMESPACE_XINCLUDE) == false) { documentElement.setAttribute("xmlns:xi", XmlConstants.NAMESPACE_XINCLUDE); } write(documentElement, out, ""); } else { NodeList children = tdoc.getChildNodes(); if (children != null && children.getLength() != 0) { for (int i = 0; i < children.getLength(); i++) { write(children.item(i), out, ""); out.write(Sfv.LSEP); } } } } private void writeXmlDeclaration(Writer out) throws IOException { out.write("" + Sfv.LSEP); } public void writeDocumentTypeNode(DocumentType docType, Writer out) throws IOException { out.write(" 0) { out.write(" PUBLIC '" + docType.getPublicId() + "'"); } else { out.write(" SYSTEM"); } out.write(" '" + docType.getSystemId() + "'"); NamedNodeMap entityMap = docType.getEntities(); if (entityMap != null && entityMap.getLength() > 0) { out.write("[" + Sfv.LSEP); for (int i = 0; i < entityMap.getLength(); i++) { Entity entity = (Entity) entityMap.item(i); out.write("" + Sfv.LSEP); } out.write("]"); } out.write(">"); out.write(Sfv.LSEP); } private void writeElementNode(Node node, Writer out, boolean inMixedContent, String indent) throws IOException { Element elem = (Element) node; String name = elem.getNodeName(); ElementImpl elemImpl = null; if (elem instanceof ElementImpl) { elemImpl = (ElementImpl) elem; } if (inMixedContent == false) { out.write(indent); out.write('<'); out.write(name); } else { out.write('<'); out.write(name); } if (elemImpl != null) { String attributesAsText = elemImpl.getAttributesAsText(); if (attributesAsText != null && attributesAsText.length() > 0) { out.write(' '); out.write(attributesAsText); } if (elemImpl.isLiteral()) { literalContext++; } } else { out.write(W3cServices.getAttributesAsText(elem)); } NodeList children = elem.getChildNodes(); if (children != null && children.getLength() != 0) { out.write(">"); boolean hasMixedContent = false; for (int i = 0; i < children.getLength(); i++) { Node child = children.item(i); if (child.getNodeType() == Node.ENTITY_REFERENCE_NODE) { hasMixedContent = true; } if (child.getNodeType() == Node.TEXT_NODE) { String buffer = child.getTextContent(); if (buffer != null && buffer.trim().length() > 0) { hasMixedContent = true; } } } if (elemImpl != null) { if (elemImpl.getFormatType() != NodeImpl.FORMAT_BLOCK) { hasMixedContent = true; } } if (hasMixedContent == false) { out.write(Sfv.LSEP); } for (int i = 0; i < children.getLength(); i++) { if (isIndentationEnabled()) { write(children.item(i), out, hasMixedContent, indent + INDENT); } else { write(children.item(i), out, hasMixedContent, ""); } } if (hasMixedContent == false) { out.write(indent + ""); out.write(Sfv.LSEP); } else { out.write(""); if (inMixedContent == false) { out.write(Sfv.LSEP); } } } else { out.write("/>"); if (inMixedContent == false && (elemImpl == null || elemImpl.getFormatType() != NodeImpl.FORMAT_INLINE)) { out.write(Sfv.LSEP); } } if (elemImpl != null && elemImpl.isLiteral()) { literalContext--; } } private void writeEntityNode(Node node, Writer out) throws IOException { Entity entity = (Entity) node; out.write("&" + entity.getNodeName() + ";"); } private void writeEntityReferenceNode(Node node, Writer out) throws IOException { EntityReference entityReference = (EntityReference) node; out.write("&" + resolveEntityReference(entityReference.getNodeName()) + ";"); } private void writeFragmentNode(Node node, Writer out) throws IOException { NodeList nodes; nodes = node.getChildNodes(); if (nodes != null) { for (int i = 0; i < nodes.getLength(); i++) { write(nodes.item(i), out, ""); } } } private void writeProcessingInstructionNode(Node node, Writer out, String indent) throws IOException { ProcessingInstruction pi = (ProcessingInstruction) node; out.write(indent + ""); out.write(Sfv.LSEP); } private void writeTextNode(Node node, Writer out) throws IOException { Text text = (Text) node; String data = text.getData(); // logger.info("text=[" + data + "]"); if (data != null) { if (isInsideLiteralElement() == false) { data = XmlServices.normalizeText(data); } } if (text instanceof TextImpl) { if (((TextImpl) text).isRawData() == true) { out.write(data); } else { out.write(XmlServices.textToXml(data)); } } else { out.write(XmlServices.textToXml(data)); } } public void setSystemId(File systemId) { this.systemId = systemId; } public void setEncoding(String encoding) { this.encoding = encoding; } public void setValidationEnabled(boolean validation) { this.validation = validation; } public boolean isValidationEnabled() { return validation; } public void setIndentationEnabled(boolean indentation) { this.indentation = indentation; } public boolean isIndentationEnabled() { return indentation; } } src/java/org/dbdoclet/xiphias/XPathServices.java0000644000175000017500000001065212644165236022064 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.xiphias; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import org.apache.commons.jxpath.CompiledExpression; import org.apache.commons.jxpath.JXPathContext; import org.apache.commons.jxpath.JXPathException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.w3c.dom.Node; public class XPathServices { private static Log logger = LogFactory.getLog(XPathServices.class); public static Object getValue(Object contextBean, String query) { return getValue(contextBean, null, null, query); } /** * Die Methode getValue liefert den Wert eines Kontent. * * @param contextBean * Object * @param query * String * @return Object */ public static Object getValue(Object contextBean, String namespace, String namespaceUrl, String query) { Object obj = null; JXPathContext context = JXPathContext.newContext(contextBean); if (namespace != null && namespaceUrl != null) { context.registerNamespace(namespace, namespaceUrl); } CompiledExpression expr = JXPathContext.compile(query); try { obj = expr.getValue(context); } catch (JXPathException oops) { logger.debug("JXPathException: " + oops.getMessage()); obj = null; } return obj; } public static ArrayList getValues(Object contextBean, String query) { return getValues(contextBean, null, null, query); } @SuppressWarnings("unchecked") public static ArrayList getValues(Object contextBean, String namespace, String namespaceUrl, String query) { Object obj = null; JXPathContext context = JXPathContext.newContext(contextBean); if (namespace != null && namespaceUrl != null) { context.registerNamespace(namespace, namespaceUrl); } CompiledExpression expr = JXPathContext.compile(query); Iterator iterator; ArrayList list = new ArrayList(); try { // Unchecked iterator iterator = expr.iterate(context); while (iterator.hasNext()) { obj = iterator.next(); if (obj != null) { list.add(obj.toString()); } } } catch (JXPathException oops) { oops.printStackTrace(); } return list; } public static ArrayList getNodes(Object contextBean, String query) { return getNodes(contextBean, null, null, query); } public static ArrayList getNodes(Object contextBean, String namespace, String namespaceUrl, String query) { JXPathContext context = JXPathContext.newContext(contextBean); if (namespace != null && namespaceUrl != null) { context.registerNamespace(namespace, namespaceUrl); } List list = context.selectNodes(query); ArrayList nodeList = new ArrayList(); for (Object obj : list) { if (obj instanceof Node) { nodeList.add((Node) obj); } } return nodeList; } public static Node getNode(Object contextBean, String query) { return getNode(contextBean, null, null, query); } public static Node getNode(Object contextBean, String namespace, String namespaceUrl, String query) { ArrayList list = getNodes(contextBean, namespace, namespaceUrl, query); if (list.size() > 0) { return list.get(0); } else { return null; } } } src/java/org/dbdoclet/xiphias/XmlValidationResult.java0000644000175000017500000002122112644165236023300 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.xiphias; import java.io.File; import java.io.StringReader; import java.text.MessageFormat; import java.util.ArrayList; import java.util.Iterator; import java.util.Locale; import java.util.ResourceBundle; import org.dbdoclet.service.ResourceServices; import org.w3c.dom.bootstrap.DOMImplementationRegistry; import org.w3c.dom.ls.DOMImplementationLS; import org.w3c.dom.ls.LSInput; import org.w3c.dom.ls.LSResourceResolver; import org.xml.sax.ErrorHandler; import org.xml.sax.SAXParseException; /** * Die Klasse XmlValidationResult wird benachrichtigt falls beim * Parsen einer XML-Datei ein Fehler auftritt. * * Die Fehlermeldungen werden formatiert und auf System.err über * die Konsole ausgegeben. * * @author Michael Fuchs * @version 1.0 */ public class XmlValidationResult implements ErrorHandler, LSResourceResolver { private boolean hasErrors = false; private boolean fileNotFound = false; private boolean canNotRead = false; private int errorCounter = 0; private final ArrayList errorList; private final ArrayList warningList; private final ArrayList exceptionList; private Throwable throwable; private final File xmlFile; private final ResourceBundle res; private String systemId; public XmlValidationResult(File xmlFile, Locale locale) { if (locale == null) { throw new IllegalArgumentException( "The argument locale must not be null!"); } this.xmlFile = xmlFile; res = ResourceBundle .getBundle("org/dbdoclet/xiphias/Resources", locale); errorList = new ArrayList(); warningList = new ArrayList(); exceptionList = new ArrayList(); } public XmlValidationResult(File xmlFile) { this(xmlFile, Locale.getDefault()); } public XmlValidationResult(String systemId) { this(null, Locale.getDefault()); this.systemId = systemId; } public File getXmlFile() { return xmlFile; } public String getSourceDescription() { if (xmlFile != null) { return xmlFile.getAbsolutePath(); } else { if (systemId == null || systemId.length() == 0) { return "Anonymous InputStream"; } else { return systemId; } } } public boolean failed() { return hasErrors; } public void setFileNotFound(boolean fileNotFound) { this.fileNotFound = fileNotFound; String msg = MessageFormat.format(ResourceServices.getString(res, "C_XML_VALIDATION_ERROR_FILE_NOT_FOUND"), getSourceDescription()); errorList.add(msg); hasErrors = true; errorCounter++; } public boolean getFileNotFound() { return fileNotFound; } public void setCanNotRead(boolean canNotRead) { this.canNotRead = canNotRead; String msg = MessageFormat.format( res.getString("C_XML_VALIDATION_ERROR_FILE_CAN_NOT_READ"), getSourceDescription()); errorList.add(msg); hasErrors = true; errorCounter++; } public boolean getCanNotRead() { return canNotRead; } public int getNumOfErrors() { return errorCounter; } public void setThrowable(Throwable throwable) { if (throwable == null) { throw new IllegalArgumentException( "The argument throwable must not be null!"); } this.throwable = throwable; String msg = "(" + throwable.getClass().getName() + ") " + throwable.getMessage(); if (msg == null || msg.length() == 0) { msg = throwable.getClass().getName(); } msg = getSourceDescription() + ": " + msg; errorList.add(msg); hasErrors = true; errorCounter++; } public Throwable getThrowable() { return throwable; } /** * Die Methode fatalError wird bei Auftreten eines fatalen * Fehlers vom Sax-Parser aufgerufen. * * @param oops * SAXParseException */ @Override public void fatalError(SAXParseException oops) { errorCounter++; String msg = MessageFormat.format( ResourceServices.getString(res, "C_XML_VALIDATION_FATAL"), getSourceDescription(), String.valueOf(oops.getLineNumber()), String.valueOf(oops.getColumnNumber()), oops.getMessage()); errorList.add(msg); exceptionList.add(oops); hasErrors = true; } /** * Die Methode error wird bei Auftreten eines Fehlers vom * Sax-Parser aufgerufen. * * @param oops * SAXParseException */ @Override public void error(SAXParseException oops) { errorCounter++; String msg = MessageFormat.format( ResourceServices.getString(res, "C_XML_VALIDATION_ERROR"), getSourceDescription(), String.valueOf(oops.getLineNumber()), String.valueOf(oops.getColumnNumber()), oops.getMessage()); errorList.add(msg); exceptionList.add(oops); hasErrors = true; } /** * Die Methode warning wird bei Auftreten einer Warnung vom * SAX-Parser aufgerufen. * * @param oops * SAXParseException */ @Override public void warning(SAXParseException oops) { String msg = MessageFormat.format( ResourceServices.getString(res, "C_XML_VALIDATION_WARNING"), getSourceDescription(), String.valueOf(oops.getLineNumber()), String.valueOf(oops.getColumnNumber()), oops.getMessage()); warningList.add(msg); // exceptionList.add(oops); } public String createTextReport() { return createReport(false); } public String createHtmlReport() { return createReport(true); } public String createReport(boolean isHtml) { String msg; StringBuffer buffer = new StringBuffer(); buffer.append('\n'); if (isHtml) { buffer.append("

      "); } msg = MessageFormat.format( ResourceServices.getString(res, "C_XML_VALIDATION_OF_FILE"), getSourceDescription()); buffer.append(msg); if (isHtml) { buffer.append("

      "); } Iterator iterator = warningList.iterator(); while (iterator.hasNext()) { if (isHtml) { buffer.append("
      ");
      			}
      
      			buffer.append('\n');
      
      			msg = iterator.next();
      			buffer.append(msg);
      
      			if (isHtml) {
      				buffer.append("
      "); } buffer.append('\n'); } buffer.append('\n'); if (failed() == false) { if (isHtml) { buffer.append("

      "); buffer.append(ResourceServices.getString(res, "C_XML_VALIDATION_SUCCESSFUL")); buffer.append("

      "); } else { buffer.append(ResourceServices.getString(res, "C_XML_VALIDATION_SUCCESSFUL")); } buffer.append('\n'); } else { iterator = errorList.iterator(); while (iterator.hasNext()) { if (isHtml) { buffer.append("
      ");
      				}
      
      				buffer.append('\n');
      
      				msg = iterator.next();
      				buffer.append(msg);
      
      				if (isHtml) {
      					buffer.append("
      "); } buffer.append('\n'); } buffer.append('\n'); msg = MessageFormat.format(ResourceServices.getString(res, "C_XML_VALIDATION_NUMBER_OF_ERRORS"), String .valueOf(errorCounter)); buffer.append(msg); buffer.append('\n'); if (isHtml) { buffer.append("

      "); buffer.append(ResourceServices.getString(res, "C_XML_VALIDATION_FAILED")); buffer.append("

      "); } else { buffer.append(ResourceServices.getString(res, "C_XML_VALIDATION_FAILED")); } buffer.append('\n'); } return buffer.toString(); } @Override public LSInput resolveResource(String type, String namespaceURI, String publicId, String systemId, String baseURI) { // System.out.println("XMLValidationResult: Resolving resource [type=" + // type // + ", namespaceURI=" + namespaceURI + ", publicId=" + publicId + // ", systemId=" // + systemId + ", baseURI=" + baseURI); if (systemId != null && systemId.length() > 0) { if (systemId.startsWith("http://")) { try { DOMImplementationRegistry registry = DOMImplementationRegistry .newInstance(); DOMImplementationLS domImpl = (DOMImplementationLS) registry .getDOMImplementation("LS"); LSInput input = domImpl.createLSInput(); input.setCharacterStream(new StringReader("")); return input; } catch (Exception oops) { oops.printStackTrace(); } } } return null; } } src/java/org/dbdoclet/xiphias/W3cServices.java0000644000175000017500000003061212644165236021472 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.xiphias; import java.util.ArrayList; import java.util.Collections; import java.util.List; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.w3c.dom.Text; public class W3cServices { public static Element getChildElement(Element parent, String childName) { if (parent == null) { throw new IllegalArgumentException("The argument parent may not be null!"); } if (childName == null) { throw new IllegalArgumentException("The argument childName may not be null!"); } Element element = null; String nodeName = null; NodeList childNodes = parent.getChildNodes(); for (int i = 0; i < childNodes.getLength(); i++) { if (childNodes.item(i) instanceof Element) { element = (Element) childNodes.item(i); nodeName = element.getNodeName(); if (nodeName != null && nodeName.equals(childName)) { return element; } } } return null; } public static List getChildElements(Element parent, String childName) { if (parent == null) { throw new IllegalArgumentException("The argument parent may not be null!"); } if (childName == null) { throw new IllegalArgumentException("The argument childName may not be null!"); } Element element = null; String nodeName = null; ArrayList children = new ArrayList(); NodeList childNodes = parent.getChildNodes(); for (int i = 0; i < childNodes.getLength(); i++) { if (childNodes.item(i) instanceof Element) { element = (Element) childNodes.item(i); nodeName = element.getNodeName(); if (nodeName != null && nodeName.equals(childName)) { children.add(element); } } } return children; } public static Element[] getElementPath(Element elem) { if (elem == null) { throw new IllegalArgumentException("The argument elem must not be null!"); } ArrayList elementList = new ArrayList(); elementList.add(elem); Node parent = elem.getParentNode(); while (parent != null) { if (parent instanceof Element) { elementList.add(parent); } parent = parent.getParentNode(); } Collections.reverse(elementList); Element[] path = new Element[elementList.size()]; for (int i = 0; i < elementList.size(); i++) { elem = (Element) elementList.get(i); path[i] = elem; } return path; } public static Element getFirstElement(Element parent) { if (parent == null) { throw new IllegalArgumentException("The argument parent may not be null!"); } NodeList childNodes = parent.getChildNodes(); for (int i = 0; i < childNodes.getLength(); i++) { if (childNodes.item(i) instanceof Element) { return (Element) childNodes.item(i); } } return null; } public static void setText(Element parent, String text) { if (parent == null) { throw new IllegalArgumentException("The argument parent must not be null!"); } NodeList childNodes = parent.getChildNodes(); if (childNodes != null && childNodes.getLength() > 0) { Node childNode; for (int i = 0; i < childNodes.getLength(); i++) { childNode = childNodes.item(i); parent.removeChild(childNode); } } Document doc = parent.getOwnerDocument(); if (doc == null) { throw new NullPointerException("Owner document of element must not be null!"); } Text textNode = doc.createTextNode(XmlServices.textToXml(text)); parent.appendChild(textNode); } public static String getText(Node parent) { if (parent == null) { throw new IllegalArgumentException("The argument parent must not be null!"); } String buffer = ""; NodeList childNodes = parent.getChildNodes(); if (childNodes == null || childNodes.getLength() == 0) { return buffer; } Node childNode; Text textNode; for (int i = 0; i < childNodes.getLength(); i++) { childNode = childNodes.item(i); if (childNode instanceof Text) { textNode = (Text) childNode; buffer += textNode.getNodeValue(); } else if (childNode instanceof Element) { buffer += W3cServices.getText(childNode); } } return buffer; } /** * Die Methode insertAfter fügt ein neues Element nach dem * angegebenen Referenzelement ein. * * @param node Element * @param refNode Element */ public static void insertElementAfter(Element newNode, Element refNode) { if (newNode == null) { throw new IllegalArgumentException("The argument newNode must not be null!"); } if (refNode == null) { throw new IllegalArgumentException("The argument refNode must not be null!"); } Element parentNode = (Element) refNode.getParentNode(); if (parentNode == null) { throw new IllegalStateException("The parent node of the destination node must not be null!"); } Element siblingNode = null; Node node = refNode.getNextSibling(); while (node != null && node instanceof Element == false) { node = node.getNextSibling(); } if (node != null && node instanceof Element) { siblingNode = (Element) node; } if (siblingNode != null) { parentNode.insertBefore(newNode, siblingNode); } else { parentNode.appendChild(newNode); } } public static void setElementText(Element elem, String text) { if (elem == null) { throw new IllegalArgumentException("The argument elem must not be null!"); } if (text == null) { text = ""; } Document doc = elem.getOwnerDocument(); if (doc == null) { return; } if (elem.hasChildNodes()) { Node childNode; NodeList childNodes = elem.getChildNodes(); for (int i = 0; i < childNodes.getLength(); i++) { childNode = childNodes.item(i); elem.removeChild(childNode); } } Text textNode = doc.createTextNode(text); elem.appendChild(textNode); } /** * Die Methode copyNode kopiert den Baum mit dem Wurzelelement * oNode in den Kontext des Dokumentes doc und * gibt den Wurzelknoten des neu erzeugten Baumes nNode zurück. * Diese Methode wird benötigt um Knoten aus einem Dokument in den Baum * eines anderen Dokumentes zu kopieren. * *

      Wird versucht Knoten eines Dokumentes in ein zweites zu einzuhängen, * erhält man die Fehlermeldung : WRONG_DOCUMENT_ERR: A node is used * in a different document than the one that created it.

      * *

      Beispiel:

      *
           * Document resourceDoc = XmlServices.parse(file);
           * elem = resourceDoc.getDocumentElement();
           * parent.appendChild(W3cServices.copyNode(manifestDoc, elem));
           * 
      * * @param doc Document * @param oNode Node * @return Node */ public static Node copyNode(Document doc, Node oNode) { if (doc == null) { throw new IllegalArgumentException("The argument doc must not be null!"); } if (oNode == null) { throw new IllegalArgumentException("The argument oNode must not be null!"); } Node nNode = null; Node nChild; int nodeType; switch (oNode.getNodeType()) { case Node.ELEMENT_NODE: nNode = doc.createElement(oNode.getNodeName()); NamedNodeMap attrMap = oNode.getAttributes(); Node attrNode; for (int i = 0; i < attrMap.getLength(); i++) { attrNode = attrMap.item(i); ((Element) nNode).setAttribute(attrNode.getNodeName(), attrNode.getNodeValue()); } break; case Node.TEXT_NODE: nNode = doc.createTextNode(oNode.getNodeValue()); break; case Node.ENTITY_NODE: nNode = doc.createTextNode(oNode.getNodeName()); break; case Node.ENTITY_REFERENCE_NODE: nNode = doc.createEntityReference(oNode.getNodeName()); break; case Node.COMMENT_NODE: nNode = doc.createComment(oNode.getNodeValue()); break; case Node.CDATA_SECTION_NODE: nNode = doc.createCDATASection(oNode.getNodeValue()); break; case Node.PROCESSING_INSTRUCTION_NODE: nNode = doc.createProcessingInstruction(oNode.getNodeName(), oNode.getNodeValue()); break; } if (nNode == null) { return null; } NodeList childNodes = oNode.getChildNodes(); if (childNodes != null && childNodes.getLength() > 0) { for (int i = 0; i < childNodes.getLength(); i++) { nodeType = childNodes.item(i).getNodeType(); if (nodeType != Node.ATTRIBUTE_NODE) { nChild = copyNode(doc, childNodes.item(i)); if (nChild != null) { nNode.appendChild(nChild); } } } } return nNode; } public static String getAttributesAsText(Element elem) { String buffer = ""; NamedNodeMap attributes = elem.getAttributes(); if (attributes != null) { for (int i = 0; i < attributes.getLength(); i++) { Node attr = attributes.item(i); buffer += " " + attr.getNodeName() + "=\"" + XmlServices.textToXml(attr.getNodeValue()) + "\""; } } return buffer; } public static void setAttribute(Node node, String attr, String namespace) { if (node instanceof Element) { Element elem = (Element) node; elem.setAttribute(attr, namespace); } } public static boolean hasNamespace(Element element, String namespace) { NamedNodeMap attrMap = element.getAttributes(); for (int i = 0; i < attrMap.getLength(); i++) { Node item = attrMap.item(i); if (item.getNodeName() != null && item.getNodeName().startsWith("xmlns")) { if (namespace.equals(item.getNodeValue())) { return true; } } } return false; } public static void copyNamespaces(Element documentElement, Element element) { NamedNodeMap attrMap = documentElement.getAttributes(); for (int i = 0; i < attrMap.getLength(); i++) { Node item = attrMap.item(i); if (item.getNodeName() != null && item.getNodeName().startsWith("xmlns")) { element.setAttribute(item.getNodeName(), item.getNodeValue()); } } } } src/java/org/dbdoclet/xiphias/XmlServices.java0000644000175000017500000012736212644165236021607 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.xiphias; import java.io.BufferedReader; import java.io.ByteArrayInputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.StringReader; import java.io.UnsupportedEncodingException; import java.net.URL; import java.nio.ByteBuffer; import java.nio.CharBuffer; import java.nio.charset.CharacterCodingException; import java.nio.charset.Charset; import java.nio.charset.CharsetEncoder; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.Locale; import java.util.Stack; import java.util.regex.Matcher; import java.util.regex.Pattern; import javax.xml.XMLConstants; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import javax.xml.transform.ErrorListener; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerConfigurationException; import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerFactory; import javax.xml.transform.sax.SAXSource; import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamSource; import javax.xml.validation.Schema; import javax.xml.validation.SchemaFactory; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.xml.resolver.tools.CatalogResolver; import org.dbdoclet.service.FileServices; import org.dbdoclet.service.ReplaceServices; import org.dbdoclet.service.StringServices; import org.dbdoclet.service.UnicodeServices; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.Text; import org.xml.sax.EntityResolver; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import org.xml.sax.SAXParseException; import org.xml.sax.XMLReader; import org.xml.sax.helpers.XMLReaderFactory; /** * Die Klasse XmlServices stellt eine Sammlung statischer Methoden * zur Bearbeitung von XML zur Verfügung. * * @author Michael Fuchs * @version 1.0 */ public class XmlServices { public static final String test = " "; private static final Pattern encPattern = Pattern .compile("^(?i).*<\\?xml\\s*.*encoding=['\"](.*)['\"].*\\?>.*$"); private static Log logger = LogFactory.getLog(XmlServices.class); private static final Pattern startsWithDigitPattern = Pattern .compile("^[0-9].*$"); static { System.setProperty("xml.catalog.ignoreMissing", "yes"); } /** * Die Methode findDocBookTextLength liefert die Textposition * innerhalb eines DocBook XML-Zeichenpuffers ohne Berücksichtigung der Tags * und Entities(!). Ebenso wird alles innerhalb von indexterm-Tags * ignoriert. * * @param buffer * String * @param index * int * @return int */ public static int findDocBookTextIndex(String buffer, int index) { char c; int length = 0; Stack blocked = new Stack(); StringBuffer tagName; String openTag; String closingTag; for (int i = 0; i < buffer.length(); i++) { c = buffer.charAt(i); if (c == '<') { tagName = new StringBuffer(); while (c != '>' && i < buffer.length()) { c = buffer.charAt(i++); tagName.append(c); } if (tagName.toString().startsWith("")) { if (blocked.empty() == false) { blocked.pop(); } } } else { openTag = tagName.toString(); if (openTag.equals("")) { blocked.push(openTag); } } i--; continue; } if (c == '&') { c = buffer.charAt(i++); while (c != ';' && c != ' ' && c != '\t' && c != '\r' && c != '\n' && i < buffer.length()) { c = buffer.charAt(i++); } i--; continue; } if (length == index) { return i; } if (blocked.size() == 0) { length++; } } return -1; } /** * Die Methode findXmlTextLength liefert die Textposition * innerhalb eines XML-Zeichenpuffers ohne Berücksichtigung der Tags und * Entities(!). * * @param buffer * String * @param index * int * @return int */ public static int findXmlTextIndex(String buffer, int index) { char c; int length = 0; for (int i = 0; i < buffer.length(); i++) { c = buffer.charAt(i); if (c == '<') { while (c != '>' && i < buffer.length()) { c = buffer.charAt(i++); } i--; continue; } if (c == '&') { c = buffer.charAt(i++); while (c != ';' && c != ' ' && c != '\t' && c != '\r' && c != '\n' && i < buffer.length()) { c = buffer.charAt(i++); } i--; continue; } if (length == index) { return i; } length++; } return -1; } /** * Die Methode getDocBookTextLength liefert die reine Textlänge * eines DocBook XML-Zeichenpuffers. * * Tags und Entities(!) gehen nicht in die Berechnung der Länge ein. Ebenso * wird alles innerhalb eines indexterm-Tags ignoriert. * * @param buffer * String * @return int */ public static int getDocBookTextLength(String buffer) { return getDocBookTextLength(new StringBuffer(buffer)); } /** * Die Methode getDocBookTextLength liefert die reine Textlänge * eines DocBook XML-Zeichenpuffers. * * Tags und Entities(!) gehen nicht in die Berechnung der Länge ein. Ebenso * wird alles innerhalb von indexterm-Tags ignoriert. * * @param buffer * StringBuffer * @return int */ public static int getDocBookTextLength(StringBuffer buffer) { char c; int length = 0; Stack blocked = new Stack(); StringBuffer tagName; String openTag; String closingTag; for (int i = 0; i < buffer.length(); i++) { c = buffer.charAt(i); if (c == '<') { tagName = new StringBuffer(); while (c != '>' && i < buffer.length()) { c = buffer.charAt(i++); tagName.append(c); } // System.out.println("tag=" + tagName.toString()); if (tagName.toString().startsWith("")) { if (blocked.empty() == false) { blocked.pop(); } } } else { openTag = tagName.toString(); if (openTag.equals("")) { blocked.push(openTag); } } i--; continue; } if (c == '&') { c = buffer.charAt(i++); while (c != ';' && c != ' ' && c != '\t' && c != '\r' && c != '\n' && i < buffer.length()) { c = buffer.charAt(i++); } i--; continue; } if (blocked.size() == 0) { length++; } } return length; } public static String getEncoding(File source) throws IOException { if (source == null) { throw new IllegalArgumentException( "The argument source must not be null!"); } BufferedReader reader = null; try { reader = new BufferedReader(new FileReader(source)); String line; Matcher matcher; while ((line = reader.readLine()) != null) { logger.debug("line=" + line); matcher = encPattern.matcher(line); if (matcher.matches()) { return matcher.group(1); } } } finally { if (reader != null) { reader.close(); } } return "UTF-8"; } public static String getEncoding(String source) throws IOException { if (source == null) { throw new IllegalArgumentException( "The argument source must not be null!"); } BufferedReader reader = new BufferedReader(new StringReader(source)); String line; Matcher matcher; while ((line = reader.readLine()) != null) { matcher = encPattern.matcher(line); if (matcher.matches()) { return matcher.group(1); } } return "UTF-8"; } /** * Erstellt den Pfadnamen des Elements vom Wurzelelement ab. Die einzelnen * Elemente werden durch einen Schrägstrich voneinander getrennt, z.B. * /Dokument/Kapitel/Absatz. * * @param element * @return String */ public static String getFullyQualifiedElementName(Element element) { if (element == null) { return null; } Stack stack = new Stack(); Element parent = element; while (parent != null) { stack.push(parent.getTagName()); parent = (Element) parent.getParentNode(); } StringBuilder buffer = new StringBuilder(); buffer.append('/'); while (stack.isEmpty() == false) { buffer.append(stack.pop()); if (stack.isEmpty() == false) { buffer.append('/'); } } return buffer.toString(); } /** * Die Methode getXmlTextLength liefert die reine Textlänge * eines XML-Zeichenpuffers. * * Tags und Entities(!) gehen nicht in die Berechnung der Länge ien. * * @param buffer * String * @return int */ public static int getXmlTextLength(String buffer) { return getXmlTextLength(new StringBuffer(buffer)); } /** * Die Methode getXmlTextLength liefert die reine Textlänge * eines XML-Zeichenpuffers. * * Tags und Entities(!) gehen nicht in die Berechnung der Länge ien. * * @param buffer * StringBuffer * @return int */ public static int getXmlTextLength(StringBuffer buffer) { char c; int length = 0; for (int i = 0; i < buffer.length(); i++) { c = buffer.charAt(i); if (c == '<') { while (c != '>' && i < buffer.length()) { c = buffer.charAt(i++); } i--; continue; } if (c == '&') { c = buffer.charAt(i++); while (c != ';' && c != ' ' && c != '\t' && c != '\r' && c != '\n' && i < buffer.length()) { c = buffer.charAt(i++); } i--; continue; } length++; } return length; } public static boolean isEntity(StringBuffer word) { if (word == null) { throw new IllegalArgumentException( "The argument word must not be null!"); } char c; int length = word.length(); int max = length - 1; for (int i = 0; i < word.length(); i++) { c = word.charAt(i); if (i == 0 && c != '&') { return false; } if (i == max && c != ';') { return false; } if (Character.isWhitespace(c) == true) { return false; } } String buffer = word.toString(); buffer = StringServices.cutPrefix(buffer, "&"); buffer = StringServices.cutSuffix(buffer, ";"); Matcher matcher; matcher = startsWithDigitPattern.matcher(buffer); if (matcher.matches() == true) { return false; } return true; } public static String normalizeText(String text) { if (text == null) { return null; } return text.replaceAll("\\s+", " "); } public static Document parse(File source) throws IOException, SAXException, ParserConfigurationException { return parse(source, true, null); } public static Document parse(File source, boolean validate) throws IOException, SAXException, ParserConfigurationException { return parse(source, validate, null); } public static Document parse(File file, boolean validate, URL schemaUrl) throws IOException, SAXException, ParserConfigurationException { String encoding = getEncoding(file); InputStreamReader reader = new InputStreamReader(new FileInputStream(file), encoding); InputSource inputSource = new InputSource(reader); inputSource.setSystemId(file.getCanonicalPath()); return parse(inputSource, validate, null); } public static Document parse(InputSource source, boolean validate, URL schemaUrl) throws IOException, SAXException, ParserConfigurationException { if (source == null) { throw new IllegalArgumentException( "The argument source may not be null!"); } System.setProperty("xml.catalog.ignoreMissing", "yes"); DocumentBuilderFactory factory; DocumentBuilder parser; if (schemaUrl != null) { factory = DocumentBuilderFactory.newInstance(); factory.setValidating(validate); factory.setXIncludeAware(true); Schema schema = SchemaFactory.newInstance( XMLConstants.W3C_XML_SCHEMA_NS_URI).newSchema(schemaUrl); factory.setNamespaceAware(true); factory.setSchema(schema); parser = factory.newDocumentBuilder(); } else { factory = DocumentBuilderFactory.newInstance(); factory.setValidating(validate); factory.setXIncludeAware(true); parser = factory.newDocumentBuilder(); parser.setEntityResolver(new CatalogResolver()); } XmlValidationResult result = new XmlValidationResult(new File(source.getSystemId()), Locale.getDefault()); parser.setErrorHandler(result); Document doc = parser.parse(source); return doc; } /** * Einlesen einer XML-Datei in einen DOM-Tree. Die XML-Daten müssen nur wohl * geformt sein. Es wird keinerlei Validierung vorgenommen. * * @param file * @return Document * @throws SAXException * @throws IOException * @throws ParserConfigurationException */ public static Document loadDocument(File file) throws SAXException, IOException, ParserConfigurationException { if (file == null) { throw new IllegalArgumentException( "The argument source may not be null!"); } DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setValidating(false); DocumentBuilder parser = factory.newDocumentBuilder(); parser.setEntityResolver(new EntityResolver() { @Override public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException { return new InputSource(new ByteArrayInputStream( "".getBytes())); } }); XmlValidationResult result = new XmlValidationResult(file, Locale.getDefault()); parser.setErrorHandler(result); Document doc = parser.parse(file); return doc; } public static Document parse(File source, URL schemaUrl) throws IOException, SAXException, ParserConfigurationException { return parse(source, true, schemaUrl); } public static void recode(File file, String to, URL schemaUrl) throws IOException, SAXException, ParserConfigurationException { if (file == null) { throw new IllegalArgumentException( "The argument file must not be null!"); } if (to == null) { throw new IllegalArgumentException( "The argument to must not be null!"); } String from = getEncoding(file); if (from == null) { from = "UTF-8"; } if (from.toLowerCase().equals(to.toLowerCase())) { return; } Document doc = parse(file, false, schemaUrl); NodeSerializer serializer = new NodeSerializer(); serializer.setEncoding(to); serializer.write(doc, file); } public static String replaceAmpersand(String text, boolean isHtml) { char c; String entity; StringBuffer source = new StringBuffer(text); StringBuffer dest = new StringBuffer(); StringBuffer word; int max = source.length() - 1; for (int i = 0; i <= max; i++) { c = source.charAt(i); if (c == '&') { word = new StringBuffer(); if (i == max) { dest.append("&"); continue; } else { if (source.charAt(i + 1) == ';') { i++; dest.append("&;"); continue; } else { word.append('&'); } } while (i < max) { c = source.charAt(++i); if (Character.isWhitespace(c) || (c == '&') || (c == ';') || (i == max)) { if (c == ';') { word.append(c); } if (isEntity(word)) { entity = word.toString(); if (isHtml) { entity = resolveHtmlEntity(entity); } entity = resolveNumericEntity(entity); dest.append(entity); if (Character.isWhitespace(c)) { dest.append(c); } break; } else { dest.append("&"); dest.append(word.substring(1)); if (Character.isWhitespace(c)) { dest.append(c); } if (i == max) { if (c == '&') { dest.append("&"); } else if (c != ';') { dest.append(c); } } logger.debug("dest: " + dest.toString()); if (c == '&') { word = new StringBuffer(); word.append('&'); } else { break; } } } else { word.append(c); } } } else { dest.append(c); } } return dest.toString(); } public static String resolveHtmlEntity(String entity) { if (entity == null || entity.length() == 0) { return ""; } if (entity.startsWith("&") == false || entity.endsWith(";") == false) { return entity; } if (entity.equals(" ")) { return resolveNumericEntity(" "); } if (entity.equals("¡")) { return resolveNumericEntity("¡"); } if (entity.equals("¤")) { return resolveNumericEntity("¤"); } if (entity.equals("¢")) { return resolveNumericEntity("¢"); } if (entity.equals("£")) { return resolveNumericEntity("£"); } if (entity.equals("¥")) { return resolveNumericEntity("¥"); } if (entity.equals("¦")) { return resolveNumericEntity("¦"); } if (entity.equals("§")) { return resolveNumericEntity("§"); } if (entity.equals("¨")) { return resolveNumericEntity("¨"); } if (entity.equals("©")) { return resolveNumericEntity("©"); } if (entity.equals("ª")) { return resolveNumericEntity("ª"); } if (entity.equals("«")) { return resolveNumericEntity("«"); } if (entity.equals("¬")) { return resolveNumericEntity("¬"); } if (entity.equals("­")) { return resolveNumericEntity("­"); } if (entity.equals("®")) { return resolveNumericEntity("®"); } if (entity.equals("™")) { return resolveNumericEntity("™"); } if (entity.equals("¯")) { return resolveNumericEntity("¯"); } if (entity.equals("°")) { return resolveNumericEntity("°"); } if (entity.equals("±")) { return resolveNumericEntity("±"); } if (entity.equals("²")) { return resolveNumericEntity("²"); } if (entity.equals("³")) { return resolveNumericEntity("³"); } if (entity.equals("´")) { return resolveNumericEntity("´"); } if (entity.equals("µ")) { return resolveNumericEntity("µ"); } if (entity.equals("¶")) { return resolveNumericEntity("¶"); } if (entity.equals("·")) { return resolveNumericEntity("·"); } if (entity.equals("¸")) { return resolveNumericEntity("¸"); } if (entity.equals("¹")) { return resolveNumericEntity("¹"); } if (entity.equals("º")) { return resolveNumericEntity("º"); } if (entity.equals("»")) { return resolveNumericEntity("»"); } if (entity.equals("¼")) { return resolveNumericEntity("¼"); } if (entity.equals("½")) { return resolveNumericEntity("½"); } if (entity.equals("¾")) { return resolveNumericEntity("¾"); } if (entity.equals("¿")) { return resolveNumericEntity("¿"); } if (entity.equals("×")) { return resolveNumericEntity("×"); } if (entity.equals("÷")) { return resolveNumericEntity("÷"); } if (entity.equals("À")) { return resolveNumericEntity("À"); } if (entity.equals("Á")) { return resolveNumericEntity("Á"); } if (entity.equals("Â")) { return resolveNumericEntity("Â"); } if (entity.equals("Ã")) { return resolveNumericEntity("Ã"); } if (entity.equals("Ä")) { return resolveNumericEntity("Ä"); } if (entity.equals("Å")) { return resolveNumericEntity("Å"); } if (entity.equals("Æ")) { return resolveNumericEntity("Æ"); } if (entity.equals("Ç")) { return resolveNumericEntity("Ç"); } if (entity.equals("È")) { return resolveNumericEntity("È"); } if (entity.equals("É")) { return resolveNumericEntity("É"); } if (entity.equals("Ê")) { return resolveNumericEntity("Ê"); } if (entity.equals("Ë")) { return resolveNumericEntity("Ë"); } if (entity.equals("Ì")) { return resolveNumericEntity("Ì"); } if (entity.equals("Í")) { return resolveNumericEntity("Í"); } if (entity.equals("Î")) { return resolveNumericEntity("Î"); } if (entity.equals("Ï")) { return resolveNumericEntity("Ï"); } if (entity.equals("Ð")) { return resolveNumericEntity("Ð"); } if (entity.equals("Ñ")) { return resolveNumericEntity("Ñ"); } if (entity.equals("Ò")) { return resolveNumericEntity("Ò"); } if (entity.equals("Ó")) { return resolveNumericEntity("Ó"); } if (entity.equals("Ô")) { return resolveNumericEntity("Ô"); } if (entity.equals("Õ")) { return resolveNumericEntity("Õ"); } if (entity.equals("Ö")) { return resolveNumericEntity("Ö"); } if (entity.equals("Ø")) { return resolveNumericEntity("Ø"); } if (entity.equals("Ù")) { return resolveNumericEntity("Ù"); } if (entity.equals("Ú")) { return resolveNumericEntity("Ú"); } if (entity.equals("Û")) { return resolveNumericEntity("Û"); } if (entity.equals("Ü")) { return resolveNumericEntity("Ü"); } if (entity.equals("Ý")) { return resolveNumericEntity("Ý"); } if (entity.equals("Þ")) { return resolveNumericEntity("Þ"); } if (entity.equals("ß")) { return resolveNumericEntity("ß"); } if (entity.equals("à")) { return resolveNumericEntity("à"); } if (entity.equals("á")) { return resolveNumericEntity("á"); } if (entity.equals("â")) { return resolveNumericEntity("â"); } if (entity.equals("ã")) { return resolveNumericEntity("ã"); } if (entity.equals("ä")) { return resolveNumericEntity("ä"); } if (entity.equals("å")) { return resolveNumericEntity("å"); } if (entity.equals("æ")) { return resolveNumericEntity("æ"); } if (entity.equals("ç")) { return resolveNumericEntity("ç"); } if (entity.equals("è")) { return resolveNumericEntity("è"); } if (entity.equals("é")) { return resolveNumericEntity("é"); } if (entity.equals("ê")) { return resolveNumericEntity("ê"); } if (entity.equals("ë")) { return resolveNumericEntity("ë"); } if (entity.equals("ì")) { return resolveNumericEntity("ì"); } if (entity.equals("í")) { return resolveNumericEntity("í"); } if (entity.equals("î")) { return resolveNumericEntity("î"); } if (entity.equals("ï")) { return resolveNumericEntity("ï"); } if (entity.equals("ð")) { return resolveNumericEntity("ð"); } if (entity.equals("ñ")) { return resolveNumericEntity("ñ"); } if (entity.equals("ò")) { return resolveNumericEntity("ò"); } if (entity.equals("ó")) { return resolveNumericEntity("ó"); } if (entity.equals("ô")) { return resolveNumericEntity("ô"); } if (entity.equals("õ")) { return resolveNumericEntity("õ"); } if (entity.equals("ö")) { return resolveNumericEntity("ö"); } if (entity.equals("ø")) { return resolveNumericEntity("ø"); } if (entity.equals("ù")) { return resolveNumericEntity("ù"); } if (entity.equals("ú")) { return resolveNumericEntity("ú"); } if (entity.equals("û")) { return resolveNumericEntity("û"); } if (entity.equals("ü")) { return resolveNumericEntity("ü"); } if (entity.equals("ý")) { return resolveNumericEntity("ý"); } if (entity.equals("þ")) { return resolveNumericEntity("þ"); } if (entity.equals("ÿ")) { return resolveNumericEntity("ÿ"); } if (entity.equals("Œ")) { return resolveNumericEntity("Œ"); } if (entity.equals("œ")) { return resolveNumericEntity("œ"); } if (entity.equals("Š")) { return resolveNumericEntity("Š"); } if (entity.equals("š")) { return resolveNumericEntity("š"); } if (entity.equals("Ÿ")) { return resolveNumericEntity("Ÿ"); } if (entity.equals("ˆ")) { return resolveNumericEntity("ˆ"); } if (entity.equals("˜")) { return resolveNumericEntity("˜"); } if (entity.equals(" ")) { return resolveNumericEntity(" "); } if (entity.equals(" ")) { return resolveNumericEntity(" "); } if (entity.equals(" ")) { return resolveNumericEntity(" "); } if (entity.equals("‌")) { return resolveNumericEntity("‌"); } if (entity.equals("‍")) { return resolveNumericEntity("‍"); } if (entity.equals("‎")) { return resolveNumericEntity("‎"); } if (entity.equals("‏")) { return resolveNumericEntity("‏"); } if (entity.equals("–")) { return resolveNumericEntity("–"); } if (entity.equals("—")) { return resolveNumericEntity("—"); } if (entity.equals("‘")) { return resolveNumericEntity("‘"); } if (entity.equals("’")) { return resolveNumericEntity("’"); } if (entity.equals("‚")) { return resolveNumericEntity("‚"); } if (entity.equals("“")) { return resolveNumericEntity("“"); } if (entity.equals("”")) { return resolveNumericEntity("”"); } if (entity.equals("„")) { return resolveNumericEntity("„"); } if (entity.equals("†")) { return resolveNumericEntity("†"); } if (entity.equals("‡")) { return resolveNumericEntity("‡"); } if (entity.equals("…")) { return resolveNumericEntity("…"); } if (entity.equals("‰")) { return resolveNumericEntity("‰"); } if (entity.equals("‹")) { return resolveNumericEntity("‹"); } if (entity.equals("›")) { return resolveNumericEntity("›"); } if (entity.equals("€")) { return resolveNumericEntity("€"); } return entity; } public static String resolveNumericEntity(String entity) { if (entity == null || entity.length() == 0) { return ""; } if (entity.startsWith("&#") == false || entity.endsWith(";") == false) { return entity; } String str = entity; str = StringServices.cutPrefix(str, "&#"); str = StringServices.cutSuffix(str, ";"); int code = -1; int radix = 10; if (str.startsWith("x")) { str = StringServices.cutPrefix(str, "x"); radix = 16; } try { code = Integer.parseInt(str, radix); } catch (NumberFormatException oops) { return entity; } StringBuffer buffer = new StringBuffer(); buffer.append((char) code); return buffer.toString(); } public static String textToHtml(String text) { if (text == null) { return null; } text = textToXml(text, true); return text; } /** * Die Methode textToXml wandelt Text in XML-Text um. * * Dazu werden die von XML reservierter Zeichen "kleiner als", "größer als" * und das kaufmännische Und durch ihre entsprechenden Entities ersetzt. * * @param text * String * @return String */ public static String textToXml(String text) { return textToXml(text, false); } /** * Die Methode textToXml wandelt Text in XML-Text um. * * Dazu werden die von XML reservierter Zeichen "kleiner als", "größer als" * und das kaufmännische Und durch ihre entsprechenden Entities ersetzt. * * @param text * String * @return String */ public static String textToXml(String text, boolean isHtml) { logger.debug("Argument text: \"" + text + "\""); logger.debug("Argument isHtml: \"" + isHtml + "\""); if (text == null) { return null; } text = StringServices.replace(text, "<", "<"); text = StringServices.replace(text, ">", ">"); text = StringServices.replace(text, """, "\""); text = StringServices.replace(text, "'", "'"); text = StringServices.replace(text, "'", "'"); text = StringServices.replace(text, "<", "<"); text = StringServices.replace(text, ">", ">"); text = StringServices.replace(text, "\"", """); text = StringServices.replace(text, "\uF0E0", ""); if (isHtml == true) { text = StringServices.replace(text, "'", "'"); } else { text = StringServices.replace(text, "'", "'"); } text = replaceAmpersand(text, isHtml); text = UnicodeServices.removeUndefinedCharacters(text); logger.debug("Return: \"" + text + "\""); return text; } /** * Die Methode validate validiert die angegebene XML-Datei. * * @param file * File * @exception ParserConfigurationException * ParserConfigurationException * @exception SAXException * SAXException * @exception IOException * IOException public static int validate(File source) throws * ParserConfigurationException, SAXException, IOException { * * XmlValidationResult result = validate(source); * * return result.getNumOfErrors(); } */ public static XmlValidationResult validate(File file) throws ParserConfigurationException, SAXException, IOException { return validate(file, null, Locale.getDefault()); } public static XmlValidationResult validate(File file, Locale locale) throws ParserConfigurationException, SAXException, IOException { return validate(file, null, locale); } public static XmlValidationResult validate(File file, URL schemaUrl) throws ParserConfigurationException, SAXException, IOException { return validate(file, schemaUrl, Locale.getDefault()); } public static XmlValidationResult validate(File file, URL schemaUrl, Locale locale) throws ParserConfigurationException, SAXException, IOException { if (file == null) { throw new IllegalArgumentException( "The argument file may not be null!"); } if (locale == null) { throw new IllegalArgumentException( "The argument locale must not be null!"); } XmlValidationResult result = new XmlValidationResult(file, locale); if (file.exists() == false) { result.setFileNotFound(true); return result; } if (file.canRead() == false) { result.setCanNotRead(true); return result; } System.setProperty("xml.catalog.ignoreMissing", "yes"); DocumentBuilderFactory factory; DocumentBuilder parser; if (schemaUrl != null) { Schema schema = SchemaFactory.newInstance( XMLConstants.W3C_XML_SCHEMA_NS_URI).newSchema(schemaUrl); factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); factory.setSchema(schema); factory.setXIncludeAware(true); parser = factory.newDocumentBuilder(); parser.setEntityResolver(new CatalogResolver()); } else { factory = DocumentBuilderFactory.newInstance(); parser = factory.newDocumentBuilder(); parser.setEntityResolver(new CatalogResolver()); } factory.setValidating(true); parser.setErrorHandler(result); try { parser.parse(file); } catch (SAXParseException oops) { // Wird von XmlValidationResult verarbeitet } catch (Throwable oops) { result.setThrowable(oops); } return result; } public static XmlValidationResult validate(String source) throws ParserConfigurationException, SAXException, IOException { if (source == null) { throw new IllegalArgumentException( "The argument source may not be null!"); } return validate(new File(source)); } /** * Die Methode validate validiert die angegebene Zeichekette. * * Vor der Konvertierung wird die Zeichenkette in die angegebene Kodierung * umgewandelt. * * @param xmlCode * String * @param encoding * String * @return byte[] * @exception CharacterCodingException * CharacterCodingException * @exception ParserConfigurationException * ParserConfigurationException * @exception SAXException * SAXException * @exception IOException * IOException */ public static byte[] validate(String xmlCode, String encoding) throws CharacterCodingException, ParserConfigurationException, SAXException, IOException { return validate(xmlCode, encoding, null); } public static byte[] validate(String xmlCode, String encoding, URL schemaUrl) throws CharacterCodingException, ParserConfigurationException, SAXException, IOException { if (xmlCode == null) { throw new IllegalArgumentException( "The argument xmlCode may not be null!"); } if (encoding == null) { throw new IllegalArgumentException( "The argument encoding may not be null!"); } System.setProperty("xml.catalog.ignoreMissing", "yes"); Charset charset = Charset.forName(encoding); CharsetEncoder encoder = charset.newEncoder(); CharBuffer inBuffer = CharBuffer.wrap(xmlCode); ByteBuffer byteBuffer = encoder.encode(inBuffer); int limit = byteBuffer.limit(); byte[] data = new byte[limit]; byteBuffer.get(data, 0, limit); ByteArrayInputStream stream = new ByteArrayInputStream(data); DocumentBuilderFactory factory; DocumentBuilder parser; if (schemaUrl != null) { Schema schema = SchemaFactory.newInstance( XMLConstants.W3C_XML_SCHEMA_NS_URI).newSchema(schemaUrl); factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); factory.setSchema(schema); factory.setXIncludeAware(true); parser = factory.newDocumentBuilder(); } else { factory = DocumentBuilderFactory.newInstance(); parser = factory.newDocumentBuilder(); parser.setEntityResolver(new CatalogResolver()); } factory.setValidating(true); parser.parse(stream); return data; } public static boolean isNewline(Node node) { if (node != null && node instanceof Text) { String text = ((Text) node).getData(); if (text != null && text.trim().length() == 0 && text.indexOf('\n') != -1) { return true; } } return false; } public static String normalizeText(Text text) { String data = text.getData(); data = ReplaceServices.replaceAll(data, "\\s+", " "); return data; } public static String xmlToText(String text) { if (text == null) { return null; } text = StringServices.replace(text, "'", "'"); text = StringServices.replace(text, "'", "'"); text = StringServices.replace(text, """, "\""); text = StringServices.replace(text, "<", "<"); text = StringServices.replace(text, ">", ">"); text = StringServices.replace(text, "&", "&"); return text; } /** * Die Methode xslt führt eine XSL-Transformation durch. */ public static void xslt(File in, String xsl, HashMap params, File out, String encoding, boolean validate) throws IOException, SAXException, TransformerConfigurationException, TransformerException, UnsupportedEncodingException { xslt(in.getCanonicalPath(), xsl, params, out.getCanonicalPath(), encoding, validate, null); } public static void xslt(File in, String xsl, HashMap params, File out, String encoding, boolean validate, ErrorListener listener) throws IOException, SAXException, TransformerConfigurationException, TransformerException, UnsupportedEncodingException { xslt(in.getCanonicalPath(), xsl, params, out.getCanonicalPath(), encoding, validate, listener); } public static void xslt(String in, String xsl, HashMap params, String out) throws IOException, SAXException, TransformerConfigurationException, TransformerException, UnsupportedEncodingException { xslt(in, xsl, params, out, "UTF-8", false, null); } public static void xslt(String in, String xsl, HashMap params, String out, String encoding, boolean validate) throws IOException, SAXException, TransformerConfigurationException, TransformerException, UnsupportedEncodingException { xslt(in, xsl, params, out, encoding, validate, null); } /** * Die Methode xslt führt eine XSL-Transformation durch. */ public static void xslt(String in, String xsl, HashMap params, String out, String encoding, boolean validate, ErrorListener listener) throws IOException, SAXException, TransformerConfigurationException, TransformerException, UnsupportedEncodingException { if (in == null) { throw new IllegalArgumentException("Parameter in is null!"); } if (xsl == null) { throw new IllegalArgumentException("Parameter xsl is null!"); } if (out == null) { throw new IllegalArgumentException("Parameter out is null!"); } if (encoding == null) { throw new IllegalArgumentException( "The argument encoding may not be null!"); } System.setProperty("xml.catalog.ignoreMissing", "yes"); FileInputStream fis = null; FileOutputStream fos = null; logger.debug("validate=" + validate); String spf = System.getProperty("javax.xml.parsers.SAXParserFactory"); String dbf = System .getProperty("javax.xml.parsers.DocumentBuilderFactory"); String tf = System .getProperty("javax.xml.transform.TransformerFactory"); try { System.setProperty("javax.xml.parsers.SAXParserFactory", "org.apache.xerces.jaxp.SAXParserFactoryImpl"); System.setProperty("javax.xml.parsers.DocumentBuilderFactory", "org.apache.xerces.jaxp.DocumentBuilderFactoryImpl"); System.setProperty("javax.xml.transform.TransformerFactory", "org.apache.xalan.processor.TransformerFactoryImpl"); TransformerFactory transformerFactory = TransformerFactory .newInstance(); if (listener != null) { transformerFactory.setErrorListener(listener); } if (validate == true) { transformerFactory.setURIResolver(new CatalogResolver()); } Transformer transformer = transformerFactory .newTransformer(new StreamSource(xsl)); if (transformer == null) { throw new TransformerException( "Can't create transformer for stylesheet " + xsl + ". Working directory is " + new File(".").getAbsolutePath()); } if (listener != null) { transformer.setErrorListener(listener); } if (validate == true) { transformer.setURIResolver(new CatalogResolver()); } if (params != null) { Iterator iterator = params.keySet().iterator(); String param; String value; while (iterator.hasNext()) { param = iterator.next(); value = params.get(param); transformer.setParameter(param, value); } } fis = new FileInputStream(in); fos = new FileOutputStream(out); try { XMLReader reader = XMLReaderFactory.createXMLReader(); if (validate == true) { reader.setEntityResolver(new CatalogResolver()); } transformer .transform(new SAXSource(reader, new InputSource(in)), new StreamResult(new OutputStreamWriter(fos, encoding))); } catch (Exception oops) { logger.fatal("XmlServices.xslt", oops); } } finally { if (fis != null) { fis.close(); } if (fos != null) { fos.close(); } if (spf != null) { System.setProperty("javax.xml.parsers.SAXParserFactory", spf); } if (dbf != null) { System.setProperty("javax.xml.parsers.DocumentBuilderFactor", dbf); } if (tf != null) { System.setProperty("javax.xml.transform.TransformerFactory", tf); } } } public static void xslt(String in, String xsl, HashMap params, String out, String encoding, ErrorListener listener) throws IOException, SAXException, TransformerConfigurationException, TransformerException, UnsupportedEncodingException { xslt(in, xsl, params, out, encoding, false, listener); } /** * Führt eine XSLT-Transformation durch. * * @param in * XML-Eingabedatei * @param xsl * XSLT-Datei * @param out * Ausgabedatei * @throws IOException * @throws SAXException * @throws TransformerConfigurationException * @throws TransformerException * @throws UnsupportedEncodingException */ public static void xslt(String in, String xsl, String out) throws IOException, SAXException, TransformerConfigurationException, TransformerException, UnsupportedEncodingException { xslt(in, xsl, new HashMap(), out, "UTF-8", false, null); } public static void xslt(String in, String xsl, String out, ErrorListener listener) throws IOException, SAXException, TransformerConfigurationException, TransformerException, UnsupportedEncodingException { xslt(in, xsl, new HashMap(), out, "UTF-8", false, listener); } /** * Die Methode relocateSrc kopiert die Bilder der lokalen * Bildreferenzen einer HTML-Datei in das angegebene Zeilverzeichnis und * passt die Referenzen entsprechend an. * * @param file * @param imgDir * @throws IOException * @throws SAXException * @throws ParserConfigurationException */ public static void relocateSrc(File file, File imgDir) throws IOException, SAXException, ParserConfigurationException { Document doc = loadDocument(file); ArrayList imgNodeList = XPathServices.getNodes(doc, "xhtml", "http://www.w3.org/1999/xhtml", "//xhtml:img"); for (Node node : imgNodeList) { Element img = (Element) node; String srcAttr = img.getAttribute("src"); if (srcAttr == null || srcAttr.trim().length() == 0) { continue; } File fromFile; if (srcAttr.startsWith("file:")) { URL srcUrl = new URL(srcAttr); fromFile = new File(srcUrl.getPath()); } else { fromFile = new File(srcAttr); } if (fromFile.exists() == false) { logger.warn("Image file doesn't exist: " + fromFile.getAbsolutePath()); continue; } String toFileName = FileServices.appendPath(imgDir, fromFile.getName()); File toFile = FileServices.createUniqueFile(new File(toFileName)); FileServices.copyFileToFile(fromFile, toFile); img.setAttribute("src", FileServices.relativePath(file, toFile)); } NodeSerializer serializer = new NodeSerializer(); serializer.write(doc, file); } public static String printPath(Node node) { if (node == null) { return "Path: null"; } StringBuilder buffer = new StringBuilder(); Node parent = node; while (parent != null) { buffer.insert(0, " -> "); buffer.insert(0, parent.getNodeName()); parent = parent.getParentNode(); } String text = buffer.toString(); text = StringServices.cutPrefix(text, " -> "); return "Path: " + text; } } src/java/org/dbdoclet/xiphias/HtmlServices.java0000644000175000017500000006762212644165236021755 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.xiphias; import java.io.PrintWriter; import java.io.StringWriter; import org.dbdoclet.service.StringServices; public class HtmlServices { public static boolean isEntity(StringBuffer word) { return XmlServices.isEntity(word); } public static String textToHtml(String text) { if (text == null) { return null; } text = XmlServices.textToXml(text, true); return text; } public static String htmlToText(String text) { if (text == null) { return null; } text = XmlServices.xmlToText(text); text = StringServices.replace(text, "ä", "ä"); text = StringServices.replace(text, "Ö", "Ö"); text = StringServices.replace(text, "ö", "ö"); text = StringServices.replace(text, "Ü", "Ü"); text = StringServices.replace(text, "ü", "ü"); return text; } public static String createExceptionBox(String title, String msg, Throwable oops) { String name = "exception"; StringBuffer buffer = new StringBuffer(); buffer.append("
      \n"); buffer.append("
      "); buffer.append(title); buffer.append("
      \n"); buffer.append("
      \n"); buffer.append(msg); buffer.append("
      \n"); buffer.append("
      \n");
      
      		StringWriter stb = new StringWriter();
      		oops.printStackTrace(new PrintWriter(stb));
      		buffer.append(stb.toString());
      
      		buffer.append("  
      \n"); buffer.append("
      \n"); return buffer.toString(); } public static String createErrorBox(String title, String msg) { return createBox("error", title, msg); } public static String createWarningBox(String title, String msg) { return createBox("warning", title, msg); } public static String createInfoBox(String title, String msg) { return createBox("info", title, msg); } public static String createBox(String name, String title, String msg) { StringBuffer buffer = new StringBuffer(); buffer.append("
      \n"); buffer.append("
      "); buffer.append("

      " + title + "

      "); buffer.append("
      \n"); buffer.append("
      \n"); buffer.append(msg); buffer.append("
      \n"); buffer.append("
      \n"); return buffer.toString(); } public static String replaceEntities(String htmlCode) { String buffer = new String(htmlCode); buffer = StringServices.replace(buffer, " ", XmlServices.resolveNumericEntity(" ")); buffer = StringServices.replace(buffer, "¡", XmlServices.resolveNumericEntity("¡")); buffer = StringServices.replace(buffer, "¢", XmlServices.resolveNumericEntity("¢")); buffer = StringServices.replace(buffer, "£", XmlServices.resolveNumericEntity("£")); buffer = StringServices.replace(buffer, "¤", XmlServices.resolveNumericEntity("¤")); buffer = StringServices.replace(buffer, "¥", XmlServices.resolveNumericEntity("¥")); buffer = StringServices.replace(buffer, "¦", XmlServices.resolveNumericEntity("¦")); buffer = StringServices.replace(buffer, "§", XmlServices.resolveNumericEntity("§")); buffer = StringServices.replace(buffer, "¨", XmlServices.resolveNumericEntity("¨")); buffer = StringServices.replace(buffer, "©", XmlServices.resolveNumericEntity("©")); buffer = StringServices.replace(buffer, "ª", XmlServices.resolveNumericEntity("ª")); buffer = StringServices.replace(buffer, "«", XmlServices.resolveNumericEntity("«")); buffer = StringServices.replace(buffer, "¬", XmlServices.resolveNumericEntity("¬")); buffer = StringServices.replace(buffer, "­", XmlServices.resolveNumericEntity("­")); buffer = StringServices.replace(buffer, "®", XmlServices.resolveNumericEntity("®")); buffer = StringServices.replace(buffer, "¯", XmlServices.resolveNumericEntity("¯")); buffer = StringServices.replace(buffer, "°", XmlServices.resolveNumericEntity("°")); buffer = StringServices.replace(buffer, "±", XmlServices.resolveNumericEntity("±")); buffer = StringServices.replace(buffer, "²", XmlServices.resolveNumericEntity("²")); buffer = StringServices.replace(buffer, "³", XmlServices.resolveNumericEntity("³")); buffer = StringServices.replace(buffer, "´", XmlServices.resolveNumericEntity("´")); buffer = StringServices.replace(buffer, "µ", XmlServices.resolveNumericEntity("µ")); buffer = StringServices.replace(buffer, "¶", XmlServices.resolveNumericEntity("¶")); buffer = StringServices.replace(buffer, "·", XmlServices.resolveNumericEntity("·")); buffer = StringServices.replace(buffer, "¸", XmlServices.resolveNumericEntity("¸")); buffer = StringServices.replace(buffer, "¹", XmlServices.resolveNumericEntity("¹")); buffer = StringServices.replace(buffer, "º", XmlServices.resolveNumericEntity("º")); buffer = StringServices.replace(buffer, "»", XmlServices.resolveNumericEntity("»")); buffer = StringServices.replace(buffer, "¼", XmlServices.resolveNumericEntity("¼")); buffer = StringServices.replace(buffer, "½", XmlServices.resolveNumericEntity("½")); buffer = StringServices.replace(buffer, "¾", XmlServices.resolveNumericEntity("¾")); buffer = StringServices.replace(buffer, "¿", XmlServices.resolveNumericEntity("¿")); buffer = StringServices.replace(buffer, "À", XmlServices.resolveNumericEntity("À")); buffer = StringServices.replace(buffer, "Á", XmlServices.resolveNumericEntity("Á")); buffer = StringServices.replace(buffer, "Â", XmlServices.resolveNumericEntity("Â")); buffer = StringServices.replace(buffer, "Ã", XmlServices.resolveNumericEntity("Ã")); buffer = StringServices.replace(buffer, "Ä", XmlServices.resolveNumericEntity("Ä")); buffer = StringServices.replace(buffer, "Å", XmlServices.resolveNumericEntity("Å")); buffer = StringServices.replace(buffer, "Æ", XmlServices.resolveNumericEntity("Æ")); buffer = StringServices.replace(buffer, "Ç", XmlServices.resolveNumericEntity("Ç")); buffer = StringServices.replace(buffer, "È", XmlServices.resolveNumericEntity("È")); buffer = StringServices.replace(buffer, "É", XmlServices.resolveNumericEntity("É")); buffer = StringServices.replace(buffer, "Ê", XmlServices.resolveNumericEntity("Ê")); buffer = StringServices.replace(buffer, "Ë", XmlServices.resolveNumericEntity("Ë")); buffer = StringServices.replace(buffer, "Ì", XmlServices.resolveNumericEntity("Ì")); buffer = StringServices.replace(buffer, "Í", XmlServices.resolveNumericEntity("Í")); buffer = StringServices.replace(buffer, "Î", XmlServices.resolveNumericEntity("Î")); buffer = StringServices.replace(buffer, "Ï", XmlServices.resolveNumericEntity("Ï")); buffer = StringServices.replace(buffer, "Ð", XmlServices.resolveNumericEntity("Ð")); buffer = StringServices.replace(buffer, "Ñ", XmlServices.resolveNumericEntity("Ñ")); buffer = StringServices.replace(buffer, "Ò", XmlServices.resolveNumericEntity("Ò")); buffer = StringServices.replace(buffer, "Ó", XmlServices.resolveNumericEntity("Ó")); buffer = StringServices.replace(buffer, "Ô", XmlServices.resolveNumericEntity("Ô")); buffer = StringServices.replace(buffer, "Õ", XmlServices.resolveNumericEntity("Õ")); buffer = StringServices.replace(buffer, "Ö", XmlServices.resolveNumericEntity("Ö")); buffer = StringServices.replace(buffer, "×", XmlServices.resolveNumericEntity("×")); buffer = StringServices.replace(buffer, "Ø", XmlServices.resolveNumericEntity("Ø")); buffer = StringServices.replace(buffer, "Ù", XmlServices.resolveNumericEntity("Ù")); buffer = StringServices.replace(buffer, "Ú", XmlServices.resolveNumericEntity("Ú")); buffer = StringServices.replace(buffer, "Û", XmlServices.resolveNumericEntity("Û")); buffer = StringServices.replace(buffer, "Ü", XmlServices.resolveNumericEntity("Ü")); buffer = StringServices.replace(buffer, "Ý", XmlServices.resolveNumericEntity("Ý")); buffer = StringServices.replace(buffer, "Þ", XmlServices.resolveNumericEntity("Þ")); buffer = StringServices.replace(buffer, "ß", XmlServices.resolveNumericEntity("ß")); buffer = StringServices.replace(buffer, "à", XmlServices.resolveNumericEntity("à")); buffer = StringServices.replace(buffer, "á", XmlServices.resolveNumericEntity("á")); buffer = StringServices.replace(buffer, "â", XmlServices.resolveNumericEntity("â")); buffer = StringServices.replace(buffer, "ã", XmlServices.resolveNumericEntity("ã")); buffer = StringServices.replace(buffer, "ä", XmlServices.resolveNumericEntity("ä")); buffer = StringServices.replace(buffer, "å", XmlServices.resolveNumericEntity("å")); buffer = StringServices.replace(buffer, "æ", XmlServices.resolveNumericEntity("æ")); buffer = StringServices.replace(buffer, "ç", XmlServices.resolveNumericEntity("ç")); buffer = StringServices.replace(buffer, "è", XmlServices.resolveNumericEntity("è")); buffer = StringServices.replace(buffer, "é", XmlServices.resolveNumericEntity("é")); buffer = StringServices.replace(buffer, "ê", XmlServices.resolveNumericEntity("ê")); buffer = StringServices.replace(buffer, "ë", XmlServices.resolveNumericEntity("ë")); buffer = StringServices.replace(buffer, "ì", XmlServices.resolveNumericEntity("ì")); buffer = StringServices.replace(buffer, "í", XmlServices.resolveNumericEntity("í")); buffer = StringServices.replace(buffer, "î", XmlServices.resolveNumericEntity("î")); buffer = StringServices.replace(buffer, "ï", XmlServices.resolveNumericEntity("ï")); buffer = StringServices.replace(buffer, "ð", XmlServices.resolveNumericEntity("ð")); buffer = StringServices.replace(buffer, "ñ", XmlServices.resolveNumericEntity("ñ")); buffer = StringServices.replace(buffer, "ò", XmlServices.resolveNumericEntity("ò")); buffer = StringServices.replace(buffer, "ó", XmlServices.resolveNumericEntity("ó")); buffer = StringServices.replace(buffer, "ô", XmlServices.resolveNumericEntity("ô")); buffer = StringServices.replace(buffer, "õ", XmlServices.resolveNumericEntity("õ")); buffer = StringServices.replace(buffer, "ö", XmlServices.resolveNumericEntity("ö")); buffer = StringServices.replace(buffer, "÷", XmlServices.resolveNumericEntity("÷")); buffer = StringServices.replace(buffer, "ø", XmlServices.resolveNumericEntity("ø")); buffer = StringServices.replace(buffer, "ù", XmlServices.resolveNumericEntity("ù")); buffer = StringServices.replace(buffer, "ú", XmlServices.resolveNumericEntity("ú")); buffer = StringServices.replace(buffer, "û", XmlServices.resolveNumericEntity("û")); buffer = StringServices.replace(buffer, "ü", XmlServices.resolveNumericEntity("ü")); buffer = StringServices.replace(buffer, "ý", XmlServices.resolveNumericEntity("ý")); buffer = StringServices.replace(buffer, "þ", XmlServices.resolveNumericEntity("þ")); buffer = StringServices.replace(buffer, "ÿ", XmlServices.resolveNumericEntity("ÿ")); buffer = StringServices.replace(buffer, "Α", XmlServices.resolveNumericEntity("Α")); buffer = StringServices.replace(buffer, "α", XmlServices.resolveNumericEntity("α")); buffer = StringServices.replace(buffer, "Β", XmlServices.resolveNumericEntity("Β")); buffer = StringServices.replace(buffer, "β", XmlServices.resolveNumericEntity("β")); buffer = StringServices.replace(buffer, "Γ", XmlServices.resolveNumericEntity("Γ")); buffer = StringServices.replace(buffer, "γ", XmlServices.resolveNumericEntity("γ")); buffer = StringServices.replace(buffer, "Δ", XmlServices.resolveNumericEntity("Δ")); buffer = StringServices.replace(buffer, "δ", XmlServices.resolveNumericEntity("δ")); buffer = StringServices.replace(buffer, "Ε", XmlServices.resolveNumericEntity("Ε")); buffer = StringServices.replace(buffer, "ε", XmlServices.resolveNumericEntity("ε")); buffer = StringServices.replace(buffer, "Ζ", XmlServices.resolveNumericEntity("Ζ")); buffer = StringServices.replace(buffer, "ζ", XmlServices.resolveNumericEntity("ζ")); buffer = StringServices.replace(buffer, "Η", XmlServices.resolveNumericEntity("Η")); buffer = StringServices.replace(buffer, "η", XmlServices.resolveNumericEntity("η")); buffer = StringServices.replace(buffer, "Θ", XmlServices.resolveNumericEntity("Θ")); buffer = StringServices.replace(buffer, "θ", XmlServices.resolveNumericEntity("θ")); buffer = StringServices.replace(buffer, "Ι", XmlServices.resolveNumericEntity("Ι")); buffer = StringServices.replace(buffer, "ι", XmlServices.resolveNumericEntity("ι")); buffer = StringServices.replace(buffer, "Κ", XmlServices.resolveNumericEntity("Κ")); buffer = StringServices.replace(buffer, "κ", XmlServices.resolveNumericEntity("κ")); buffer = StringServices.replace(buffer, "Λ", XmlServices.resolveNumericEntity("Λ")); buffer = StringServices.replace(buffer, "λ", XmlServices.resolveNumericEntity("λ")); buffer = StringServices.replace(buffer, "Μ", XmlServices.resolveNumericEntity("Μ")); buffer = StringServices.replace(buffer, "μ", XmlServices.resolveNumericEntity("μ")); buffer = StringServices.replace(buffer, "Ν", XmlServices.resolveNumericEntity("Ν")); buffer = StringServices.replace(buffer, "ν", XmlServices.resolveNumericEntity("ν")); buffer = StringServices.replace(buffer, "Ξ", XmlServices.resolveNumericEntity("Ξ")); buffer = StringServices.replace(buffer, "ξ", XmlServices.resolveNumericEntity("ξ")); buffer = StringServices.replace(buffer, "Ο", XmlServices.resolveNumericEntity("Ο")); buffer = StringServices.replace(buffer, "ο", XmlServices.resolveNumericEntity("ο")); buffer = StringServices.replace(buffer, "Π", XmlServices.resolveNumericEntity("Π")); buffer = StringServices.replace(buffer, "π", XmlServices.resolveNumericEntity("π")); buffer = StringServices.replace(buffer, "Ρ", XmlServices.resolveNumericEntity("Ρ")); buffer = StringServices.replace(buffer, "ρ", XmlServices.resolveNumericEntity("ρ")); buffer = StringServices.replace(buffer, "Σ", XmlServices.resolveNumericEntity("Σ")); buffer = StringServices.replace(buffer, "ς", XmlServices.resolveNumericEntity("ς")); buffer = StringServices.replace(buffer, "σ", XmlServices.resolveNumericEntity("σ")); buffer = StringServices.replace(buffer, "Τ", XmlServices.resolveNumericEntity("Τ")); buffer = StringServices.replace(buffer, "τ", XmlServices.resolveNumericEntity("τ")); buffer = StringServices.replace(buffer, "Υ", XmlServices.resolveNumericEntity("Υ")); buffer = StringServices.replace(buffer, "υ", XmlServices.resolveNumericEntity("υ")); buffer = StringServices.replace(buffer, "Φ", XmlServices.resolveNumericEntity("Φ")); buffer = StringServices.replace(buffer, "φ", XmlServices.resolveNumericEntity("φ")); buffer = StringServices.replace(buffer, "Χ", XmlServices.resolveNumericEntity("Χ")); buffer = StringServices.replace(buffer, "χ", XmlServices.resolveNumericEntity("χ")); buffer = StringServices.replace(buffer, "Ψ", XmlServices.resolveNumericEntity("Ψ")); buffer = StringServices.replace(buffer, "ψ", XmlServices.resolveNumericEntity("ψ")); buffer = StringServices.replace(buffer, "Ω", XmlServices.resolveNumericEntity("Ω")); buffer = StringServices.replace(buffer, "ω", XmlServices.resolveNumericEntity("ω")); buffer = StringServices.replace(buffer, "ϑ", XmlServices.resolveNumericEntity("ϑ")); buffer = StringServices.replace(buffer, "ϒ", XmlServices.resolveNumericEntity("ϒ")); buffer = StringServices.replace(buffer, "ϖ", XmlServices.resolveNumericEntity("ϖ")); buffer = StringServices.replace(buffer, "∀", XmlServices.resolveNumericEntity("∀")); buffer = StringServices.replace(buffer, "∂", XmlServices.resolveNumericEntity("∂")); buffer = StringServices.replace(buffer, "∃", XmlServices.resolveNumericEntity("∃")); buffer = StringServices.replace(buffer, "∅", XmlServices.resolveNumericEntity("∅")); buffer = StringServices.replace(buffer, "∇", XmlServices.resolveNumericEntity("∇")); buffer = StringServices.replace(buffer, "∈", XmlServices.resolveNumericEntity("∈")); buffer = StringServices.replace(buffer, "∉", XmlServices.resolveNumericEntity("∉")); buffer = StringServices.replace(buffer, "∋", XmlServices.resolveNumericEntity("∋")); buffer = StringServices.replace(buffer, "∏", XmlServices.resolveNumericEntity("∏")); buffer = StringServices.replace(buffer, "∑", XmlServices.resolveNumericEntity("∑")); buffer = StringServices.replace(buffer, "−", XmlServices.resolveNumericEntity("−")); buffer = StringServices.replace(buffer, "∗", XmlServices.resolveNumericEntity("∗")); buffer = StringServices.replace(buffer, "√", XmlServices.resolveNumericEntity("√")); buffer = StringServices.replace(buffer, "∝", XmlServices.resolveNumericEntity("∝")); buffer = StringServices.replace(buffer, "∞", XmlServices.resolveNumericEntity("∞")); buffer = StringServices.replace(buffer, "∠", XmlServices.resolveNumericEntity("∠")); buffer = StringServices.replace(buffer, "∧", XmlServices.resolveNumericEntity("∧")); buffer = StringServices.replace(buffer, "∨", XmlServices.resolveNumericEntity("∨")); buffer = StringServices.replace(buffer, "∩", XmlServices.resolveNumericEntity("∩")); buffer = StringServices.replace(buffer, "∪", XmlServices.resolveNumericEntity("∪")); buffer = StringServices.replace(buffer, "∫", XmlServices.resolveNumericEntity("∫")); buffer = StringServices.replace(buffer, "∴", XmlServices.resolveNumericEntity("∴")); buffer = StringServices.replace(buffer, "∼", XmlServices.resolveNumericEntity("∼")); buffer = StringServices.replace(buffer, "≅", XmlServices.resolveNumericEntity("≅")); buffer = StringServices.replace(buffer, "≈", XmlServices.resolveNumericEntity("≈")); buffer = StringServices.replace(buffer, "≠", XmlServices.resolveNumericEntity("≠")); buffer = StringServices.replace(buffer, "≡", XmlServices.resolveNumericEntity("≡")); buffer = StringServices.replace(buffer, "≤", XmlServices.resolveNumericEntity("≤")); buffer = StringServices.replace(buffer, "≥", XmlServices.resolveNumericEntity("≥")); buffer = StringServices.replace(buffer, "⊂", XmlServices.resolveNumericEntity("⊂")); buffer = StringServices.replace(buffer, "⊃", XmlServices.resolveNumericEntity("⊃")); buffer = StringServices.replace(buffer, "⊄", XmlServices.resolveNumericEntity("⊄")); buffer = StringServices.replace(buffer, "⊆", XmlServices.resolveNumericEntity("⊆")); buffer = StringServices.replace(buffer, "⊇", XmlServices.resolveNumericEntity("⊇")); buffer = StringServices.replace(buffer, "⊕", XmlServices.resolveNumericEntity("⊕")); buffer = StringServices.replace(buffer, "⊗", XmlServices.resolveNumericEntity("⊗")); buffer = StringServices.replace(buffer, "⊥", XmlServices.resolveNumericEntity("⊥")); buffer = StringServices.replace(buffer, "⋅", XmlServices.resolveNumericEntity("⋅")); buffer = StringServices.replace(buffer, "◊", XmlServices.resolveNumericEntity("◊")); buffer = StringServices.replace(buffer, "⌈", XmlServices.resolveNumericEntity("⌈")); buffer = StringServices.replace(buffer, "⌉", XmlServices.resolveNumericEntity("⌉")); buffer = StringServices.replace(buffer, "⌊", XmlServices.resolveNumericEntity("⌊")); buffer = StringServices.replace(buffer, "⌋", XmlServices.resolveNumericEntity("⌋")); buffer = StringServices.replace(buffer, "⟨", XmlServices.resolveNumericEntity("〈")); buffer = StringServices.replace(buffer, "⟩", XmlServices.resolveNumericEntity("〉")); buffer = StringServices.replace(buffer, "←", XmlServices.resolveNumericEntity("←")); buffer = StringServices.replace(buffer, "↑", XmlServices.resolveNumericEntity("↑")); buffer = StringServices.replace(buffer, "→", XmlServices.resolveNumericEntity("→")); buffer = StringServices.replace(buffer, "↓", XmlServices.resolveNumericEntity("↓")); buffer = StringServices.replace(buffer, "↔", XmlServices.resolveNumericEntity("↔")); buffer = StringServices.replace(buffer, "↵", XmlServices.resolveNumericEntity("↵")); buffer = StringServices.replace(buffer, "⇐", XmlServices.resolveNumericEntity("⇐")); buffer = StringServices.replace(buffer, "⇑", XmlServices.resolveNumericEntity("⇑")); buffer = StringServices.replace(buffer, "⇒", XmlServices.resolveNumericEntity("⇒")); buffer = StringServices.replace(buffer, "⇓", XmlServices.resolveNumericEntity("⇓")); buffer = StringServices.replace(buffer, "⇔", XmlServices.resolveNumericEntity("⇔")); buffer = StringServices.replace(buffer, "•", XmlServices.resolveNumericEntity("•")); buffer = StringServices.replace(buffer, "′", XmlServices.resolveNumericEntity("′")); buffer = StringServices.replace(buffer, "″", XmlServices.resolveNumericEntity("″")); buffer = StringServices.replace(buffer, "‾", XmlServices.resolveNumericEntity("‾")); buffer = StringServices.replace(buffer, "⁄", XmlServices.resolveNumericEntity("⁄")); buffer = StringServices.replace(buffer, "℘", XmlServices.resolveNumericEntity("℘")); buffer = StringServices.replace(buffer, "ℑ", XmlServices.resolveNumericEntity("ℑ")); buffer = StringServices.replace(buffer, "ℜ", XmlServices.resolveNumericEntity("ℜ")); buffer = StringServices.replace(buffer, "™", XmlServices.resolveNumericEntity("™")); buffer = StringServices.replace(buffer, "€", XmlServices.resolveNumericEntity("€")); buffer = StringServices.replace(buffer, "ℵ", XmlServices.resolveNumericEntity("ℵ")); buffer = StringServices.replace(buffer, "♠", XmlServices.resolveNumericEntity("♠")); buffer = StringServices.replace(buffer, "♣", XmlServices.resolveNumericEntity("♣")); buffer = StringServices.replace(buffer, "♥", XmlServices.resolveNumericEntity("♥")); buffer = StringServices.replace(buffer, "♦", XmlServices.resolveNumericEntity("♦")); buffer = StringServices.replace(buffer, "Œ", XmlServices.resolveNumericEntity("Œ")); buffer = StringServices.replace(buffer, "œ", XmlServices.resolveNumericEntity("œ")); buffer = StringServices.replace(buffer, "Š", XmlServices.resolveNumericEntity("Š")); buffer = StringServices.replace(buffer, "š", XmlServices.resolveNumericEntity("š")); buffer = StringServices.replace(buffer, "Ÿ", XmlServices.resolveNumericEntity("Ÿ")); buffer = StringServices.replace(buffer, "ƒ", XmlServices.resolveNumericEntity("ƒ")); buffer = StringServices.replace(buffer, " ", XmlServices.resolveNumericEntity(" ")); buffer = StringServices.replace(buffer, " ", XmlServices.resolveNumericEntity(" ")); buffer = StringServices.replace(buffer, " ", XmlServices.resolveNumericEntity(" ")); buffer = StringServices.replace(buffer, "‌", XmlServices.resolveNumericEntity("‌")); buffer = StringServices.replace(buffer, "‍", XmlServices.resolveNumericEntity("‍")); buffer = StringServices.replace(buffer, "‎", XmlServices.resolveNumericEntity("‎")); buffer = StringServices.replace(buffer, "‏", XmlServices.resolveNumericEntity("‏")); buffer = StringServices.replace(buffer, "–", XmlServices.resolveNumericEntity("–")); buffer = StringServices.replace(buffer, "—", XmlServices.resolveNumericEntity("—")); buffer = StringServices.replace(buffer, "‘", XmlServices.resolveNumericEntity("‘")); buffer = StringServices.replace(buffer, "’", XmlServices.resolveNumericEntity("’")); buffer = StringServices.replace(buffer, "‚", XmlServices.resolveNumericEntity("‚")); buffer = StringServices.replace(buffer, "“", XmlServices.resolveNumericEntity("“")); buffer = StringServices.replace(buffer, "”", XmlServices.resolveNumericEntity("”")); buffer = StringServices.replace(buffer, "„", XmlServices.resolveNumericEntity("„")); buffer = StringServices.replace(buffer, "†", XmlServices.resolveNumericEntity("†")); buffer = StringServices.replace(buffer, "‡", XmlServices.resolveNumericEntity("‡")); buffer = StringServices.replace(buffer, "…", XmlServices.resolveNumericEntity("…")); buffer = StringServices.replace(buffer, "‰", XmlServices.resolveNumericEntity("‰")); buffer = StringServices.replace(buffer, "‹", XmlServices.resolveNumericEntity("‹")); buffer = StringServices.replace(buffer, "›", XmlServices.resolveNumericEntity("›")); buffer = StringServices.replace(buffer, "ˆ", XmlServices.resolveNumericEntity("ˆ")); buffer = StringServices.replace(buffer, "˜", XmlServices.resolveNumericEntity("˜")); return buffer; } } src/java/org/dbdoclet/xiphias/ImageServices.java0000644000175000017500000002361112644165236022061 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.xiphias; import java.awt.Graphics; import java.awt.GraphicsConfiguration; import java.awt.GraphicsDevice; import java.awt.GraphicsEnvironment; import java.awt.HeadlessException; import java.awt.Image; import java.awt.Transparency; import java.awt.image.BufferedImage; import java.awt.image.ColorModel; import java.awt.image.PixelGrabber; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import javax.imageio.ImageIO; import javax.swing.ImageIcon; import org.apache.commons.codec.binary.Base64; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.xmlgraphics.java2d.GraphicContext; import org.apache.xmlgraphics.java2d.ps.EPSDocumentGraphics2D; import org.dbdoclet.Sfv; import org.dbdoclet.service.FileServices; public class ImageServices { private static Log logger = LogFactory.getLog(ImageServices.class); public static double A4_WIDTH = 210.0; public static double A4_HEIGHT = 297.0; public static double INCH = 25.4; public static int DPI = 72; public static int getWidth(File imageFile) { if (imageFile == null) { throw new IllegalArgumentException( "The argument imageFile must not be null!"); } try { ImageIcon image = new ImageIcon(imageFile.toURI().toURL()); return image.getIconWidth(); } catch (Throwable oops) { logger.fatal("ImageServices.getWidth", oops); return 100; } } public static int getHeight(File imageFile) { if (imageFile == null) { throw new IllegalArgumentException( "The argument imageFile must not be null!"); } try { ImageIcon image = new ImageIcon(imageFile.toURI().toURL()); return image.getIconHeight(); } catch (Throwable oops) { logger.fatal("ImageServices.getWidth", oops); return 100; } } public static File giftopng(File gifFile) throws IOException { if (gifFile == null) { throw new IllegalArgumentException( "The argument gifFile must not be null!"); } String pngPath = FileServices.getFileBase(gifFile) + ".png"; File pngFile = new File(pngPath); return giftopng(gifFile, pngFile); } public static File giftopng(File gifFile, File pngFile) throws IOException { if (gifFile == null) { throw new IllegalArgumentException( "The argument gifFile must not be null!"); } if (pngFile == null) { throw new IllegalArgumentException( "The argument pngFile must not be null!"); } BufferedImage image = ImageIO.read(gifFile); ImageIO.write(image, "png", pngFile); return pngFile; } public static String toBase64(File inFile) throws IOException { if (inFile == null) { throw new IllegalArgumentException( "The argument inFile must not be null!"); } if (inFile.exists() == false) { throw new IllegalArgumentException( "The argument inFile must exist!"); } byte[] enc = Base64.encodeBase64(FileServices.readToByteArray(inFile)); return new String(enc, "UTF-8"); } public static String toXml(File inFile) throws IOException { String xml = toBase64(inFile); xml = "" + Sfv.LSEP + "" + xml + "" + Sfv.LSEP; return xml; } public static void toEps(File inFile, File epsFile) throws IOException { if (inFile == null) { throw new IllegalArgumentException( "The argument inFile must not be null!"); } if (epsFile == null) { throw new IllegalArgumentException( "The argument epsFile must not be null!"); } String format = FileServices.getExtension(inFile.getName()); format = format.toLowerCase(); if (format.equals("gif") == false && format.equals("jpg") == false && format.equals("png") == false && format.equals("bmp") == false) { throw new IllegalArgumentException("UnsupportedFormat " + format + "!"); } if (inFile.exists() == false) { throw new FileNotFoundException("No such file : " + inFile.getAbsolutePath()); } if (inFile.canRead() == false) { throw new IOException("File is not readable: " + inFile.getAbsolutePath()); } BufferedImage image = ImageIO.read(inFile); EPSDocumentGraphics2D graphics = new EPSDocumentGraphics2D(false); graphics.setGraphicContext(new GraphicContext()); FileOutputStream out = new FileOutputStream(epsFile); int maxWidth = (int) (A4_WIDTH * 0.95 / INCH) * DPI; if (image.getWidth() > maxWidth) { double ratio = (double) image.getHeight() / (double) image.getWidth(); int newHeight = (int) (ratio * maxWidth); // This code ensures that all the pixels in the image are loaded image = toBufferedImage(image.getScaledInstance(maxWidth, newHeight, Image.SCALE_SMOOTH)); } graphics.setupDocument(out, image.getWidth(null), image.getHeight(null)); graphics.drawImage(image, 0, 0, null); graphics.finish(); } public static boolean scale(File imageFile, int maxWidth) throws IOException { if (imageFile == null) { throw new IllegalArgumentException( "The argument imageFile must not be null!"); } if (maxWidth < 1) { throw new IllegalArgumentException( "The argument maxWidth must not be less than 1!"); } String format = FileServices.getExtension(imageFile.getName()); BufferedImage image = ImageIO.read(imageFile); logger.debug("Bild = " + imageFile.getName()); int width = image.getWidth(); logger.debug("Bildbreite = " + width); int height = image.getHeight(); logger.debug("Bildhöhe = " + height); if (width > maxWidth) { float factor = (float) maxWidth / (float) width; logger.debug("Skalierungsfaktor = " + factor); height *= factor; width = maxWidth; Image scaledImage = image.getScaledInstance(width, height, Image.SCALE_SMOOTH); BufferedImage scaledBufferedImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); Graphics graphics = scaledBufferedImage.getGraphics(); graphics.drawImage(scaledImage, 0, 0, null); ImageIO.write(scaledBufferedImage, format, imageFile); return true; } return false; } public static ImageIcon getScaledIcon(ImageIcon icon, int width, int height) { if (height < 1 && width < 1) { throw new IllegalArgumentException( "Both arguments height and width must not be smaller than 1!"); } int iconHeight = icon.getIconHeight(); int iconWidth = icon.getIconWidth(); if (iconHeight < 1 && iconWidth < 1) { return icon; } if (width < 1) { width = (height * iconWidth) / iconHeight; if (width < 1) { width = 1; } } if (height < 1) { height = (width * iconHeight) / iconWidth; if (height < 1) { height = 1; } } Image image = icon.getImage().getScaledInstance(width, height, Image.SCALE_SMOOTH); icon.setImage(image); return icon; } public static BufferedImage toBufferedImage(Image image) { if (image == null) { throw new IllegalArgumentException( "The argument image must not be null!"); } if (image instanceof BufferedImage) { return (BufferedImage) image; } // This code ensures that all the pixels in the image are loaded image = new ImageIcon(image).getImage(); // Determine if the image has transparent pixels; for this method's // implementation, see e661 Determining If an Image Has Transparent // Pixels boolean hasAlpha = hasAlpha(image); // Create a buffered image with a format that's compatible with the // screen BufferedImage bimage = null; GraphicsEnvironment ge = GraphicsEnvironment .getLocalGraphicsEnvironment(); try { // Determine the type of transparency of the new buffered image int transparency = Transparency.OPAQUE; if (hasAlpha) { transparency = Transparency.BITMASK; } // Create the buffered image GraphicsDevice gs = ge.getDefaultScreenDevice(); GraphicsConfiguration gc = gs.getDefaultConfiguration(); bimage = gc.createCompatibleImage(image.getWidth(null), image.getHeight(null), transparency); } catch (HeadlessException e) { // The system does not have a screen logger.error("headless exception creating buffered image", e); } if (bimage == null) { // Create a buffered image using the default color model int type = BufferedImage.TYPE_INT_RGB; if (hasAlpha) { type = BufferedImage.TYPE_INT_ARGB; } bimage = new BufferedImage(image.getWidth(null), image.getHeight(null), type); } // Copy image to buffered image Graphics g = bimage.createGraphics(); // Paint the image onto the buffered image g.drawImage(image, 0, 0, null); g.dispose(); return bimage; } /** * This method returns true if the specified image has transparent pixels */ public static boolean hasAlpha(Image image) { // If buffered image, the color model is readily available if (image instanceof BufferedImage) { BufferedImage bimage = (BufferedImage) image; return bimage.getColorModel().hasAlpha(); } // Use a pixel grabber to retrieve the image's color model; // grabbing a single pixel is usually sufficient PixelGrabber pg = new PixelGrabber(image, 0, 0, 1, 1, false); try { pg.grabPixels(); } catch (InterruptedException oops) { oops.printStackTrace(); } // Get the image's color model ColorModel cm = pg.getColorModel(); return cm.hasAlpha(); } } src/java/org/dbdoclet/xiphias/XmlConstants.java0000644000175000017500000000213612644165236021767 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.xiphias; public class XmlConstants { public static final String NAMESPACE_XINCLUDE = "http://www.w3.org/2001/XInclude"; public static final String NAMESPACE_XLINK = "http://www.w3.org/1999/xlink"; public static final String NAMESPACE_XML = "http://www.w3.org/XML/1998/namespace"; public static final String NAMESPACE_DOCBOOK = "http://docbook.org/ns/docbook"; } src/java/org/dbdoclet/xiphias/Resources_de.properties0000644000175000017500000000175612644165236023236 0ustar mathieumathieu# Java Resource Bundle # Modified by Zaval JRC Editor (C) Zaval CE Group # http://www.zaval.org/products/jrc-editor/ C_ERROR=Fehler C_INCLUDING_FILE=Einbinden der Datei {0}... C_XML_VALIDATION_ERROR={0}:{1}:{2}\n\ Fehler in Zeile {1}, Spalte {2}\n\ {3} C_XML_VALIDATION_ERROR_FILE_CAN_NOT_READ={0}: Die Datei darf nicht gelesen werden C_XML_VALIDATION_ERROR_FILE_NOT_FOUND={0}: Die Datei konnte nicht gefunden werden.\ C_XML_VALIDATION_FAILED=Die Validierung der XML-Datei ist FEHLGESCHLAGEN! C_XML_VALIDATION_FATAL={0}:{1}:{2}\n\ Fataler Fehler in Zeile {1}, Spalte {2}\n\ {3} C_XML_VALIDATION_NUMBER_OF_ERRORS=Anzahl der Fehler: {0} C_XML_VALIDATION_OF_FILE=Validierung der Datei {0}. C_XML_VALIDATION_REPORT=Report der XML-Validierung C_XML_VALIDATION_REPORT_DATE=Datum: {0} C_XML_VALIDATION_REPORT_TIME=Uhrzeit: {0} C_XML_VALIDATION_SUCCESSFUL=Die Validierung der XML-Datei verlief ERFOLGREICH. C_XML_VALIDATION_WARNING={0}:{1}:{2}\n\ Warnung in Zeile {1}, Spalte {2}\n\ {3} src/java/org/dbdoclet/xiphias/dom/0000755000175000017500000000000012644165244017243 5ustar mathieumathieusrc/java/org/dbdoclet/xiphias/dom/ElementImpl.java0000644000175000017500000002612212644165236022325 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.xiphias.dom; import java.io.UnsupportedEncodingException; import java.net.URLDecoder; import java.util.ArrayList; import java.util.Map; import java.util.TreeMap; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.stream.Collectors; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.dbdoclet.service.StringServices; import org.w3c.dom.Attr; import org.w3c.dom.DOMException; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.w3c.dom.TypeInfo; public class ElementImpl extends NodeImpl implements Element { public static final int FORMAT_BLOCK = 3; public static final int FORMAT_CONTENT = 2; public static final int FORMAT_INLINE = 1; private static int idCounter = 1; private static Log logger = LogFactory.getLog(ElementImpl.class); private static final Pattern xmlIdPattern = Pattern.compile("[^\\w\\.-]+"); private static final Pattern xmlNameStartPattern = Pattern .compile("^[a-zA-Z_].*$"); private Map attributes = new TreeMap<>(); private int formatType = FORMAT_CONTENT; private boolean isLiteral = false; public static String hardenId(String id) { if (id == null || id.length() == 0) { id = StringServices.fillInt(idCounter++, 5); id = "N" + id; } String buffer = new String(id); try { buffer = URLDecoder.decode(buffer, "UTF-8"); } catch (UnsupportedEncodingException oops) { logger.fatal("Decoding of id '" + buffer + "' failed!", oops); } Matcher matcher = xmlIdPattern.matcher(buffer); buffer = matcher.replaceAll("-"); matcher = xmlNameStartPattern.matcher(buffer); if (matcher.matches() == false) { buffer = "dbdoclet." + buffer; } return buffer; } public ElementImpl() { super(); setNodeType(Node.ELEMENT_NODE); } public ElementImpl(String name) { super(name); setNodeType(Node.ELEMENT_NODE); } public ElementImpl(String name, NodeImpl parent) { super(name, parent); setNodeType(Node.ELEMENT_NODE); } private void addAttribute(Attr newAttr) { String key = createAttributeKey(newAttr.getNamespaceURI(), newAttr.getNodeName()); attributes.put(key, newAttr); } public void clearAttributes() { attributes = new TreeMap(); } public void closed() { } private String createAttributeKey(String namespaceUri, String name) { if (name == null) { throw new IllegalArgumentException("The argument name must not be null!"); } if (name.contains(":")) { name = name.split(":")[1]; } String key = name; if (namespaceUri != null && namespaceUri.trim().length() > 0) { key = String.format("{%s %s}", namespaceUri, name); } return key; } /** * Liefert alle Kindelement des angegebenen Typs zurück. * * @param type * @return ArrayList */ @SuppressWarnings("unchecked") public ArrayList findChildren(Class type) { ArrayList list = new ArrayList(); for (Element element : getChildElementList()) { if (type.isInstance(element)) { list.add((T) element); } } return list; } public Element findFirstElement() { ArrayList childList = getChildElementList(); if (childList != null && childList.size() > 0) { return childList.get(0); } return null; } @Override public String getAttribute(String name) { if ((name == null) || name.equals("")) { return ""; } name = name.toLowerCase(); Attr attr = attributes.get(name); if (attr == null) { return null; } return attr.getValue(); } @Override public Attr getAttributeNode(String name) { if ((name == null) || name.equals("")) { return null; } name = name.toLowerCase(); return attributes.get(createAttributeKey(null, name)); } @Override public Attr getAttributeNodeNS(String namespaceURI, String localName) throws DOMException { String key = createAttributeKey(namespaceURI, localName); return attributes.get(key); } @Override public String getAttributeNS(String namespaceURI, String localName) throws DOMException { Attr attr = getAttributeNodeNS(namespaceURI, localName); if (attr != null) { return attr.getNodeValue(); } return null; } @Override public NamedNodeMap getAttributes() { NamedNodeMapImpl map = new NamedNodeMapImpl(); for (Attr attr : attributes.values()) { map.setNamedItem(attr); } return map; } @Override public Map getAttributesAsMap() { if (attributes == null) { attributes = new TreeMap(); } return attributes; } public String getAttributesAsText() { if ((attributes != null) && (attributes.size() > 0)) { validateAttributes(); return attributes.values().stream().map(a -> { return a.getNodeName() + "=\"" + a.getNodeValue() + "\""; }) .collect(Collectors.joining(" ")); } return ""; } public boolean getBooleanAttribute(String name) { if ((name == null) || name.equals("")) { return false; } Attr attr = attributes.get(name); String bval = "false"; if (attr != null) { String value = attr.getValue(); if (value != null && value.trim().equals("1")) { bval = "true"; } } Boolean b = new Boolean(bval); return b.booleanValue(); } @Override public NodeList getElementsByTagName(String name) { ElementByTagNameVisitor visitor = new ElementByTagNameVisitor(name); DOMTraverser dt = new DOMTraverser(visitor); try { dt.traverse(this); } catch (Exception e) { e.printStackTrace(); } return visitor.getElementList(); } @Override public NodeList getElementsByTagNameNS(String namespaceURI, String localName) throws DOMException { // TODO Auto-generated method stub return null; } public int getFormatType() { return formatType; } public String getId() { return getAttribute("id"); } public Integer getIntAttribute(String name) { if ((name == null) || name.equals("")) { return null; } Attr attr = attributes.get(name); if (attr == null) { return null; } String value = attr.getValue(); if (value == null || value.trim().length() == 0) { return null; } int number = 0; try { number = Integer.parseInt(value.trim()); } catch (NumberFormatException oops) { logger.warn("Attribute " + name + " of tag " + getTagName() + " is not a valid integer. It has a value of '" + value + "'."); return null; } return number; } @Override public TypeInfo getSchemaTypeInfo() { // TODO Auto-generated method stub return null; } @Override public String getTagName() { return getNodeName(); } @Override public boolean hasAttribute(String name) { // TODO Auto-generated method stub return false; } @Override public boolean hasAttributeNS(String namespaceURI, String localName) throws DOMException { // TODO Auto-generated method stub return false; } public boolean isFirstChildElement() { ElementImpl parent = (ElementImpl) getParentNode(); Element first = parent.getFirstChildElement(); if (first != null && this == first) { return true; } return false; } public boolean isLiteral() { return isLiteral; } public NodeImpl isLiteral(boolean isLiteral) { this.isLiteral = isLiteral; return this; } @Override public void removeAttribute(String name) throws DOMException { if (name != null) { if (isCaseInsensitive) { name = name.toLowerCase(); } attributes.remove(name); } } @Override public Attr removeAttributeNode(Attr oldAttr) throws DOMException { if (oldAttr == null) { return null; } return attributes.remove(oldAttr.getName()); } @Override public void removeAttributeNS(String namespaceURI, String localName) throws DOMException { // TODO Auto-generated method stub } public void setAttribute(String name, Object value) throws DOMException { if (value != null) { setAttribute(name, value.toString()); } } @Override public void setAttribute(String name, String value) throws DOMException { if (name != null && name.length() > 0 && value != null) { if (isCaseInsensitive) { name = name.toLowerCase(); } AttrImpl attr = (AttrImpl) getDocument().createAttribute(name); attr.setNodeValue(value); attr.setOwnerElement(this); addAttribute(attr); } } @Override public Attr setAttributeNode(Attr newAttr) throws DOMException { if (newAttr == null) { return null; } String name = newAttr.getName(); Attr oldAttr = attributes.get(name); addAttribute(newAttr); return oldAttr; } @Override public Attr setAttributeNodeNS(Attr newAttr) throws DOMException { return null; } @Override public void setAttributeNS(String namespaceUri, String qualifiedName, String value) throws DOMException { AttrImpl attr = (AttrImpl) getDocument().createAttributeNS(namespaceUri, qualifiedName); attr.setNodeValue(value); attr.setOwnerElement(this); addAttribute(attr); } public NodeImpl setFormatType(int formatType) { this.formatType = formatType; return this; } public void setId(int number) { setAttribute("id", String.valueOf(number)); } public void setId(String id) { setAttribute("id", hardenId(id)); } @Override public void setIdAttribute(String name, boolean isId) throws DOMException { // TODO Auto-generated method stub } @Override public void setIdAttributeNode(Attr idAttr, boolean isId) throws DOMException { // TODO Auto-generated method stub } @Override public void setIdAttributeNS(String namespaceURI, String localName, boolean isId) throws DOMException { // TODO Auto-generated method stub } public NodeImpl setTrafoAttributes(Map nattrs) { if (nattrs == null) { throw new IllegalArgumentException("Parameter attributes is null!"); } attributes.putAll(nattrs); attributes.values().stream().forEach(attr -> { ((AttrImpl) attr).setOwnerElement(this);}); return this; } public NodeImpl setTrafoStringAttributes(Map tokenAttrs) { if (tokenAttrs == null) { throw new IllegalArgumentException("Parameter attributes is null!"); } for (String tokenAttrName : tokenAttrs.keySet()) { String attrName = tokenAttrName; if (isCaseInsensitive) { attrName = attrName.toLowerCase(); } AttrImpl attr = (AttrImpl) getDocument().createAttribute(attrName); attr.setNodeValue(tokenAttrs.get(tokenAttrName)); attr.setOwnerElement(this); addAttribute(attr); } return this; } } src/java/org/dbdoclet/xiphias/dom/NodeListImpl.java0000644000175000017500000000266712644165236022465 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.xiphias.dom; import java.util.ArrayList; import java.util.Iterator; import org.w3c.dom.Node; import org.w3c.dom.NodeList; public class NodeListImpl extends ArrayList implements NodeList { private static final long serialVersionUID = 1L; public int getLength() { return size(); } public Node item(int index) { if ((index < 0) || (index >= size())) { return null; } Object obj = get(index); if (obj instanceof Node) { return (Node) obj; } else { throw new IllegalStateException( "Object in NodeList is not of type Node but of type " + obj); } } @Override public Iterator iterator() { Iterator iterator = super.iterator(); return iterator; } } src/java/org/dbdoclet/xiphias/dom/AbstractNodeVisitor.java0000644000175000017500000000342012644165236024037 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.xiphias.dom; import java.util.ArrayList; import org.dbdoclet.progress.ProgressEvent; import org.dbdoclet.progress.ProgressListener; import org.dbdoclet.progress.ProgressManager; import org.w3c.dom.Node; public abstract class AbstractNodeVisitor implements INodeVisitor { protected final ArrayList listeners; private ProgressManager pm; public AbstractNodeVisitor() { this.listeners = new ArrayList(); pm = new ProgressManager(listeners); } public AbstractNodeVisitor(ArrayList listeners) { this.listeners = listeners; pm = new ProgressManager(listeners); } protected void fireProgressEvent(String msg, int stage) { ProgressEvent event = new ProgressEvent(msg); event.setStage(stage); pm.fireProgressEvent(event); } public abstract void accept(Node node) throws Exception; protected void removeNodes(ArrayList nodeList) { for (Node node : nodeList) { Node parent = node.getParentNode(); if (parent != null) { parent.removeChild(node); } } } }src/java/org/dbdoclet/xiphias/dom/DocumentImpl.java0000644000175000017500000001656412644165236022523 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.xiphias.dom; import java.util.HashMap; import org.dbdoclet.Sfv; import org.dbdoclet.xiphias.W3cServices; import org.dbdoclet.xiphias.XmlConstants; import org.w3c.dom.Attr; import org.w3c.dom.CDATASection; import org.w3c.dom.Comment; import org.w3c.dom.DOMConfiguration; import org.w3c.dom.DOMException; import org.w3c.dom.DOMImplementation; import org.w3c.dom.Document; import org.w3c.dom.DocumentFragment; import org.w3c.dom.DocumentType; import org.w3c.dom.Element; import org.w3c.dom.EntityReference; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.w3c.dom.ProcessingInstruction; import org.w3c.dom.Text; public class DocumentImpl extends NodeImpl implements Document { private DocumentType docType; private ElementImpl documentElement; private HashMap namespacePrefixMap = new HashMap<>(); private String xmlEncoding = "UTF-8"; private String xmlVersion = "1.0"; public DocumentImpl() { super("#document", null); setNodeType(DOCUMENT_NODE); setXmlEncoding("UTF-8"); setXmlVersion("1.0"); namespacePrefixMap.put(XmlConstants.NAMESPACE_XML, "xml"); } @Override public Node adoptNode(Node source) throws DOMException { throw new IllegalStateException("Not yet implemented"); } @Override public Attr createAttribute(String name) throws DOMException { AttrImpl attr = new AttrImpl(); attr.setNodeName(name); return attr; } @Override public Attr createAttributeNS(String namespaceUri, String qualifiedName) throws DOMException { String prefix = manageNamespace(namespaceUri, qualifiedName); AttrImpl attr = new AttrImpl(); attr.setPrefix(prefix); attr.setNamespaceURI(namespaceUri); attr.setNodeName(qualifiedName); return attr; } @Override public CDATASection createCDATASection(String data) throws DOMException { throw new IllegalStateException("Not yet implemented"); } @Override public Comment createComment(String data) { throw new IllegalStateException("Not yet implemented"); } @Override public DocumentFragment createDocumentFragment() { throw new IllegalStateException("Not yet implemented"); } @Override public ElementImpl createElement(String tagName) throws DOMException { ElementImpl elem = new ElementImpl(tagName); elem.setDocument(this); elem.setFormatType(FORMAT_BLOCK); return elem; } @Override public Element createElementNS(String namespaceUri, String qualifiedName) throws DOMException { String prefix = manageNamespace(namespaceUri, qualifiedName); ElementImpl elem = new ElementImpl(); elem.setNamespaceURI(namespaceUri); elem.setPrefix(prefix); elem.setNodeName(qualifiedName); return elem; } @Override public EntityReference createEntityReference(String name) throws DOMException { throw new IllegalStateException("Not yet implemented"); } @Override public ProcessingInstruction createProcessingInstruction(String target, String data) throws DOMException { throw new IllegalStateException("Not yet implemented"); } @Override public Text createTextNode(String data) { TextImpl text = new TextImpl(data); text.setDocument(this); return text; } public String createXmlDeclaration() { return "" + Sfv.LSEP; } @Override public DocumentType getDoctype() { return docType; } @Override public Element getDocumentElement() { if (documentElement == null) { return (Element) getFirstChildElement(); } return documentElement; } @Override public String getDocumentURI() { throw new IllegalStateException("Not yet implemented"); } @Override public DOMConfiguration getDomConfig() { throw new IllegalStateException("Not yet implemented"); } @Override public Element getElementById(String elementId) { throw new IllegalStateException("Not yet implemented"); } @Override public NodeList getElementsByTagName(String tagname) { throw new IllegalStateException("Not yet implemented"); } @Override public NodeList getElementsByTagNameNS(String namespaceURI, String localName) { throw new IllegalStateException("Not yet implemented"); } @Override public DOMImplementation getImplementation() { throw new IllegalStateException("Not yet implemented"); } @Override public String getInputEncoding() { throw new IllegalStateException("Not yet implemented"); } @Override public boolean getStrictErrorChecking() { throw new IllegalStateException("Not yet implemented"); } @Override public String getXmlEncoding() { return xmlEncoding; } @Override public boolean getXmlStandalone() { throw new IllegalStateException("Not yet implemented"); } @Override public String getXmlVersion() { return xmlVersion; } @Override public Node importNode(Node importedNode, boolean deep) throws DOMException { Node clone = W3cServices.copyNode(this, importedNode); if (deep == false) { NodeList childList = clone.getChildNodes(); for (int i = 0; i < childList.getLength(); i++) { clone.removeChild(childList.item(i)); } } return clone; } @Override public void normalizeDocument() { throw new IllegalStateException("Not yet implemented"); } @Override public Node renameNode(Node n, String namespaceURI, String qualifiedName) throws DOMException { throw new IllegalStateException("Not yet implemented"); } public void setDoctype(DocumentType docType) { this.docType = docType; } public void setDocumentElement(ElementImpl documentElement) { this.documentElement = documentElement; } @Override public void setDocumentURI(String documentURI) { throw new IllegalStateException("Not yet implemented"); } @Override public void setStrictErrorChecking(boolean strictErrorChecking) { throw new IllegalStateException("Not yet implemented"); } public void setXmlEncoding(String xmlEncoding) { this.xmlEncoding = xmlEncoding; } @Override public void setXmlStandalone(boolean xmlStandalone) throws DOMException { throw new IllegalStateException("Not yet implemented"); } @Override public void setXmlVersion(String xmlVersion) throws DOMException { this.xmlVersion = xmlVersion; } private String manageNamespace(String namespaceUri, String qualifiedName) { String prefix = null; if (qualifiedName.contains(":")) { String[] tokens = qualifiedName.split(":"); prefix = tokens[0]; } if (namespaceUri == null && prefix != null) { throw new DOMException(DOMException.NAMESPACE_ERR, String.format( "No namespace for prefix %s defined", prefix)); } if (namespaceUri != null && prefix != null) { String value = namespacePrefixMap.get(namespaceUri); if (value == null) { namespacePrefixMap.put(namespaceUri, prefix); } } return prefix; } } src/java/org/dbdoclet/xiphias/dom/NamedNodeMapImpl.java0000644000175000017500000000415312644165236023224 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.xiphias.dom; import java.util.LinkedHashMap; import org.w3c.dom.DOMException; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; public class NamedNodeMapImpl extends LinkedHashMap implements NamedNodeMap { private static final long serialVersionUID = 1L; public int getLength() { return size(); } public Node getNamedItem(String name) { return get(name); } public Node getNamedItemNS(String namespaceURI, String localName) throws DOMException { return get(namespaceURI + ":" + localName); } public Node item(int index) { Node[] nodes = values().toArray(new Node[0]); if (nodes == null || index >= nodes.length || index < 0) { return null; } return nodes[index]; } public Node removeNamedItem(String name) throws DOMException { return remove(name); } public Node removeNamedItemNS(String namespaceURI, String localName) throws DOMException { return remove(namespaceURI + ":" + localName); } public Node setNamedItem(Node node) throws DOMException { put(node.getLocalName(), node); return node; } public Node setNamedItemNS(Node node) throws DOMException { String namespace = node.getNamespaceURI(); put(namespace + ":" + node.getLocalName(), node); return node; } } src/java/org/dbdoclet/xiphias/dom/AttrImpl.java0000644000175000017500000000306112644165236021643 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.xiphias.dom; import org.w3c.dom.Attr; import org.w3c.dom.DOMException; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.TypeInfo; public class AttrImpl extends NodeImpl implements Attr { private Element ownerElement; public String getName() { return getNodeName(); } public Element getOwnerElement() { return ownerElement; } public TypeInfo getSchemaTypeInfo() { return null; } public boolean getSpecified() { return false; } public String getValue() { return getNodeValue(); } public boolean isId() { return false; } public void setOwnerElement(Element ownerElement) { this.ownerElement = ownerElement; } public void setValue(String value) throws DOMException { setNodeValue(value); } } src/java/org/dbdoclet/xiphias/dom/EntityImpl.java0000644000175000017500000000427312644165236022213 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.xiphias.dom; import org.w3c.dom.Entity; import org.w3c.dom.Node; public class EntityImpl extends NodeImpl implements Entity { private String inputEncoding; private String notationName; private String publicId; private String systemId; private String xmlEncoding; private String xmlVersion; public EntityImpl(String name, String systemId) { this.systemId = systemId; setNodeType(Node.ENTITY_NODE); setNodeName(name); } public String getInputEncoding() { return inputEncoding; } public String getNotationName() { return notationName; } public String getPublicId() { return publicId; } public String getSystemId() { return systemId; } public String getXmlEncoding() { return xmlEncoding; } public String getXmlVersion() { return xmlVersion; } public void setInputEncoding(String inputEncoding) { this.inputEncoding = inputEncoding; } public void setNotationName(String notationName) { this.notationName = notationName; } public void setPublicId(String publicId) { this.publicId = publicId; } public void setSystemId(String systemId) { this.systemId = systemId; } public void setXmlEncoding(String xmlEncoding) { this.xmlEncoding = xmlEncoding; } public void setXmlVersion(String xmlVersion) { this.xmlVersion = xmlVersion; } } src/java/org/dbdoclet/xiphias/dom/NodeImpl.java0000644000175000017500000007025112644165236021623 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.xiphias.dom; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.stream.Collectors; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.dbdoclet.service.StringServices; import org.dbdoclet.xiphias.XmlServices; import org.dbdoclet.xiphias.annotation.Annotation; import org.w3c.dom.Attr; import org.w3c.dom.DOMException; import org.w3c.dom.Document; import org.w3c.dom.DocumentFragment; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.w3c.dom.Text; import org.w3c.dom.UserDataHandler; /** * The class Node represents a node in a document tree. * * @author Michael Fuchs * @version 1.0 */ public class NodeImpl implements Node { public static final int FORMAT_BLOCK = 3; public static final int FORMAT_CONTENT = 2; public static final int FORMAT_INLINE = 1; public static final int HTML = 3; private static Log logger = LogFactory.getLog(NodeImpl.class); private static final String LSEP = System.getProperty("line.separator"); public static final int SGML = 1; public static final int XML = 2; private static int flavour = XML; public static final short XML_DECLARATION = 23; private NodeListImpl childNodes = new NodeListImpl(); private int column; private DocumentImpl document; protected boolean isCaseInsensitive = false; private boolean isEmpty = false; private boolean isMute = false; private boolean isRawData = false; private int line; private String namespaceUri; private boolean needsPadding = false; private String nodeName = "node"; private short nodeType = ELEMENT_NODE; private String nodeValue; private NodeImpl parent = null; private String prefix; private HashMap userDataMap; private ArrayList annotationList; /** * The method findParent tries to find the nearest parent, * which is of type parentClass. * * If no parent of this type can be found null is returned. * * @param node * a Node value * @param parentClass * a Class value * @return a Node value */ public static NodeImpl findParent(Node node, Class parentClass) { if (node == null || parentClass == null) { return null; } Node parent = node.getParentNode(); while (parent != null && !parentClass.isInstance(parent)) { parent = parent.getParentNode(); } return (NodeImpl) parent; } public static String getTextContent(NodeImpl node) { String buffer = ""; if (node instanceof TextImpl) { buffer += ((TextImpl) node).getData(); } NodeListImpl children = node.getTrafoChildNodes(); if (children == null) { return buffer; } Iterator iterator = children.iterator(); NodeImpl o; while (iterator.hasNext()) { o = iterator.next(); if (o == null || o instanceof CommentImpl) { continue; } if (o instanceof TextImpl) { buffer += ((TextImpl) o).getData(); } else { try { buffer += NodeImpl.getTextContent(o); } catch (StackOverflowError oops) { logger.fatal("[NodeImpl.getTextContent] StackOverflowError. Possibly recursive structure detected!!! Node: " + node.toString()); } } } return buffer; } public static void setCodeType(int type) { switch (type) { case HTML: flavour = HTML; break; case SGML: flavour = SGML; break; case XML: flavour = XML; break; default: throw new IllegalArgumentException("Wrong type " + type); } // end of switch () } public static void setCodeType(String type) { if (type == null) { return; } if (type.equalsIgnoreCase("xml")) { flavour = XML; } else if (type.equalsIgnoreCase("sgml")) { flavour = SGML; } else if (type.equalsIgnoreCase("html")) { flavour = HTML; } else { logger.error("Unknown type " + type + ". Using SGML!"); } } public static void traverse(Node node, INodeVisitor visitor) throws Exception { if (node != null) { if (node instanceof Document) { Document doc = (Document) node; if (doc.getDocumentElement() != null) { node = doc.getDocumentElement(); } } if (visitor != null) { visitor.accept(node); } NodeList childList = node.getChildNodes(); for (int i = 0; i < childList.getLength(); i++) { traverse(childList.item(i), visitor); } } } public NodeImpl() { super(); } public NodeImpl(String name) { this(name, null); } public NodeImpl(String name, NodeImpl parent) { if (name != null) { nodeName = name; } if (isCaseInsensitive) { nodeName = nodeName.toLowerCase(); } this.parent = parent; } public void addAnnotation(Annotation annotation) { if (annotation != null) { if (annotationList == null) { annotationList = new ArrayList<>(); } annotationList.add(annotation); } } @Override public Node appendChild(Node newChild) throws DOMException { if (newChild instanceof NodeImpl) { return appendChild((NodeImpl) newChild); } throw new IllegalArgumentException("The new child must be of type " + NodeImpl.class.getName()); } /** * The method appendChild adds a child node to this node. * * The parent of the child node is explicitly set to this node to this node * to avoid inconsistencies in the resulting document tree. * * @param node * The child node {@link NodeImpl (Node)}. */ public NodeImpl appendChild(NodeImpl node) { if (node == null) { throw new IllegalArgumentException("Variable node is null!"); } if (childNodes == null) { throw new IllegalStateException("Variable childNodes is null!"); } node.setParentNode(this); if (node instanceof DocumentFragment) { NodeList childList = node.getChildNodes(); for (int i=0; i parentClass) { Node parent = this.getParentNode(); return findParent(parent, parentClass); } @Override public NamedNodeMap getAttributes() { if (this instanceof Element) { return ((Element) this).getAttributes(); } return null; } public Map getAttributesAsMap() { if (this instanceof ElementImpl) { return this.getAttributesAsMap(); } return null; } @Override public String getBaseURI() { System.err.println("Not yet implemented"); return null; } public ArrayList getChildElementList() { ArrayList list = new ArrayList(); if (childNodes != null) { for (Node child : childNodes) { if (child instanceof Element) { list.add((Element) child); } } } return list; } /** * The method getChildNodes returns a list with all children of * this node.. * * @return an ArrayList value */ @Override public NodeList getChildNodes() { if (childNodes == null) { throw new IllegalStateException("Variable childNodes is null!"); } return childNodes; } public int getColumn() { return column; } public DocumentImpl getDocument() { if (document == null) { Node parent = getParentNode(); while (parent != null && document == null) { document = (DocumentImpl) parent.getOwnerDocument(); parent = parent.getParentNode(); } } if (document == null) { document = new DocumentImpl(); } return document; } public NodeListImpl getElementChildNodes() { if (childNodes == null) { throw new IllegalStateException("Variable childNodes is null!"); } NodeListImpl list = new NodeListImpl(); for (int i = 0; i < childNodes.getLength(); i++) { Node child = childNodes.item(i); if (child instanceof ElementImpl) { list.add((NodeImpl) child); } } return list; } @Override public Object getFeature(String feature, String version) { System.err.println("Not yet implemented"); return null; } /** * The method getFirstChild returns the first child of this * node. * * If this node has no children, null is returned. * * @return a Node value */ @Override public NodeImpl getFirstChild() { if (childNodes == null || childNodes.size() < 1) { return null; } return childNodes.get(0); } /** * The method getFirstElement returns the first child of this * node that is of type ELEMENT_NODE. * * If this node has no element child, null is returned. * * @return The element or null, if element child can be found. */ public Element getFirstChildElement() { if ((childNodes == null) || (childNodes.size() < 1)) { return null; } NodeImpl element = null; for (int i = 0; i < childNodes.size(); i++) { if (childNodes.get(i) instanceof ElementImpl) { element = childNodes.get(i); break; } } return (Element) element; } public Text getFirstText() { if ((childNodes == null) || (childNodes.size() < 1)) { return null; } NodeImpl element = null; for (int i = 0; i < childNodes.size(); i++) { if (childNodes.get(i) instanceof Text) { element = childNodes.get(i); break; } } return (Text) element; } /* ========================================================== */ /* Extensions */ /* ========================================================== */ public int getFlavour() { return flavour; } @Override public Node getLastChild() { if (childNodes == null || childNodes.size() == 0) { return null; } return childNodes.get(childNodes.size() - 1); } public NodeImpl getLastChild(Class type) { if (type == null) { throw new IllegalArgumentException( "The argument type must not be null!"); } if ((childNodes == null) || (childNodes.size() < 1)) { return null; } NodeImpl element = null; NodeImpl node; String classname; for (int i = 0; i < childNodes.size(); i++) { node = childNodes.get(i); classname = node.getClass().getName(); if (classname.equals(type.getName())) { element = childNodes.get(i); } } return element; } public int getLine() { return line; } @Override public String getLocalName() { if (this instanceof ElementImpl || this instanceof AttrImpl || this instanceof EntityImpl) { String qualifiedName = getNodeName(); if (qualifiedName.indexOf(':') == -1) { return qualifiedName; } else { return qualifiedName.split(":")[1]; } } return null; } @Override public String getNamespaceURI() { return namespaceUri; } @Override public Node getNextSibling() { NodeImpl parent = getTrafoParentNode(); if (parent == null) { return null; } int index = 0; NodeListImpl children = parent.getTrafoChildNodes(); for (NodeImpl child : children) { if (child == this) { break; } index++; } if (index < (children.size() - 1)) { return children.get(index + 1); } return null; } @Override public String getNodeName() { return nodeName; } @Override public short getNodeType() { return nodeType; } @Override public String getNodeValue() throws DOMException { return nodeValue; } public int getNumberOfChildNodes() { return childNodes.size(); } @Override public Document getOwnerDocument() { return getDocument(); } @Override public Node getParentNode() { return parent; } @Override public String getPrefix() { if (prefix != null) { return prefix; } if (this instanceof ElementImpl || this instanceof AttrImpl) { String qualifiedName = getNodeName(); if (qualifiedName.indexOf(':') == -1) { return null; } else { return qualifiedName.split(":")[0]; } } return null; } @Override public Node getPreviousSibling() { NodeImpl parent = getTrafoParentNode(); if (parent == null) { return null; } int index = 0; NodeListImpl children = parent.getTrafoChildNodes(); for (NodeImpl child : children) { if (child == this) { break; } index++; } if (index > 0) { return children.get(index - 1); } return null; } public NodeImpl getRoot() { Node parent = getParentNode(); if (parent == null) { return this; } Node root = parent; while (parent != null) { parent = parent.getParentNode(); if (parent != null) { root = parent; } } return (NodeImpl) root; } @Override public String getTextContent() { return NodeImpl.getTextContent(this); } public NodeListImpl getTrafoChildNodes() { if (childNodes == null) { childNodes = new NodeListImpl(); } return childNodes; } public NodeImpl getTrafoParentNode() { return parent; } @Override public Object getUserData(String key) { if (key == null || userDataMap == null) { return null; } return userDataMap.get(key); } public String hardenText(String text) { if (text == null) { return ""; } String buffer = StringServices.replace(text, "&", "&"); buffer = StringServices.replace(buffer, "<", "<"); buffer = StringServices.replace(buffer, ">", ">"); return buffer; } @Override public boolean hasAttributes() { System.err.println("Not yet implemented"); return false; } /** * The method hasChildren returns true, if the node contains * any children. * * @return an int value */ @Override public boolean hasChildNodes() { if (childNodes == null) { throw new IllegalStateException("Parameter childNodes is null!"); } int size = childNodes.size(); if (size > 0) { return true; } else { return false; } } /** * The method hasElementChildren returns true, if the node * contains any children, which are elements. * * @return an int value */ public boolean hasElementChildren() { if (childNodes == null) { throw new IllegalStateException("Parameter childNodes is null!"); } NodeImpl node; for (int i = 0; i < childNodes.size(); i++) { node = childNodes.get(i); if (node instanceof ElementImpl) { return true; } } return false; } public boolean hasSiblingElements() { NodeImpl parent = (NodeImpl) getParentNode(); if (parent == null) { return false; } NodeListImpl list = parent.getElementChildNodes(); for (int i = 0; i < list.getLength(); i++) { Node node = list.get(i); if (node != this) { return true; } } return false; } public boolean hasText() { String text = getTextContent(); if ((text != null) && !text.trim().equals("")) { return true; } return false; } public Node insertAfter(Node newChild, Node refChild) { if (newChild == null) { throw new IllegalArgumentException( "The argument newChild must not be null!"); } if (refChild == null) { throw new IllegalArgumentException( "The argument refChild must not be null!"); } NodeImpl node; int index = -1; if ((childNodes != null) && (childNodes.size() > 0)) { for (int i = 0; i < childNodes.size(); i++) { node = childNodes.get(i); if (node == refChild) { index = i; } } if (index > -1) { NodeImpl newChildImpl = (NodeImpl) newChild; newChildImpl.setParentNode(this); childNodes.add(index + 1, newChildImpl); } } return this; } @Override public Node insertBefore(Node newChild, Node refChild) throws DOMException { NodeListImpl childList = (NodeListImpl) getChildNodes(); for (int i = 0; i < childList.getLength(); i++) { Node child = childList.item(i); if (child.equals(refChild)) { NodeImpl newChildImpl = (NodeImpl) newChild; newChildImpl.setParentNode(this); logger.debug("Inserting " + newChild + "before " + refChild); childList.add(i, newChildImpl); return this; } } logger.warn("InsertBefore: Couldn't find reference child " + refChild); return this; } /** * The method insertChild inserts a child node at the specified * index. * * @param index * an int value * @param node * a Node value * @return a Node value */ public NodeImpl insertChild(int index, NodeImpl node) { node.setParentNode(this); childNodes.add(index, node); return this; } /** * Falls die Sprache nicht zwischen Groß- und Kleinschreibung unterscheidet, * muss das Attribute isCaseSensitive auf true * gesetzt werden. * *

      * Die Methode konvertiert bereits bestehende Daten in Kleinbuchstaben. * Sollten dabei Doppeldeutigkeiten auftreten, gilt der letzte, verarbeitete * Wert. * * @param isCaseInsensitive * @return NodeImpl */ public NodeImpl isCaseInsensitive(boolean isCaseInsensitive) { this.isCaseInsensitive = isCaseInsensitive; if (nodeName != null) { nodeName = nodeName.toLowerCase(); } return this; } @Override public boolean isDefaultNamespace(String namespaceURI) { System.err.println("Not yet implemented"); return false; } public boolean isEmpty() { return isEmpty; } public NodeImpl isEmpty(boolean isEmpty) { this.isEmpty = isEmpty; return this; } @Override public boolean isEqualNode(Node otherNode) { return equals(otherNode); } public boolean isMute() { return isMute; } public void isMute(boolean isMute) { this.isMute = isMute; } public boolean isRawData() { return isRawData; } public void isRawData(boolean isRawData) { this.isRawData = isRawData; } /** * The method isRoot returns true if this node is Root * node. * * @return a boolean value */ public boolean isRoot() { if (parent == null || this instanceof DocumentFragmentImpl) { return true; } return false; } @Override public boolean isSameNode(Node other) { System.err.println("Not yet implemented"); return false; } @Override public boolean isSupported(String feature, String version) { System.err.println("Not yet implemented"); return false; } @Override public String lookupNamespaceURI(String prefix) { System.err.println("Not yet implemented"); return null; } @Override public String lookupPrefix(String namespaceURI) { System.err.println("Not yet implemented"); return null; } public boolean needsPadding() { return needsPadding; } public NodeImpl needsPadding(boolean needsPadding) { this.needsPadding = needsPadding; return this; } @Override public void normalize() { System.err.println("Not yet implemented"); } @Override public Node removeChild(Node node) throws DOMException { if (node == null) { throw new IllegalArgumentException("Variable node is null!"); } if (childNodes == null) { throw new IllegalStateException("Variable childNodes is null!"); } Node child; Node removedChild = null; for (int i = 0; i < childNodes.getLength(); i++) { child = childNodes.item(i); if (child.equals(node)) { childNodes.remove(i); removedChild = child; break; } } return removedChild; } /** * {@inheritDoc} * * The method replaceChild exchanges a node against another * one. * * Beware of that the parent of the old child is set to null. If either * oldNode or newNode is null, an * IllegalArgumentException is thrown. * * @param oldChild * a Node value * @param newChild * a Node value * @return a Node value */ @Override public Node replaceChild(Node newChild, Node oldChild) throws DOMException { logger.debug("(W3C) Replacing child " + oldChild + " with child " + newChild); NodeList childList = getChildNodes(); for (int i = 0; i < childList.getLength(); i++) { Node child = childList.item(i); if (child.equals(oldChild)) { logger.debug("Found child to replace."); insertBefore(newChild, oldChild); removeChild(oldChild); } } return this; } public void setChildNodes(NodeList children) { if (children == null) { childNodes = new NodeListImpl(); } childNodes = (NodeListImpl) children; } /** * Die Methode setColumn setzt die Spaltennummer in der das * Element ursprünglich vom Tokenizer gefunden wurde. * * @param column * int */ public void setColumn(int column) { this.column = column; } public void setDocument(DocumentImpl document) { this.document = document; } /** * Die Methode setLine setzt die Zeilennummer in der das * Element ursprünglich vom Tokenizer gefunden wurde. * * @param line * int */ public void setLine(int line) { this.line = line; } public void setMute(boolean isMute) { this.isMute = isMute; } public void setNamespaceURI(String namespaceUri) { this.namespaceUri = namespaceUri; } public void setNodeName(String nodeName) { this.nodeName = nodeName; } public void setNodeType(short nodeType) { this.nodeType = nodeType; } @Override public void setNodeValue(String nodeValue) throws DOMException { this.nodeValue = nodeValue; } public void setParentNode(NodeImpl parent) { if (this == parent) { throw new IllegalStateException("Self referencing " + parent); } this.parent = parent; } @Override public void setPrefix(String prefix) throws DOMException { this.prefix = prefix; } @Override public void setTextContent(String textContent) throws DOMException { childNodes.clear(); if (textContent != null) { if (this instanceof TextImpl) { ((TextImpl) this).setData(textContent); } else { appendChild(new TextImpl(textContent)); } } } @Override public Object setUserData(String key, Object data, UserDataHandler handler) { if (userDataMap == null) { userDataMap = new HashMap(); } if (key != null) { userDataMap.put(key, data); } return data; } public void swapWithParent() { NodeList childNodes1 = childNodes; NodeList childNodes2 = parent.getChildNodes(); Node hook = parent.getParentNode(); if (hook == null) { return; } parent.setChildNodes(childNodes1); setChildNodes(childNodes2); removeChild(this); insertChild(0, parent); hook.replaceChild(this, parent); } @Override public String toString() { StringBuilder buffer = new StringBuilder(); buffer.append("name="); if (nodeName != null) { buffer.append(nodeName); } buffer.append(','); buffer.append("value="); if (nodeValue != null) { buffer.append(nodeValue); } buffer.append(",line="); buffer.append(getLine()); buffer.append(",column="); buffer.append(getColumn()); String text = buffer.toString(); if (text.length() > 42) { text = text.substring(0, 39) + "..."; } return text; } public String toTag() { String str = "<" + nodeName + ">"; return str; } public String toTree(String prefix, int[] levels, int level) { if (level >= levels.length) { logger.fatal(String.format( "Resulting node tree has more than %d levels.", levels.length)); return ""; } String buffer = ""; levels[level] = getTrafoChildNodes().size(); buffer = "+ " + getNodeName() + "[" + hashCode() + "]:children[" + getTrafoChildNodes().size() + "]\n"; String spaces = ""; for (int i = 0; i <= level; i++) { if (levels[i] > 0) { spaces += "| "; } else { spaces += " "; } } buffer += (spaces + LSEP); spaces = ""; for (int i = 0; i < level; i++) { if (levels[i] > 0) { spaces += "| "; } else { spaces += " "; } } prefix = spaces + "+--"; for (NodeImpl node : getTrafoChildNodes()) { levels[level]--; if (node instanceof TextImpl) { buffer += (prefix + ((TextImpl) node).toString() + "(Text)\n"); } else if (node instanceof ElementImpl) { NodeImpl elem = node; buffer += (prefix + elem.toTree(prefix, levels, level + 1)); } } return buffer; } public void traverse(INodeVisitor visitor) throws Exception { traverse(this, visitor); } public String treeView() { int[] levels = new int[1024]; return toTree("", levels, 0); } protected boolean validateAttributes() { return true; } public boolean validateParentPath( HashMap> validParentMap) { NodeImpl parent = getTrafoParentNode(); if (parent == null || isRoot() == true) { return true; } while (parent.isMute()) { parent = parent.getTrafoParentNode(); if (parent == null) { return true; } } String path = parent.getNodeName() + " -> " + toTag(); while (parent != null && parent instanceof DocumentFragmentImpl == false) { if (validParentMap.get(parent.getNodeName()) == null) { return false; } parent = parent.getTrafoParentNode(); if (parent != null) { while (parent.isMute()) { parent = parent.getTrafoParentNode(); if (parent == null) { return true; } } path = parent.getNodeName() + " -> " + path; } } return true; } @SuppressWarnings("unchecked") public T getAnnotation(Class type) { if (annotationList == null) { return null; } List collected = annotationList.stream().filter(annotation -> type.isInstance(annotation)).collect(Collectors.toList()); if (collected != null && collected.size() > 0) { return (T) collected.get(0); } return null; } public void vanish() { if (parent != null) { NodeListImpl children = parent.getTrafoChildNodes(); children.remove(this); } } @SuppressWarnings("unchecked") public List getAnnotations(Class type) { ArrayList foundList = new ArrayList<>(); if (annotationList == null) { return foundList; } List collected = annotationList.stream().filter(annotation -> type.isInstance(annotation)).collect(Collectors.toList()); if (collected != null && collected.size() > 0) { return (List) collected; } return foundList; } } src/java/org/dbdoclet/xiphias/dom/INodeVisitor.java0000644000175000017500000000171712644165236022473 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.xiphias.dom; import org.w3c.dom.Node; public interface INodeVisitor { public void openTag(Node node) throws Exception; public void accept(Node node) throws Exception; public void closeTag(Node node) throws Exception; } src/java/org/dbdoclet/xiphias/dom/NodeStack.java0000644000175000017500000000256712644165236021774 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.xiphias.dom; import java.util.Stack; public class NodeStack extends Stack { private static final long serialVersionUID = 1L; public int searchNearest(String[] nodes) { if (nodes == null) { throw new IllegalArgumentException("Variable nodes is null!"); } int min = -1; int index; for (int i = 0; i < nodes.length; i++) { index = search(nodes[i]); if (index != -1) { if ((min == -1) || (index < min)) { min = index; } } // end of if () } // end of for () return min; } } src/java/org/dbdoclet/xiphias/dom/DOMTraverser.java0000644000175000017500000000461712644165236022434 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.xiphias.dom; import java.util.ArrayList; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.w3c.dom.NodeList; public class DOMTraverser { private ArrayList visitors = new ArrayList(); public DOMTraverser(INodeVisitor visitor) { addVisitor(visitor); } public void addVisitor(INodeVisitor visitor) { visitors.add(visitor); } public void traverse(Node node) throws Exception { if (node.getNodeType() == Node.ELEMENT_NODE) { openTag(node); } accept(node); if ((node.getNodeType() == Node.ELEMENT_NODE) && node.hasAttributes()) { NamedNodeMap attrs = ((Element) node).getAttributes(); for (int i = 0; i < attrs.getLength(); i++) { Node attr = attrs.item(i); accept(attr); } } if (node.hasChildNodes()) { NodeList children = node.getChildNodes(); for (int i = 0; i < children.getLength(); i++) { Node child = children.item(i); traverse(child); } } if (node.getNodeType() == Node.ELEMENT_NODE) { closeTag(node); } } private void openTag(Node node) throws Exception { for (INodeVisitor visitor : visitors) { visitor.openTag(node); } } private void accept(Node node) throws Exception { for (INodeVisitor visitor : visitors) { visitor.accept(node); } } private void closeTag(Node node) throws Exception { for (INodeVisitor visitor : visitors) { visitor.closeTag(node); } } } src/java/org/dbdoclet/xiphias/dom/DocumentFragmentImpl.java0000644000175000017500000000175212644165236024200 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.xiphias.dom; import org.w3c.dom.DocumentFragment; public class DocumentFragmentImpl extends ElementImpl implements DocumentFragment { public DocumentFragmentImpl() { setNodeName("#document-fragment"); setNodeType(NodeImpl.DOCUMENT_FRAGMENT_NODE); } } src/java/org/dbdoclet/xiphias/dom/ElementByTagNameVisitor.java0000644000175000017500000000325412644165236024614 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.xiphias.dom; import org.w3c.dom.Element; import org.w3c.dom.Node; public class ElementByTagNameVisitor implements INodeVisitor { private final String tagName; private NodeListImpl elementList; public NodeListImpl getElementList() { return elementList; } public ElementByTagNameVisitor(String tagName) { this.tagName = tagName; elementList = new NodeListImpl(); } public void accept(Node node) { if (node == null || node instanceof Element == false) { return; } Element element = (Element) node; String otherTagName = element.getTagName(); if (tagName != null && otherTagName != null) { if (tagName.equals(otherTagName)) { elementList.add((NodeImpl) element); } } } @Override public void openTag(Node node) { // } @Override public void closeTag(Node node) { // } } src/java/org/dbdoclet/xiphias/dom/CommentImpl.java0000644000175000017500000000213312644165236022332 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.xiphias.dom; import org.w3c.dom.Comment; public class CommentImpl extends CharacterDataImpl implements Comment { public CommentImpl(String text) { this(text, null); } public CommentImpl(String text, NodeImpl parent) { setNodeType(COMMENT_NODE); setNodeName("#comment"); setData(text); setParentNode(parent); } } src/java/org/dbdoclet/xiphias/dom/NodeCountVisitor.java0000644000175000017500000000266712644165236023400 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.xiphias.dom; import java.util.ArrayList; import org.dbdoclet.progress.ProgressEvent; import org.dbdoclet.progress.ProgressListener; import org.w3c.dom.Node; public class NodeCountVisitor extends AbstractNodeVisitor implements INodeVisitor { private int counter = 0; public NodeCountVisitor(ArrayList listeners) { super(listeners); } public int getNumberOfNodes() { return counter; } public void accept(Node node) { counter++; fireProgressEvent(String.valueOf(counter), ProgressEvent.STAGE_PREPARE); } public INodeVisitor reset() { counter = 0; return this; } @Override public void openTag(Node node) { // } @Override public void closeTag(Node node) { // } } src/java/org/dbdoclet/xiphias/dom/CharacterDataImpl.java0000644000175000017500000000352312644165236023422 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.xiphias.dom; import org.w3c.dom.CharacterData; import org.w3c.dom.DOMException; public class CharacterDataImpl extends NodeImpl implements CharacterData { private String data; public void appendData(String arg) throws DOMException { // TODO Auto-generated method stub } public void deleteData(int offset, int count) throws DOMException { // TODO Auto-generated method stub } public String getData() throws DOMException { return data; } public int getLength() { // TODO Auto-generated method stub return 0; } public void insertData(int offset, String arg) throws DOMException { // TODO Auto-generated method stub } public void replaceData(int offset, int count, String arg) throws DOMException { // TODO Auto-generated method stub } public void setData(String data) throws DOMException { this.data = data; setNodeValue(data); } public String substringData(int offset, int count) throws DOMException { // TODO Auto-generated method stub return null; } } src/java/org/dbdoclet/xiphias/dom/TextImpl.java0000644000175000017500000000436012644165236021660 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.xiphias.dom; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.w3c.dom.DOMException; import org.w3c.dom.Text; public class TextImpl extends CharacterDataImpl implements Text { private static Log logger = LogFactory.getLog(TextImpl.class); public TextImpl(String text, NodeImpl parent) { super(); setNodeType(TEXT_NODE); setNodeName("#text"); setParentNode(parent); setData(text); logger.debug("Text text=[" + text + "]"); } public TextImpl(String text) { this(text, null); } /** * The method toString returns the first 24 characters of the * text of this node. * * If the length of the text is greater than 24 characters, the text is * truncated and three digits are appended. * * @return a String value */ @Override public String toString() { String data = getData(); if ((data == null) || (data.length() == 0)) { return ""; } if (data.length() < 24) { return data.trim(); } else { return data.substring(0, 23) + "..."; } } @Override public String getWholeText() { // TODO Auto-generated method stub return null; } @Override public boolean isElementContentWhitespace() { // TODO Auto-generated method stub return false; } @Override public Text replaceWholeText(String content) throws DOMException { // TODO Auto-generated method stub return null; } @Override public Text splitText(int offset) throws DOMException { // TODO Auto-generated method stub return null; } } src/java/org/dbdoclet/xiphias/Resources.properties0000644000175000017500000000165112644165236022560 0ustar mathieumathieu# Java Resource Bundle # Modified by Zaval JRC Editor (C) Zaval CE Group # http://www.zaval.org/products/jrc-editor/ C_ERROR=Error C_INCLUDING_FILE=Including file {0}... C_XML_VALIDATION_ERROR={0}:{1}:{2}\n\ Error in row {1}, column {2}\n\ {3} C_XML_VALIDATION_ERROR_FILE_CAN_NOT_READ={0}: The file can not be read C_XML_VALIDATION_ERROR_FILE_NOT_FOUND={0}: The file couldn't be found. C_XML_VALIDATION_FAILED=The validation of the XML file FAILED! C_XML_VALIDATION_FATAL={0}:{1}:{2}\n\ Fatal error in row {1}, column {2}\n\ {3} C_XML_VALIDATION_NUMBER_OF_ERRORS=Number of errors: {0} C_XML_VALIDATION_OF_FILE=Validation of file {0}. C_XML_VALIDATION_REPORT=XML Validation Report C_XML_VALIDATION_REPORT_DATE=Date: {0} C_XML_VALIDATION_REPORT_TIME=Time: {0} C_XML_VALIDATION_SUCCESSFUL=The validation of the XML file was SUCCESSFUL. C_XML_VALIDATION_WARNING={0}:{1}:{2}\n\ Warning in row {1}, column {2}\n\ {3} src/java/org/dbdoclet/xiphias/annotation/0000755000175000017500000000000012644165236020637 5ustar mathieumathieusrc/java/org/dbdoclet/xiphias/annotation/MapToAttributeAnnotation.java0000644000175000017500000000214312644165236026441 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.xiphias.annotation; public class MapToAttributeAnnotation extends Annotation { private String attribute; private String mapTo; public String getAttribute() { return attribute; } public String getMapTo() { return mapTo; } public void setAttribute(String attribute) { this.attribute = attribute; } public void setMapTo(String mapTo) { this.mapTo = mapTo; } } src/java/org/dbdoclet/xiphias/annotation/Annotation.java0000644000175000017500000000143012644165236023612 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.xiphias.annotation; public class Annotation { } src/java/org/dbdoclet/xiphias/annotation/MapToNodeAnnotation.java0000644000175000017500000000167412644165236025373 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.xiphias.annotation; public class MapToNodeAnnotation extends Annotation { private String mapTo; public String getMapTo() { return mapTo; } public void setMapTo(String mapTo) { this.mapTo = mapTo; } } src/java/org/dbdoclet/html/0000755000175000017500000000000012644165236015764 5ustar mathieumathieusrc/java/org/dbdoclet/html/tokenizer/0000755000175000017500000000000012644165236017776 5ustar mathieumathieusrc/java/org/dbdoclet/html/tokenizer/TokenizerException.java0000644000175000017500000000410712644165236024474 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.html.tokenizer; public class TokenizerException extends Exception { private static final long serialVersionUID = 1L; public TokenizerException(String msg) { super(msg); } public TokenizerException(String message, Throwable cause) { super(message, cause); } public TokenizerException(Throwable oops) { super(oops); } @Override public String getMessage() { String str; String msg; Throwable cause = getCause(); if (cause != null) { msg = "[" + cause.getClass().getName() + "] "; str = cause.getMessage(); if ((str != null) && (str.length() > 0)) { msg += str; } } else { msg = super.getMessage(); } return msg; } } /* * $Log: TokenizerException.java,v $ Revision 1.1.1.1 2004/12/21 13:57:02 mfuchs * Reimport * * Revision 1.2 2004/10/05 13:11:21 mfuchs Koorektur in der Behandlung von * Entitäten * * Revision 1.1.1.1 2004/07/29 14:49:43 mfuchs Tagspender * * Revision 1.1.1.1 2004/02/17 22:51:06 mfuchs dbdoclet * * Revision 1.1.1.1 2004/01/05 14:58:45 cvs dbdoclet * * Revision 1.1.1.1 2003/08/01 13:17:52 cvs DocBook Doclet * * Revision 1.1.1.1 2003/07/31 17:05:39 mfuchs DocBook Doclet since 0.46 * * Revision 1.1.1.1 2003/05/30 11:09:40 mfuchs dbdoclet * * Revision 1.1.1.1 2003/03/18 07:41:37 mfuchs DocBook Doclet 0.40 * * Revision 1.1.1.1 2003/03/17 20:50:12 cvs dbdoclet */ src/java/org/dbdoclet/html/tokenizer/Token.java0000644000175000017500000002246312644165236021730 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.html.tokenizer; import java.util.HashMap; import org.dbdoclet.service.StringServices; /** * Die Klasse MLToken repräsentiert einen einzelnen Token. * * Ein Token entsteht bei der Zerlegung der Eingabedaten in Teilstücke. * * @author Michael Fuchs * @version 1.0 */ public class Token { /** Der Inhalt des Token. */ private String value; /** Der Name des Tags, falls der Token einen Tag repräsentiert.*/ private String tagName; /** Die Attributes des Tags, falls der Token einen Tag repräsentiert.*/ private HashMap tagAttributes; /** Der Typ des Tokens. */ private String type; /** Die Zeilenummer, in der der Token gefunden wurde. */ private int line; /** Die Spaltennummer, in der der Token gefunden wurde. */ private int column; public Token() { this(""); } /** * Erzeugt eine neue Instanz der Klasse MLToken. * * @param token String */ public Token(String token) { if (token == null) { throw new IllegalArgumentException( "The argument token may not be null!"); } type = "__UNKNOWN__"; tagAttributes = new HashMap(); this.value = parse(token); } /** * Die Methode getAttribute liefert ein bestimmtes Attribut des Tags. * * Ist der Token kein Tag, wird null zurückgegeben. * * @return HashMap */ public String getAttribute(String attrName) { if (attrName == null) { throw new IllegalArgumentException("The argument attrName must not be null!"); } if (tagAttributes != null) { return (String) tagAttributes.get(attrName); } return null; } /** * Die Methode getAttributes liefert die Attribute des Tags. * * Ist der Token kein Tag, wird null zurückgegeben. * * @return HashMap */ public HashMap getAttributes() { return tagAttributes; } /** * Die Methode getColumn liefert die Spaltennummer. * * @return int */ public int getColumn() { return column; } /** * Die Methode getLine liefert die Zeilennummer. * * @return int */ public int getLine() { return line; } /** * Die Methode getTagName liefert den Namen des Tags. * * Ist der Token kein Tag, wird null zurückgegeben. * * @return String */ public String getTagName() { return tagName; } /** * Die Methode getToken liefert den Token als Ganzes. * * @return String */ public String getValue() { if (isComment() && value != null) { String buffer = value.trim(); buffer = StringServices.cutPrefix(buffer, ""); buffer = buffer.trim(); return buffer; } return value; } /** * Wahr, falls der Token ein schließender Tag ist. * * @return boolean */ public boolean isClosingTag() { if (type.endsWith(".Closing") || type.endsWith(".Empty")) { return true; } return false; } /** * Wahr, falls der Token ein Kommentar ist. * * @return boolean */ public boolean isComment() { if (type.equals("Text.Comment")) { return true; } return false; } /** * Wahr, falls der Token eine Doctype-Anweisung ist. * * @return boolean */ public boolean isDoctype() { if (type.equals("Doctype")) { return true; } return false; } /** * Wahr, falls der Token ein leerer Tag ist. * * @return boolean */ public boolean isEmptyTag() { if (type.equals("Tag.Empty")) { return true; } return false; } /** * Wahr, falls der Token ein JavaDoc-Tag ist. * * @return boolean */ public boolean isJavadoc() { if (type.startsWith("Tag.Javadoc.")) { return true; } return false; } /** * Wahr, falls der Token ein öffnender Tag ist. * * @return boolean */ public boolean isOpeningTag() { if (type.endsWith(".Opening") || type.endsWith(".Empty")) { return true; } return false; } /** * Wahr, falls der Token ein Tag ist. * * @return boolean */ public boolean isTag() { if (type.startsWith("Tag.")) { return true; } return false; } /** * Wahr, falls der Token nur Text enthält ist. * * @return boolean */ public boolean isText() { if (type.startsWith("Text.")) { return true; } return false; } /** * Wahr, falls der Token nur Trennzeichen enthält. * * @return boolean */ public boolean isWhitespace() { if (type.equals("Text.Whitespace")) { return true; } return false; } /** * Die Methode setAttributes setzt die Attribute des Tags. * * @param attributes HashMap */ public void setAttributes(HashMap attributes) { this.tagAttributes = attributes; } /** * Die Methode setColumn setzt die Spaltennummer. * * @param column int */ public void setColumn(int column) { this.column = column; } /** * Die Methode setLine setzt die Zeilennummer. * * @param line int */ public void setLine(int line) { this.line = line; } /** * Die Methode setTagName setzt den Namen des Tags. * * @param tagName String */ public void setTagName(String tagName) { if (tagName == null) { throw new IllegalArgumentException("Parameter tagName is null!"); } this.tagName = tagName; } public void setValue(String value) { this.value = value; parse(value); } public void appendValue(String value) { this.value += value; } /** * Die Methode toString liefert eine textuelle Darstellung des * Tokens. * * @return String */ @Override public String toString() { StringBuilder buffer = new StringBuilder(); if (tagName != null) { buffer.append(tagName); buffer.append(", "); } if (type != null) { buffer.append(type); buffer.append(", "); } if (value != null) { buffer.append(value); } if (buffer.length() > 42) { buffer.delete(39, buffer.length()); buffer.append("..."); } return buffer.toString(); } /** * Die Methode parse wertet den Inhalt des Tokens aus und setzt * danach den Wert des Attributes type. * * @param token String * @return String */ private String parse(String token) { if (token == null) { return null; } String value = token.trim(); if (value.startsWith("")) { type = "Text.Comment"; } else if (value.startsWith("")) { type = "Doctype"; } else if (value.startsWith("")) { type = "Declaration"; } else if (value.startsWith("<") && value.endsWith("/>")) { type = "Tag.Empty"; } else if (value.startsWith("")) { type = "Tag.Javadoc.Opening"; } else if (value.startsWith("")) { type = "Tag.Javadoc.Closing"; } else if (value.startsWith("")) { type = "Tag.Closing"; } else if (value.startsWith("<") && value.endsWith(">")) { type = "Tag.Opening"; } else if (value.trim().equals("")) { type = "Text.Whitespace"; } else { type = "Text."; } return token; } } src/java/org/dbdoclet/html/tokenizer/Tokenizer.java0000644000175000017500000000726412644165236022624 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.html.tokenizer; import java.text.ParseException; import java.util.ArrayList; import org.dbdoclet.html.tokenizer.parser.HtmlTokenizer; import org.dbdoclet.html.tokenizer.parser.TokenMgrError; import org.dbdoclet.progress.ProgressListener; /** * Die Klasse Tokenizer implementiert einen Tokenizer für HTML. * * @author Michael Fuchs * @version 1.0 */ public class Tokenizer { private ArrayList tokens; private Token currentToken; private StringBuffer buffer = null; private int tokenPosition = 0; private ArrayList listeners; /** * Creates a new MLTokenizer instance. * * @param data * {@link String (String)} */ public Tokenizer(String data) { buffer = new StringBuffer(data); } public void tokenize() throws TokenizerException { tokenPosition = 0; tokens = parse(); } /* ======================================================================== */ /* PUBLIC METHODS */ /* ======================================================================== */ /** * The method hasNext returns true if there are still tokens to * be fetched. * * @return True if another token exists. */ public boolean hasNext() { if (tokenPosition < tokens.size()) { return true; } else { return false; } } /** * The method next returns the next token. * * If there are no more tokens left, a null value is returned. * * @return The next token or null {@link Token (MLToken)}. */ public Token next() { if (tokenPosition >= tokens.size()) { return null; } currentToken = tokens.get(tokenPosition); tokenPosition++; return currentToken; } public int size() { if (tokens == null) { throw new IllegalStateException("Variable tokens is null!"); } return tokens.size(); } public int position() { return tokenPosition; } /* ======================================================================== */ /* PRIVATE METHODS */ /* ======================================================================== */ /** * The method parse parses the buffer and adds all tokens into * an object of the type ArrayList, which is returned in the * end. * * @return {@link java.util.ArrayList (ArrayList)} * @exception TokenizerException * if an error occurs */ private ArrayList parse() throws TokenizerException { HtmlTokenizer parser; try { parser = new HtmlTokenizer(buffer.toString(), "UTF-8"); parser.setProgressListeners(listeners); return parser.parse(); } catch (Throwable oops) { String msg = "Tokenizer Error"; if (oops instanceof TokenMgrError || oops instanceof ParseException) { msg = "Parse error " + oops.getMessage() + " while parsing \"" + buffer.toString() + "\"."; } throw new TokenizerException(msg, oops); } } public void setProgressListeners(ArrayList listeners) { this.listeners = listeners; } } src/java/org/dbdoclet/html/tokenizer/parser/0000755000175000017500000000000012644165244021271 5ustar mathieumathieusrc/java/org/dbdoclet/html/tokenizer/parser/TokenMgrError.java0000644000175000017500000001173712644165236024706 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.html.tokenizer.parser; /** Token Manager Error. */ @SuppressWarnings("all") public class TokenMgrError extends Error { /** * The version identifier for this Serializable class. * Increment only if the serialized form of the * class changes. */ private static final long serialVersionUID = 1L; /* * Ordinals for various reasons why an Error of this type can be thrown. */ /** * Lexical error occurred. */ static final int LEXICAL_ERROR = 0; /** * An attempt was made to create a second instance of a static token manager. */ static final int STATIC_LEXER_ERROR = 1; /** * Tried to change to an invalid lexical state. */ static final int INVALID_LEXICAL_STATE = 2; /** * Detected (and bailed out of) an infinite loop in the token manager. */ static final int LOOP_DETECTED = 3; /** * Indicates the reason why the exception is thrown. It will have * one of the above 4 values. */ int errorCode; /** * Replaces unprintable characters by their escaped (or unicode escaped) * equivalents in the given string */ protected static final String addEscapes(String str) { StringBuffer retval = new StringBuffer(); char ch; for (int i = 0; i < str.length(); i++) { switch (str.charAt(i)) { case 0 : continue; case '\b': retval.append("\\b"); continue; case '\t': retval.append("\\t"); continue; case '\n': retval.append("\\n"); continue; case '\f': retval.append("\\f"); continue; case '\r': retval.append("\\r"); continue; case '\"': retval.append("\\\""); continue; case '\'': retval.append("\\\'"); continue; case '\\': retval.append("\\\\"); continue; default: if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) { String s = "0000" + Integer.toString(ch, 16); retval.append("\\u" + s.substring(s.length() - 4, s.length())); } else { retval.append(ch); } continue; } } return retval.toString(); } /** * Returns a detailed message for the Error when it is thrown by the * token manager to indicate a lexical error. * Parameters : * EOFSeen : indicates if EOF caused the lexical error * curLexState : lexical state in which this error occurred * errorLine : line number when the error occurred * errorColumn : column number when the error occurred * errorAfter : prefix that was seen before this error occurred * curchar : the offending character * Note: You can customize the lexical error message by modifying this method. */ protected static String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) { return("Lexical error at line " + errorLine + ", column " + errorColumn + ". Encountered: " + (EOFSeen ? " " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int)curChar + "), ") + "after : \"" + addEscapes(errorAfter) + "\""); } /** * You can also modify the body of this method to customize your error messages. * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not * of end-users concern, so you can return something like : * * "Internal Error : Please file a bug report .... " * * from this method for such cases in the release version of your parser. */ public String getMessage() { return super.getMessage(); } /* * Constructors of various flavors follow. */ /** No arg constructor. */ public TokenMgrError() { } /** Constructor with message and reason. */ public TokenMgrError(String message, int reason) { super(message); errorCode = reason; } /** Full Constructor. */ public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) { this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason); } } /* JavaCC - OriginalChecksum=4018fc262b3912b4de27d74aafb44b22 (do not edit this line) */ src/java/org/dbdoclet/html/tokenizer/parser/JJTHtmlTokenizerState.java0000644000175000017500000000750112644165236026310 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.html.tokenizer.parser; public class JJTHtmlTokenizerState { private java.util.List nodes; private java.util.List marks; private int sp; // number of nodes on stack private int mk; // current mark private boolean node_created; public JJTHtmlTokenizerState() { nodes = new java.util.ArrayList(); marks = new java.util.ArrayList(); sp = 0; mk = 0; } /* Determines whether the current node was actually closed and pushed. This should only be called in the final user action of a node scope. */ public boolean nodeCreated() { return node_created; } /* Call this to reinitialize the node stack. It is called automatically by the parser's ReInit() method. */ public void reset() { nodes.clear(); marks.clear(); sp = 0; mk = 0; } /* Returns the root node of the AST. It only makes sense to call this after a successful parse. */ public Node rootNode() { return nodes.get(0); } /* Pushes a node on to the stack. */ public void pushNode(Node n) { nodes.add(n); ++sp; } /* Returns the node on the top of the stack, and remove it from the stack. */ public Node popNode() { if (--sp < mk) { mk = marks.remove(marks.size()-1); } return nodes.remove(nodes.size()-1); } /* Returns the node currently on the top of the stack. */ public Node peekNode() { return nodes.get(nodes.size()-1); } /* Returns the number of children on the stack in the current node scope. */ public int nodeArity() { return sp - mk; } public void clearNodeScope(Node n) { while (sp > mk) { popNode(); } mk = marks.remove(marks.size()-1); } public void openNodeScope(Node n) { marks.add(mk); mk = sp; n.jjtOpen(); } /* A definite node is constructed from a specified number of children. That number of nodes are popped from the stack and made the children of the definite node. Then the definite node is pushed on to the stack. */ public void closeNodeScope(Node n, int num) { mk = marks.remove(marks.size()-1); while (num-- > 0) { Node c = popNode(); c.jjtSetParent(n); n.jjtAddChild(c, num); } n.jjtClose(); pushNode(n); node_created = true; } /* A conditional node is constructed if its condition is true. All the nodes that have been pushed since the node was opened are made children of the conditional node, which is then pushed on to the stack. If the condition is false the node is not constructed and they are left on the stack. */ public void closeNodeScope(Node n, boolean condition) { if (condition) { int a = nodeArity(); mk = marks.remove(marks.size()-1); while (a-- > 0) { Node c = popNode(); c.jjtSetParent(n); n.jjtAddChild(c, a); } n.jjtClose(); pushNode(n); node_created = true; } else { mk = marks.remove(marks.size()-1); node_created = false; } } } /* JavaCC - OriginalChecksum=8763f702f55943484c6fcfb891e42e02 (do not edit this line) */ src/java/org/dbdoclet/html/tokenizer/parser/Node.java0000644000175000017500000000344712644165236023032 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.html.tokenizer.parser; /* All AST nodes must implement this interface. It provides basic machinery for constructing the parent and child relationships between nodes. */ public @SuppressWarnings("all") interface Node { /** This method is called after the node has been made the current node. It indicates that child nodes can now be added to it. */ public void jjtOpen(); /** This method is called after all the child nodes have been added. */ public void jjtClose(); /** This pair of methods are used to inform the node of its parent. */ public void jjtSetParent(Node n); public Node jjtGetParent(); /** This method tells the node to add its argument to the node's list of children. */ public void jjtAddChild(Node n, int i); /** This method returns a child node. The children are numbered from zero, left to right. */ public Node jjtGetChild(int i); /** Return the number of children the node has. */ public int jjtGetNumChildren(); } /* JavaCC - OriginalChecksum=d1e356b8f784f3d6e222b2264e1a7432 (do not edit this line) */ src/java/org/dbdoclet/html/tokenizer/parser/Token.java0000644000175000017500000001111112644165236023210 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.html.tokenizer.parser; /** * Describes the input token stream. */ @SuppressWarnings("all") public class Token implements java.io.Serializable { /** * The version identifier for this Serializable class. * Increment only if the serialized form of the * class changes. */ private static final long serialVersionUID = 1L; /** * An integer that describes the kind of this token. This numbering * system is determined by JavaCCParser, and a table of these numbers is * stored in the file ...Constants.java. */ public int kind; /** The line number of the first character of this Token. */ public int beginLine; /** The column number of the first character of this Token. */ public int beginColumn; /** The line number of the last character of this Token. */ public int endLine; /** The column number of the last character of this Token. */ public int endColumn; /** * The string image of the token. */ public String image; /** * A reference to the next regular (non-special) token from the input * stream. If this is the last token from the input stream, or if the * token manager has not read tokens beyond this one, this field is * set to null. This is true only if this token is also a regular * token. Otherwise, see below for a description of the contents of * this field. */ public Token next; /** * This field is used to access special tokens that occur prior to this * token, but after the immediately preceding regular (non-special) token. * If there are no such special tokens, this field is set to null. * When there are more than one such special token, this field refers * to the last of these special tokens, which in turn refers to the next * previous special token through its specialToken field, and so on * until the first special token (whose specialToken field is null). * The next fields of special tokens refer to other special tokens that * immediately follow it (without an intervening regular token). If there * is no such token, this field is null. */ public Token specialToken; /** * An optional attribute value of the Token. * Tokens which are not used as syntactic sugar will often contain * meaningful values that will be used later on by the compiler or * interpreter. This attribute value is often different from the image. * Any subclass of Token that actually wants to return a non-null value can * override this method as appropriate. */ public Object getValue() { return null; } /** * No-argument constructor */ public Token() {} /** * Constructs a new token for the specified Image. */ public Token(int kind) { this(kind, null); } /** * Constructs a new token for the specified Image and Kind. */ public Token(int kind, String image) { this.kind = kind; this.image = image; } /** * Returns the image. */ public String toString() { return image; } /** * Returns a new Token object, by default. However, if you want, you * can create and return subclass objects based on the value of ofKind. * Simply add the cases to the switch for all those special cases. * For example, if you have a subclass of Token called IDToken that * you want to create if ofKind is ID, simply add something like : * * case MyParserConstants.ID : return new IDToken(ofKind, image); * * to the following switch statement. Then you can cast matchedToken * variable to the appropriate type and use sit in your lexical actions. */ public static Token newToken(int ofKind, String image) { switch(ofKind) { default : return new Token(ofKind, image); } } public static Token newToken(int ofKind) { return newToken(ofKind, null); } } /* JavaCC - OriginalChecksum=32dcceb3d060b8c3753de8b101388514 (do not edit this line) */ src/java/org/dbdoclet/html/tokenizer/parser/HtmlTokenizer.java0000644000175000017500000004476612644165236024755 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.html.tokenizer.parser; import java.io.ByteArrayInputStream; import java.io.UnsupportedEncodingException; import java.util.ArrayList; import java.util.HashMap; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.dbdoclet.progress.ProgressEvent; import org.dbdoclet.progress.ProgressListener; import org.dbdoclet.progress.ProgressManager; public class HtmlTokenizer/*@bgen(jjtree)*/implements HtmlTokenizerTreeConstants, HtmlTokenizerConstants {/*@bgen(jjtree)*/ protected JJTHtmlTokenizerState jjtree = new JJTHtmlTokenizerState();private static Log logger = LogFactory.getLog(HtmlTokenizer.class); private ArrayList tokenList; private ArrayList listeners; public HtmlTokenizer(String buffer, String encoding) throws UnsupportedEncodingException { this (new ByteArrayInputStream(buffer.getBytes(encoding)), encoding); } public synchronized ArrayList < org.dbdoclet.html.tokenizer.Token > parse() throws ParseException { tokenList = new ArrayList < org.dbdoclet.html.tokenizer.Token > (); start(); return tokenList; } final public void start() throws ParseException { /*@bgen(jjtree) start */ SimpleNode jjtn000 = new SimpleNode(JJTSTART); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); try { label_1: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case TAG_START: case QUOTE: case TEXT: case COMMENT: ; break; default: jj_la1[0] = jj_gen; break label_1; } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case TAG_START: tag(); break; case QUOTE: case TEXT: text(); break; case COMMENT: comment(); break; default: jj_la1[1] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte000;} } if (jjte000 instanceof ParseException) { {if (true) throw (ParseException)jjte000;} } {if (true) throw (Error)jjte000;} } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } } final public void tag() throws ParseException { /*@bgen(jjtree) tag */ SimpleNode jjtn000 = new SimpleNode(JJTTAG); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000);Token tag = null; Token name = null; Token value = null; Token slash1 = null; Token slash2 = null; HashMap < String, String > attributeMap = new HashMap < String, String > (); try { org.dbdoclet.html.tokenizer.Token token = new org.dbdoclet.html.tokenizer.Token(); tokenList.add(token); fireProgressEvent(token.toString()); try { jj_consume_token(TAG_START); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case SLASH: slash1 = jj_consume_token(SLASH); break; default: jj_la1[2] = jj_gen; ; } tag = ncname(); token.setTagName(tag.image); token.setLine(tag.beginLine); token.setColumn(tag.beginColumn); trace("Tag: " + tag.image); label_2: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case NCNAME: ; break; default: jj_la1[3] = jj_gen; break label_2; } name = attrName(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case EQUALS: equals(); value = attrValue(); break; default: jj_la1[4] = jj_gen; ; } if (value != null) { String buffer = value.image; if (buffer != null) { if (buffer.startsWith("\u005c"") || buffer.startsWith("'")) { buffer = buffer.substring(1, buffer.length()); } if (buffer.endsWith("\u005c"") || buffer.endsWith("'")) { buffer = buffer.substring(0, buffer.length() - 1); } attributeMap.put(name.image, buffer); } } } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case SLASH: slash2 = jj_consume_token(SLASH); break; default: jj_la1[5] = jj_gen; ; } jj_consume_token(TAG_END); } catch (Throwable oops) { logger.warn(String.format("Invalid attributes in Element %s line %d column %d", token.getTagName(), token.getLine(), token.getColumn())); logger.warn(oops.getMessage()); Token t = skipTo(DEFAULT, DEFAULT, token.toString(), TAG_END, TAG_START); token.setValue("<" + token.getTagName() + toAttributesAsText(attributeMap) + t.image); {if (true) return;} } jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; StringBuilder buffer = new StringBuilder(); buffer.append('<'); if (slash1 != null) { buffer.append('/'); } if (tag != null) { buffer.append(tag.image); } buffer.append(toAttributesAsText(attributeMap)); if (slash2 != null) { buffer.append('/'); } buffer.append('>'); trace(buffer.toString()); token.setValue(buffer.toString()); token.setAttributes(attributeMap); } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte000;} } if (jjte000 instanceof ParseException) { {if (true) throw (ParseException)jjte000;} } {if (true) throw (Error)jjte000;} } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } } final public void comment() throws ParseException { /*@bgen(jjtree) comment */ SimpleNode jjtn000 = new SimpleNode(JJTCOMMENT); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000);Token comment; try { comment = jj_consume_token(COMMENT); jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; org.dbdoclet.html.tokenizer.Token token = new org.dbdoclet.html.tokenizer.Token(comment.image); tokenList.add(token); fireProgressEvent(token.toString()); } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } } final public void text() throws ParseException { /*@bgen(jjtree) text */ SimpleNode jjtn000 = new SimpleNode(JJTTEXT); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000);Token text; try { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case TEXT: text = jj_consume_token(TEXT); break; case QUOTE: text = jj_consume_token(QUOTE); break; default: jj_la1[6] = jj_gen; jj_consume_token(-1); throw new ParseException(); } jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; org.dbdoclet.html.tokenizer.Token token = new org.dbdoclet.html.tokenizer.Token(text.image); trace("text() " + token); tokenList.add(token); fireProgressEvent(token.toString()); } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } } @SuppressWarnings("unused") final public Token ncname() throws ParseException { /*@bgen(jjtree) ncname */ SimpleNode jjtn000 = new SimpleNode(JJTNCNAME); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000);Token t; try { t = jj_consume_token(NCNAME); jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; {if (true) return t;} } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } throw new Error("Missing return statement in function"); } final public void equals() throws ParseException { /*@bgen(jjtree) equals */ SimpleNode jjtn000 = new SimpleNode(JJTEQUALS); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); try { jj_consume_token(EQUALS); } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } } @SuppressWarnings("unused") final public Token attrName() throws ParseException { /*@bgen(jjtree) attrName */ SimpleNode jjtn000 = new SimpleNode(JJTATTRNAME); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000);Token token = null; try { try { token = jj_consume_token(NCNAME); // System.out.println(token.image); {if (true) return token;} } catch (Throwable oops) { logger.warn(String.format("Invalid attributes in Element %s line %d column %d", token.image, token.beginLine, token.beginColumn)); logger.warn(oops.getMessage()); {if (true) return skipTo(DEFAULT, TAG_CONTEXT, "", TAG_END, QUOTE);} } } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } throw new Error("Missing return statement in function"); } @SuppressWarnings("unused") final public Token attrValue() throws ParseException { /*@bgen(jjtree) attrValue */ SimpleNode jjtn000 = new SimpleNode(JJTATTRVALUE); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000);Token token = null; try { try { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case VALUE: token = jj_consume_token(VALUE); break; case NCNAME: token = jj_consume_token(NCNAME); break; default: jj_la1[7] = jj_gen; jj_consume_token(-1); throw new ParseException(); } {if (true) return token;} } catch (Throwable oops) { logger.warn(String.format("Invalid attributes in Element %s line %d column %d", token.image, token.beginLine, token.beginColumn)); logger.warn(oops.getMessage()); {if (true) return skipTo(DEFAULT, TAG_CONTEXT, "", TAG_END, QUOTE);} } } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } throw new Error("Missing return statement in function"); } private Token skipTo(int preContext, int postContext, String prev, int... kind) throws ParseException { /*@bgen(jjtree) skipTo */ SimpleNode jjtn000 = new SimpleNode(JJTSKIPTO); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); try {StringBuilder buffer = new StringBuilder(); boolean skip = true; token_source.SwitchTo(preContext); while (skip) { Token t = getNextToken(); buffer.append(t.image); if (t.kind == EOF) { break; } for (int stop : kind) { if (t.kind == stop) { skip = false; } } } token_source.SwitchTo(postContext); return new Token(VALUE, buffer.toString());/*@bgen(jjtree)*/ } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } } private String toAttributesAsText(HashMap attributeMap) throws ParseException { /*@bgen(jjtree) toAttributesAsText */ SimpleNode jjtn000 = new SimpleNode(JJTTOATTRIBUTESASTEXT); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); try {StringBuilder buffer = new StringBuilder(); for (String attr : attributeMap.keySet()) { buffer.append(' '); buffer.append(attr); buffer.append("=\u005c""); buffer.append(attributeMap.get(attr)); buffer.append("\u005c""); } return buffer.toString();/*@bgen(jjtree)*/ } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } } public void setProgressListeners(ArrayList listeners) throws ParseException { /*@bgen(jjtree) setProgressListeners */ SimpleNode jjtn000 = new SimpleNode(JJTSETPROGRESSLISTENERS); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); try {this.listeners = listeners;/*@bgen(jjtree)*/ } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } } public void fireProgressEvent(String action) throws ParseException { /*@bgen(jjtree) fireProgressEvent */ SimpleNode jjtn000 = new SimpleNode(JJTFIREPROGRESSEVENT); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); try {if (listeners != null) { ProgressEvent event = new ProgressEvent("Tokenizer: " + action); event.setStage(ProgressEvent.STAGE_PREPARE); ProgressManager pm = new ProgressManager(listeners); pm.fireProgressEvent(event); }/*@bgen(jjtree)*/ } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } } private void trace(String text) throws ParseException { /*@bgen(jjtree) trace */ SimpleNode jjtn000 = new SimpleNode(JJTTRACE); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); try {/*@bgen(jjtree)*/ } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } } /** Generated Token Manager. */ public HtmlTokenizerTokenManager token_source; SimpleCharStream jj_input_stream; /** Current token. */ public Token token; /** Next token. */ public Token jj_nt; private int jj_ntk; private int jj_gen; final private int[] jj_la1 = new int[8]; static private int[] jj_la1_0; static { jj_la1_init_0(); } private static void jj_la1_init_0() { jj_la1_0 = new int[] {0x400700,0x400700,0x40000,0x80000,0x20000,0x40000,0x600,0x180000,}; } /** Constructor with InputStream. */ public HtmlTokenizer(java.io.InputStream stream) { this(stream, null); } /** Constructor with InputStream and supplied encoding */ public HtmlTokenizer(java.io.InputStream stream, String encoding) { try { jj_input_stream = new SimpleCharStream(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } token_source = new HtmlTokenizerTokenManager(jj_input_stream); token = new Token(); jj_ntk = -1; jj_gen = 0; for (int i = 0; i < 8; i++) jj_la1[i] = -1; } /** Reinitialise. */ public void ReInit(java.io.InputStream stream) { ReInit(stream, null); } /** Reinitialise. */ public void ReInit(java.io.InputStream stream, String encoding) { try { jj_input_stream.ReInit(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } token_source.ReInit(jj_input_stream); token = new Token(); jj_ntk = -1; jjtree.reset(); jj_gen = 0; for (int i = 0; i < 8; i++) jj_la1[i] = -1; } /** Constructor. */ public HtmlTokenizer(java.io.Reader stream) { jj_input_stream = new SimpleCharStream(stream, 1, 1); token_source = new HtmlTokenizerTokenManager(jj_input_stream); token = new Token(); jj_ntk = -1; jj_gen = 0; for (int i = 0; i < 8; i++) jj_la1[i] = -1; } /** Reinitialise. */ public void ReInit(java.io.Reader stream) { jj_input_stream.ReInit(stream, 1, 1); token_source.ReInit(jj_input_stream); token = new Token(); jj_ntk = -1; jjtree.reset(); jj_gen = 0; for (int i = 0; i < 8; i++) jj_la1[i] = -1; } /** Constructor with generated Token Manager. */ public HtmlTokenizer(HtmlTokenizerTokenManager tm) { token_source = tm; token = new Token(); jj_ntk = -1; jj_gen = 0; for (int i = 0; i < 8; i++) jj_la1[i] = -1; } /** Reinitialise. */ public void ReInit(HtmlTokenizerTokenManager tm) { token_source = tm; token = new Token(); jj_ntk = -1; jjtree.reset(); jj_gen = 0; for (int i = 0; i < 8; i++) jj_la1[i] = -1; } private Token jj_consume_token(int kind) throws ParseException { Token oldToken; if ((oldToken = token).next != null) token = token.next; else token = token.next = token_source.getNextToken(); jj_ntk = -1; if (token.kind == kind) { jj_gen++; return token; } token = oldToken; jj_kind = kind; throw generateParseException(); } /** Get the next Token. */ final public Token getNextToken() { if (token.next != null) token = token.next; else token = token.next = token_source.getNextToken(); jj_ntk = -1; jj_gen++; return token; } /** Get the specific Token. */ final public Token getToken(int index) { Token t = token; for (int i = 0; i < index; i++) { if (t.next != null) t = t.next; else t = t.next = token_source.getNextToken(); } return t; } private int jj_ntk() { if ((jj_nt=token.next) == null) return (jj_ntk = (token.next=token_source.getNextToken()).kind); else return (jj_ntk = jj_nt.kind); } private java.util.List jj_expentries = new java.util.ArrayList(); private int[] jj_expentry; private int jj_kind = -1; /** Generate ParseException. */ public ParseException generateParseException() { jj_expentries.clear(); boolean[] la1tokens = new boolean[30]; if (jj_kind >= 0) { la1tokens[jj_kind] = true; jj_kind = -1; } for (int i = 0; i < 8; i++) { if (jj_la1[i] == jj_gen) { for (int j = 0; j < 32; j++) { if ((jj_la1_0[i] & (1<. */ package org.dbdoclet.html.tokenizer.parser; /** Token Manager. */ public class HtmlTokenizerTokenManager implements HtmlTokenizerConstants { /** Debug output. */ public java.io.PrintStream debugStream = System.out; /** Set debug output. */ public void setDebugStream(java.io.PrintStream ds) { debugStream = ds; } private final int jjStopStringLiteralDfa_0(int pos, long active0) { switch (pos) { case 0: if ((active0 & 0x900L) != 0L) return 21; if ((active0 & 0x1eL) != 0L) return 22; return -1; case 1: if ((active0 & 0x800L) != 0L) return 4; return -1; default : return -1; } } private final int jjStartNfa_0(int pos, long active0) { return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0), pos + 1); } private int jjStopAtPos(int pos, int kind) { jjmatchedKind = kind; jjmatchedPos = pos; return pos + 1; } private int jjMoveStringLiteralDfa0_0() { switch(curChar) { case 9: return jjStartNfaWithStates_0(0, 3, 22); case 10: return jjStartNfaWithStates_0(0, 4, 22); case 13: return jjStartNfaWithStates_0(0, 2, 22); case 32: return jjStartNfaWithStates_0(0, 1, 22); case 60: jjmatchedKind = 8; return jjMoveStringLiteralDfa1_0(0x800L); default : return jjMoveNfa_0(0, 0); } } private int jjMoveStringLiteralDfa1_0(long active0) { try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(0, active0); return 1; } switch(curChar) { case 33: return jjMoveStringLiteralDfa2_0(active0, 0x800L); default : break; } return jjStartNfa_0(0, active0); } private int jjMoveStringLiteralDfa2_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(0, old0); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(1, active0); return 2; } switch(curChar) { case 45: return jjMoveStringLiteralDfa3_0(active0, 0x800L); default : break; } return jjStartNfa_0(1, active0); } private int jjMoveStringLiteralDfa3_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(1, old0); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(2, active0); return 3; } switch(curChar) { case 45: if ((active0 & 0x800L) != 0L) return jjStopAtPos(3, 11); break; default : break; } return jjStartNfa_0(2, active0); } private int jjStartNfaWithStates_0(int pos, int kind, int state) { jjmatchedKind = kind; jjmatchedPos = pos; try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { return pos + 1; } return jjMoveNfa_0(state, pos + 1); } static final long[] jjbitVec0 = { 0xfffffffffffffffeL, 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffffffffffffL }; static final long[] jjbitVec2 = { 0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL }; static final long[] jjbitVec3 = { 0xffc00000000L, 0x0L, 0x0L, 0x1ffffffff000000L }; static final long[] jjbitVec4 = { 0x0L, 0x0L, 0xffffffffffffffffL, 0x80000000800000L }; static final long[] jjbitVec5 = { 0xffffffffffffffffL, 0x4000ffffffffffffL, 0x0L, 0x0L }; static final long[] jjbitVec6 = { 0xffffffffffffcfffL, 0xffffffffffffL, 0x0L, 0x0L }; static final long[] jjbitVec7 = { 0x0L, 0x0L, 0xffffffffffff0000L, 0xffffffffffffffffL }; static final long[] jjbitVec8 = { 0x0L, 0x0L, 0x0L, 0xffff000000000000L }; static final long[] jjbitVec9 = { 0x1L, 0x0L, 0x0L, 0x0L }; static final long[] jjbitVec10 = { 0x0L, 0x0L, 0x0L, 0xffffffff0000L }; static final long[] jjbitVec11 = { 0x0L, 0x0L, 0x0L, 0xc000000000000000L }; private int jjMoveNfa_0(int startState, int curPos) { int startsAt = 0; jjnewStateCnt = 21; int i = 1; jjstateSet[0] = startState; int kind = 0x7fffffff; for (;;) { if (++jjround == 0x7fffffff) ReInitRounds(); if (curChar < 64) { long l = 1L << curChar; do { switch(jjstateSet[--i]) { case 0: if ((0xefffff7bffffffffL & l) != 0L) { if (kind > 10) kind = 10; jjCheckNAddStates(0, 2); } else if ((0x8400000000L & l) != 0L) { if (kind > 9) kind = 9; } else if (curChar == 60) jjCheckNAddStates(3, 6); if (curChar == 45) jjstateSet[jjnewStateCnt++] = 6; break; case 21: if ((0xfbff7ffdffffffffL & l) != 0L) { if (kind > 10) kind = 10; jjCheckNAddStates(0, 2); } else if (curChar == 33) jjstateSet[jjnewStateCnt++] = 4; if ((0x100002600L & l) != 0L) jjCheckNAddTwoStates(10, 11); break; case 22: if ((0xefffff7bffffffffL & l) != 0L) { if (kind > 10) kind = 10; jjCheckNAddStates(0, 2); } else if (curChar == 60) jjCheckNAddTwoStates(3, 8); if (curChar == 45) jjstateSet[jjnewStateCnt++] = 6; break; case 1: if ((0xefffff7bffffffffL & l) == 0L) break; if (kind > 10) kind = 10; jjCheckNAddStates(0, 2); break; case 2: if (curChar == 60) jjCheckNAddTwoStates(3, 8); break; case 3: if (curChar == 33) jjstateSet[jjnewStateCnt++] = 4; break; case 4: if ((0xffffdfffffffffffL & l) != 0L) jjstateSet[jjnewStateCnt++] = 5; break; case 5: if ((0xffffdfffffffffffL & l) == 0L) break; if (kind > 10) kind = 10; jjCheckNAddStates(0, 2); break; case 6: if (curChar != 62) break; if (kind > 10) kind = 10; jjCheckNAddStates(0, 2); break; case 7: if (curChar == 45) jjstateSet[jjnewStateCnt++] = 6; break; case 8: if ((0xfbff7ffdffffffffL & l) == 0L) break; if (kind > 10) kind = 10; jjCheckNAddStates(0, 2); break; case 9: if (curChar == 60) jjCheckNAddStates(3, 6); break; case 10: if ((0x100002600L & l) != 0L) jjCheckNAddTwoStates(10, 11); break; default : break; } } while(i != startsAt); } else if (curChar < 128) { long l = 1L << (curChar & 077); do { switch(jjstateSet[--i]) { case 0: case 1: case 5: if (kind > 10) kind = 10; jjCheckNAddStates(0, 2); break; case 21: if ((0xf800000178000001L & l) != 0L) { if (kind > 10) kind = 10; jjCheckNAddStates(0, 2); } else if (curChar == 115) jjAddStates(7, 8); break; case 22: if (kind > 10) kind = 10; jjCheckNAddStates(0, 2); break; case 4: jjstateSet[jjnewStateCnt++] = 5; break; case 8: if ((0xf800000178000001L & l) == 0L) break; if (kind > 10) kind = 10; jjCheckNAddStates(0, 2); break; case 11: if (curChar == 115) jjAddStates(7, 8); break; case 12: if (curChar == 116 && kind > 5) kind = 5; break; case 13: if (curChar == 112) jjstateSet[jjnewStateCnt++] = 12; break; case 14: if (curChar == 105) jjstateSet[jjnewStateCnt++] = 13; break; case 15: if (curChar == 114) jjstateSet[jjnewStateCnt++] = 14; break; case 16: if (curChar == 99) jjstateSet[jjnewStateCnt++] = 15; break; case 17: if (curChar == 101 && kind > 5) kind = 5; break; case 18: if (curChar == 108) jjstateSet[jjnewStateCnt++] = 17; break; case 19: if (curChar == 121) jjstateSet[jjnewStateCnt++] = 18; break; case 20: if (curChar == 116) jjstateSet[jjnewStateCnt++] = 19; break; default : break; } } while(i != startsAt); } else { int hiByte = (int)(curChar >> 8); int i1 = hiByte >> 6; long l1 = 1L << (hiByte & 077); int i2 = (curChar & 0xff) >> 6; long l2 = 1L << (curChar & 077); do { switch(jjstateSet[--i]) { case 0: case 1: case 5: if (!jjCanMove_0(hiByte, i1, i2, l1, l2)) break; if (kind > 10) kind = 10; jjCheckNAddStates(0, 2); break; case 21: case 8: if (!jjCanMove_1(hiByte, i1, i2, l1, l2)) break; if (kind > 10) kind = 10; jjCheckNAddStates(0, 2); break; case 22: if (!jjCanMove_0(hiByte, i1, i2, l1, l2)) break; if (kind > 10) kind = 10; jjCheckNAddStates(0, 2); break; case 4: if (jjCanMove_0(hiByte, i1, i2, l1, l2)) jjstateSet[jjnewStateCnt++] = 5; break; default : break; } } while(i != startsAt); } if (kind != 0x7fffffff) { jjmatchedKind = kind; jjmatchedPos = curPos; kind = 0x7fffffff; } ++curPos; if ((i = jjnewStateCnt) == (startsAt = 21 - (jjnewStateCnt = startsAt))) return curPos; try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { return curPos; } } } private final int jjStopStringLiteralDfa_2(int pos, long active0) { switch (pos) { default : return -1; } } private final int jjStartNfa_2(int pos, long active0) { return jjMoveNfa_2(jjStopStringLiteralDfa_2(pos, active0), pos + 1); } private int jjMoveStringLiteralDfa0_2() { switch(curChar) { case 47: return jjStopAtPos(0, 18); case 61: return jjStopAtPos(0, 17); case 62: return jjStopAtPos(0, 16); default : return jjMoveNfa_2(0, 0); } } static final long[] jjbitVec12 = { 0xfffe7000fffffff6L, 0xffffffffffffffffL, 0xffffffffffffffffL, 0x5e00000000ffffffL }; static final long[] jjbitVec13 = { 0x0L, 0x0L, 0x0L, 0xff7fffffff7fffffL }; static final long[] jjbitVec14 = { 0x0L, 0xbfff000000000000L, 0xffffffffffffffffL, 0xffffffffffffffffL }; static final long[] jjbitVec15 = { 0x3000L, 0xffff000000000000L, 0xffffffffffffffffL, 0xffffffffffffffffL }; static final long[] jjbitVec16 = { 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffL, 0x0L }; static final long[] jjbitVec17 = { 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffffffffL }; static final long[] jjbitVec18 = { 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffff00000000ffffL }; static final long[] jjbitVec19 = { 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffffffffffffL, 0x3fffffffffffffffL }; static final long[] jjbitVec20 = { 0x0L, 0x0L, 0x80000000000000L, 0xff7fffffff7fffffL }; static final long[] jjbitVec21 = { 0xffffffffffffffffL, 0xbfffffffffffffffL, 0xffffffffffffffffL, 0xffffffffffffffffL }; static final long[] jjbitVec22 = { 0x8000000000003000L, 0xffff000000000001L, 0xffffffffffffffffL, 0xffffffffffffffffL }; private int jjMoveNfa_2(int startState, int curPos) { int startsAt = 0; jjnewStateCnt = 10; int i = 1; jjstateSet[0] = startState; int kind = 0x7fffffff; for (;;) { if (++jjround == 0x7fffffff) ReInitRounds(); if (curChar < 64) { long l = 1L << curChar; do { switch(jjstateSet[--i]) { case 0: if ((0x7ff600000000000L & l) != 0L) { if (kind > 20) kind = 20; jjCheckNAdd(9); } else if (curChar == 39) jjCheckNAddTwoStates(6, 7); else if (curChar == 34) jjCheckNAddTwoStates(3, 4); if (curChar == 58) { if (kind > 19) kind = 19; jjCheckNAdd(1); } break; case 1: if ((0x7ff600000000000L & l) == 0L) break; if (kind > 19) kind = 19; jjCheckNAdd(1); break; case 2: if (curChar == 34) jjCheckNAddTwoStates(3, 4); break; case 3: if ((0xbffffffbffffffffL & l) != 0L) jjCheckNAddTwoStates(3, 4); break; case 4: if (curChar == 34 && kind > 20) kind = 20; break; case 5: if (curChar == 39) jjCheckNAddTwoStates(6, 7); break; case 6: if ((0xbfffff7fffffffffL & l) != 0L) jjCheckNAddTwoStates(6, 7); break; case 7: if (curChar == 39 && kind > 20) kind = 20; break; case 8: if ((0x7ff600000000000L & l) == 0L) break; if (kind > 20) kind = 20; jjCheckNAdd(9); break; case 9: if ((0x87ff604000000000L & l) == 0L) break; if (kind > 20) kind = 20; jjCheckNAdd(9); break; default : break; } } while(i != startsAt); } else if (curChar < 128) { long l = 1L << (curChar & 077); do { switch(jjstateSet[--i]) { case 0: if ((0x7fffffe87fffffeL & l) != 0L) { if (kind > 20) kind = 20; jjCheckNAdd(9); } if ((0x7fffffe87fffffeL & l) != 0L) { if (kind > 19) kind = 19; jjCheckNAdd(1); } break; case 1: if ((0x7fffffe87fffffeL & l) == 0L) break; if (kind > 19) kind = 19; jjCheckNAdd(1); break; case 3: jjAddStates(9, 10); break; case 6: jjAddStates(11, 12); break; case 8: case 9: if ((0x7fffffe87fffffeL & l) == 0L) break; if (kind > 20) kind = 20; jjCheckNAdd(9); break; default : break; } } while(i != startsAt); } else { int hiByte = (int)(curChar >> 8); int i1 = hiByte >> 6; long l1 = 1L << (hiByte & 077); int i2 = (curChar & 0xff) >> 6; long l2 = 1L << (curChar & 077); do { switch(jjstateSet[--i]) { case 0: if (jjCanMove_2(hiByte, i1, i2, l1, l2)) { if (kind > 19) kind = 19; jjCheckNAdd(1); } if (jjCanMove_3(hiByte, i1, i2, l1, l2)) { if (kind > 20) kind = 20; jjCheckNAdd(9); } break; case 1: if (!jjCanMove_3(hiByte, i1, i2, l1, l2)) break; if (kind > 19) kind = 19; jjCheckNAdd(1); break; case 3: if (jjCanMove_0(hiByte, i1, i2, l1, l2)) jjAddStates(9, 10); break; case 6: if (jjCanMove_0(hiByte, i1, i2, l1, l2)) jjAddStates(11, 12); break; case 8: case 9: if (!jjCanMove_3(hiByte, i1, i2, l1, l2)) break; if (kind > 20) kind = 20; jjCheckNAdd(9); break; default : break; } } while(i != startsAt); } if (kind != 0x7fffffff) { jjmatchedKind = kind; jjmatchedPos = curPos; kind = 0x7fffffff; } ++curPos; if ((i = jjnewStateCnt) == (startsAt = 10 - (jjnewStateCnt = startsAt))) return curPos; try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { return curPos; } } } private int jjMoveStringLiteralDfa0_1() { return jjMoveNfa_1(14, 0); } private int jjMoveNfa_1(int startState, int curPos) { int startsAt = 0; jjnewStateCnt = 15; int i = 1; jjstateSet[0] = startState; int kind = 0x7fffffff; for (;;) { if (++jjround == 0x7fffffff) ReInitRounds(); if (curChar < 64) { long l = 1L << curChar; do { switch(jjstateSet[--i]) { case 0: if (curChar == 47) jjCheckNAddTwoStates(1, 2); break; case 1: if ((0x100002600L & l) != 0L) jjCheckNAddTwoStates(1, 2); break; case 4: if ((0x100002600L & l) != 0L) jjAddStates(13, 14); break; case 5: if (curChar == 62) kind = 6; break; case 14: if (curChar == 60) jjstateSet[jjnewStateCnt++] = 0; break; default : break; } } while(i != startsAt); } else if (curChar < 128) { long l = 1L << (curChar & 077); do { switch(jjstateSet[--i]) { case 2: if (curChar == 115) jjAddStates(15, 16); break; case 3: if (curChar == 116) jjCheckNAddTwoStates(4, 5); break; case 6: if (curChar == 112) jjstateSet[jjnewStateCnt++] = 3; break; case 7: if (curChar == 105) jjstateSet[jjnewStateCnt++] = 6; break; case 8: if (curChar == 114) jjstateSet[jjnewStateCnt++] = 7; break; case 9: if (curChar == 99) jjstateSet[jjnewStateCnt++] = 8; break; case 10: if (curChar == 101) jjCheckNAddTwoStates(4, 5); break; case 11: if (curChar == 108) jjstateSet[jjnewStateCnt++] = 10; break; case 12: if (curChar == 121) jjstateSet[jjnewStateCnt++] = 11; break; case 13: if (curChar == 116) jjstateSet[jjnewStateCnt++] = 12; break; default : break; } } while(i != startsAt); } else { int hiByte = (int)(curChar >> 8); int i1 = hiByte >> 6; long l1 = 1L << (hiByte & 077); int i2 = (curChar & 0xff) >> 6; long l2 = 1L << (curChar & 077); do { switch(jjstateSet[--i]) { default : break; } } while(i != startsAt); } if (kind != 0x7fffffff) { jjmatchedKind = kind; jjmatchedPos = curPos; kind = 0x7fffffff; } ++curPos; if ((i = jjnewStateCnt) == (startsAt = 15 - (jjnewStateCnt = startsAt))) return curPos; try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { return curPos; } } } private int jjMoveStringLiteralDfa0_3() { switch(curChar) { case 45: return jjMoveStringLiteralDfa1_3(0x400000L); default : return 1; } } private int jjMoveStringLiteralDfa1_3(long active0) { try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { return 1; } switch(curChar) { case 45: return jjMoveStringLiteralDfa2_3(active0, 0x400000L); default : return 2; } } private int jjMoveStringLiteralDfa2_3(long old0, long active0) { if (((active0 &= old0)) == 0L) return 2; try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { return 2; } switch(curChar) { case 62: if ((active0 & 0x400000L) != 0L) return jjStopAtPos(2, 22); break; default : return 3; } return 3; } static final int[] jjnextStates = { 1, 2, 7, 10, 3, 8, 11, 16, 20, 3, 4, 6, 7, 4, 5, 9, 13, }; private static final boolean jjCanMove_0(int hiByte, int i1, int i2, long l1, long l2) { switch(hiByte) { case 0: return ((jjbitVec2[i2] & l2) != 0L); default : if ((jjbitVec0[i1] & l1) != 0L) return true; return false; } } private static final boolean jjCanMove_1(int hiByte, int i1, int i2, long l1, long l2) { switch(hiByte) { case 0: return ((jjbitVec4[i2] & l2) != 0L); case 3: return ((jjbitVec5[i2] & l2) != 0L); case 32: return ((jjbitVec6[i2] & l2) != 0L); case 33: return ((jjbitVec7[i2] & l2) != 0L); case 47: return ((jjbitVec8[i2] & l2) != 0L); case 48: return ((jjbitVec9[i2] & l2) != 0L); case 253: return ((jjbitVec10[i2] & l2) != 0L); case 255: return ((jjbitVec11[i2] & l2) != 0L); default : if ((jjbitVec3[i1] & l1) != 0L) return true; return false; } } private static final boolean jjCanMove_2(int hiByte, int i1, int i2, long l1, long l2) { switch(hiByte) { case 0: return ((jjbitVec13[i2] & l2) != 0L); case 3: return ((jjbitVec14[i2] & l2) != 0L); case 32: return ((jjbitVec15[i2] & l2) != 0L); case 33: return ((jjbitVec16[i2] & l2) != 0L); case 47: return ((jjbitVec17[i2] & l2) != 0L); case 48: return ((jjbitVec0[i2] & l2) != 0L); case 253: return ((jjbitVec18[i2] & l2) != 0L); case 255: return ((jjbitVec19[i2] & l2) != 0L); default : if ((jjbitVec12[i1] & l1) != 0L) return true; return false; } } private static final boolean jjCanMove_3(int hiByte, int i1, int i2, long l1, long l2) { switch(hiByte) { case 0: return ((jjbitVec20[i2] & l2) != 0L); case 3: return ((jjbitVec21[i2] & l2) != 0L); case 32: return ((jjbitVec22[i2] & l2) != 0L); case 33: return ((jjbitVec16[i2] & l2) != 0L); case 47: return ((jjbitVec17[i2] & l2) != 0L); case 48: return ((jjbitVec0[i2] & l2) != 0L); case 253: return ((jjbitVec18[i2] & l2) != 0L); case 255: return ((jjbitVec19[i2] & l2) != 0L); default : if ((jjbitVec12[i1] & l1) != 0L) return true; return false; } } /** Token literal values. */ public static final String[] jjstrLiteralImages = { "", null, null, null, null, null, null, null, "\74", null, null, null, null, null, null, null, "\76", "\75", "\57", null, null, null, null, null, null, null, null, null, null, null, }; /** Lexer state names. */ public static final String[] lexStateNames = { "DEFAULT", "WithinIgnorable", "TAG_CONTEXT", "COMMENT_CONTEXT", }; /** Lex State array. */ public static final int[] jjnewLexState = { -1, -1, -1, -1, -1, 1, 0, -1, 2, -1, -1, 3, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, }; static final long[] jjtoToken = { 0x5f0701L, }; static final long[] jjtoSkip = { 0xf07eL, }; static final long[] jjtoMore = { 0x200880L, }; protected SimpleCharStream input_stream; private final int[] jjrounds = new int[21]; private final int[] jjstateSet = new int[42]; protected char curChar; /** Constructor. */ public HtmlTokenizerTokenManager(SimpleCharStream stream){ if (SimpleCharStream.staticFlag) throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer."); input_stream = stream; } /** Constructor. */ public HtmlTokenizerTokenManager(SimpleCharStream stream, int lexState){ this(stream); SwitchTo(lexState); } /** Reinitialise parser. */ public void ReInit(SimpleCharStream stream) { jjmatchedPos = jjnewStateCnt = 0; curLexState = defaultLexState; input_stream = stream; ReInitRounds(); } private void ReInitRounds() { int i; jjround = 0x80000001; for (i = 21; i-- > 0;) jjrounds[i] = 0x80000000; } /** Reinitialise parser. */ public void ReInit(SimpleCharStream stream, int lexState) { ReInit(stream); SwitchTo(lexState); } /** Switch to specified lex state. */ public void SwitchTo(int lexState) { if (lexState >= 4 || lexState < 0) throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE); else curLexState = lexState; } protected Token jjFillToken() { final Token t; final String curTokenImage; final int beginLine; final int endLine; final int beginColumn; final int endColumn; String im = jjstrLiteralImages[jjmatchedKind]; curTokenImage = (im == null) ? input_stream.GetImage() : im; beginLine = input_stream.getBeginLine(); beginColumn = input_stream.getBeginColumn(); endLine = input_stream.getEndLine(); endColumn = input_stream.getEndColumn(); t = Token.newToken(jjmatchedKind, curTokenImage); t.beginLine = beginLine; t.endLine = endLine; t.beginColumn = beginColumn; t.endColumn = endColumn; return t; } int curLexState = 0; int defaultLexState = 0; int jjnewStateCnt; int jjround; int jjmatchedPos; int jjmatchedKind; /** Get the next Token. */ public Token getNextToken() { Token matchedToken; int curPos = 0; EOFLoop : for (;;) { try { curChar = input_stream.BeginToken(); } catch(java.io.IOException e) { jjmatchedKind = 0; matchedToken = jjFillToken(); return matchedToken; } for (;;) { switch(curLexState) { case 0: jjmatchedKind = 0x7fffffff; jjmatchedPos = 0; curPos = jjMoveStringLiteralDfa0_0(); break; case 1: jjmatchedKind = 0x7fffffff; jjmatchedPos = 0; curPos = jjMoveStringLiteralDfa0_1(); if (jjmatchedPos == 0 && jjmatchedKind > 7) { jjmatchedKind = 7; } break; case 2: try { input_stream.backup(0); while (curChar <= 32 && (0x100002600L & (1L << curChar)) != 0L) curChar = input_stream.BeginToken(); } catch (java.io.IOException e1) { continue EOFLoop; } jjmatchedKind = 0x7fffffff; jjmatchedPos = 0; curPos = jjMoveStringLiteralDfa0_2(); break; case 3: jjmatchedKind = 0x7fffffff; jjmatchedPos = 0; curPos = jjMoveStringLiteralDfa0_3(); if (jjmatchedPos == 0 && jjmatchedKind > 21) { jjmatchedKind = 21; } break; } if (jjmatchedKind != 0x7fffffff) { if (jjmatchedPos + 1 < curPos) input_stream.backup(curPos - jjmatchedPos - 1); if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L) { matchedToken = jjFillToken(); if (jjnewLexState[jjmatchedKind] != -1) curLexState = jjnewLexState[jjmatchedKind]; return matchedToken; } else if ((jjtoSkip[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L) { if (jjnewLexState[jjmatchedKind] != -1) curLexState = jjnewLexState[jjmatchedKind]; continue EOFLoop; } if (jjnewLexState[jjmatchedKind] != -1) curLexState = jjnewLexState[jjmatchedKind]; curPos = 0; jjmatchedKind = 0x7fffffff; try { curChar = input_stream.readChar(); continue; } catch (java.io.IOException e1) { } } int error_line = input_stream.getEndLine(); int error_column = input_stream.getEndColumn(); String error_after = null; boolean EOFSeen = false; try { input_stream.readChar(); input_stream.backup(1); } catch (java.io.IOException e1) { EOFSeen = true; error_after = curPos <= 1 ? "" : input_stream.GetImage(); if (curChar == '\n' || curChar == '\r') { error_line++; error_column = 0; } else error_column++; } if (!EOFSeen) { input_stream.backup(1); error_after = curPos <= 1 ? "" : input_stream.GetImage(); } throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR); } } } private void jjCheckNAdd(int state) { if (jjrounds[state] != jjround) { jjstateSet[jjnewStateCnt++] = state; jjrounds[state] = jjround; } } private void jjAddStates(int start, int end) { do { jjstateSet[jjnewStateCnt++] = jjnextStates[start]; } while (start++ != end); } private void jjCheckNAddTwoStates(int state1, int state2) { jjCheckNAdd(state1); jjCheckNAdd(state2); } private void jjCheckNAddStates(int start, int end) { do { jjCheckNAdd(jjnextStates[start]); } while (start++ != end); } } src/java/org/dbdoclet/html/tokenizer/parser/SimpleNode.java0000644000175000017500000000520212644165236024173 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.html.tokenizer.parser; public @SuppressWarnings("all") class SimpleNode implements Node { protected Node parent; protected Node[] children; protected int id; protected Object value; protected HtmlTokenizer parser; public SimpleNode(int i) { id = i; } public SimpleNode(HtmlTokenizer p, int i) { this(i); parser = p; } public void jjtOpen() { } public void jjtClose() { } public void jjtSetParent(Node n) { parent = n; } public Node jjtGetParent() { return parent; } public void jjtAddChild(Node n, int i) { if (children == null) { children = new Node[i + 1]; } else if (i >= children.length) { Node c[] = new Node[i + 1]; System.arraycopy(children, 0, c, 0, children.length); children = c; } children[i] = n; } public Node jjtGetChild(int i) { return children[i]; } public int jjtGetNumChildren() { return (children == null) ? 0 : children.length; } public void jjtSetValue(Object value) { this.value = value; } public Object jjtGetValue() { return value; } /* * You can override these two methods in subclasses of SimpleNode to * customize the way the node appears when the tree is dumped. If your * output uses more than one line you should override toString(String), * otherwise overriding toString() is probably all you need to do. */ public String toString() { return HtmlTokenizerTreeConstants.jjtNodeName[id]; } public String toString(String prefix) { return prefix + toString(); } /* * Override this method if you want to customize how the node dumps out its * children. */ public void dump(String prefix) { System.out.println(toString(prefix)); if (children != null) { for (int i = 0; i < children.length; ++i) { SimpleNode n = (SimpleNode) children[i]; if (n != null) { n.dump(prefix + " "); } } } } } /* * JavaCC - OriginalChecksum=9244c0ee103002e3a1afbc2b734b2384 (do not edit this * line) */ src/java/org/dbdoclet/html/tokenizer/parser/SimpleCharStream.java0000644000175000017500000003002212644165236025335 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.html.tokenizer.parser; /** * An implementation of interface CharStream, where the stream is assumed to * contain only ASCII characters (without unicode processing). */ @SuppressWarnings("all") public class SimpleCharStream { /** Whether parser is static. */ public static final boolean staticFlag = false; int bufsize; int available; int tokenBegin; /** Position in buffer. */ public int bufpos = -1; protected int bufline[]; protected int bufcolumn[]; protected int column = 0; protected int line = 1; protected boolean prevCharIsCR = false; protected boolean prevCharIsLF = false; protected java.io.Reader inputStream; protected char[] buffer; protected int maxNextCharInd = 0; protected int inBuf = 0; protected int tabSize = 8; protected void setTabSize(int i) { tabSize = i; } protected int getTabSize(int i) { return tabSize; } protected void ExpandBuff(boolean wrapAround) { char[] newbuffer = new char[bufsize + 2048]; int newbufline[] = new int[bufsize + 2048]; int newbufcolumn[] = new int[bufsize + 2048]; try { if (wrapAround) { System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); System.arraycopy(buffer, 0, newbuffer, bufsize - tokenBegin, bufpos); buffer = newbuffer; System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin); System.arraycopy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos); bufline = newbufline; System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin); System.arraycopy(bufcolumn, 0, newbufcolumn, bufsize - tokenBegin, bufpos); bufcolumn = newbufcolumn; maxNextCharInd = (bufpos += (bufsize - tokenBegin)); } else { System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); buffer = newbuffer; System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin); bufline = newbufline; System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin); bufcolumn = newbufcolumn; maxNextCharInd = (bufpos -= tokenBegin); } } catch (Throwable t) { throw new Error(t.getMessage()); } bufsize += 2048; available = bufsize; tokenBegin = 0; } protected void FillBuff() throws java.io.IOException { if (maxNextCharInd == available) { if (available == bufsize) { if (tokenBegin > 2048) { bufpos = maxNextCharInd = 0; available = tokenBegin; } else if (tokenBegin < 0) bufpos = maxNextCharInd = 0; else ExpandBuff(false); } else if (available > tokenBegin) available = bufsize; else if ((tokenBegin - available) < 2048) ExpandBuff(true); else available = tokenBegin; } int i; try { if ((i = inputStream.read(buffer, maxNextCharInd, available - maxNextCharInd)) == -1) { inputStream.close(); throw new java.io.IOException(); } else maxNextCharInd += i; return; } catch(java.io.IOException e) { --bufpos; backup(0); if (tokenBegin == -1) tokenBegin = bufpos; throw e; } } /** Start. */ public char BeginToken() throws java.io.IOException { tokenBegin = -1; char c = readChar(); tokenBegin = bufpos; return c; } protected void UpdateLineColumn(char c) { column++; if (prevCharIsLF) { prevCharIsLF = false; line += (column = 1); } else if (prevCharIsCR) { prevCharIsCR = false; if (c == '\n') { prevCharIsLF = true; } else line += (column = 1); } switch (c) { case '\r' : prevCharIsCR = true; break; case '\n' : prevCharIsLF = true; break; case '\t' : column--; column += (tabSize - (column % tabSize)); break; default : break; } bufline[bufpos] = line; bufcolumn[bufpos] = column; } /** Read a character. */ public char readChar() throws java.io.IOException { if (inBuf > 0) { --inBuf; if (++bufpos == bufsize) bufpos = 0; return buffer[bufpos]; } if (++bufpos >= maxNextCharInd) FillBuff(); char c = buffer[bufpos]; UpdateLineColumn(c); return c; } @Deprecated /** * @deprecated * @see #getEndColumn */ public int getColumn() { return bufcolumn[bufpos]; } @Deprecated /** * @deprecated * @see #getEndLine */ public int getLine() { return bufline[bufpos]; } /** Get token end column number. */ public int getEndColumn() { return bufcolumn[bufpos]; } /** Get token end line number. */ public int getEndLine() { return bufline[bufpos]; } /** Get token beginning column number. */ public int getBeginColumn() { return bufcolumn[tokenBegin]; } /** Get token beginning line number. */ public int getBeginLine() { return bufline[tokenBegin]; } /** Backup a number of characters. */ public void backup(int amount) { inBuf += amount; if ((bufpos -= amount) < 0) bufpos += bufsize; } /** Constructor. */ public SimpleCharStream(java.io.Reader dstream, int startline, int startcolumn, int buffersize) { inputStream = dstream; line = startline; column = startcolumn - 1; available = bufsize = buffersize; buffer = new char[buffersize]; bufline = new int[buffersize]; bufcolumn = new int[buffersize]; } /** Constructor. */ public SimpleCharStream(java.io.Reader dstream, int startline, int startcolumn) { this(dstream, startline, startcolumn, 4096); } /** Constructor. */ public SimpleCharStream(java.io.Reader dstream) { this(dstream, 1, 1, 4096); } /** Reinitialise. */ public void ReInit(java.io.Reader dstream, int startline, int startcolumn, int buffersize) { inputStream = dstream; line = startline; column = startcolumn - 1; if (buffer == null || buffersize != buffer.length) { available = bufsize = buffersize; buffer = new char[buffersize]; bufline = new int[buffersize]; bufcolumn = new int[buffersize]; } prevCharIsLF = prevCharIsCR = false; tokenBegin = inBuf = maxNextCharInd = 0; bufpos = -1; } /** Reinitialise. */ public void ReInit(java.io.Reader dstream, int startline, int startcolumn) { ReInit(dstream, startline, startcolumn, 4096); } /** Reinitialise. */ public void ReInit(java.io.Reader dstream) { ReInit(dstream, 1, 1, 4096); } /** Constructor. */ public SimpleCharStream(java.io.InputStream dstream, String encoding, int startline, int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException { this(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize); } /** Constructor. */ public SimpleCharStream(java.io.InputStream dstream, int startline, int startcolumn, int buffersize) { this(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize); } /** Constructor. */ public SimpleCharStream(java.io.InputStream dstream, String encoding, int startline, int startcolumn) throws java.io.UnsupportedEncodingException { this(dstream, encoding, startline, startcolumn, 4096); } /** Constructor. */ public SimpleCharStream(java.io.InputStream dstream, int startline, int startcolumn) { this(dstream, startline, startcolumn, 4096); } /** Constructor. */ public SimpleCharStream(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException { this(dstream, encoding, 1, 1, 4096); } /** Constructor. */ public SimpleCharStream(java.io.InputStream dstream) { this(dstream, 1, 1, 4096); } /** Reinitialise. */ public void ReInit(java.io.InputStream dstream, String encoding, int startline, int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException { ReInit(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize); } /** Reinitialise. */ public void ReInit(java.io.InputStream dstream, int startline, int startcolumn, int buffersize) { ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize); } /** Reinitialise. */ public void ReInit(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException { ReInit(dstream, encoding, 1, 1, 4096); } /** Reinitialise. */ public void ReInit(java.io.InputStream dstream) { ReInit(dstream, 1, 1, 4096); } /** Reinitialise. */ public void ReInit(java.io.InputStream dstream, String encoding, int startline, int startcolumn) throws java.io.UnsupportedEncodingException { ReInit(dstream, encoding, startline, startcolumn, 4096); } /** Reinitialise. */ public void ReInit(java.io.InputStream dstream, int startline, int startcolumn) { ReInit(dstream, startline, startcolumn, 4096); } /** Get token literal value. */ public String GetImage() { if (bufpos >= tokenBegin) return new String(buffer, tokenBegin, bufpos - tokenBegin + 1); else return new String(buffer, tokenBegin, bufsize - tokenBegin) + new String(buffer, 0, bufpos + 1); } /** Get the suffix. */ public char[] GetSuffix(int len) { char[] ret = new char[len]; if ((bufpos + 1) >= len) System.arraycopy(buffer, bufpos - len + 1, ret, 0, len); else { System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0, len - bufpos - 1); System.arraycopy(buffer, 0, ret, len - bufpos - 1, bufpos + 1); } return ret; } /** Reset buffer when finished. */ public void Done() { buffer = null; bufline = null; bufcolumn = null; } /** * Method to adjust line and column numbers for the start of a token. */ public void adjustBeginLineColumn(int newLine, int newCol) { int start = tokenBegin; int len; if (bufpos >= tokenBegin) { len = bufpos - tokenBegin + inBuf + 1; } else { len = bufsize - tokenBegin + bufpos + 1 + inBuf; } int i = 0, j = 0, k = 0; int nextColDiff = 0, columnDiff = 0; while (i < len && bufline[j = start % bufsize] == bufline[k = ++start % bufsize]) { bufline[j] = newLine; nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j]; bufcolumn[j] = newCol + columnDiff; columnDiff = nextColDiff; i++; } if (i < len) { bufline[j] = newLine++; bufcolumn[j] = newCol + columnDiff; while (i++ < len) { if (bufline[j = start % bufsize] != bufline[++start % bufsize]) bufline[j] = newLine++; else bufline[j] = newLine; } } line = bufline[j]; column = bufcolumn[j]; } } /* JavaCC - OriginalChecksum=9a3504a592609e3b6677f1a2932b2ed9 (do not edit this line) */ src/java/org/dbdoclet/html/tokenizer/parser/ParseException.java0000644000175000017500000001524012644165236025070 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.html.tokenizer.parser; /** * This exception is thrown when parse errors are encountered. * You can explicitly create objects of this exception type by * calling the method generateParseException in the generated * parser. * * You can modify this class to customize your error reporting * mechanisms so long as you retain the public fields. */ @SuppressWarnings("all") public class ParseException extends Exception { /** * The version identifier for this Serializable class. * Increment only if the serialized form of the * class changes. */ private static final long serialVersionUID = 1L; /** * This constructor is used by the method "generateParseException" * in the generated parser. Calling this constructor generates * a new object of this type with the fields "currentToken", * "expectedTokenSequences", and "tokenImage" set. */ public ParseException(Token currentTokenVal, int[][] expectedTokenSequencesVal, String[] tokenImageVal ) { super(initialise(currentTokenVal, expectedTokenSequencesVal, tokenImageVal)); currentToken = currentTokenVal; expectedTokenSequences = expectedTokenSequencesVal; tokenImage = tokenImageVal; } /** * The following constructors are for use by you for whatever * purpose you can think of. Constructing the exception in this * manner makes the exception behave in the normal way - i.e., as * documented in the class "Throwable". The fields "errorToken", * "expectedTokenSequences", and "tokenImage" do not contain * relevant information. The JavaCC generated code does not use * these constructors. */ public ParseException() { super(); } /** Constructor with message. */ public ParseException(String message) { super(message); } /** * This is the last token that has been consumed successfully. If * this object has been created due to a parse error, the token * followng this token will (therefore) be the first error token. */ public Token currentToken; /** * Each entry in this array is an array of integers. Each array * of integers represents a sequence of tokens (by their ordinal * values) that is expected at this point of the parse. */ public int[][] expectedTokenSequences; /** * This is a reference to the "tokenImage" array of the generated * parser within which the parse error occurred. This array is * defined in the generated ...Constants interface. */ public String[] tokenImage; /** * It uses "currentToken" and "expectedTokenSequences" to generate a parse * error message and returns it. If this object has been created * due to a parse error, and you do not catch it (it gets thrown * from the parser) the correct error message * gets displayed. */ private static String initialise(Token currentToken, int[][] expectedTokenSequences, String[] tokenImage) { String eol = System.getProperty("line.separator", "\n"); StringBuffer expected = new StringBuffer(); int maxSize = 0; for (int i = 0; i < expectedTokenSequences.length; i++) { if (maxSize < expectedTokenSequences[i].length) { maxSize = expectedTokenSequences[i].length; } for (int j = 0; j < expectedTokenSequences[i].length; j++) { expected.append(tokenImage[expectedTokenSequences[i][j]]).append(' '); } if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) { expected.append("..."); } expected.append(eol).append(" "); } String retval = "Encountered \""; Token tok = currentToken.next; for (int i = 0; i < maxSize; i++) { if (i != 0) retval += " "; if (tok.kind == 0) { retval += tokenImage[0]; break; } retval += " " + tokenImage[tok.kind]; retval += " \""; retval += add_escapes(tok.image); retval += " \""; tok = tok.next; } retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn; retval += "." + eol; if (expectedTokenSequences.length == 1) { retval += "Was expecting:" + eol + " "; } else { retval += "Was expecting one of:" + eol + " "; } retval += expected.toString(); return retval; } /** * The end of line string for this machine. */ protected String eol = System.getProperty("line.separator", "\n"); /** * Used to convert raw characters to their escaped version * when these raw version cannot be used as part of an ASCII * string literal. */ static String add_escapes(String str) { StringBuffer retval = new StringBuffer(); char ch; for (int i = 0; i < str.length(); i++) { switch (str.charAt(i)) { case 0 : continue; case '\b': retval.append("\\b"); continue; case '\t': retval.append("\\t"); continue; case '\n': retval.append("\\n"); continue; case '\f': retval.append("\\f"); continue; case '\r': retval.append("\\r"); continue; case '\"': retval.append("\\\""); continue; case '\'': retval.append("\\\'"); continue; case '\\': retval.append("\\\\"); continue; default: if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) { String s = "0000" + Integer.toString(ch, 16); retval.append("\\u" + s.substring(s.length() - 4, s.length())); } else { retval.append(ch); } continue; } } return retval.toString(); } } /* JavaCC - OriginalChecksum=bcba1e3171c5b52c551f24ada466f825 (do not edit this line) */ src/java/org/dbdoclet/html/tokenizer/parser/HtmlTokenizerTreeConstants.java0000644000175000017500000000303412644165236027451 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.html.tokenizer.parser; public interface HtmlTokenizerTreeConstants { public int JJTSTART = 0; public int JJTTAG = 1; public int JJTCOMMENT = 2; public int JJTTEXT = 3; public int JJTNCNAME = 4; public int JJTEQUALS = 5; public int JJTATTRNAME = 6; public int JJTATTRVALUE = 7; public int JJTSKIPTO = 8; public int JJTTOATTRIBUTESASTEXT = 9; public int JJTSETPROGRESSLISTENERS = 10; public int JJTFIREPROGRESSEVENT = 11; public int JJTTRACE = 12; public String[] jjtNodeName = { "start", "tag", "comment", "text", "ncname", "equals", "attrName", "attrValue", "skipTo", "toAttributesAsText", "setProgressListeners", "fireProgressEvent", "trace", }; } /* JavaCC - OriginalChecksum=0edda5fcc9575e799cc4b360865f41f4 (do not edit this line) */ src/java/org/dbdoclet/html/tokenizer/parser/HtmlTokenizerConstants.java0000644000175000017500000000474312644165236026641 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.html.tokenizer.parser; /** * Token literal values and constants. * Generated by org.javacc.parser.OtherFilesGen#start() */ public interface HtmlTokenizerConstants { /** End of File. */ int EOF = 0; /** RegularExpression Id. */ int TAG_START = 8; /** RegularExpression Id. */ int QUOTE = 9; /** RegularExpression Id. */ int TEXT = 10; /** RegularExpression Id. */ int TAG_END = 16; /** RegularExpression Id. */ int EQUALS = 17; /** RegularExpression Id. */ int SLASH = 18; /** RegularExpression Id. */ int NCNAME = 19; /** RegularExpression Id. */ int VALUE = 20; /** RegularExpression Id. */ int COMMENT = 22; /** RegularExpression Id. */ int DIGIT = 23; /** RegularExpression Id. */ int LETTER = 24; /** RegularExpression Id. */ int WHITESPACE = 25; /** RegularExpression Id. */ int NAME_START_CHAR = 26; /** RegularExpression Id. */ int TEXT_AFTER_GT = 27; /** RegularExpression Id. */ int NAME_CHAR = 28; /** RegularExpression Id. */ int NAME = 29; /** Lexical state. */ int DEFAULT = 0; /** Lexical state. */ int WithinIgnorable = 1; /** Lexical state. */ int TAG_CONTEXT = 2; /** Lexical state. */ int COMMENT_CONTEXT = 3; /** Literal token values. */ String[] tokenImage = { "", "\" \"", "\"\\r\"", "\"\\t\"", "\"\\n\"", "", "", "", "\"<\"", "", "", "\"\"", "", "", "", "", "", "", "", }; } src/java/org/dbdoclet/html/parser/0000755000175000017500000000000012644165236017260 5ustar mathieumathieusrc/java/org/dbdoclet/html/parser/ParserException.java0000644000175000017500000000244212644165236023240 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.html.parser; public class ParserException extends Exception { private static final long serialVersionUID = 1L; public ParserException(String msg) { super(msg); } public ParserException(Throwable oops) { super(oops); } @Override public String getMessage() { String str; String msg; Throwable cause = getCause(); if (cause != null) { msg = "[" + cause.getClass().getName() + "] "; str = cause.getMessage(); if ((str != null) && (str.length() > 0)) { msg += str; } } else { msg = super.getMessage(); } return msg; } } src/java/org/dbdoclet/html/parser/HtmlParser.java0000644000175000017500000004577012644165236022221 0ustar mathieumathieu/* * Copyright (C) 2001-2013 Michael Fuchs * * This file is part of herold. * * herold is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * herold is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with herold. If not, see . */ package org.dbdoclet.html.parser; import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.dbdoclet.html.tokenizer.Token; import org.dbdoclet.html.tokenizer.Tokenizer; import org.dbdoclet.html.tokenizer.TokenizerException; import org.dbdoclet.progress.ProgressEvent; import org.dbdoclet.progress.ProgressListener; import org.dbdoclet.progress.ProgressManager; import org.dbdoclet.service.FileServices; import org.dbdoclet.service.ReplaceServices; import org.dbdoclet.service.StringServices; import org.dbdoclet.tag.html.A; import org.dbdoclet.tag.html.Body; import org.dbdoclet.tag.html.Frameset; import org.dbdoclet.tag.html.Head; import org.dbdoclet.tag.html.HeadingElement; import org.dbdoclet.tag.html.Html; import org.dbdoclet.tag.html.HtmlDocument; import org.dbdoclet.tag.html.HtmlElement; import org.dbdoclet.tag.html.HtmlFragment; import org.dbdoclet.tag.html.Li; import org.dbdoclet.tag.html.P; import org.dbdoclet.tag.html.Pre; import org.dbdoclet.tag.html.Title; import org.dbdoclet.xiphias.HtmlServices; import org.dbdoclet.xiphias.dom.CommentImpl; import org.dbdoclet.xiphias.dom.ElementImpl; import org.dbdoclet.xiphias.dom.NodeImpl; import org.dbdoclet.xiphias.dom.NodeListImpl; import org.dbdoclet.xiphias.dom.NodeStack; import org.dbdoclet.xiphias.dom.TextImpl; import org.w3c.dom.Node; import org.w3c.dom.NodeList; /** *

      * The class HTMLParser parses HTML code and creates a tree of * HTMLElement nodes. *

      * * @author Michael Fuchs */ public class HtmlParser { private static final String HTML = "html"; public final static int CONTEXT_HTML = 1; public final static int CONTEXT_BODY = 2; private static Log logger = LogFactory.getLog(HtmlParser.class); private int treeSize = 0; private final ArrayList listeners = new ArrayList(); private final HashMap unsupportedTags = new HashMap(); private final NodeStack openTags = new NodeStack(); private final NodeStack openElements = new NodeStack(); private int codeContext = CONTEXT_HTML; private final String title = ""; public static int computeSize(Node node) { NodeList childNodes = node.getChildNodes(); int elemCounter = 1; for (int i = 0; i < childNodes.getLength(); i++) { Node child = childNodes.item(i); elemCounter += computeSize(child); } return elemCounter; } /** * The method addProgressListener adds a progress listener. * * @param listener * a ProgressListener value */ public void addProgressListener(ProgressListener listener) { if (listener == null) { throw new IllegalArgumentException("Parameter listener is null!"); } listeners.add(listener); } public String getTitle() { return title; } public int getTreeSize() { return treeSize; } public HtmlDocument parseDocument(File file) throws IOException, ParserException, TokenizerException { String htmlCode = FileServices.readToString(file); return parseDocument(htmlCode); } public HtmlDocument parseDocument(String htmlCode) throws ParserException, TokenizerException { HtmlDocument doc = new HtmlDocument(); if (parseInternal(htmlCode, doc, null)) { return doc; } doc = new HtmlDocument(); setCodeContext(CONTEXT_BODY); parseInternal(htmlCode, doc, null); return doc; } public HtmlFragment parseFragment(String htmlCode) throws ParserException, TokenizerException { HtmlFragment fragment = new HtmlFragment(); setCodeContext(CONTEXT_BODY); parseInternal(htmlCode, fragment, null); return fragment; } public HtmlFragment parseFragment(String htmlCode, String skipTo) throws ParserException, TokenizerException { HtmlFragment fragment = new HtmlFragment(); setCodeContext(CONTEXT_BODY); parseInternal(htmlCode, fragment, skipTo); return fragment; } /* ======================================================================== */ /* PRIVATE METHODS */ /* ======================================================================== */ public void postparse(NodeImpl root, NodeImpl node) { NodeListImpl childNodes = node.getTrafoChildNodes(); for (NodeImpl child : new ArrayList(childNodes)) { NodeImpl parent = child.getTrafoParentNode(); if (parent != null) { if (child instanceof HeadingElement && parent instanceof A) { /* * Falls ein Header Tag in einem A Tag enthalten ist, stellt * dies eine ungültige Schachtelung dar, die erst innerhalb * der Nachbearbeitung behoben werden kann. Der * Header-Knoten tauscht seinen Platz mit seinem * Vaterknoten. */ child.swapWithParent(); } } if (child.getNodeType() == NodeImpl.ELEMENT_NODE) { postparse(root, child); } } } /** * The method setCodeContext sets the context for the HTML code * to parse. * * The context can be CONTEXT_HTML, which means the code is a complete HTML * page, or CONTEXT_BODY, which means the code is a snippet inside a body * region. * * @param context * an int value */ public void setCodeContext(int context) { switch (context) { case CONTEXT_HTML: break; case CONTEXT_BODY: break; default: throw new IllegalArgumentException("Invalid code context '" + context + "'."); } codeContext = context; } public boolean isFragment(String htmlCode) throws TokenizerException { if (htmlCode == null) { throw new IllegalArgumentException("The argument htmlCode must not be null!"); } Tokenizer tokenizer = new Tokenizer(htmlCode); tokenizer.tokenize(); Token token = null; while (tokenizer.hasNext()) { token = tokenizer.next(); if (token.isTag()) { if (HTML.equalsIgnoreCase(token.getTagName())) { return false; } else { return true; } } } return true; } private void addOpenTag(NodeImpl elem) { String tag = elem.getNodeName(); openElements.push(elem); openTags.push(tag.toLowerCase()); } /** * The method capFirstLetter lowers all letters of a string * except the first one, which is made an upper case letters. * * The code: * *
      	 * s = s.toLowerCase();
      	 * StringBuffer b = new StringBuffer(s);
      	 * b.setCharAt(0, Character.toUpperCase(b.charAt(0)));
      	 * 
      * * * @param s * a String value * @return a String value */ private String capFirstLetter(String s) { if ((s != null) && (s.length() > 0)) { s = s.toLowerCase(); StringBuffer b = new StringBuffer(s); b.setCharAt(0, Character.toUpperCase(b.charAt(0))); return b.toString(); } else { return s; } // end of else } private boolean checkCodeContext(NodeImpl candidate) { if (codeContext == CONTEXT_BODY) { if (candidate instanceof Head || candidate instanceof Title || candidate instanceof Html || candidate instanceof Frameset) { return false; } } return true; } private int closeClosingTag(String tag, NodeImpl currentNode) { if (currentNode == null || currentNode instanceof HtmlElement == false) { return 0; } Node elem = currentNode; String tagName = elem.getNodeName(); if (tagName == null) { return 0; } // First of all. Look if there is a corresponding open tag at all! while ((elem != null) && !elem.getNodeName().equalsIgnoreCase(tag)) { elem = elem.getParentNode(); } if (elem == null) { logger.debug("Tag <" + tag + "> has no corresponding opening tag!"); return 0; } int nesting = 0; int depth = openTags.search(tag); logger.debug("Open tag stack = '" + openTags + "'"); for (int i = 0; i < depth; i++) { removeOpenTag(); nesting++; } // end of while () return nesting; } private int closeOpenTag(String tag, NodeImpl currentNode) { String search = ""; logger.debug("Testing tag \"" + tag + "\". The current node is " + currentNode + "."); // Close any open p tags, if the tag is a ol, ul, dl, address, // div, pre or table tag and no opening tag can be found. if (tag.equalsIgnoreCase("address") || tag.equalsIgnoreCase("div") || tag.equalsIgnoreCase("dl") || tag.equalsIgnoreCase("menu") || tag.equalsIgnoreCase("ol") || tag.equalsIgnoreCase("p") || tag.equalsIgnoreCase("pre") || tag.equalsIgnoreCase("table") || tag.equalsIgnoreCase("ul")) { if (openTags.search("p") != -1) { search = "p"; } } // end of if () if (tag.equalsIgnoreCase("h1") || tag.equalsIgnoreCase("h2") || tag.equalsIgnoreCase("h3") || tag.equalsIgnoreCase("h4") || tag.equalsIgnoreCase("h5") || tag.equalsIgnoreCase("h6")) { search = "p"; } if (tag.equalsIgnoreCase("td")) { int tdDepth = openTags.search("td"); if (tdDepth != -1) { int depth = openTags.search("tr"); if ((depth != -1) && (depth > tdDepth)) { search = "td"; } } } if (tag.equalsIgnoreCase("tr")) { int trDepth = openTags.search("tr"); if (trDepth != -1) { int depth = openTags.search("table"); if ((depth != -1) && (depth > trDepth)) { search = "tr"; } } } if (tag.equalsIgnoreCase("li")) { // if an open li tag is found, test first if it is in the // same list or not. int liDepth = openTags.search("li"); if (liDepth != -1) { int uldepth = openTags.search("ul"); int oldepth = openTags.search("ol"); int depth = -1; if ((oldepth == -1) && (uldepth != -1)) { depth = uldepth; } if ((oldepth != -1) && (uldepth == -1)) { depth = oldepth; } if ((oldepth != -1) && (uldepth != -1) && (oldepth < uldepth)) { depth = oldepth; } if ((oldepth != -1) && (uldepth != -1) && (uldepth < oldepth)) { depth = uldepth; } if ((depth != -1) && (depth > liDepth)) { search = "li"; } if ((depth != -1) && (depth > liDepth)) { search = "li"; } } } // Close any open dt tags if the tag is a dd. if (tag.equalsIgnoreCase("dd")) { int dtDepth = openTags.search("dt"); if (dtDepth != -1) { search = "dt"; } } // end of if () // Close any open dd tags if the tag is a dt. if (tag.equalsIgnoreCase("dt")) { int dddepth = openTags.search("dd"); int dldepth = openTags.search("dl"); // System.out.println("dddepth: " + dddepth + " dldepth: " + // dldepth); if ((dddepth != -1) && (dldepth > dddepth)) { search = "dd"; } if ((dddepth != -1) && (dldepth != -1) && (dldepth < dddepth)) { search = ""; } } // end of if () int depth = openTags.search(search); return depth; } private HtmlElement createElement(Token token, NodeImpl parent) { String className; HtmlElement node = null; String tagName = token.getTagName().toLowerCase(); logger.debug("tagName=" + tagName); if (token.isJavadoc()) { tagName = tagName.substring("javadoc:".length()); className = "org.dbdoclet.tag.javadoc." + capFirstLetter(tagName); logger.debug("Javadoc classname = '" + className + "'."); } else { className = "org.dbdoclet.tag.html." + capFirstLetter(tagName); } try { Class tagClass = Class.forName(className); node = (HtmlElement) tagClass.newInstance(); node.setParentNode(parent); node.setTrafoStringAttributes(token.getAttributes()); node.setLine(token.getLine()); node.setColumn(token.getColumn()); } catch (ClassNotFoundException oops) { if (unsupportedTags.get(tagName) == null) { logger.debug("Tag " + tagName + " is not supported! (" + className + ")"); unsupportedTags.put(tagName, className); } } catch (Exception oops) { logger.error("Exception: " + oops.getClass().getName() + " " + oops.getMessage()); } return node; } private boolean parseInternal(String htmlCode, NodeImpl root, String skipTo) throws ParserException, TokenizerException { ProgressManager pm = new ProgressManager(listeners); treeSize = 1; String errorBuffer = ""; boolean firstElement = true; boolean rc = true; int index = 0; int nesting = 0; if ((htmlCode == null) || htmlCode.equals("")) { return false; } boolean skip = false; if (skipTo != null) { skip = true; } Tokenizer tokenizer = new Tokenizer(htmlCode); tokenizer.setProgressListeners(listeners); tokenizer.tokenize(); Token token = null; NodeImpl currentNode = root; HtmlElement candidate = null; String title = ""; while (tokenizer.hasNext()) { token = tokenizer.next(); ProgressEvent event = new ProgressEvent(tokenizer.size(), tokenizer.position()); event.setAction("HTML Parser: " + token.toString()); event.setStage(ProgressEvent.STAGE_PREPARE); pm.fireProgressEvent(event); logger.debug(String.format("++++++ PROCESSING NEXT TOKEN %s", token.getTagName())); logger.debug("token=" + token.toString()); logger.debug("currentNode=" + currentNode); if (token.isDoctype() && (currentNode == root)) { continue; } if ((codeContext == CONTEXT_HTML) && (firstElement == true)) { String tagName = token.getTagName(); if (tagName != null) { tagName = tagName.toLowerCase(); } if ((tagName != null) && tagName.equals(HTML)) { firstElement = false; } else if ((tagName != null) && tagName.equals("body")) { logger.debug("Missing html tag."); firstElement = false; } else { if (token.isTag()) { logger.debug("Found tag before html tag: " + token.toString()); if (errorBuffer.length() < 16832) { errorBuffer += "Found tag before html tag: " + token.toString() + ".\n"; } else { if (errorBuffer.endsWith("More...\n") == false) { errorBuffer += "More...\n"; } } rc = false; } continue; } } if (token.isComment()) { currentNode.appendChild(new CommentImpl("\n" + token.getValue() + "\n", currentNode)); treeSize++; continue; } if (token.isText()) { /* * Falls der letzte Kandidat der Title-Tag des Dokumentes war, * wird er in dem Attribut title abgelegt. Der Titel des * Dokuments kann nach der Transformation, mit Hilfe der Methode * getTitle() vom Aufrufer ermittelt werden. */ if (candidate instanceof Title) { title += token.getValue(); title = StringServices.replace(title, "\n", " "); title = title.trim(); } if (skip == true) { continue; } if ((currentNode instanceof Body || currentNode instanceof Li) && (token.isWhitespace() == false)) { P para = new P(); para.setParentNode(currentNode); currentNode.appendChild(para); treeSize++; currentNode = para; addOpenTag(para); } if (currentNode instanceof Pre || (currentNode.findParent(Pre.class) != null)) { String value = token.getValue(); value = HtmlServices.textToHtml(value); logger.debug("Adding text to literal environment.\n'" + value + "'."); currentNode.appendChild(new TextImpl(value, currentNode)); treeSize++; } else { if (token.isWhitespace() == false) { String value = token.getValue(); value = ReplaceServices.replaceAll(value, "[\\t ]+", " "); value = ReplaceServices.replaceAll(value, "\\s+$", " "); currentNode.appendChild(new TextImpl(HtmlServices .textToHtml(value), currentNode)); treeSize++; } } } if (token.isOpeningTag()) { String tagName = token.getTagName(); if (tagName == null) { continue; } tagName = tagName.toLowerCase(); if ((skip == true) && skipTo.equals(tagName)) { logger.debug("Setting skip to false. Found tag " + tagName + "."); skip = false; } nesting = closeOpenTag(tagName, currentNode); NodeImpl node = currentNode; for (int i = 0; i < nesting; i++) { if (node != null) { NodeImpl parent = node.getTrafoParentNode(); if (parent != null) { logger.debug("Closing node = " + node); logger.debug("New current node = " + parent); node = parent; } } } candidate = createElement(token, node); if (candidate == null) { continue; } logger.debug("Created candidate = " + candidate); if (!checkCodeContext(candidate)) { logger.debug("Candidate is not allowed in this code context(" + codeContext + ") '" + candidate + "'!"); continue; } logger.debug("Candidate is valid: " + candidate); // Commit changes if (skip == false) { for (int i = 0; i < nesting; i++) { removeOpenTag(); if (currentNode != null) { NodeImpl parent = currentNode.getTrafoParentNode(); if (parent != null) { currentNode = parent; } } } if (currentNode instanceof HtmlDocument) { ((HtmlDocument) currentNode) .setDocumentElement((ElementImpl) candidate); } currentNode.appendChild(candidate); treeSize++; if (candidate.isEmpty() == false) { addOpenTag(candidate); currentNode = candidate; } } else { logger.debug("Skipped candidate."); } // end of else } // end of if () if (token.isClosingTag() && (skip == false)) { if (currentNode != null) { nesting = closeClosingTag(token.getTagName().toLowerCase(), currentNode); logger.debug("Nesting = " + nesting); for (int j = 0; j < nesting; j++) { if ((currentNode != null) && (currentNode.getParentNode() != null)) { currentNode = currentNode.getTrafoParentNode(); } } } } } postparse(root, root); /* * --------------------------------------------------------------- try { * * PrintWriter out = new PrintWriter(new FileWriter("dbdoclet-" + new * Date().getTime() + ".html")); out.println(root.toHTML()); * out.close(); * * } catch (Exception oops) { * * logger.error("Can't save intermediate HTML file: " + * oops.getMessage()); } * --------------------------------------------------------------- */ if ((errorBuffer != null) && (errorBuffer.length() > 0)) { root.appendChild(new CommentImpl("ERRORS:\n" + errorBuffer)); treeSize++; } return rc; } private ElementImpl removeOpenTag() { openTags.pop(); HtmlElement node = (HtmlElement) openElements.pop(); node.closed(); return node; } } src/java/xsd/0000755000175000017500000000000012644165236013247 5ustar mathieumathieusrc/java/xsd/docbook/0000755000175000017500000000000012644165236014667 5ustar mathieumathieusrc/java/xsd/docbook/docbook.xsd0000644000175000017500000271460312644165236017044 0ustar mathieumathieu src/java/xsd/docbook/xml.xsd0000644000175000017500000000110312644165236016202 0ustar mathieumathieu src/java/xsd/docbook/xlink.xsd0000644000175000017500000000233012644165236016532 0ustar mathieumathieu src/java/lib/0000755000175000017500000000000012673747472013231 5ustar mathieumathieusrc/java/images/0000755000175000017500000000000012644165236013716 5ustar mathieumathieusrc/java/images/errorReportItem.jpg0000644000175000017500000000110012644165236017554 0ustar mathieumathieuJFIFHHExifMM*Created with The GIMPC  !"$"$C"!"q!1Q ?eVM6Oѵlnli&c8b’P0M "o9q>C6ծXYZc3fu5fQߢ>OA`mZ8U4ωiQJp(p!e ҅>QNP8YPE8PaCdtAS6GN‡)B # (|(0:!AɖO%6QN 6GJC)C #(8l8p†‡)C#8l8|8ᲊPCB ( (|(0p†ƒ ( (l)х:|(3 Ӈ>QNPaŽdT)ƒ #8|(0:ppCCPE8PaN# (|8:PCPCC(8|(0p†( (l(0p†PE(Pg # (|J (l'2eSe#eQ#dtďR6GJtpFG)B#(=t6QK'O%6QJH(Q#D҇S6GNHE9IDATe _38 .+C+@"KؚL,%s)|Fyi JIENDB`src/java/images/dialogHeaderBackground.png0000644000175000017500000001054012644165236020774 0ustar mathieumathieuPNG  IHDR00WbKGD pHYsHHFk>IDAThkeYU{sU=faBA$0LIHTB FLH_h!>!&~DA^Cd`1Z~ا{&ܺs.? @^<$m^'4{{:sw^{x4bssQEUT$J~MU@3CE)EU!!XeaPU0m667~ ܓY||'ORVZla1Ƃ1 ,]1( 5CzE`/'U@n@}r)%Ν;/m{ @Qd*I(BJBLBJJ!$='xޭy 3|KPSP`uU5@ "!{CEU#R\H&$IH JlNoY#eAIjc 7JkC`S:lYi>|CkWgYШǨ&Μ[sPbA>ĈsIA6463 DQ%b@XCAN7y, |Hz<h떏Q`kw]z튣+}jՁk{bbR XJְpޓ-ҀWR#*%i,(T O^ƵOUD9ckFBIIjƔ 9+`>#KGBrQJJHlOkZc9qx .MBFea^Ę"s_2$QQklM^A:$\ښcO1{ &PGú*!RJ`slH2]KHʱ)E0&'BLDc(NݿgZc(/zg%0N16I7Zz M M@YcsQG'=>pvuz|J -/}8}:DuC}kW=uO|N| hnY51D|JeDʁ¾Gxp!.. +|L^um*iB2, ;'8Hc's={N2,1/>u¼7g{3O~+} ~UoRXR0 8{{_7__||W}`4Zv{=>C(rM =(\{ɠ"$˛檞'QCR cC;bЫxs㝿v[(ӲBBB2ç?w` IPX<~||R|L(pakΒ# 7gA'!R枫xH;bZ[O7QH ONA1;,\…ą4oȈ1$-0d!|B DWz,EX2PZm5KhcY;)b09lHF|#2՝%.HQ+::$v[`3xoɳTA%R*vH!X,MC'",) :VnUh9yG[)[Ip!OMq>Aǝ졨nq^#Ԑ䌄AԒ4wn>|B(j *[kkqA(-U!2wq<4ZYG#bx!bd_ŅSŭ"JYX X'4$5e 5֠@Sc〪v ҫ,0Xx!p]꠸|jm|HA8:`GaZ,QVIsX )9J`r!s|qsjk"Qm1+I=H"uM#DńOµEmԕa> kKRY|b T VXkGH2QŅ'J1P(+CUZʖתX0EȉPqcP7!̞^3]D$ VI]tq`,I=`HdAH1I #Z4AlsWTo BU *uTu:>`B_ \ؘʫ$lnN1 xŠjQS i>]D¾r 6,LSZbI( !cL A 7YI,] e x2R XX (rG$D2KPJ3}0RKP(www]c<beZ•9ɰ ༰;L1g(!_"Ӫu E4\R$5:DL)95}W,ú/}ւ=oU8[mG `~ٷzֽ> 1 )R&BPLB ^jHH=Xct)%o{ y+G*-9v晒f,*LBC!#0hS}C0Foy]?%R s8/[k{^j|ݩ <`PS4 3$곟(9l;(dB!@zK_?:c->xbL, JKpi{N*)ΠɅroF;α!- P7Cv!אzZ_p[b̗K>m)%@CHr0,e7%%Zti\$ 0\aŒ)tfrN+,nA ё$եnQ(B8s\vo{A2]iH\~+'QI "f% Ua(1wֲ}'}Yr|}0nvt{}s\aQU ˯_>枽W,0rݫٺ:GbMp0[0KmN,UUrsҚ?~ԋL&|鋏p-?V&1~AN`b[k\ޚDZ1&2sw0L GlnlsE- ccfeeƚnQwu'N|ggo`ܟ`}*Y)t Oy5;DQo; `~j?\*?UU'nX,Lloo3͸٧ϰ_.)ܒtk;U>f[WFٲ}xۖ;s%JE穟JBFr>e[T7WvQہۧy{/Ġe43ucHH1R'[[4#4_Ϧ{6>w>z/aAjkDz>Jь3sM!B"!bN`69SU1,CUEnn)ݥ6}zp&{=qs~ǟral-(JA%a.7JAK %1hwL+r5VMUcȔ!Վz < EAb|7߾z}{l5zp< -̞$L P#qAaFU|wo>da<1^9D?h L!Z#UEQΙͦnF&5?|xXƯ?G Ku?ιoiؼ"If1&|(]_1j d )eC@c uͲYψ1""s+uZ@!pݪzt{]F1n/i*YI1B*ʲDZh~ϹS#8&E`$:шnp8t1b~GN2|&19ze-\Uq \ک/ 0n1z nv:t, ʾljiS5 `ΔEq['>Nƹ뛁=;vhGc6ONcv õrbzUMi.Oc셲j]G%󿱾ΧN]o>tPg0~I)]G>M[ K^IENDB`src/java/images/infoBoxHeaderBackground.jpg0000644000175000017500000000161612644165236021141 0ustar mathieumathieuJFIFHHExifMM*Created with The GIMPC  !"$"$C2"1A ?I#˧%E$H䒚a$9$I$II$),I$rIDH䒚a$9$I$rIK"j$IdRI$I)ISL$G$L$G$I$I"$rIMT$G$I$I"I$rIM$H),G-i,G$I$I"i,I.dEH䒚I$%4I$rIK"i$G$TI$I)ISI$9$a$)$YEa$),ISI$9$I$%4I,Kr),G$BI$rIM0IE$H䒚I$$RY$I)ISI$9$c),jI#H$H䒚I$%5DH+ %Ie4I"Ȫ$G$I$I)IE0YSTI$K"ISTI$I)$H)H䒚I$$RY$I)$G$I$I"I$rIM$H),G-i,G$I$I"i$HI, $i$RM0IHRH,I:IHUti$RM$JB7)%D )&ܤ*$LnK I$I4K) I$L$RMSrYHRI$I$I4I) I8I$I8?src/java/images/successReportItem.jpg0000644000175000017500000000104712644165236020105 0ustar mathieumathieuJFIFHHExifMM*Created with The GIMPC  !"$"$C"#!1"2A"1! ?rG>/~o|~/n.:̐^vYF(̄?$a>bvԳCf,ZwϓȥgoUe4rJ4){wWS`vvHʲewlHn?d!POv=oӎۅĨU +=N<}Hsrc/java/images/sortDown.png0000644000175000017500000000022512644165236016242 0ustar mathieumathieuPNG  IHDRPbKGD1 pHYsHHFk>9IDATm uD_F* !>Q * ,aE2 ႟f0DO|qIENDB`src/java/images/dialogHeaderBackground.jpg0000644000175000017500000000155112644165236020772 0ustar mathieumathieuJFIFHHExifMM*Created with The GIMPC  !"$"$C2"1A ?㠲(,5%Id4Y, KAdPY jK%Ȥ`4AddRYDXA,EId9$h, dRY BdRXDYA$%,E%L,E%KRY,I(K"hYA Aap %Id`RXMK"0YȤ,E%K&4Y, K K"0YCPXQ,%I9$h, Y,K(`RYY A$&d(, %Id0hTK"hXA,Ec`PYtkY, KhYA@ ,%d),"Y4M!d2hXȠ d),&ai, I( "jK"%(,Y, KdRYX,K @YEȤ `(, :5,RhI5 ,K)gK:j h,,FtjK)X4b@I)&@a$M%$BIgR )XK &%Τɏsrc/java/images/errorBoxHeaderBackground.jpg0000644000175000017500000000173412644165236021340 0ustar mathieumathieuJFIFHHExifMM*Created with The GIMPC  !"$"$C2" 1A ?h z F6 FH``PYT&P4XA2hASA0hTAaѠ4(4h C@A0hTAaA@`Сhh KɡZ4@XA2hT&B`BA1Ahh 0iTgadPYrqJh4 Ѥ,(4hI0iT 4@i A0iTB@`A0hTP4h A`PXPi4(Z4 Bh4 Ш-M!Bth4 *,&F4 Ѡ(,6FH`Ҩ*8, J= A2hTea),6 FH`ҨY$hhIZ4PcM *FJBJYIPTfIA`i(4hIPZ4Rl ,Pi4JѤѼIAѠ(:4&FF- )* src/java/images/settingsGroupOpen.gif0000644000175000017500000000007212644165236020103 0ustar mathieumathieuGIF89a , XQy-uxlJ;src/java/images/errorBoxHeaderBackground.png0000644000175000017500000003001612644165236021337 0ustar mathieumathieuPNG  IHDR2~ pHYs  tIME!:VxtEXtCommentCreated with The GIMPd%n IDATx}[eCD{C+v2#CGIT,UUIUIuTU~HURɿw;UU_Tu?Uu RYwwX%PC[o\%ݥI|?_To|V~Ώ_>?㘧TG+|WyoK'EU_}l߻ܿ,UguT5<~Mw7CͲy^co34OD^}[9A*xu3܇Fa7b_U^gi;e[bmiK2[]ekTMw=.l{#眞}c~>=[z_ZߏBʽkVwnº쳯>,X.ܟ 35ww[Z[~m$yftS\g ϖtvgoܝaU]OxW>_#yKg8_gy8*]ro{`m<,,Iгo>:D-8ZwWrS |۱e>z0uw-*x˱Efm|ޏu C77=~QȖy˞].Fѳ_|+KF$^ {(l}];kEȖ+ү|b/ѝ/n߳|$b:%f7Q2w:IneѬWy׹6X?kx.U,_R{T ^ u" +M :\N(-q=? >;o{Vyx#|xn7'98v˽scL]@P'i#~sՓ1~[ A\5 X4Jm_ݏ fO+fbo:2/="\+;stqWyW_êD!Q>At&pϡ/chv6~C\nL!'fQV6Z*}ynKXȧe6 E;},%Pߞ̛xC{?Mi^_'eLmV CP->Sʙ^,"a1Ԯ+ #Sv:)ף͞;7 z'^[i*֮]@,lqc f _Lמxd A_F#w~ 3O?ԹPZh))w#y7.{CNn5 'gfS{{iT%^ou2Ov ޸u/.{Jvy7y3mbx.!2}''@\>fe?/v6U]0So ;>* Nmke_b8j#ma*'&QovZ"ETŴzm#s(OV$f=;XN^Ʉ@7^ os/M[68'3PαVCrXHB(V^7kT<$D?ۅ%v@R}T ) )>e]RՇcV ~/Ey ugijDayg;|%?078 jD]_ jnȸ|oI{mm.5銰ׯ 睋#slkxF=tAgzӝ-BXو~ρ(EYfZN=u,œ!JX04B*IٙsTz~zHS* b!OxSi\G'K]n׳jlEAI sbd(P:kx a=:4 fu 9Gb^A\ͰU+"jJ GwJ+l\SLo|)b t፹32V8rLQ`SG:fF7 .O@ekUOhv(RN[/ DJX]}V, gj&*5J Q0fPm*+[&g{BG0oSИ1|{"kgV./OIet,J[!t,-OioS+dv_CkưLד\`'~@6'ym7mankAnT+62se=X5R~-92E[rAZ)k\$Ua9^ sl|\b3F}2ObDdٺXu]BNС Zme›w\TẳgPHr rѕy\cွ!P*ۂ=<2Z a^ <;YU"Tut&3oueǔ2ETFJaaRjmD xMDYܶJ|凪{0Jҫ$]$ˑ {.R?3j;4c  ń(:P+ԐPTevyT_(/7leaQ`R]ޫ '~h;@ &}d-Gm2[=j2y,+;*j0Iۨm iڄG|lQz ڕR (bﲇ]ƍZO=/8v^&b>p5!W*]R_s5bs7o ,ǚ BbuҽֺY}z>L7YFR\U"kI~v(^Rpw=Zy_rI"C"@R&/BӚ x/=PK~+;|'QeŻge/j%dBGdF3?`!<e"DdՇJ5OvBjؚ'lQnY;pĞ sqv/-e}BW^)2Y=׌SŭQ!bڂ}1Ȃ"$%ƀ3cT63kQ;knݑ׆ͻ;lǼ GI-Gu yVbPz=FFZ *6[,ԛJf3M dQ[w$Hai-]mt'w#jR~~{y ݈E%ص_uz> wX31DփgNkVy2T%7D{78^lڇ]nh^jv-ʚ!-Zt/Ɨ[dp*Ѹdo*vWim|E92hQ5H,fis0@&B4JqHŖ /9xQʬTKge Eyhs++ p#bxΦtzj2YbG{"*aC AbX+؃!Q8Dx) Vж^{ɤM? ԪʷnO@9·VBמ1vfhZ@nǘ$3.&p}JBV{Ѭi(":@Zf{E0%.'!ر!BOo֣qjJ Td9)$?ƸmӰѽ0 @Rk葇ܻm咓FZ]Wu%ږU*6g0 Ն:|tF>&-r$ң}ڔ]Xg C2[[3v~>_&80./zZ4 d>?' ӰuD&֐ZcH3x[>-&̀vSrxw 6k@٦0hiCdA,V[+iLy2Uy%jӌm? f6VԓRS&$WVeVkMB: 9 [S<qn #LOB k_{K\E-6*ޞl0]5M4X耔ͳAu5^N;koKx f2"7TE?=U)SeӶ/%@87` c\@juТ%DntDWFIQ6!Pi?]hoeJy'Q@Nޭ_F(.c~Wi_']Iؒә'-z|^;pĭgXHfå6/])\ĎNq{u/G|7M{0J)#]bƆd? ]oYO\͸@Kz.)ٙq}ݡKu¿"i(N Uۧ%@z_SKJBإ8?C6Fn<[JsSKpmLc ^Iivj8qK[ߞ-žA = ?J%"L$Ejj/Y-0!=΄LkҲK-Z 9CC)|\m<^_H%yZ7˄E)ѯST&z0R-ßℼY*zrQK;ˆ6- 9:hcagG5]oV܁XThq mdK^ؖ4++ܵE; K̓үn:0 bJ^{O.ςKMh}&rt*w&h k2\mBEwoM"U?CdZJ[B LX8?wWIþ R/coY=BA{P`7£Rg4׾*$a:h\)w̾nЙ1b9\״ĐfD/JS%.2eK yS 4r%e"1^:EvПh^o?7. SYR[ˎ-`#^֚/x o:NSbզL׀[fW#dZ\4N^֩0'>V>PEʶ0D)ZsӚ,fak{5.]!*#JWH853zyS;1T)lBXݶ ѵi4.mʼ0;^1Ng?R]96Uѵz\9J9:o&\m#܇<:̵r5{B5wQՔ5#"d<+A~L^zq̬Y=9 3"^B{ W3A*S#} %(}3BvalBLTY C)K0 Jg3`{$'a#vuXK#QM47LѪ6Ь! %Q5T@Dm(v?0l骒5cUP^~T?vY9~wZE-`%#ZƤt 8aA[߃ .׃>HT&J.;] W2kn}8n%9۽CUz3r y F8FhSNK2h҂Ѩg9`R&ȶR(4-9a Yup^+P_J:| 5-J+⨚Þ7 L[6X% bUyrEC"ⅴGjR~K>tgD/Ԁ>YJ52$84 oC)^J;7h 뫭/iϙQ' A= gPH/R+2$ %a Nn;-I7-9˩u@*E:GcyaUK90 kM%>Mms\ѧ2hC{1y5t3XW0qyɽO92,Då?8Q,JULEI DžLlC%3xsoWIE 5ai@M3vyH˴j-(`+m_0/[l*M:-z5G e/xݞs@qlBU' } ,5֩NۍM+o5tO7t5i a) |* <]]Q\B˝kRnkeYkwRA]쿚V4XbaMq!a8><=Tpsߋ(5CL1 ctCvAvtI?1i;}ѴF`pWx˄JObDKG1oIw c_#$h=h yQ"iyш\;O™6dQjZYbR[4kH9jm ?Zno͂`X>v<aIXcWi5MflYh{Ĕ$ B Q3l?ILMocӔEWf(#&Зa*NwYΐh=CÞA,)N/5(ϦbFA Q`ˏDu[iaôWo,Z3(XYG},DB%=>Vr٘E6d"lNԹxIDATt@ ַ ĆxZNQ/ՖX c|Ȓ8αjQ'Zc>_ƧeyG^v[&r@0l1ʆF]F$4W|Aw,HC=p"ʗgZݤ f^N )^e:b5~x*=tM"Z;iA & C'_wY4.h+"0Q6Gu ȉ2ôl1;:uT+mW!1#cZ}S3uzVrϰ^^F_T^܋=T0uNl>. iO OG(h|4w!v}]&+%ڦzщ TZ!K*; )5{8wzbswfjCp[jS 3ͯae"QFG7(I3ُ7^frB+KX4Ѽ%Xq8]Cخzp%u3y.8SlI(й&!X =Vo9SPD N fEza~[m b\;+e ' W َzv$B!)dyj -\䐍VzgfZe>Z2#BCU9 EiNY2jT=1 k 7ڲ_˚-NI;.ʲ}77FpHT9 Zz`JO#H>GY:)f)gL;XΫO; xfƎ@w᠛"P`0o5'U v2k>݊XRR^**FdՉk@^ȻWyChƴ߭-.k1UB׆ר9aCmM&ٺPن]R3(NAɺT7}RS,J9+qEp&fn\;!!:OBV7t?)gkƎ d6*q0E\^z VðG7 6ɮ>b"5>>88:XqAϳz@Ͷ/.eYVFk㪸#*utuSU4U [QL5' P5jqPPGf6B {"3EefVUCi?EO35%37>.'qu@/\o=m/zvdm햿?SƩGZo |E<=Tݾ1?8q0&<*i|nt|&EN=fybB-җ`& <-e'| E d1l4z\(ʘ/&>]ZpƧj~p/ycM(%F~3Gm+E,)&wJ{? \,ED047'B^AH.4l6ôҷ+zXPٶ7#ya*m| Y81Ҿ )'C*2!RUN,w}bu9E#b9|$7`ʹM)p4ZَaV#^RX]~|=to*ϴ<{&7E^`W^C{,Y46uI{fvZzt4l7m!W_2HMzգ !}K,zмsHנoSF9]7̃q4GG*{zQ)3J tW - {+m]JB(1]ٚ9nZ/wFM{Vc@a9gp\`˦]M.S{ ʩBKI8҉&E7:pVjl;jBN@O? I28ޜ,펃L}K~H%YK8~I =UykYع(=zCO+f*IJA}_|vk\S߱E=5xס^SwzZ uۦo>93FW8 m|6V9cEyTr3/Q:1MD)޹ 50 ')^[sӫB rޑqY#Y2|D ;U-sMz ~C(TVދwJYRDUTr]ҙ\ZDdoJ Aڦ7YD Y K=E9bfyGRS|pkst)C beU/Z>;E-%x[A.Ҡl<` NAփK1.sn'='1RZGU%Zw~ֶW{./6wbY:%nWFs!3q7 J%ϑM\0ԝ k,P:$#wbQɷ0ՃƬ¥kyBCIN?aFȄ(Q g?'Q?&(VG;mWNA1-dAǨqv;Qq)Jm>L_%Zβ`p'^s> fMG5/= ugfM0_a IiARsv^8p6hX;.>D9KfH ]W~ C9RV3HsYlS qĄ4I{^sA=HL^l6U !o⋤C3t@yJ̌X4n nnWRNHl XEi4\/- }Gx70 }~ܹ/>I距rJϖc碶rT˗b=وϦ*paPFؗU*j{B^W"B]2Ԑ}ڝUY1ڳG3gZph1cqގ p|Ҳ CXc<}jzD^WK$uX%Tq8CA}DLxwh m_|z01|XeOaj,d[xg)Yt1}[%}Py 9td\Ⱦ_BYq*iB9*TCrv|2wZpPmw>k vP6EF4r#U%hȶƸ,xoILr4s}+8:4*I tr{P5gb6ǹN2QHovh"@>H9DNJn5t('U{ i 9Ǐ{(oBws=Myr"(s WѓYrn&X NZK [h7Q?[m#v"xIn@ЈvEژ5Vҕ6k^ Q<m!cKpkoVosu\־h˛u Yx1?^`m8IENDB`src/java/images/toc.png0000644000175000017500000000650312644165236015215 0ustar mathieumathieuPNG  IHDR00WbKGD pHYsHHFk> IDAThi%UV{^{'=KO>x{<H$ J@d l!Ye5| #PH!(qB8{<==g_m^>TzVVZ[??n kmyg!ts ֛i6E ߺ^d)Ko/?p@븮R|:sg<,q#R\D/$zUZ5pr2_'+{ϋD$}gNϽZkbA:݀ZIS.<cA9}jja  ĩ-sT`=Z7Po-n:1`$xbVgѤX(+b\ySł{rrbk.(V/I/|cO/u+^~WW֎7~n/`q1\{! vnhXxkDP<63k'SSFs}RXVOW*幱M[oy9(-Ht/|cF:͵N7ۋ/]\Yj XZ' 3ۙɛK(EDX7X\^C)њb{8!VVVYX\JE~ /Lm̎m +S[;- _/f5^'Ntd#\|cZT8A,3(Ŷlh(`kӿZ9wS7qP$ fL""&پcaڞ3gTK%_(k.XQu]Ă6ND ZH)i1CZa(JIB잝Ci4mjZZ=ض}m4[mR2 QW0: lf\6;LN~UZ@K ֚ɉMc1Ƥe 5ZmNMR4α[~u:s2D886R ?GODzIQz!c-@Q9A YDc\er1eH( 7099A(kz]rz[xyFZ繦Х{A vDě84ogV~cPILq'N}]>>|}ǹ'X]OY{i l.'m s"yR9{Xt3aFJ..} A]O,إҏ/~c8Ͻg?_}^/A(QSJpCwJTF?X oZtyH-ӤL,DqJmCsg/|X-O8nVJg KzJyidBk ۽$۠mdWڝ.+k;䠧E1v'wޖmW4R5ڤ%^" Ð ,e*Q6G*@7huzQ5*J9/Im%Ql~E$a;b/*2BI>젠XeW%8 !V@`Xiۦ"Y۝._b r$䘒ژj'pp銿ἐAAW( 4M^!%*eX2vDRc})6lͷ @ ঒s'ܿ8ՒQ\IRAD١i2YfIl㴊QP1MJjnSEңQ .:ج٦%wԹREaE?v]DT׮M6V:^VI@IVRoHhJHLhH—!sXV`xuo~89h}cԋ"-^s].,.:MN6כ03ASao/{Ϭɿ>g瀧Fs}7=yuɏrpK1Kk9ߝ{J'iJM7y$N^/SvL<ē e)#671p+8 G{ۉ1ƠM<*%jM6D1(8<L%({YcekŃw6AR:2Qc9}FwNCai<# t:i߃OiXEG)<`kmoЧgףu׈}k[k(QwR8uuZzxyfΖQ${hjae;zdI+zq0؛I7XBADҭRBW'Q|f{smw PJQ)`)~塏._Low^R:}X9jˡǡc=К:xx+ Ҹ_-(}[ޱ\{ힽ;+8O|yƏrf9}IENDB`src/java/images/warningReportItem.jpg0000644000175000017500000000105712644165236020103 0ustar mathieumathieuJFIFHHExifMM*Created with The GIMPC  !"$"$C"!!1 1 ?~F5֪ԩIWU`FGy 2`쀶""J,kq3lp}s!xԲGarԥ Y"d{Tڙvg  7Bj-HY>ydgtLaY1 H_ ~ xuv6Xx9Kȫػ(ܒ>3\{˲`src/java/images/Time16.gif0000644000175000017500000000040012644165236015444 0ustar mathieumathieuGIF89a! NETSCAPE2.0! ,!PZeSmi3ɷ}^=u07[! , o&W8ȑ留u[! ,!3jBN"ȔZ&*K/!,#Y;]8ige^vۮp9?S;src/java/images/settingsGroupClosed.gif0000644000175000017500000000007712644165236020420 0ustar mathieumathieuGIF89a , XF e'Z߉x ';src/java/images/question.png0000644000175000017500000001314712644165236016301 0ustar mathieumathieuPNG  IHDR((m pHYs   OiCCPPhotoshop ICC profilexڝSgTS=BKKoR RB&*! J!QEEȠQ, !{kּ> H3Q5 B.@ $pd!s#~<<+"x M0B\t8K@zB@F&S`cbP-`'{[! eDh;VEX0fK9-0IWfH  0Q){`##xFW<+*x<$9E[-qWW.(I+6aa@.y24x6_-"bbϫp@t~,/;m%h^ uf@Wp~<5j>{-]cK'Xto(hw?G%fIq^D$.Tʳ?D*A, `6B$BB dr`)B(Ͱ*`/@4Qhp.U=pa( Aa!ڈbX#!H$ ɈQ"K5H1RT UH=r9\F;2G1Q= C7F dt1r=6Ыhڏ>C03l0.B8, c˱" VcϱwE 6wB aAHXLXNH $4 7 Q'"K&b21XH,#/{C7$C2'ITFnR#,4H#dk9, +ȅ3![ b@qS(RjJ4e2AURݨT5ZBRQ4u9̓IKhhitݕNWGw Ljg(gwLӋT071oUX**| J&*/Tު UUT^S}FU3S ԖUPSSg;goT?~YYLOCQ_ cx,!k u5&|v*=9C3J3WRf?qtN (~))4L1e\kXHQG6EYAJ'\'GgSSݧ M=:.kDwn^Loy}/TmG X $ <5qo</QC]@Caaᄑ.ȽJtq]zۯ6iܟ4)Y3sCQ? 0k߬~OCOg#/c/Wװwa>>r><72Y_7ȷOo_C#dz%gA[z|!?:eAAA!h쐭!ΑiP~aa~ 'W?pX15wCsDDDޛg1O9-J5*>.j<74?.fYXXIlK9.*6nl {/]py.,:@LN8A*%w% yg"/6шC\*NH*Mz쑼5y$3,幄'L Lݛ:v m2=:1qB!Mggfvˬen/kY- BTZ(*geWf͉9+̳ې7ᒶKW-X潬j9(xoʿܔĹdff-[n ڴ VE/(ۻCɾUUMfeI?m]Nmq#׹=TR+Gw- 6 U#pDy  :v{vg/jBFS[b[O>zG499?rCd&ˮ/~јѡ򗓿m|x31^VwwO| (hSЧc3- cHRMz%u0`:o_F IDATx̘{]uks}̝si5a@@NRPPhQ"5EHTUm"!&*U jFTMZZ%()!qIҐ@0ux3s^cঐR)[::^ݳϷZ߷EUe_f`;_yn)NOoxZD맣?U߼}ws}VkZ{ݦx̯.;'tzsfE{nd|z"KK.,,L]7v|MoŘ" B êpO'^ {1nA6޸h@&?Hj :~!z}M՚jDp զAl ]qC|K~qDq)c0(6'Cœ+jp)ц+\?߷NgϮ Ŷva{PTE?6#ӯC,PEO]$>9ȺanKl߷wzakmˣ ZKEo[MQ[..ːtK^3ѷ1iXJX< y|UDx~'M*ZEԆUEU?WGL!qL\sioĘ>Rp* >48?~z"`sD\"`s|ID2>(8(rA\w \.e!OFFǰ'9Y83}PdwHlSUELjzq+ 6do@2pq\FL 7j W )IZ}A/ +b,<.qd 0:#(ꂥ"EB!Q?; >$?o!`9E8W66o߽l}h$e--S *oA»E0>̞y$*BwyjD+jy't zE&5( u.>ԡ`*%b+cGqU䐒0JTʖ3%?"xxj$|tiauU/"fDh6en];ח9rNWEҡW^yȉjvߺnZШ'sNfªJP+@s4I ggS,b" .;@Vlx<:p9YzWEQQJ.T$.`S$`+LuYp9`v4=###Q wG;Yg-:T/& \l*aGlҕ9q.ƺcStx/g3̭P&Z'Z<3_̙e T";F8UTwYqT-DV܊KA u8bXVă?tk;8g$ǹsRܛЙgG^Ը&栂#fI*Smcki"`0&:'Ƙjb4A`$xEMT 'f8֏# Fcfbbufy#E= E-11d%Hpq Bop?ȽSǎܷ?w;F`{HJe_CQ,-=il'ч?MexVv{{rŽ>[_2դ^$I AzNN7[DjZμ'~춥#p 3hԣ&9 vo6ԢVn6{GFFYѹam5MN3yZ8eg8j;qQ|BHUV8Ŝ=5AMIENDB`