please post such topics to the users list.
[EMAIL PROTECTED] wrote:
Hello,

when I declare page property using <property name="testName"> in page property file and then implements getters and setters for this property using concrette (not abstract) methods implementation in page class , Tapestry ignores this getters and setters and constructs this own methods implementation as the getters and setters were defined using abstract methods.

Result is the implemented logic in methods is quitely overriden and ignored. Maybe I am wrong in implementation or misread docs, but the reading I did found for this problem is not much helpful, too. On

../tapestry-4.0-beta-13-docs/UsersGuide/spec.html#spec.property
" ... In Tapestry 4.0, the type of the implemented property will simply match the type of any existing (abstract) property, or will default to Object. ..." This does not expalin too much clearly what will happen. Or the abstract method shoud be required for property or the concrette implementation should not be overriden for the property.

I am using:

Tapestry beta 13
Hiveming 1.1
Apache Tomcat 4.1
Java SDK1.4.2_08

Attached please find working example. Problem is in property "implementedWithDefinition". It has getters and setters implemented with log.debug message, which is never called - althoug it should be - can be seen in the log example o the end of email.

Can you tell me ouur opinion about this problem?

Best regards

Petr Marek

--------------------------------------------------------------------------------------------------------------------------------------------------
EXAMPLE:

TestProperties.html
------------------------
<html>
    <body>
        Hello, this is test of properties!
    </body>
</html>

TestProperties.page
-------------------------
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE page-specification PUBLIC
"-//Apache Software Foundation//Tapestry Specification 4.0//EN" "http://jakarta.apache.org/tapestry/dtd/Tapestry_4_0.dtd";> <page-specification class="cz.profinit.kos.web.stranky.TestProperties">
      <property name="abstractWithDefinition"/>
      <property name="implementedWithDefinition"/>
  </page-specification>

TestProperties.java
------------------------

package cz.profinit.kos.web.stranky;

import org.apache.log4j.Logger;
import org.apache.tapestry.event.PageBeginRenderListener;
import org.apache.tapestry.event.PageEvent;
import org.apache.tapestry.html.BasePage;

/**
* Tests the results of calling and setting abstract and implemented properties.
 *
 * History:
 * <br>$Log: TestProperties.java,v $
 * <br>
 *
 * @author $Author: pmarek $
 * @version $Revision: 1.0 $
 */

public abstract class TestProperties extends BasePage implements PageBeginRenderListener { private static Logger log = Logger.getLogger(TestProperties.class.getName()); /** * Abstract property with definition in TestProperties.page using <property tag>.
         * @return
         */
        public abstract String getAbstractWithDefinition();
public abstract void setAbstractWithDefinition(String abstractWithDefinition); /** * Implemented property with definition in TestProperties.page using <property tag>.
         */
        private String implementedWithDefinition;
        public String getImplementedWithDefinition() {
                log.debug("running getImplementedWithDefinition()...");
                return this.implementedWithDefinition;
        }
public void setImplementedWithDefinition(String implementedWithDefinition) {
                log.debug("running setImplementedWithDefinition(...)...");
this.implementedWithDefinition = implementedWithDefinition;
        }
/**
         * Abstract property with NO definition in TestProperties.page.
         * @return
         */
        public abstract String getAbstractNoDefinition();
public abstract void setAbstractNoDefinition(String abstractNoDefinition); /**
         * Implemented property with NO definition in TestProperties.page.
         */
        private String implementedNoDefinition;
        public String getImplementedNoDefinition() {
                log.debug("running getImplementedNoDefinition()...");
                return this.implementedNoDefinition;
        }
public void setImplementedNoDefinition(String implementedNoDefinition) {
                log.debug("running setImplementedNoDefinition(...)...");
                this.implementedNoDefinition = implementedNoDefinition;
        }
/**
         * Implementation of @see PageRenderListener#pageBeginRender.
         * @param pageEvent
         */
        public void pageBeginRender (PageEvent pageEvent) {
                log.debug("setAbstractWithDefinition("+TEST_VALUE_1+")");
                this.setAbstractWithDefinition(TEST_VALUE_1);
                log.debug("getAbstractWithDefinition()");
log.debug("Should be '"+TEST_VALUE_1+"'. Is '"+this.getAbstractWithDefinition()+"'");
 log.debug("setImplementedWithDefinition("+TEST_VALUE_2+")");
                this.setImplementedWithDefinition(TEST_VALUE_2);
                log.debug("getImplementedWithDefinition()");
log.debug("Should be '"+TEST_VALUE_2+"'. Is '"+this.getImplementedWithDefinition()+"'");
                log.debug("setAbstractNoDefinition("+TEST_VALUE_3+")");
                this.setAbstractNoDefinition(TEST_VALUE_3);
                log.debug("getAbstractNoDefinition()");
log.debug("Should be '"+TEST_VALUE_3+"'. Is '"+this.getAbstractNoDefinition()+"'");
                log.debug("setImplementedNoDefinition("+TEST_VALUE_4+")");
                this.setImplementedNoDefinition(TEST_VALUE_4);
                log.debug("getImplementedNoDefinition()");
log.debug("Should be '"+TEST_VALUE_4+"'. Is '"+this.getImplementedNoDefinition()+"'");
        }
private static final String TEST_VALUE_1 = "test value 1";
        private static final String TEST_VALUE_2 = "test value 2";
        private static final String TEST_VALUE_3 = "test value 3";
        private static final String TEST_VALUE_4 = "test value 4";

}


