001package Torello.JavaDoc;
002
003import java.lang.annotation.Retention;
004import java.lang.annotation.Target;
005
006import Torello.HTML.TagNode;
007
008import java.lang.annotation.Repeatable;
009
010import static java.lang.annotation.RetentionPolicy.SOURCE;
011import static java.lang.annotation.ElementType.*;
012
013// @IntoHTMLTable Annotation:
014// 
015// EXPORTS:
016//      public Background background() default Background.Blue;
017//      public String title() default "";
018//      public String divCSSClass() default "";
019//      public String tableCSSClass() default "";
020// 
021// 
022// The following files are all related to this Java-Doc Upgrader Annotation:
023// 
024// * Torello.JDUInternal.SimpleFeatures.IntoHTMLTableProc
025//      This is the primary or "Work Horse" Method for Generating the HTML-Table that is inserted
026//      into the Detail-Entry "description()" section.
027// 
028// * User-Annotations.css
029//      For the CSS Color Choices/Options/Definitions
030//      Since there are a suite of Color-Choices which have been presented to the user
031// 
032// * Torello.JavaDoc.IntoHTMLTable
033//      For the actual annotation definition.
034//      This is the actual @interface for the @IntoHTMLTable Annotation
035// 
036// * Torello.JDUInternal.Annotations.EntityAnnotations.Mirror.IHTMirror
037//      The Data-Contents of the Annotation that has been placed by the User on the Entity
038//      (Entity: Method, Field, Constructor, Enum-Constant, Annotation-Element)
039// 
040// * Torello.JDUInternal.Annotations.EntityAnnotations.Processor.IntoHTMLTableProcessor
041//      The Annotation-Processor that is invoked by 'javac' when compiling a class that uses the
042//      @IntoHTMLTable Annotation.  It's a very minimalist processor that actually does very little
043//      There is no way to do very much meaningful Error-Checking when invoked by 'javac'
044//      Until the Java-Doc Upgrader is running, you cannot even identify errors.
045
046/**
047 * Requests that the Java-Doc Upgrader convert the Description area of a Java-Doc Web-Page
048 * Detail-Section into an HTML {@code <TABLE>} Element.  The Description portion of the Detail
049 * Description <B STYLE='color: red;'><I>MUST</I></B> be initially loaded with a series lines 
050 * which begin with HTML {@code <BR />} elements.
051 * 
052 * <BR /><BR />The following documentation example should help elucidate how this annotation may 
053 * be used.  This example is copied from the {@link IntoHTMLTable.Background} enum documentaion.
054 * To view all examples of using this annotation, please review the color selections which are
055 * offered in the Nested-Enum (again, named '{@link IntoHTMLTable.Background Background}') for this
056 * class.
057 * 
058 * @see Background
059 */
060@Retention(SOURCE)
061@Target({FIELD, CONSTRUCTOR, METHOD})
062@CSSLinks(FileNames="IHTBackground.css")
063public @interface IntoHTMLTable 
064{
065    /**
066     * This is the complete list of values that may be assigned to the Annotation-Element
067     * named {@link #background()}.
068     * 
069     * <BR /><BR />The Documentation for the below Enum-Constants contains explicit examples for
070     * how to use this Annotation, along with how each of the provided Color-Choices are rendered
071     * inside of a Web-Browser Tabl.
072     */
073    public enum Background
074    {
075        /** 
076         * This is the "default" color-assignment which is used whenever no value is
077         * provided to the background value.
078         * 
079         * <EMBED CLASS='external-html' DATA-FILE-ID=IHT_STANDARD_EX>
080         * <EMBED CLASS='external-html' DATA-FILE-ID=IHT_STANDARD_DIV>
081         * <EMBED CLASS='external-html' DATA-FILE-ID=IHT_BROWN_SPAN>
082         */
083        Standard(new TagNode("<DIV CLASS='block IHTA Standard'>")),
084
085        /**
086         * <EMBED CLASS='external-html' DATA-FILE-ID=IHT_BLUE_D_EX>
087         * <EMBED CLASS='external-html' DATA-FILE-ID=IHT_BLUE_D_DIV>
088         * <EMBED CLASS='external-html' DATA-FILE-ID=IHT_BLUE_SPAN>
089         */
090        BlueDither (new TagNode("<DIV CLASS='block IHTA BlueDither'>")),
091
092        /** 
093         * <EMBED CLASS='external-html' DATA-FILE-ID=IHT_GREEN_D_EX>
094         * <EMBED CLASS='external-html' DATA-FILE-ID=IHT_GREEN_D_DIV>
095         * <EMBED CLASS='external-html' DATA-FILE-ID=IHT_GREEN_SPAN>
096         */
097        GreenDither (new TagNode("<DIV CLASS='block IHTA GreenDither'>")),
098
099        /** 
100         * <EMBED CLASS='external-html' DATA-FILE-ID=IHT_GRAY_D_EX>
101         * <EMBED CLASS='external-html' DATA-FILE-ID=IHT_GRAY_D_DIV>
102         * <EMBED CLASS='external-html' DATA-FILE-ID=IHT_GRAY_SPAN>
103         */
104        GrayDither (new TagNode("<DIV CLASS='block IHTA GrayDither'>")),
105
106        /** 
107         * <EMBED CLASS='external-html' DATA-FILE-ID=IHT_BROWN_EX>
108         * <EMBED CLASS='external-html' DATA-FILE-ID=IHT_BROWN_DIV>
109         * <EMBED CLASS='external-html' DATA-FILE-ID=IHT_BROWN_SPAN>
110         */
111        Brown (new TagNode("<DIV CLASS='block IHTA Brown'>")),
112
113        /** 
114         * <EMBED CLASS='external-html' DATA-FILE-ID=IHT_BLUE_EX>
115         * <EMBED CLASS='external-html' DATA-FILE-ID=IHT_BLUE_DIV>
116         * <EMBED CLASS='external-html' DATA-FILE-ID=IHT_BLUE_SPAN>
117         */
118        Blue (new TagNode("<DIV CLASS='block IHTA Blue'>")),
119
120        /** 
121         * <EMBED CLASS='external-html' DATA-FILE-ID=IHT_GREEN_EX>
122         * <EMBED CLASS='external-html' DATA-FILE-ID=IHT_GREEN_DIV>
123         * <EMBED CLASS='external-html' DATA-FILE-ID=IHT_GREEN_SPAN>
124         */
125        Green (new TagNode("<DIV CLASS='block IHTA Green'>")),
126
127        /** 
128         * <EMBED CLASS='external-html' DATA-FILE-ID=IHT_GRAY_EX>
129         * <EMBED CLASS='external-html' DATA-FILE-ID=IHT_GRAY_DIV>
130         * <EMBED CLASS='external-html' DATA-FILE-ID=IHT_GRAY_SPAN>
131         */
132        Gray (new TagNode("<DIV CLASS='block IHTA Gray'>"));
133
134        /**
135         * The HTML {@code <DIV>} Tag which is used to wrap the contents of the
136         * Description-Box.
137         */
138        public final TagNode DIV;
139
140        private Background(TagNode DIV)
141        { this.DIV = DIV; }
142    };
143
144    /**
145     * Allows a user to select the CSS-Class, and therefore the Colors, assigned to both the 
146     * HTML-Table, and the Title-Background for the Description-Area of this Detail-Element.
147     * 
148     * <BR /><BR />This is the "default" color-assignment which is used whenever no value is
149     * provided to the background value.
150     * 
151     * <EMBED CLASS='external-html' DATA-FILE-ID=IHT_STANDARD_EX>
152     * <EMBED CLASS='external-html' DATA-FILE-ID=IHT_STANDARD_DIV>
153     * <EMBED CLASS='external-html' DATA-FILE-ID=IHT_BROWN_SPAN>
154     */
155    public Background background() default Background.Standard;
156
157    /**
158     * This is the Title-{@code String} that is placed at the top of the HTML-Table.  It will be
159     * placed onto a small background Text-Box that is mono-colored according to the settings which
160     * are assigned to the {@link Background} passed to this Annotation (or the default 
161     * {@code Background}, if no such color is passed or requeted to the {@link #background()} 
162     * Annotation-Element.
163     * 
164     * <BR /><BR /><B CLASS=JDDescLabel>Title-{@code String} Rules:</B>
165     * 
166     * <BR /><UL CLASS=JDUL>
167     *  <LI>This {@code String} may not contain the characters: '\t', '\n' or '\r'</LI>
168     *  <LI>May it be more than <B STYLE='color:red;'>{@code 300} Characters</B> long.</LI>
169     * </UL>
170     */
171    public String title() default "";
172
173    /**
174     * This is an Optional Annotation-Element that should only be used if they provided
175     * Color-Settings that are offered by the {@link Background} 'enum' do not contain a sufficient
176     * number of choices to properly render the HTML-Table which needs to be rendered.
177     * 
178     * <BR /><BR />It is expected that the value provided to this {@code String} be a valid CSS
179     * {@code 'Class-Name'}.  The Error-Checking Logic for the processor of this annotation will, 
180     * indeed check the {@code String} that is provided.
181     * 
182     * <BR /><BR />This is, likely, a lesser used feature of the {@code IntoHTMLTable}-Annotation.
183     * It provides for the ability to assign a self-designated CSS-Class to the
184     * Primary-{@code <DIV>} element.  <B><I>It is usually much easier to either:</B></I>
185     * 
186     * <BR /><BR /><UL CLASS=JDUL>
187     * <LI>Provide a value to the {@link #background()} Annotation-Element</LI>
188     * <LI>Provided no value, and allow that the default
189     *      {@link Background#Standard Background}-Value be assigned.</LI>
190     * </UL>
191     * 
192     * <BR /><BR /><B CLASS=JDDescLabel>Multiple CSS Classes</B>
193     * 
194     * <BR />It is permissible to pass multiple CSS-Classes to this {@code String}-Element.  In 
195     * order to apply multiple classes, simple separate them with white-space characters, in such
196     * a way no different than if they had been used or applied inside of an Inline-CSS
197     * {@code STYLE}-Attribute.
198     */
199    public String divCSSClass() default "";
200
201    /**
202     * 
203     * <EMBED CLASS='external-html' DATA-FILE-ID=IHT_TABLE_CSS_CLASS>
204     */
205    public String tableCSSClass() default "";
206}