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

@ -36,20 +36,20 @@ import org.x4o.xml.test.models.TestObjectRoot;
* @version 1.0 Jul 24, 2006 * @version 1.0 Jul 24, 2006
*/ */
public class SwingTests { public class SwingTests {
public void setUp() throws Exception { public void setUp() throws Exception {
//X4OTesting.initLogging(); // X4OTesting.initLogging();
} }
@Test @Test
public void testSwing() throws Exception { public void testSwing() throws Exception {
TestDriver driver = TestDriver.getInstance(); TestDriver driver = TestDriver.getInstance();
X4OReader<TestObjectRoot> reader = driver.createReader(); X4OReader<TestObjectRoot> reader = driver.createReader();
File f = File.createTempFile("test-swing", ".xml"); File f = File.createTempFile("test-swing", ".xml");
//f.deleteOnExit(); // f.deleteOnExit();
//reader.setProperty(X4OLanguagePropertyKeys.DEBUG_OUTPUT_STREAM, new FileOutputStream(f)); // reader.setProperty(X4OLanguagePropertyKeys.DEBUG_OUTPUT_STREAM, new FileOutputStream(f));
//reader.setProperty(X4OLanguagePropertyKeys.DEBUG_OUTPUT_ELD_PARSER, true); // reader.setProperty(X4OLanguagePropertyKeys.DEBUG_OUTPUT_ELD_PARSER, true);
//reader.readResource("tests/test-swing.xml"); // reader.readResource("tests/test-swing.xml");
//Thread.sleep(30000); // Thread.sleep(30000);
} }
} }

View file

@ -34,32 +34,26 @@ import org.x4o.xml.test.models.TestObjectRoot;
* @version 1.0 Jul 24, 2006 * @version 1.0 Jul 24, 2006
*/ */
public class TagHandlerTest { public class TagHandlerTest {
public void setUp() throws Exception { public void setUp() throws Exception {
//X4OTesting.initLogging(); // X4OTesting.initLogging();
} }
private void printS(Throwable e) { private void printS(Throwable e) {
if (e.getCause()==null) { if (e.getCause() == null) {
e.printStackTrace(); e.printStackTrace();
return; return;
} }
printS(e.getCause()); printS(e.getCause());
} }
@Test @Test
public void testTagHanders() throws Exception { public void testTagHanders() throws Exception {
X4ODriver<TestObjectRoot> driver = TestDriver.getInstance(); X4ODriver<TestObjectRoot> driver = TestDriver.getInstance();
X4OReader<TestObjectRoot> reader = driver.createReader(); X4OReader<TestObjectRoot> reader = driver.createReader();
/* /*
File f = File.createTempFile("test-taghandlers", ".xml"); * File f = File.createTempFile("test-taghandlers", ".xml"); f.deleteOnExit(); reader.setProperty(X4OLanguagePropertyKeys.DEBUG_OUTPUT_STREAM, new
f.deleteOnExit(); * FileOutputStream(f)); try { reader.readResource("tests/test-taghandlers.xml"); } catch (Exception e) { printS(e); }
reader.setProperty(X4OLanguagePropertyKeys.DEBUG_OUTPUT_STREAM, new FileOutputStream(f)); */
try {
reader.readResource("tests/test-taghandlers.xml");
} catch (Exception e) {
printS(e);
}
*/
} }
} }

View file

@ -29,8 +29,8 @@ import org.x4o.xml.test.models.TestObjectRoot;
public class TestDriver extends X4ODriver<TestObjectRoot> { public class TestDriver extends X4ODriver<TestObjectRoot> {
static final public String LANGUAGE_NAME = "test"; static final public String LANGUAGE_NAME = "test";
static final public String[] LANGUAGE_VERSIONS = new String[]{X4ODriver.DEFAULT_LANGUAGE_VERSION}; static final public String[] LANGUAGE_VERSIONS = new String[] { X4ODriver.DEFAULT_LANGUAGE_VERSION };
@Override @Override
public String getLanguageName() { public String getLanguageName() {
return LANGUAGE_NAME; return LANGUAGE_NAME;
@ -40,8 +40,8 @@ public class TestDriver extends X4ODriver<TestObjectRoot> {
public String[] getLanguageVersions() { public String[] getLanguageVersions() {
return LANGUAGE_VERSIONS; return LANGUAGE_VERSIONS;
} }
static public TestDriver getInstance() { static public TestDriver getInstance() {
return (TestDriver)X4ODriverManager.getX4ODriver(LANGUAGE_NAME); return (TestDriver) X4ODriverManager.getX4ODriver(LANGUAGE_NAME);
} }
} }

View file

@ -31,12 +31,12 @@ import java.util.logging.LogManager;
* @author Willem Cazander * @author Willem Cazander
* @version 1.0 Jul 24, 2006 * @version 1.0 Jul 24, 2006
*/ */
public class X4OTesting { public class X4OTesting {
static public void initLogging() throws Exception { static public void initLogging() throws Exception {
// enable all logs // enable all logs
InputStream loggingProperties = Class.class.getClass().getResourceAsStream("/META-INF/logging.properties"); // todo: fix loading InputStream loggingProperties = Class.class.getClass().getResourceAsStream("/META-INF/logging.properties"); // todo: fix loading
LogManager.getLogManager().readConfiguration( loggingProperties ); LogManager.getLogManager().readConfiguration(loggingProperties);
loggingProperties.close(); loggingProperties.close();
} }
} }

View file

@ -36,20 +36,20 @@ import org.x4o.xml.test.models.TestObjectRoot;
* @version 1.0 Aug 31, 2012 * @version 1.0 Aug 31, 2012
*/ */
public class XIncludeTest { public class XIncludeTest {
@Test @Test
public void testXInclude() throws Exception { public void testXInclude() throws Exception {
TestDriver driver = TestDriver.getInstance(); TestDriver driver = TestDriver.getInstance();
X4OReader<TestObjectRoot> reader = driver.createReader(); X4OReader<TestObjectRoot> reader = driver.createReader();
TestObjectRoot root = reader.readResource("tests/xinclude/include-base.xml"); TestObjectRoot root = reader.readResource("tests/xinclude/include-base.xml");
Assertions.assertNotNull(root); Assertions.assertNotNull(root);
TestObjectRoot parentRoot = (TestObjectRoot)root; TestObjectRoot parentRoot = (TestObjectRoot) root;
if (parentRoot.getTestObjectParents().size()==0) { if (parentRoot.getTestObjectParents().size() == 0) {
return; // FIXME: don't fail, as on jdk7 it 'sometimes' fails ... return; // FIXME: don't fail, as on jdk7 it 'sometimes' fails ...
} }
Assertions.assertEquals(1,parentRoot.getTestObjectParents().size()); Assertions.assertEquals(1, parentRoot.getTestObjectParents().size());
TestObjectParent parent = parentRoot.getTestObjectParents().get(0); TestObjectParent parent = parentRoot.getTestObjectParents().get(0);
TestObjectChild child = parent.testObjectChilds.get(0); TestObjectChild child = parent.testObjectChilds.get(0);
Assertions.assertEquals("include-child.xml",child.getName()); Assertions.assertEquals("include-child.xml", child.getName());
} }
} }

View file

@ -20,13 +20,12 @@
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * 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. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
package org.x4o.xml.test.element; package org.x4o.xml.test.element;
import javax.swing.JFrame; import javax.swing.JFrame;
import org.x4o.xml.element.AbstractElement; import org.x4o.xml.element.AbstractElement;
/** /**
* *
* @author Willem Cazander * @author Willem Cazander
@ -39,6 +38,6 @@ public class ContentPaneElement extends AbstractElement {
*/ */
@Override @Override
public Object getElementObject() { public Object getElementObject() {
return ((JFrame)this.getParent().getElementObject()).getContentPane(); return ((JFrame) this.getParent().getElementObject()).getContentPane();
} }
} }

View file

@ -29,7 +29,7 @@ import org.x4o.xml.element.AbstractElement;
import org.x4o.xml.element.ElementException; import org.x4o.xml.element.ElementException;
/** /**
* InlinePropertiesElement to test * InlinePropertiesElement to test
* *
* @author Willem Cazander * @author Willem Cazander
* @version 1.0 Jan 23, 2012 * @version 1.0 Jan 23, 2012
@ -37,7 +37,7 @@ import org.x4o.xml.element.ElementException;
public class InlinePropertiesElement extends AbstractElement { public class InlinePropertiesElement extends AbstractElement {
StringWriter xmlString = null; StringWriter xmlString = null;
/** /**
* @see org.x4o.xml.element.AbstractElement#doElementStart() * @see org.x4o.xml.element.AbstractElement#doElementStart()
*/ */

View file

@ -20,14 +20,12 @@
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * 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. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
package org.x4o.xml.test.element; package org.x4o.xml.test.element;
import org.x4o.xml.element.AbstractElementConfigurator; import org.x4o.xml.element.AbstractElementConfigurator;
import org.x4o.xml.element.Element; import org.x4o.xml.element.Element;
import org.x4o.xml.element.ElementConfiguratorException; import org.x4o.xml.element.ElementConfiguratorException;
/** /**
* TestElementConfigurator * TestElementConfigurator
* *
@ -37,6 +35,6 @@ import org.x4o.xml.element.ElementConfiguratorException;
public class TestElementConfigurator extends AbstractElementConfigurator { public class TestElementConfigurator extends AbstractElementConfigurator {
public void doConfigElement(Element element) throws ElementConfiguratorException { public void doConfigElement(Element element) throws ElementConfiguratorException {
} }
} }

View file

@ -20,7 +20,7 @@
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * 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. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
package org.x4o.xml.test.element; package org.x4o.xml.test.element;
import org.x4o.xml.element.AbstractElementNamespaceAttribute; import org.x4o.xml.element.AbstractElementNamespaceAttribute;
import org.x4o.xml.element.Element; import org.x4o.xml.element.Element;

View file

@ -27,118 +27,134 @@ public class TestAttributeOrderChild extends TestObjectChild {
private String aaaName = null; private String aaaName = null;
private String aabName = null; private String aabName = null;
private String aacName = null; private String aacName = null;
private String abaName = null; private String abaName = null;
private String abbName = null; private String abbName = null;
private String abcName = null; private String abcName = null;
private String caaName = null; private String caaName = null;
private String cabName = null; private String cabName = null;
private String cacName = null; private String cacName = null;
/** /**
* @return the caaName * @return the caaName
*/ */
public String getCaaName() { public String getCaaName() {
return caaName; return caaName;
} }
/** /**
* @param caaName the caaName to set * @param caaName the caaName to set
*/ */
public void setCaaName(String caaName) { public void setCaaName(String caaName) {
this.caaName = caaName; this.caaName = caaName;
} }
/** /**
* @return the cabName * @return the cabName
*/ */
public String getCabName() { public String getCabName() {
return cabName; return cabName;
} }
/** /**
* @param cabName the cabName to set * @param cabName the cabName to set
*/ */
public void setCabName(String cabName) { public void setCabName(String cabName) {
this.cabName = cabName; this.cabName = cabName;
} }
/** /**
* @return the cacName * @return the cacName
*/ */
public String getCacName() { public String getCacName() {
return cacName; return cacName;
} }
/** /**
* @param cacName the cacName to set * @param cacName the cacName to set
*/ */
public void setCacName(String cacName) { public void setCacName(String cacName) {
this.cacName = cacName; this.cacName = cacName;
} }
/** /**
* @return the aaaName * @return the aaaName
*/ */
public String getAaaName() { public String getAaaName() {
return aaaName; return aaaName;
} }
/** /**
* @param aaaName the aaaName to set * @param aaaName the aaaName to set
*/ */
public void setAaaName(String aaaName) { public void setAaaName(String aaaName) {
this.aaaName = aaaName; this.aaaName = aaaName;
} }
/** /**
* @return the aabName * @return the aabName
*/ */
public String getAabName() { public String getAabName() {
return aabName; return aabName;
} }
/** /**
* @param aabName the aabName to set * @param aabName the aabName to set
*/ */
public void setAabName(String aabName) { public void setAabName(String aabName) {
this.aabName = aabName; this.aabName = aabName;
} }
/** /**
* @return the aacName * @return the aacName
*/ */
public String getAacName() { public String getAacName() {
return aacName; return aacName;
} }
/** /**
* @param aacName the aacName to set * @param aacName the aacName to set
*/ */
public void setAacName(String aacName) { public void setAacName(String aacName) {
this.aacName = aacName; this.aacName = aacName;
} }
/** /**
* @return the abaName * @return the abaName
*/ */
public String getAbaName() { public String getAbaName() {
return abaName; return abaName;
} }
/** /**
* @param abaName the abaName to set * @param abaName the abaName to set
*/ */
public void setAbaName(String abaName) { public void setAbaName(String abaName) {
this.abaName = abaName; this.abaName = abaName;
} }
/** /**
* @return the abbName * @return the abbName
*/ */
public String getAbbName() { public String getAbbName() {
return abbName; return abbName;
} }
/** /**
* @param abbName the abbName to set * @param abbName the abbName to set
*/ */
public void setAbbName(String abbName) { public void setAbbName(String abbName) {
this.abbName = abbName; this.abbName = abbName;
} }
/** /**
* @return the abcName * @return the abcName
*/ */
public String getAbcName() { public String getAbcName() {
return abcName; return abcName;
} }
/** /**
* @param abcName the abcName to set * @param abcName the abcName to set
*/ */

View file

@ -23,253 +23,282 @@
package org.x4o.xml.test.models; package org.x4o.xml.test.models;
/** /**
* Bean for property testing. * Bean for property testing.
* *
* @author Willem Cazander * @author Willem Cazander
* @version 1.0 Jan 15, 2009 * @version 1.0 Jan 15, 2009
*/ */
public class TestBean { public class TestBean {
// TODO: Add public field support, ... and remove public* methods below // TODO: Add public field support, ... and remove public* methods below
public int publicIntegerTypeField = 0; public int publicIntegerTypeField = 0;
public Integer publicIntegerObjectField = new Integer(0); public Integer publicIntegerObjectField = new Integer(0);
public long publicLongTypeField = 0; public long publicLongTypeField = 0;
public Long publicLongObjectField = new Long(0l); public Long publicLongObjectField = new Long(0l);
public double publicDoubleTypeField = 0l; public double publicDoubleTypeField = 0l;
public Double publicDoubleObjectField = new Double(0); public Double publicDoubleObjectField = new Double(0);
public float publicFloatTypeField = 0l; public float publicFloatTypeField = 0l;
public Float publicFloatObjectField = new Float(0); public Float publicFloatObjectField = new Float(0);
public byte publicByteTypeField = 0; public byte publicByteTypeField = 0;
public Byte publicByteObjectField = Byte.valueOf((byte)0); public Byte publicByteObjectField = Byte.valueOf((byte) 0);
public boolean publicBooleanTypeField = false; public boolean publicBooleanTypeField = false;
public Boolean publicBooleanObjectField = new Boolean(false); public Boolean publicBooleanObjectField = new Boolean(false);
public char publicCharTypeField = ' '; public char publicCharTypeField = ' ';
public Character publicCharObjectField = new Character(' '); public Character publicCharObjectField = new Character(' ');
public String publicStringObjectField = "𑀳𑁂𑀮𑀺𑀉𑁄𑀤𑁄𑀭𑁂𑀡𑀪𑀸𑀕"; public String publicStringObjectField = "𑀳𑁂𑀮𑀺𑀉𑁄𑀤𑁄𑀭𑁂𑀡𑀪𑀸𑀕";
//public String publicStringObjectFieldUnicodeᒡᒢᑊᒻᒻᓫᔿ = " ᒡᒢᑊᒻᒻᓫᔿ"; // public String publicStringObjectFieldUnicodeᒡᒢᑊᒻᒻᓫᔿ = " ᒡᒢᑊᒻᒻᓫᔿ";
public String publicStringObjectFieldUnicode仙上主天 = "仙上主天"; public String publicStringObjectFieldUnicode仙上主天 = "仙上主天";
//public Date publicDateObjectField = new Date(0); // TODO add date converters // public Date publicDateObjectField = new Date(0); // TODO add date converters
// private // private
private int privateIntegerTypeField = 0; private int privateIntegerTypeField = 0;
private Integer privateIntegerObjectField = new Integer(0); private Integer privateIntegerObjectField = new Integer(0);
private long privateLongTypeField = 0; private long privateLongTypeField = 0;
private Long privateLongObjectField = new Long(0l); private Long privateLongObjectField = new Long(0l);
private double privateDoubleTypeField = 0l; private double privateDoubleTypeField = 0l;
private Double privateDoubleObjectField = new Double(0); private Double privateDoubleObjectField = new Double(0);
private float privateFloatTypeField = 0l; private float privateFloatTypeField = 0l;
private Float privateFloatObjectField = new Float(0); private Float privateFloatObjectField = new Float(0);
private byte privateByteTypeField = 0; private byte privateByteTypeField = 0;
private Byte privateByteObjectField = Byte.valueOf((byte)0); private Byte privateByteObjectField = Byte.valueOf((byte) 0);
private boolean privateBooleanTypeField = false; private boolean privateBooleanTypeField = false;
private Boolean privateBooleanObjectField = new Boolean(false); private Boolean privateBooleanObjectField = new Boolean(false);
private char privateCharTypeField = ' '; private char privateCharTypeField = ' ';
private Character privateCharObjectField = new Character(' '); private Character privateCharObjectField = new Character(' ');
private String privateStringObjectField = "𑀳𑁂𑀮𑀺𑀉𑁄𑀤𑁄𑀭𑁂𑀡𑀪𑀸𑀕"; private String privateStringObjectField = "𑀳𑁂𑀮𑀺𑀉𑁄𑀤𑁄𑀭𑁂𑀡𑀪𑀸𑀕";
//private String privateStringObjectFieldUnicodeᒡᒢᑊᒻᒻᓫᔿ = " ᒡᒢᑊᒻᒻᓫᔿ"; // private String privateStringObjectFieldUnicodeᒡᒢᑊᒻᒻᓫᔿ = " ᒡᒢᑊᒻᒻᓫᔿ";
private String privateStringObjectFieldUnicode仙上主天 = "仙上主天"; private String privateStringObjectFieldUnicode仙上主天 = "仙上主天";
//private Date privateDateObjectField = new Date(0); // private Date privateDateObjectField = new Date(0);
// auto gen , get/set-ers // auto gen , get/set-ers
/** /**
* @return the publicIntegerTypeField * @return the publicIntegerTypeField
*/ */
public int getPublicIntegerTypeField() { public int getPublicIntegerTypeField() {
return publicIntegerTypeField; return publicIntegerTypeField;
} }
/** /**
* @param publicIntegerTypeField the publicIntegerTypeField to set * @param publicIntegerTypeField the publicIntegerTypeField to set
*/ */
public void setPublicIntegerTypeField(int publicIntegerTypeField) { public void setPublicIntegerTypeField(int publicIntegerTypeField) {
this.publicIntegerTypeField = publicIntegerTypeField; this.publicIntegerTypeField = publicIntegerTypeField;
} }
/** /**
* @return the publicIntegerObjectField * @return the publicIntegerObjectField
*/ */
public Integer getPublicIntegerObjectField() { public Integer getPublicIntegerObjectField() {
return publicIntegerObjectField; return publicIntegerObjectField;
} }
/** /**
* @param publicIntegerObjectField the publicIntegerObjectField to set * @param publicIntegerObjectField the publicIntegerObjectField to set
*/ */
public void setPublicIntegerObjectField(Integer publicIntegerObjectField) { public void setPublicIntegerObjectField(Integer publicIntegerObjectField) {
this.publicIntegerObjectField = publicIntegerObjectField; this.publicIntegerObjectField = publicIntegerObjectField;
} }
/** /**
* @return the publicLongTypeField * @return the publicLongTypeField
*/ */
public long getPublicLongTypeField() { public long getPublicLongTypeField() {
return publicLongTypeField; return publicLongTypeField;
} }
/** /**
* @param publicLongTypeField the publicLongTypeField to set * @param publicLongTypeField the publicLongTypeField to set
*/ */
public void setPublicLongTypeField(long publicLongTypeField) { public void setPublicLongTypeField(long publicLongTypeField) {
this.publicLongTypeField = publicLongTypeField; this.publicLongTypeField = publicLongTypeField;
} }
/** /**
* @return the publicLongObjectField * @return the publicLongObjectField
*/ */
public Long getPublicLongObjectField() { public Long getPublicLongObjectField() {
return publicLongObjectField; return publicLongObjectField;
} }
/** /**
* @param publicLongObjectField the publicLongObjectField to set * @param publicLongObjectField the publicLongObjectField to set
*/ */
public void setPublicLongObjectField(Long publicLongObjectField) { public void setPublicLongObjectField(Long publicLongObjectField) {
this.publicLongObjectField = publicLongObjectField; this.publicLongObjectField = publicLongObjectField;
} }
/** /**
* @return the publicDoubleTypeField * @return the publicDoubleTypeField
*/ */
public double getPublicDoubleTypeField() { public double getPublicDoubleTypeField() {
return publicDoubleTypeField; return publicDoubleTypeField;
} }
/** /**
* @param publicDoubleTypeField the publicDoubleTypeField to set * @param publicDoubleTypeField the publicDoubleTypeField to set
*/ */
public void setPublicDoubleTypeField(double publicDoubleTypeField) { public void setPublicDoubleTypeField(double publicDoubleTypeField) {
this.publicDoubleTypeField = publicDoubleTypeField; this.publicDoubleTypeField = publicDoubleTypeField;
} }
/** /**
* @return the publicDoubleObjectField * @return the publicDoubleObjectField
*/ */
public Double getPublicDoubleObjectField() { public Double getPublicDoubleObjectField() {
return publicDoubleObjectField; return publicDoubleObjectField;
} }
/** /**
* @param publicDoubleObjectField the publicDoubleObjectField to set * @param publicDoubleObjectField the publicDoubleObjectField to set
*/ */
public void setPublicDoubleObjectField(Double publicDoubleObjectField) { public void setPublicDoubleObjectField(Double publicDoubleObjectField) {
this.publicDoubleObjectField = publicDoubleObjectField; this.publicDoubleObjectField = publicDoubleObjectField;
} }
/** /**
* @return the publicFloatTypeField * @return the publicFloatTypeField
*/ */
public float getPublicFloatTypeField() { public float getPublicFloatTypeField() {
return publicFloatTypeField; return publicFloatTypeField;
} }
/** /**
* @param publicFloatTypeField the publicFloatTypeField to set * @param publicFloatTypeField the publicFloatTypeField to set
*/ */
public void setPublicFloatTypeField(float publicFloatTypeField) { public void setPublicFloatTypeField(float publicFloatTypeField) {
this.publicFloatTypeField = publicFloatTypeField; this.publicFloatTypeField = publicFloatTypeField;
} }
/** /**
* @return the publicFloatObjectField * @return the publicFloatObjectField
*/ */
public Float getPublicFloatObjectField() { public Float getPublicFloatObjectField() {
return publicFloatObjectField; return publicFloatObjectField;
} }
/** /**
* @param publicFloatObjectField the publicFloatObjectField to set * @param publicFloatObjectField the publicFloatObjectField to set
*/ */
public void setPublicFloatObjectField(Float publicFloatObjectField) { public void setPublicFloatObjectField(Float publicFloatObjectField) {
this.publicFloatObjectField = publicFloatObjectField; this.publicFloatObjectField = publicFloatObjectField;
} }
/** /**
* @return the publicByteTypeField * @return the publicByteTypeField
*/ */
public byte getPublicByteTypeField() { public byte getPublicByteTypeField() {
return publicByteTypeField; return publicByteTypeField;
} }
/** /**
* @param publicByteTypeField the publicByteTypeField to set * @param publicByteTypeField the publicByteTypeField to set
*/ */
public void setPublicByteTypeField(byte publicByteTypeField) { public void setPublicByteTypeField(byte publicByteTypeField) {
this.publicByteTypeField = publicByteTypeField; this.publicByteTypeField = publicByteTypeField;
} }
/** /**
* @return the publicByteObjectField * @return the publicByteObjectField
*/ */
public Byte getPublicByteObjectField() { public Byte getPublicByteObjectField() {
return publicByteObjectField; return publicByteObjectField;
} }
/** /**
* @param publicByteObjectField the publicByteObjectField to set * @param publicByteObjectField the publicByteObjectField to set
*/ */
public void setPublicByteObjectField(Byte publicByteObjectField) { public void setPublicByteObjectField(Byte publicByteObjectField) {
this.publicByteObjectField = publicByteObjectField; this.publicByteObjectField = publicByteObjectField;
} }
/** /**
* @return the publicBooleanTypeField * @return the publicBooleanTypeField
*/ */
public boolean isPublicBooleanTypeField() { public boolean isPublicBooleanTypeField() {
return publicBooleanTypeField; return publicBooleanTypeField;
} }
/** /**
* @param publicBooleanTypeField the publicBooleanTypeField to set * @param publicBooleanTypeField the publicBooleanTypeField to set
*/ */
public void setPublicBooleanTypeField(boolean publicBooleanTypeField) { public void setPublicBooleanTypeField(boolean publicBooleanTypeField) {
this.publicBooleanTypeField = publicBooleanTypeField; this.publicBooleanTypeField = publicBooleanTypeField;
} }
/** /**
* @return the publicBooleanObjectField * @return the publicBooleanObjectField
*/ */
public Boolean getPublicBooleanObjectField() { public Boolean getPublicBooleanObjectField() {
return publicBooleanObjectField; return publicBooleanObjectField;
} }
/** /**
* @param publicBooleanObjectField the publicBooleanObjectField to set * @param publicBooleanObjectField the publicBooleanObjectField to set
*/ */
public void setPublicBooleanObjectField(Boolean publicBooleanObjectField) { public void setPublicBooleanObjectField(Boolean publicBooleanObjectField) {
this.publicBooleanObjectField = publicBooleanObjectField; this.publicBooleanObjectField = publicBooleanObjectField;
} }
/** /**
* @return the publicCharTypeField * @return the publicCharTypeField
*/ */
public char getPublicCharTypeField() { public char getPublicCharTypeField() {
return publicCharTypeField; return publicCharTypeField;
} }
/** /**
* @param publicCharTypeField the publicCharTypeField to set * @param publicCharTypeField the publicCharTypeField to set
*/ */
public void setPublicCharTypeField(char publicCharTypeField) { public void setPublicCharTypeField(char publicCharTypeField) {
this.publicCharTypeField = publicCharTypeField; this.publicCharTypeField = publicCharTypeField;
} }
/** /**
* @return the publicCharObjectField * @return the publicCharObjectField
*/ */
public Character getPublicCharObjectField() { public Character getPublicCharObjectField() {
return publicCharObjectField; return publicCharObjectField;
} }
/** /**
* @param publicCharObjectField the publicCharObjectField to set * @param publicCharObjectField the publicCharObjectField to set
*/ */
public void setPublicCharObjectField(Character publicCharObjectField) { public void setPublicCharObjectField(Character publicCharObjectField) {
this.publicCharObjectField = publicCharObjectField; this.publicCharObjectField = publicCharObjectField;
} }
/** /**
* @return the publicStringObjectField * @return the publicStringObjectField
*/ */
public String getPublicStringObjectField() { public String getPublicStringObjectField() {
return publicStringObjectField; return publicStringObjectField;
} }
/** /**
* @param publicStringObjectField the publicStringObjectField to set * @param publicStringObjectField the publicStringObjectField to set
*/ */
public void setPublicStringObjectField(String publicStringObjectField) { public void setPublicStringObjectField(String publicStringObjectField) {
this.publicStringObjectField = publicStringObjectField; this.publicStringObjectField = publicStringObjectField;
} }
// /** // /**
// * @return the publicStringObjectFieldUnicodeᒡᒢᑊᒻᒻᓫᔿ // * @return the publicStringObjectFieldUnicodeᒡᒢᑊᒻᒻᓫᔿ
// */ // */
@ -288,204 +317,234 @@ public class TestBean {
public String getPublicStringObjectFieldUnicode仙上主天() { public String getPublicStringObjectFieldUnicode仙上主天() {
return publicStringObjectFieldUnicode仙上主天; return publicStringObjectFieldUnicode仙上主天;
} }
/** /**
* @param publicStringObjectFieldUnicode仙上主天 the publicStringObjectFieldUnicode仙上主天 to set * @param publicStringObjectFieldUnicode仙上主天 the publicStringObjectFieldUnicode仙上主天 to set
*/ */
public void setPublicStringObjectFieldUnicode仙上主天(String publicStringObjectFieldUnicode仙上主天) { public void setPublicStringObjectFieldUnicode仙上主天(String publicStringObjectFieldUnicode仙上主天) {
this.publicStringObjectFieldUnicode仙上主天 = publicStringObjectFieldUnicode仙上主天; this.publicStringObjectFieldUnicode仙上主天 = publicStringObjectFieldUnicode仙上主天;
} }
/* /*
* @return the publicDateObjectField * @return the publicDateObjectField
*
public Date getPublicDateObjectField() { * public Date getPublicDateObjectField() { return publicDateObjectField; }
return publicDateObjectField; */
}*/
/* /*
* @param publicDateObjectField the publicDateObjectField to set * @param publicDateObjectField the publicDateObjectField to set
*
public void setPublicDateObjectField(Date publicDateObjectField) { * public void setPublicDateObjectField(Date publicDateObjectField) { this.publicDateObjectField = publicDateObjectField; }
this.publicDateObjectField = publicDateObjectField; */
}*/
/** /**
* @return the privateIntegerTypeField * @return the privateIntegerTypeField
*/ */
public int getPrivateIntegerTypeField() { public int getPrivateIntegerTypeField() {
return privateIntegerTypeField; return privateIntegerTypeField;
} }
/** /**
* @param privateIntegerTypeField the privateIntegerTypeField to set * @param privateIntegerTypeField the privateIntegerTypeField to set
*/ */
public void setPrivateIntegerTypeField(int privateIntegerTypeField) { public void setPrivateIntegerTypeField(int privateIntegerTypeField) {
this.privateIntegerTypeField = privateIntegerTypeField; this.privateIntegerTypeField = privateIntegerTypeField;
} }
/** /**
* @return the privateIntegerObjectField * @return the privateIntegerObjectField
*/ */
public Integer getPrivateIntegerObjectField() { public Integer getPrivateIntegerObjectField() {
return privateIntegerObjectField; return privateIntegerObjectField;
} }
/** /**
* @param privateIntegerObjectField the privateIntegerObjectField to set * @param privateIntegerObjectField the privateIntegerObjectField to set
*/ */
public void setPrivateIntegerObjectField(Integer privateIntegerObjectField) { public void setPrivateIntegerObjectField(Integer privateIntegerObjectField) {
this.privateIntegerObjectField = privateIntegerObjectField; this.privateIntegerObjectField = privateIntegerObjectField;
} }
/** /**
* @return the privateLongTypeField * @return the privateLongTypeField
*/ */
public long getPrivateLongTypeField() { public long getPrivateLongTypeField() {
return privateLongTypeField; return privateLongTypeField;
} }
/** /**
* @param privateLongTypeField the privateLongTypeField to set * @param privateLongTypeField the privateLongTypeField to set
*/ */
public void setPrivateLongTypeField(long privateLongTypeField) { public void setPrivateLongTypeField(long privateLongTypeField) {
this.privateLongTypeField = privateLongTypeField; this.privateLongTypeField = privateLongTypeField;
} }
/** /**
* @return the privateLongObjectField * @return the privateLongObjectField
*/ */
public Long getPrivateLongObjectField() { public Long getPrivateLongObjectField() {
return privateLongObjectField; return privateLongObjectField;
} }
/** /**
* @param privateLongObjectField the privateLongObjectField to set * @param privateLongObjectField the privateLongObjectField to set
*/ */
public void setPrivateLongObjectField(Long privateLongObjectField) { public void setPrivateLongObjectField(Long privateLongObjectField) {
this.privateLongObjectField = privateLongObjectField; this.privateLongObjectField = privateLongObjectField;
} }
/** /**
* @return the privateDoubleTypeField * @return the privateDoubleTypeField
*/ */
public double getPrivateDoubleTypeField() { public double getPrivateDoubleTypeField() {
return privateDoubleTypeField; return privateDoubleTypeField;
} }
/** /**
* @param privateDoubleTypeField the privateDoubleTypeField to set * @param privateDoubleTypeField the privateDoubleTypeField to set
*/ */
public void setPrivateDoubleTypeField(double privateDoubleTypeField) { public void setPrivateDoubleTypeField(double privateDoubleTypeField) {
this.privateDoubleTypeField = privateDoubleTypeField; this.privateDoubleTypeField = privateDoubleTypeField;
} }
/** /**
* @return the privateDoubleObjectField * @return the privateDoubleObjectField
*/ */
public Double getPrivateDoubleObjectField() { public Double getPrivateDoubleObjectField() {
return privateDoubleObjectField; return privateDoubleObjectField;
} }
/** /**
* @param privateDoubleObjectField the privateDoubleObjectField to set * @param privateDoubleObjectField the privateDoubleObjectField to set
*/ */
public void setPrivateDoubleObjectField(Double privateDoubleObjectField) { public void setPrivateDoubleObjectField(Double privateDoubleObjectField) {
this.privateDoubleObjectField = privateDoubleObjectField; this.privateDoubleObjectField = privateDoubleObjectField;
} }
/** /**
* @return the privateFloatTypeField * @return the privateFloatTypeField
*/ */
public float getPrivateFloatTypeField() { public float getPrivateFloatTypeField() {
return privateFloatTypeField; return privateFloatTypeField;
} }
/** /**
* @param privateFloatTypeField the privateFloatTypeField to set * @param privateFloatTypeField the privateFloatTypeField to set
*/ */
public void setPrivateFloatTypeField(float privateFloatTypeField) { public void setPrivateFloatTypeField(float privateFloatTypeField) {
this.privateFloatTypeField = privateFloatTypeField; this.privateFloatTypeField = privateFloatTypeField;
} }
/** /**
* @return the privateFloatObjectField * @return the privateFloatObjectField
*/ */
public Float getPrivateFloatObjectField() { public Float getPrivateFloatObjectField() {
return privateFloatObjectField; return privateFloatObjectField;
} }
/** /**
* @param privateFloatObjectField the privateFloatObjectField to set * @param privateFloatObjectField the privateFloatObjectField to set
*/ */
public void setPrivateFloatObjectField(Float privateFloatObjectField) { public void setPrivateFloatObjectField(Float privateFloatObjectField) {
this.privateFloatObjectField = privateFloatObjectField; this.privateFloatObjectField = privateFloatObjectField;
} }
/** /**
* @return the privateByteTypeField * @return the privateByteTypeField
*/ */
public byte getPrivateByteTypeField() { public byte getPrivateByteTypeField() {
return privateByteTypeField; return privateByteTypeField;
} }
/** /**
* @param privateByteTypeField the privateByteTypeField to set * @param privateByteTypeField the privateByteTypeField to set
*/ */
public void setPrivateByteTypeField(byte privateByteTypeField) { public void setPrivateByteTypeField(byte privateByteTypeField) {
this.privateByteTypeField = privateByteTypeField; this.privateByteTypeField = privateByteTypeField;
} }
/** /**
* @return the privateByteObjectField * @return the privateByteObjectField
*/ */
public Byte getPrivateByteObjectField() { public Byte getPrivateByteObjectField() {
return privateByteObjectField; return privateByteObjectField;
} }
/** /**
* @param privateByteObjectField the privateByteObjectField to set * @param privateByteObjectField the privateByteObjectField to set
*/ */
public void setPrivateByteObjectField(Byte privateByteObjectField) { public void setPrivateByteObjectField(Byte privateByteObjectField) {
this.privateByteObjectField = privateByteObjectField; this.privateByteObjectField = privateByteObjectField;
} }
/** /**
* @return the privateBooleanTypeField * @return the privateBooleanTypeField
*/ */
public boolean isPrivateBooleanTypeField() { public boolean isPrivateBooleanTypeField() {
return privateBooleanTypeField; return privateBooleanTypeField;
} }
/** /**
* @param privateBooleanTypeField the privateBooleanTypeField to set * @param privateBooleanTypeField the privateBooleanTypeField to set
*/ */
public void setPrivateBooleanTypeField(boolean privateBooleanTypeField) { public void setPrivateBooleanTypeField(boolean privateBooleanTypeField) {
this.privateBooleanTypeField = privateBooleanTypeField; this.privateBooleanTypeField = privateBooleanTypeField;
} }
/** /**
* @return the privateBooleanObjectField * @return the privateBooleanObjectField
*/ */
public Boolean getPrivateBooleanObjectField() { public Boolean getPrivateBooleanObjectField() {
return privateBooleanObjectField; return privateBooleanObjectField;
} }
/** /**
* @param privateBooleanObjectField the privateBooleanObjectField to set * @param privateBooleanObjectField the privateBooleanObjectField to set
*/ */
public void setPrivateBooleanObjectField(Boolean privateBooleanObjectField) { public void setPrivateBooleanObjectField(Boolean privateBooleanObjectField) {
this.privateBooleanObjectField = privateBooleanObjectField; this.privateBooleanObjectField = privateBooleanObjectField;
} }
/** /**
* @return the privateCharTypeField * @return the privateCharTypeField
*/ */
public char getPrivateCharTypeField() { public char getPrivateCharTypeField() {
return privateCharTypeField; return privateCharTypeField;
} }
/** /**
* @param privateCharTypeField the privateCharTypeField to set * @param privateCharTypeField the privateCharTypeField to set
*/ */
public void setPrivateCharTypeField(char privateCharTypeField) { public void setPrivateCharTypeField(char privateCharTypeField) {
this.privateCharTypeField = privateCharTypeField; this.privateCharTypeField = privateCharTypeField;
} }
/** /**
* @return the privateCharObjectField * @return the privateCharObjectField
*/ */
public Character getPrivateCharObjectField() { public Character getPrivateCharObjectField() {
return privateCharObjectField; return privateCharObjectField;
} }
/** /**
* @param privateCharObjectField the privateCharObjectField to set * @param privateCharObjectField the privateCharObjectField to set
*/ */
public void setPrivateCharObjectField(Character privateCharObjectField) { public void setPrivateCharObjectField(Character privateCharObjectField) {
this.privateCharObjectField = privateCharObjectField; this.privateCharObjectField = privateCharObjectField;
} }
/** /**
* @return the privateStringObjectField * @return the privateStringObjectField
*/ */
public String getPrivateStringObjectField() { public String getPrivateStringObjectField() {
return privateStringObjectField; return privateStringObjectField;
} }
/** /**
* @param privateStringObjectField the privateStringObjectField to set * @param privateStringObjectField the privateStringObjectField to set
*/ */
public void setPrivateStringObjectField(String privateStringObjectField) { public void setPrivateStringObjectField(String privateStringObjectField) {
this.privateStringObjectField = privateStringObjectField; this.privateStringObjectField = privateStringObjectField;
} }
// /** // /**
// * @return the privateStringObjectFieldUnicodeᒡᒢᑊᒻᒻᓫᔿ // * @return the privateStringObjectFieldUnicodeᒡᒢᑊᒻᒻᓫᔿ
// */ // */
@ -504,6 +563,7 @@ public class TestBean {
public String getPrivateStringObjectFieldUnicode仙上主天() { public String getPrivateStringObjectFieldUnicode仙上主天() {
return privateStringObjectFieldUnicode仙上主天; return privateStringObjectFieldUnicode仙上主天;
} }
/** /**
* @param privateStringObjectFieldUnicode仙上主天 the privateStringObjectFieldUnicode仙上主天 to set * @param privateStringObjectFieldUnicode仙上主天 the privateStringObjectFieldUnicode仙上主天 to set
*/ */
@ -512,14 +572,12 @@ public class TestBean {
} }
/* /*
* @return the privateDateObjectField * @return the privateDateObjectField
*
public Date getPrivateDateObjectField() { * public Date getPrivateDateObjectField() { return privateDateObjectField; }
return privateDateObjectField; */
}*/
/* /*
* @param privateDateObjectField the privateDateObjectField to set * @param privateDateObjectField the privateDateObjectField to set
*
public void setPrivateDateObjectField(Date privateDateObjectField) { * public void setPrivateDateObjectField(Date privateDateObjectField) { this.privateDateObjectField = privateDateObjectField; }
this.privateDateObjectField = privateDateObjectField; */
}*/
} }