Here is log listing after page TestProperties constructed:
---------------------------------------------------------------------
2005-12-05 12:01:28,587 DEBUG cz.profinit.kos.web.stranky.TestProperties - setAbstractWithDefinition(test value 1) 2005-12-05 12:01:28,587 DEBUG cz.profinit.kos.web.stranky.TestProperties - getAbstractWithDefinition() 2005-12-05 12:01:28,587 DEBUG cz.profinit.kos.web.stranky.TestProperties - Should be 'test value 1'. Is 'test value 1' 2005-12-05 12:01:28,587 DEBUG cz.profinit.kos.web.stranky.TestProperties - setImplementedWithDefinition(test value 2)

*** here should be "running setImplementedWithDefinition(...)..." printed
*** here should be "running getImplementedWithDefinition()..." printed

2005-12-05 12:01:28,587 DEBUG cz.profinit.kos.web.stranky.TestProperties - getImplementedWithDefinition() 2005-12-05 12:01:28,587 DEBUG cz.profinit.kos.web.stranky.TestProperties - Should be 'test value 2'. Is 'test value 2' 2005-12-05 12:01:28,587 DEBUG cz.profinit.kos.web.stranky.TestProperties - setAbstractNoDefinition(test value 3) 2005-12-05 12:01:28,587 DEBUG cz.profinit.kos.web.stranky.TestProperties - getAbstractNoDefinition() 2005-12-05 12:01:28,587 DEBUG cz.profinit.kos.web.stranky.TestProperties - Should be 'test value 3'. Is 'test value 3' 2005-12-05 12:01:28,587 DEBUG cz.profinit.kos.web.stranky.TestProperties - setImplementedNoDefinition(test value 4) 2005-12-05 12:01:28,587 DEBUG cz.profinit.kos.web.stranky.TestProperties - running setImplementedNoDefinition(...)... 2005-12-05 12:01:28,587 DEBUG cz.profinit.kos.web.stranky.TestProperties - getImplementedNoDefinition() 2005-12-05 12:01:28,587 DEBUG cz.profinit.kos.web.stranky.TestProperties - running getImplementedNoDefinition()... 2005-12-05 12:01:28,587 DEBUG cz.profinit.kos.web.stranky.TestProperties - Should be 'test value 4'. Is 'test value 4'

----------------------------------
Petr Marek
Profinit Ltd.
----------------------------------


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

Reply via email to