X4O: Formatted plugins and maisdoc

This commit is contained in:
Willem Cazander 2025-11-07 21:48:59 +01:00
parent a61ce241e1
commit bd4a04a813
63 changed files with 1690 additions and 1589 deletions

View file

@ -52,14 +52,8 @@ public class TagHandlerTest {
X4ODriver<TestObjectRoot> driver = TestDriver.getInstance();
X4OReader<TestObjectRoot> reader = driver.createReader();
/*
File f = File.createTempFile("test-taghandlers", ".xml");
f.deleteOnExit();
reader.setProperty(X4OLanguagePropertyKeys.DEBUG_OUTPUT_STREAM, new FileOutputStream(f));
try {
reader.readResource("tests/test-taghandlers.xml");
} catch (Exception e) {
printS(e);
}
* File f = File.createTempFile("test-taghandlers", ".xml"); f.deleteOnExit(); reader.setProperty(X4OLanguagePropertyKeys.DEBUG_OUTPUT_STREAM, new
* FileOutputStream(f)); try { reader.readResource("tests/test-taghandlers.xml"); } catch (Exception e) { printS(e); }
*/
}
}

View file

@ -26,7 +26,6 @@ import javax.swing.JFrame;
import org.x4o.xml.element.AbstractElement;
/**
*
* @author Willem Cazander

View file

@ -22,12 +22,10 @@
*/
package org.x4o.xml.test.element;
import org.x4o.xml.element.AbstractElementConfigurator;
import org.x4o.xml.element.Element;
import org.x4o.xml.element.ElementConfiguratorException;
/**
* TestElementConfigurator
*

View file

@ -42,30 +42,35 @@ public class TestAttributeOrderChild extends TestObjectChild {
public String getCaaName() {
return caaName;
}
/**
* @param caaName the caaName to set
*/
public void setCaaName(String caaName) {
this.caaName = caaName;
}
/**
* @return the cabName
*/
public String getCabName() {
return cabName;
}
/**
* @param cabName the cabName to set
*/
public void setCabName(String cabName) {
this.cabName = cabName;
}
/**
* @return the cacName
*/
public String getCacName() {
return cacName;
}
/**
* @param cacName the cacName to set
*/
@ -79,66 +84,77 @@ public class TestAttributeOrderChild extends TestObjectChild {
public String getAaaName() {
return aaaName;
}
/**
* @param aaaName the aaaName to set
*/
public void setAaaName(String aaaName) {
this.aaaName = aaaName;
}
/**
* @return the aabName
*/
public String getAabName() {
return aabName;
}
/**
* @param aabName the aabName to set
*/
public void setAabName(String aabName) {
this.aabName = aabName;
}
/**
* @return the aacName
*/
public String getAacName() {
return aacName;
}
/**
* @param aacName the aacName to set
*/
public void setAacName(String aacName) {
this.aacName = aacName;
}
/**
* @return the abaName
*/
public String getAbaName() {
return abaName;
}
/**
* @param abaName the abaName to set
*/
public void setAbaName(String abaName) {
this.abaName = abaName;
}
/**
* @return the abbName
*/
public String getAbbName() {
return abbName;
}
/**
* @param abbName the abbName to set
*/
public void setAbbName(String abbName) {
this.abbName = abbName;
}
/**
* @return the abcName
*/
public String getAbcName() {
return abcName;
}
/**
* @param abcName the abcName to set
*/

View file

@ -87,7 +87,6 @@ public class TestBean {
private String privateStringObjectFieldUnicode仙上主天 = "仙上主天";
// private Date privateDateObjectField = new Date(0);
// auto gen , get/set-ers
/**
@ -96,180 +95,210 @@ public class TestBean {
public int getPublicIntegerTypeField() {
return publicIntegerTypeField;
}
/**
* @param publicIntegerTypeField the publicIntegerTypeField to set
*/
public void setPublicIntegerTypeField(int publicIntegerTypeField) {
this.publicIntegerTypeField = publicIntegerTypeField;
}
/**
* @return the publicIntegerObjectField
*/
public Integer getPublicIntegerObjectField() {
return publicIntegerObjectField;
}
/**
* @param publicIntegerObjectField the publicIntegerObjectField to set
*/
public void setPublicIntegerObjectField(Integer publicIntegerObjectField) {
this.publicIntegerObjectField = publicIntegerObjectField;
}
/**
* @return the publicLongTypeField
*/
public long getPublicLongTypeField() {
return publicLongTypeField;
}
/**
* @param publicLongTypeField the publicLongTypeField to set
*/
public void setPublicLongTypeField(long publicLongTypeField) {
this.publicLongTypeField = publicLongTypeField;
}
/**
* @return the publicLongObjectField
*/
public Long getPublicLongObjectField() {
return publicLongObjectField;
}
/**
* @param publicLongObjectField the publicLongObjectField to set
*/
public void setPublicLongObjectField(Long publicLongObjectField) {
this.publicLongObjectField = publicLongObjectField;
}
/**
* @return the publicDoubleTypeField
*/
public double getPublicDoubleTypeField() {
return publicDoubleTypeField;
}
/**
* @param publicDoubleTypeField the publicDoubleTypeField to set
*/
public void setPublicDoubleTypeField(double publicDoubleTypeField) {
this.publicDoubleTypeField = publicDoubleTypeField;
}
/**
* @return the publicDoubleObjectField
*/
public Double getPublicDoubleObjectField() {
return publicDoubleObjectField;
}
/**
* @param publicDoubleObjectField the publicDoubleObjectField to set
*/
public void setPublicDoubleObjectField(Double publicDoubleObjectField) {
this.publicDoubleObjectField = publicDoubleObjectField;
}
/**
* @return the publicFloatTypeField
*/
public float getPublicFloatTypeField() {
return publicFloatTypeField;
}
/**
* @param publicFloatTypeField the publicFloatTypeField to set
*/
public void setPublicFloatTypeField(float publicFloatTypeField) {
this.publicFloatTypeField = publicFloatTypeField;
}
/**
* @return the publicFloatObjectField
*/
public Float getPublicFloatObjectField() {
return publicFloatObjectField;
}
/**
* @param publicFloatObjectField the publicFloatObjectField to set
*/
public void setPublicFloatObjectField(Float publicFloatObjectField) {
this.publicFloatObjectField = publicFloatObjectField;
}
/**
* @return the publicByteTypeField
*/
public byte getPublicByteTypeField() {
return publicByteTypeField;
}
/**
* @param publicByteTypeField the publicByteTypeField to set
*/
public void setPublicByteTypeField(byte publicByteTypeField) {
this.publicByteTypeField = publicByteTypeField;
}
/**
* @return the publicByteObjectField
*/
public Byte getPublicByteObjectField() {
return publicByteObjectField;
}
/**
* @param publicByteObjectField the publicByteObjectField to set
*/
public void setPublicByteObjectField(Byte publicByteObjectField) {
this.publicByteObjectField = publicByteObjectField;
}
/**
* @return the publicBooleanTypeField
*/
public boolean isPublicBooleanTypeField() {
return publicBooleanTypeField;
}
/**
* @param publicBooleanTypeField the publicBooleanTypeField to set
*/
public void setPublicBooleanTypeField(boolean publicBooleanTypeField) {
this.publicBooleanTypeField = publicBooleanTypeField;
}
/**
* @return the publicBooleanObjectField
*/
public Boolean getPublicBooleanObjectField() {
return publicBooleanObjectField;
}
/**
* @param publicBooleanObjectField the publicBooleanObjectField to set
*/
public void setPublicBooleanObjectField(Boolean publicBooleanObjectField) {
this.publicBooleanObjectField = publicBooleanObjectField;
}
/**
* @return the publicCharTypeField
*/
public char getPublicCharTypeField() {
return publicCharTypeField;
}
/**
* @param publicCharTypeField the publicCharTypeField to set
*/
public void setPublicCharTypeField(char publicCharTypeField) {
this.publicCharTypeField = publicCharTypeField;
}
/**
* @return the publicCharObjectField
*/
public Character getPublicCharObjectField() {
return publicCharObjectField;
}
/**
* @param publicCharObjectField the publicCharObjectField to set
*/
public void setPublicCharObjectField(Character publicCharObjectField) {
this.publicCharObjectField = publicCharObjectField;
}
/**
* @return the publicStringObjectField
*/
public String getPublicStringObjectField() {
return publicStringObjectField;
}
/**
* @param publicStringObjectField the publicStringObjectField to set
*/
public void setPublicStringObjectField(String publicStringObjectField) {
this.publicStringObjectField = publicStringObjectField;
}
// /**
// * @return the publicStringObjectFieldUnicodeᒡᒢᑊᒻᒻᓫᔿ
// */
@ -288,204 +317,234 @@ public class TestBean {
public String getPublicStringObjectFieldUnicode仙上主天() {
return publicStringObjectFieldUnicode仙上主天;
}
/**
* @param publicStringObjectFieldUnicode仙上主天 the publicStringObjectFieldUnicode仙上主天 to set
*/
public void setPublicStringObjectFieldUnicode仙上主天(String publicStringObjectFieldUnicode仙上主天) {
this.publicStringObjectFieldUnicode仙上主天 = publicStringObjectFieldUnicode仙上主天;
}
/*
* @return the publicDateObjectField
public Date getPublicDateObjectField() {
return publicDateObjectField;
}*/
*
* public Date getPublicDateObjectField() { return publicDateObjectField; }
*/
/*
* @param publicDateObjectField the publicDateObjectField to set
public void setPublicDateObjectField(Date publicDateObjectField) {
this.publicDateObjectField = publicDateObjectField;
}*/
*
* public void setPublicDateObjectField(Date publicDateObjectField) { this.publicDateObjectField = publicDateObjectField; }
*/
/**
* @return the privateIntegerTypeField
*/
public int getPrivateIntegerTypeField() {
return privateIntegerTypeField;
}
/**
* @param privateIntegerTypeField the privateIntegerTypeField to set
*/
public void setPrivateIntegerTypeField(int privateIntegerTypeField) {
this.privateIntegerTypeField = privateIntegerTypeField;
}
/**
* @return the privateIntegerObjectField
*/
public Integer getPrivateIntegerObjectField() {
return privateIntegerObjectField;
}
/**
* @param privateIntegerObjectField the privateIntegerObjectField to set
*/
public void setPrivateIntegerObjectField(Integer privateIntegerObjectField) {
this.privateIntegerObjectField = privateIntegerObjectField;
}
/**
* @return the privateLongTypeField
*/
public long getPrivateLongTypeField() {
return privateLongTypeField;
}
/**
* @param privateLongTypeField the privateLongTypeField to set
*/
public void setPrivateLongTypeField(long privateLongTypeField) {
this.privateLongTypeField = privateLongTypeField;
}
/**
* @return the privateLongObjectField
*/
public Long getPrivateLongObjectField() {
return privateLongObjectField;
}
/**
* @param privateLongObjectField the privateLongObjectField to set
*/
public void setPrivateLongObjectField(Long privateLongObjectField) {
this.privateLongObjectField = privateLongObjectField;
}
/**
* @return the privateDoubleTypeField
*/
public double getPrivateDoubleTypeField() {
return privateDoubleTypeField;
}
/**
* @param privateDoubleTypeField the privateDoubleTypeField to set
*/
public void setPrivateDoubleTypeField(double privateDoubleTypeField) {
this.privateDoubleTypeField = privateDoubleTypeField;
}
/**
* @return the privateDoubleObjectField
*/
public Double getPrivateDoubleObjectField() {
return privateDoubleObjectField;
}
/**
* @param privateDoubleObjectField the privateDoubleObjectField to set
*/
public void setPrivateDoubleObjectField(Double privateDoubleObjectField) {
this.privateDoubleObjectField = privateDoubleObjectField;
}
/**
* @return the privateFloatTypeField
*/
public float getPrivateFloatTypeField() {
return privateFloatTypeField;
}
/**
* @param privateFloatTypeField the privateFloatTypeField to set
*/
public void setPrivateFloatTypeField(float privateFloatTypeField) {
this.privateFloatTypeField = privateFloatTypeField;
}
/**
* @return the privateFloatObjectField
*/
public Float getPrivateFloatObjectField() {
return privateFloatObjectField;
}
/**
* @param privateFloatObjectField the privateFloatObjectField to set
*/
public void setPrivateFloatObjectField(Float privateFloatObjectField) {
this.privateFloatObjectField = privateFloatObjectField;
}
/**
* @return the privateByteTypeField
*/
public byte getPrivateByteTypeField() {
return privateByteTypeField;
}
/**
* @param privateByteTypeField the privateByteTypeField to set
*/
public void setPrivateByteTypeField(byte privateByteTypeField) {
this.privateByteTypeField = privateByteTypeField;
}
/**
* @return the privateByteObjectField
*/
public Byte getPrivateByteObjectField() {
return privateByteObjectField;
}
/**
* @param privateByteObjectField the privateByteObjectField to set
*/
public void setPrivateByteObjectField(Byte privateByteObjectField) {
this.privateByteObjectField = privateByteObjectField;
}
/**
* @return the privateBooleanTypeField
*/
public boolean isPrivateBooleanTypeField() {
return privateBooleanTypeField;
}
/**
* @param privateBooleanTypeField the privateBooleanTypeField to set
*/
public void setPrivateBooleanTypeField(boolean privateBooleanTypeField) {
this.privateBooleanTypeField = privateBooleanTypeField;
}
/**
* @return the privateBooleanObjectField
*/
public Boolean getPrivateBooleanObjectField() {
return privateBooleanObjectField;
}
/**
* @param privateBooleanObjectField the privateBooleanObjectField to set
*/
public void setPrivateBooleanObjectField(Boolean privateBooleanObjectField) {
this.privateBooleanObjectField = privateBooleanObjectField;
}
/**
* @return the privateCharTypeField
*/
public char getPrivateCharTypeField() {
return privateCharTypeField;
}
/**
* @param privateCharTypeField the privateCharTypeField to set
*/
public void setPrivateCharTypeField(char privateCharTypeField) {
this.privateCharTypeField = privateCharTypeField;
}
/**
* @return the privateCharObjectField
*/
public Character getPrivateCharObjectField() {
return privateCharObjectField;
}
/**
* @param privateCharObjectField the privateCharObjectField to set
*/
public void setPrivateCharObjectField(Character privateCharObjectField) {
this.privateCharObjectField = privateCharObjectField;
}
/**
* @return the privateStringObjectField
*/
public String getPrivateStringObjectField() {
return privateStringObjectField;
}
/**
* @param privateStringObjectField the privateStringObjectField to set
*/
public void setPrivateStringObjectField(String privateStringObjectField) {
this.privateStringObjectField = privateStringObjectField;
}
// /**
// * @return the privateStringObjectFieldUnicodeᒡᒢᑊᒻᒻᓫᔿ
// */
@ -504,6 +563,7 @@ public class TestBean {
public String getPrivateStringObjectFieldUnicode仙上主天() {
return privateStringObjectFieldUnicode仙上主天;
}
/**
* @param privateStringObjectFieldUnicode仙上主天 the privateStringObjectFieldUnicode仙上主天 to set
*/
@ -512,14 +572,12 @@ public class TestBean {
}
/*
* @return the privateDateObjectField
public Date getPrivateDateObjectField() {
return privateDateObjectField;
}*/
*
* public Date getPrivateDateObjectField() { return privateDateObjectField; }
*/
/*
* @param privateDateObjectField the privateDateObjectField to set
public void setPrivateDateObjectField(Date privateDateObjectField) {
this.privateDateObjectField = privateDateObjectField;
}*/
*
* public void setPrivateDateObjectField(Date privateDateObjectField) { this.privateDateObjectField = privateDateObjectField; }
*/
}

View file

@ -30,12 +30,35 @@ public class TestObjectChild {
private Object parent = null;
// Some test methods
public String getName() { return name; }
public void setName(String name) { this.name = name; }
public Integer getPrice() { return price; }
public void setPrice(Integer price) { this.price = price; }
public Double getSize() { return size; }
public void setSize(Double size) { this.size = size; }
public Object getParent() { return parent; }
public void setParent(Object parent) { this.parent = parent; }
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Integer getPrice() {
return price;
}
public void setPrice(Integer price) {
this.price = price;
}
public Double getSize() {
return size;
}
public void setSize(Double size) {
this.size = size;
}
public Object getParent() {
return parent;
}
public void setParent(Object parent) {
this.parent = parent;
}
}

View file

@ -76,5 +76,4 @@ public class TestObjectRoot {
return testObjects;
}
}

View file

@ -31,8 +31,7 @@ import javax.swing.JOptionPane;
/**
* Accelerator2 test demo.
*
* see swixml sample; http://www.swixml.org/samples/src/Accelerator.java
* Added exitMethod and render boolean for unit testing.
* see swixml sample; http://www.swixml.org/samples/src/Accelerator.java Added exitMethod and render boolean for unit testing.
*
* @author Willem Cazander
* @version 1.0 Aug 15, 2012

View file

@ -47,11 +47,13 @@ public class SwiXmlDriver extends X4ODriver<Component> {
/**
* Helper for while parsing to get the SwingEngine.
*
* @param elementLanguage The elementLanguage to get the swingEngine out.
* @return Returns the SwingEngine for this elementLanguage.
*/
static public SwingEngine getSwingEngine(X4OLanguageSession elementLanguage) {
ValueExpression ee = elementLanguage.getExpressionLanguageFactory().createValueExpression(elementLanguage.getExpressionLanguageContext(),"${"+SwiXmlDriver.LANGUAGE_EL_SWING_ENGINE+"}",Object.class);
ValueExpression ee = elementLanguage.getExpressionLanguageFactory().createValueExpression(elementLanguage.getExpressionLanguageContext(),
"${" + SwiXmlDriver.LANGUAGE_EL_SWING_ENGINE + "}", Object.class);
SwingEngine se = (SwingEngine) ee.getValue(elementLanguage.getExpressionLanguageContext());
return se;
}

View file

@ -76,5 +76,4 @@ public class ColorConverter extends AbstractStringObjectConverter {
return result;
}
}

View file

@ -52,7 +52,6 @@ public class IconConverter extends AbstractStringObjectConverter {
public Object convertStringTo(String str, Locale locale) throws ObjectConverterException {
try {
Icon icon = UIManager.getIcon("OptionPane.questionIcon");
return icon;
} catch (Exception e) {
throw new ObjectConverterException(this, e.getMessage(), e);
@ -66,5 +65,4 @@ public class IconConverter extends AbstractStringObjectConverter {
return result;
}
}

View file

@ -65,5 +65,4 @@ public class KeyStrokeConverter extends AbstractStringObjectConverter {
return result;
}
}

View file

@ -106,5 +106,4 @@ public class LayoutConverter extends AbstractStringObjectConverter {
return result;
}
}

View file

@ -39,6 +39,5 @@ public interface MaisDocProjectPerspectiveWing {
// use: doc.addConcept
// use: doc.addDocPage
// use: waspNode.addNode
}

View file

@ -55,6 +55,7 @@ public class MaisDocWriter {
private final static String PROPERTY_CONTEXT_PREFIX = SAX3PropertyConfig.X4O_PROPERTIES_PREFIX + "api-doc/";
public final static SAX3PropertyConfig DEFAULT_PROPERTY_CONFIG;
//@formatter:off
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";
@ -92,6 +93,7 @@ public class MaisDocWriter {
new PropertyConfigItem(PAGE_PRINT_HELP,Boolean.class,true)
);
}
//@formatter:on
/** The config of this writer. */
private final SAX3PropertyConfig propertyConfig;
@ -103,6 +105,7 @@ public class MaisDocWriter {
/**
* Writes the language documentation to the base path.
*
* @throws IOException Is thrown when error is done.
*/
public void writeDocumentation() throws IOException {
@ -114,6 +117,7 @@ public class MaisDocWriter {
/**
* Creates a fully configured ApiDoc object.
*
* @return The ApiDoc configured to write eld documentation.
*/
private MaisDoc buildLanguageDoc() {

View file

@ -40,7 +40,8 @@ import org.x4o.sax3.SAX3WriterHtml.Tag;
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());
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 {
@ -48,6 +49,7 @@ public class DefaultPageWriterHelp implements MaisDocPageWriter {
// ApiDocPage page = e.getEvent();
MaisDocContentWriter writer = e.getWriter();
//@formatter:off
writer.printTagStart(Tag.div,"header");
writer.printTagCharacters(Tag.h1, "How This API Document Is Organized", "title");
writer.printTagStart(Tag.div, "subTitle");
@ -73,5 +75,6 @@ public class DefaultPageWriterHelp implements MaisDocPageWriter {
}
writer.docPageBlockEnd();
writer.docPageContentEnd();
//@formatter:on
}
}

View file

@ -71,8 +71,7 @@ public enum MaisDocContentCss {
// frame names maybe can be used to create frame-less html5 JS version
frameNavOverview,
frameNavDetail,
frameContent,
;
frameContent,;
//
// TODO: write new CSS spec for html root tag to have tag+style class guards in CSS.
// because this sun css of above defines the allowed (styled) html tree structure.

View file

@ -59,12 +59,7 @@ public interface MaisDocContentPrinter {
}
default void printApiTable(MaisDocWriteEvent<MaisDocNode> event, String name, Class<?> interfaceClass) throws IOException {
printApiTable(
event.getEventObject(),
filterUserDataClassType(event.getEventObject(),interfaceClass),
event.getWriter(),
name
);
printApiTable(event.getEventObject(), filterUserDataClassType(event.getEventObject(), interfaceClass), event.getWriter(), name);
}
default void printApiTable(MaisDocNode parent, List<MaisDocNode> nodes, MaisDocContentWriter writer, String name) throws IOException {
@ -105,7 +100,8 @@ public interface MaisDocContentPrinter {
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 {
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()) {

View file

@ -56,6 +56,7 @@ public class MaisDocContentWriter extends SAX3WriterHtml {
printHtmlStart("en");
// ====== Write head
//@formatter:off
printTagStart(Tag.head);
docCommentGenerated();
printHeadMetaContentType();
@ -67,6 +68,7 @@ public class MaisDocContentWriter extends SAX3WriterHtml {
printHeadLinkCss(pathPrefix+"resources/stylesheet.css");
printScriptSrc(pathPrefix+"resources/api-theme.js");
printTagEnd(Tag.head);
//@formatter:on
// ======= Write body
printTagStart(Tag.body);
@ -75,7 +77,9 @@ public class MaisDocContentWriter extends SAX3WriterHtml {
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\tparent.document.title=\"");
script.append(title);
script.append("\";\n");
script.append("\t\t} catch (e) {}\n");
script.append("\t}\n");
printScriptInline(script.toString());
@ -83,11 +87,13 @@ public class MaisDocContentWriter extends SAX3WriterHtml {
}
public void docHtmlEnd(String copyright, String statsJS) throws IOException {
//@formatter:off
printTagStart(Tag.p,MaisDocContentCss.legalCopy);
printTagStart(Tag.small);
printCharacters(copyright);
printTagEnd(Tag.small);
printTagEnd(Tag.p);
//@formatter:on
if (statsJS != null) {
printScriptInline(statsJS);
}
@ -113,6 +119,7 @@ public class MaisDocContentWriter extends SAX3WriterHtml {
}
public void docPagePackageTitle(String title, String summary) throws IOException {
//@formatter:off
printTagStart(Tag.div, MaisDocContentCss.header);
printTagCharacters(Tag.h1, title, "title");
printTagStart(Tag.div, MaisDocContentCss.docSummary);
@ -123,6 +130,7 @@ public class MaisDocContentWriter extends SAX3WriterHtml {
printHref("#package_description", "Description");
printTagEnd(Tag.p);
printTagEnd(Tag.div);
//@formatter:on
}
public void docPagePackageDescription(String title, String summary, String description) throws IOException {
@ -204,10 +212,12 @@ public class MaisDocContentWriter extends SAX3WriterHtml {
}
printTagStart(Tag.table, atts);
//@formatter:off
printTagStart(Tag.caption);
printTagStart(Tag.span);printCharacters(tableTitle);printTagEnd(Tag.span);
printTagStart(Tag.span,MaisDocContentCss.tabEnd);printCharacters("&nbsp;");printTagEnd(Tag.span);
printTagEnd(Tag.caption);
//@formatter:on
}
public void docTableEnd() throws IOException {
@ -270,7 +280,8 @@ public class MaisDocContentWriter extends SAX3WriterHtml {
return () -> printTagEnd(Tag.tr);
}
private void docTableRowHref(String dataFirstHref, String dataFirst, String dataLast, String dataBlock, boolean dataFirstCode, boolean dataLastCode, boolean skipLast) throws IOException {
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);
@ -300,6 +311,7 @@ public class MaisDocContentWriter extends SAX3WriterHtml {
return;
}
//@formatter:off
printTagStart(Tag.td,MaisDocContentCss.colLast);
if (dataLastCode) {
printTagStart(Tag.code);printCharacters(dataLast);printTagEnd(Tag.code);
@ -310,11 +322,11 @@ public class MaisDocContentWriter extends SAX3WriterHtml {
printTagStart(Tag.div, MaisDocContentCss.block);printCharacters(dataBlock);printTagEnd(Tag.div);
}
printTagEnd(Tag.td);
//@formatter:on
tableRow.close();
}
static public String toSafeUri(List<String> paths) {
return toSafeUri(paths.toArray(new String[] {}));
}

View file

@ -70,6 +70,7 @@ public class MaisDocGenerator implements MaisDocContentPrinter {
/**
* Writes full api doc tree files to the base path.
*
* @param doc The ApiDoc to writer.
* @param basePath The bath path to write into.
* @throws IOException When file exception happens.
@ -252,18 +253,30 @@ public class MaisDocGenerator implements MaisDocContentPrinter {
writer.docPageBlockStart();
}
if (bodyWriterSummary.isEmpty() && event.getEventObject().getNodes().isEmpty() == false) {
if (!isPageMode) { writer.docPageBlockStart(); }
if (!isPageMode) {
writer.docPageBlockStart();
}
defaultWriteSummary(event.getEventObject(), writer);
if (!isPageMode) { writer.docPageBlockEnd(); }
if (!isPageMode) {
writer.docPageBlockEnd();
}
}
for (int i = 0; i < bodyWriterSummary.size(); i++) {
MaisDocNodeWriter nodeWriter = bodyWriterSummary.get(i);
if (!isPageMode) { writer.docPageBlockStart(); }
if (!isPageMode) {
writer.docPageBlockStart();
}
writeSubNavNamedHref(event, nodeWriter);
if (!isPageMode) { writer.printTagCharacters(Tag.h3, "Summary"); }
if (!isPageMode) {
writer.printTagCharacters(Tag.h3, "Summary");
}
nodeWriter.writeNodeContent(event);
if (!isPageMode) { writer.docPageBlockEnd(); }
if (isPageMode) { writer.printTagStartEnd(Tag.br); }
if (!isPageMode) {
writer.docPageBlockEnd();
}
if (isPageMode) {
writer.printTagStartEnd(Tag.br);
}
}
if (!isPageMode) {
writer.docPageBlockEnd();
@ -492,9 +505,11 @@ public class MaisDocGenerator implements MaisDocContentPrinter {
private class ApiDocNodeWriterComparator implements Comparator<MaisDocNodeWriter> {
final Class<?> objClass;
public ApiDocNodeWriterComparator(Class<?> objClass) {
this.objClass = objClass;
}
public int compare(MaisDocNodeWriter o1, MaisDocNodeWriter o2) {
int index1 = -1;
int index2 = -1;
@ -614,17 +629,10 @@ public class MaisDocGenerator implements MaisDocContentPrinter {
writer.printTagEnd(Tag.head);
}
private static final String FRAME_JS = "\n"+
"targetPage = \"\" + window.location.search;\n"+
"if (targetPage != \"\" && targetPage != \"undefined\")\n"+
"\t { targetPage = targetPage.substring(1); }\n"+
"if (targetPage.indexOf(\":\") != -1)\n"+
"\t { targetPage = \"undefined\"; }\n"+
"function loadFrames() {\n"+
"\tif (targetPage != \"\" && targetPage != \"undefined\")\n"+
"\t\t { top."+MaisDocContentCss.frameContent.name()+".location = top.targetPage; }\n"+
"}\n";
private static final String FRAME_JS = "\n" + "targetPage = \"\" + window.location.search;\n" + "if (targetPage != \"\" && targetPage != \"undefined\")\n"
+ "\t { targetPage = targetPage.substring(1); }\n" + "if (targetPage.indexOf(\":\") != -1)\n" + "\t { targetPage = \"undefined\"; }\n"
+ "function loadFrames() {\n" + "\tif (targetPage != \"\" && targetPage != \"undefined\")\n" + "\t\t { top." + MaisDocContentCss.frameContent.name()
+ ".location = top.targetPage; }\n" + "}\n";
public void writeIndex() throws IOException {
File outputFile = createOutputPathFile(basePath, "index.html");
@ -675,7 +683,8 @@ public class MaisDocGenerator implements MaisDocContentPrinter {
writer.printScriptNoDiv();
writer.printTagCharacters(Tag.h2, "Frame Alert");
writer.printTagStart(Tag.p);
writer.printCharacters("This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to ");
writer.printCharacters(
"This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to ");
writer.printHref(rootLink, "Non-frame version");
writer.printCharacters(".");
writer.printTagEnd(Tag.p);
@ -817,7 +826,8 @@ public class MaisDocGenerator implements MaisDocContentPrinter {
if (searchNode.getParent() != null && !node.getParent().getParent().getId().equals(searchNode.getParent().getId())) {
continue;
}
if (searchNode.getParent().getParent()!=null && !node.getParent().getParent().getParent().getId().equals(searchNode.getParent().getParent().getId())) {
if (searchNode.getParent().getParent() != null
&& !node.getParent().getParent().getParent().getId().equals(searchNode.getParent().getParent().getId())) {
continue;
}
}
@ -1058,7 +1068,6 @@ public class MaisDocGenerator implements MaisDocContentPrinter {
writer.printScriptInline(buf.toString());
}
writer.docNavBarAbout(doc.getDocAbout());
writer.printTagEnd(Tag.div); // end barCssDiv
@ -1128,7 +1137,9 @@ public class MaisDocGenerator implements MaisDocContentPrinter {
writer.printTagStart(Tag.div); // don't print empty div
}
writer.printTagStart(Tag.ul, MaisDocContentCss.subNavList);
writer.printTagStart(Tag.li);writer.printCharacters(groupName+":&nbsp;");writer.printTagEnd(Tag.li);
writer.printTagStart(Tag.li);
writer.printCharacters(groupName + ":&nbsp;");
writer.printTagEnd(Tag.li);
for (int l = 0; l < links.size(); l++) {
MaisDocNavLink link = links.get(l);
writer.printTagStart(Tag.li);
@ -1158,7 +1169,8 @@ public class MaisDocGenerator implements MaisDocContentPrinter {
writer.printComment("========= END OF " + barComment + " NAVBAR =======");
}
private void docNavBarListItemHref(MaisDocContentWriter writer, String href, String title, String text, String cssClass, String spanCss, String linkSpace) throws IOException {
private void docNavBarListItemHref(MaisDocContentWriter writer, String href, String title, String text, String cssClass, String spanCss, String linkSpace)
throws IOException {
writer.printTagStart(Tag.li, cssClass);
writer.printHref(href, text, title, spanCss);
writer.printCharacters(linkSpace);

View file

@ -79,7 +79,8 @@ public class MaisDocNodeWriterBean implements MaisDocNodeWriter {
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.");
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>();

View file

@ -122,12 +122,12 @@ public class MaisDoc {
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";
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";
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());
@ -216,21 +216,9 @@ public class MaisDoc {
Class<?> objClass = node.getUserData().getClass();
return findConceptByClass(objClass);
/*
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;
* 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;
*/
}
@ -356,6 +344,7 @@ public class MaisDoc {
/**
* Creates default copyright message for owner.
*
* @param owner The owner of the copyright.
*/
public void createDocCopyright(String owner) {
@ -366,6 +355,7 @@ public class MaisDoc {
/**
* Creates default copyright message for owner and year.
*
* @param owner The owner of the copyright.
* @param year The year of the copyright.
*/

View file

@ -159,6 +159,4 @@ public class MaisDocConcept {
this.parent = parent;
}
}

View file

@ -29,10 +29,12 @@ package org.x4o.maisdoc.model;
* @version 1.0 May 12, 2013
*/
public enum MaisDocNodeBody {
//@formatter:off
TREE_PATH,
DESCRIPTION_LINKS,
DESCRIPTION_NODE,
SUMMARY,
DETAIL
DETAIL,
;
//@formatter:on
}

View file

@ -34,9 +34,13 @@ import java.util.List;
public interface MaisDocNodeWriter {
MaisDocNodeBody getNodeBody();
List<Class<?>> getTargetClasses();
List<Integer> getNodeBodyOrders();
String getContentGroup();
String getContentGroupType();
void writeNodeContent(MaisDocWriteEvent<MaisDocNode> e) throws IOException;

View file

@ -56,6 +56,7 @@ public class MaisDocRemoteClass {
/**
* Creates the ApiDocRemoteClass with a javadoc url to fetch the package-list from.
*
* @param docUrl The remote javadoc base url.
*/
public MaisDocRemoteClass(String docUrl) {
@ -65,6 +66,7 @@ public class MaisDocRemoteClass {
/**
* 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.
*/
@ -75,6 +77,7 @@ public class MaisDocRemoteClass {
/**
* 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.
*/
@ -101,6 +104,7 @@ public class MaisDocRemoteClass {
/**
* Cleans the docUrl by sometimes appending postfix slash.
*
* @return The cleaned doc url.
*/
private String getDocUrlClean() {
@ -113,6 +117,7 @@ public class MaisDocRemoteClass {
/**
* Fetches and parses the package-list file.
*
* @throws IOException If error happend.
*/
public void parseRemotePackageList() throws IOException {
@ -128,6 +133,7 @@ public class MaisDocRemoteClass {
/**
* Parsed the inputStream into the packagList values.
*
* @param in The inputStream.
* @param enc The encoding of the inputStream.
* @throws IOException When error on inputStream.

View file

@ -39,6 +39,7 @@ public class MaisDocWriteEvent<T> {
/**
* 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.

View file

@ -32,7 +32,6 @@ import org.x4o.xml.lang.task.X4OLanguageTaskException;
import org.x4o.xml.lang.task.run.X4OTaskProperty;
import org.x4o.xml.lang.task.run.X4OTaskRunner;
/**
* AbstractX4OLanguageTask is base ant x4o language task executor.
*
@ -57,6 +56,7 @@ public class X4OTask extends Task {
/**
* Adds the ant child x4oTaskProperty element.
*
* @param property
*/
public void addX4oTaskProperty(X4OTaskProperty property) {
@ -65,6 +65,7 @@ public class X4OTask extends Task {
/**
* Executes the x4o eld schema task.
*
* @see org.apache.tools.ant.Task#execute()
*/
@Override

View file

@ -72,15 +72,19 @@ public class X4OWriteLanguageDocTaskTest extends BuildFileTest {
public void testFailAllMissing() {
expectBuildException("test-fail-all", "Should get exception with no attributes.");
}
public void testFailBasePath() {
expectBuildException("test-fail-destdir", "Should get exception id destdir is not set.");
}
public void testFailBasePathError() {
expectBuildException("test-fail-destdir-error", "Should get exception id destdir does not exists.");
}
public void testFailLanguage() {
expectBuildException("test-fail-language", "Should get exception id language is not set.");
}
public void testFailLanguageError() {
expectBuildException("test-fail-language-error", "Should get exception id language throws error.");
}

View file

@ -64,15 +64,19 @@ public class X4OWriteLanguageSchemaTaskTest extends BuildFileTest {
public void testFailAllMissing() {
expectBuildException("test-fail-all", "Should get exception if no attributes are set.");
}
public void testFailBasePath() {
expectBuildException("test-fail-destdir", "Should get exception id destdir is not set.");
}
public void testFailBasePathError() {
expectBuildException("test-fail-destdir-error", "Should get exception id destdir does not exists.");
}
public void testFailLanguage() {
expectBuildException("test-fail-language", "Should get exception id language is not set.");
}
public void testFailLanguageError() {
expectBuildException("test-fail-language-error", "Should get exception id language throws error.");
}

View file

@ -167,12 +167,14 @@ public class X4OLanguageTaskMojo extends AbstractMojo {
public void setLanguageVersion(String languageVersion) {
this.languageVersion = languageVersion;
}
/**
* @return the taskId
*/
public String getTaskId() {
return taskId;
}
/**
* @param taskId the taskId to set
*/

View file

@ -75,46 +75,26 @@ public class X4OLanguageTaskMojoTest extends AbstractMojoTestCase {
}
/*
public void testConfLangWriteDoc() throws Exception {
executeGoal(X4OLanguageTaskMojo.GOAL,"src/test/resources/junit/test-plugin-conf-lang.pom");
File outputDir = new File("target/jtest/test-plugin-conf-lang/cel");
int files = outputDir.listFiles().length;
assertEquals("Should created more then one files", true, files>1);
}
public void testConfDefaultsWriteDoc() throws Exception {
executeGoal(X4OLanguageTaskMojo.GOAL,"src/test/resources/junit/test-plugin-defaults.pom");
File outputDir = new File("target/x4o/doc-cel-1.0");
int files = outputDir.listFiles().length;
assertEquals("Should created more then two files", true, files>2);
outputDir = new File("target/x4o/doc-eld-1.0");
files = outputDir.listFiles().length;
assertEquals("Should created more then two files", true, files>2);
}
public void testConfAllWriteSchema() throws Exception {
executeGoal(X4OLanguageTaskMojo.GOAL,"src/test/resources/junit/test-plugin-conf-all.pom");
File outputDir = new File("target/jtest/test-plugin-conf-all/xsd-eld-1.0");
assertTrue(outputDir.exists());
int files = outputDir.listFiles().length;
assertEquals("Should created more then two files", true, files>2);
}
public void testConfLangWriteSchema() throws Exception {
executeGoal(X4OLanguageTaskMojo.GOAL,"src/test/resources/junit/test-plugin-conf-lang.pom");
File outputDir = new File("target/jtest/test-plugin-conf-lang/xsd-cel-1.0");
int files = outputDir.listFiles().length;
assertEquals("Should created more then one file", true, files>1);
}
public void testConfDefaultsWriteSchema() throws Exception {
executeGoal(X4OLanguageTaskMojo.GOAL,"src/test/resources/junit/test-plugin-defaults.pom");
File outputDir = new File("target/x4o/xsd-cel-1.0");
int files = outputDir.listFiles().length;
assertEquals("Should created more then one file", true, files>1);
outputDir = new File("target/x4o/xsd-eld-1.0");
files = outputDir.listFiles().length;
assertEquals("Should created more then two files", true, files>2);
}
* public void testConfLangWriteDoc() throws Exception { executeGoal(X4OLanguageTaskMojo.GOAL,"src/test/resources/junit/test-plugin-conf-lang.pom"); File
* outputDir = new File("target/jtest/test-plugin-conf-lang/cel"); int files = outputDir.listFiles().length;
* assertEquals("Should created more then one files", true, files>1); }
*
* public void testConfDefaultsWriteDoc() throws Exception { executeGoal(X4OLanguageTaskMojo.GOAL,"src/test/resources/junit/test-plugin-defaults.pom"); File
* outputDir = new File("target/x4o/doc-cel-1.0"); int files = outputDir.listFiles().length; assertEquals("Should created more then two files", true,
* files>2); outputDir = new File("target/x4o/doc-eld-1.0"); files = outputDir.listFiles().length; assertEquals("Should created more then two files", true,
* files>2); }
*
* public void testConfAllWriteSchema() throws Exception { executeGoal(X4OLanguageTaskMojo.GOAL,"src/test/resources/junit/test-plugin-conf-all.pom"); File
* outputDir = new File("target/jtest/test-plugin-conf-all/xsd-eld-1.0"); assertTrue(outputDir.exists()); int files = outputDir.listFiles().length;
* assertEquals("Should created more then two files", true, files>2); }
*
* public void testConfLangWriteSchema() throws Exception { executeGoal(X4OLanguageTaskMojo.GOAL,"src/test/resources/junit/test-plugin-conf-lang.pom"); File
* outputDir = new File("target/jtest/test-plugin-conf-lang/xsd-cel-1.0"); int files = outputDir.listFiles().length;
* assertEquals("Should created more then one file", true, files>1); }
*
* public void testConfDefaultsWriteSchema() throws Exception { executeGoal(X4OLanguageTaskMojo.GOAL,"src/test/resources/junit/test-plugin-defaults.pom");
* File outputDir = new File("target/x4o/xsd-cel-1.0"); int files = outputDir.listFiles().length; assertEquals("Should created more then one file", true,
* files>1); outputDir = new File("target/x4o/xsd-eld-1.0"); files = outputDir.listFiles().length; assertEquals("Should created more then two files", true,
* files>2); }
*/
}