You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@click.apache.org by "WarnerJan Veldhuis (JIRA)" <ji...@apache.org> on 2009/06/29 13:45:47 UTC
[jira] Created: (CLK-562) AbstractControl and default constructor
AbstractControl and default constructor
---------------------------------------
Key: CLK-562
URL: https://issues.apache.org/jira/browse/CLK-562
Project: Click
Issue Type: Improvement
Components: documentation
Affects Versions: 2.1.0
Reporter: WarnerJan Veldhuis
Priority: Trivial
The AbstractControl javadoc says: "Subclasses are expected to at least override getTag() to differentiate the control.". What it *also* should mention, is that it needs a default constructor if you have created a custom constructor.
At deploy time, all the controls listed in click.xml will have their onDeploy() method called. But the reflection part will fail if the default cstor does not exist.
org.apache.click.service.XmlConfigService.deployControls(XmlConfigService.java:1077):
Class deployClass = ClickUtils.classForName(classname);
Control control = (Control) deployClass.newInstance(); //<--- fails at deploy time
control.onDeploy(servletContext);
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Closed: (CLK-562) AbstractControl and default constructor
Posted by "Bob Schellink (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CLK-562?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Bob Schellink closed CLK-562.
-----------------------------
Resolution: Fixed
Fix Version/s: 2.1.0
Assignee: Bob Schellink
fixed in trunk
> AbstractControl and default constructor
> ---------------------------------------
>
> Key: CLK-562
> URL: https://issues.apache.org/jira/browse/CLK-562
> Project: Click
> Issue Type: Improvement
> Components: documentation
> Affects Versions: 2.1.0
> Reporter: WarnerJan Veldhuis
> Assignee: Bob Schellink
> Priority: Trivial
> Fix For: 2.1.0
>
>
> The AbstractControl javadoc says: "Subclasses are expected to at least override getTag() to differentiate the control.". What it *also* should mention, is that it needs a default constructor if you have created a custom constructor.
> At deploy time, all the controls listed in click.xml will have their onDeploy() method called. But the reflection part will fail if the default cstor does not exist.
> org.apache.click.service.XmlConfigService.deployControls(XmlConfigService.java:1077):
> Class deployClass = ClickUtils.classForName(classname);
> Control control = (Control) deployClass.newInstance(); //<--- fails at deploy time
> control.onDeploy(servletContext);
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (CLK-562) AbstractControl and default constructor
Posted by "Bob Schellink (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CLK-562?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12725223#action_12725223 ]
Bob Schellink commented on CLK-562:
-----------------------------------
Good catch. I've updated the docs as follows:
"Subclasses are also expected to provide a default no-arg constructor <tt>if</tt> the control deploys its JavaScript and CSS resources through Click's {@link org.apache.click.Control#onDeploy(javax.servlet.ServletContext)} mechanism. However if JavaScript and CSS resources are deployed through Click's <a href="../../../../user-guide/html/ch04s03.html#deploying-custom-resources">convention based</a> mechanism, a default constructor is <tt>not</tt> needed."
Btw I recommend using the convention based approach (place resources under classes/META-INF/web/) which makes it easier to manage control's resources since you don't have to update the onDeploy methods.
> AbstractControl and default constructor
> ---------------------------------------
>
> Key: CLK-562
> URL: https://issues.apache.org/jira/browse/CLK-562
> Project: Click
> Issue Type: Improvement
> Components: documentation
> Affects Versions: 2.1.0
> Reporter: WarnerJan Veldhuis
> Priority: Trivial
>
> The AbstractControl javadoc says: "Subclasses are expected to at least override getTag() to differentiate the control.". What it *also* should mention, is that it needs a default constructor if you have created a custom constructor.
> At deploy time, all the controls listed in click.xml will have their onDeploy() method called. But the reflection part will fail if the default cstor does not exist.
> org.apache.click.service.XmlConfigService.deployControls(XmlConfigService.java:1077):
> Class deployClass = ClickUtils.classForName(classname);
> Control control = (Control) deployClass.newInstance(); //<--- fails at deploy time
> control.onDeploy(servletContext);
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.