You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Koen Segers <Ko...@scarlet.be> on 2005/03/28 21:13:42 UTC

bug???

Hi, 

I just created a DirectLink component that must work like an on/off button. 
First click works, since then always same property is chosen...

I don't understand it...
Can you help? I believe it is a stupid fault, but it is a nasty one :s

java:
public void tree (IRequestCycle cycle){
		Global global = (Global) getGlobal();
		if (isShowTree()){
			setShowTree(false);
			global.log("from true to false");
		}
		else{
			setShowTree(true);
			global.log("from false to true");
		}
	}
	
	public boolean isShowTree() {
		return showTree;
	}
	public void setShowTree(boolean showTree) {
		this.showTree = showTree;
		if (showTree)
			setShowTreeText("Remove Tree");
		else
			setShowTreeText("Tree");
	}
	
	public String getShowTreeText() {
		return showTreeText;
	}
	public void setShowTreeText(String showTreeText) {
		this.showTreeText = showTreeText;
	}

Page file:
 <component id="Tree" type="DirectLink">
        <binding name="listener" expression="listeners.tree"/>
    </component>
    
    <component id="ShowTreeText" type="Insert">
        <binding name="value" expression="showTreeText"/>
    </component>


HTML:
<td valign="top">
        <a href=# jwcid="Tree"><span jwcid='ShowTreeText'>JA of nee</span></a>
		<span jwcid='TreeText'>
	    	  	<script type="text/javascript">
			a = new dTree('a');
			document.write(a);
			</script>
		</span>
      </td>
-- 

Koen Segers

<ko...@scarlet.be>
<http://eddyvite.dyndns.org>

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: bug???

Posted by Koen Segers <Ko...@scarlet.be>.
Just to inform you, I tried a Actionlink and a button. Both had same 
problem...

On Monday 28 March 2005 21:13, Koen Segers wrote:
> Hi,
>
> I just created a DirectLink component that must work like an on/off button.
> First click works, since then always same property is chosen...
>
> I don't understand it...
> Can you help? I believe it is a stupid fault, but it is a nasty one :s
>
> java:
> public void tree (IRequestCycle cycle){
> 		Global global = (Global) getGlobal();
> 		if (isShowTree()){
> 			setShowTree(false);
> 			global.log("from true to false");
> 		}
> 		else{
> 			setShowTree(true);
> 			global.log("from false to true");
> 		}
> 	}
>
> 	public boolean isShowTree() {
> 		return showTree;
> 	}
> 	public void setShowTree(boolean showTree) {
> 		this.showTree = showTree;
> 		if (showTree)
> 			setShowTreeText("Remove Tree");
> 		else
> 			setShowTreeText("Tree");
> 	}
>
> 	public String getShowTreeText() {
> 		return showTreeText;
> 	}
> 	public void setShowTreeText(String showTreeText) {
> 		this.showTreeText = showTreeText;
> 	}
>
> Page file:
>  <component id="Tree" type="DirectLink">
>         <binding name="listener" expression="listeners.tree"/>
>     </component>
>
>     <component id="ShowTreeText" type="Insert">
>         <binding name="value" expression="showTreeText"/>
>     </component>
>
>
> HTML:
> <td valign="top">
>         <a href=# jwcid="Tree"><span jwcid='ShowTreeText'>JA of
> nee</span></a> <span jwcid='TreeText'>
> 	    	  	<script type="text/javascript">
> 			a = new dTree('a');
> 			document.write(a);
> 			</script>
> 		</span>
>       </td>

-- 

Koen Segers

<ko...@scarlet.be>
<http://eddyvite.dyndns.org>

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: bug???

Posted by Koen Segers <Ko...@scarlet.be>.
On Wednesday 30 March 2005 03:26, Kent Tong wrote:
> Koen Segers <KoenSegers <at> scarlet.be> writes:
> > I just created a DirectLink component that must work like an on/off
> > button. First click works, since then always same property is chosen...
> >
> > I don't understand it...
> > Can you help? I believe it is a stupid fault, but it is a nasty one :s
>
> If your "showTree" var is an instance var, it will not be
> kept for long, that is, when the next request arrives,
> Tapestry may get a completely new page object to serve
> the request.

Ow ic, so I must place the value in the Visit object...

Thx

>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org

-- 

Koen Segers

<ko...@scarlet.be>
<http://eddyvite.dyndns.org>

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: bug???

Posted by Kent Tong <ke...@cpttm.org.mo>.
Koen Segers <KoenSegers <at> scarlet.be> writes:

> I just created a DirectLink component that must work like an on/off button. 
> First click works, since then always same property is chosen...
> 
> I don't understand it...
> Can you help? I believe it is a stupid fault, but it is a nasty one :s

If your "showTree" var is an instance var, it will not be
kept for long, that is, when the next request arrives, 
Tapestry may get a completely new page object to serve 
the request.



---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org