Well, your component looks somehow strange to me. I don't see what it should
do.
However id="checkbox" is written when your contained checkbox is rendered.
That's expected behavior. Your own component does nothing except registering
to the group. So why do you expect id="ckL1"?

On 7/25/07, #Cyrille37# <[EMAIL PROTECTED]> wrote:

Igor Drobiazko a écrit :
> It is inpossible to help you without having a look into your
> GroupableCheckbox.java and GroupableCheckbox.html
> Please post it.
Ha! That's another story, a more complex problem ;-)
After relearned Ids concept, I can talk to you about the component
GroupableCheckbox which I try to construct.

The rendered version of the concept/need is looking like (where "x" are
checkboxes) :
x List1
   x List1Choice1
   x List1Choice2
  x List2
   x List2Choice1
   x List2Choice2
With those constraints :
1/ you can select list's choices only in the selected list. eg: is List1
is selected you can choice List1Choice1 or List1Choice2 but not
List2Choice1 or List2Choice2
2/ The validation must be done on the client-side *without* any
communication with the server, but the validation has to exist on the
server to check validity at form's submit.
3/ I do not want to have encapsulation of component html tags like the
CheckboxGroup component do. This constraint is to let free html designer.

I've not yet many sources to show because I've to learning and find many
stuff to complete this 3 constraints. At first I've to verify that the
third constraint is possible ...
For da moment I've got :

========================
TestGroupableCheckbox.html :

<form jwcid="[EMAIL PROTECTED]" clientValidationEnabled="true" >

    L1     <input id="ckL1" jwcid="[EMAIL PROTECTED]/GroupableCheckbox"
value="L1" /> <br/>

    L1C1    <input id="ckL1C1" jwcid="[EMAIL PROTECTED]/GroupableCheckbox"
value="0" group="component:ckL1" />
    L1C2    <input id="ckL1C2" jwcid="[EMAIL PROTECTED]/GroupableCheckbox"
value="ognl:null" group="component:ckL1" />
    L1C3    <input id="ckL1C3" jwcid="[EMAIL PROTECTED]/GroupableCheckbox"
group="component:ckL1" />
</form>

========================
GroupableCheckbox.html :

<span jwcid="$content$">
    <span jwcid="checkbox"/>
</span>

========================
GroupableCheckbox.jwc :

<!DOCTYPE component-specification
      PUBLIC "-//Apache Software Foundation//Tapestry Specification 4.0
//EN"
      "http://tapestry.apache.org/dtd/Tapestry_4_0.dtd";>

<component-specification
    class="web.components.mycomps.GroupableCheckbox"
    allow-body="no"
    allow-informal-parameters="yes" >

    <description>
        A checkbox whose state may be controlled/validated by an other
checkbox which acting as a checkbox group controler.
    </description>

    <parameter name="id" required="no"/>
    <parameter name="value" required="no" default-value="null"/>
    <parameter name="disabled" required="no"/>

    <parameter name="group" required="yes">
        <description>
            Specifies the GroupableCheckbox this component belongs to.
        </description>
    </parameter>

    <component id="checkbox" type="Checkbox"
inherit-informal-parameters="yes">
        <inherited-binding name="id" parameter-name="id"/>
        <inherited-binding name="name" parameter-name="id"/>
        <inherited-binding name="value" parameter-name="value"/>
        <inherited-binding name="disabled" parameter-name="disabled"/>
    </component>

    <property name="subCheckboxesId" initial-value="new
java.util.ArrayList()"/>

</component-specification>

========================
And the UGLY java file. I'm just at the time of tracing all calls to
learn more on cycle...
GroupableCheckbox.java :

public abstract class GroupableCheckbox extends BaseComponent
{
public abstract Object getGroup();
public abstract Collection getSubCheckboxesId() ;
public void registerSubCheckbox( GroupableCheckbox groupableCheckbox)
{
  getSubCheckboxesId().add( groupableCheckbox );
}
protected void renderComponent( IMarkupWriter writer, IRequestCycle cycle
)
{
        log.info( "*** renderComponent()" );
        log.info( "getBoundId: "+this.getBoundId() );
        log.info( "id: "+this.getId()+", clientId:
"+this.getClientId()+", specifiedId: "+this.getSpecifiedId() );
        log.info( "getIdPath: "+this.getIdPath() + ", getExtendedId:
"+this.getExtendedId() );
        Object group = this.getGroup();
        log.info( "group: "+group );
        if( group != null )
        {
            ((GroupableCheckbox)group).registerSubCheckbox( this );
        }
        super.renderComponent( writer, cycle );
    }
    ...
    ... Overrided methods with log.info("methodName")
    ...
}



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


Reply via email to