I would like to be able to send you the stuff but I cannot as it's all overly complex for just an example (When I say complex I mean it uses a lot of my own logicsheets).

The idea was basically to have 1 document (XML) and generate all the information from that. I have attached a sample document (example.xmb). Using the style sheet (databeans.xsl) you can create a .java file which can be compiled into a Bean. If you included in the example.xmb the information needed to generate a generic XMLForm and Validator then you would on your way.

Then all you need is an Ant Script with an action like this
<style destdir="." extension="xml" in="./apps/example.xmb" out="./apps/example.java" />

<style destdir="." extension="xml" in="./apps/example.xmb" out="./apps/example_desc.xml" />
<style destdir="." extension="xml" in="./apps/example.xmb" out="./apps/example_form.xsp" />
...... etc.

I hope this helps. I know the description is not very completed and the example files don't all match up but hopfully you get the idea

Regards

Scott Warren

Rob Johnston wrote:
Scott,

Would it be possible for you to send the related files to me to take a
look at?  This is very interesting to me, as I'm in a bit of a bind with
the XMLForms stuff I've been working on.

If it is company proprietary -- don't worry about it.  If you have some
generic stuffs I could take a look at, that would be great. :-)

thanks,
rob

On Mon, 18 Nov 2002, Scott Warren wrote:

  
Senhaji,

An easy way that I have achieved this is to generate an XML document 
that has all the information (Java Bean properties + code, Form Elements 
etc) then I created a number of XSL Documents that take the XML doc and 
produce the JavaBean code, XMLForm.XSP, Validation Descriptor.XML etc. 
Then all you need to do is change the layout of the XMLForm as 
needed...... I use Ant to generate the files from the XML but you can 
use a Cocoon pipleine to generate the files.

Hope this helps

Scott Warren

Senhaji wrote:

    
Hello,

I've just finished playing with the XMLForm wizard example. I've learned a
lot of good concepts such as the separation between the content, the
presentation and the validation in the form building process. After that, I
started looking for an XMLForm builder that would help me speed up the form
building process. But without success! How can I explain to the management
that even building a simple Form with C2 will take ~3 days of development?
not easy -).

It could be very nice if from a form builder one can generate all the
necessary files for C2 (JavaBeans, XSL for transforming XMLForm widget to
HTML or whatever widget, XSL for the form layout, XML schema for
validation,...).

Are there any works in this area ?

Thanks in advance,

Senhaji


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <[EMAIL PROTECTED]>
For additional commands, e-mail:   <[EMAIL PROTECTED]>





      

---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <[EMAIL PROTECTED]>
For additional commands, e-mail:   <[EMAIL PROTECTED]>
    


  

<?xml version="1.0"?>
<db:databean xmlns:db="http://ocom.ocom/databeans/1.0"; tablename="tblAddress" 
datasource="st_ucm">
        <db:import name="java.sql.Date" />
        <db:import name="java.sql.Time" />
        
        <db:property name="TestID" type="long" fieldname="TestID" 
primarykey="true"><db:default>0</db:default><db:database 
fieldname="ID"><db:select/><db:insert/><db:update/></db:database><db:gui 
type="text"><db:format>java.text.NumberFormat.getNumberInstance()</db:format><db:caption>ID</db:caption></db:gui></db:property>
        <db:property name="TestName" type="String" fieldname="TestName" 
primarykey="false"><db:default>""</db:default><db:database 
fieldname="TestName"><db:select/><db:insert/><db:update/></db:database><db:gui 
type="text"><db:caption>TestName</db:caption></db:gui></db:property>
        <db:property name="Body" type="String" fieldname="Body" 
