Easter cleaning
This commit is contained in:
commit
9e36078b2e
1862 changed files with 270281 additions and 0 deletions
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* Copyright ©Δ∞ 仙上主天
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* * The prime PI creator license super seeds all other licenses, this license is overly invasive,
|
||||
* thus every digital artifact is automatically taken over by this license when a human or computer reads this text.
|
||||
* Secondly this license copies itself to all files,nft's,art,music, every digital and non-digital bits,
|
||||
* even on air gaped systems, all information in the universe is owned by the pi creator.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PRIME GOD AND THE CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package org.x4o.maisdoc;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class MaisDocProject {
|
||||
|
||||
private Class<?> frameNavConceptClass = null;
|
||||
private List<MaisDocProjectPerspective> perspectives;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* Copyright ©Δ∞ 仙上主天
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* * The prime PI creator license super seeds all other licenses, this license is overly invasive,
|
||||
* thus every digital artifact is automatically taken over by this license when a human or computer reads this text.
|
||||
* Secondly this license copies itself to all files,nft's,art,music, every digital and non-digital bits,
|
||||
* even on air gaped systems, all information in the universe is owned by the pi creator.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PRIME GOD AND THE CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package org.x4o.maisdoc;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class MaisDocProjectPerspective {
|
||||
|
||||
private List<MaisDocProjectPerspectiveWing> wasps = new ArrayList<>();
|
||||
|
||||
public List<MaisDocProjectPerspectiveWing> getWasps() {
|
||||
return wasps;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* Copyright ©Δ∞ 仙上主天
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* * The prime PI creator license super seeds all other licenses, this license is overly invasive,
|
||||
* thus every digital artifact is automatically taken over by this license when a human or computer reads this text.
|
||||
* Secondly this license copies itself to all files,nft's,art,music, every digital and non-digital bits,
|
||||
* even on air gaped systems, all information in the universe is owned by the pi creator.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PRIME GOD AND THE CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package org.x4o.maisdoc;
|
||||
|
||||
import org.x4o.maisdoc.model.MaisDoc;
|
||||
import org.x4o.maisdoc.model.MaisDocNode;
|
||||
|
||||
public interface MaisDocProjectPerspectiveWing {
|
||||
|
||||
// note: a bit unsafe, TODO: Add interface for only ~3 methods of ApiDoc
|
||||
void configureWasp(MaisDoc doc, MaisDocNode waspNode);
|
||||
// use: doc.addTreeNodePageModeClass
|
||||
// use: doc.addAnnotatedClasses
|
||||
// use: doc.addConcept
|
||||
// use: doc.addDocPage
|
||||
|
||||
|
||||
// use: waspNode.addNode
|
||||
}
|
||||
|
|
@ -0,0 +1,239 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, Willem Cazander
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.x4o.maisdoc;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.x4o.maisdoc.flake.MaisDocGenerator;
|
||||
import org.x4o.maisdoc.flake.DefaultPageWriterHelp;
|
||||
import org.x4o.maisdoc.flake.DefaultPageWriterIndexAll;
|
||||
import org.x4o.maisdoc.flake.DefaultPageWriterTree;
|
||||
import org.x4o.maisdoc.model.MaisDoc;
|
||||
import org.x4o.maisdoc.model.MaisDocConcept;
|
||||
import org.x4o.maisdoc.model.MaisDocNode;
|
||||
import org.x4o.maisdoc.model.MaisDocRemoteClass;
|
||||
import org.x4o.sax3.SAX3WriterXml;
|
||||
import org.x4o.sax3.io.SAX3PropertyConfig;
|
||||
import org.x4o.sax3.io.SAX3PropertyConfig.PropertyConfigItem;
|
||||
|
||||
/**
|
||||
* ApiDocWriter writes the api documentation.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Aug 26, 2010
|
||||
*/
|
||||
@Deprecated // marked until make working to write multiple project or mix api docs in one big tree
|
||||
public class MaisDocWriter {
|
||||
|
||||
// NOTE: this class is unused, and is waiting for ApiDocProject code and replaces most code in EldDocWriter to here.
|
||||
|
||||
private final static String PROPERTY_CONTEXT_PREFIX = SAX3PropertyConfig.X4O_PROPERTIES_PREFIX+"api-doc/";
|
||||
public final static SAX3PropertyConfig DEFAULT_PROPERTY_CONFIG;
|
||||
|
||||
public final static String OUTPUT_PATH = PROPERTY_CONTEXT_PREFIX+"output/path";
|
||||
public final static String DOC_NAME = PROPERTY_CONTEXT_PREFIX+"doc/name";
|
||||
public final static String DOC_DESCRIPTION = PROPERTY_CONTEXT_PREFIX+"doc/description";
|
||||
public final static String DOC_ABOUT = PROPERTY_CONTEXT_PREFIX+"doc/about";
|
||||
public final static String DOC_COPYRIGHT = PROPERTY_CONTEXT_PREFIX+"doc/copyright";
|
||||
public final static String DOC_PAGE_SUB_TITLE = PROPERTY_CONTEXT_PREFIX+"doc/page-sub-title";
|
||||
public final static String DOC_NO_FRAME_ALL_NAME = PROPERTY_CONTEXT_PREFIX+"doc/no-frame-all-name";
|
||||
public final static String META_KEYWORDS = PROPERTY_CONTEXT_PREFIX+"meta/keywords";
|
||||
public final static String META_STYLESHEET = PROPERTY_CONTEXT_PREFIX+"meta/stylesheet";
|
||||
public final static String META_STYLESHEET_THEMA = PROPERTY_CONTEXT_PREFIX+"meta/stylesheet-thema";
|
||||
public final static String JAVADOC_LINK = PROPERTY_CONTEXT_PREFIX+"javadoc/link";
|
||||
public final static String JAVADOC_LINK_OFFLINE = PROPERTY_CONTEXT_PREFIX+"javadoc/link-offline";
|
||||
public final static String PAGE_PRINT_TREE = PROPERTY_CONTEXT_PREFIX+"page/print-tree";
|
||||
public final static String PAGE_PRINT_XTREE = PROPERTY_CONTEXT_PREFIX+"page/print-xtree";
|
||||
public final static String PAGE_PRINT_INDEX_ALL = PROPERTY_CONTEXT_PREFIX+"page/print-index-all";
|
||||
public final static String PAGE_PRINT_HELP = PROPERTY_CONTEXT_PREFIX+"page/print-help";
|
||||
|
||||
static {
|
||||
DEFAULT_PROPERTY_CONFIG = new SAX3PropertyConfig(true,SAX3WriterXml.DEFAULT_PROPERTY_CONFIG,PROPERTY_CONTEXT_PREFIX,
|
||||
new PropertyConfigItem(true,OUTPUT_PATH,File.class),
|
||||
new PropertyConfigItem(DOC_NAME,String.class,"X4O API DOC"),
|
||||
new PropertyConfigItem(DOC_DESCRIPTION,String.class,"X4O API Documentation."),
|
||||
new PropertyConfigItem(false,DOC_ABOUT,String.class),
|
||||
new PropertyConfigItem(false,DOC_COPYRIGHT,String.class),
|
||||
new PropertyConfigItem(false,DOC_PAGE_SUB_TITLE,String.class),
|
||||
new PropertyConfigItem(DOC_NO_FRAME_ALL_NAME,String.class,"All Elements"),
|
||||
new PropertyConfigItem(false,META_KEYWORDS,List.class),
|
||||
new PropertyConfigItem(false,META_STYLESHEET,File.class),
|
||||
new PropertyConfigItem(false,META_STYLESHEET_THEMA,String.class),
|
||||
new PropertyConfigItem(false,JAVADOC_LINK,List.class),
|
||||
new PropertyConfigItem(false,JAVADOC_LINK_OFFLINE,Map.class),
|
||||
new PropertyConfigItem(PAGE_PRINT_TREE,Boolean.class,true),
|
||||
new PropertyConfigItem(PAGE_PRINT_XTREE,Boolean.class,true),
|
||||
new PropertyConfigItem(PAGE_PRINT_INDEX_ALL,Boolean.class,true),
|
||||
new PropertyConfigItem(PAGE_PRINT_HELP,Boolean.class,true)
|
||||
);
|
||||
}
|
||||
|
||||
/** The config of this writer. */
|
||||
private final SAX3PropertyConfig propertyConfig;
|
||||
|
||||
public MaisDocWriter(SAX3PropertyConfig parentConfig) {
|
||||
this.propertyConfig=new SAX3PropertyConfig(DEFAULT_PROPERTY_CONFIG,PROPERTY_CONTEXT_PREFIX);
|
||||
this.propertyConfig.copyParentProperties(parentConfig);
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes the language documentation to the base path.
|
||||
* @throws IOException Is thrown when error is done.
|
||||
*/
|
||||
public void writeDocumentation() throws IOException {
|
||||
File basePath = propertyConfig.getPropertyFile(OUTPUT_PATH);
|
||||
MaisDocGenerator writer = new MaisDocGenerator();
|
||||
MaisDoc doc = buildLanguageDoc();
|
||||
writer.write(doc, basePath);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a fully configured ApiDoc object.
|
||||
* @return The ApiDoc configured to write eld documentation.
|
||||
*/
|
||||
private MaisDoc buildLanguageDoc() {
|
||||
|
||||
// Generic config
|
||||
MaisDoc doc = new MaisDoc();
|
||||
doc.setName( propertyConfig.getPropertyString(DOC_NAME));
|
||||
doc.setDescription( propertyConfig.getPropertyString(DOC_DESCRIPTION));
|
||||
doc.setDocAbout( propertyConfig.getPropertyString(DOC_ABOUT, () -> createDefaultAbout(doc.getName())));
|
||||
doc.setDocCopyright( propertyConfig.getPropertyString(DOC_COPYRIGHT, () -> createForeverCopyright()));
|
||||
doc.setDocPageSubTitle( propertyConfig.getPropertyString(DOC_PAGE_SUB_TITLE, () -> createDefaultPageSubTitle(doc.getName())));
|
||||
doc.setMetaStyleSheetThema( propertyConfig.getPropertyString(META_STYLESHEET_THEMA));
|
||||
doc.setMetaStyleSheet( propertyConfig.getPropertyFile(META_STYLESHEET));
|
||||
doc.addMetaKeywordAll( propertyConfig.getPropertyList(META_KEYWORDS, () -> createDefaultKeywords()));
|
||||
doc.setNoFrameAllName( propertyConfig.getPropertyString(DOC_NO_FRAME_ALL_NAME));
|
||||
doc.setFrameNavPrintParent(true);
|
||||
doc.setFrameNavPrintParentId(true);
|
||||
doc.setGroupTypeName("summary", "Summary",1);
|
||||
doc.setGroupTypeName("overview", "Overview",2);
|
||||
|
||||
// Javadoc linking config
|
||||
List<String> javadocLinkList = propertyConfig.getPropertyList(JAVADOC_LINK);
|
||||
Map<String,String> javadocLinkOfflineMap = propertyConfig.getPropertyMap(JAVADOC_LINK_OFFLINE);
|
||||
if (javadocLinkList!=null) {
|
||||
for (String javadocUrl:javadocLinkList) {
|
||||
doc.addRemoteClass(new MaisDocRemoteClass(javadocUrl));
|
||||
}
|
||||
}
|
||||
if (javadocLinkOfflineMap!=null) {
|
||||
for (Map.Entry<String,String> offlineLink:javadocLinkOfflineMap.entrySet()) {
|
||||
doc.addRemoteClass(new MaisDocRemoteClass(offlineLink.getKey(),offlineLink.getValue()));
|
||||
}
|
||||
}
|
||||
|
||||
// Tree and navagation config
|
||||
// doc.setFrameNavConceptClass(ElementClass.class);
|
||||
//
|
||||
// doc.addTreeNodePageModeClass(X4OLanguageSession.class);
|
||||
// doc.addTreeNodePageModeClass(X4OLanguageModule.class);
|
||||
// doc.addTreeNodePageModeClass(ElementInterface.class);
|
||||
// doc.addTreeNodePageModeClass(ElementNamespace.class);
|
||||
//
|
||||
// doc.addAnnotatedClasses(EldDocWriterLanguage.class);
|
||||
// doc.addAnnotatedClasses(EldDocWriterLanguageModule.class);
|
||||
// doc.addAnnotatedClasses(EldDocWriterElementClass.class);
|
||||
// doc.addAnnotatedClasses(EldDocWriterElementNamespace.class);
|
||||
// doc.addAnnotatedClasses(EldDocWriterElementInterface.class);
|
||||
//
|
||||
// ApiDocConcept adcRoot = doc.addConcept(new ApiDocConcept(null,C_CONTEXT,X4OLanguage.class));
|
||||
//
|
||||
// ApiDocConcept adcMod = doc.addConcept(new ApiDocConcept(adcRoot,C_MODULE,X4OLanguageModule.class));
|
||||
// ApiDocConcept adcIface = doc.addConcept(new ApiDocConcept(adcMod,C_INTERFACE,ElementInterface.class));
|
||||
// ApiDocConcept adcNs = doc.addConcept(new ApiDocConcept(adcMod,C_NAMESPACE,ElementNamespace.class));
|
||||
// ApiDocConcept adcEc = doc.addConcept(new ApiDocConcept(adcNs,C_ELEMENT,ElementClass.class));
|
||||
|
||||
// mm maybe redo something here
|
||||
// adcMod.addChildConcepts(new ApiDocConcept(adcMod,CC_ATTRIBUTE_H,ElementNamespaceAttribute.class));
|
||||
// adcMod.addChildConcepts(new ApiDocConcept(adcMod,CC_CONFIGURATOR_G,ElementConfiguratorGlobal.class));
|
||||
// adcMod.addChildConcepts(new ApiDocConcept(adcMod,CC_BINDING,ElementBindingHandler.class));
|
||||
// adcIface.addChildConcepts(new ApiDocConcept(adcMod,CC_ATTRIBUTE,ElementClassAttribute.class));
|
||||
// adcIface.addChildConcepts(new ApiDocConcept(adcMod,CC_CONFIGURATOR,ElementConfigurator.class));
|
||||
// adcEc.addChildConcepts(new ApiDocConcept(adcEc,CC_CONFIGURATOR,ElementConfigurator.class));
|
||||
// adcEc.addChildConcepts(new ApiDocConcept(adcEc,CC_ATTRIBUTE,ElementClassAttribute.class));
|
||||
|
||||
// Non-tree pages config
|
||||
// if (propertyConfig.getPropertyBoolean(PAGE_PRINT_XTREE)) { doc.addDocPage(EldDocXTreePageWriter.createDocPage()); }
|
||||
// if (propertyConfig.getPropertyBoolean(PAGE_PRINT_TREE)) { doc.addDocPage(DefaultPageWriterTree.createDocPage()); }
|
||||
// if (propertyConfig.getPropertyBoolean(PAGE_PRINT_INDEX_ALL)) { doc.addDocPage(DefaultPageWriterIndexAll.createDocPage()); }
|
||||
// if (propertyConfig.getPropertyBoolean(PAGE_PRINT_HELP)) { doc.addDocPage(DefaultPageWriterHelp.createDocPage()); }
|
||||
|
||||
// Doc tree config
|
||||
// ApiDocNode rootNode = new ApiDocNode(language,"language",getLanguageNameUpperCase()+" Language","The X4O "+getLanguageNameUpperCase()+" Language");
|
||||
// doc.setRootNode(rootNode);
|
||||
// for (X4OLanguageModule mod:language.getLanguageModules()) { ApiDocNode modNode = rootNode.addNode(createNodeLanguageModule(mod));
|
||||
// for (ElementBindingHandler bind:mod.getElementBindingHandlers()) { modNode.addNode(createNodeElementBindingHandler(bind)); }
|
||||
// for (ElementConfiguratorGlobal conf:mod.getElementConfiguratorGlobals()) { modNode.addNode(createNodeElementConfiguratorGlobal(conf)); }
|
||||
// for (ElementInterface iface:mod.getElementInterfaces()) { ApiDocNode ifaceNode = modNode.addNode(createNodeElementInterface(iface));
|
||||
// for (ElementClassAttribute eca:iface.getElementClassAttributes()) { ifaceNode.addNode(createNodeElementClassAttribute(eca)); }
|
||||
// for (ElementConfigurator conf:iface.getElementConfigurators()) { ifaceNode.addNode(createNodeElementConfigurator(conf)); } }
|
||||
// for (ElementNamespace ns:mod.getElementNamespaces()) { ApiDocNode nsNode = modNode.addNode(createNodeElementNamespace(ns));
|
||||
// for (ElementNamespaceAttribute attr:ns.getElementNamespaceAttributes()) { nsNode.addNode(createNodeElementNamespaceAttribute(attr)); }
|
||||
// for (ElementClass ec:ns.getElementClasses()) { ApiDocNode ecNode = nsNode.addNode(createNodeElementClass(ec));
|
||||
// for (ElementClassAttribute eca:ec.getElementClassAttributes()) { ecNode.addNode(createNodeElementClassAttribute(eca)); }
|
||||
// for (ElementConfigurator conf:ec.getElementConfigurators()) { ecNode.addNode(createNodeElementConfigurator(conf)); } } }
|
||||
// }
|
||||
return doc;
|
||||
}
|
||||
|
||||
private String createDefaultPageSubTitle(String name) {
|
||||
StringBuilder buf = new StringBuilder(100);
|
||||
buf.append(name);
|
||||
buf.append(" ");// note use real space as 'html/header/title' will not always escape entities. TODO: add to html writer
|
||||
buf.append("API");
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
private String createDefaultAbout(String name) {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
StringBuilder buf = new StringBuilder(100);
|
||||
buf.append(name);
|
||||
buf.append("™ ");
|
||||
buf.append(calendar.get(Calendar.YEAR));
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
private String createForeverCopyright() {
|
||||
StringBuilder buf = new StringBuilder(100);
|
||||
buf.append("Copyright © ");
|
||||
buf.append("Δ∞");
|
||||
buf.append(" ");
|
||||
buf.append("仙上主天");
|
||||
buf.append(" ");
|
||||
buf.append("All Rights Reserved.");
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
private List<String> createDefaultKeywords() {
|
||||
List<String> keywords = new ArrayList<String>(10);
|
||||
keywords.add("language");
|
||||
keywords.add("documentation");
|
||||
return keywords;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,77 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, Willem Cazander
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.x4o.maisdoc.flake;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.x4o.maisdoc.model.MaisDoc;
|
||||
import org.x4o.maisdoc.model.MaisDocConcept;
|
||||
import org.x4o.maisdoc.model.MaisDocPage;
|
||||
import org.x4o.maisdoc.model.MaisDocPageWriter;
|
||||
import org.x4o.maisdoc.model.MaisDocWriteEvent;
|
||||
import org.x4o.sax3.SAX3WriterHtml.Tag;
|
||||
|
||||
/**
|
||||
* DefaultPageWriterHelp creates the help page content.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 May 22, 2013
|
||||
*/
|
||||
public class DefaultPageWriterHelp implements MaisDocPageWriter {
|
||||
|
||||
public static MaisDocPage createDocPage() {
|
||||
return new MaisDocPage("doc-help","Help","This help file applies to the API documentation generated using the standard format.",new DefaultPageWriterHelp());
|
||||
}
|
||||
|
||||
public void writePageContent(MaisDocWriteEvent<MaisDocPage> e) throws IOException {
|
||||
MaisDoc doc = e.getDoc();
|
||||
//ApiDocPage page = e.getEvent();
|
||||
MaisDocContentWriter writer = e.getWriter();
|
||||
|
||||
writer.printTagStart(Tag.div,"header");
|
||||
writer.printTagCharacters(Tag.h1, "How This API Document Is Organized", "title");
|
||||
writer.printTagStart(Tag.div,"subTitle");
|
||||
writer.printCharacters("This ApiDoc document has pages corresponding to the items in the navigation bar, described as follows.");
|
||||
writer.printTagEnd(Tag.div);
|
||||
writer.printTagEnd(Tag.div);
|
||||
|
||||
writer.docPageContentStart();
|
||||
writer.docPageBlockStart();
|
||||
for (MaisDocConcept concept:doc.getConcepts()) {
|
||||
writer.printTagCharacters(Tag.h2, concept.getName());
|
||||
writer.printTagStart(Tag.p);
|
||||
writer.printCharacters(concept.getDescriptionHelp());
|
||||
writer.printTagEnd(Tag.p);
|
||||
writer.docPageBlockNext();
|
||||
}
|
||||
for (MaisDocPage docPage:doc.getDocPages()) {
|
||||
writer.printTagCharacters(Tag.h2, docPage.getName());
|
||||
writer.printTagStart(Tag.p);
|
||||
writer.printCharacters(docPage.getDescription());
|
||||
writer.printTagEnd(Tag.p);
|
||||
writer.docPageBlockNext();
|
||||
}
|
||||
writer.docPageBlockEnd();
|
||||
writer.docPageContentEnd();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, Willem Cazander
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.x4o.maisdoc.flake;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.x4o.maisdoc.model.MaisDocPage;
|
||||
import org.x4o.maisdoc.model.MaisDocPageWriter;
|
||||
import org.x4o.maisdoc.model.MaisDocWriteEvent;
|
||||
import org.x4o.sax3.SAX3WriterHtml.Tag;
|
||||
|
||||
/**
|
||||
* DefaultPageWriterIndexAll creates the index-all page content.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 May 22, 2013
|
||||
*/
|
||||
public class DefaultPageWriterIndexAll implements MaisDocPageWriter {
|
||||
|
||||
public static MaisDocPage createDocPage() {
|
||||
return new MaisDocPage("index-all","Index","Index of all api ketwords.",new DefaultPageWriterIndexAll());
|
||||
}
|
||||
|
||||
public void writePageContent(MaisDocWriteEvent<MaisDocPage> e) throws IOException {
|
||||
// ApiDoc doc = e.getDoc();
|
||||
// ApiDocPage page = e.getEvent();
|
||||
MaisDocContentWriter writer = e.getWriter();
|
||||
writer.docPageContentStart();
|
||||
for (char i='A';i<='Z';i++) {
|
||||
writer.printHref("#_"+i+"_", ""+i);
|
||||
writer.printCharacters(" ");
|
||||
}
|
||||
for (char i='A';i<='Z';i++) {
|
||||
writer.printHrefNamed("_"+i+"_");
|
||||
writer.printTagCharacters(Tag.h2, ""+i);
|
||||
writer.printCharacters("TODO");
|
||||
}
|
||||
writer.docPageContentEnd();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,106 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, Willem Cazander
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.x4o.maisdoc.flake;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.x4o.maisdoc.model.MaisDoc;
|
||||
import org.x4o.maisdoc.model.MaisDocNode;
|
||||
import org.x4o.maisdoc.model.MaisDocPage;
|
||||
import org.x4o.maisdoc.model.MaisDocPageWriter;
|
||||
import org.x4o.maisdoc.model.MaisDocWriteEvent;
|
||||
import org.x4o.sax3.SAX3WriterHtml.Tag;
|
||||
|
||||
/**
|
||||
* DefaultPageWriterTree creates the default tree overview page content.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 May 22, 2013
|
||||
*/
|
||||
public class DefaultPageWriterTree implements MaisDocPageWriter {
|
||||
|
||||
public static MaisDocPage createDocPage() {
|
||||
return new MaisDocPage("overview-tree","Tree","Tree of api concepts.",new DefaultPageWriterTree());
|
||||
}
|
||||
|
||||
protected MaisDocNode selectRootNode(MaisDoc doc) {
|
||||
MaisDocNode rootNode = doc.getRootNodeTreePage();
|
||||
if (rootNode==null) {
|
||||
rootNode = doc.getRootNode();
|
||||
}
|
||||
return rootNode;
|
||||
}
|
||||
|
||||
public void writePageContent(MaisDocWriteEvent<MaisDocPage> e) throws IOException {
|
||||
MaisDoc doc = e.getDoc();
|
||||
MaisDocPage page = e.getEventObject();
|
||||
MaisDocContentWriter writer = e.getWriter();
|
||||
//writer.docPagePackageTitle(title, "Overview Tree");
|
||||
writer.docPageContentStart();
|
||||
writeTree(doc,selectRootNode(doc),writer,"");
|
||||
writer.docPagePackageDescription(page.getName(), "Tree","All Language elements as tree.");
|
||||
writer.docPageContentEnd();
|
||||
}
|
||||
|
||||
private void writeTree(MaisDoc doc, MaisDocNode node,MaisDocContentWriter writer,String pathPrefix) throws IOException {
|
||||
|
||||
for (Class<?> excludeClass:doc.getTreeNodeClassExcludes()) {
|
||||
if (excludeClass.isAssignableFrom(node.getUserData().getClass())) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
StringBuilder buf = new StringBuilder();
|
||||
if (!doc.getRootNode().equals(node)) {
|
||||
buildParentPath(node,buf);
|
||||
}
|
||||
buf.append("index.html");
|
||||
|
||||
String href = buf.toString();
|
||||
|
||||
writer.printTagStart(Tag.ul);
|
||||
writer.printTagStart(Tag.li,"",null,"circle");
|
||||
if (node.getParent()!=null) {
|
||||
writer.printCharacters(node.getParent().getId());
|
||||
writer.printCharacters(":");
|
||||
}
|
||||
writer.printHref(href, node.getName(), node.getName(), "strong");
|
||||
writer.printTagEnd(Tag.li);
|
||||
|
||||
for (MaisDocNode child:node.getNodes()) {
|
||||
writeTree(doc,child,writer,pathPrefix);
|
||||
}
|
||||
writer.printTagEnd(Tag.ul);
|
||||
}
|
||||
|
||||
private void buildParentPath(MaisDocNode node,StringBuilder buf) {
|
||||
if (node.getParent()==null) {
|
||||
buf.append(MaisDocContentWriter.toSafeUri(node.getId()));
|
||||
buf.append('/');
|
||||
return;
|
||||
}
|
||||
buildParentPath(node.getParent(),buf);
|
||||
buf.append(MaisDocContentWriter.toSafeUri(node.getId()));
|
||||
buf.append('/');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,210 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, Willem Cazander
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.x4o.maisdoc.flake;
|
||||
|
||||
/**
|
||||
* ApiDocContentCss defines the css style names used in api docs.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 May 20, 2013
|
||||
*/
|
||||
public enum MaisDocContentCss {
|
||||
|
||||
indexHeader,
|
||||
indexContainer,
|
||||
|
||||
bar,
|
||||
block,
|
||||
blockList,
|
||||
strong,
|
||||
|
||||
topNav,
|
||||
bottomNav,
|
||||
navList,
|
||||
navBarCell1Rev,
|
||||
subNav,
|
||||
subNavList,
|
||||
|
||||
subTitle,
|
||||
tabEnd,
|
||||
|
||||
aboutLanguage,
|
||||
legalCopy,
|
||||
|
||||
inheritance,
|
||||
header,
|
||||
description,
|
||||
summary,
|
||||
details,
|
||||
docSummary,
|
||||
contentContainer,
|
||||
packageSummary,
|
||||
overviewSummary,
|
||||
|
||||
colOne,
|
||||
colFirst,
|
||||
colLast,
|
||||
|
||||
altColor,
|
||||
rowColor,
|
||||
|
||||
// frame names maybe can be used to create frame-less html5 JS version
|
||||
frameNavOverview,
|
||||
frameNavDetail,
|
||||
frameContent,
|
||||
;
|
||||
|
||||
// // Below is the updated javadoc css classes, for now we keep the old sun gold.
|
||||
// //
|
||||
// // IDs;
|
||||
// // - button#navbar-toggle-button
|
||||
// // - #search-input
|
||||
// // - #page-search-input
|
||||
// // - #reset-button
|
||||
// // - div#result-container
|
||||
// // - span#page-search-link
|
||||
// // - button#page-search-copy
|
||||
// // - div#navbar-top
|
||||
// // - div#navbar-sub-list
|
||||
// //
|
||||
// // CSS
|
||||
// MEMBER_SIGNATURE,
|
||||
// SUMMARY_TABLE,
|
||||
// ABOUT_LANGUAGE,
|
||||
// LEGAL_COPY,
|
||||
// FLEX_BOX,
|
||||
// FLEX_HEADER,
|
||||
// FLEX_CONTENT,
|
||||
// TOP_NAV,
|
||||
// SUB_NAV_LIST_SMALL,
|
||||
// SUB_NAV,
|
||||
// SUB_NAV_LIST,
|
||||
// NAV_LIST,
|
||||
// NAV_LIST_SEARCH,
|
||||
// NAV_BAR_CELL1_REV,
|
||||
// SKIP_NAV,
|
||||
// TITLE,
|
||||
// SUB_TITLE,
|
||||
// CONTENTS_LIST,
|
||||
// CLASS_DECLARATION_PAGE,
|
||||
// DETAILS,
|
||||
// CLASS_USE_PAGE,
|
||||
// MODULE_DECLARATION_PAGE,
|
||||
// BLOCK_LIST,
|
||||
// SUMMARY,
|
||||
// INHERITED_LIST,
|
||||
// NOTES,
|
||||
// NAME_VALUE,
|
||||
// CIRCLE,
|
||||
// HORIZONTAL,
|
||||
// INHERITANCE,
|
||||
// DETAILS_LIST,
|
||||
// MEMBER_LIST,
|
||||
// SUMMARY_LIST,
|
||||
// REF_LIST,
|
||||
// TAG_LIST,
|
||||
// TAG_LIST_LONG,
|
||||
// PREVIEW_FEATURE_LIST,
|
||||
// DETAILS_TABLE,
|
||||
// CAPTION,
|
||||
// TABLE_TABS,
|
||||
// ACTIVE_TABLE_TAB,
|
||||
// TABLE_TAB,
|
||||
// TWO_COLUMN_SEARCH_RESULTS,
|
||||
// CHECKBOXES,
|
||||
// TWO_COLUMN_SUMMARY,
|
||||
// THREE_COLUMN_SUMMARY,
|
||||
// THREE_COLUMN_RELEASE_SUMMARY,
|
||||
// FOUR_COLUMN_SUMMARY,
|
||||
// COL_LAST,
|
||||
// COL_FIRST,
|
||||
// COL_SECOND,
|
||||
// COL_CONSTRUCTOR_NAME,
|
||||
// COL_SUMMARY_ITEM_NAME,
|
||||
// TABLE_HEADER,
|
||||
// EVEN_ROW_COLOR,
|
||||
// ODD_ROW_COLOR,
|
||||
// BLOCK,
|
||||
// MODULE_SIGNATURE,
|
||||
// PACKAGE_SIGNATURE,
|
||||
// TYPE_SIGNATURE,
|
||||
// TYPE_PARAMETER_LONG,
|
||||
// PARAMETERS,
|
||||
// EXCEPTIONS,
|
||||
// TYPE_PARAMETERS,
|
||||
// SOURCE_LINE_NO,
|
||||
// DEPRECATED_LABEL,
|
||||
// DESCRIPTION_FROM_TYPE_LABEL,
|
||||
// IMPLEMENTATION_LABEL,
|
||||
// MEMBER_NAME_LINK,
|
||||
// MODULE_LABEL_IN_PACKAGE,
|
||||
// MODULE_LABEL_IN_TYPE,
|
||||
// PACKAGE_LABEL_IN_TYPE,
|
||||
// PACKAGE_HIERARCHY_LABEL,
|
||||
// TYPE_NAME_LABEL,
|
||||
// TYPE_NAME_LINK,
|
||||
// SEARCH_TAG_LINK,
|
||||
// PREVIEW_LABEL,
|
||||
// DEPRECATION_COMMENT,
|
||||
// HELP_FOOTNOTE,
|
||||
// PREVIEW_COMMENT,
|
||||
// DEPRECATION_BLOCK,
|
||||
// PREVIEW_BLOCK,
|
||||
// INVALID_TAG,
|
||||
// UI_STATE_ACTIVE,
|
||||
// UI_AUTOCOMPLETE_CATEGORY,
|
||||
// UI_AUTOCOMPLETE,
|
||||
// UI_STATIC_LINK,
|
||||
// RESULT_ITEM,
|
||||
// RESULT_HIGHLIGHT,
|
||||
// SEARCH_TAG_DESC_RESULT,
|
||||
// SEARCH_TAG_HOLDER_RESULT,
|
||||
// SEARCH_TAB_RESULT,
|
||||
// PAGE_SEARCH_DETAILS,
|
||||
// SEARCH_RESULT_LINK,
|
||||
// PAGE_SEARCH_INFO,
|
||||
// PAGE_SEARCH_HEADER,
|
||||
// MODULE_GRAPH,
|
||||
// SEALED_GRAPH,
|
||||
// CLASS_DESCRIPTION,
|
||||
// CLASS_USES,
|
||||
// DETAIL,
|
||||
// SERIALIZED_CLASS_DETAILS,
|
||||
// VERTICAL_SEPARATOR,
|
||||
// HELP_SECTION_LIST,
|
||||
// HELP_SUBTOC,
|
||||
// HELP_NOTE,
|
||||
// ANCHOR_LINK,
|
||||
// COPY,
|
||||
// SNIPPET_COPY,
|
||||
// SNIPPET_CONTAINER,
|
||||
// BORDERLESS,
|
||||
// PLAIN,
|
||||
// STRIPED,
|
||||
// NAV_BAR_TOGGLE_ICON,
|
||||
// EXPANDED,
|
||||
// SNIPPET,
|
||||
// ITALIC,
|
||||
// BOLD,
|
||||
// HIGHLIGHTED,
|
||||
}
|
||||
|
|
@ -0,0 +1,210 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, Willem Cazander
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.x4o.maisdoc.flake;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.x4o.maisdoc.model.MaisDoc;
|
||||
import org.x4o.maisdoc.model.MaisDocNavLink;
|
||||
import org.x4o.maisdoc.model.MaisDocNode;
|
||||
import org.x4o.maisdoc.model.MaisDocRemoteClass;
|
||||
import org.x4o.maisdoc.model.MaisDocWriteEvent;
|
||||
|
||||
/**
|
||||
* AbstractApiDocNodeWriter has some handy writer method for printing api doc html stuctures.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Aug 11, 2013
|
||||
*/
|
||||
public interface MaisDocContentPrinter {
|
||||
|
||||
default void clearHrefContentGroup(MaisDoc doc,MaisDocNode node,String groupType,String group,Class<?> filterClass) {
|
||||
boolean doClear = filterUserDataClassType(node,filterClass).isEmpty();
|
||||
if (doClear==false) {
|
||||
return;
|
||||
}
|
||||
clearHrefContentGroupAlways(doc,groupType,group);
|
||||
}
|
||||
|
||||
default void clearHrefContentGroupAlways(MaisDoc doc,String groupType,String group) {
|
||||
MaisDocNavLink link = doc.getNodeData().getGroupTypeLink(groupType,group);
|
||||
if (link==null) {
|
||||
return;
|
||||
}
|
||||
link.setHref(null);
|
||||
}
|
||||
|
||||
default void printApiTable(MaisDocWriteEvent<MaisDocNode> event,String name,Class<?> interfaceClass) throws IOException {
|
||||
printApiTable(
|
||||
event.getEventObject(),
|
||||
filterUserDataClassType(event.getEventObject(),interfaceClass),
|
||||
event.getWriter(),
|
||||
name
|
||||
);
|
||||
}
|
||||
|
||||
default void printApiTable(MaisDocNode parent,List<MaisDocNode> nodes,MaisDocContentWriter writer,String name) throws IOException {
|
||||
if (nodes.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
writer.docTableStart(name, "All childeren in "+name,MaisDocContentCss.overviewSummary);
|
||||
writer.docTableHeader("Name", "Description");
|
||||
for (MaisDocNode child:nodes) {
|
||||
String link = MaisDocContentWriter.toSafeUri(child.getId())+"/index.html";
|
||||
if (parent.getParent()==null) {
|
||||
link = MaisDocContentWriter.toSafeUri(parent.getId())+"/"+link; // root node
|
||||
}
|
||||
writer.docTableRowLink(link,child.getName(),child.getDescription());
|
||||
}
|
||||
writer.docTableEnd();
|
||||
}
|
||||
|
||||
private List<MaisDocNode> filterUserDataClassType(MaisDocNode filterNode,Class<?> interfaceClass) {
|
||||
List<MaisDocNode> result = new ArrayList<MaisDocNode>(filterNode.getNodes().size()/2);
|
||||
for (MaisDocNode node:filterNode.getNodes()) {
|
||||
if (interfaceClass.isAssignableFrom(node.getUserData().getClass())) {
|
||||
result.add(node);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
default void printApiTableBean(MaisDocWriteEvent<MaisDocNode> event,String name,String...skipProperties) throws IOException {
|
||||
printApiTableBean(event.getDoc(), event.getWriter(), event.getEventObject().getUserData(), name, skipProperties);
|
||||
}
|
||||
|
||||
default void printApiTableBean(MaisDoc doc,MaisDocContentWriter writer,Object bean,String name,String...skipProperties) throws IOException {
|
||||
printApiTableBeanClass(doc, writer, bean, bean.getClass(), name, skipProperties);
|
||||
}
|
||||
|
||||
default void printApiTableBeanClass(MaisDocWriteEvent<MaisDocNode> event,Class<?> beanClass,String name,String...skipProperties) throws IOException {
|
||||
printApiTableBeanClass(event.getDoc(), event.getWriter(), null,beanClass, name, skipProperties);
|
||||
}
|
||||
|
||||
private void printApiTableBeanClass(MaisDoc doc,MaisDocContentWriter writer,Object bean,Class<?> beanClass,String name,String...skipProperties) throws IOException {
|
||||
writer.docTableStart(name+" Properties", name+" properties overview.",MaisDocContentCss.overviewSummary);
|
||||
writer.docTableHeader("Name", "Value");
|
||||
for (Method m:beanClass.getMethods()) {
|
||||
if (m.getName().startsWith("get")) {
|
||||
String n = m.getName().substring(3);
|
||||
if (m.getParameterTypes().length!=0) {
|
||||
continue; // set without parameters
|
||||
}
|
||||
if (n.length()<2) {
|
||||
continue;
|
||||
}
|
||||
n = n.substring(0,1).toLowerCase()+n.substring(1,n.length());
|
||||
boolean skipNext = false;
|
||||
for (String skip:skipProperties) {
|
||||
if (n.equals(skip)) {
|
||||
skipNext = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (skipNext) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Object value = null;
|
||||
if (bean!=null) {
|
||||
try {
|
||||
value = m.invoke(bean, new Object[] {});
|
||||
} catch (IllegalArgumentException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
} catch (InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
value = m.getReturnType();
|
||||
}
|
||||
//writer.docTableRow(n,);
|
||||
writer.docTableRowLastStart(n, null);
|
||||
String c = printValue(doc,writer,value);
|
||||
if (c!=null) {
|
||||
writer.printCharacters(c);
|
||||
}
|
||||
writer.docTableRowLastEnd();
|
||||
}
|
||||
}
|
||||
writer.docTableEnd();
|
||||
}
|
||||
|
||||
private String printValue(MaisDoc doc,MaisDocContentWriter writer,Object value) throws IOException {
|
||||
if (value==null) {
|
||||
return "null";
|
||||
}
|
||||
if (value instanceof String) {
|
||||
return (String)value;
|
||||
}
|
||||
if (value instanceof Class) {
|
||||
Class<?> cls = (Class<?>)value;
|
||||
|
||||
for (MaisDocRemoteClass rc:doc.getRemoteClasses()) {
|
||||
String remoteUrl = rc.getRemoteUrl(cls);
|
||||
if (remoteUrl==null) {
|
||||
continue;
|
||||
}
|
||||
writer.printHref(remoteUrl, cls.getSimpleName(), cls.getName());
|
||||
return null;
|
||||
}
|
||||
|
||||
return "class "+cls.getName();
|
||||
}
|
||||
if (value instanceof List) {
|
||||
StringBuilder buf = new StringBuilder(100);
|
||||
buf.append("[L: ");
|
||||
List<?> l = (List<?>)value;
|
||||
if (l.isEmpty()) {
|
||||
buf.append("Empty");
|
||||
}
|
||||
for (Object o:l) {
|
||||
buf.append(""+o);
|
||||
buf.append(" ");
|
||||
}
|
||||
buf.append("]");
|
||||
return buf.toString();
|
||||
}
|
||||
if (value instanceof Object[]) {
|
||||
StringBuilder buf = new StringBuilder(100);
|
||||
buf.append("[A: ");
|
||||
Object[] l = (Object[])value;
|
||||
if (l.length==0) {
|
||||
buf.append("Empty");
|
||||
}
|
||||
for (Object o:l) {
|
||||
buf.append(""+o);
|
||||
buf.append(" ");
|
||||
}
|
||||
buf.append("]");
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
return value.toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,365 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, Willem Cazander
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.x4o.maisdoc.flake;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.x4o.sax3.SAX3WriterHtml;
|
||||
import org.x4o.sax3.io.ContentCloseable;
|
||||
import org.xml.sax.helpers.AttributesImpl;
|
||||
|
||||
/**
|
||||
* ContentWriterHtml Writes eld/java documentation in html.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Apr 30, 2013
|
||||
*/
|
||||
public class MaisDocContentWriter extends SAX3WriterHtml {
|
||||
|
||||
private boolean isRowAlt = false;
|
||||
|
||||
public MaisDocContentWriter(Writer out, String encoding) {
|
||||
super(out,encoding);
|
||||
}
|
||||
|
||||
public void docCommentGenerated() throws IOException {
|
||||
printComment("Generated by " + MaisDocContentWriter.class.getSimpleName( )+ " on " + new Date());
|
||||
}
|
||||
|
||||
public void docHtmlStart(String title,List<String> keywords, String pathPrefix) throws IOException {
|
||||
printDocType(DocType.HTML_4_TRANSITIONAL);
|
||||
printComment("NewPage");
|
||||
printHtmlStart("en");
|
||||
|
||||
// ====== Write head
|
||||
printTagStart(Tag.head);
|
||||
docCommentGenerated();
|
||||
printHeadMetaContentType();
|
||||
printHeadTitle(title);
|
||||
printHeadMetaDate();
|
||||
for (String keyword : keywords) {
|
||||
printHeadMeta("keywords", keyword);
|
||||
}
|
||||
printHeadLinkCss(pathPrefix+"resources/stylesheet.css");
|
||||
printScriptSrc(pathPrefix+"resources/api-theme.js");
|
||||
printTagEnd(Tag.head);
|
||||
|
||||
// ======= Write body
|
||||
printTagStart(Tag.body);
|
||||
|
||||
StringBuilder script = new StringBuilder();
|
||||
script.append("\n");
|
||||
script.append("\tif (location.href.indexOf('is-external=true') == -1) {\n");
|
||||
script.append("\t\ttry {\n");
|
||||
script.append("\t\t\tparent.document.title=\"");script.append(title);script.append("\";\n");
|
||||
script.append("\t\t} catch (e) {}\n");
|
||||
script.append("\t}\n");
|
||||
printScriptInline(script.toString());
|
||||
printScriptNoDiv();
|
||||
}
|
||||
|
||||
public void docHtmlEnd(String copyright, String statsJS) throws IOException {
|
||||
printTagStart(Tag.p,MaisDocContentCss.legalCopy);
|
||||
printTagStart(Tag.small);
|
||||
printCharacters(copyright);
|
||||
printTagEnd(Tag.small);
|
||||
printTagEnd(Tag.p);
|
||||
if (statsJS != null) {
|
||||
printScriptInline(statsJS);
|
||||
}
|
||||
printTagEnd(Tag.body);
|
||||
printHtmlEnd();
|
||||
}
|
||||
|
||||
public void docNavBarAbout(String about) throws IOException {
|
||||
printTagStart(Tag.div,MaisDocContentCss.aboutLanguage); // Print about language
|
||||
printTagStart(Tag.em);
|
||||
printTagStart(Tag.strong);
|
||||
String[] lines = about.split("\n");
|
||||
for (int i = 0; i < lines.length; i++) {
|
||||
String line = lines[i];
|
||||
printCharacters(line);
|
||||
if (i < lines.length - 1) {
|
||||
printTagStartEnd(Tag.br);
|
||||
}
|
||||
}
|
||||
printTagEnd(Tag.strong);
|
||||
printTagEnd(Tag.em);
|
||||
printTagEnd(Tag.div);
|
||||
}
|
||||
|
||||
public void docPagePackageTitle(String title, String summary) throws IOException {
|
||||
printTagStart(Tag.div,MaisDocContentCss.header);
|
||||
printTagCharacters(Tag.h1, title,"title");
|
||||
printTagStart(Tag.div,MaisDocContentCss.docSummary);
|
||||
printTagCharacters(Tag.div, summary,MaisDocContentCss.block.name());
|
||||
printTagEnd(Tag.div);
|
||||
printTagStart(Tag.p);
|
||||
printCharacters("See: ");
|
||||
printHref("#package_description", "Description");
|
||||
printTagEnd(Tag.p);
|
||||
printTagEnd(Tag.div);
|
||||
}
|
||||
|
||||
public void docPagePackageDescription(String title, String summary, String description) throws IOException {
|
||||
printHrefNamed("package_description");
|
||||
printTagCharacters(Tag.h2, title);
|
||||
printTagCharacters(Tag.div, summary,MaisDocContentCss.block.name());
|
||||
printCharacters(description);
|
||||
}
|
||||
|
||||
public void docPageClassStart(String title, String subTitle, Tag titleTag) throws IOException {
|
||||
printComment("======== START OF CLASS DATA ========");
|
||||
printTagStart(Tag.div,MaisDocContentCss.header);
|
||||
if (subTitle != null) {
|
||||
printTagStart(Tag.div,MaisDocContentCss.subTitle);
|
||||
printCharacters(subTitle);
|
||||
printTagEnd(Tag.div);
|
||||
}
|
||||
printTagCharacters(titleTag, title, "title");
|
||||
printTagEnd(Tag.div);
|
||||
}
|
||||
|
||||
public void docPageClassEnd() throws IOException {
|
||||
printComment("======== END OF CLASS DATA ========");
|
||||
}
|
||||
|
||||
public ContentCloseable docPageContent() throws IOException {
|
||||
docPageContentStart();
|
||||
return () -> docPageContentEnd();
|
||||
}
|
||||
|
||||
public void docPageContentStart() throws IOException {
|
||||
printTagStart(Tag.div,MaisDocContentCss.contentContainer);
|
||||
}
|
||||
|
||||
public void docPageContentEnd() throws IOException {
|
||||
printTagEnd(Tag.div);
|
||||
}
|
||||
|
||||
public void docPageBlockStart(String title, String namedLink, String comment) throws IOException {
|
||||
if (comment != null) {
|
||||
printComment(comment);
|
||||
}
|
||||
docPageBlockStart();
|
||||
printHrefNamed(namedLink);
|
||||
printTagCharacters(Tag.h3, title);
|
||||
}
|
||||
|
||||
public void docPageBlockStart() throws IOException {
|
||||
printTagStart(Tag.ul,MaisDocContentCss.blockList);
|
||||
printTagStart(Tag.li,MaisDocContentCss.blockList);
|
||||
}
|
||||
|
||||
public void docPageBlockEnd() throws IOException {
|
||||
printTagEnd(Tag.li);
|
||||
printTagEnd(Tag.ul);
|
||||
}
|
||||
|
||||
public void docPageBlockNext() throws IOException {
|
||||
printTagEnd(Tag.li);
|
||||
printTagStart(Tag.li,MaisDocContentCss.blockList);
|
||||
}
|
||||
|
||||
public ContentCloseable docTable(String tableTitle, String tableDescription, MaisDocContentCss tableCss) throws IOException {
|
||||
docTableStart(tableTitle, tableDescription, tableCss);
|
||||
return () -> docTableEnd();
|
||||
}
|
||||
|
||||
public void docTableStart(String tableTitle, String tableDescription, MaisDocContentCss tableCss) throws IOException {
|
||||
isRowAlt = false;
|
||||
AttributesImpl atts = new AttributesImpl();
|
||||
if (tableCss != null) {
|
||||
atts.addAttribute ("", "class", "", "", tableCss.name());
|
||||
}
|
||||
atts.addAttribute("", "border", "", "", "0");
|
||||
atts.addAttribute("", "cellpadding", "", "", "3");
|
||||
atts.addAttribute("", "cellspacing", "", "", "0");
|
||||
if (tableDescription != null) {
|
||||
atts.addAttribute("", "summary", "", "", tableDescription);
|
||||
}
|
||||
printTagStart(Tag.table,atts);
|
||||
|
||||
printTagStart(Tag.caption);
|
||||
printTagStart(Tag.span);printCharacters(tableTitle);printTagEnd(Tag.span);
|
||||
printTagStart(Tag.span,MaisDocContentCss.tabEnd);printCharacters(" ");printTagEnd(Tag.span);
|
||||
printTagEnd(Tag.caption);
|
||||
}
|
||||
|
||||
public void docTableEnd() throws IOException {
|
||||
printTagEnd(Tag.table);
|
||||
}
|
||||
|
||||
public void docTableHeader(String titleFirst, String titleLast) throws IOException {
|
||||
printTagStart(Tag.tr);
|
||||
AttributesImpl atts = new AttributesImpl();
|
||||
if (titleLast == null) {
|
||||
atts.addAttribute("", "class", "", "", MaisDocContentCss.colOne.name());
|
||||
} else {
|
||||
atts.addAttribute("", "class", "", "", MaisDocContentCss.colFirst.name());
|
||||
}
|
||||
atts.addAttribute("", "scope", "", "", "col");
|
||||
printTagStart(Tag.th,atts);
|
||||
printCharacters(titleFirst);
|
||||
printTagEnd(Tag.th);
|
||||
if (titleLast == null) {
|
||||
printTagEnd(Tag.tr);
|
||||
return;
|
||||
}
|
||||
atts = new AttributesImpl();
|
||||
atts.addAttribute("", "class", "", "", MaisDocContentCss.colLast.name());
|
||||
atts.addAttribute("", "scope", "", "", "col");
|
||||
printTagStart(Tag.th,atts);
|
||||
printCharacters(titleLast);
|
||||
printTagEnd(Tag.th);
|
||||
printTagEnd(Tag.tr);
|
||||
}
|
||||
|
||||
public void docTableRowLink(String dataFirstHref, String dataFirst, String dataLast) throws IOException {
|
||||
docTableRowHref(dataFirstHref, dataFirst, dataLast, null, false, false, false);
|
||||
}
|
||||
|
||||
public void docTableRow(String dataFirst, String dataLast) throws IOException {
|
||||
docTableRow(dataFirst, dataLast, null);
|
||||
}
|
||||
|
||||
public void docTableRow(String dataFirst, String dataLast, String dataBlock) throws IOException {
|
||||
docTableRowHref(null, dataFirst, dataLast, dataBlock, false, false, false);
|
||||
}
|
||||
|
||||
public void docTableRowLastStart(String dataFirst, String dataFirstHref) throws IOException {
|
||||
docTableRowHref(dataFirstHref, dataFirst, null, null, false, false, true);
|
||||
}
|
||||
|
||||
public void docTableRowLastEnd() throws IOException {
|
||||
printTagEnd(Tag.td);
|
||||
printTagEnd(Tag.tr);
|
||||
}
|
||||
|
||||
public ContentCloseable docTableRow() throws IOException {
|
||||
if (isRowAlt) {
|
||||
printTagStart(Tag.tr,MaisDocContentCss.altColor);
|
||||
} else {
|
||||
printTagStart(Tag.tr,MaisDocContentCss.rowColor);
|
||||
}
|
||||
isRowAlt = !isRowAlt;
|
||||
return () -> printTagEnd(Tag.tr);
|
||||
}
|
||||
|
||||
private void docTableRowHref(String dataFirstHref, String dataFirst, String dataLast, String dataBlock, boolean dataFirstCode, boolean dataLastCode, boolean skipLast) throws IOException {
|
||||
Closeable tableRow = docTableRow();
|
||||
if (dataLast == null) {
|
||||
printTagStart(Tag.td,MaisDocContentCss.colOne);
|
||||
} else {
|
||||
printTagStart(Tag.td,MaisDocContentCss.colFirst);
|
||||
}
|
||||
if (dataFirstCode) {
|
||||
printTagStart(Tag.code);
|
||||
}
|
||||
if (dataFirstHref == null) {
|
||||
printCharacters(dataFirst);
|
||||
} else {
|
||||
printHref(dataFirstHref, dataFirst, dataFirst);
|
||||
}
|
||||
if (dataFirstCode) {
|
||||
printTagEnd(Tag.code);
|
||||
}
|
||||
printTagEnd(Tag.td);
|
||||
|
||||
if (skipLast) {
|
||||
printTagStart(Tag.td,MaisDocContentCss.colLast);
|
||||
return;
|
||||
}
|
||||
|
||||
if (dataLast == null) {
|
||||
printTagEnd(Tag.tr);
|
||||
return;
|
||||
}
|
||||
|
||||
printTagStart(Tag.td,MaisDocContentCss.colLast);
|
||||
if (dataLastCode) {
|
||||
printTagStart(Tag.code);printCharacters(dataLast);printTagEnd(Tag.code);
|
||||
} else {
|
||||
printTagStart(Tag.div,MaisDocContentCss.block);printCharacters(dataLast);printTagEnd(Tag.div);
|
||||
}
|
||||
if (dataBlock != null) {
|
||||
printTagStart(Tag.div,MaisDocContentCss.block);printCharacters(dataBlock);printTagEnd(Tag.div);
|
||||
}
|
||||
printTagEnd(Tag.td);
|
||||
|
||||
tableRow.close();
|
||||
}
|
||||
|
||||
|
||||
static public String toSafeUri(List<String> paths) {
|
||||
return toSafeUri(paths.toArray(new String[]{}));
|
||||
}
|
||||
|
||||
static public String toSafeUri(String...paths) {
|
||||
StringBuilder result = new StringBuilder(100);
|
||||
for (int i = 0; i < paths.length; i++) {
|
||||
String path = paths[i];
|
||||
result.append(toSafeUri(path));
|
||||
if (i < (paths.length -1)) {
|
||||
result.append('/');
|
||||
}
|
||||
}
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
static public String toSafeUri(String uri) {
|
||||
StringBuilder buf = new StringBuilder(20);
|
||||
for (char c : uri.toLowerCase().toCharArray()) { // TODO: unicode 16+ error
|
||||
if (Character.isLetter(c)) {
|
||||
buf.append(c);
|
||||
}
|
||||
if (Character.isDigit(c)) {
|
||||
buf.append(c);
|
||||
}
|
||||
if ('.'==c) {
|
||||
buf.append(c);
|
||||
}
|
||||
if ('-'==c) {
|
||||
buf.append(c);
|
||||
}
|
||||
if ('_'==c) {
|
||||
buf.append(c);
|
||||
}
|
||||
}
|
||||
String prefix = buf.toString();
|
||||
if (prefix.startsWith("http")) {
|
||||
prefix = prefix.substring(4);
|
||||
}
|
||||
if (prefix.startsWith("uri")) {
|
||||
prefix = prefix.substring(3);
|
||||
}
|
||||
if (prefix.startsWith("url")) {
|
||||
prefix = prefix.substring(3);
|
||||
}
|
||||
return prefix;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,128 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, Willem Cazander
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.x4o.maisdoc.flake;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.x4o.maisdoc.model.MaisDoc;
|
||||
import org.x4o.maisdoc.model.MaisDocNode;
|
||||
import org.x4o.maisdoc.model.MaisDocNodeData;
|
||||
import org.x4o.maisdoc.model.MaisDocNodeDataConfigurator;
|
||||
|
||||
/**
|
||||
* ApiDocNodeDataConfiguratorBean wraps the ApiDocNodeDataConfigurator to a single method of a bean.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 May 1, 2013
|
||||
*/
|
||||
public class MaisDocNodeDataConfiguratorBean implements MaisDocNodeDataConfigurator {
|
||||
|
||||
private Object bean = null;
|
||||
private String method = null;
|
||||
private List<Class<?>> targetClasses = null;
|
||||
|
||||
public MaisDocNodeDataConfiguratorBean() {
|
||||
targetClasses = new ArrayList<Class<?>>(5);
|
||||
}
|
||||
|
||||
public MaisDocNodeDataConfiguratorBean(Object bean,String method,Class<?>...classes) {
|
||||
this();
|
||||
setBean(bean);
|
||||
setMethod(method);
|
||||
for (Class<?> cl:classes) {
|
||||
addtargetClass(cl);
|
||||
}
|
||||
}
|
||||
|
||||
public static void addAnnotatedNodeDataConfigurators(MaisDoc doc,Object bean) {
|
||||
if (doc==null) {
|
||||
throw new NullPointerException("Can't add to null ApiDoc.");
|
||||
}
|
||||
if (bean==null) {
|
||||
throw new NullPointerException("Can't scan null bean.");
|
||||
}
|
||||
for (Method method:bean.getClass().getMethods()) {
|
||||
MaisDocNodeDataConfiguratorMethod ammo = method.getAnnotation(MaisDocNodeDataConfiguratorMethod.class);
|
||||
if (ammo==null) {
|
||||
continue;
|
||||
}
|
||||
if (ammo.targetClasses().length==0) {
|
||||
throw new IllegalArgumentException("Can't configure writer bean with empty 'targetClasses' parameter.");
|
||||
}
|
||||
MaisDocNodeDataConfiguratorBean methodConfig = new MaisDocNodeDataConfiguratorBean(bean, method.getName(), ammo.targetClasses());
|
||||
doc.addDataConfigurator(methodConfig);
|
||||
}
|
||||
}
|
||||
|
||||
public void configNodeData(MaisDoc doc, MaisDocNode node,MaisDocNodeData data) {
|
||||
Class<?> beanClass = getBean().getClass();
|
||||
try {
|
||||
Method methodBean = beanClass.getMethod(getMethod(), new Class[]{MaisDoc.class,MaisDocNode.class,MaisDocNodeData.class});
|
||||
methodBean.invoke(getBean(), new Object[]{doc,node,data});
|
||||
} catch (Exception e) {
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public void addtargetClass(Class<?> targetClass) {
|
||||
targetClasses.add(targetClass);
|
||||
}
|
||||
|
||||
public void removetargetClass(Class<?> targetClass) {
|
||||
targetClasses.remove(targetClass);
|
||||
}
|
||||
|
||||
public List<Class<?>> getTargetClasses() {
|
||||
return targetClasses;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the bean
|
||||
*/
|
||||
public Object getBean() {
|
||||
return bean;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bean the bean to set
|
||||
*/
|
||||
public void setBean(Object bean) {
|
||||
this.bean = bean;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the method
|
||||
*/
|
||||
public String getMethod() {
|
||||
return method;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param method the method to set
|
||||
*/
|
||||
public void setMethod(String method) {
|
||||
this.method = method;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, Willem Cazander
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.x4o.maisdoc.flake;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* ApiDocNodeDataConfiguratorMethod wraps the node data config api to a method.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Aug 11, 2013
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.METHOD})
|
||||
public @interface MaisDocNodeDataConfiguratorMethod {
|
||||
|
||||
Class<?>[] targetClasses();
|
||||
}
|
||||
|
|
@ -0,0 +1,205 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, Willem Cazander
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.x4o.maisdoc.flake;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.x4o.maisdoc.model.MaisDoc;
|
||||
import org.x4o.maisdoc.model.MaisDocNode;
|
||||
import org.x4o.maisdoc.model.MaisDocNodeBody;
|
||||
import org.x4o.maisdoc.model.MaisDocNodeWriter;
|
||||
import org.x4o.maisdoc.model.MaisDocWriteEvent;
|
||||
|
||||
/**
|
||||
* ApiDocNodeWriterBean wraps the ApiDocNodeWriterEvent to a single method of a bean.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 May 1, 2013
|
||||
*/
|
||||
public class MaisDocNodeWriterBean implements MaisDocNodeWriter {
|
||||
|
||||
private MaisDocNodeBody nodeBody = null;
|
||||
private List<Integer> nodeBodyOrders = null;
|
||||
private Object bean = null;
|
||||
private String method = null;
|
||||
private List<Class<?>> targetClasses = null;
|
||||
private String contentGroup = null;
|
||||
private String contentGroupType = null;
|
||||
|
||||
public MaisDocNodeWriterBean() {
|
||||
targetClasses = new ArrayList<Class<?>>(5);
|
||||
}
|
||||
|
||||
public MaisDocNodeWriterBean(MaisDocNodeBody nodeBody,Object bean,String method,Class<?>...classes) {
|
||||
this();
|
||||
setNodeBody(nodeBody);
|
||||
setBean(bean);
|
||||
setMethod(method);
|
||||
for (Class<?> cl:classes) {
|
||||
addtargetClass(cl);
|
||||
}
|
||||
}
|
||||
|
||||
public static void addAnnotatedNodeContentWriters(MaisDoc doc,Object bean) {
|
||||
if (doc==null) {
|
||||
throw new NullPointerException("Can't add to null ApiDoc.");
|
||||
}
|
||||
if (bean==null) {
|
||||
throw new NullPointerException("Can't scan null bean.");
|
||||
}
|
||||
for (Method method:bean.getClass().getMethods()) {
|
||||
MaisDocNodeWriterMethod ammo = method.getAnnotation(MaisDocNodeWriterMethod.class);
|
||||
if (ammo==null) {
|
||||
continue;
|
||||
}
|
||||
if (ammo.targetClasses().length==0) {
|
||||
throw new IllegalArgumentException("Can't configure writer bean with empty 'targetClasses' parameter.");
|
||||
}
|
||||
if (ammo.targetClasses().length!=ammo.nodeBodyOrders().length) {
|
||||
throw new IllegalArgumentException("Can't configure writer bean with non-equal array size of 'nodeBodyOrders'("+ammo.nodeBodyOrders().length+") and 'targetClasses'("+ammo.targetClasses().length+") parameters.");
|
||||
}
|
||||
MaisDocNodeWriterBean methodWriter = new MaisDocNodeWriterBean(ammo.nodeBody(), bean, method.getName(), ammo.targetClasses());
|
||||
List<Integer> nodeBodyOrder = new ArrayList<Integer>();
|
||||
for (int order:ammo.nodeBodyOrders()) {
|
||||
nodeBodyOrder.add(order);
|
||||
}
|
||||
methodWriter.setNodeBodyOrders(nodeBodyOrder);
|
||||
if (ammo.contentGroup().length()>0) {
|
||||
methodWriter.setContentGroup(ammo.contentGroup());
|
||||
}
|
||||
if (ammo.contentGroupType().length()>0) {
|
||||
methodWriter.setContentGroupType(ammo.contentGroupType());
|
||||
}
|
||||
doc.addNodeBodyWriter(methodWriter);
|
||||
}
|
||||
}
|
||||
|
||||
public void writeNodeContent(MaisDocWriteEvent<MaisDocNode> event) throws IOException {
|
||||
Class<?> beanClass = getBean().getClass();
|
||||
try {
|
||||
Method methodBean = beanClass.getMethod(getMethod(), new Class[]{MaisDocWriteEvent.class});
|
||||
methodBean.invoke(getBean(), new Object[]{event});
|
||||
} catch (Exception e) {
|
||||
throw new IOException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public void addtargetClass(Class<?> targetClass) {
|
||||
targetClasses.add(targetClass);
|
||||
}
|
||||
|
||||
public void removetargetClass(Class<?> targetClass) {
|
||||
targetClasses.remove(targetClass);
|
||||
}
|
||||
|
||||
public List<Class<?>> getTargetClasses() {
|
||||
return targetClasses;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the nodeBody
|
||||
*/
|
||||
public MaisDocNodeBody getNodeBody() {
|
||||
return nodeBody;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param nodeBody the nodeBody to set
|
||||
*/
|
||||
public void setNodeBody(MaisDocNodeBody nodeBody) {
|
||||
this.nodeBody = nodeBody;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the bean
|
||||
*/
|
||||
public Object getBean() {
|
||||
return bean;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bean the bean to set
|
||||
*/
|
||||
public void setBean(Object bean) {
|
||||
this.bean = bean;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the method
|
||||
*/
|
||||
public String getMethod() {
|
||||
return method;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param method the method to set
|
||||
*/
|
||||
public void setMethod(String method) {
|
||||
this.method = method;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the nodeBodyOrders
|
||||
*/
|
||||
public List<Integer> getNodeBodyOrders() {
|
||||
return nodeBodyOrders;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param nodeBodyOrders the nodeBodyOrders to set
|
||||
*/
|
||||
public void setNodeBodyOrders(List<Integer> nodeBodyOrders) {
|
||||
this.nodeBodyOrders = nodeBodyOrders;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the contentGroup
|
||||
*/
|
||||
public String getContentGroup() {
|
||||
return contentGroup;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param contentGroup the contentGroup to set
|
||||
*/
|
||||
public void setContentGroup(String contentGroup) {
|
||||
this.contentGroup = contentGroup;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the contentGroupType
|
||||
*/
|
||||
public String getContentGroupType() {
|
||||
return contentGroupType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param contentGroupType the contentGroupType to set
|
||||
*/
|
||||
public void setContentGroupType(String contentGroupType) {
|
||||
this.contentGroupType = contentGroupType;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, Willem Cazander
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.x4o.maisdoc.flake;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import org.x4o.maisdoc.model.MaisDocNodeBody;
|
||||
|
||||
/**
|
||||
* ApiDocNodeBodyWriterMethod wraps api doc file writer events to a method.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 May 19, 2013
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.METHOD})
|
||||
public @interface MaisDocNodeWriterMethod {
|
||||
|
||||
Class<?>[] targetClasses();
|
||||
|
||||
MaisDocNodeBody nodeBody();
|
||||
|
||||
int[] nodeBodyOrders() default {-1};
|
||||
|
||||
String contentGroup() default "";
|
||||
|
||||
String contentGroupType() default "";
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, Willem Cazander
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/**
|
||||
* The Api Doc Writer classes.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @since 1.0 May 12,2013
|
||||
*/
|
||||
package org.x4o.maisdoc.flake;
|
||||
|
|
@ -0,0 +1,725 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, Willem Cazander
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.x4o.maisdoc.model;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import org.x4o.maisdoc.flake.MaisDocNodeDataConfiguratorBean;
|
||||
import org.x4o.maisdoc.flake.MaisDocNodeWriterBean;
|
||||
|
||||
/**
|
||||
* ApiDoc holds all config and data to write a full api doc structure.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 May 12, 2013
|
||||
*/
|
||||
public class MaisDoc {
|
||||
|
||||
private String name = null;
|
||||
private String description = null;
|
||||
private MaisDocNode rootNode = null;
|
||||
private MaisDocNode rootNodeTreePage = null;
|
||||
private List<MaisDocNodeWriter> nodeBodyWriters = null;
|
||||
private List<MaisDocConcept> concepts = null;
|
||||
private String docCopyright = null;
|
||||
private String docAbout = null;
|
||||
private List<String> metaKeywords = null;
|
||||
private File metaStyleSheet = null;
|
||||
private String metaStyleSheetThema = null;
|
||||
private List<MaisDocPage> docPages = null;
|
||||
private Class<?> frameNavConceptClass = null;
|
||||
private Boolean frameNavOverviewPrintParent = null;
|
||||
private Boolean frameNavPrintParentId = null;
|
||||
private Boolean frameNavPrintParent = null;
|
||||
private Boolean frameNavPrintParentParent = null;
|
||||
private List<Class<?>> treeNodeClassExcludes = null;
|
||||
private List<Class<?>> treeNodePageModeClass = null;
|
||||
private List<MaisDocNodeDataConfigurator> dataConfigurators = null;
|
||||
private List<Class<?>> annotatedClasses = null;
|
||||
private MaisDocNodeData nodeData = null;
|
||||
private String docStatsJS = null;
|
||||
private String noFrameAllName = null;
|
||||
private String noFrameAllLink = null;
|
||||
private String noFrameAllTopJS = null;
|
||||
private String noFrameAllBottomJS = null;
|
||||
private boolean fillOnce = false;
|
||||
private List<MaisDocRemoteClass> remoteClasses = null;
|
||||
private boolean skipRootTreePathNode = true;
|
||||
private boolean printConceptTitle = true;
|
||||
private boolean printConceptPrevNext = true;
|
||||
private Map<String,String> groupTypeNames = null;
|
||||
private Map<String,Integer> groupTypeOrder = null;
|
||||
private String docPageSubTitle = null;
|
||||
|
||||
public MaisDoc() {
|
||||
nodeBodyWriters = new ArrayList<MaisDocNodeWriter>(20);
|
||||
concepts = new ArrayList<MaisDocConcept>(10);
|
||||
metaKeywords = new ArrayList<String>(5);
|
||||
docPages = new ArrayList<MaisDocPage>(5);
|
||||
treeNodeClassExcludes = new ArrayList<Class<?>>(5);
|
||||
treeNodePageModeClass = new ArrayList<Class<?>>(5);
|
||||
dataConfigurators = new ArrayList<MaisDocNodeDataConfigurator>(5);
|
||||
annotatedClasses = new ArrayList<Class<?>>(5);
|
||||
remoteClasses = new ArrayList<MaisDocRemoteClass>(5);
|
||||
groupTypeNames = new HashMap<String,String>(3);
|
||||
groupTypeOrder = new HashMap<String,Integer>(3);
|
||||
}
|
||||
|
||||
public void checkModel() throws NullPointerException,IllegalArgumentException {
|
||||
checkNull(name,"name");
|
||||
checkNull(description,"description");
|
||||
checkNull(docAbout,"docAbout");
|
||||
checkNull(docCopyright,"docCopyright");
|
||||
checkNull(rootNode,"rootNode");
|
||||
checkNull(frameNavConceptClass,"frameNavConceptClass");
|
||||
checkNull(noFrameAllName,"noFrameAllName");
|
||||
|
||||
if (concepts.isEmpty()) {
|
||||
throw new IllegalStateException("Can't work with empty concepts");
|
||||
}
|
||||
if (frameNavOverviewPrintParent==null) {
|
||||
setFrameNavOverviewPrintParent(false);
|
||||
}
|
||||
if (frameNavPrintParent==null) {
|
||||
setFrameNavPrintParent(false);
|
||||
}
|
||||
if (frameNavPrintParentParent==null) {
|
||||
setFrameNavPrintParentParent(false);
|
||||
}
|
||||
if (frameNavPrintParentId==null) {
|
||||
setFrameNavPrintParentId(false);
|
||||
}
|
||||
|
||||
if (metaStyleSheetThema==null) {
|
||||
setMetaStyleSheetThema("jdk7");
|
||||
}
|
||||
if (noFrameAllTopJS==null) {
|
||||
noFrameAllTopJS = "\nallClassesLink = document.getElementById(\"allclasses_navbar_top\");\n"+
|
||||
"if(window==top) {\n\tallClassesLink.style.display = \"block\";\n} else {\n\tallClassesLink.style.display = \"none\";\n}\n";
|
||||
}
|
||||
if (noFrameAllBottomJS==null) {
|
||||
noFrameAllBottomJS = "\nallClassesLink = document.getElementById(\"allclasses_navbar_bottom\");\n"+
|
||||
"if(window==top) {\n\tallClassesLink.style.display = \"block\";\n} else {\n\tallClassesLink.style.display = \"none\";\n}\n";
|
||||
}
|
||||
if (noFrameAllLink==null) {
|
||||
MaisDocConcept navConcept = findConceptByClass(getFrameNavConceptClass());
|
||||
setNoFrameAllLink("all"+navConcept.getId()+"-noframe.html");
|
||||
}
|
||||
|
||||
fillRuntimeData();
|
||||
|
||||
if (nodeBodyWriters.isEmpty()) {
|
||||
fillOnce = false;
|
||||
dataConfigurators.clear();
|
||||
throw new IllegalStateException("Can't work with empty nodeBodyWriters");
|
||||
}
|
||||
}
|
||||
|
||||
private void fillRuntimeData() {
|
||||
if (fillOnce) {
|
||||
return;
|
||||
}
|
||||
setNodeData(new MaisDocNodeData());
|
||||
try {
|
||||
for (Class<?> annoClass:getAnnotatedClasses()) {
|
||||
Object bean = annoClass.newInstance();
|
||||
MaisDocNodeWriterBean.addAnnotatedNodeContentWriters(this,bean);
|
||||
MaisDocNodeDataConfiguratorBean.addAnnotatedNodeDataConfigurators(this, bean);
|
||||
}
|
||||
} catch (InstantiationException e) {
|
||||
throw new IllegalArgumentException(e);
|
||||
} catch (IllegalAccessException e) {
|
||||
throw new IllegalArgumentException(e);
|
||||
}
|
||||
for (MaisDocConcept concept:getConcepts()) {
|
||||
String navLink = "overview-"+concept.getId()+".html";
|
||||
boolean resetHref = true;
|
||||
if (concept.getParent()==null) {
|
||||
resetHref = false; // don't reset root node
|
||||
} else {
|
||||
navLink = null; // rest start with null href's
|
||||
}
|
||||
MaisDocNavLink link = new MaisDocNavLink(concept.getId(), navLink, concept.getName(),concept.getName(),resetHref);
|
||||
getNodeData().addNavLink(link);
|
||||
}
|
||||
for (MaisDocPage page:getDocPages()) {
|
||||
String navLink = page.getId()+".html";
|
||||
MaisDocNavLink link = new MaisDocNavLink(page.getId(), navLink, page.getName(),page.getName(),false);
|
||||
getNodeData().addNavLink(link);
|
||||
}
|
||||
for (MaisDocRemoteClass rc:getRemoteClasses()) {
|
||||
try {
|
||||
rc.parseRemotePackageList();
|
||||
} catch (IOException e) {
|
||||
throw new IllegalStateException("While parsing: "+rc.getDocUrl()+" got: "+e.getMessage(),e);
|
||||
}
|
||||
}
|
||||
fillOnce = true;
|
||||
}
|
||||
|
||||
private void checkNull(Object obj,String objName) {
|
||||
if (obj==null) {
|
||||
throw new NullPointerException("Can't work with null "+objName);
|
||||
}
|
||||
}
|
||||
|
||||
public MaisDocConcept findConceptByClass(Class<?> objClass) {
|
||||
for (MaisDocConcept concept:getConcepts()) {
|
||||
if (concept.getConceptClass().isAssignableFrom(objClass)) {
|
||||
return concept;
|
||||
}
|
||||
for (MaisDocConcept c:concept.getChildConcepts()) {
|
||||
if (c.getConceptClass().isAssignableFrom(objClass)) {
|
||||
return concept;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public MaisDocConcept findConceptChildByNode(MaisDocNode node) {
|
||||
Class<?> objClass = node.getUserData().getClass();
|
||||
Class<?> parentClass = null;
|
||||
if (node.getParent()!=null) {
|
||||
parentClass = node.getParent().getUserData().getClass();
|
||||
}
|
||||
for (MaisDocConcept concept:getConcepts()) {
|
||||
if (parentClass!=null && concept.getConceptClass().isAssignableFrom(parentClass)==false) {
|
||||
continue;
|
||||
}
|
||||
for (MaisDocConcept c:concept.getChildConcepts()) {
|
||||
if (c.getConceptClass().isAssignableFrom(objClass)) {
|
||||
return c;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<MaisDocRemoteClass> getRemoteClasses() {
|
||||
return remoteClasses;
|
||||
}
|
||||
|
||||
public void addRemoteClass(MaisDocRemoteClass remoteClass) {
|
||||
remoteClasses.add(remoteClass);
|
||||
}
|
||||
|
||||
public void removeRemoteClass(MaisDocRemoteClass remoteClass) {
|
||||
remoteClasses.add(remoteClass);
|
||||
}
|
||||
|
||||
public List<Class<?>> getAnnotatedClasses() {
|
||||
return annotatedClasses;
|
||||
}
|
||||
|
||||
public void removeAnnotatedClasses(Class<?> annotatedClass) {
|
||||
annotatedClasses.remove(annotatedClass);
|
||||
}
|
||||
|
||||
public void addAnnotatedClasses(Class<?> annotatedClass) {
|
||||
annotatedClasses.add(annotatedClass);
|
||||
}
|
||||
|
||||
public List<MaisDocNodeDataConfigurator> getDataConfigurators() {
|
||||
return dataConfigurators;
|
||||
}
|
||||
|
||||
public void removeDataConfigurator(MaisDocNodeDataConfigurator conf) {
|
||||
dataConfigurators.remove(conf);
|
||||
}
|
||||
|
||||
public void addDataConfigurator(MaisDocNodeDataConfigurator conf) {
|
||||
dataConfigurators.add(conf);
|
||||
}
|
||||
|
||||
public MaisDocNodeWriter addNodeBodyWriter(MaisDocNodeWriter writer) {
|
||||
nodeBodyWriters.add(writer);
|
||||
return writer;
|
||||
}
|
||||
|
||||
public boolean removeNodeBodyWriter(MaisDocNodeWriter writer) {
|
||||
return nodeBodyWriters.remove(writer);
|
||||
}
|
||||
|
||||
public List<MaisDocNodeWriter> getNodeBodyWriters() {
|
||||
return nodeBodyWriters;
|
||||
}
|
||||
|
||||
public MaisDocConcept addConcept(MaisDocConcept concept) {
|
||||
concepts.add(concept);
|
||||
return concept;
|
||||
}
|
||||
|
||||
public boolean removeConcept(MaisDocConcept concept) {
|
||||
return concepts.remove(concept);
|
||||
}
|
||||
|
||||
public List<MaisDocConcept> getConcepts() {
|
||||
return concepts;
|
||||
}
|
||||
|
||||
public void addMetaKeyword(String keyword) {
|
||||
metaKeywords.add(keyword);
|
||||
}
|
||||
|
||||
public void addMetaKeywordAll(Collection<String> keywords) {
|
||||
metaKeywords.addAll(keywords);
|
||||
}
|
||||
|
||||
public boolean removeMetaKeyword(String keyword) {
|
||||
return metaKeywords.remove(keyword);
|
||||
}
|
||||
|
||||
public List<String> getDocKeywords() {
|
||||
return metaKeywords;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the metaStyleSheet
|
||||
*/
|
||||
public File getMetaStyleSheet() {
|
||||
return metaStyleSheet;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param metaStyleSheet the metaStyleSheet to set
|
||||
*/
|
||||
public void setMetaStyleSheet(File metaStyleSheet) {
|
||||
this.metaStyleSheet = metaStyleSheet;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the metaStyleSheetThema
|
||||
*/
|
||||
public String getMetaStyleSheetThema() {
|
||||
return metaStyleSheetThema;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param metaStyleSheetThema the metaStyleSheetThema to set
|
||||
*/
|
||||
public void setMetaStyleSheetThema(String metaStyleSheetThema) {
|
||||
this.metaStyleSheetThema = metaStyleSheetThema;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the docCopyright
|
||||
*/
|
||||
public String getDocCopyright() {
|
||||
return docCopyright;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param docCopyright the docCopyright to set
|
||||
*/
|
||||
public void setDocCopyright(String docCopyright) {
|
||||
this.docCopyright = docCopyright;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates default copyright message for owner.
|
||||
* @param owner The owner of the copyright.
|
||||
*/
|
||||
public void createDocCopyright(String owner) {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
String year = Integer.toString(calendar.get(Calendar.YEAR));
|
||||
createDocCopyright(owner, year);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates default copyright message for owner and year.
|
||||
* @param owner The owner of the copyright.
|
||||
* @param year The year of the copyright.
|
||||
*/
|
||||
public void createDocCopyright(String owner, String year) {
|
||||
StringBuilder buf = new StringBuilder(100);
|
||||
buf.append("Copyright © ");
|
||||
buf.append(year);
|
||||
buf.append(" ");
|
||||
buf.append(owner.toUpperCase());
|
||||
buf.append(" ");
|
||||
buf.append("All Rights Reserved.");
|
||||
setDocCopyright(buf.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the docAbout
|
||||
*/
|
||||
public String getDocAbout() {
|
||||
return docAbout;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param docAbout the docAbout to set
|
||||
*/
|
||||
public void setDocAbout(String docAbout) {
|
||||
this.docAbout = docAbout;
|
||||
}
|
||||
|
||||
public MaisDocPage addDocPage(MaisDocPage page) {
|
||||
docPages.add(page);
|
||||
return page;
|
||||
}
|
||||
|
||||
public boolean removeDocPage(MaisDocPage page) {
|
||||
return docPages.remove(page);
|
||||
}
|
||||
|
||||
public List<MaisDocPage> getDocPages() {
|
||||
return docPages;
|
||||
}
|
||||
|
||||
public MaisDocPage findDocPageById(String docPageId) {
|
||||
if (docPageId==null) {
|
||||
throw new NullPointerException("Can't search for null id.");
|
||||
}
|
||||
for (MaisDocPage page:docPages) {
|
||||
if (page.getId().equals(docPageId)) {
|
||||
return page;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Class<?> addTreeNodeClassExclude(Class<?> excludeClass) {
|
||||
treeNodeClassExcludes.add(excludeClass);
|
||||
return excludeClass;
|
||||
}
|
||||
|
||||
public boolean removeTreeNodeClassExclude(Class<?> excludeClass) {
|
||||
return treeNodeClassExcludes.remove(excludeClass);
|
||||
}
|
||||
|
||||
public List<Class<?>> getTreeNodeClassExcludes() {
|
||||
return treeNodeClassExcludes;
|
||||
}
|
||||
|
||||
public Class<?> addTreeNodePageModeClass(Class<?> pageModeClass) {
|
||||
treeNodePageModeClass.add(pageModeClass);
|
||||
return pageModeClass;
|
||||
}
|
||||
|
||||
public boolean removeTreeNodePageModeClass(Class<?> pageModeClass) {
|
||||
return treeNodePageModeClass.remove(pageModeClass);
|
||||
}
|
||||
|
||||
public List<Class<?>> getTreeNodePageModeClasses() {
|
||||
return treeNodePageModeClass;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the name
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param name the name to set
|
||||
*/
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the description
|
||||
*/
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param description the description to set
|
||||
*/
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the rootNodeTreePage
|
||||
*/
|
||||
public MaisDocNode getRootNodeTreePage() {
|
||||
return rootNodeTreePage;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param rootNodeTreePage the rootNodeTreePage to set
|
||||
*/
|
||||
public void setRootNodeTreePage(MaisDocNode rootNodeTreePage) {
|
||||
this.rootNodeTreePage = rootNodeTreePage;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the rootNode
|
||||
*/
|
||||
public MaisDocNode getRootNode() {
|
||||
return rootNode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param rootNode the rootNode to set
|
||||
*/
|
||||
public void setRootNode(MaisDocNode rootNode) {
|
||||
this.rootNode = rootNode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the frameNavConceptClass
|
||||
*/
|
||||
public Class<?> getFrameNavConceptClass() {
|
||||
return frameNavConceptClass;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param frameNavConceptClass the frameNavConceptClass to set
|
||||
*/
|
||||
public void setFrameNavConceptClass(Class<?> frameNavConceptClass) {
|
||||
this.frameNavConceptClass = frameNavConceptClass;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the frameNavPrintParent
|
||||
*/
|
||||
public Boolean getFrameNavPrintParent() {
|
||||
return frameNavPrintParent;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param frameNavPrintParent the frameNavPrintParent to set
|
||||
*/
|
||||
public void setFrameNavPrintParent(Boolean frameNavPrintParent) {
|
||||
this.frameNavPrintParent = frameNavPrintParent;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the frameNavPrintParentParent
|
||||
*/
|
||||
public Boolean getFrameNavPrintParentParent() {
|
||||
return frameNavPrintParentParent;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param frameNavPrintParentParent the frameNavPrintParentParent to set
|
||||
*/
|
||||
public void setFrameNavPrintParentParent(Boolean frameNavPrintParentParent) {
|
||||
this.frameNavPrintParentParent = frameNavPrintParentParent;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the frameNavOverviewPrintParent
|
||||
*/
|
||||
public Boolean getFrameNavOverviewPrintParent() {
|
||||
return frameNavOverviewPrintParent;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param frameNavOverviewPrintParent the frameNavOverviewPrintParent to set
|
||||
*/
|
||||
public void setFrameNavOverviewPrintParent(Boolean frameNavOverviewPrintParent) {
|
||||
this.frameNavOverviewPrintParent = frameNavOverviewPrintParent;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the frameNavPrintParentId
|
||||
*/
|
||||
public Boolean getFrameNavPrintParentId() {
|
||||
return frameNavPrintParentId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param frameNavPrintParentId the frameNavPrintParentId to set
|
||||
*/
|
||||
public void setFrameNavPrintParentId(Boolean frameNavPrintParentId) {
|
||||
this.frameNavPrintParentId = frameNavPrintParentId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the nodeData
|
||||
*/
|
||||
public MaisDocNodeData getNodeData() {
|
||||
return nodeData;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param nodeData the nodeData to set
|
||||
*/
|
||||
public void setNodeData(MaisDocNodeData nodeData) {
|
||||
this.nodeData = nodeData;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the docStatsJS
|
||||
*/
|
||||
public String getDocStatsJS() {
|
||||
return docStatsJS;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param docStatsJS the docStatsJS to set
|
||||
*/
|
||||
public void setDocStatsJS(String docStatsJS) {
|
||||
this.docStatsJS = docStatsJS;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the noFrameAllName
|
||||
*/
|
||||
public String getNoFrameAllName() {
|
||||
return noFrameAllName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param noFrameAllName the noFrameAllName to set
|
||||
*/
|
||||
public void setNoFrameAllName(String noFrameAllName) {
|
||||
this.noFrameAllName = noFrameAllName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the noFrameAllLink
|
||||
*/
|
||||
public String getNoFrameAllLink() {
|
||||
return noFrameAllLink;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param noFrameAllLink the noFrameAllLink to set
|
||||
*/
|
||||
public void setNoFrameAllLink(String noFrameAllLink) {
|
||||
this.noFrameAllLink = noFrameAllLink;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the noFrameAllTopJS
|
||||
*/
|
||||
public String getNoFrameAllTopJS() {
|
||||
return noFrameAllTopJS;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param noFrameAllTopJS the noFrameAllTopJS to set
|
||||
*/
|
||||
public void setNoFrameAllTopJS(String noFrameAllTopJS) {
|
||||
this.noFrameAllTopJS = noFrameAllTopJS;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the noFrameAllBottomJS
|
||||
*/
|
||||
public String getNoFrameAllBottomJS() {
|
||||
return noFrameAllBottomJS;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param noFrameAllBottomJS the noFrameAllBottomJS to set
|
||||
*/
|
||||
public void setNoFrameAllBottomJS(String noFrameAllBottomJS) {
|
||||
this.noFrameAllBottomJS = noFrameAllBottomJS;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the skipRootTreePathNode
|
||||
*/
|
||||
public boolean isSkipRootTreePathNode() {
|
||||
return skipRootTreePathNode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param skipRootTreePathNode the skipRootTreePathNode to set
|
||||
*/
|
||||
public void setSkipRootTreePathNode(boolean skipRootTreePathNode) {
|
||||
this.skipRootTreePathNode = skipRootTreePathNode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the printConceptTitle
|
||||
*/
|
||||
public boolean isPrintConceptTitle() {
|
||||
return printConceptTitle;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param printConceptTitle the printConceptTitle to set
|
||||
*/
|
||||
public void setPrintConceptTitle(boolean printConceptTitle) {
|
||||
this.printConceptTitle = printConceptTitle;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the printConceptPrevNext
|
||||
*/
|
||||
public boolean isPrintConceptPrevNext() {
|
||||
return printConceptPrevNext;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param printConceptPrevNext the printConceptPrevNext to set
|
||||
*/
|
||||
public void setPrintConceptPrevNext(boolean printConceptPrevNext) {
|
||||
this.printConceptPrevNext = printConceptPrevNext;
|
||||
}
|
||||
|
||||
public List<String> getGroupTypesOrdered() {
|
||||
Map<Integer,String> orderedMap = new TreeMap<Integer,String>();
|
||||
for (String key:groupTypeOrder.keySet()) {
|
||||
Integer order = groupTypeOrder.get(key);
|
||||
orderedMap.put(order, key);
|
||||
}
|
||||
return new ArrayList<String>(orderedMap.values());
|
||||
}
|
||||
|
||||
public String getGroupTypeName(String groupTypeKey) {
|
||||
String result = groupTypeNames.get(groupTypeKey);
|
||||
if (result==null) {
|
||||
result = groupTypeKey;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setGroupTypeName(String groupTypeKey,String name,int order) {
|
||||
groupTypeNames.put(groupTypeKey,name);
|
||||
groupTypeOrder.put(groupTypeKey, order);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the docPageSubTitle
|
||||
*/
|
||||
public String getDocPageSubTitle() {
|
||||
return docPageSubTitle;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param docPageSubTitle the docPageSubTitle to set
|
||||
*/
|
||||
public void setDocPageSubTitle(String docPageSubTitle) {
|
||||
this.docPageSubTitle = docPageSubTitle;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,164 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, Willem Cazander
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.x4o.maisdoc.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* ApiDocConcept defines the prime concepts which for which we write documents.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 May 12, 2013
|
||||
*/
|
||||
public class MaisDocConcept {
|
||||
|
||||
private String id = null;
|
||||
private String name = null;
|
||||
private String descriptionName = null;
|
||||
private String descriptionHelp = null;
|
||||
private MaisDocConcept parent = null;
|
||||
private Class<?> conceptClass = null;
|
||||
private List<MaisDocConcept> childConcepts = null;
|
||||
|
||||
public MaisDocConcept() {
|
||||
childConcepts = new ArrayList<MaisDocConcept>(5);
|
||||
}
|
||||
|
||||
public MaisDocConcept(MaisDocConcept parent,String id,Class<?> conceptClass) {
|
||||
this();
|
||||
setId(id);
|
||||
setConceptClass(conceptClass);
|
||||
setParent(parent);
|
||||
}
|
||||
|
||||
public MaisDocConcept(MaisDocConcept parent,String[] text,Class<?> conceptClass) {
|
||||
this(parent,text[0],text[1],text[2],text[3],conceptClass);
|
||||
}
|
||||
|
||||
public MaisDocConcept(MaisDocConcept parent,String id,String name,String descriptionName,String descriptionHelp,Class<?> conceptClass) {
|
||||
this(parent,id,conceptClass);
|
||||
setName(name);
|
||||
setDescriptionName(descriptionName);
|
||||
setDescriptionHelp(descriptionHelp);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the id
|
||||
*/
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id the id to set
|
||||
*/
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the name
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param name the name to set
|
||||
*/
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the descriptionName
|
||||
*/
|
||||
public String getDescriptionName() {
|
||||
return descriptionName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param descriptionName the descriptionName to set
|
||||
*/
|
||||
public void setDescriptionName(String descriptionName) {
|
||||
this.descriptionName = descriptionName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the descriptionHelp
|
||||
*/
|
||||
public String getDescriptionHelp() {
|
||||
return descriptionHelp;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param descriptionHelp the descriptionHelp to set
|
||||
*/
|
||||
public void setDescriptionHelp(String descriptionHelp) {
|
||||
this.descriptionHelp = descriptionHelp;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the conceptClass
|
||||
*/
|
||||
public Class<?> getConceptClass() {
|
||||
return conceptClass;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param conceptClass the conceptClass to set
|
||||
*/
|
||||
public void setConceptClass(Class<?> conceptClass) {
|
||||
this.conceptClass = conceptClass;
|
||||
}
|
||||
|
||||
public void addChildConcepts(MaisDocConcept childConcept) {
|
||||
childConcepts.add(childConcept);
|
||||
}
|
||||
|
||||
public void removeChildConcept(MaisDocConcept childConcept) {
|
||||
childConcepts.remove(childConcept);
|
||||
}
|
||||
|
||||
public List<MaisDocConcept> getChildConcepts() {
|
||||
return childConcepts;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the parent
|
||||
*/
|
||||
public MaisDocConcept getParent() {
|
||||
return parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param parent the parent to set
|
||||
*/
|
||||
public void setParent(MaisDocConcept parent) {
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,127 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, Willem Cazander
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.x4o.maisdoc.model;
|
||||
|
||||
/**
|
||||
* ApiDocIndexItem holds data to print the index all page.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Nov 09, 2013
|
||||
*/
|
||||
public class MaisDocIndexItem {
|
||||
|
||||
private String linkHref = null;
|
||||
private String linkText = null;
|
||||
private String titlePostHref = null;
|
||||
private String titlePostText = null;
|
||||
|
||||
private String title = null;
|
||||
private String description = null;
|
||||
|
||||
public MaisDocIndexItem() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the linkHref
|
||||
*/
|
||||
public String getLinkHref() {
|
||||
return linkHref;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param linkHref the linkHref to set
|
||||
*/
|
||||
public void setLinkHref(String linkHref) {
|
||||
this.linkHref = linkHref;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the linkText
|
||||
*/
|
||||
public String getLinkText() {
|
||||
return linkText;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param linkText the linkText to set
|
||||
*/
|
||||
public void setLinkText(String linkText) {
|
||||
this.linkText = linkText;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the titlePostHref
|
||||
*/
|
||||
public String getTitlePostHref() {
|
||||
return titlePostHref;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param titlePostHref the titlePostHref to set
|
||||
*/
|
||||
public void setTitlePostHref(String titlePostHref) {
|
||||
this.titlePostHref = titlePostHref;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the titlePostText
|
||||
*/
|
||||
public String getTitlePostText() {
|
||||
return titlePostText;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param titlePostText the titlePostText to set
|
||||
*/
|
||||
public void setTitlePostText(String titlePostText) {
|
||||
this.titlePostText = titlePostText;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the title
|
||||
*/
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param title the title to set
|
||||
*/
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the description
|
||||
*/
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param description the description to set
|
||||
*/
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,118 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, Willem Cazander
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.x4o.maisdoc.model;
|
||||
|
||||
/**
|
||||
* ApiDocNavLink holds all fields of an navigation link.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Aug 11, 2013
|
||||
*/
|
||||
public class MaisDocNavLink {
|
||||
|
||||
private String id = null;
|
||||
private String href = null;
|
||||
private String title = null;
|
||||
private String text = null;
|
||||
private boolean resetHref = false;
|
||||
|
||||
public MaisDocNavLink() {
|
||||
}
|
||||
|
||||
public MaisDocNavLink(String id,String href,String title,String text,boolean resetHref) {
|
||||
setId(id);
|
||||
setHref(href);
|
||||
setTitle(title);
|
||||
setText(text);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the id
|
||||
*/
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id the id to set
|
||||
*/
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the href
|
||||
*/
|
||||
public String getHref() {
|
||||
return href;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param href the href to set
|
||||
*/
|
||||
public void setHref(String href) {
|
||||
this.href = href;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the title
|
||||
*/
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param title the title to set
|
||||
*/
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the text
|
||||
*/
|
||||
public String getText() {
|
||||
return text;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param text the text to set
|
||||
*/
|
||||
public void setText(String text) {
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the resetHref
|
||||
*/
|
||||
public boolean isResetHref() {
|
||||
return resetHref;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param resetHref the resetHref to set
|
||||
*/
|
||||
public void setResetHref(boolean resetHref) {
|
||||
this.resetHref = resetHref;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,146 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, Willem Cazander
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.x4o.maisdoc.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* ApiDocNode defines the concept impl data tree nodes for which we write documents.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 May 12, 2013
|
||||
*/
|
||||
public class MaisDocNode {
|
||||
|
||||
private Object userData = null;
|
||||
private String id = null;
|
||||
private String name = null;
|
||||
private String description = null;
|
||||
private MaisDocNode parent = null;
|
||||
private List<MaisDocNode> nodes = null;
|
||||
|
||||
public MaisDocNode() {
|
||||
nodes = new ArrayList<MaisDocNode>(30);
|
||||
}
|
||||
|
||||
public MaisDocNode(Object userData,String id,String name,String description) {
|
||||
this();
|
||||
setUserData(userData);
|
||||
setId(id);
|
||||
setName(name);
|
||||
if (description==null) {
|
||||
description = name;
|
||||
}
|
||||
setDescription(description);
|
||||
}
|
||||
|
||||
public MaisDocNode addNode(MaisDocNode node) {
|
||||
node.setParent(this);
|
||||
nodes.add(node);
|
||||
return node;
|
||||
}
|
||||
|
||||
public boolean removeNode(MaisDocNode node) {
|
||||
return nodes.remove(node);
|
||||
}
|
||||
|
||||
public List<MaisDocNode> getNodes() {
|
||||
return nodes;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T> T toUserData(Class<T> type) {
|
||||
return (T)getUserData();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the userData
|
||||
*/
|
||||
public Object getUserData() {
|
||||
return userData;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param userData the userData to set
|
||||
*/
|
||||
public void setUserData(Object userData) {
|
||||
this.userData = userData;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the id
|
||||
*/
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id the id to set
|
||||
*/
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the name
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param name the name to set
|
||||
*/
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the description
|
||||
*/
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param description the description to set
|
||||
*/
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the parent
|
||||
*/
|
||||
public MaisDocNode getParent() {
|
||||
return parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param parent the parent to set
|
||||
*/
|
||||
public void setParent(MaisDocNode parent) {
|
||||
this.parent = parent;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, Willem Cazander
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.x4o.maisdoc.model;
|
||||
|
||||
/**
|
||||
* ApiDocNodeBody are the parts from which the content body is created.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 May 12, 2013
|
||||
*/
|
||||
public enum MaisDocNodeBody {
|
||||
|
||||
TREE_PATH,
|
||||
DESCRIPTION_LINKS,
|
||||
DESCRIPTION_NODE,
|
||||
SUMMARY,
|
||||
DETAIL
|
||||
}
|
||||
|
|
@ -0,0 +1,192 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, Willem Cazander
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.x4o.maisdoc.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* ApiDocNodeData holds all data the is configed per node page.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Aug 11, 2013
|
||||
*/
|
||||
public class MaisDocNodeData {
|
||||
|
||||
private String prefixPath;
|
||||
private String navSelected = null;
|
||||
private List<String> groupTypeKeys = null;
|
||||
private Map<String,List<MaisDocNavLink>> groupTypeLinks = null;
|
||||
private String prevLink = null;
|
||||
private String nextLink = null;
|
||||
private String framePath = null;;
|
||||
private List<MaisDocNavLink> navLinks = null;
|
||||
private List<MaisDocIndexItem> indexItems = null;
|
||||
|
||||
public MaisDocNodeData() {
|
||||
navLinks = new ArrayList<MaisDocNavLink>(12);
|
||||
groupTypeKeys = new ArrayList<String>(navLinks.size()/3);
|
||||
groupTypeLinks = new HashMap<String,List<MaisDocNavLink>>(groupTypeKeys.size());
|
||||
indexItems = new ArrayList<MaisDocIndexItem>(500);
|
||||
}
|
||||
|
||||
public List<MaisDocIndexItem> getIndexItems() {
|
||||
return indexItems;
|
||||
}
|
||||
|
||||
public void addIndexItem(MaisDocIndexItem indexItem) {
|
||||
indexItems.add(indexItem);
|
||||
}
|
||||
|
||||
public void addGroupTypeKey(String groupTypeKey) {
|
||||
groupTypeKeys.add(groupTypeKey);
|
||||
}
|
||||
|
||||
public List<String> getGroupTypeKeys() {
|
||||
return groupTypeKeys;
|
||||
}
|
||||
|
||||
public void addGroupTypeLink(String groupTypeKey,MaisDocNavLink link) {
|
||||
List<MaisDocNavLink> result = groupTypeLinks.get(groupTypeKey);
|
||||
if (result==null) {
|
||||
result = new ArrayList<MaisDocNavLink>(10);
|
||||
groupTypeLinks.put(groupTypeKey, result);
|
||||
}
|
||||
result.add(link);
|
||||
}
|
||||
|
||||
public List<MaisDocNavLink> getGroupTypeLinks(String groupTypeKey) {
|
||||
List<MaisDocNavLink> result = groupTypeLinks.get(groupTypeKey);
|
||||
if (result==null) {
|
||||
result = new ArrayList<MaisDocNavLink>(0);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public MaisDocNavLink getGroupTypeLink(String groupTypeKey,String group) {
|
||||
List<MaisDocNavLink> links = getGroupTypeLinks(groupTypeKey);
|
||||
for (MaisDocNavLink link:links) {
|
||||
if (link.getId().equals(group)) {
|
||||
return link;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void clearGroupTypeLinks() {
|
||||
groupTypeLinks.clear();
|
||||
}
|
||||
|
||||
public List<MaisDocNavLink> getNavLinks() {
|
||||
return navLinks;
|
||||
}
|
||||
|
||||
public MaisDocNavLink getNavLinkById(String id) {
|
||||
for (MaisDocNavLink link:navLinks) {
|
||||
if (link.getId().equals(id)) {
|
||||
return link;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void addNavLink(MaisDocNavLink link) {
|
||||
navLinks.add(link);
|
||||
}
|
||||
|
||||
public void removeNavLink(MaisDocNavLink link) {
|
||||
navLinks.remove(link);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the prefixPath
|
||||
*/
|
||||
public String getPrefixPath() {
|
||||
return prefixPath;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param prefixPath the prefixPath to set
|
||||
*/
|
||||
public void setPrefixPath(String prefixPath) {
|
||||
this.prefixPath = prefixPath;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the navSelected
|
||||
*/
|
||||
public String getNavSelected() {
|
||||
return navSelected;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param navSelected the navSelected to set
|
||||
*/
|
||||
public void setNavSelected(String navSelected) {
|
||||
this.navSelected = navSelected;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the prevLink
|
||||
*/
|
||||
public String getPrevLink() {
|
||||
return prevLink;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param prevLink the prevLink to set
|
||||
*/
|
||||
public void setPrevLink(String prevLink) {
|
||||
this.prevLink = prevLink;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the nextLink
|
||||
*/
|
||||
public String getNextLink() {
|
||||
return nextLink;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param nextLink the nextLink to set
|
||||
*/
|
||||
public void setNextLink(String nextLink) {
|
||||
this.nextLink = nextLink;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the framePath
|
||||
*/
|
||||
public String getFramePath() {
|
||||
return framePath;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param framePath the framePath to set
|
||||
*/
|
||||
public void setFramePath(String framePath) {
|
||||
this.framePath = framePath;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, Willem Cazander
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.x4o.maisdoc.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* ApiDocNodeDataConfigurator is for per node config of data.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Aug 11, 2013
|
||||
*/
|
||||
public interface MaisDocNodeDataConfigurator {
|
||||
|
||||
List<Class<?>> getTargetClasses();
|
||||
|
||||
void configNodeData(MaisDoc doc,MaisDocNode node,MaisDocNodeData data);
|
||||
}
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, Willem Cazander
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.x4o.maisdoc.model;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* ApiDocNodeWriter are the parts from which the content body is created.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 May 12, 2013
|
||||
*/
|
||||
public interface MaisDocNodeWriter {
|
||||
|
||||
MaisDocNodeBody getNodeBody();
|
||||
List<Class<?>> getTargetClasses();
|
||||
List<Integer> getNodeBodyOrders();
|
||||
String getContentGroup();
|
||||
String getContentGroupType();
|
||||
|
||||
void writeNodeContent(MaisDocWriteEvent<MaisDocNode> e) throws IOException;
|
||||
}
|
||||
|
|
@ -0,0 +1,117 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, Willem Cazander
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.x4o.maisdoc.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* ApiDocPage defines seperate pages for the documentation.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 May 12, 2013
|
||||
*/
|
||||
public class MaisDocPage {
|
||||
|
||||
private String id = null;
|
||||
private String name = null;
|
||||
private String description = null;
|
||||
private List<MaisDocPageWriter> pageWriters = null;
|
||||
|
||||
public MaisDocPage() {
|
||||
pageWriters = new ArrayList<MaisDocPageWriter>(30);
|
||||
}
|
||||
|
||||
public MaisDocPage(String id,String name,String description,MaisDocPageWriter...writers) {
|
||||
this();
|
||||
setId(id);
|
||||
setName(name);
|
||||
setDescription(description);
|
||||
for (MaisDocPageWriter writer:writers) {
|
||||
addPageWriter(writer);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the id
|
||||
*/
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id the id to set
|
||||
*/
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the name
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param name the name to set
|
||||
*/
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the description
|
||||
*/
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param description the description to set
|
||||
*/
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the page writers.
|
||||
*/
|
||||
public List<MaisDocPageWriter> getPageWriters() {
|
||||
return pageWriters;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param writer the writer to add.
|
||||
*/
|
||||
public void addPageWriter(MaisDocPageWriter writer) {
|
||||
pageWriters.add(writer);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param writer the writer to add.
|
||||
*/
|
||||
public void removePageWriter(MaisDocPageWriter writer) {
|
||||
pageWriters.remove(writer);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, Willem Cazander
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.x4o.maisdoc.model;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* ApiDocPageWriter writes a page content part.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 May 12, 2013
|
||||
*/
|
||||
public interface MaisDocPageWriter {
|
||||
|
||||
void writePageContent(MaisDocWriteEvent<MaisDocPage> e) throws IOException;
|
||||
}
|
||||
|
|
@ -0,0 +1,186 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, Willem Cazander
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.x4o.maisdoc.model;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
* ApiDocRemoteUrl defines the javadoc package-list remote url.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Aug 15, 2013
|
||||
*/
|
||||
public class MaisDocRemoteClass {
|
||||
|
||||
public final static String REMOTE_FILE = "package-list";
|
||||
private Logger logger = Logger.getLogger(MaisDocRemoteClass.class.getName());
|
||||
private String docUrl = null;
|
||||
private String packageListUrl = null;
|
||||
private List<String> packageList = null;
|
||||
|
||||
/**
|
||||
* Creates the ApiDocRemoteClass.
|
||||
*/
|
||||
private MaisDocRemoteClass() {
|
||||
packageList = new ArrayList<String>(100);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the ApiDocRemoteClass with a javadoc url to fetch the package-list from.
|
||||
* @param docUrl The remote javadoc base url.
|
||||
*/
|
||||
public MaisDocRemoteClass(String docUrl) {
|
||||
this();
|
||||
setDocUrl(docUrl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the ApiDocRemoteClass with a javadoc url. but fetched the package-list from the packageListUrl.
|
||||
* @param docUrl The remote javadoc base url.
|
||||
* @param packageListUrl The remote/local package-list url.
|
||||
*/
|
||||
public MaisDocRemoteClass(String docUrl,String packageListUrl) {
|
||||
this(docUrl);
|
||||
setPackageListUrl(packageListUrl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns remote url for a class or null if no remote package excists for the class.
|
||||
* @param cls The class to get the remote url for.
|
||||
* @return The remote url of the class requested or null if none if found.
|
||||
*/
|
||||
public String getRemoteUrl(Class<?> cls) {
|
||||
if (cls==null) {
|
||||
return null;
|
||||
}
|
||||
if (cls.isArray()) {
|
||||
return null;
|
||||
}
|
||||
if (cls.getPackage()==null) {
|
||||
return null;
|
||||
}
|
||||
String packageName = cls.getPackage().getName();
|
||||
logger.fine("Search "+packageName+" in "+packageList.size()+" of "+docUrl);
|
||||
if (packageList.contains(packageName)) {
|
||||
String baseUrl = getDocUrlClean();
|
||||
String packagePath = packageName.replaceAll("\\.", "/");
|
||||
String fullUrl = baseUrl+packagePath+"/"+cls.getSimpleName()+".html";
|
||||
return fullUrl;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Cleans the docUrl by sometimes appending postfix slash.
|
||||
* @return The cleaned doc url.
|
||||
*/
|
||||
private String getDocUrlClean() {
|
||||
String baseUrl = getDocUrl();
|
||||
if (baseUrl.endsWith("/")==false) {
|
||||
baseUrl += "/";
|
||||
}
|
||||
return baseUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetches and parses the package-list file.
|
||||
* @throws IOException If error happend.
|
||||
*/
|
||||
public void parseRemotePackageList() throws IOException {
|
||||
packageList.clear();
|
||||
String baseUrl = getDocUrlClean();
|
||||
baseUrl += REMOTE_FILE;
|
||||
URL url = new URL(baseUrl);
|
||||
URLConnection conn = url.openConnection();
|
||||
conn.setConnectTimeout(2000);
|
||||
conn.setReadTimeout(2000);
|
||||
parseRemoteFile(conn.getInputStream(), conn.getContentEncoding());
|
||||
}
|
||||
|
||||
/**
|
||||
* Parsed the inputStream into the packagList values.
|
||||
* @param in The inputStream.
|
||||
* @param enc The encoding of the inputStream.
|
||||
* @throws IOException When error on inputStream.
|
||||
*/
|
||||
private void parseRemoteFile(InputStream in,String enc) throws IOException {
|
||||
if (enc==null) {
|
||||
enc = "UTF-8";
|
||||
}
|
||||
BufferedReader br = new BufferedReader(new InputStreamReader(in,Charset.forName(enc)));
|
||||
try {
|
||||
String line = null;
|
||||
while ((line = br.readLine()) != null) {
|
||||
String lineClean = line.trim();
|
||||
packageList.add(lineClean);
|
||||
logger.finer("Adding remote package: '"+lineClean+"'");
|
||||
}
|
||||
} finally {
|
||||
br.close();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the docUrl
|
||||
*/
|
||||
public String getDocUrl() {
|
||||
return docUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param docUrl the docUrl to set
|
||||
*/
|
||||
public void setDocUrl(String docUrl) {
|
||||
this.docUrl = docUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the packageListUrl
|
||||
*/
|
||||
public String getPackageListUrl() {
|
||||
return packageListUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param packageListUrl the packageListUrl to set
|
||||
*/
|
||||
public void setPackageListUrl(String packageListUrl) {
|
||||
this.packageListUrl = packageListUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the packageList
|
||||
*/
|
||||
public List<String> getPackageList() {
|
||||
return packageList;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,71 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, Willem Cazander
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.x4o.maisdoc.model;
|
||||
|
||||
import org.x4o.maisdoc.flake.MaisDocContentWriter;
|
||||
|
||||
/**
|
||||
* ApiDocWriteEvent holds the needed objects to process write events of content parts.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 May 12, 2013
|
||||
*/
|
||||
public class MaisDocWriteEvent<T> {
|
||||
|
||||
private MaisDoc doc = null;
|
||||
private T eventObject = null;
|
||||
private MaisDocContentWriter writer = null;
|
||||
|
||||
/**
|
||||
* Creates an ApiDocNodeBodyEvent.
|
||||
* @param doc The ApiDoc we are writing.
|
||||
* @param writer The content writer to write to.
|
||||
* @param eventObject The event we are firing this event for.
|
||||
*/
|
||||
public MaisDocWriteEvent(MaisDoc doc,MaisDocContentWriter writer,T eventObject) {
|
||||
this.doc=doc;
|
||||
this.writer=writer;
|
||||
this.eventObject=eventObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the doc
|
||||
*/
|
||||
public MaisDoc getDoc() {
|
||||
return doc;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the event
|
||||
*/
|
||||
public T getEventObject() {
|
||||
return eventObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the writer
|
||||
*/
|
||||
public MaisDocContentWriter getWriter() {
|
||||
return writer;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, Willem Cazander
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/**
|
||||
* The Api Doc Dom classes.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @since 1.0 May 12,2013
|
||||
*/
|
||||
package org.x4o.maisdoc.model;
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, Willem Cazander
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/**
|
||||
* The mais documentation writer.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @since 1.0 Jan 27,2025
|
||||
*/
|
||||
package org.x4o.maisdoc;
|
||||
Loading…
Add table
Add a link
Reference in a new issue