View file

@ -23,19 +23,42 @@
package org.x4o.xml.test.models; package org.x4o.xml.test.models;
public class TestObjectChild { public class TestObjectChild {
private String name = null; private String name = null;
private Integer price = null; private Integer price = null;
private Double size = null; private Double size = null;
private Object parent = null; private Object parent = null;
// Some test methods // Some test methods
public String getName() { return name; } public String getName() {
public void setName(String name) { this.name = name; } return name;
public Integer getPrice() { return price; } }
public void setPrice(Integer price) { this.price = price; }
public Double getSize() { return size; } public void setName(String name) {
public void setSize(Double size) { this.size = size; } this.name = name;
public Object getParent() { return parent; } }
public void setParent(Object parent) { this.parent = parent; }
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

@ -26,18 +26,18 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
public class TestObjectParent { public class TestObjectParent {
public String name = null; public String name = null;
public List<TestObjectChild> testObjectChilds = new ArrayList<TestObjectChild>(2); public List<TestObjectChild> testObjectChilds = new ArrayList<TestObjectChild>(2);
public void addTestObjectChild(TestObjectChild c) { public void addTestObjectChild(TestObjectChild c) {
testObjectChilds.add(c); testObjectChilds.add(c);
} }
public List<TestObjectChild> getTestObjectChilds() { public List<TestObjectChild> getTestObjectChilds() {
return testObjectChilds; return testObjectChilds;
} }
/** /**
* @return the name * @return the name
*/ */

View file

@ -26,24 +26,24 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
public class TestObjectRoot { public class TestObjectRoot {
private List<TestObjectChild> testObjectChilds = new ArrayList<TestObjectChild>(2); private List<TestObjectChild> testObjectChilds = new ArrayList<TestObjectChild>(2);
private List<TestObjectParent> testObjectParents = new ArrayList<TestObjectParent>(2); private List<TestObjectParent> testObjectParents = new ArrayList<TestObjectParent>(2);
private List<TestBean> testBeans = new ArrayList<TestBean>(2); private List<TestBean> testBeans = new ArrayList<TestBean>(2);
private List<Object> testObjects = new ArrayList<Object>(2); private List<Object> testObjects = new ArrayList<Object>(2);
public void addChild(TestObjectChild c) { public void addChild(TestObjectChild c) {
testObjectChilds.add(c); testObjectChilds.add(c);
} }
public void addParent(TestObjectParent c) { public void addParent(TestObjectParent c) {
testObjectParents.add(c); testObjectParents.add(c);
} }
public void addTestBean(TestBean c) { public void addTestBean(TestBean c) {
testBeans.add(c); testBeans.add(c);
} }
public void addObject(Object c) { public void addObject(Object c) {
testObjects.add(c); testObjects.add(c);
} }
@ -75,6 +75,5 @@ public class TestObjectRoot {
public List<Object> getTestObjects() { public List<Object> getTestObjects() {
return testObjects; return testObjects;
} }
} }

View file

@ -31,45 +31,44 @@ import javax.swing.JOptionPane;
/** /**
* Accelerator2 test demo. * Accelerator2 test demo.
* *
* see swixml sample; http://www.swixml.org/samples/src/Accelerator.java * see swixml sample; http://www.swixml.org/samples/src/Accelerator.java Added exitMethod and render boolean for unit testing.
* Added exitMethod and render boolean for unit testing.
* *
* @author Willem Cazander * @author Willem Cazander
* @version 1.0 Aug 15, 2012 * @version 1.0 Aug 15, 2012
*/ */
public class Accelerator2 { public class Accelerator2 {
protected static final String DESCRIPTOR = "tests/swixml/swixml-accelerator-2.0.xml"; protected static final String DESCRIPTOR = "tests/swixml/swixml-accelerator-2.0.xml";
protected SwingEngine swix = new SwingEngine( this ); protected SwingEngine swix = new SwingEngine(this);
public Accelerator2(boolean render) throws Exception { public Accelerator2(boolean render) throws Exception {
if (render) { if (render) {
swix.render( Accelerator2.DESCRIPTOR, SwiXmlDriver.LANGUAGE_VERSION_2 ).setVisible( true ); swix.render(Accelerator2.DESCRIPTOR, SwiXmlDriver.LANGUAGE_VERSION_2).setVisible(true);
} }
} }
@SuppressWarnings("serial") @SuppressWarnings("serial")
public Action newAction = new AbstractAction() { public Action newAction = new AbstractAction() {
public void actionPerformed( ActionEvent e ) { public void actionPerformed(ActionEvent e) {
JOptionPane.showMessageDialog( swix.getRootComponent(), "Sorry, not implemented yet." ); JOptionPane.showMessageDialog(swix.getRootComponent(), "Sorry, not implemented yet.");
} }
}; };
@SuppressWarnings("serial") @SuppressWarnings("serial")
public Action aboutAction = new AbstractAction() { public Action aboutAction = new AbstractAction() {
public void actionPerformed( ActionEvent e ) { public void actionPerformed(ActionEvent e) {
JOptionPane.showMessageDialog( swix.getRootComponent(), "This is the Accelerator Example." ); JOptionPane.showMessageDialog(swix.getRootComponent(), "This is the Accelerator Example.");
} }
}; };
@SuppressWarnings("serial") @SuppressWarnings("serial")
public Action exitAction = new AbstractAction() { public Action exitAction = new AbstractAction() {
public void actionPerformed( ActionEvent e ) { public void actionPerformed(ActionEvent e) {
System.exit(0); System.exit(0);
} }
}; };
public static void main( String[] args ) { public static void main(String[] args) {
try { try {
new Accelerator2(true); new Accelerator2(true);
} catch (Exception e) { } catch (Exception e) {

View file

@ -29,17 +29,17 @@ package org.x4o.xml.test.swixml;
* @version 1.0 Aug 15, 2012 * @version 1.0 Aug 15, 2012
*/ */
public class Accelerator3 extends Accelerator2 { public class Accelerator3 extends Accelerator2 {
protected static final String DESCRIPTOR = "tests/swixml/swixml-accelerator-3.0.xml"; protected static final String DESCRIPTOR = "tests/swixml/swixml-accelerator-3.0.xml";
public Accelerator3(boolean render) throws Exception { public Accelerator3(boolean render) throws Exception {
super(false); super(false);
if (render) { if (render) {
swix.render( Accelerator3.DESCRIPTOR, SwiXmlDriver.LANGUAGE_VERSION_3 ).setVisible( true ); swix.render(Accelerator3.DESCRIPTOR, SwiXmlDriver.LANGUAGE_VERSION_3).setVisible(true);
} }
} }
public static void main( String[] args ) { public static void main(String[] args) {
try { try {
new Accelerator3(true); new Accelerator3(true);
} catch (Exception e) { } catch (Exception e) {

View file

@ -39,7 +39,7 @@ import org.x4o.xml.io.X4OReader;
* @version 1.0 Aug 31, 2012 * @version 1.0 Aug 31, 2012
*/ */
public class Accelerator3Test { public class Accelerator3Test {
@Test @Test
public void testSwingMenuAbout() throws Exception { public void testSwingMenuAbout() throws Exception {
Accelerator3 ac3 = new Accelerator3(false); Accelerator3 ac3 = new Accelerator3(false);
@ -49,12 +49,12 @@ public class Accelerator3Test {
reader.addELBeanInstance(SwiXmlDriver.LANGUAGE_EL_SWING_ENGINE, engine); reader.addELBeanInstance(SwiXmlDriver.LANGUAGE_EL_SWING_ENGINE, engine);
Component root = reader.readResource(Accelerator3.DESCRIPTOR); Component root = reader.readResource(Accelerator3.DESCRIPTOR);
Assertions.assertNotNull(root); Assertions.assertNotNull(root);
JFrame frame = (JFrame)root; JFrame frame = (JFrame) root;
Assertions.assertTrue(frame.getJMenuBar().getMenuCount()>0); Assertions.assertTrue(frame.getJMenuBar().getMenuCount() > 0);
JMenu helpMenu = frame.getJMenuBar().getMenu(1); JMenu helpMenu = frame.getJMenuBar().getMenu(1);
Assertions.assertEquals("Help",helpMenu.getText()); Assertions.assertEquals("Help", helpMenu.getText());
Assertions.assertTrue(helpMenu.getMenuComponentCount()>0); Assertions.assertTrue(helpMenu.getMenuComponentCount() > 0);
JMenuItem about = (JMenuItem)helpMenu.getMenuComponent(0); JMenuItem about = (JMenuItem) helpMenu.getMenuComponent(0);
Assertions.assertEquals("mi_about", about.getName()); Assertions.assertEquals("mi_about", about.getName());
} }
} }

View file

@ -20,7 +20,7 @@
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * 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. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
package org.x4o.xml.test.swixml; package org.x4o.xml.test.swixml;
import javax.swing.Action; import javax.swing.Action;
import javax.swing.JMenuItem; import javax.swing.JMenuItem;
@ -30,7 +30,7 @@ import org.x4o.xml.element.Element;
import org.x4o.xml.element.ElementConfiguratorException; import org.x4o.xml.element.ElementConfiguratorException;
/** /**
* SwiXmlActionConfigurator sets the Action object. * SwiXmlActionConfigurator sets the Action object.
* *
* @author Willem Cazander * @author Willem Cazander
* @version 1.0 Aug 16, 2012 * @version 1.0 Aug 16, 2012
@ -39,15 +39,15 @@ public class SwiXmlActionConfigurator extends AbstractElementConfigurator {
public void doConfigElement(Element element) throws ElementConfiguratorException { public void doConfigElement(Element element) throws ElementConfiguratorException {
String actionName = element.getAttributes().get("Action"); String actionName = element.getAttributes().get("Action");
if (actionName==null) { if (actionName == null) {
return; return;
} }
SwingEngine se = SwiXmlDriver.getSwingEngine(element.getLanguageSession()); SwingEngine se = SwiXmlDriver.getSwingEngine(element.getLanguageSession());
Action action = se.getUIActionByName(actionName); Action action = se.getUIActionByName(actionName);
Object object = element.getElementObject(); Object object = element.getElementObject();
if (object instanceof JMenuItem) { if (object instanceof JMenuItem) {
((JMenuItem)object).setAction(action); ((JMenuItem) object).setAction(action);
} }
// etc // etc
} }
} }

View file

@ -38,33 +38,35 @@ import org.x4o.xml.lang.X4OLanguageSession;
*/ */
public class SwiXmlDriver extends X4ODriver<Component> { public class SwiXmlDriver extends X4ODriver<Component> {
public static final String LANGUAGE_NAME = "swixml"; public static final String LANGUAGE_NAME = "swixml";
public static final String LANGUAGE_VERSION_2 = "2.0"; public static final String LANGUAGE_VERSION_2 = "2.0";
public static final String LANGUAGE_VERSION_2_NSURI = "http://swixml.junit.x4o.org/xml/ns/junit-swixml-lang"; public static final String LANGUAGE_VERSION_2_NSURI = "http://swixml.junit.x4o.org/xml/ns/junit-swixml-lang";
public static final String LANGUAGE_VERSION_3 = "3.0"; public static final String LANGUAGE_VERSION_3 = "3.0";
public static final String[] LANGUAGE_VERSIONS = new String[]{LANGUAGE_VERSION_2,LANGUAGE_VERSION_3}; public static final String[] LANGUAGE_VERSIONS = new String[] { LANGUAGE_VERSION_2, LANGUAGE_VERSION_3 };
public static final String LANGUAGE_EL_SWING_ENGINE = "swingEngine"; public static final String LANGUAGE_EL_SWING_ENGINE = "swingEngine";
/** /**
* Helper for while parsing to get the SwingEngine. * Helper for while parsing to get the SwingEngine.
* @param elementLanguage The elementLanguage to get the swingEngine out. *
* @return Returns the SwingEngine for this elementLanguage. * @param elementLanguage The elementLanguage to get the swingEngine out.
* @return Returns the SwingEngine for this elementLanguage.
*/ */
static public SwingEngine getSwingEngine(X4OLanguageSession 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(),
SwingEngine se = (SwingEngine)ee.getValue(elementLanguage.getExpressionLanguageContext()); "${" + SwiXmlDriver.LANGUAGE_EL_SWING_ENGINE + "}", Object.class);
SwingEngine se = (SwingEngine) ee.getValue(elementLanguage.getExpressionLanguageContext());
return se; return se;
} }
static public SwiXmlDriver getInstance() { static public SwiXmlDriver getInstance() {
return (SwiXmlDriver)X4ODriverManager.getX4ODriver(LANGUAGE_NAME); return (SwiXmlDriver) X4ODriverManager.getX4ODriver(LANGUAGE_NAME);
} }
@Override @Override
public String getLanguageName() { public String getLanguageName() {
return LANGUAGE_NAME; return LANGUAGE_NAME;
} }
@Override @Override
public String[] getLanguageVersions() { public String[] getLanguageVersions() {
return LANGUAGE_VERSIONS; return LANGUAGE_VERSIONS;

View file

@ -40,24 +40,24 @@ public class SwingEngine {
private Object uiHandler; private Object uiHandler;
private Component rootComponent = null; private Component rootComponent = null;
public SwingEngine(Object uiHandler) { public SwingEngine(Object uiHandler) {
this.uiHandler=uiHandler; this.uiHandler = uiHandler;
} }
public Action getUIActionByName(String name) { public Action getUIActionByName(String name) {
if (name==null) { if (name == null) {
return null; return null;
} }
if (uiHandler==null) { if (uiHandler == null) {
return null; return null;
} }
try { try {
for (Field f:uiHandler.getClass().getFields()) { for (Field f : uiHandler.getClass().getFields()) {
if (name.equals(f.getName())) { if (name.equals(f.getName())) {
Object value = f.get(uiHandler); Object value = f.get(uiHandler);
if (value instanceof Action) { if (value instanceof Action) {
return (Action)value; return (Action) value;
} else { } else {
return null; return null;
} }
@ -68,8 +68,8 @@ public class SwingEngine {
} }
return null; return null;
} }
public Component render(String resource,String languageVersion) { public Component render(String resource, String languageVersion) {
SwiXmlDriver driver = SwiXmlDriver.getInstance(); SwiXmlDriver driver = SwiXmlDriver.getInstance();
X4OReader<Component> reader = driver.createReader(languageVersion); X4OReader<Component> reader = driver.createReader(languageVersion);
if (SwiXmlDriver.LANGUAGE_VERSION_2.equals(languageVersion)) { if (SwiXmlDriver.LANGUAGE_VERSION_2.equals(languageVersion)) {
@ -83,7 +83,7 @@ public class SwingEngine {
} }
return getRootComponent(); return getRootComponent();
} }
public Component getRootComponent() { public Component getRootComponent() {
return rootComponent; return rootComponent;
} }

View file

@ -20,7 +20,7 @@
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * 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. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
package org.x4o.xml.test.swixml.bind; package org.x4o.xml.test.swixml.bind;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Component; import java.awt.Component;
@ -40,7 +40,7 @@ import org.x4o.xml.element.ElementBindingHandlerException;
* @version 1.0 Aug 16, 2012 * @version 1.0 Aug 16, 2012
*/ */
public class JFrameBindingHandler extends AbstractElementBindingHandler<JFrame> { public class JFrameBindingHandler extends AbstractElementBindingHandler<JFrame> {
/** /**
* @see org.x4o.xml.element.ElementBindingHandler#getBindParentClass() * @see org.x4o.xml.element.ElementBindingHandler#getBindParentClass()
*/ */
@ -52,19 +52,19 @@ public class JFrameBindingHandler extends AbstractElementBindingHandler<JFrame>
* @see org.x4o.xml.element.ElementBindingHandler#getBindChildClasses() * @see org.x4o.xml.element.ElementBindingHandler#getBindChildClasses()
*/ */
public Class<?>[] getBindChildClasses() { public Class<?>[] getBindChildClasses() {
return new Class[] {JMenuBar.class,JComponent.class}; return new Class[] { JMenuBar.class, JComponent.class };
} }
/** /**
* @see org.x4o.xml.element.ElementBindingHandler#bindChild(org.x4o.xml.element.Element, java.lang.Object, java.lang.Object) * @see org.x4o.xml.element.ElementBindingHandler#bindChild(org.x4o.xml.element.Element, java.lang.Object, java.lang.Object)
*/ */
public void bindChild(Element childElement, JFrame parentObject, Object childObject) throws ElementBindingHandlerException { public void bindChild(Element childElement, JFrame parentObject, Object childObject) throws ElementBindingHandlerException {
JFrame frame = (JFrame)parentObject; JFrame frame = (JFrame) parentObject;
if (childObject instanceof JMenuBar) { if (childObject instanceof JMenuBar) {
JMenuBar child = (JMenuBar)childObject; JMenuBar child = (JMenuBar) childObject;
frame.getRootPane().setJMenuBar(child); frame.getRootPane().setJMenuBar(child);
} else if (childObject instanceof JComponent) { } else if (childObject instanceof JComponent) {
JComponent child = (JComponent)childObject; JComponent child = (JComponent) childObject;
String c = childElement.getAttributes().get("constraints"); String c = childElement.getAttributes().get("constraints");
Object con = null; Object con = null;
@ -77,22 +77,22 @@ public class JFrameBindingHandler extends AbstractElementBindingHandler<JFrame>
} else if ("BorderLayout.SOUTH".equals(c)) { } else if ("BorderLayout.SOUTH".equals(c)) {
con = BorderLayout.SOUTH; con = BorderLayout.SOUTH;
} }
if (con==null) { if (con == null) {
frame.getContentPane().add(child); frame.getContentPane().add(child);
} else { } else {
frame.getContentPane().add(child,con); frame.getContentPane().add(child, con);
} }
} }
} }
/** /**
* @see org.x4o.xml.element.AbstractElementBindingHandler#createChilderen(org.x4o.xml.element.Element, java.lang.Object) * @see org.x4o.xml.element.AbstractElementBindingHandler#createChilderen(org.x4o.xml.element.Element, java.lang.Object)
*/ */
@Override @Override
public void createChilderen(Element parentElement,JFrame parent) throws ElementBindingHandlerException { public void createChilderen(Element parentElement, JFrame parent) throws ElementBindingHandlerException {
createChild(parentElement, parent.getMenuBar()); createChild(parentElement, parent.getMenuBar());
for (Component c:parent.getComponents()) { for (Component c : parent.getComponents()) {
if (c instanceof JComponent) { if (c instanceof JComponent) {
createChild(parentElement, c); createChild(parentElement, c);
} }

View file

@ -20,7 +20,7 @@
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * 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. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
package org.x4o.xml.test.swixml.bind; package org.x4o.xml.test.swixml.bind;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Component; import java.awt.Component;
@ -39,7 +39,7 @@ import org.x4o.xml.element.ElementBindingHandlerException;
* @version 1.0 Aug 16, 2012 * @version 1.0 Aug 16, 2012
*/ */
public class JInternalFrameBindingHandler extends AbstractElementBindingHandler<JInternalFrame> { public class JInternalFrameBindingHandler extends AbstractElementBindingHandler<JInternalFrame> {
/** /**
* @see org.x4o.xml.element.ElementBindingHandler#getBindParentClass() * @see org.x4o.xml.element.ElementBindingHandler#getBindParentClass()
*/ */
@ -51,15 +51,15 @@ public class JInternalFrameBindingHandler extends AbstractElementBindingHandler<
* @see org.x4o.xml.element.ElementBindingHandler#getBindChildClasses() * @see org.x4o.xml.element.ElementBindingHandler#getBindChildClasses()
*/ */
public Class<?>[] getBindChildClasses() { public Class<?>[] getBindChildClasses() {
return new Class[] {JComponent.class}; return new Class[] { JComponent.class };
} }
/** /**
* @see org.x4o.xml.element.ElementBindingHandler#bindChild(org.x4o.xml.element.Element, java.lang.Object, java.lang.Object) * @see org.x4o.xml.element.ElementBindingHandler#bindChild(org.x4o.xml.element.Element, java.lang.Object, java.lang.Object)
*/ */
public void bindChild(Element childElement, JInternalFrame frame, Object childObject) throws ElementBindingHandlerException { public void bindChild(Element childElement, JInternalFrame frame, Object childObject) throws ElementBindingHandlerException {
JComponent child = (JComponent)childObject; JComponent child = (JComponent) childObject;
String c = childElement.getAttributes().get("constraints"); String c = childElement.getAttributes().get("constraints");
Object con = null; Object con = null;
if ("BorderLayout.CENTER".equals(c)) { if ("BorderLayout.CENTER".equals(c)) {
@ -71,19 +71,19 @@ public class JInternalFrameBindingHandler extends AbstractElementBindingHandler<
} else if ("BorderLayout.SOUTH".equals(c)) { } else if ("BorderLayout.SOUTH".equals(c)) {
con = BorderLayout.SOUTH; con = BorderLayout.SOUTH;
} }
if (con==null) { if (con == null) {
frame.getContentPane().add(child); frame.getContentPane().add(child);
} else { } else {
frame.getContentPane().add(child,con); frame.getContentPane().add(child, con);
} }
} }
/** /**
* @see org.x4o.xml.element.AbstractElementBindingHandler#createChilderen(org.x4o.xml.element.Element, java.lang.Object) * @see org.x4o.xml.element.AbstractElementBindingHandler#createChilderen(org.x4o.xml.element.Element, java.lang.Object)
*/ */
@Override @Override
public void createChilderen(Element parentElement,JInternalFrame parent) throws ElementBindingHandlerException { public void createChilderen(Element parentElement, JInternalFrame parent) throws ElementBindingHandlerException {
for (Component c:parent.getComponents()) { for (Component c : parent.getComponents()) {
if (c instanceof JComponent) { if (c instanceof JComponent) {
if (c.getClass().getName().startsWith("javax.swing.plaf")) { if (c.getClass().getName().startsWith("javax.swing.plaf")) {
return; return;

View file

@ -20,7 +20,7 @@
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * 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. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
package org.x4o.xml.test.swixml.bind; package org.x4o.xml.test.swixml.bind;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Component; import java.awt.Component;
@ -39,7 +39,7 @@ import org.x4o.xml.element.ElementBindingHandlerException;
* @version 1.0 Aug 16, 2012 * @version 1.0 Aug 16, 2012
*/ */
public class JPanelBindingHandler extends AbstractElementBindingHandler<JPanel> { public class JPanelBindingHandler extends AbstractElementBindingHandler<JPanel> {
/** /**
* @see org.x4o.xml.element.ElementBindingHandler#getBindParentClass() * @see org.x4o.xml.element.ElementBindingHandler#getBindParentClass()
*/ */
@ -51,15 +51,15 @@ public class JPanelBindingHandler extends AbstractElementBindingHandler<JPanel>
* @see org.x4o.xml.element.ElementBindingHandler#getBindChildClasses() * @see org.x4o.xml.element.ElementBindingHandler#getBindChildClasses()
*/ */
public Class<?>[] getBindChildClasses() { public Class<?>[] getBindChildClasses() {
return new Class[] {JComponent.class}; return new Class[] { JComponent.class };
} }
/** /**
* @see org.x4o.xml.element.ElementBindingHandler#bindChild(org.x4o.xml.element.Element, java.lang.Object, java.lang.Object) * @see org.x4o.xml.element.ElementBindingHandler#bindChild(org.x4o.xml.element.Element, java.lang.Object, java.lang.Object)
*/ */
public void bindChild(Element childElement, JPanel parent, Object childObject) throws ElementBindingHandlerException { public void bindChild(Element childElement, JPanel parent, Object childObject) throws ElementBindingHandlerException {
JComponent child = (JComponent)childObject; JComponent child = (JComponent) childObject;
String c = childElement.getAttributes().get("constraints"); String c = childElement.getAttributes().get("constraints");
Object con = null; Object con = null;
if ("BorderLayout.CENTER".equals(c)) { if ("BorderLayout.CENTER".equals(c)) {
@ -71,19 +71,19 @@ public class JPanelBindingHandler extends AbstractElementBindingHandler<JPanel>
} else if ("BorderLayout.SOUTH".equals(c)) { } else if ("BorderLayout.SOUTH".equals(c)) {
con = BorderLayout.SOUTH; con = BorderLayout.SOUTH;
} }
if (con==null) { if (con == null) {
parent.add(child); parent.add(child);
} else { } else {
parent.add(child,con); parent.add(child, con);
} }
} }
/** /**
* @see org.x4o.xml.element.AbstractElementBindingHandler#createChilderen(org.x4o.xml.element.Element, java.lang.Object) * @see org.x4o.xml.element.AbstractElementBindingHandler#createChilderen(org.x4o.xml.element.Element, java.lang.Object)
*/ */
@Override @Override
public void createChilderen(Element parentElement,JPanel parent) throws ElementBindingHandlerException { public void createChilderen(Element parentElement, JPanel parent) throws ElementBindingHandlerException {
for (Component c:parent.getComponents()) { for (Component c : parent.getComponents()) {
if (c instanceof JComponent) { if (c instanceof JComponent) {
createChild(parentElement, c); createChild(parentElement, c);
} }

View file

@ -20,7 +20,7 @@
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * 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. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
package org.x4o.xml.test.swixml.bind; package org.x4o.xml.test.swixml.bind;
import javax.swing.JButton; import javax.swing.JButton;
import javax.swing.JComponent; import javax.swing.JComponent;
@ -37,7 +37,7 @@ import org.x4o.xml.element.ElementBindingHandlerException;
* @version 1.0 Aug 16, 2012 * @version 1.0 Aug 16, 2012
*/ */
public class JSplitPaneBindingHandler extends AbstractElementBindingHandler<JSplitPane> { public class JSplitPaneBindingHandler extends AbstractElementBindingHandler<JSplitPane> {
/** /**
* @see org.x4o.xml.element.ElementBindingHandler#getBindParentClass() * @see org.x4o.xml.element.ElementBindingHandler#getBindParentClass()
*/ */
@ -49,14 +49,14 @@ public class JSplitPaneBindingHandler extends AbstractElementBindingHandler<JSpl
* @see org.x4o.xml.element.ElementBindingHandler#getBindChildClasses() * @see org.x4o.xml.element.ElementBindingHandler#getBindChildClasses()
*/ */
public Class<?>[] getBindChildClasses() { public Class<?>[] getBindChildClasses() {
return new Class[] {JComponent.class}; return new Class[] { JComponent.class };
} }
/** /**
* @see org.x4o.xml.element.ElementBindingHandler#bindChild(org.x4o.xml.element.Element, java.lang.Object, java.lang.Object, ) * @see org.x4o.xml.element.ElementBindingHandler#bindChild(org.x4o.xml.element.Element, java.lang.Object, java.lang.Object, )
*/ */
public void bindChild(Element childElement, JSplitPane pane, Object childObject) throws ElementBindingHandlerException { public void bindChild(Element childElement, JSplitPane pane, Object childObject) throws ElementBindingHandlerException {
JComponent child = (JComponent)childObject; JComponent child = (JComponent) childObject;
if (pane.getLeftComponent() instanceof JButton) { // strange swing constructor for splitpane if (pane.getLeftComponent() instanceof JButton) { // strange swing constructor for splitpane
pane.setLeftComponent(child); pane.setLeftComponent(child);
} else if (pane.getRightComponent() instanceof JButton) { } else if (pane.getRightComponent() instanceof JButton) {
@ -65,12 +65,12 @@ public class JSplitPaneBindingHandler extends AbstractElementBindingHandler<JSpl
throw new ElementBindingHandlerException("SplitPane is full."); throw new ElementBindingHandlerException("SplitPane is full.");
} }
} }
/** /**
* @see org.x4o.xml.element.AbstractElementBindingHandler#createChilderen(org.x4o.xml.element.Element, java.lang.Object) * @see org.x4o.xml.element.AbstractElementBindingHandler#createChilderen(org.x4o.xml.element.Element, java.lang.Object)
*/ */
@Override @Override
public void createChilderen(Element parentElement,JSplitPane parentObject) throws ElementBindingHandlerException { public void createChilderen(Element parentElement, JSplitPane parentObject) throws ElementBindingHandlerException {
createChild(parentElement, parentObject.getLeftComponent()); createChild(parentElement, parentObject.getLeftComponent());
createChild(parentElement, parentObject.getRightComponent()); createChild(parentElement, parentObject.getRightComponent());
} }

View file

@ -20,7 +20,7 @@
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * 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. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
package org.x4o.xml.test.swixml.conv; package org.x4o.xml.test.swixml.conv;
import java.util.Locale; import java.util.Locale;
@ -38,15 +38,15 @@ import org.x4o.xml.conv.ObjectConverterException;
* @version 1.0 Aug 17, 2012 * @version 1.0 Aug 17, 2012
*/ */
public class BorderConverter extends AbstractStringObjectConverter { public class BorderConverter extends AbstractStringObjectConverter {
private static final long serialVersionUID = 6729812931433525103L; private static final long serialVersionUID = 6729812931433525103L;
public Class<?> getObjectClassTo() { public Class<?> getObjectClassTo() {
return Border.class; return Border.class;
} }
public String convertStringBack(Object obj,Locale locale) throws ObjectConverterException { public String convertStringBack(Object obj, Locale locale) throws ObjectConverterException {
return ((Border)obj).toString(); return ((Border) obj).toString();
} }
public Object convertStringTo(String str, Locale locale) throws ObjectConverterException { public Object convertStringTo(String str, Locale locale) throws ObjectConverterException {
@ -57,14 +57,14 @@ public class BorderConverter extends AbstractStringObjectConverter {
return BorderFactory.createEmptyBorder(); return BorderFactory.createEmptyBorder();
} }
} catch (Exception e) { } catch (Exception e) {
throw new ObjectConverterException(this,e.getMessage(),e); throw new ObjectConverterException(this, e.getMessage(), e);
} }
} }
@Override @Override
public ObjectConverter clone() throws CloneNotSupportedException { public ObjectConverter clone() throws CloneNotSupportedException {
BorderConverter result = new BorderConverter(); BorderConverter result = new BorderConverter();
result.converters=cloneConverters(); result.converters = cloneConverters();
return result; return result;
} }
} }

View file

@ -20,7 +20,7 @@
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * 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. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
package org.x4o.xml.test.swixml.conv; package org.x4o.xml.test.swixml.conv;
import java.awt.Color; import java.awt.Color;
import java.util.Locale; import java.util.Locale;
@ -36,21 +36,21 @@ import org.x4o.xml.conv.ObjectConverterException;
* @version 1.0 Aug 17, 2012 * @version 1.0 Aug 17, 2012
*/ */
public class ColorConverter extends AbstractStringObjectConverter { public class ColorConverter extends AbstractStringObjectConverter {
private static final long serialVersionUID = 6729812931433525103L; private static final long serialVersionUID = 6729812931433525103L;
public Class<?> getObjectClassTo() { public Class<?> getObjectClassTo() {
return Color.class; return Color.class;
} }
public String convertStringBack(Object obj,Locale locale) throws ObjectConverterException { public String convertStringBack(Object obj, Locale locale) throws ObjectConverterException {
return ((Color)obj).toString(); return ((Color) obj).toString();
} }
public Object convertStringTo(String str, Locale locale) throws ObjectConverterException { public Object convertStringTo(String str, Locale locale) throws ObjectConverterException {
try { try {
if (str.length()==0) { if (str.length() == 0) {
throw new ObjectConverterException(this,"Can't convert empty color."); throw new ObjectConverterException(this, "Can't convert empty color.");
} }
if (Character.isDigit(str.charAt(0))) { if (Character.isDigit(str.charAt(0))) {
return Color.decode(str); return Color.decode(str);
@ -62,19 +62,18 @@ public class ColorConverter extends AbstractStringObjectConverter {
} else if ("red".equalsIgnoreCase(str)) { } else if ("red".equalsIgnoreCase(str)) {
return Color.RED; return Color.RED;
} }
throw new ObjectConverterException(this,"Can't convert color: "+str); throw new ObjectConverterException(this, "Can't convert color: " + str);
} }
} catch (Exception e) { } catch (Exception e) {
throw new ObjectConverterException(this,e.getMessage(),e); throw new ObjectConverterException(this, e.getMessage(), e);
} }
} }
@Override @Override
public ObjectConverter clone() throws CloneNotSupportedException { public ObjectConverter clone() throws CloneNotSupportedException {
ColorConverter result = new ColorConverter(); ColorConverter result = new ColorConverter();
result.converters=cloneConverters(); result.converters = cloneConverters();
return result; return result;
} }
} }

View file

@ -20,7 +20,7 @@
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * 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. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
package org.x4o.xml.test.swixml.conv; package org.x4o.xml.test.swixml.conv;
import java.util.Locale; import java.util.Locale;
@ -38,33 +38,31 @@ import org.x4o.xml.conv.ObjectConverterException;
* @version 1.0 Aug 17, 2012 * @version 1.0 Aug 17, 2012
*/ */
public class IconConverter extends AbstractStringObjectConverter { public class IconConverter extends AbstractStringObjectConverter {
private static final long serialVersionUID = 6729812931433525103L; private static final long serialVersionUID = 6729812931433525103L;
public Class<?> getObjectClassTo() { public Class<?> getObjectClassTo() {
return Icon.class; return Icon.class;
} }
public String convertStringBack(Object obj,Locale locale) throws ObjectConverterException { public String convertStringBack(Object obj, Locale locale) throws ObjectConverterException {
return ((Icon)obj).toString(); return ((Icon) obj).toString();
} }
public Object convertStringTo(String str, Locale locale) throws ObjectConverterException { public Object convertStringTo(String str, Locale locale) throws ObjectConverterException {
try { try {
Icon icon = UIManager.getIcon("OptionPane.questionIcon"); Icon icon = UIManager.getIcon("OptionPane.questionIcon");
return icon; return icon;
} catch (Exception e) { } catch (Exception e) {
throw new ObjectConverterException(this,e.getMessage(),e); throw new ObjectConverterException(this, e.getMessage(), e);
} }
} }
@Override @Override
public ObjectConverter clone() throws CloneNotSupportedException { public ObjectConverter clone() throws CloneNotSupportedException {
IconConverter result = new IconConverter(); IconConverter result = new IconConverter();
result.converters=cloneConverters(); result.converters = cloneConverters();
return result; return result;
} }
} }

View file

@ -20,7 +20,7 @@
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * 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. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
package org.x4o.xml.test.swixml.conv; package org.x4o.xml.test.swixml.conv;
import java.util.Locale; import java.util.Locale;
@ -37,15 +37,15 @@ import org.x4o.xml.conv.ObjectConverterException;
* @version 1.0 Aug 17, 2012 * @version 1.0 Aug 17, 2012
*/ */
public class JSplitPaneOrientationConverter extends AbstractStringObjectConverter { public class JSplitPaneOrientationConverter extends AbstractStringObjectConverter {
private static final long serialVersionUID = 6729812931433525103L; private static final long serialVersionUID = 6729812931433525103L;
public Class<?> getObjectClassTo() { public Class<?> getObjectClassTo() {
return Integer.class; return Integer.class;
} }
public String convertStringBack(Object obj,Locale locale) throws ObjectConverterException { public String convertStringBack(Object obj, Locale locale) throws ObjectConverterException {
return ((Integer)obj).toString(); return ((Integer) obj).toString();
} }
public Object convertStringTo(String str, Locale locale) throws ObjectConverterException { public Object convertStringTo(String str, Locale locale) throws ObjectConverterException {
@ -55,17 +55,17 @@ public class JSplitPaneOrientationConverter extends AbstractStringObjectConverte
} else if ("VERTICAL".equals(str)) { } else if ("VERTICAL".equals(str)) {
return JSplitPane.VERTICAL_SPLIT; return JSplitPane.VERTICAL_SPLIT;
} else { } else {
throw new ObjectConverterException(this,"Unknown orientation: "+str); throw new ObjectConverterException(this, "Unknown orientation: " + str);
} }
} catch (Exception e) { } catch (Exception e) {
throw new ObjectConverterException(this,e.getMessage(),e); throw new ObjectConverterException(this, e.getMessage(), e);
} }
} }
@Override @Override
public ObjectConverter clone() throws CloneNotSupportedException { public ObjectConverter clone() throws CloneNotSupportedException {
JSplitPaneOrientationConverter result = new JSplitPaneOrientationConverter(); JSplitPaneOrientationConverter result = new JSplitPaneOrientationConverter();
result.converters=cloneConverters(); result.converters = cloneConverters();
return result; return result;
} }
} }

View file

@ -20,7 +20,7 @@
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * 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. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
package org.x4o.xml.test.swixml.conv; package org.x4o.xml.test.swixml.conv;
import java.util.Locale; import java.util.Locale;
@ -37,33 +37,32 @@ import org.x4o.xml.conv.ObjectConverterException;
* @version 1.0 Aug 17, 2012 * @version 1.0 Aug 17, 2012
*/ */
public class KeyStrokeConverter extends AbstractStringObjectConverter { public class KeyStrokeConverter extends AbstractStringObjectConverter {
private static final long serialVersionUID = 6729812931433525103L; private static final long serialVersionUID = 6729812931433525103L;
public Class<?> getObjectClassTo() { public Class<?> getObjectClassTo() {
return KeyStroke.class; return KeyStroke.class;
} }
public String convertStringBack(Object obj,Locale locale) throws ObjectConverterException { public String convertStringBack(Object obj, Locale locale) throws ObjectConverterException {
return ((KeyStroke)obj).toString(); return ((KeyStroke) obj).toString();
} }
public Object convertStringTo(String str, Locale locale) throws ObjectConverterException { public Object convertStringTo(String str, Locale locale) throws ObjectConverterException {
try { try {
KeyStroke key = KeyStroke.getKeyStroke(str); KeyStroke key = KeyStroke.getKeyStroke(str);
return key; return key;
} catch (Exception e) { } catch (Exception e) {
throw new ObjectConverterException(this,e.getMessage(),e); throw new ObjectConverterException(this, e.getMessage(), e);
} }
} }
@Override @Override
public ObjectConverter clone() throws CloneNotSupportedException { public ObjectConverter clone() throws CloneNotSupportedException {
KeyStrokeConverter result = new KeyStrokeConverter(); KeyStrokeConverter result = new KeyStrokeConverter();
result.converters=cloneConverters(); result.converters = cloneConverters();
return result; return result;
} }
} }

View file

@ -20,7 +20,7 @@
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * 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. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
package org.x4o.xml.test.swixml.conv; package org.x4o.xml.test.swixml.conv;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.FlowLayout; import java.awt.FlowLayout;
@ -40,15 +40,15 @@ import org.x4o.xml.conv.ObjectConverterException;
* @version 1.0 Aug 17, 2012 * @version 1.0 Aug 17, 2012
*/ */
public class LayoutConverter extends AbstractStringObjectConverter { public class LayoutConverter extends AbstractStringObjectConverter {
private static final long serialVersionUID = 6729812931433525103L; private static final long serialVersionUID = 6729812931433525103L;
public Class<?> getObjectClassTo() { public Class<?> getObjectClassTo() {
return LayoutManager.class; return LayoutManager.class;
} }
public String convertStringBack(Object obj,Locale locale) throws ObjectConverterException { public String convertStringBack(Object obj, Locale locale) throws ObjectConverterException {
return ((LayoutManager)obj).toString(); return ((LayoutManager) obj).toString();
} }
public Object convertStringTo(String str, Locale locale) throws ObjectConverterException { public Object convertStringTo(String str, Locale locale) throws ObjectConverterException {
@ -56,7 +56,7 @@ public class LayoutConverter extends AbstractStringObjectConverter {
if ("borderlayout".equals(str)) { if ("borderlayout".equals(str)) {
return new BorderLayout(); return new BorderLayout();
} else if (str.startsWith("FlowLayout")) { } else if (str.startsWith("FlowLayout")) {
if (str.contains("RIGHT")) { if (str.contains("RIGHT")) {
return new FlowLayout(FlowLayout.RIGHT); return new FlowLayout(FlowLayout.RIGHT);
} else if (str.contains("LEFT")) { } else if (str.contains("LEFT")) {
@ -70,41 +70,40 @@ public class LayoutConverter extends AbstractStringObjectConverter {
} else { } else {
return new FlowLayout(); return new FlowLayout();
} }
} else if (str.startsWith("GridLayout")) { } else if (str.startsWith("GridLayout")) {
int indexStart = str.indexOf('('); int indexStart = str.indexOf('(');
int indexMid = str.indexOf(','); int indexMid = str.indexOf(',');
int indexEnd = str.indexOf(')'); int indexEnd = str.indexOf(')');
if (indexStart>0 && indexMid>0 && indexEnd>0) { if (indexStart > 0 && indexMid > 0 && indexEnd > 0) {
Integer rows = new Integer(str.substring(indexStart+1,indexMid)); Integer rows = new Integer(str.substring(indexStart + 1, indexMid));
Integer cols = new Integer(str.substring(indexMid+1,indexEnd)); Integer cols = new Integer(str.substring(indexMid + 1, indexEnd));
return new GridLayout(rows,cols); return new GridLayout(rows, cols);
} else { } else {
throw new ObjectConverterException(this,"Could not parse arguments: "+str); throw new ObjectConverterException(this, "Could not parse arguments: " + str);
} }
} else if (str.startsWith("GridBagLayout")) { } else if (str.startsWith("GridBagLayout")) {
return new GridBagLayout(); return new GridBagLayout();
} else { } else {
throw new ObjectConverterException(this,"Unknow layout requested: "+str); throw new ObjectConverterException(this, "Unknow layout requested: " + str);
} }
} catch (Exception e) { } catch (Exception e) {
throw new ObjectConverterException(this,e.getMessage(),e); throw new ObjectConverterException(this, e.getMessage(), e);
} }
} }
@Override @Override
public ObjectConverter clone() throws CloneNotSupportedException { public ObjectConverter clone() throws CloneNotSupportedException {
LayoutConverter result = new LayoutConverter(); LayoutConverter result = new LayoutConverter();
result.converters=cloneConverters(); result.converters = cloneConverters();
return result; return result;
} }
} }

View file

@ -33,5 +33,5 @@ public class MaisDocProject {
private Class<?> frameNavConceptClass = null; private Class<?> frameNavConceptClass = null;
private List<MaisDocProjectPerspective> perspectives; private List<MaisDocProjectPerspective> perspectives;
} }

View file

@ -33,7 +33,7 @@ import java.util.List;
public class MaisDocProjectPerspective { public class MaisDocProjectPerspective {
private List<MaisDocProjectPerspectiveWing> wasps = new ArrayList<>(); private List<MaisDocProjectPerspectiveWing> wasps = new ArrayList<>();
public List<MaisDocProjectPerspectiveWing> getWasps() { public List<MaisDocProjectPerspectiveWing> getWasps() {
return wasps; return wasps;
} }

View file

@ -38,7 +38,6 @@ public interface MaisDocProjectPerspectiveWing {
// use: doc.addAnnotatedClasses // use: doc.addAnnotatedClasses
// use: doc.addConcept // use: doc.addConcept
// use: doc.addDocPage // use: doc.addDocPage
// use: waspNode.addNode // use: waspNode.addNode
} }

View file

@ -49,12 +49,13 @@ import org.x4o.sax3.io.SAX3PropertyConfig.PropertyConfigItem;
*/ */
@Deprecated // marked until make working to write multiple project or mix api docs in one big tree @Deprecated // marked until make working to write multiple project or mix api docs in one big tree
public class MaisDocWriter { public class MaisDocWriter {
// NOTE: this class is unused, and is waiting for ApiDocProject code and replaces most code in EldDocWriter to here. // 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/"; private final static String PROPERTY_CONTEXT_PREFIX = SAX3PropertyConfig.X4O_PROPERTIES_PREFIX + "api-doc/";
public final static SAX3PropertyConfig DEFAULT_PROPERTY_CONFIG; public final static SAX3PropertyConfig DEFAULT_PROPERTY_CONFIG;
//@formatter:off
public final static String OUTPUT_PATH = PROPERTY_CONTEXT_PREFIX+"output/path"; 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_NAME = PROPERTY_CONTEXT_PREFIX+"doc/name";
public final static String DOC_DESCRIPTION = PROPERTY_CONTEXT_PREFIX+"doc/description"; public final static String DOC_DESCRIPTION = PROPERTY_CONTEXT_PREFIX+"doc/description";
@ -92,18 +93,20 @@ public class MaisDocWriter {
new PropertyConfigItem(PAGE_PRINT_HELP,Boolean.class,true) new PropertyConfigItem(PAGE_PRINT_HELP,Boolean.class,true)
); );
} }
//@formatter:on
/** The config of this writer. */ /** The config of this writer. */
private final SAX3PropertyConfig propertyConfig; private final SAX3PropertyConfig propertyConfig;
public MaisDocWriter(SAX3PropertyConfig parentConfig) { public MaisDocWriter(SAX3PropertyConfig parentConfig) {
this.propertyConfig=new SAX3PropertyConfig(DEFAULT_PROPERTY_CONFIG,PROPERTY_CONTEXT_PREFIX); this.propertyConfig = new SAX3PropertyConfig(DEFAULT_PROPERTY_CONFIG, PROPERTY_CONTEXT_PREFIX);
this.propertyConfig.copyParentProperties(parentConfig); this.propertyConfig.copyParentProperties(parentConfig);
} }
/** /**
* Writes the language documentation to the base path. * Writes the language documentation to the base path.
* @throws IOException Is thrown when error is done. *
* @throws IOException Is thrown when error is done.
*/ */
public void writeDocumentation() throws IOException { public void writeDocumentation() throws IOException {
File basePath = propertyConfig.getPropertyFile(OUTPUT_PATH); File basePath = propertyConfig.getPropertyFile(OUTPUT_PATH);
@ -111,43 +114,44 @@ public class MaisDocWriter {
MaisDoc doc = buildLanguageDoc(); MaisDoc doc = buildLanguageDoc();
writer.write(doc, basePath); writer.write(doc, basePath);
} }
/** /**
* Creates a fully configured ApiDoc object. * Creates a fully configured ApiDoc object.
* @return The ApiDoc configured to write eld documentation. *
* @return The ApiDoc configured to write eld documentation.
*/ */
private MaisDoc buildLanguageDoc() { private MaisDoc buildLanguageDoc() {
// Generic config // Generic config
MaisDoc doc = new MaisDoc(); MaisDoc doc = new MaisDoc();
doc.setName( propertyConfig.getPropertyString(DOC_NAME)); doc.setName(propertyConfig.getPropertyString(DOC_NAME));
doc.setDescription( propertyConfig.getPropertyString(DOC_DESCRIPTION)); doc.setDescription(propertyConfig.getPropertyString(DOC_DESCRIPTION));
doc.setDocAbout( propertyConfig.getPropertyString(DOC_ABOUT, () -> createDefaultAbout(doc.getName()))); doc.setDocAbout(propertyConfig.getPropertyString(DOC_ABOUT, () -> createDefaultAbout(doc.getName())));
doc.setDocCopyright( propertyConfig.getPropertyString(DOC_COPYRIGHT, () -> createForeverCopyright())); doc.setDocCopyright(propertyConfig.getPropertyString(DOC_COPYRIGHT, () -> createForeverCopyright()));
doc.setDocPageSubTitle( propertyConfig.getPropertyString(DOC_PAGE_SUB_TITLE, () -> createDefaultPageSubTitle(doc.getName()))); doc.setDocPageSubTitle(propertyConfig.getPropertyString(DOC_PAGE_SUB_TITLE, () -> createDefaultPageSubTitle(doc.getName())));
doc.setMetaStyleSheetThema( propertyConfig.getPropertyString(META_STYLESHEET_THEMA)); doc.setMetaStyleSheetThema(propertyConfig.getPropertyString(META_STYLESHEET_THEMA));
doc.setMetaStyleSheet( propertyConfig.getPropertyFile(META_STYLESHEET)); doc.setMetaStyleSheet(propertyConfig.getPropertyFile(META_STYLESHEET));
doc.addMetaKeywordAll( propertyConfig.getPropertyList(META_KEYWORDS, () -> createDefaultKeywords())); doc.addMetaKeywordAll(propertyConfig.getPropertyList(META_KEYWORDS, () -> createDefaultKeywords()));
doc.setNoFrameAllName( propertyConfig.getPropertyString(DOC_NO_FRAME_ALL_NAME)); doc.setNoFrameAllName(propertyConfig.getPropertyString(DOC_NO_FRAME_ALL_NAME));
doc.setFrameNavPrintParent(true); doc.setFrameNavPrintParent(true);
doc.setFrameNavPrintParentId(true); doc.setFrameNavPrintParentId(true);
doc.setGroupTypeName("summary", "Summary",1); doc.setGroupTypeName("summary", "Summary", 1);
doc.setGroupTypeName("overview", "Overview",2); doc.setGroupTypeName("overview", "Overview", 2);
// Javadoc linking config // Javadoc linking config
List<String> javadocLinkList = propertyConfig.getPropertyList(JAVADOC_LINK); List<String> javadocLinkList = propertyConfig.getPropertyList(JAVADOC_LINK);
Map<String,String> javadocLinkOfflineMap = propertyConfig.getPropertyMap(JAVADOC_LINK_OFFLINE); Map<String, String> javadocLinkOfflineMap = propertyConfig.getPropertyMap(JAVADOC_LINK_OFFLINE);
if (javadocLinkList!=null) { if (javadocLinkList != null) {
for (String javadocUrl:javadocLinkList) { for (String javadocUrl : javadocLinkList) {
doc.addRemoteClass(new MaisDocRemoteClass(javadocUrl)); doc.addRemoteClass(new MaisDocRemoteClass(javadocUrl));
} }
} }
if (javadocLinkOfflineMap!=null) { if (javadocLinkOfflineMap != null) {
for (Map.Entry<String,String> offlineLink:javadocLinkOfflineMap.entrySet()) { for (Map.Entry<String, String> offlineLink : javadocLinkOfflineMap.entrySet()) {
doc.addRemoteClass(new MaisDocRemoteClass(offlineLink.getKey(),offlineLink.getValue())); doc.addRemoteClass(new MaisDocRemoteClass(offlineLink.getKey(), offlineLink.getValue()));
} }
} }
// Tree and navagation config // Tree and navagation config
// doc.setFrameNavConceptClass(ElementClass.class); // doc.setFrameNavConceptClass(ElementClass.class);
// //
@ -168,7 +172,7 @@ public class MaisDocWriter {
// ApiDocConcept adcIface = doc.addConcept(new ApiDocConcept(adcMod,C_INTERFACE,ElementInterface.class)); // ApiDocConcept adcIface = doc.addConcept(new ApiDocConcept(adcMod,C_INTERFACE,ElementInterface.class));
// ApiDocConcept adcNs = doc.addConcept(new ApiDocConcept(adcMod,C_NAMESPACE,ElementNamespace.class)); // ApiDocConcept adcNs = doc.addConcept(new ApiDocConcept(adcMod,C_NAMESPACE,ElementNamespace.class));
// ApiDocConcept adcEc = doc.addConcept(new ApiDocConcept(adcNs,C_ELEMENT,ElementClass.class)); // ApiDocConcept adcEc = doc.addConcept(new ApiDocConcept(adcNs,C_ELEMENT,ElementClass.class));
// mm maybe redo something here // mm maybe redo something here
// adcMod.addChildConcepts(new ApiDocConcept(adcMod,CC_ATTRIBUTE_H,ElementNamespaceAttribute.class)); // 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_CONFIGURATOR_G,ElementConfiguratorGlobal.class));
@ -177,13 +181,13 @@ public class MaisDocWriter {
// adcIface.addChildConcepts(new ApiDocConcept(adcMod,CC_CONFIGURATOR,ElementConfigurator.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_CONFIGURATOR,ElementConfigurator.class));
// adcEc.addChildConcepts(new ApiDocConcept(adcEc,CC_ATTRIBUTE,ElementClassAttribute.class)); // adcEc.addChildConcepts(new ApiDocConcept(adcEc,CC_ATTRIBUTE,ElementClassAttribute.class));
// Non-tree pages config // Non-tree pages config
// if (propertyConfig.getPropertyBoolean(PAGE_PRINT_XTREE)) { doc.addDocPage(EldDocXTreePageWriter.createDocPage()); } // 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_TREE)) { doc.addDocPage(DefaultPageWriterTree.createDocPage()); }
// if (propertyConfig.getPropertyBoolean(PAGE_PRINT_INDEX_ALL)) { doc.addDocPage(DefaultPageWriterIndexAll.createDocPage()); } // if (propertyConfig.getPropertyBoolean(PAGE_PRINT_INDEX_ALL)) { doc.addDocPage(DefaultPageWriterIndexAll.createDocPage()); }
// if (propertyConfig.getPropertyBoolean(PAGE_PRINT_HELP)) { doc.addDocPage(DefaultPageWriterHelp.createDocPage()); } // if (propertyConfig.getPropertyBoolean(PAGE_PRINT_HELP)) { doc.addDocPage(DefaultPageWriterHelp.createDocPage()); }
// Doc tree config // Doc tree config
// ApiDocNode rootNode = new ApiDocNode(language,"language",getLanguageNameUpperCase()+" Language","The X4O "+getLanguageNameUpperCase()+" Language"); // ApiDocNode rootNode = new ApiDocNode(language,"language",getLanguageNameUpperCase()+" Language","The X4O "+getLanguageNameUpperCase()+" Language");
// doc.setRootNode(rootNode); // doc.setRootNode(rootNode);
@ -201,7 +205,7 @@ public class MaisDocWriter {
// } // }
return doc; return doc;
} }
private String createDefaultPageSubTitle(String name) { private String createDefaultPageSubTitle(String name) {
StringBuilder buf = new StringBuilder(100); StringBuilder buf = new StringBuilder(100);
buf.append(name); buf.append(name);
@ -209,7 +213,7 @@ public class MaisDocWriter {
buf.append("API"); buf.append("API");
return buf.toString(); return buf.toString();
} }
private String createDefaultAbout(String name) { private String createDefaultAbout(String name) {
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
StringBuilder buf = new StringBuilder(100); StringBuilder buf = new StringBuilder(100);
@ -218,7 +222,7 @@ public class MaisDocWriter {
buf.append(calendar.get(Calendar.YEAR)); buf.append(calendar.get(Calendar.YEAR));
return buf.toString(); return buf.toString();
} }
private String createForeverCopyright() { private String createForeverCopyright() {
StringBuilder buf = new StringBuilder(100); StringBuilder buf = new StringBuilder(100);
buf.append("Copyright&nbsp;&#x00a9;&nbsp;"); buf.append("Copyright&nbsp;&#x00a9;&nbsp;");
@ -229,7 +233,7 @@ public class MaisDocWriter {
buf.append("All Rights Reserved."); buf.append("All Rights Reserved.");
return buf.toString(); return buf.toString();
} }
private List<String> createDefaultKeywords() { private List<String> createDefaultKeywords() {
List<String> keywords = new ArrayList<String>(10); List<String> keywords = new ArrayList<String>(10);
keywords.add("language"); keywords.add("language");

View file

@ -38,33 +38,35 @@ import org.x4o.sax3.SAX3WriterHtml.Tag;
* @version 1.0 May 22, 2013 * @version 1.0 May 22, 2013
*/ */
public class DefaultPageWriterHelp implements MaisDocPageWriter { public class DefaultPageWriterHelp implements MaisDocPageWriter {
public static MaisDocPage createDocPage() { 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 { public void writePageContent(MaisDocWriteEvent<MaisDocPage> e) throws IOException {
MaisDoc doc = e.getDoc(); MaisDoc doc = e.getDoc();
//ApiDocPage page = e.getEvent(); // ApiDocPage page = e.getEvent();
MaisDocContentWriter writer = e.getWriter(); MaisDocContentWriter writer = e.getWriter();
//@formatter:off
writer.printTagStart(Tag.div,"header"); writer.printTagStart(Tag.div,"header");
writer.printTagCharacters(Tag.h1, "How This API Document Is Organized", "title"); writer.printTagCharacters(Tag.h1, "How This API Document Is Organized", "title");
writer.printTagStart(Tag.div,"subTitle"); writer.printTagStart(Tag.div, "subTitle");
writer.printCharacters("This ApiDoc document has pages corresponding to the items in the navigation bar, described as follows."); 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.printTagEnd(Tag.div); writer.printTagEnd(Tag.div);
writer.docPageContentStart(); writer.docPageContentStart();
writer.docPageBlockStart(); writer.docPageBlockStart();
for (MaisDocConcept concept:doc.getConcepts()) { for (MaisDocConcept concept : doc.getConcepts()) {
writer.printTagCharacters(Tag.h2, concept.getName()); writer.printTagCharacters(Tag.h2, concept.getName());
writer.printTagStart(Tag.p); writer.printTagStart(Tag.p);
writer.printCharacters(concept.getDescriptionHelp()); writer.printCharacters(concept.getDescriptionHelp());
writer.printTagEnd(Tag.p); writer.printTagEnd(Tag.p);
writer.docPageBlockNext(); writer.docPageBlockNext();
} }
for (MaisDocPage docPage:doc.getDocPages()) { for (MaisDocPage docPage : doc.getDocPages()) {
writer.printTagCharacters(Tag.h2, docPage.getName()); writer.printTagCharacters(Tag.h2, docPage.getName());
writer.printTagStart(Tag.p); writer.printTagStart(Tag.p);
writer.printCharacters(docPage.getDescription()); writer.printCharacters(docPage.getDescription());
@ -73,5 +75,6 @@ public class DefaultPageWriterHelp implements MaisDocPageWriter {
} }
writer.docPageBlockEnd(); writer.docPageBlockEnd();
writer.docPageContentEnd(); writer.docPageContentEnd();
//@formatter:on
} }
} }

View file

@ -36,23 +36,23 @@ import org.x4o.sax3.SAX3WriterHtml.Tag;
* @version 1.0 May 22, 2013 * @version 1.0 May 22, 2013
*/ */
public class DefaultPageWriterIndexAll implements MaisDocPageWriter { public class DefaultPageWriterIndexAll implements MaisDocPageWriter {
public static MaisDocPage createDocPage() { public static MaisDocPage createDocPage() {
return new MaisDocPage("index-all","Index","Index of all api ketwords.",new DefaultPageWriterIndexAll()); return new MaisDocPage("index-all", "Index", "Index of all api ketwords.", new DefaultPageWriterIndexAll());
} }
public void writePageContent(MaisDocWriteEvent<MaisDocPage> e) throws IOException { public void writePageContent(MaisDocWriteEvent<MaisDocPage> e) throws IOException {
// ApiDoc doc = e.getDoc(); // ApiDoc doc = e.getDoc();
// ApiDocPage page = e.getEvent(); // ApiDocPage page = e.getEvent();
MaisDocContentWriter writer = e.getWriter(); MaisDocContentWriter writer = e.getWriter();
writer.docPageContentStart(); writer.docPageContentStart();
for (char i='A';i<='Z';i++) { for (char i = 'A'; i <= 'Z'; i++) {
writer.printHref("#_"+i+"_", ""+i); writer.printHref("#_" + i + "_", "" + i);
writer.printCharacters("&nbsp;"); writer.printCharacters("&nbsp;");
} }
for (char i='A';i<='Z';i++) { for (char i = 'A'; i <= 'Z'; i++) {
writer.printHrefNamed("_"+i+"_"); writer.printHrefNamed("_" + i + "_");
writer.printTagCharacters(Tag.h2, ""+i); writer.printTagCharacters(Tag.h2, "" + i);
writer.printCharacters("TODO"); writer.printCharacters("TODO");
} }
writer.docPageContentEnd(); writer.docPageContentEnd();

View file

@ -38,68 +38,68 @@ import org.x4o.sax3.SAX3WriterHtml.Tag;
* @version 1.0 May 22, 2013 * @version 1.0 May 22, 2013
*/ */
public class DefaultPageWriterTree implements MaisDocPageWriter { public class DefaultPageWriterTree implements MaisDocPageWriter {
public static MaisDocPage createDocPage() { public static MaisDocPage createDocPage() {
return new MaisDocPage("overview-tree","Tree","Tree of api concepts.",new DefaultPageWriterTree()); return new MaisDocPage("overview-tree", "Tree", "Tree of api concepts.", new DefaultPageWriterTree());
} }
protected MaisDocNode selectRootNode(MaisDoc doc) { protected MaisDocNode selectRootNode(MaisDoc doc) {
MaisDocNode rootNode = doc.getRootNodeTreePage(); MaisDocNode rootNode = doc.getRootNodeTreePage();
if (rootNode==null) { if (rootNode == null) {
rootNode = doc.getRootNode(); rootNode = doc.getRootNode();
} }
return rootNode; return rootNode;
} }
public void writePageContent(MaisDocWriteEvent<MaisDocPage> e) throws IOException { public void writePageContent(MaisDocWriteEvent<MaisDocPage> e) throws IOException {
MaisDoc doc = e.getDoc(); MaisDoc doc = e.getDoc();
MaisDocPage page = e.getEventObject(); MaisDocPage page = e.getEventObject();
MaisDocContentWriter writer = e.getWriter(); MaisDocContentWriter writer = e.getWriter();
//writer.docPagePackageTitle(title, "Overview Tree"); // writer.docPagePackageTitle(title, "Overview Tree");
writer.docPageContentStart(); writer.docPageContentStart();
writeTree(doc,selectRootNode(doc),writer,""); writeTree(doc, selectRootNode(doc), writer, "");
writer.docPagePackageDescription(page.getName(), "Tree","All Language elements as tree."); writer.docPagePackageDescription(page.getName(), "Tree", "All Language elements as tree.");
writer.docPageContentEnd(); writer.docPageContentEnd();
} }
private void writeTree(MaisDoc doc, MaisDocNode node,MaisDocContentWriter writer,String pathPrefix) throws IOException { private void writeTree(MaisDoc doc, MaisDocNode node, MaisDocContentWriter writer, String pathPrefix) throws IOException {
for (Class<?> excludeClass:doc.getTreeNodeClassExcludes()) { for (Class<?> excludeClass : doc.getTreeNodeClassExcludes()) {
if (excludeClass.isAssignableFrom(node.getUserData().getClass())) { if (excludeClass.isAssignableFrom(node.getUserData().getClass())) {
return; return;
} }
} }
StringBuilder buf = new StringBuilder(); StringBuilder buf = new StringBuilder();
if (!doc.getRootNode().equals(node)) { if (!doc.getRootNode().equals(node)) {
buildParentPath(node,buf); buildParentPath(node, buf);
} }
buf.append("index.html"); buf.append("index.html");
String href = buf.toString(); String href = buf.toString();
writer.printTagStart(Tag.ul); writer.printTagStart(Tag.ul);
writer.printTagStart(Tag.li,"",null,"circle"); writer.printTagStart(Tag.li, "", null, "circle");
if (node.getParent()!=null) { if (node.getParent() != null) {
writer.printCharacters(node.getParent().getId()); writer.printCharacters(node.getParent().getId());
writer.printCharacters(":"); writer.printCharacters(":");
} }
writer.printHref(href, node.getName(), node.getName(), "strong"); writer.printHref(href, node.getName(), node.getName(), "strong");
writer.printTagEnd(Tag.li); writer.printTagEnd(Tag.li);
for (MaisDocNode child:node.getNodes()) { for (MaisDocNode child : node.getNodes()) {
writeTree(doc,child,writer,pathPrefix); writeTree(doc, child, writer, pathPrefix);
} }
writer.printTagEnd(Tag.ul); writer.printTagEnd(Tag.ul);
} }
private void buildParentPath(MaisDocNode node,StringBuilder buf) { private void buildParentPath(MaisDocNode node, StringBuilder buf) {
if (node.getParent()==null) { if (node.getParent() == null) {
buf.append(MaisDocContentWriter.toSafeUri(node.getId())); buf.append(MaisDocContentWriter.toSafeUri(node.getId()));
buf.append('/'); buf.append('/');
return; return;
} }
buildParentPath(node.getParent(),buf); buildParentPath(node.getParent(), buf);
buf.append(MaisDocContentWriter.toSafeUri(node.getId())); buf.append(MaisDocContentWriter.toSafeUri(node.getId()));
buf.append('/'); buf.append('/');
} }

View file

@ -29,28 +29,28 @@ package org.x4o.maisdoc.flake;
* @version 1.0 May 20, 2013 * @version 1.0 May 20, 2013
*/ */
public enum MaisDocContentCss { public enum MaisDocContentCss {
indexHeader, indexHeader,
indexContainer, indexContainer,
bar, bar,
block, block,
blockList, blockList,
strong, strong,
topNav, topNav,
bottomNav, bottomNav,
navList, navList,
navBarCell1Rev, navBarCell1Rev,
subNav, subNav,
subNavList, subNavList,
subTitle, subTitle,
tabEnd, tabEnd,
aboutLanguage, aboutLanguage,
legalCopy, legalCopy,
inheritance, inheritance,
header, header,
description, description,
@ -60,19 +60,18 @@ public enum MaisDocContentCss {
contentContainer, contentContainer,
packageSummary, packageSummary,
overviewSummary, overviewSummary,
colOne, colOne,
colFirst, colFirst,
colLast, colLast,
altColor, altColor,
rowColor, rowColor,
// frame names maybe can be used to create frame-less html5 JS version // frame names maybe can be used to create frame-less html5 JS version
frameNavOverview, frameNavOverview,
frameNavDetail, frameNavDetail,
frameContent, frameContent,;
;
// //
// TODO: write new CSS spec for html root tag to have tag+style class guards in CSS. // 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. // because this sun css of above defines the allowed (styled) html tree structure.

View file

@ -42,84 +42,80 @@ import org.x4o.maisdoc.model.MaisDocWriteEvent;
*/ */
public interface MaisDocContentPrinter { public interface MaisDocContentPrinter {
default void clearHrefContentGroup(MaisDoc doc,MaisDocNode node,String groupType,String group,Class<?> filterClass) { default void clearHrefContentGroup(MaisDoc doc, MaisDocNode node, String groupType, String group, Class<?> filterClass) {
boolean doClear = filterUserDataClassType(node,filterClass).isEmpty(); boolean doClear = filterUserDataClassType(node, filterClass).isEmpty();
if (doClear==false) { if (doClear == false) {
return; return;
} }
clearHrefContentGroupAlways(doc,groupType,group); clearHrefContentGroupAlways(doc, groupType, group);
} }
default void clearHrefContentGroupAlways(MaisDoc doc,String groupType,String group) { default void clearHrefContentGroupAlways(MaisDoc doc, String groupType, String group) {
MaisDocNavLink link = doc.getNodeData().getGroupTypeLink(groupType,group); MaisDocNavLink link = doc.getNodeData().getGroupTypeLink(groupType, group);
if (link==null) { if (link == null) {
return; return;
} }
link.setHref(null); link.setHref(null);
} }
default void printApiTable(MaisDocWriteEvent<MaisDocNode> event,String name,Class<?> interfaceClass) throws IOException { default void printApiTable(MaisDocWriteEvent<MaisDocNode> event, String name, Class<?> interfaceClass) throws IOException {
printApiTable( printApiTable(event.getEventObject(), filterUserDataClassType(event.getEventObject(), interfaceClass), event.getWriter(), name);
event.getEventObject(),
filterUserDataClassType(event.getEventObject(),interfaceClass),
event.getWriter(),
name
);
} }
default void printApiTable(MaisDocNode parent,List<MaisDocNode> nodes,MaisDocContentWriter writer,String name) throws IOException { default void printApiTable(MaisDocNode parent, List<MaisDocNode> nodes, MaisDocContentWriter writer, String name) throws IOException {
if (nodes.isEmpty()) { if (nodes.isEmpty()) {
return; return;
} }
writer.docTableStart(name, "All childeren in "+name,MaisDocContentCss.overviewSummary); writer.docTableStart(name, "All childeren in " + name, MaisDocContentCss.overviewSummary);
writer.docTableHeader("Name", "Description"); writer.docTableHeader("Name", "Description");
for (MaisDocNode child:nodes) { for (MaisDocNode child : nodes) {
String link = MaisDocContentWriter.toSafeUri(child.getId())+"/index.html"; String link = MaisDocContentWriter.toSafeUri(child.getId()) + "/index.html";
if (parent.getParent()==null) { if (parent.getParent() == null) {
link = MaisDocContentWriter.toSafeUri(parent.getId())+"/"+link; // root node link = MaisDocContentWriter.toSafeUri(parent.getId()) + "/" + link; // root node
} }
writer.docTableRowLink(link,child.getName(),child.getDescription()); writer.docTableRowLink(link, child.getName(), child.getDescription());
} }
writer.docTableEnd(); writer.docTableEnd();
} }
private List<MaisDocNode> filterUserDataClassType(MaisDocNode filterNode,Class<?> interfaceClass) { private List<MaisDocNode> filterUserDataClassType(MaisDocNode filterNode, Class<?> interfaceClass) {
List<MaisDocNode> result = new ArrayList<MaisDocNode>(filterNode.getNodes().size()/2); List<MaisDocNode> result = new ArrayList<MaisDocNode>(filterNode.getNodes().size() / 2);
for (MaisDocNode node:filterNode.getNodes()) { for (MaisDocNode node : filterNode.getNodes()) {
if (interfaceClass.isAssignableFrom(node.getUserData().getClass())) { if (interfaceClass.isAssignableFrom(node.getUserData().getClass())) {
result.add(node); result.add(node);
} }
} }
return result; return result;
} }
default void printApiTableBean(MaisDocWriteEvent<MaisDocNode> event,String name,String...skipProperties) throws IOException { default void printApiTableBean(MaisDocWriteEvent<MaisDocNode> event, String name, String... skipProperties) throws IOException {
printApiTableBean(event.getDoc(), event.getWriter(), event.getEventObject().getUserData(), name, skipProperties); 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 { default void printApiTableBean(MaisDoc doc, MaisDocContentWriter writer, Object bean, String name, String... skipProperties) throws IOException {
printApiTableBeanClass(doc, writer, bean, bean.getClass(), name, skipProperties); printApiTableBeanClass(doc, writer, bean, bean.getClass(), name, skipProperties);
} }
default void printApiTableBeanClass(MaisDocWriteEvent<MaisDocNode> event,Class<?> beanClass,String name,String...skipProperties) throws IOException { default void printApiTableBeanClass(MaisDocWriteEvent<MaisDocNode> event, Class<?> beanClass, String name, String... skipProperties) throws IOException {
printApiTableBeanClass(event.getDoc(), event.getWriter(), null,beanClass, name, skipProperties); 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)
writer.docTableStart(name+" Properties", name+" properties overview.",MaisDocContentCss.overviewSummary); throws IOException {
writer.docTableStart(name + " Properties", name + " properties overview.", MaisDocContentCss.overviewSummary);
writer.docTableHeader("Name", "Value"); writer.docTableHeader("Name", "Value");
for (Method m:beanClass.getMethods()) { for (Method m : beanClass.getMethods()) {
if (m.getName().startsWith("get")) { if (m.getName().startsWith("get")) {
String n = m.getName().substring(3); String n = m.getName().substring(3);
if (m.getParameterTypes().length!=0) { if (m.getParameterTypes().length != 0) {
continue; // set without parameters continue; // set without parameters
} }
if (n.length()<2) { if (n.length() < 2) {
continue; continue;
} }
n = n.substring(0,1).toLowerCase()+n.substring(1,n.length()); n = n.substring(0, 1).toLowerCase() + n.substring(1, n.length());
boolean skipNext = false; boolean skipNext = false;
for (String skip:skipProperties) { for (String skip : skipProperties) {
if (n.equals(skip)) { if (n.equals(skip)) {
skipNext = true; skipNext = true;
break; break;
@ -128,9 +124,9 @@ public interface MaisDocContentPrinter {
if (skipNext) { if (skipNext) {
continue; continue;
} }
Object value = null; Object value = null;
if (bean!=null) { if (bean != null) {
try { try {
value = m.invoke(bean, new Object[] {}); value = m.invoke(bean, new Object[] {});
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
@ -143,10 +139,10 @@ public interface MaisDocContentPrinter {
} else { } else {
value = m.getReturnType(); value = m.getReturnType();
} }
//writer.docTableRow(n,); // writer.docTableRow(n,);
writer.docTableRowLastStart(n, null); writer.docTableRowLastStart(n, null);
String c = printValue(doc,writer,value); String c = printValue(doc, writer, value);
if (c!=null) { if (c != null) {
writer.printCharacters(c); writer.printCharacters(c);
} }
writer.docTableRowLastEnd(); writer.docTableRowLastEnd();
@ -154,37 +150,37 @@ public interface MaisDocContentPrinter {
} }
writer.docTableEnd(); writer.docTableEnd();
} }
private String printValue(MaisDoc doc,MaisDocContentWriter writer,Object value) throws IOException { private String printValue(MaisDoc doc, MaisDocContentWriter writer, Object value) throws IOException {
if (value==null) { if (value == null) {
return "null"; return "null";
} }
if (value instanceof String) { if (value instanceof String) {
return (String)value; return (String) value;
} }
if (value instanceof Class) { if (value instanceof Class) {
Class<?> cls = (Class<?>)value; Class<?> cls = (Class<?>) value;
for (MaisDocRemoteClass rc:doc.getRemoteClasses()) { for (MaisDocRemoteClass rc : doc.getRemoteClasses()) {
String remoteUrl = rc.getRemoteUrl(cls); String remoteUrl = rc.getRemoteUrl(cls);
if (remoteUrl==null) { if (remoteUrl == null) {
continue; continue;
} }
writer.printHref(remoteUrl, cls.getSimpleName(), cls.getName()); writer.printHref(remoteUrl, cls.getSimpleName(), cls.getName());
return null; return null;
} }
return "class "+cls.getName(); return "class " + cls.getName();
} }
if (value instanceof List) { if (value instanceof List) {
StringBuilder buf = new StringBuilder(100); StringBuilder buf = new StringBuilder(100);
buf.append("[L: "); buf.append("[L: ");
List<?> l = (List<?>)value; List<?> l = (List<?>) value;
if (l.isEmpty()) { if (l.isEmpty()) {
buf.append("Empty"); buf.append("Empty");
} }
for (Object o:l) { for (Object o : l) {
buf.append(""+o); buf.append("" + o);
buf.append(" "); buf.append(" ");
} }
buf.append("]"); buf.append("]");
@ -193,18 +189,18 @@ public interface MaisDocContentPrinter {
if (value instanceof Object[]) { if (value instanceof Object[]) {
StringBuilder buf = new StringBuilder(100); StringBuilder buf = new StringBuilder(100);
buf.append("[A: "); buf.append("[A: ");
Object[] l = (Object[])value; Object[] l = (Object[]) value;
if (l.length==0) { if (l.length == 0) {
buf.append("Empty"); buf.append("Empty");
} }
for (Object o:l) { for (Object o : l) {
buf.append(""+o); buf.append("" + o);
buf.append(" "); buf.append(" ");
} }
buf.append("]"); buf.append("]");
return buf.toString(); return buf.toString();
} }
return value.toString(); return value.toString();
} }
} }

View file

@ -39,23 +39,24 @@ import org.xml.sax.helpers.AttributesImpl;
* @version 1.0 Apr 30, 2013 * @version 1.0 Apr 30, 2013
*/ */
public class MaisDocContentWriter extends SAX3WriterHtml { public class MaisDocContentWriter extends SAX3WriterHtml {
private boolean isRowAlt = false; private boolean isRowAlt = false;
public MaisDocContentWriter(Writer out, String encoding) { public MaisDocContentWriter(Writer out, String encoding) {
super(out,encoding); super(out, encoding);
} }
public void docCommentGenerated() throws IOException { public void docCommentGenerated() throws IOException {
printComment("Generated by " + MaisDocContentWriter.class.getSimpleName( )+ " on " + new Date()); printComment("Generated by " + MaisDocContentWriter.class.getSimpleName() + " on " + new Date());
} }
public void docHtmlStart(String title,List<String> keywords, String pathPrefix) throws IOException { public void docHtmlStart(String title, List<String> keywords, String pathPrefix) throws IOException {
printDocType(DocType.HTML_4_TRANSITIONAL); printDocType(DocType.HTML_4_TRANSITIONAL);
printComment("NewPage"); printComment("NewPage");
printHtmlStart("en"); printHtmlStart("en");
// ====== Write head // ====== Write head
//@formatter:off
printTagStart(Tag.head); printTagStart(Tag.head);
docCommentGenerated(); docCommentGenerated();
printHeadMetaContentType(); printHeadMetaContentType();
@ -67,36 +68,41 @@ public class MaisDocContentWriter extends SAX3WriterHtml {
printHeadLinkCss(pathPrefix+"resources/stylesheet.css"); printHeadLinkCss(pathPrefix+"resources/stylesheet.css");
printScriptSrc(pathPrefix+"resources/api-theme.js"); printScriptSrc(pathPrefix+"resources/api-theme.js");
printTagEnd(Tag.head); printTagEnd(Tag.head);
//@formatter:on
// ======= Write body // ======= Write body
printTagStart(Tag.body); printTagStart(Tag.body);
StringBuilder script = new StringBuilder(); StringBuilder script = new StringBuilder();
script.append("\n"); script.append("\n");
script.append("\tif (location.href.indexOf('is-external=true') == -1) {\n"); script.append("\tif (location.href.indexOf('is-external=true') == -1) {\n");
script.append("\t\ttry {\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\t} catch (e) {}\n");
script.append("\t}\n"); script.append("\t}\n");
printScriptInline(script.toString()); printScriptInline(script.toString());
printScriptNoDiv(); printScriptNoDiv();
} }
public void docHtmlEnd(String copyright, String statsJS) throws IOException { public void docHtmlEnd(String copyright, String statsJS) throws IOException {
//@formatter:off
printTagStart(Tag.p,MaisDocContentCss.legalCopy); printTagStart(Tag.p,MaisDocContentCss.legalCopy);
printTagStart(Tag.small); printTagStart(Tag.small);
printCharacters(copyright); printCharacters(copyright);
printTagEnd(Tag.small); printTagEnd(Tag.small);
printTagEnd(Tag.p); printTagEnd(Tag.p);
//@formatter:on
if (statsJS != null) { if (statsJS != null) {
printScriptInline(statsJS); printScriptInline(statsJS);
} }
printTagEnd(Tag.body); printTagEnd(Tag.body);
printHtmlEnd(); printHtmlEnd();
} }
public void docNavBarAbout(String about) throws IOException { public void docNavBarAbout(String about) throws IOException {
printTagStart(Tag.div,MaisDocContentCss.aboutLanguage); // Print about language printTagStart(Tag.div, MaisDocContentCss.aboutLanguage); // Print about language
printTagStart(Tag.em); printTagStart(Tag.em);
printTagStart(Tag.strong); printTagStart(Tag.strong);
String[] lines = about.split("\n"); String[] lines = about.split("\n");
@ -109,58 +115,60 @@ public class MaisDocContentWriter extends SAX3WriterHtml {
} }
printTagEnd(Tag.strong); printTagEnd(Tag.strong);
printTagEnd(Tag.em); printTagEnd(Tag.em);
printTagEnd(Tag.div); printTagEnd(Tag.div);
} }
public void docPagePackageTitle(String title, String summary) throws IOException { public void docPagePackageTitle(String title, String summary) throws IOException {
printTagStart(Tag.div,MaisDocContentCss.header); //@formatter:off
printTagCharacters(Tag.h1, title,"title"); printTagStart(Tag.div, MaisDocContentCss.header);
printTagStart(Tag.div,MaisDocContentCss.docSummary); printTagCharacters(Tag.h1, title, "title");
printTagCharacters(Tag.div, summary,MaisDocContentCss.block.name()); printTagStart(Tag.div, MaisDocContentCss.docSummary);
printTagCharacters(Tag.div, summary, MaisDocContentCss.block.name());
printTagEnd(Tag.div); printTagEnd(Tag.div);
printTagStart(Tag.p); printTagStart(Tag.p);
printCharacters("See:&nbsp;"); printCharacters("See:&nbsp;");
printHref("#package_description", "Description"); printHref("#package_description", "Description");
printTagEnd(Tag.p); printTagEnd(Tag.p);
printTagEnd(Tag.div); printTagEnd(Tag.div);
//@formatter:on
} }
public void docPagePackageDescription(String title, String summary, String description) throws IOException { public void docPagePackageDescription(String title, String summary, String description) throws IOException {
printHrefNamed("package_description"); printHrefNamed("package_description");
printTagCharacters(Tag.h2, title); printTagCharacters(Tag.h2, title);
printTagCharacters(Tag.div, summary,MaisDocContentCss.block.name()); printTagCharacters(Tag.div, summary, MaisDocContentCss.block.name());
printCharacters(description); printCharacters(description);
} }
public void docPageClassStart(String title, String subTitle, Tag titleTag) throws IOException { public void docPageClassStart(String title, String subTitle, Tag titleTag) throws IOException {
printComment("======== START OF CLASS DATA ========"); printComment("======== START OF CLASS DATA ========");
printTagStart(Tag.div,MaisDocContentCss.header); printTagStart(Tag.div, MaisDocContentCss.header);
if (subTitle != null) { if (subTitle != null) {
printTagStart(Tag.div,MaisDocContentCss.subTitle); printTagStart(Tag.div, MaisDocContentCss.subTitle);
printCharacters(subTitle); printCharacters(subTitle);
printTagEnd(Tag.div); printTagEnd(Tag.div);
} }
printTagCharacters(titleTag, title, "title"); printTagCharacters(titleTag, title, "title");
printTagEnd(Tag.div); printTagEnd(Tag.div);
} }
public void docPageClassEnd() throws IOException { public void docPageClassEnd() throws IOException {
printComment("======== END OF CLASS DATA ========"); printComment("======== END OF CLASS DATA ========");
} }
public ContentCloseable docPageContent() throws IOException { public ContentCloseable docPageContent() throws IOException {
docPageContentStart(); docPageContentStart();
return () -> docPageContentEnd(); return () -> docPageContentEnd();
} }
public void docPageContentStart() throws IOException { public void docPageContentStart() throws IOException {
printTagStart(Tag.div,MaisDocContentCss.contentContainer); printTagStart(Tag.div, MaisDocContentCss.contentContainer);
} }
public void docPageContentEnd() throws IOException { public void docPageContentEnd() throws IOException {
printTagEnd(Tag.div); printTagEnd(Tag.div);
} }
public void docPageBlockStart(String title, String namedLink, String comment) throws IOException { public void docPageBlockStart(String title, String namedLink, String comment) throws IOException {
if (comment != null) { if (comment != null) {
printComment(comment); printComment(comment);
@ -169,32 +177,32 @@ public class MaisDocContentWriter extends SAX3WriterHtml {
printHrefNamed(namedLink); printHrefNamed(namedLink);
printTagCharacters(Tag.h3, title); printTagCharacters(Tag.h3, title);
} }
public void docPageBlockStart() throws IOException { public void docPageBlockStart() throws IOException {
printTagStart(Tag.ul,MaisDocContentCss.blockList); printTagStart(Tag.ul, MaisDocContentCss.blockList);
printTagStart(Tag.li,MaisDocContentCss.blockList); printTagStart(Tag.li, MaisDocContentCss.blockList);
} }
public void docPageBlockEnd() throws IOException { public void docPageBlockEnd() throws IOException {
printTagEnd(Tag.li); printTagEnd(Tag.li);
printTagEnd(Tag.ul); printTagEnd(Tag.ul);
} }
public void docPageBlockNext() throws IOException { public void docPageBlockNext() throws IOException {
printTagEnd(Tag.li); printTagEnd(Tag.li);
printTagStart(Tag.li,MaisDocContentCss.blockList); printTagStart(Tag.li, MaisDocContentCss.blockList);
} }
public ContentCloseable docTable(String tableTitle, String tableDescription, MaisDocContentCss tableCss) throws IOException { public ContentCloseable docTable(String tableTitle, String tableDescription, MaisDocContentCss tableCss) throws IOException {
docTableStart(tableTitle, tableDescription, tableCss); docTableStart(tableTitle, tableDescription, tableCss);
return () -> docTableEnd(); return () -> docTableEnd();
} }
public void docTableStart(String tableTitle, String tableDescription, MaisDocContentCss tableCss) throws IOException { public void docTableStart(String tableTitle, String tableDescription, MaisDocContentCss tableCss) throws IOException {
isRowAlt = false; isRowAlt = false;
AttributesImpl atts = new AttributesImpl(); AttributesImpl atts = new AttributesImpl();
if (tableCss != null) { if (tableCss != null) {
atts.addAttribute ("", "class", "", "", tableCss.name()); atts.addAttribute("", "class", "", "", tableCss.name());
} }
atts.addAttribute("", "border", "", "", "0"); atts.addAttribute("", "border", "", "", "0");
atts.addAttribute("", "cellpadding", "", "", "3"); atts.addAttribute("", "cellpadding", "", "", "3");
@ -202,18 +210,20 @@ public class MaisDocContentWriter extends SAX3WriterHtml {
if (tableDescription != null) { if (tableDescription != null) {
atts.addAttribute("", "summary", "", "", tableDescription); atts.addAttribute("", "summary", "", "", tableDescription);
} }
printTagStart(Tag.table,atts); printTagStart(Tag.table, atts);
//@formatter:off
printTagStart(Tag.caption); printTagStart(Tag.caption);
printTagStart(Tag.span);printCharacters(tableTitle);printTagEnd(Tag.span); printTagStart(Tag.span);printCharacters(tableTitle);printTagEnd(Tag.span);
printTagStart(Tag.span,MaisDocContentCss.tabEnd);printCharacters("&nbsp;");printTagEnd(Tag.span); printTagStart(Tag.span,MaisDocContentCss.tabEnd);printCharacters("&nbsp;");printTagEnd(Tag.span);
printTagEnd(Tag.caption); printTagEnd(Tag.caption);
//@formatter:on
} }
public void docTableEnd() throws IOException { public void docTableEnd() throws IOException {
printTagEnd(Tag.table); printTagEnd(Tag.table);
} }
public void docTableHeader(String titleFirst, String titleLast) throws IOException { public void docTableHeader(String titleFirst, String titleLast) throws IOException {
printTagStart(Tag.tr); printTagStart(Tag.tr);
AttributesImpl atts = new AttributesImpl(); AttributesImpl atts = new AttributesImpl();
@ -223,7 +233,7 @@ public class MaisDocContentWriter extends SAX3WriterHtml {
atts.addAttribute("", "class", "", "", MaisDocContentCss.colFirst.name()); atts.addAttribute("", "class", "", "", MaisDocContentCss.colFirst.name());
} }
atts.addAttribute("", "scope", "", "", "col"); atts.addAttribute("", "scope", "", "", "col");
printTagStart(Tag.th,atts); printTagStart(Tag.th, atts);
printCharacters(titleFirst); printCharacters(titleFirst);
printTagEnd(Tag.th); printTagEnd(Tag.th);
if (titleLast == null) { if (titleLast == null) {
@ -233,49 +243,50 @@ public class MaisDocContentWriter extends SAX3WriterHtml {
atts = new AttributesImpl(); atts = new AttributesImpl();
atts.addAttribute("", "class", "", "", MaisDocContentCss.colLast.name()); atts.addAttribute("", "class", "", "", MaisDocContentCss.colLast.name());
atts.addAttribute("", "scope", "", "", "col"); atts.addAttribute("", "scope", "", "", "col");
printTagStart(Tag.th,atts); printTagStart(Tag.th, atts);
printCharacters(titleLast); printCharacters(titleLast);
printTagEnd(Tag.th); printTagEnd(Tag.th);
printTagEnd(Tag.tr); printTagEnd(Tag.tr);
} }
public void docTableRowLink(String dataFirstHref, String dataFirst, String dataLast) throws IOException { public void docTableRowLink(String dataFirstHref, String dataFirst, String dataLast) throws IOException {
docTableRowHref(dataFirstHref, dataFirst, dataLast, null, false, false, false); docTableRowHref(dataFirstHref, dataFirst, dataLast, null, false, false, false);
} }
public void docTableRow(String dataFirst, String dataLast) throws IOException { public void docTableRow(String dataFirst, String dataLast) throws IOException {
docTableRow(dataFirst, dataLast, null); docTableRow(dataFirst, dataLast, null);
} }
public void docTableRow(String dataFirst, String dataLast, String dataBlock) throws IOException { public void docTableRow(String dataFirst, String dataLast, String dataBlock) throws IOException {
docTableRowHref(null, dataFirst, dataLast, dataBlock, false, false, false); docTableRowHref(null, dataFirst, dataLast, dataBlock, false, false, false);
} }
public void docTableRowLastStart(String dataFirst, String dataFirstHref) throws IOException { public void docTableRowLastStart(String dataFirst, String dataFirstHref) throws IOException {
docTableRowHref(dataFirstHref, dataFirst, null, null, false, false, true); docTableRowHref(dataFirstHref, dataFirst, null, null, false, false, true);
} }
public void docTableRowLastEnd() throws IOException { public void docTableRowLastEnd() throws IOException {
printTagEnd(Tag.td); printTagEnd(Tag.td);
printTagEnd(Tag.tr); printTagEnd(Tag.tr);
} }
public ContentCloseable docTableRow() throws IOException { public ContentCloseable docTableRow() throws IOException {
if (isRowAlt) { if (isRowAlt) {
printTagStart(Tag.tr,MaisDocContentCss.altColor); printTagStart(Tag.tr, MaisDocContentCss.altColor);
} else { } else {
printTagStart(Tag.tr,MaisDocContentCss.rowColor); printTagStart(Tag.tr, MaisDocContentCss.rowColor);
} }
isRowAlt = !isRowAlt; isRowAlt = !isRowAlt;
return () -> printTagEnd(Tag.tr); 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(); Closeable tableRow = docTableRow();
if (dataLast == null) { if (dataLast == null) {
printTagStart(Tag.td,MaisDocContentCss.colOne); printTagStart(Tag.td, MaisDocContentCss.colOne);
} else { } else {
printTagStart(Tag.td,MaisDocContentCss.colFirst); printTagStart(Tag.td, MaisDocContentCss.colFirst);
} }
if (dataFirstCode) { if (dataFirstCode) {
printTagStart(Tag.code); printTagStart(Tag.code);
@ -289,48 +300,49 @@ public class MaisDocContentWriter extends SAX3WriterHtml {
printTagEnd(Tag.code); printTagEnd(Tag.code);
} }
printTagEnd(Tag.td); printTagEnd(Tag.td);
if (skipLast) { if (skipLast) {
printTagStart(Tag.td,MaisDocContentCss.colLast); printTagStart(Tag.td, MaisDocContentCss.colLast);
return; return;
} }
if (dataLast == null) { if (dataLast == null) {
printTagEnd(Tag.tr); printTagEnd(Tag.tr);
return; return;
} }
//@formatter:off
printTagStart(Tag.td,MaisDocContentCss.colLast); printTagStart(Tag.td,MaisDocContentCss.colLast);
if (dataLastCode) { if (dataLastCode) {
printTagStart(Tag.code);printCharacters(dataLast);printTagEnd(Tag.code); printTagStart(Tag.code);printCharacters(dataLast);printTagEnd(Tag.code);
} else { } else {
printTagStart(Tag.div,MaisDocContentCss.block);printCharacters(dataLast);printTagEnd(Tag.div); printTagStart(Tag.div, MaisDocContentCss.block);printCharacters(dataLast);printTagEnd(Tag.div);
} }
if (dataBlock != null) { if (dataBlock != null) {
printTagStart(Tag.div,MaisDocContentCss.block);printCharacters(dataBlock);printTagEnd(Tag.div); printTagStart(Tag.div, MaisDocContentCss.block);printCharacters(dataBlock);printTagEnd(Tag.div);
} }
printTagEnd(Tag.td); printTagEnd(Tag.td);
//@formatter:on
tableRow.close(); tableRow.close();
} }
static public String toSafeUri(List<String> paths) { static public String toSafeUri(List<String> paths) {
return toSafeUri(paths.toArray(new String[]{})); return toSafeUri(paths.toArray(new String[] {}));
} }
static public String toSafeUri(String...paths) { static public String toSafeUri(String... paths) {
StringBuilder result = new StringBuilder(100); StringBuilder result = new StringBuilder(100);
for (int i = 0; i < paths.length; i++) { for (int i = 0; i < paths.length; i++) {
String path = paths[i]; String path = paths[i];
result.append(toSafeUri(path)); result.append(toSafeUri(path));
if (i < (paths.length -1)) { if (i < (paths.length - 1)) {
result.append('/'); result.append('/');
} }
} }
return result.toString(); return result.toString();
} }
static public String toSafeUri(String uri) { static public String toSafeUri(String uri) {
StringBuilder buf = new StringBuilder(20); StringBuilder buf = new StringBuilder(20);
for (char c : uri.toLowerCase().toCharArray()) { // TODO: unicode 16+ error for (char c : uri.toLowerCase().toCharArray()) { // TODO: unicode 16+ error
@ -340,13 +352,13 @@ public class MaisDocContentWriter extends SAX3WriterHtml {
if (Character.isDigit(c)) { if (Character.isDigit(c)) {
buf.append(c); buf.append(c);
} }
if ('.'==c) { if ('.' == c) {
buf.append(c); buf.append(c);
} }
if ('-'==c) { if ('-' == c) {
buf.append(c); buf.append(c);
} }
if ('_'==c) { if ('_' == c) {
buf.append(c); buf.append(c);
} }
} }

View file

@ -42,83 +42,83 @@ public class MaisDocNodeDataConfiguratorBean implements MaisDocNodeDataConfigura
private Object bean = null; private Object bean = null;
private String method = null; private String method = null;
private List<Class<?>> targetClasses = null; private List<Class<?>> targetClasses = null;
public MaisDocNodeDataConfiguratorBean() { public MaisDocNodeDataConfiguratorBean() {
targetClasses = new ArrayList<Class<?>>(5); targetClasses = new ArrayList<Class<?>>(5);
} }
public MaisDocNodeDataConfiguratorBean(Object bean,String method,Class<?>...classes) { public MaisDocNodeDataConfiguratorBean(Object bean, String method, Class<?>... classes) {
this(); this();
setBean(bean); setBean(bean);
setMethod(method); setMethod(method);
for (Class<?> cl:classes) { for (Class<?> cl : classes) {
addtargetClass(cl); addtargetClass(cl);
} }
} }
public static void addAnnotatedNodeDataConfigurators(MaisDoc doc,Object bean) { public static void addAnnotatedNodeDataConfigurators(MaisDoc doc, Object bean) {
if (doc==null) { if (doc == null) {
throw new NullPointerException("Can't add to null ApiDoc."); throw new NullPointerException("Can't add to null ApiDoc.");
} }
if (bean==null) { if (bean == null) {
throw new NullPointerException("Can't scan null bean."); throw new NullPointerException("Can't scan null bean.");
} }
for (Method method:bean.getClass().getMethods()) { for (Method method : bean.getClass().getMethods()) {
MaisDocNodeDataConfiguratorMethod ammo = method.getAnnotation(MaisDocNodeDataConfiguratorMethod.class); MaisDocNodeDataConfiguratorMethod ammo = method.getAnnotation(MaisDocNodeDataConfiguratorMethod.class);
if (ammo==null) { if (ammo == null) {
continue; continue;
} }
if (ammo.targetClasses().length==0) { if (ammo.targetClasses().length == 0) {
throw new IllegalArgumentException("Can't configure writer bean with empty 'targetClasses' parameter."); throw new IllegalArgumentException("Can't configure writer bean with empty 'targetClasses' parameter.");
} }
MaisDocNodeDataConfiguratorBean methodConfig = new MaisDocNodeDataConfiguratorBean(bean, method.getName(), ammo.targetClasses()); MaisDocNodeDataConfiguratorBean methodConfig = new MaisDocNodeDataConfiguratorBean(bean, method.getName(), ammo.targetClasses());
doc.addDataConfigurator(methodConfig); doc.addDataConfigurator(methodConfig);
} }
} }
public void configNodeData(MaisDoc doc, MaisDocNode node,MaisDocNodeData data) { public void configNodeData(MaisDoc doc, MaisDocNode node, MaisDocNodeData data) {
Class<?> beanClass = getBean().getClass(); Class<?> beanClass = getBean().getClass();
try { try {
Method methodBean = beanClass.getMethod(getMethod(), new Class[]{MaisDoc.class,MaisDocNode.class,MaisDocNodeData.class}); Method methodBean = beanClass.getMethod(getMethod(), new Class[] { MaisDoc.class, MaisDocNode.class, MaisDocNodeData.class });
methodBean.invoke(getBean(), new Object[]{doc,node,data}); methodBean.invoke(getBean(), new Object[] { doc, node, data });
} catch (Exception e) { } catch (Exception e) {
throw new IllegalStateException(e); throw new IllegalStateException(e);
} }
} }
public void addtargetClass(Class<?> targetClass) { public void addtargetClass(Class<?> targetClass) {
targetClasses.add(targetClass); targetClasses.add(targetClass);
} }
public void removetargetClass(Class<?> targetClass) { public void removetargetClass(Class<?> targetClass) {
targetClasses.remove(targetClass); targetClasses.remove(targetClass);
} }
public List<Class<?>> getTargetClasses() { public List<Class<?>> getTargetClasses() {
return targetClasses; return targetClasses;
} }
/** /**
* @return the bean * @return the bean
*/ */
public Object getBean() { public Object getBean() {
return bean; return bean;
} }
/** /**
* @param bean the bean to set * @param bean the bean to set
*/ */
public void setBean(Object bean) { public void setBean(Object bean) {
this.bean = bean; this.bean = bean;
} }
/** /**
* @return the method * @return the method
*/ */
public String getMethod() { public String getMethod() {
return method; return method;
} }
/** /**
* @param method the method to set * @param method the method to set
*/ */

View file

@ -34,8 +34,8 @@ import java.lang.annotation.Target;
* @version 1.0 Aug 11, 2013 * @version 1.0 Aug 11, 2013
*/ */
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD}) @Target({ ElementType.METHOD })
public @interface MaisDocNodeDataConfiguratorMethod { public @interface MaisDocNodeDataConfiguratorMethod {
Class<?>[] targetClasses(); Class<?>[] targetClasses();
} }

View file

@ -48,154 +48,155 @@ public class MaisDocNodeWriterBean implements MaisDocNodeWriter {
private List<Class<?>> targetClasses = null; private List<Class<?>> targetClasses = null;
private String contentGroup = null; private String contentGroup = null;
private String contentGroupType = null; private String contentGroupType = null;
public MaisDocNodeWriterBean() { public MaisDocNodeWriterBean() {
targetClasses = new ArrayList<Class<?>>(5); targetClasses = new ArrayList<Class<?>>(5);
} }
public MaisDocNodeWriterBean(MaisDocNodeBody nodeBody,Object bean,String method,Class<?>...classes) { public MaisDocNodeWriterBean(MaisDocNodeBody nodeBody, Object bean, String method, Class<?>... classes) {
this(); this();
setNodeBody(nodeBody); setNodeBody(nodeBody);
setBean(bean); setBean(bean);
setMethod(method); setMethod(method);
for (Class<?> cl:classes) { for (Class<?> cl : classes) {
addtargetClass(cl); addtargetClass(cl);
} }
} }
public static void addAnnotatedNodeContentWriters(MaisDoc doc,Object bean) { public static void addAnnotatedNodeContentWriters(MaisDoc doc, Object bean) {
if (doc==null) { if (doc == null) {
throw new NullPointerException("Can't add to null ApiDoc."); throw new NullPointerException("Can't add to null ApiDoc.");
} }
if (bean==null) { if (bean == null) {
throw new NullPointerException("Can't scan null bean."); throw new NullPointerException("Can't scan null bean.");
} }
for (Method method:bean.getClass().getMethods()) { for (Method method : bean.getClass().getMethods()) {
MaisDocNodeWriterMethod ammo = method.getAnnotation(MaisDocNodeWriterMethod.class); MaisDocNodeWriterMethod ammo = method.getAnnotation(MaisDocNodeWriterMethod.class);
if (ammo==null) { if (ammo == null) {
continue; continue;
} }
if (ammo.targetClasses().length==0) { if (ammo.targetClasses().length == 0) {
throw new IllegalArgumentException("Can't configure writer bean with empty 'targetClasses' parameter."); throw new IllegalArgumentException("Can't configure writer bean with empty 'targetClasses' parameter.");
} }
if (ammo.targetClasses().length!=ammo.nodeBodyOrders().length) { 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()); MaisDocNodeWriterBean methodWriter = new MaisDocNodeWriterBean(ammo.nodeBody(), bean, method.getName(), ammo.targetClasses());
List<Integer> nodeBodyOrder = new ArrayList<Integer>(); List<Integer> nodeBodyOrder = new ArrayList<Integer>();
for (int order:ammo.nodeBodyOrders()) { for (int order : ammo.nodeBodyOrders()) {
nodeBodyOrder.add(order); nodeBodyOrder.add(order);
} }
methodWriter.setNodeBodyOrders(nodeBodyOrder); methodWriter.setNodeBodyOrders(nodeBodyOrder);
if (ammo.contentGroup().length()>0) { if (ammo.contentGroup().length() > 0) {
methodWriter.setContentGroup(ammo.contentGroup()); methodWriter.setContentGroup(ammo.contentGroup());
} }
if (ammo.contentGroupType().length()>0) { if (ammo.contentGroupType().length() > 0) {
methodWriter.setContentGroupType(ammo.contentGroupType()); methodWriter.setContentGroupType(ammo.contentGroupType());
} }
doc.addNodeBodyWriter(methodWriter); doc.addNodeBodyWriter(methodWriter);
} }
} }
public void writeNodeContent(MaisDocWriteEvent<MaisDocNode> event) throws IOException { public void writeNodeContent(MaisDocWriteEvent<MaisDocNode> event) throws IOException {
Class<?> beanClass = getBean().getClass(); Class<?> beanClass = getBean().getClass();
try { try {
Method methodBean = beanClass.getMethod(getMethod(), new Class[]{MaisDocWriteEvent.class}); Method methodBean = beanClass.getMethod(getMethod(), new Class[] { MaisDocWriteEvent.class });
methodBean.invoke(getBean(), new Object[]{event}); methodBean.invoke(getBean(), new Object[] { event });
} catch (Exception e) { } catch (Exception e) {
throw new IOException(e); throw new IOException(e);
} }
} }
public void addtargetClass(Class<?> targetClass) { public void addtargetClass(Class<?> targetClass) {
targetClasses.add(targetClass); targetClasses.add(targetClass);
} }
public void removetargetClass(Class<?> targetClass) { public void removetargetClass(Class<?> targetClass) {
targetClasses.remove(targetClass); targetClasses.remove(targetClass);
} }
public List<Class<?>> getTargetClasses() { public List<Class<?>> getTargetClasses() {
return targetClasses; return targetClasses;
} }
/** /**
* @return the nodeBody * @return the nodeBody
*/ */
public MaisDocNodeBody getNodeBody() { public MaisDocNodeBody getNodeBody() {
return nodeBody; return nodeBody;
} }
/** /**
* @param nodeBody the nodeBody to set * @param nodeBody the nodeBody to set
*/ */
public void setNodeBody(MaisDocNodeBody nodeBody) { public void setNodeBody(MaisDocNodeBody nodeBody) {
this.nodeBody = nodeBody; this.nodeBody = nodeBody;
} }
/** /**
* @return the bean * @return the bean
*/ */
public Object getBean() { public Object getBean() {
return bean; return bean;
} }
/** /**
* @param bean the bean to set * @param bean the bean to set
*/ */
public void setBean(Object bean) { public void setBean(Object bean) {
this.bean = bean; this.bean = bean;
} }
/** /**
* @return the method * @return the method
*/ */
public String getMethod() { public String getMethod() {
return method; return method;
} }
/** /**
* @param method the method to set * @param method the method to set
*/ */
public void setMethod(String method) { public void setMethod(String method) {
this.method = method; this.method = method;
} }
/** /**
* @return the nodeBodyOrders * @return the nodeBodyOrders
*/ */
public List<Integer> getNodeBodyOrders() { public List<Integer> getNodeBodyOrders() {
return nodeBodyOrders; return nodeBodyOrders;
} }
/** /**
* @param nodeBodyOrders the nodeBodyOrders to set * @param nodeBodyOrders the nodeBodyOrders to set
*/ */
public void setNodeBodyOrders(List<Integer> nodeBodyOrders) { public void setNodeBodyOrders(List<Integer> nodeBodyOrders) {
this.nodeBodyOrders = nodeBodyOrders; this.nodeBodyOrders = nodeBodyOrders;
} }
/** /**
* @return the contentGroup * @return the contentGroup
*/ */
public String getContentGroup() { public String getContentGroup() {
return contentGroup; return contentGroup;
} }
/** /**
* @param contentGroup the contentGroup to set * @param contentGroup the contentGroup to set
*/ */
public void setContentGroup(String contentGroup) { public void setContentGroup(String contentGroup) {
this.contentGroup = contentGroup; this.contentGroup = contentGroup;
} }
/** /**
* @return the contentGroupType * @return the contentGroupType
*/ */
public String getContentGroupType() { public String getContentGroupType() {
return contentGroupType; return contentGroupType;
} }
/** /**
* @param contentGroupType the contentGroupType to set * @param contentGroupType the contentGroupType to set
*/ */

View file

@ -36,16 +36,16 @@ import org.x4o.maisdoc.model.MaisDocNodeBody;
* @version 1.0 May 19, 2013 * @version 1.0 May 19, 2013
*/ */
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD}) @Target({ ElementType.METHOD })
public @interface MaisDocNodeWriterMethod { public @interface MaisDocNodeWriterMethod {
Class<?>[] targetClasses(); Class<?>[] targetClasses();
MaisDocNodeBody nodeBody(); MaisDocNodeBody nodeBody();
int[] nodeBodyOrders() default {-1}; int[] nodeBodyOrders() default { -1 };
String contentGroup() default ""; String contentGroup() default "";
String contentGroupType() default ""; String contentGroupType() default "";
} }

View file

@ -75,10 +75,10 @@ public class MaisDoc {
private boolean skipRootTreePathNode = true; private boolean skipRootTreePathNode = true;
private boolean printConceptTitle = true; private boolean printConceptTitle = true;
private boolean printConceptPrevNext = true; private boolean printConceptPrevNext = true;
private Map<String,String> groupTypeNames = null; private Map<String, String> groupTypeNames = null;
private Map<String,Integer> groupTypeOrder = null; private Map<String, Integer> groupTypeOrder = null;
private String docPageSubTitle = null; private String docPageSubTitle = null;
public MaisDoc() { public MaisDoc() {
nodeBodyWriters = new ArrayList<MaisDocNodeWriter>(20); nodeBodyWriters = new ArrayList<MaisDocNodeWriter>(20);
concepts = new ArrayList<MaisDocConcept>(10); concepts = new ArrayList<MaisDocConcept>(10);
@ -89,69 +89,69 @@ public class MaisDoc {
dataConfigurators = new ArrayList<MaisDocNodeDataConfigurator>(5); dataConfigurators = new ArrayList<MaisDocNodeDataConfigurator>(5);
annotatedClasses = new ArrayList<Class<?>>(5); annotatedClasses = new ArrayList<Class<?>>(5);
remoteClasses = new ArrayList<MaisDocRemoteClass>(5); remoteClasses = new ArrayList<MaisDocRemoteClass>(5);
groupTypeNames = new HashMap<String,String>(3); groupTypeNames = new HashMap<String, String>(3);
groupTypeOrder = new HashMap<String,Integer>(3); groupTypeOrder = new HashMap<String, Integer>(3);
} }
public void checkModel() throws NullPointerException,IllegalArgumentException { public void checkModel() throws NullPointerException, IllegalArgumentException {
checkNull(name,"name"); checkNull(name, "name");
checkNull(description,"description"); checkNull(description, "description");
checkNull(docAbout,"docAbout"); checkNull(docAbout, "docAbout");
checkNull(docCopyright,"docCopyright"); checkNull(docCopyright, "docCopyright");
checkNull(rootNode,"rootNode"); checkNull(rootNode, "rootNode");
checkNull(frameNavConceptClass,"frameNavConceptClass"); checkNull(frameNavConceptClass, "frameNavConceptClass");
checkNull(noFrameAllName,"noFrameAllName"); checkNull(noFrameAllName, "noFrameAllName");
if (concepts.isEmpty()) { if (concepts.isEmpty()) {
throw new IllegalStateException("Can't work with empty concepts"); throw new IllegalStateException("Can't work with empty concepts");
} }
if (frameNavOverviewPrintParent==null) { if (frameNavOverviewPrintParent == null) {
setFrameNavOverviewPrintParent(false); setFrameNavOverviewPrintParent(false);
} }
if (frameNavPrintParent==null) { if (frameNavPrintParent == null) {
setFrameNavPrintParent(false); setFrameNavPrintParent(false);
} }
if (frameNavPrintParentParent==null) { if (frameNavPrintParentParent == null) {
setFrameNavPrintParentParent(false); setFrameNavPrintParentParent(false);
} }
if (frameNavPrintParentId==null) { if (frameNavPrintParentId == null) {
setFrameNavPrintParentId(false); setFrameNavPrintParentId(false);
} }
if (metaStyleSheetThema==null) { if (metaStyleSheetThema == null) {
setMetaStyleSheetThema("jdk7"); setMetaStyleSheetThema("jdk7");
} }
if (noFrameAllTopJS==null) { if (noFrameAllTopJS == null) {
noFrameAllTopJS = "\nallClassesLink = document.getElementById(\"allclasses_navbar_top\");\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(window==top) {\n\tallClassesLink.style.display = \"block\";\n} else {\n\tallClassesLink.style.display = \"none\";\n}\n";
} }
if (noFrameAllBottomJS==null) { if (noFrameAllBottomJS == null) {
noFrameAllBottomJS = "\nallClassesLink = document.getElementById(\"allclasses_navbar_bottom\");\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(window==top) {\n\tallClassesLink.style.display = \"block\";\n} else {\n\tallClassesLink.style.display = \"none\";\n}\n";
} }
if (noFrameAllLink==null) { if (noFrameAllLink == null) {
MaisDocConcept navConcept = findConceptByClass(getFrameNavConceptClass()); MaisDocConcept navConcept = findConceptByClass(getFrameNavConceptClass());
setNoFrameAllLink("all"+navConcept.getId()+"-noframe.html"); setNoFrameAllLink("all" + navConcept.getId() + "-noframe.html");
} }
fillRuntimeData(); fillRuntimeData();
if (nodeBodyWriters.isEmpty()) { if (nodeBodyWriters.isEmpty()) {
fillOnce = false; fillOnce = false;
dataConfigurators.clear(); dataConfigurators.clear();
throw new IllegalStateException("Can't work with empty nodeBodyWriters"); throw new IllegalStateException("Can't work with empty nodeBodyWriters");
} }
} }
private void fillRuntimeData() { private void fillRuntimeData() {
if (fillOnce) { if (fillOnce) {
return; return;
} }
setNodeData(new MaisDocNodeData()); setNodeData(new MaisDocNodeData());
try { try {
for (Class<?> annoClass:getAnnotatedClasses()) { for (Class<?> annoClass : getAnnotatedClasses()) {
Object bean = annoClass.newInstance(); Object bean = annoClass.newInstance();
MaisDocNodeWriterBean.addAnnotatedNodeContentWriters(this,bean); MaisDocNodeWriterBean.addAnnotatedNodeContentWriters(this, bean);
MaisDocNodeDataConfiguratorBean.addAnnotatedNodeDataConfigurators(this, bean); MaisDocNodeDataConfiguratorBean.addAnnotatedNodeDataConfigurators(this, bean);
} }
} catch (InstantiationException e) { } catch (InstantiationException e) {
@ -159,50 +159,50 @@ public class MaisDoc {
} catch (IllegalAccessException e) { } catch (IllegalAccessException e) {
throw new IllegalArgumentException(e); throw new IllegalArgumentException(e);
} }
for (MaisDocConcept concept:getConcepts()) { for (MaisDocConcept concept : getConcepts()) {
String navLink = "overview-"+concept.getId()+".html"; String navLink = "overview-" + concept.getId() + ".html";
boolean resetHref = true; boolean resetHref = true;
if (concept.getParent()==null) { if (concept.getParent() == null) {
resetHref = false; // don't reset root node resetHref = false; // don't reset root node
} else { } else {
navLink = null; // rest start with null href's navLink = null; // rest start with null href's
} }
MaisDocNavLink link = new MaisDocNavLink(concept.getId(), navLink, concept.getName(),concept.getName(),resetHref); MaisDocNavLink link = new MaisDocNavLink(concept.getId(), navLink, concept.getName(), concept.getName(), resetHref);
getNodeData().addNavLink(link); getNodeData().addNavLink(link);
} }
for (MaisDocPage page:getDocPages()) { for (MaisDocPage page : getDocPages()) {
String navLink = page.getId()+".html"; String navLink = page.getId() + ".html";
MaisDocNavLink link = new MaisDocNavLink(page.getId(), navLink, page.getName(),page.getName(),false); MaisDocNavLink link = new MaisDocNavLink(page.getId(), navLink, page.getName(), page.getName(), false);
getNodeData().addNavLink(link); getNodeData().addNavLink(link);
} }
for (MaisDocRemoteClass rc:getRemoteClasses()) { for (MaisDocRemoteClass rc : getRemoteClasses()) {
try { try {
rc.parseRemotePackageList(); rc.parseRemotePackageList();
} catch (IOException e) { } catch (IOException e) {
throw new IllegalStateException("While parsing: "+rc.getDocUrl()+" got: "+e.getMessage(),e); throw new IllegalStateException("While parsing: " + rc.getDocUrl() + " got: " + e.getMessage(), e);
} }
} }
fillOnce = true; fillOnce = true;
} }
private void checkNull(Object obj,String objName) { private void checkNull(Object obj, String objName) {
if (obj==null) { if (obj == null) {
throw new NullPointerException("Can't work with null "+objName); throw new NullPointerException("Can't work with null " + objName);
} }
} }
public MaisDocConcept findConceptByClass(Class<?> objClass) { public MaisDocConcept findConceptByClass(Class<?> objClass) {
for (MaisDocConcept concept:getConcepts()) { for (MaisDocConcept concept : getConcepts()) {
if (concept.getConceptClass().isAssignableFrom(objClass)) { if (concept.getConceptClass().isAssignableFrom(objClass)) {
return concept; return concept;
} }
// NOTE: only 2 level search for sub child concepts // NOTE: only 2 level search for sub child concepts
for (MaisDocConcept c:concept.getChildConcepts()) { for (MaisDocConcept c : concept.getChildConcepts()) {
if (c.getConceptClass().isAssignableFrom(objClass)) { if (c.getConceptClass().isAssignableFrom(objClass)) {
//return concept; // return concept;
return c; return c;
} }
for (MaisDocConcept cc:c.getChildConcepts()) { for (MaisDocConcept cc : c.getChildConcepts()) {
if (cc.getConceptClass().isAssignableFrom(objClass)) { if (cc.getConceptClass().isAssignableFrom(objClass)) {
return cc; return cc;
} }
@ -211,163 +211,153 @@ public class MaisDoc {
} }
return null; return null;
} }
public MaisDocConcept findConceptChildByNode(MaisDocNode node) { public MaisDocConcept findConceptChildByNode(MaisDocNode node) {
Class<?> objClass = node.getUserData().getClass(); Class<?> objClass = node.getUserData().getClass();
return findConceptByClass(objClass); return findConceptByClass(objClass);
/* /*
Class<?> parentClass = null; * Class<?> parentClass = null; if (node.getParent()!=null) { parentClass = node.getParent().getUserData().getClass(); } for (MaisDocConcept
if (node.getParent()!=null) { * concept:getConcepts()) { if (parentClass!=null && concept.getConceptClass().isAssignableFrom(parentClass)==false) { continue; } for (MaisDocConcept
parentClass = node.getParent().getUserData().getClass(); * c:concept.getChildConcepts()) { if (c.getConceptClass().isAssignableFrom(objClass)) { return c; } } } return null;
} */
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() { public List<MaisDocRemoteClass> getRemoteClasses() {
return remoteClasses; return remoteClasses;
} }
public void addRemoteClass(MaisDocRemoteClass remoteClass) { public void addRemoteClass(MaisDocRemoteClass remoteClass) {
remoteClasses.add(remoteClass); remoteClasses.add(remoteClass);
} }
public void removeRemoteClass(MaisDocRemoteClass remoteClass) { public void removeRemoteClass(MaisDocRemoteClass remoteClass) {
remoteClasses.add(remoteClass); remoteClasses.add(remoteClass);
} }
public List<Class<?>> getAnnotatedClasses() { public List<Class<?>> getAnnotatedClasses() {
return annotatedClasses; return annotatedClasses;
} }
public void removeAnnotatedClasses(Class<?> annotatedClass) { public void removeAnnotatedClasses(Class<?> annotatedClass) {
annotatedClasses.remove(annotatedClass); annotatedClasses.remove(annotatedClass);
} }
public void addAnnotatedClasses(Class<?> annotatedClass) { public void addAnnotatedClasses(Class<?> annotatedClass) {
annotatedClasses.add(annotatedClass); annotatedClasses.add(annotatedClass);
} }
public List<MaisDocNodeDataConfigurator> getDataConfigurators() { public List<MaisDocNodeDataConfigurator> getDataConfigurators() {
return dataConfigurators; return dataConfigurators;
} }
public void removeDataConfigurator(MaisDocNodeDataConfigurator conf) { public void removeDataConfigurator(MaisDocNodeDataConfigurator conf) {
dataConfigurators.remove(conf); dataConfigurators.remove(conf);
} }
public void addDataConfigurator(MaisDocNodeDataConfigurator conf) { public void addDataConfigurator(MaisDocNodeDataConfigurator conf) {
dataConfigurators.add(conf); dataConfigurators.add(conf);
} }
public MaisDocNodeWriter addNodeBodyWriter(MaisDocNodeWriter writer) { public MaisDocNodeWriter addNodeBodyWriter(MaisDocNodeWriter writer) {
nodeBodyWriters.add(writer); nodeBodyWriters.add(writer);
return writer; return writer;
} }
public boolean removeNodeBodyWriter(MaisDocNodeWriter writer) { public boolean removeNodeBodyWriter(MaisDocNodeWriter writer) {
return nodeBodyWriters.remove(writer); return nodeBodyWriters.remove(writer);
} }
public List<MaisDocNodeWriter> getNodeBodyWriters() { public List<MaisDocNodeWriter> getNodeBodyWriters() {
return nodeBodyWriters; return nodeBodyWriters;
} }
public MaisDocConcept addConcept(MaisDocConcept concept) { public MaisDocConcept addConcept(MaisDocConcept concept) {
concepts.add(concept); concepts.add(concept);
return concept; return concept;
} }
public boolean removeConcept(MaisDocConcept concept) { public boolean removeConcept(MaisDocConcept concept) {
return concepts.remove(concept); return concepts.remove(concept);
} }
public List<MaisDocConcept> getConcepts() { public List<MaisDocConcept> getConcepts() {
return concepts; return concepts;
} }
public void addMetaKeyword(String keyword) { public void addMetaKeyword(String keyword) {
metaKeywords.add(keyword); metaKeywords.add(keyword);
} }
public void addMetaKeywordAll(Collection<String> keywords) { public void addMetaKeywordAll(Collection<String> keywords) {
metaKeywords.addAll(keywords); metaKeywords.addAll(keywords);
} }
public boolean removeMetaKeyword(String keyword) { public boolean removeMetaKeyword(String keyword) {
return metaKeywords.remove(keyword); return metaKeywords.remove(keyword);
} }
public List<String> getDocKeywords() { public List<String> getDocKeywords() {
return metaKeywords; return metaKeywords;
} }
/** /**
* @return the metaStyleSheet * @return the metaStyleSheet
*/ */
public File getMetaStyleSheet() { public File getMetaStyleSheet() {
return metaStyleSheet; return metaStyleSheet;
} }
/** /**
* @param metaStyleSheet the metaStyleSheet to set * @param metaStyleSheet the metaStyleSheet to set
*/ */
public void setMetaStyleSheet(File metaStyleSheet) { public void setMetaStyleSheet(File metaStyleSheet) {
this.metaStyleSheet = metaStyleSheet; this.metaStyleSheet = metaStyleSheet;
} }
/** /**
* @return the metaStyleSheetThema * @return the metaStyleSheetThema
*/ */
public String getMetaStyleSheetThema() { public String getMetaStyleSheetThema() {
return metaStyleSheetThema; return metaStyleSheetThema;
} }
/** /**
* @param metaStyleSheetThema the metaStyleSheetThema to set * @param metaStyleSheetThema the metaStyleSheetThema to set
*/ */
public void setMetaStyleSheetThema(String metaStyleSheetThema) { public void setMetaStyleSheetThema(String metaStyleSheetThema) {
this.metaStyleSheetThema = metaStyleSheetThema; this.metaStyleSheetThema = metaStyleSheetThema;
} }
/** /**
* @return the docCopyright * @return the docCopyright
*/ */
public String getDocCopyright() { public String getDocCopyright() {
return docCopyright; return docCopyright;
} }
/** /**
* @param docCopyright the docCopyright to set * @param docCopyright the docCopyright to set
*/ */
public void setDocCopyright(String docCopyright) { public void setDocCopyright(String docCopyright) {
this.docCopyright = docCopyright; this.docCopyright = docCopyright;
} }
/** /**
* Creates default copyright message for owner. * Creates default copyright message for owner.
* @param owner The owner of the copyright. *
* @param owner The owner of the copyright.
*/ */
public void createDocCopyright(String owner) { public void createDocCopyright(String owner) {
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
String year = Integer.toString(calendar.get(Calendar.YEAR)); String year = Integer.toString(calendar.get(Calendar.YEAR));
createDocCopyright(owner, year); createDocCopyright(owner, year);
} }
/** /**
* Creates default copyright message for owner and year. * Creates default copyright message for owner and year.
* @param owner The owner of the copyright. *
* @param year The year of the copyright. * @param owner The owner of the copyright.
* @param year The year of the copyright.
*/ */
public void createDocCopyright(String owner, String year) { public void createDocCopyright(String owner, String year) {
StringBuilder buf = new StringBuilder(100); StringBuilder buf = new StringBuilder(100);
@ -379,219 +369,219 @@ public class MaisDoc {
buf.append("All Rights Reserved."); buf.append("All Rights Reserved.");
setDocCopyright(buf.toString()); setDocCopyright(buf.toString());
} }
/** /**
* @return the docAbout * @return the docAbout
*/ */
public String getDocAbout() { public String getDocAbout() {
return docAbout; return docAbout;
} }
/** /**
* @param docAbout the docAbout to set * @param docAbout the docAbout to set
*/ */
public void setDocAbout(String docAbout) { public void setDocAbout(String docAbout) {
this.docAbout = docAbout; this.docAbout = docAbout;
} }
public MaisDocPage addDocPage(MaisDocPage page) { public MaisDocPage addDocPage(MaisDocPage page) {
docPages.add(page); docPages.add(page);
return page; return page;
} }
public boolean removeDocPage(MaisDocPage page) { public boolean removeDocPage(MaisDocPage page) {
return docPages.remove(page); return docPages.remove(page);
} }
public List<MaisDocPage> getDocPages() { public List<MaisDocPage> getDocPages() {
return docPages; return docPages;
} }
public MaisDocPage findDocPageById(String docPageId) { public MaisDocPage findDocPageById(String docPageId) {
if (docPageId==null) { if (docPageId == null) {
throw new NullPointerException("Can't search for null id."); throw new NullPointerException("Can't search for null id.");
} }
for (MaisDocPage page:docPages) { for (MaisDocPage page : docPages) {
if (page.getId().equals(docPageId)) { if (page.getId().equals(docPageId)) {
return page; return page;
} }
} }
return null; return null;
} }
public Class<?> addTreeNodeClassExclude(Class<?> excludeClass) { public Class<?> addTreeNodeClassExclude(Class<?> excludeClass) {
treeNodeClassExcludes.add(excludeClass); treeNodeClassExcludes.add(excludeClass);
return excludeClass; return excludeClass;
} }
public boolean removeTreeNodeClassExclude(Class<?> excludeClass) { public boolean removeTreeNodeClassExclude(Class<?> excludeClass) {
return treeNodeClassExcludes.remove(excludeClass); return treeNodeClassExcludes.remove(excludeClass);
} }
public List<Class<?>> getTreeNodeClassExcludes() { public List<Class<?>> getTreeNodeClassExcludes() {
return treeNodeClassExcludes; return treeNodeClassExcludes;
} }
public Class<?> addTreeNodePageModeClass(Class<?> pageModeClass) { public Class<?> addTreeNodePageModeClass(Class<?> pageModeClass) {
treeNodePageModeClass.add(pageModeClass); treeNodePageModeClass.add(pageModeClass);
return pageModeClass; return pageModeClass;
} }
public boolean removeTreeNodePageModeClass(Class<?> pageModeClass) { public boolean removeTreeNodePageModeClass(Class<?> pageModeClass) {
return treeNodePageModeClass.remove(pageModeClass); return treeNodePageModeClass.remove(pageModeClass);
} }
public List<Class<?>> getTreeNodePageModeClasses() { public List<Class<?>> getTreeNodePageModeClasses() {
return treeNodePageModeClass; return treeNodePageModeClass;
} }
/** /**
* @return the name * @return the name
*/ */
public String getName() { public String getName() {
return name; return name;
} }
/** /**
* @param name the name to set * @param name the name to set
*/ */
public void setName(String name) { public void setName(String name) {
this.name = name; this.name = name;
} }
/** /**
* @return the description * @return the description
*/ */
public String getDescription() { public String getDescription() {
return description; return description;
} }
/** /**
* @param description the description to set * @param description the description to set
*/ */
public void setDescription(String description) { public void setDescription(String description) {
this.description = description; this.description = description;
} }
/** /**
* @return the rootNodeTreePage * @return the rootNodeTreePage
*/ */
public MaisDocNode getRootNodeTreePage() { public MaisDocNode getRootNodeTreePage() {
return rootNodeTreePage; return rootNodeTreePage;
} }
/** /**
* @param rootNodeTreePage the rootNodeTreePage to set * @param rootNodeTreePage the rootNodeTreePage to set
*/ */
public void setRootNodeTreePage(MaisDocNode rootNodeTreePage) { public void setRootNodeTreePage(MaisDocNode rootNodeTreePage) {
this.rootNodeTreePage = rootNodeTreePage; this.rootNodeTreePage = rootNodeTreePage;
} }
/** /**
* @return the rootNode * @return the rootNode
*/ */
public MaisDocNode getRootNode() { public MaisDocNode getRootNode() {
return rootNode; return rootNode;
} }
/** /**
* @param rootNode the rootNode to set * @param rootNode the rootNode to set
*/ */
public void setRootNode(MaisDocNode rootNode) { public void setRootNode(MaisDocNode rootNode) {
this.rootNode = rootNode; this.rootNode = rootNode;
} }
/** /**
* @return the frameNavConceptClass * @return the frameNavConceptClass
*/ */
public Class<?> getFrameNavConceptClass() { public Class<?> getFrameNavConceptClass() {
return frameNavConceptClass; return frameNavConceptClass;
} }
/** /**
* @param frameNavConceptClass the frameNavConceptClass to set * @param frameNavConceptClass the frameNavConceptClass to set
*/ */
public void setFrameNavConceptClass(Class<?> frameNavConceptClass) { public void setFrameNavConceptClass(Class<?> frameNavConceptClass) {
this.frameNavConceptClass = frameNavConceptClass; this.frameNavConceptClass = frameNavConceptClass;
} }
/** /**
* @return the frameNavPrintParent * @return the frameNavPrintParent
*/ */
public Boolean getFrameNavPrintParent() { public Boolean getFrameNavPrintParent() {
return frameNavPrintParent; return frameNavPrintParent;
} }
/** /**
* @param frameNavPrintParent the frameNavPrintParent to set * @param frameNavPrintParent the frameNavPrintParent to set
*/ */
public void setFrameNavPrintParent(Boolean frameNavPrintParent) { public void setFrameNavPrintParent(Boolean frameNavPrintParent) {
this.frameNavPrintParent = frameNavPrintParent; this.frameNavPrintParent = frameNavPrintParent;
} }
/** /**
* @return the frameNavPrintParentParent * @return the frameNavPrintParentParent
*/ */
public Boolean getFrameNavPrintParentParent() { public Boolean getFrameNavPrintParentParent() {
return frameNavPrintParentParent; return frameNavPrintParentParent;
} }
/** /**
* @param frameNavPrintParentParent the frameNavPrintParentParent to set * @param frameNavPrintParentParent the frameNavPrintParentParent to set
*/ */
public void setFrameNavPrintParentParent(Boolean frameNavPrintParentParent) { public void setFrameNavPrintParentParent(Boolean frameNavPrintParentParent) {
this.frameNavPrintParentParent = frameNavPrintParentParent; this.frameNavPrintParentParent = frameNavPrintParentParent;
} }
/** /**
* @return the frameNavOverviewPrintParent * @return the frameNavOverviewPrintParent
*/ */
public Boolean getFrameNavOverviewPrintParent() { public Boolean getFrameNavOverviewPrintParent() {
return frameNavOverviewPrintParent; return frameNavOverviewPrintParent;
} }
/** /**
* @param frameNavOverviewPrintParent the frameNavOverviewPrintParent to set * @param frameNavOverviewPrintParent the frameNavOverviewPrintParent to set
*/ */
public void setFrameNavOverviewPrintParent(Boolean frameNavOverviewPrintParent) { public void setFrameNavOverviewPrintParent(Boolean frameNavOverviewPrintParent) {
this.frameNavOverviewPrintParent = frameNavOverviewPrintParent; this.frameNavOverviewPrintParent = frameNavOverviewPrintParent;
} }
/** /**
* @return the frameNavPrintParentId * @return the frameNavPrintParentId
*/ */
public Boolean getFrameNavPrintParentId() { public Boolean getFrameNavPrintParentId() {
return frameNavPrintParentId; return frameNavPrintParentId;
} }
/** /**
* @param frameNavPrintParentId the frameNavPrintParentId to set * @param frameNavPrintParentId the frameNavPrintParentId to set
*/ */
public void setFrameNavPrintParentId(Boolean frameNavPrintParentId) { public void setFrameNavPrintParentId(Boolean frameNavPrintParentId) {
this.frameNavPrintParentId = frameNavPrintParentId; this.frameNavPrintParentId = frameNavPrintParentId;
} }
/** /**
* @return the nodeData * @return the nodeData
*/ */
public MaisDocNodeData getNodeData() { public MaisDocNodeData getNodeData() {
return nodeData; return nodeData;
} }
/** /**
* @param nodeData the nodeData to set * @param nodeData the nodeData to set
*/ */
public void setNodeData(MaisDocNodeData nodeData) { public void setNodeData(MaisDocNodeData nodeData) {
this.nodeData = nodeData; this.nodeData = nodeData;
} }
/** /**
* @return the docStatsJS * @return the docStatsJS
*/ */
public String getDocStatsJS() { public String getDocStatsJS() {
return docStatsJS; return docStatsJS;
} }
/** /**
* @param docStatsJS the docStatsJS to set * @param docStatsJS the docStatsJS to set
*/ */
@ -668,64 +658,64 @@ public class MaisDoc {
public void setSkipRootTreePathNode(boolean skipRootTreePathNode) { public void setSkipRootTreePathNode(boolean skipRootTreePathNode) {
this.skipRootTreePathNode = skipRootTreePathNode; this.skipRootTreePathNode = skipRootTreePathNode;
} }
/** /**
* @return the printConceptTitle * @return the printConceptTitle
*/ */
public boolean isPrintConceptTitle() { public boolean isPrintConceptTitle() {
return printConceptTitle; return printConceptTitle;
} }
/** /**
* @param printConceptTitle the printConceptTitle to set * @param printConceptTitle the printConceptTitle to set
*/ */
public void setPrintConceptTitle(boolean printConceptTitle) { public void setPrintConceptTitle(boolean printConceptTitle) {
this.printConceptTitle = printConceptTitle; this.printConceptTitle = printConceptTitle;
} }
/** /**
* @return the printConceptPrevNext * @return the printConceptPrevNext
*/ */
public boolean isPrintConceptPrevNext() { public boolean isPrintConceptPrevNext() {
return printConceptPrevNext; return printConceptPrevNext;
} }
/** /**
* @param printConceptPrevNext the printConceptPrevNext to set * @param printConceptPrevNext the printConceptPrevNext to set
*/ */
public void setPrintConceptPrevNext(boolean printConceptPrevNext) { public void setPrintConceptPrevNext(boolean printConceptPrevNext) {
this.printConceptPrevNext = printConceptPrevNext; this.printConceptPrevNext = printConceptPrevNext;
} }
public List<String> getGroupTypesOrdered() { public List<String> getGroupTypesOrdered() {
Map<Integer,String> orderedMap = new TreeMap<Integer,String>(); Map<Integer, String> orderedMap = new TreeMap<Integer, String>();
for (String key:groupTypeOrder.keySet()) { for (String key : groupTypeOrder.keySet()) {
Integer order = groupTypeOrder.get(key); Integer order = groupTypeOrder.get(key);
orderedMap.put(order, key); orderedMap.put(order, key);
} }
return new ArrayList<String>(orderedMap.values()); return new ArrayList<String>(orderedMap.values());
} }
public String getGroupTypeName(String groupTypeKey) { public String getGroupTypeName(String groupTypeKey) {
String result = groupTypeNames.get(groupTypeKey); String result = groupTypeNames.get(groupTypeKey);
if (result==null) { if (result == null) {
result = groupTypeKey; result = groupTypeKey;
} }
return result; return result;
} }
public void setGroupTypeName(String groupTypeKey,String name,int order) { public void setGroupTypeName(String groupTypeKey, String name, int order) {
groupTypeNames.put(groupTypeKey,name); groupTypeNames.put(groupTypeKey, name);
groupTypeOrder.put(groupTypeKey, order); groupTypeOrder.put(groupTypeKey, order);
} }
/** /**
* @return the docPageSubTitle * @return the docPageSubTitle
*/ */
public String getDocPageSubTitle() { public String getDocPageSubTitle() {
return docPageSubTitle; return docPageSubTitle;
} }
/** /**
* @param docPageSubTitle the docPageSubTitle to set * @param docPageSubTitle the docPageSubTitle to set
*/ */

View file

@ -40,107 +40,107 @@ public class MaisDocConcept {
private MaisDocConcept parent = null; private MaisDocConcept parent = null;
private Class<?> conceptClass = null; private Class<?> conceptClass = null;
private List<MaisDocConcept> childConcepts = null; private List<MaisDocConcept> childConcepts = null;
public MaisDocConcept() { public MaisDocConcept() {
childConcepts = new ArrayList<MaisDocConcept>(5); childConcepts = new ArrayList<MaisDocConcept>(5);
} }
public MaisDocConcept(MaisDocConcept parent,String id,Class<?> conceptClass) { public MaisDocConcept(MaisDocConcept parent, String id, Class<?> conceptClass) {
this(); this();
setId(id); setId(id);
setConceptClass(conceptClass); setConceptClass(conceptClass);
setParent(parent); setParent(parent);
} }
public MaisDocConcept(MaisDocConcept parent,String[] text,Class<?> conceptClass) { public MaisDocConcept(MaisDocConcept parent, String[] text, Class<?> conceptClass) {
this(parent,text[0],text[1],text[2],text[3],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) { public MaisDocConcept(MaisDocConcept parent, String id, String name, String descriptionName, String descriptionHelp, Class<?> conceptClass) {
this(parent,id,conceptClass); this(parent, id, conceptClass);
setName(name); setName(name);
setDescriptionName(descriptionName); setDescriptionName(descriptionName);
setDescriptionHelp(descriptionHelp); setDescriptionHelp(descriptionHelp);
} }
/** /**
* @return the id * @return the id
*/ */
public String getId() { public String getId() {
return id; return id;
} }
/** /**
* @param id the id to set * @param id the id to set
*/ */
public void setId(String id) { public void setId(String id) {
this.id = id; this.id = id;
} }
/** /**
* @return the name * @return the name
*/ */
public String getName() { public String getName() {
return name; return name;
} }
/** /**
* @param name the name to set * @param name the name to set
*/ */
public void setName(String name) { public void setName(String name) {
this.name = name; this.name = name;
} }
/** /**
* @return the descriptionName * @return the descriptionName
*/ */
public String getDescriptionName() { public String getDescriptionName() {
return descriptionName; return descriptionName;
} }
/** /**
* @param descriptionName the descriptionName to set * @param descriptionName the descriptionName to set
*/ */
public void setDescriptionName(String descriptionName) { public void setDescriptionName(String descriptionName) {
this.descriptionName = descriptionName; this.descriptionName = descriptionName;
} }
/** /**
* @return the descriptionHelp * @return the descriptionHelp
*/ */
public String getDescriptionHelp() { public String getDescriptionHelp() {
return descriptionHelp; return descriptionHelp;
} }
/** /**
* @param descriptionHelp the descriptionHelp to set * @param descriptionHelp the descriptionHelp to set
*/ */
public void setDescriptionHelp(String descriptionHelp) { public void setDescriptionHelp(String descriptionHelp) {
this.descriptionHelp = descriptionHelp; this.descriptionHelp = descriptionHelp;
} }
/** /**
* @return the conceptClass * @return the conceptClass
*/ */
public Class<?> getConceptClass() { public Class<?> getConceptClass() {
return conceptClass; return conceptClass;
} }
/** /**
* @param conceptClass the conceptClass to set * @param conceptClass the conceptClass to set
*/ */
public void setConceptClass(Class<?> conceptClass) { public void setConceptClass(Class<?> conceptClass) {
this.conceptClass = conceptClass; this.conceptClass = conceptClass;
} }
public void addChildConcept(MaisDocConcept childConcept) { public void addChildConcept(MaisDocConcept childConcept) {
childConcepts.add(childConcept); childConcepts.add(childConcept);
} }
public void removeChildConcept(MaisDocConcept childConcept) { public void removeChildConcept(MaisDocConcept childConcept) {
childConcepts.remove(childConcept); childConcepts.remove(childConcept);
} }
public List<MaisDocConcept> getChildConcepts() { public List<MaisDocConcept> getChildConcepts() {
return childConcepts; return childConcepts;
} }
@ -158,7 +158,5 @@ public class MaisDocConcept {
public void setParent(MaisDocConcept parent) { public void setParent(MaisDocConcept parent) {
this.parent = parent; this.parent = parent;
} }
}
}

View file

@ -34,90 +34,90 @@ public class MaisDocIndexItem {
private String linkText = null; private String linkText = null;
private String titlePostHref = null; private String titlePostHref = null;
private String titlePostText = null; private String titlePostText = null;
private String title = null; private String title = null;
private String description = null; private String description = null;
public MaisDocIndexItem() { public MaisDocIndexItem() {
} }
/** /**
* @return the linkHref * @return the linkHref
*/ */
public String getLinkHref() { public String getLinkHref() {
return linkHref; return linkHref;
} }
/** /**
* @param linkHref the linkHref to set * @param linkHref the linkHref to set
*/ */
public void setLinkHref(String linkHref) { public void setLinkHref(String linkHref) {
this.linkHref = linkHref; this.linkHref = linkHref;
} }
/** /**
* @return the linkText * @return the linkText
*/ */
public String getLinkText() { public String getLinkText() {
return linkText; return linkText;
} }
/** /**
* @param linkText the linkText to set * @param linkText the linkText to set
*/ */
public void setLinkText(String linkText) { public void setLinkText(String linkText) {
this.linkText = linkText; this.linkText = linkText;
} }
/** /**
* @return the titlePostHref * @return the titlePostHref
*/ */
public String getTitlePostHref() { public String getTitlePostHref() {
return titlePostHref; return titlePostHref;
} }
/** /**
* @param titlePostHref the titlePostHref to set * @param titlePostHref the titlePostHref to set
*/ */
public void setTitlePostHref(String titlePostHref) { public void setTitlePostHref(String titlePostHref) {
this.titlePostHref = titlePostHref; this.titlePostHref = titlePostHref;
} }
/** /**
* @return the titlePostText * @return the titlePostText
*/ */
public String getTitlePostText() { public String getTitlePostText() {
return titlePostText; return titlePostText;
} }
/** /**
* @param titlePostText the titlePostText to set * @param titlePostText the titlePostText to set
*/ */
public void setTitlePostText(String titlePostText) { public void setTitlePostText(String titlePostText) {
this.titlePostText = titlePostText; this.titlePostText = titlePostText;
} }
/** /**
* @return the title * @return the title
*/ */
public String getTitle() { public String getTitle() {
return title; return title;
} }
/** /**
* @param title the title to set * @param title the title to set
*/ */
public void setTitle(String title) { public void setTitle(String title) {
this.title = title; this.title = title;
} }
/** /**
* @return the description * @return the description
*/ */
public String getDescription() { public String getDescription() {
return description; return description;
} }
/** /**
* @param description the description to set * @param description the description to set
*/ */

View file

@ -35,81 +35,81 @@ public class MaisDocNavLink {
private String title = null; private String title = null;
private String text = null; private String text = null;
private boolean resetHref = false; private boolean resetHref = false;
public MaisDocNavLink() { public MaisDocNavLink() {
} }
public MaisDocNavLink(String id,String href,String title,String text,boolean resetHref) { public MaisDocNavLink(String id, String href, String title, String text, boolean resetHref) {
setId(id); setId(id);
setHref(href); setHref(href);
setTitle(title); setTitle(title);
setText(text); setText(text);
setResetHref(resetHref); setResetHref(resetHref);
} }
/** /**
* @return the id * @return the id
*/ */
public String getId() { public String getId() {
return id; return id;
} }
/** /**
* @param id the id to set * @param id the id to set
*/ */
public void setId(String id) { public void setId(String id) {
this.id = id; this.id = id;
} }
/** /**
* @return the href * @return the href
*/ */
public String getHref() { public String getHref() {
return href; return href;
} }
/** /**
* @param href the href to set * @param href the href to set
*/ */
public void setHref(String href) { public void setHref(String href) {
this.href = href; this.href = href;
} }
/** /**
* @return the title * @return the title
*/ */
public String getTitle() { public String getTitle() {
return title; return title;
} }
/** /**
* @param title the title to set * @param title the title to set
*/ */
public void setTitle(String title) { public void setTitle(String title) {
this.title = title; this.title = title;
} }
/** /**
* @return the text * @return the text
*/ */
public String getText() { public String getText() {
return text; return text;
} }
/** /**
* @param text the text to set * @param text the text to set
*/ */
public void setText(String text) { public void setText(String text) {
this.text = text; this.text = text;
} }
/** /**
* @return the resetHref * @return the resetHref
*/ */
public boolean isResetHref() { public boolean isResetHref() {
return resetHref; return resetHref;
} }
/** /**
* @param resetHref the resetHref to set * @param resetHref the resetHref to set
*/ */

View file

@ -39,104 +39,104 @@ public class MaisDocNode {
private String description = null; private String description = null;
private MaisDocNode parent = null; private MaisDocNode parent = null;
private List<MaisDocNode> nodes = null; private List<MaisDocNode> nodes = null;
public MaisDocNode() { public MaisDocNode() {
nodes = new ArrayList<MaisDocNode>(30); nodes = new ArrayList<MaisDocNode>(30);
} }
public MaisDocNode(Object userData,String id,String name,String description) { public MaisDocNode(Object userData, String id, String name, String description) {
this(); this();
setUserData(userData); setUserData(userData);
setId(id); setId(id);
setName(name); setName(name);
if (description==null) { if (description == null) {
description = name; description = name;
} }
setDescription(description); setDescription(description);
} }
public MaisDocNode addNode(MaisDocNode node) { public MaisDocNode addNode(MaisDocNode node) {
node.setParent(this); node.setParent(this);
nodes.add(node); nodes.add(node);
return node; return node;
} }
public boolean removeNode(MaisDocNode node) { public boolean removeNode(MaisDocNode node) {
return nodes.remove(node); return nodes.remove(node);
} }
public List<MaisDocNode> getNodes() { public List<MaisDocNode> getNodes() {
return nodes; return nodes;
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public <T> T toUserData(Class<T> type) { public <T> T toUserData(Class<T> type) {
return (T)getUserData(); return (T) getUserData();
} }
/** /**
* @return the userData * @return the userData
*/ */
public Object getUserData() { public Object getUserData() {
return userData; return userData;
} }
/** /**
* @param userData the userData to set * @param userData the userData to set
*/ */
public void setUserData(Object userData) { public void setUserData(Object userData) {
this.userData = userData; this.userData = userData;
} }
/** /**
* @return the id * @return the id
*/ */
public String getId() { public String getId() {
return id; return id;
} }
/** /**
* @param id the id to set * @param id the id to set
*/ */
public void setId(String id) { public void setId(String id) {
this.id = id; this.id = id;
} }
/** /**
* @return the name * @return the name
*/ */
public String getName() { public String getName() {
return name; return name;
} }
/** /**
* @param name the name to set * @param name the name to set
*/ */
public void setName(String name) { public void setName(String name) {
this.name = name; this.name = name;
} }
/** /**
* @return the description * @return the description
*/ */
public String getDescription() { public String getDescription() {
return description; return description;
} }
/** /**
* @param description the description to set * @param description the description to set
*/ */
public void setDescription(String description) { public void setDescription(String description) {
this.description = description; this.description = description;
} }
/** /**
* @return the parent * @return the parent
*/ */
public MaisDocNode getParent() { public MaisDocNode getParent() {
return parent; return parent;
} }
/** /**
* @param parent the parent to set * @param parent the parent to set
*/ */

View file

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

View file

@ -38,151 +38,151 @@ public class MaisDocNodeData {
private String prefixPath; private String prefixPath;
private String navSelected = null; private String navSelected = null;
private List<String> groupTypeKeys = null; private List<String> groupTypeKeys = null;
private Map<String,List<MaisDocNavLink>> groupTypeLinks = null; private Map<String, List<MaisDocNavLink>> groupTypeLinks = null;
private String prevLink = null; private String prevLink = null;
private String nextLink = null; private String nextLink = null;
private String framePath = null;; private String framePath = null;;
private List<MaisDocNavLink> navLinks = null; private List<MaisDocNavLink> navLinks = null;
private List<MaisDocIndexItem> indexItems = null; private List<MaisDocIndexItem> indexItems = null;
public MaisDocNodeData() { public MaisDocNodeData() {
navLinks = new ArrayList<MaisDocNavLink>(12); navLinks = new ArrayList<MaisDocNavLink>(12);
groupTypeKeys = new ArrayList<String>(navLinks.size()/3); groupTypeKeys = new ArrayList<String>(navLinks.size() / 3);
groupTypeLinks = new HashMap<String,List<MaisDocNavLink>>(groupTypeKeys.size()); groupTypeLinks = new HashMap<String, List<MaisDocNavLink>>(groupTypeKeys.size());
indexItems = new ArrayList<MaisDocIndexItem>(500); indexItems = new ArrayList<MaisDocIndexItem>(500);
} }
public List<MaisDocIndexItem> getIndexItems() { public List<MaisDocIndexItem> getIndexItems() {
return indexItems; return indexItems;
} }
public void addIndexItem(MaisDocIndexItem indexItem) { public void addIndexItem(MaisDocIndexItem indexItem) {
indexItems.add(indexItem); indexItems.add(indexItem);
} }
public void addGroupTypeKey(String groupTypeKey) { public void addGroupTypeKey(String groupTypeKey) {
groupTypeKeys.add(groupTypeKey); groupTypeKeys.add(groupTypeKey);
} }
public List<String> getGroupTypeKeys() { public List<String> getGroupTypeKeys() {
return groupTypeKeys; return groupTypeKeys;
} }
public void addGroupTypeLink(String groupTypeKey,MaisDocNavLink link) { public void addGroupTypeLink(String groupTypeKey, MaisDocNavLink link) {
List<MaisDocNavLink> result = groupTypeLinks.get(groupTypeKey); List<MaisDocNavLink> result = groupTypeLinks.get(groupTypeKey);
if (result==null) { if (result == null) {
result = new ArrayList<MaisDocNavLink>(10); result = new ArrayList<MaisDocNavLink>(10);
groupTypeLinks.put(groupTypeKey, result); groupTypeLinks.put(groupTypeKey, result);
} }
result.add(link); result.add(link);
} }
public List<MaisDocNavLink> getGroupTypeLinks(String groupTypeKey) { public List<MaisDocNavLink> getGroupTypeLinks(String groupTypeKey) {
List<MaisDocNavLink> result = groupTypeLinks.get(groupTypeKey); List<MaisDocNavLink> result = groupTypeLinks.get(groupTypeKey);
if (result==null) { if (result == null) {
result = new ArrayList<MaisDocNavLink>(0); result = new ArrayList<MaisDocNavLink>(0);
} }
return result; return result;
} }
public MaisDocNavLink getGroupTypeLink(String groupTypeKey,String group) { public MaisDocNavLink getGroupTypeLink(String groupTypeKey, String group) {
List<MaisDocNavLink> links = getGroupTypeLinks(groupTypeKey); List<MaisDocNavLink> links = getGroupTypeLinks(groupTypeKey);
for (MaisDocNavLink link:links) { for (MaisDocNavLink link : links) {
if (link.getId().equals(group)) { if (link.getId().equals(group)) {
return link; return link;
} }
} }
return null; return null;
} }
public void clearGroupTypeLinks() { public void clearGroupTypeLinks() {
groupTypeLinks.clear(); groupTypeLinks.clear();
} }
public List<MaisDocNavLink> getNavLinks() { public List<MaisDocNavLink> getNavLinks() {
return navLinks; return navLinks;
} }
public MaisDocNavLink getNavLinkById(String id) { public MaisDocNavLink getNavLinkById(String id) {
for (MaisDocNavLink link:navLinks) { for (MaisDocNavLink link : navLinks) {
if (link.getId().equals(id)) { if (link.getId().equals(id)) {
return link; return link;
} }
} }
return null; return null;
} }
public void addNavLink(MaisDocNavLink link) { public void addNavLink(MaisDocNavLink link) {
navLinks.add(link); navLinks.add(link);
} }
public void removeNavLink(MaisDocNavLink link) { public void removeNavLink(MaisDocNavLink link) {
navLinks.remove(link); navLinks.remove(link);
} }
/** /**
* @return the prefixPath * @return the prefixPath
*/ */
public String getPrefixPath() { public String getPrefixPath() {
return prefixPath; return prefixPath;
} }
/** /**
* @param prefixPath the prefixPath to set * @param prefixPath the prefixPath to set
*/ */
public void setPrefixPath(String prefixPath) { public void setPrefixPath(String prefixPath) {
this.prefixPath = prefixPath; this.prefixPath = prefixPath;
} }
/** /**
* @return the navSelected * @return the navSelected
*/ */
public String getNavSelected() { public String getNavSelected() {
return navSelected; return navSelected;
} }
/** /**
* @param navSelected the navSelected to set * @param navSelected the navSelected to set
*/ */
public void setNavSelected(String navSelected) { public void setNavSelected(String navSelected) {
this.navSelected = navSelected; this.navSelected = navSelected;
} }
/** /**
* @return the prevLink * @return the prevLink
*/ */
public String getPrevLink() { public String getPrevLink() {
return prevLink; return prevLink;
} }
/** /**
* @param prevLink the prevLink to set * @param prevLink the prevLink to set
*/ */
public void setPrevLink(String prevLink) { public void setPrevLink(String prevLink) {
this.prevLink = prevLink; this.prevLink = prevLink;
} }
/** /**
* @return the nextLink * @return the nextLink
*/ */
public String getNextLink() { public String getNextLink() {
return nextLink; return nextLink;
} }
/** /**
* @param nextLink the nextLink to set * @param nextLink the nextLink to set
*/ */
public void setNextLink(String nextLink) { public void setNextLink(String nextLink) {
this.nextLink = nextLink; this.nextLink = nextLink;
} }
/** /**
* @return the framePath * @return the framePath
*/ */
public String getFramePath() { public String getFramePath() {
return framePath; return framePath;
} }
/** /**
* @param framePath the framePath to set * @param framePath the framePath to set
*/ */

View file

@ -31,8 +31,8 @@ import java.util.List;
* @version 1.0 Aug 11, 2013 * @version 1.0 Aug 11, 2013
*/ */
public interface MaisDocNodeDataConfigurator { public interface MaisDocNodeDataConfigurator {
List<Class<?>> getTargetClasses(); List<Class<?>> getTargetClasses();
void configNodeData(MaisDoc doc,MaisDocNode node,MaisDocNodeData data); void configNodeData(MaisDoc doc, MaisDocNode node, MaisDocNodeData data);
} }

View file

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

View file

@ -32,82 +32,82 @@ import java.util.List;
* @version 1.0 May 12, 2013 * @version 1.0 May 12, 2013
*/ */
public class MaisDocPage { public class MaisDocPage {
private String id = null; private String id = null;
private String name = null; private String name = null;
private String description = null; private String description = null;
private List<MaisDocPageWriter> pageWriters = null; private List<MaisDocPageWriter> pageWriters = null;
public MaisDocPage() { public MaisDocPage() {
pageWriters = new ArrayList<MaisDocPageWriter>(30); pageWriters = new ArrayList<MaisDocPageWriter>(30);
} }
public MaisDocPage(String id,String name,String description,MaisDocPageWriter...writers) { public MaisDocPage(String id, String name, String description, MaisDocPageWriter... writers) {
this(); this();
setId(id); setId(id);
setName(name); setName(name);
setDescription(description); setDescription(description);
for (MaisDocPageWriter writer:writers) { for (MaisDocPageWriter writer : writers) {
addPageWriter(writer); addPageWriter(writer);
} }
} }
/** /**
* @return the id * @return the id
*/ */
public String getId() { public String getId() {
return id; return id;
} }
/** /**
* @param id the id to set * @param id the id to set
*/ */
public void setId(String id) { public void setId(String id) {
this.id = id; this.id = id;
} }
/** /**
* @return the name * @return the name
*/ */
public String getName() { public String getName() {
return name; return name;
} }
/** /**
* @param name the name to set * @param name the name to set
*/ */
public void setName(String name) { public void setName(String name) {
this.name = name; this.name = name;
} }
/** /**
* @return the description * @return the description
*/ */
public String getDescription() { public String getDescription() {
return description; return description;
} }
/** /**
* @param description the description to set * @param description the description to set
*/ */
public void setDescription(String description) { public void setDescription(String description) {
this.description = description; this.description = description;
} }
/** /**
* @return the page writers. * @return the page writers.
*/ */
public List<MaisDocPageWriter> getPageWriters() { public List<MaisDocPageWriter> getPageWriters() {
return pageWriters; return pageWriters;
} }
/** /**
* @param writer the writer to add. * @param writer the writer to add.
*/ */
public void addPageWriter(MaisDocPageWriter writer) { public void addPageWriter(MaisDocPageWriter writer) {
pageWriters.add(writer); pageWriters.add(writer);
} }
/** /**
* @param writer the writer to add. * @param writer the writer to add.
*/ */

View file

@ -31,6 +31,6 @@ import java.io.IOException;
* @version 1.0 May 12, 2013 * @version 1.0 May 12, 2013
*/ */
public interface MaisDocPageWriter { public interface MaisDocPageWriter {
void writePageContent(MaisDocWriteEvent<MaisDocPage> e) throws IOException; void writePageContent(MaisDocWriteEvent<MaisDocPage> e) throws IOException;
} }

View file

@ -46,74 +46,79 @@ public class MaisDocRemoteClass {
private String docUrl = null; private String docUrl = null;
private String packageListUrl = null; private String packageListUrl = null;
private List<String> packageList = null; private List<String> packageList = null;
/** /**
* Creates the ApiDocRemoteClass. * Creates the ApiDocRemoteClass.
*/ */
private MaisDocRemoteClass() { private MaisDocRemoteClass() {
packageList = new ArrayList<String>(100); packageList = new ArrayList<String>(100);
} }
/** /**
* Creates the ApiDocRemoteClass with a javadoc url to fetch the package-list from. * Creates the ApiDocRemoteClass with a javadoc url to fetch the package-list from.
* @param docUrl The remote javadoc base url. *
* @param docUrl The remote javadoc base url.
*/ */
public MaisDocRemoteClass(String docUrl) { public MaisDocRemoteClass(String docUrl) {
this(); this();
setDocUrl(docUrl); setDocUrl(docUrl);
} }
/** /**
* Creates the ApiDocRemoteClass with a javadoc url. but fetched the package-list from the packageListUrl. * 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. * @param docUrl The remote javadoc base url.
* @param packageListUrl The remote/local package-list url.
*/ */
public MaisDocRemoteClass(String docUrl,String packageListUrl) { public MaisDocRemoteClass(String docUrl, String packageListUrl) {
this(docUrl); this(docUrl);
setPackageListUrl(packageListUrl); setPackageListUrl(packageListUrl);
} }
/** /**
* Returns remote url for a class or null if no remote package excists for the class. * 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. * @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) { public String getRemoteUrl(Class<?> cls) {
if (cls==null) { if (cls == null) {
return null; return null;
} }
if (cls.isArray()) { if (cls.isArray()) {
return null; return null;
} }
if (cls.getPackage()==null) { if (cls.getPackage() == null) {
return null; return null;
} }
String packageName = cls.getPackage().getName(); String packageName = cls.getPackage().getName();
logger.fine("Search "+packageName+" in "+packageList.size()+" of "+docUrl); logger.fine("Search " + packageName + " in " + packageList.size() + " of " + docUrl);
if (packageList.contains(packageName)) { if (packageList.contains(packageName)) {
String baseUrl = getDocUrlClean(); String baseUrl = getDocUrlClean();
String packagePath = packageName.replaceAll("\\.", "/"); String packagePath = packageName.replaceAll("\\.", "/");
String fullUrl = baseUrl+packagePath+"/"+cls.getSimpleName()+".html"; String fullUrl = baseUrl + packagePath + "/" + cls.getSimpleName() + ".html";
return fullUrl; return fullUrl;
} }
return null; return null;
} }
/** /**
* Cleans the docUrl by sometimes appending postfix slash. * Cleans the docUrl by sometimes appending postfix slash.
* @return The cleaned doc url. *
* @return The cleaned doc url.
*/ */
private String getDocUrlClean() { private String getDocUrlClean() {
String baseUrl = getDocUrl(); String baseUrl = getDocUrl();
if (baseUrl.endsWith("/")==false) { if (baseUrl.endsWith("/") == false) {
baseUrl += "/"; baseUrl += "/";
} }
return baseUrl; return baseUrl;
} }
/** /**
* Fetches and parses the package-list file. * Fetches and parses the package-list file.
* @throws IOException If error happend. *
* @throws IOException If error happend.
*/ */
public void parseRemotePackageList() throws IOException { public void parseRemotePackageList() throws IOException {
packageList.clear(); packageList.clear();
@ -125,58 +130,59 @@ public class MaisDocRemoteClass {
conn.setReadTimeout(2000); conn.setReadTimeout(2000);
parseRemoteFile(conn.getInputStream(), conn.getContentEncoding()); parseRemoteFile(conn.getInputStream(), conn.getContentEncoding());
} }
/** /**
* Parsed the inputStream into the packagList values. * Parsed the inputStream into the packagList values.
* @param in The inputStream. *
* @param enc The encoding of the inputStream. * @param in The inputStream.
* @throws IOException When error on inputStream. * @param enc The encoding of the inputStream.
* @throws IOException When error on inputStream.
*/ */
private void parseRemoteFile(InputStream in,String enc) throws IOException { private void parseRemoteFile(InputStream in, String enc) throws IOException {
if (enc==null) { if (enc == null) {
enc = "UTF-8"; enc = "UTF-8";
} }
BufferedReader br = new BufferedReader(new InputStreamReader(in,Charset.forName(enc))); BufferedReader br = new BufferedReader(new InputStreamReader(in, Charset.forName(enc)));
try { try {
String line = null; String line = null;
while ((line = br.readLine()) != null) { while ((line = br.readLine()) != null) {
String lineClean = line.trim(); String lineClean = line.trim();
packageList.add(lineClean); packageList.add(lineClean);
logger.finer("Adding remote package: '"+lineClean+"'"); logger.finer("Adding remote package: '" + lineClean + "'");
} }
} finally { } finally {
br.close(); br.close();
} }
} }
/** /**
* @return the docUrl * @return the docUrl
*/ */
public String getDocUrl() { public String getDocUrl() {
return docUrl; return docUrl;
} }
/** /**
* @param docUrl the docUrl to set * @param docUrl the docUrl to set
*/ */
public void setDocUrl(String docUrl) { public void setDocUrl(String docUrl) {
this.docUrl = docUrl; this.docUrl = docUrl;
} }
/** /**
* @return the packageListUrl * @return the packageListUrl
*/ */
public String getPackageListUrl() { public String getPackageListUrl() {
return packageListUrl; return packageListUrl;
} }
/** /**
* @param packageListUrl the packageListUrl to set * @param packageListUrl the packageListUrl to set
*/ */
public void setPackageListUrl(String packageListUrl) { public void setPackageListUrl(String packageListUrl) {
this.packageListUrl = packageListUrl; this.packageListUrl = packageListUrl;
} }
/** /**
* @return the packageList * @return the packageList
*/ */

View file

@ -36,33 +36,34 @@ public class MaisDocWriteEvent<T> {
private MaisDoc doc = null; private MaisDoc doc = null;
private T eventObject = null; private T eventObject = null;
private MaisDocContentWriter writer = null; private MaisDocContentWriter writer = null;
/** /**
* Creates an ApiDocNodeBodyEvent. * Creates an ApiDocNodeBodyEvent.
* @param doc The ApiDoc we are writing. *
* @param writer The content writer to write to. * @param doc The ApiDoc we are writing.
* @param eventObject The event we are firing this event for. * @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) { public MaisDocWriteEvent(MaisDoc doc, MaisDocContentWriter writer, T eventObject) {
this.doc=doc; this.doc = doc;
this.writer=writer; this.writer = writer;
this.eventObject=eventObject; this.eventObject = eventObject;
} }
/** /**
* @return the doc * @return the doc
*/ */
public MaisDoc getDoc() { public MaisDoc getDoc() {
return doc; return doc;
} }
/** /**
* @return the event * @return the event
*/ */
public T getEventObject() { public T getEventObject() {
return eventObject; return eventObject;
} }
/** /**
* @return the writer * @return the writer
*/ */

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.X4OTaskProperty;
import org.x4o.xml.lang.task.run.X4OTaskRunner; import org.x4o.xml.lang.task.run.X4OTaskRunner;
/** /**
* AbstractX4OLanguageTask is base ant x4o language task executor. * AbstractX4OLanguageTask is base ant x4o language task executor.
* *
@ -47,35 +46,37 @@ public class X4OTask extends Task {
private boolean verbose = false; private boolean verbose = false;
private boolean failonerror = true; private boolean failonerror = true;
private List<X4OTaskProperty> taskProperties = null; private List<X4OTaskProperty> taskProperties = null;
/** /**
* Constructs this ant x4o task. * Constructs this ant x4o task.
*/ */
public X4OTask() { public X4OTask() {
taskProperties = new ArrayList<X4OTaskProperty>(15); taskProperties = new ArrayList<X4OTaskProperty>(15);
} }
/** /**
* Adds the ant child x4oTaskProperty element. * Adds the ant child x4oTaskProperty element.
*
* @param property * @param property
*/ */
public void addX4oTaskProperty(X4OTaskProperty property) { public void addX4oTaskProperty(X4OTaskProperty property) {
taskProperties.add(property); taskProperties.add(property);
} }
/** /**
* Executes the x4o eld schema task. * Executes the x4o eld schema task.
*
* @see org.apache.tools.ant.Task#execute() * @see org.apache.tools.ant.Task#execute()
*/ */
@Override @Override
public void execute() throws BuildException { public void execute() throws BuildException {
try { try {
if (isVerbose()) { if (isVerbose()) {
log("Task location: "+getLocation()); log("Task location: " + getLocation());
log("X4O language name: "+getLanguageName()); log("X4O language name: " + getLanguageName());
log("X4O language version: "+getLanguageVersion()); log("X4O language version: " + getLanguageVersion());
log("Verbose: "+isVerbose()); log("Verbose: " + isVerbose());
log("Fail on error: "+isFailonerror()); log("Fail on error: " + isFailonerror());
} }
executeLanguageTask(); executeLanguageTask();
} catch (BuildException e) { } catch (BuildException e) {
@ -86,103 +87,103 @@ public class X4OTask extends Task {
} }
} }
} }
private void executeLanguageTask() throws BuildException { private void executeLanguageTask() throws BuildException {
if (getLanguageName()==null) { if (getLanguageName() == null) {
throw new BuildException("languageName attribute is not set."); throw new BuildException("languageName attribute is not set.");
} }
if (getLanguageName().length()==0) { if (getLanguageName().length() == 0) {
throw new BuildException("languageName attribute is empty."); throw new BuildException("languageName attribute is empty.");
} }
if (getLanguageVersion()!=null && getLanguageVersion().length()==0) { if (getLanguageVersion() != null && getLanguageVersion().length() == 0) {
throw new BuildException("languageVersion attribute is empty."); throw new BuildException("languageVersion attribute is empty.");
} }
if (getTaskId()==null) { if (getTaskId() == null) {
throw new BuildException("taskId attribute is not set."); throw new BuildException("taskId attribute is not set.");
} }
if (getTaskId().length()==0) { if (getTaskId().length() == 0) {
throw new BuildException("taskId attribute is empty."); throw new BuildException("taskId attribute is empty.");
} }
if (isVerbose()) { if (isVerbose()) {
log("Starting "+getTaskId()); log("Starting " + getTaskId());
} }
long startTime = System.currentTimeMillis(); long startTime = System.currentTimeMillis();
try { try {
X4OTaskRunner.runTask(getLanguageName(),getLanguageVersion(), getTaskId(), taskProperties); X4OTaskRunner.runTask(getLanguageName(), getLanguageVersion(), getTaskId(), taskProperties);
} catch (X4OLanguageTaskException e) { } catch (X4OLanguageTaskException e) {
throw new BuildException(e); throw new BuildException(e);
} }
long stopTime = System.currentTimeMillis(); long stopTime = System.currentTimeMillis();
String taskName = getLanguageName(); String taskName = getLanguageName();
if (getLanguageVersion() != null) { if (getLanguageVersion() != null) {
taskName += ":"+getLanguageVersion(); taskName += ":" + getLanguageVersion();
} }
log("Done " + getTaskId() + " for " + taskName + " in " + (stopTime-startTime) + " ms."); log("Done " + getTaskId() + " for " + taskName + " in " + (stopTime - startTime) + " ms.");
} }
/** /**
* @return the languageName * @return the languageName
*/ */
public String getLanguageName() { public String getLanguageName() {
return languageName; return languageName;
} }
/** /**
* @param languageName the languageName to set * @param languageName the languageName to set
*/ */
public void setLanguageName(String languageName) { public void setLanguageName(String languageName) {
this.languageName = languageName; this.languageName = languageName;
} }
/** /**
* @return the languageVersion * @return the languageVersion
*/ */
public String getLanguageVersion() { public String getLanguageVersion() {
return languageVersion; return languageVersion;
} }
/** /**
* @param languageVersion the languageVersion to set * @param languageVersion the languageVersion to set
*/ */
public void setLanguageVersion(String languageVersion) { public void setLanguageVersion(String languageVersion) {
this.languageVersion = languageVersion; this.languageVersion = languageVersion;
} }
/** /**
* @return the verbose * @return the verbose
*/ */
public boolean isVerbose() { public boolean isVerbose() {
return verbose; return verbose;
} }
/** /**
* @param verbose the verbose to set * @param verbose the verbose to set
*/ */
public void setVerbose(boolean verbose) { public void setVerbose(boolean verbose) {
this.verbose = verbose; this.verbose = verbose;
} }
/** /**
* @return the failonerror * @return the failonerror
*/ */
public boolean isFailonerror() { public boolean isFailonerror() {
return failonerror; return failonerror;
} }
/** /**
* @param failonerror the failonerror to set * @param failonerror the failonerror to set
*/ */
public void setFailonerror(boolean failonerror) { public void setFailonerror(boolean failonerror) {
this.failonerror = failonerror; this.failonerror = failonerror;
} }
/** /**
* @return the taskId * @return the taskId
*/ */
public String getTaskId() { public String getTaskId() {
return taskId; return taskId;
} }
/** /**
* @param taskId the taskId to set * @param taskId the taskId to set
*/ */

View file

@ -34,36 +34,36 @@ import org.apache.tools.ant.BuildFileTest;
* @version 1.0 Aug 23, 2012 * @version 1.0 Aug 23, 2012
*/ */
public class X4OWriteLanguageDocTaskTest extends BuildFileTest { public class X4OWriteLanguageDocTaskTest extends BuildFileTest {
public void setUp() { public void setUp() {
configureProject("src/test/resources/junit/test-write-language-doc.xml"); configureProject("src/test/resources/junit/test-write-language-doc.xml");
} }
public void testEldDocCel() { public void testEldDocCel() {
executeTarget("test-elddoc-cel"); executeTarget("test-elddoc-cel");
File testDir = new File("target/test-elddoc/cel"); File testDir = new File("target/test-elddoc/cel");
int files = testDir.listFiles().length; int files = testDir.listFiles().length;
assertEquals("Should created more then two files", true, files>2); assertEquals("Should created more then two files", true, files > 2);
} }
public void testEldDocEld() { public void testEldDocEld() {
executeTarget("test-elddoc-eld"); executeTarget("test-elddoc-eld");
File testDir = new File("target/test-elddoc/eld"); File testDir = new File("target/test-elddoc/eld");
int files = testDir.listFiles().length; int files = testDir.listFiles().length;
assertEquals("Should created more then two files", true, files>2); assertEquals("Should created more then two files", true, files > 2);
///assertEquals("Message was logged but should not.", getLog(), ""); /// assertEquals("Message was logged but should not.", getLog(), "");
//expectLog("use.message", "attribute-text"); // expectLog("use.message", "attribute-text");
//assertLogContaining("Nested Element 1"); // assertLogContaining("Nested Element 1");
} }
public void testEldDocEldCustom() { public void testEldDocEldCustom() {
executeTarget("test-elddoc-eld-custom"); executeTarget("test-elddoc-eld-custom");
File testDir = new File("target/test-elddoc/eld-custom"); File testDir = new File("target/test-elddoc/eld-custom");
int files = testDir.listFiles().length; int files = testDir.listFiles().length;
assertEquals("Should created more then two files", true, files>2); assertEquals("Should created more then two files", true, files > 2);
} }
public void testEldDocEldVerbose() { public void testEldDocEldVerbose() {
executeTarget("test-elddoc-cel-verbose"); executeTarget("test-elddoc-cel-verbose");
assertLogContaining("Verbose:"); assertLogContaining("Verbose:");
@ -72,15 +72,19 @@ public class X4OWriteLanguageDocTaskTest extends BuildFileTest {
public void testFailAllMissing() { public void testFailAllMissing() {
expectBuildException("test-fail-all", "Should get exception with no attributes."); expectBuildException("test-fail-all", "Should get exception with no attributes.");
} }
public void testFailBasePath() { public void testFailBasePath() {
expectBuildException("test-fail-destdir", "Should get exception id destdir is not set."); expectBuildException("test-fail-destdir", "Should get exception id destdir is not set.");
} }
public void testFailBasePathError() { public void testFailBasePathError() {
expectBuildException("test-fail-destdir-error", "Should get exception id destdir does not exists."); expectBuildException("test-fail-destdir-error", "Should get exception id destdir does not exists.");
} }
public void testFailLanguage() { public void testFailLanguage() {
expectBuildException("test-fail-language", "Should get exception id language is not set."); expectBuildException("test-fail-language", "Should get exception id language is not set.");
} }
public void testFailLanguageError() { public void testFailLanguageError() {
expectBuildException("test-fail-language-error", "Should get exception id language throws error."); expectBuildException("test-fail-language-error", "Should get exception id language throws error.");
} }

View file

@ -37,25 +37,25 @@ public class X4OWriteLanguageSchemaTaskTest extends BuildFileTest {
public void setUp() { public void setUp() {
configureProject("src/test/resources/junit/test-write-language-schema.xml"); configureProject("src/test/resources/junit/test-write-language-schema.xml");
} }
public void testCelSchemaFull() { public void testCelSchemaFull() {
executeTarget("test-cel-schema-full"); executeTarget("test-cel-schema-full");
File testDir = new File("target/test-schemas/cel-full"); File testDir = new File("target/test-schemas/cel-full");
int files = testDir.listFiles().length; int files = testDir.listFiles().length;
assertEquals("Should created only 2 files", 2, files); assertEquals("Should created only 2 files", 2, files);
} }
public void testCelSchemaSingle() { public void testCelSchemaSingle() {
executeTarget("test-cel-schema-single"); executeTarget("test-cel-schema-single");
File testDir = new File("target/test-schemas/cel-single"); File testDir = new File("target/test-schemas/cel-single");
int files = testDir.listFiles().length; int files = testDir.listFiles().length;
assertEquals("Should created only one file", 1, files); assertEquals("Should created only one file", 1, files);
///assertEquals("Message was logged but should not.", getLog(), ""); /// assertEquals("Message was logged but should not.", getLog(), "");
//expectLog("use.message", "attribute-text"); // expectLog("use.message", "attribute-text");
//assertLogContaining("Nested Element 1"); // assertLogContaining("Nested Element 1");
} }
public void testCelSchemaVerbose() { public void testCelSchemaVerbose() {
executeTarget("test-cel-schema-verbose"); executeTarget("test-cel-schema-verbose");
assertLogContaining("Verbose:"); assertLogContaining("Verbose:");
@ -64,15 +64,19 @@ public class X4OWriteLanguageSchemaTaskTest extends BuildFileTest {
public void testFailAllMissing() { public void testFailAllMissing() {
expectBuildException("test-fail-all", "Should get exception if no attributes are set."); expectBuildException("test-fail-all", "Should get exception if no attributes are set.");
} }
public void testFailBasePath() { public void testFailBasePath() {
expectBuildException("test-fail-destdir", "Should get exception id destdir is not set."); expectBuildException("test-fail-destdir", "Should get exception id destdir is not set.");
} }
public void testFailBasePathError() { public void testFailBasePathError() {
expectBuildException("test-fail-destdir-error", "Should get exception id destdir does not exists."); expectBuildException("test-fail-destdir-error", "Should get exception id destdir does not exists.");
} }
public void testFailLanguage() { public void testFailLanguage() {
expectBuildException("test-fail-language", "Should get exception id language is not set."); expectBuildException("test-fail-language", "Should get exception id language is not set.");
} }
public void testFailLanguageError() { public void testFailLanguageError() {
expectBuildException("test-fail-language-error", "Should get exception id language throws error."); expectBuildException("test-fail-language-error", "Should get exception id language throws error.");
} }

View file

@ -40,58 +40,58 @@ import org.x4o.xml.lang.task.run.X4OTaskRunner;
* @author Willem Cazander * @author Willem Cazander
* @version 1.0 Apr 9, 2013 * @version 1.0 Apr 9, 2013
*/ */
@Mojo( name = X4OLanguageTaskMojo.GOAL,requiresProject=true,requiresDependencyResolution=ResolutionScope.COMPILE) @Mojo(name = X4OLanguageTaskMojo.GOAL, requiresProject = true, requiresDependencyResolution = ResolutionScope.COMPILE)
public class X4OLanguageTaskMojo extends AbstractMojo { public class X4OLanguageTaskMojo extends AbstractMojo {
static public final String GOAL = "x4o-language-task"; static public final String GOAL = "x4o-language-task";
@Parameter(property="languageName") @Parameter(property = "languageName")
private String languageName = null; private String languageName = null;
@Parameter(property="languageVersion") @Parameter(property = "languageVersion")
private String languageVersion = null; private String languageVersion = null;
@Parameter(property="taskId") @Parameter(property = "taskId")
private String taskId = null; private String taskId = null;
@Parameter(property="taskPropertyValues") @Parameter(property = "taskPropertyValues")
private List<String> taskPropertyValues; private List<String> taskPropertyValues;
@Parameter(defaultValue="false",property="verbose") @Parameter(defaultValue = "false", property = "verbose")
private boolean verbose = false; private boolean verbose = false;
@Parameter(defaultValue="true",property="failOnError") @Parameter(defaultValue = "true", property = "failOnError")
private boolean failOnError = true; private boolean failOnError = true;
private void executeLanguageTask() throws MojoExecutionException { private void executeLanguageTask() throws MojoExecutionException {
if (taskPropertyValues==null) { if (taskPropertyValues == null) {
taskPropertyValues = new ArrayList<String>(10); taskPropertyValues = new ArrayList<String>(10);
} }
if (verbose) { if (verbose) {
getLog().info("Verbose: "+verbose); getLog().info("Verbose: " + verbose);
getLog().info("Fail on error: "+failOnError); getLog().info("Fail on error: " + failOnError);
} }
long startTime = System.currentTimeMillis(); long startTime = System.currentTimeMillis();
if (verbose) { if (verbose) {
getLog().info("Starting "+getTaskId()+" for "+getLanguageName()); //+":"+languageVersion getLog().info("Starting " + getTaskId() + " for " + getLanguageName()); // +":"+languageVersion
} }
List<X4OTaskProperty> taskProperties = new ArrayList<X4OTaskProperty>(20); List<X4OTaskProperty> taskProperties = new ArrayList<X4OTaskProperty>(20);
for (String taskPropertyLine:taskPropertyValues) { for (String taskPropertyLine : taskPropertyValues) {
taskProperties.add(X4OTaskProperty.parseLine(taskPropertyLine)); taskProperties.add(X4OTaskProperty.parseLine(taskPropertyLine));
} }
try { try {
X4OTaskRunner.runTask(getLanguageName(),getLanguageVersion(), getTaskId(), taskProperties); X4OTaskRunner.runTask(getLanguageName(), getLanguageVersion(), getTaskId(), taskProperties);
} catch (X4OLanguageTaskException e) { } catch (X4OLanguageTaskException e) {
throw new MojoExecutionException("Error while running task: "+getTaskId()+" error: "+e.getMessage(),e); throw new MojoExecutionException("Error while running task: " + getTaskId() + " error: " + e.getMessage(), e);
} }
long stopTime = System.currentTimeMillis(); long stopTime = System.currentTimeMillis();
String taskName = getLanguageName(); String taskName = getLanguageName();
if (getLanguageVersion() != null) { if (getLanguageVersion() != null) {
taskName += ":"+getLanguageVersion(); taskName += ":" + getLanguageVersion();
} }
getLog().info("Done " + getTaskId() + " for " + taskName + " in " + (stopTime-startTime) + " ms."); getLog().info("Done " + getTaskId() + " for " + taskName + " in " + (stopTime - startTime) + " ms.");
} }
public void execute() throws MojoExecutionException { public void execute() throws MojoExecutionException {
try { try {
executeLanguageTask(); executeLanguageTask();
@ -103,76 +103,78 @@ public class X4OLanguageTaskMojo extends AbstractMojo {
} }
} }
} }
public List<String> getTaskPropertyValues() { public List<String> getTaskPropertyValues() {
return taskPropertyValues; return taskPropertyValues;
} }
public void addTaskPropertyValue(String taskPropertyLine) { public void addTaskPropertyValue(String taskPropertyLine) {
taskPropertyValues.add(taskPropertyLine); taskPropertyValues.add(taskPropertyLine);
} }
/** /**
* @return the verbose * @return the verbose
*/ */
public boolean isVerbose() { public boolean isVerbose() {
return verbose; return verbose;
} }
/** /**
* @param verbose the verbose to set * @param verbose the verbose to set
*/ */
public void setVerbose(boolean verbose) { public void setVerbose(boolean verbose) {
this.verbose = verbose; this.verbose = verbose;
} }
/** /**
* @return the failOnError * @return the failOnError
*/ */
public boolean isFailOnError() { public boolean isFailOnError() {
return failOnError; return failOnError;
} }
/** /**
* @param failOnError the failOnError to set * @param failOnError the failOnError to set
*/ */
public void setFailOnError(boolean failOnError) { public void setFailOnError(boolean failOnError) {
this.failOnError = failOnError; this.failOnError = failOnError;
} }
/** /**
* @return the languageName * @return the languageName
*/ */
public String getLanguageName() { public String getLanguageName() {
return languageName; return languageName;
} }
/** /**
* @param languageName the languageName to set * @param languageName the languageName to set
*/ */
public void setLanguageName(String languageName) { public void setLanguageName(String languageName) {
this.languageName = languageName; this.languageName = languageName;
} }
/** /**
* @return the languageVersion * @return the languageVersion
*/ */
public String getLanguageVersion() { public String getLanguageVersion() {
return languageVersion; return languageVersion;
} }
/** /**
* @param languageVersion the languageVersion to set * @param languageVersion the languageVersion to set
*/ */
public void setLanguageVersion(String languageVersion) { public void setLanguageVersion(String languageVersion) {
this.languageVersion = languageVersion; this.languageVersion = languageVersion;
} }
/** /**
* @return the taskId * @return the taskId
*/ */
public String getTaskId() { public String getTaskId() {
return taskId; return taskId;
} }
/** /**
* @param taskId the taskId to set * @param taskId the taskId to set
*/ */

View file

@ -44,77 +44,57 @@ public class X4OLanguageTaskMojoTest extends AbstractMojoTestCase {
protected void tearDown() throws Exception { protected void tearDown() throws Exception {
super.tearDown(); // required super.tearDown(); // required
} }
private void executeGoal(String goal,String testFile) throws Exception { private void executeGoal(String goal, String testFile) throws Exception {
File pom = getTestFile(testFile); File pom = getTestFile(testFile);
assertNotNull(pom); assertNotNull(pom);
assertTrue(pom.exists()); assertTrue(pom.exists());
X4OLanguageTaskMojo mojo = (X4OLanguageTaskMojo) lookupMojo(goal,pom); X4OLanguageTaskMojo mojo = (X4OLanguageTaskMojo) lookupMojo(goal, pom);
assertNotNull(mojo); assertNotNull(mojo);
mojo.execute(); mojo.execute();
} }
public void testHelp() throws Exception { public void testHelp() throws Exception {
File pom = getTestFile("src/test/resources/junit/test-plugin-defaults.pom"); File pom = getTestFile("src/test/resources/junit/test-plugin-defaults.pom");
assertNotNull(pom); assertNotNull(pom);
assertTrue(pom.exists()); assertTrue(pom.exists());
Mojo mojo = lookupMojo("help",pom); Mojo mojo = lookupMojo("help", pom);
assertNotNull(mojo); assertNotNull(mojo);
mojo.execute(); mojo.execute();
} }
public void testConfAllWriteDoc() throws Exception { public void testConfAllWriteDoc() throws Exception {
executeGoal(X4OLanguageTaskMojo.GOAL,"src/test/resources/junit/test-plugin-conf-all.pom"); executeGoal(X4OLanguageTaskMojo.GOAL, "src/test/resources/junit/test-plugin-conf-all.pom");
File outputDir = new File("target/jtest/test-plugin-conf-all/doc-eld-1.0"); File outputDir = new File("target/jtest/test-plugin-conf-all/doc-eld-1.0");
if (!outputDir.exists()) { if (!outputDir.exists()) {
return; // TODO: fix fails in maven test run ? return; // TODO: fix fails in maven test run ?
} }
assertTrue(outputDir.exists()); assertTrue(outputDir.exists());
int files = outputDir.listFiles().length; int files = outputDir.listFiles().length;
assertEquals("Should created more then two files", true, files>2); assertEquals("Should created more then two files", true, files > 2);
} }
/* /*
public void testConfLangWriteDoc() throws Exception { * public void testConfLangWriteDoc() throws Exception { executeGoal(X4OLanguageTaskMojo.GOAL,"src/test/resources/junit/test-plugin-conf-lang.pom"); File
executeGoal(X4OLanguageTaskMojo.GOAL,"src/test/resources/junit/test-plugin-conf-lang.pom"); * outputDir = new File("target/jtest/test-plugin-conf-lang/cel"); int files = outputDir.listFiles().length;
File outputDir = new File("target/jtest/test-plugin-conf-lang/cel"); * assertEquals("Should created more then one files", true, files>1); }
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,
public void testConfDefaultsWriteDoc() throws Exception { * files>2); }
executeGoal(X4OLanguageTaskMojo.GOAL,"src/test/resources/junit/test-plugin-defaults.pom"); *
File outputDir = new File("target/x4o/doc-cel-1.0"); * public void testConfAllWriteSchema() throws Exception { executeGoal(X4OLanguageTaskMojo.GOAL,"src/test/resources/junit/test-plugin-conf-all.pom"); File
int files = outputDir.listFiles().length; * 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); * assertEquals("Should created more then two files", true, files>2); }
outputDir = new File("target/x4o/doc-eld-1.0"); *
files = outputDir.listFiles().length; * public void testConfLangWriteSchema() throws Exception { executeGoal(X4OLanguageTaskMojo.GOAL,"src/test/resources/junit/test-plugin-conf-lang.pom"); File
assertEquals("Should created more then two files", true, files>2); * 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 testConfAllWriteSchema() throws Exception { * public void testConfDefaultsWriteSchema() throws Exception { executeGoal(X4OLanguageTaskMojo.GOAL,"src/test/resources/junit/test-plugin-defaults.pom");
executeGoal(X4OLanguageTaskMojo.GOAL,"src/test/resources/junit/test-plugin-conf-all.pom"); * File outputDir = new File("target/x4o/xsd-cel-1.0"); int files = outputDir.listFiles().length; assertEquals("Should created more then one file", true,
File outputDir = new File("target/jtest/test-plugin-conf-all/xsd-eld-1.0"); * files>1); outputDir = new File("target/x4o/xsd-eld-1.0"); files = outputDir.listFiles().length; assertEquals("Should created more then two files", true,
assertTrue(outputDir.exists()); * files>2); }
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);
}
*/
} }