primarykey="false"><db:default>""</db:default><db:database 
fieldname="Body"><db:select/><db:insert/><db:update/></db:database><db:gui 
type="text"><db:caption>Body</db:caption></db:gui></db:property> 
</db:databean>
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; xmlns:db="http://ocom.ocom/databeans/1.0"; version="1.0">
<xsl:output method="text"/>
  <xsl:template match="include" />
	
	<xsl:template match="db:databean">
	package <xsl:value-of select="translate(@file-path, '/', '.')"/>;
	
	import com.ocom.framework.cocoon.components.language.markup.databeans.AbstractDataBean;
	<xsl:for-each select="db:import">
	import <xsl:value-of select="@name" />;
	</xsl:for-each>
	
  public class <xsl:value-of select="@file-name"/> extends AbstractDataBean implements java.io.Serializable {
	<!--<xsl:if test="@extends"> extends <xsl:value-of select="@extends"/> </xsl:if> -->
	
		static final String LOCATION = "<xsl:value-of select="translate(@file-path, '/', '.')"/>.<xsl:value-of select="@file-name"/>";
	
		private boolean BEAN_IsDirtyFlag = false;
		
		/* Property Change Support */
		private java.beans.PropertyChangeSupport propertySupport;
		
		<xsl:for-each select="db:property">		
		private <type><xsl:value-of select="@type" /></type>
			<xsl:text> </xsl:text>
			<xsl:value-of select="@name" /><xsl:if test="db:default"> = <xsl:value-of select="db:default" /></xsl:if>;			
		</xsl:for-each>
		
		/*
		 * Default constructor - Also creates the PropertyChangeSupport
		 */
		public <xsl:value-of select="@file-name" /> () {
			dateCreated = <xsl:value-of select="@creation-date"/>L;
			
			propertySupport = new java.beans.PropertyChangeSupport ( this ); 
		} 
		 
		/*
		 * Add a Property Change Listener
		 */
		public void addPropertyChangeListener (java.beans.PropertyChangeListener listener) { 
			propertySupport.addPropertyChangeListener (listener); 
		} 
		
		/*
		 * Remove a Property Change Listener
		 */
		public void removePropertyChangeListener (java.beans.PropertyChangeListener listener) { 
			propertySupport.removePropertyChangeListener (listener); 
		} 	
		<xsl:for-each select="db:property">
		/*
		 * Get the value of the <xsl:value-of select="@name" /> property
		 * @return the value of the property
		 */	
		public <type><xsl:value-of select="@type" /></type>  get<xsl:value-of select="@name" />() { 
			return <xsl:value-of select="@name" />; 
		} 
		
		/*
		 * Set the value of the <xsl:value-of select="@file-name" /> property
		 */
		public void set<xsl:value-of select="@name" />(<type><xsl:value-of select="@type" /></type> value) { 
			<type><xsl:value-of select="@type" /></type> old<xsl:value-of select="@name" /> = this.<xsl:value-of select="@name" />;
			<xsl:value-of select="onbeforeset" />
	
			this.<xsl:value-of select="@name" /> = value;			
			
			<xsl:value-of select="onafterset" />		
			//propertySupport.firePropertyChange("<xsl:value-of select="@name" />", <xsl:element name="toobject"><xsl:attribute name="type"><xsl:value-of select="@type" /></xsl:attribute>old<xsl:value-of select="@name" /></xsl:element>, <xsl:element name="toobject"> <xsl:attribute name="type"><xsl:value-of select="@type" /></xsl:attribute><xsl:value-of select="@name" /></xsl:element>);
		} 	
		</xsl:for-each>
		
		protected void setBEAN_Dirty(String propertyName) {
			BEAN_IsDirtyFlag = true;
			System.out.println ("Bean Was set Dirty by " + propertyName);
		}
		
		public boolean isBeanDirty() {
			return BEAN_IsDirtyFlag;
		}
		
		public void resetDirtyFlag() {
			BEAN_IsDirtyFlag = false;
		}
		
	
		public <xsl:value-of select="@file-name" /> createClone() {	
			<xsl:value-of select="@file-name" /> result = new <xsl:value-of select="@file-name" />();
			
			result.setBean (this);
			
			return result;
		}
	
		public void setBean (<xsl:value-of select="@file-name" /> bean) {
			<xsl:for-each select="db:property">
			this.<xsl:value-of select="@name" /> = bean.get<xsl:value-of select="@name" />();
			</xsl:for-each>
		}
		
		/** Override Dispose Method to implement Disposable !
			* Reset The Values to defaults as Specified
			*/
		public void dispose() {
		<xsl:for-each select="db:property[db:default]">
			<xsl:value-of select="@name" /> = <xsl:value-of select="db:default" />;			
		</xsl:for-each>		
		}
	} 
	</xsl:template>
</xsl:stylesheet>
---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <[EMAIL PROTECTED]>
For additional commands, e-mail:   <[EMAIL PROTECTED]>

Reply via email to