You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Chris Chiappone <ch...@gmail.com> on 2006/01/10 23:31:58 UTC

Tacos AjaxDirectLink

Hi I am trying to get the use the tacos AjaxDirectLink component.  I
pretty much using the example given on the website except substituting
the .page specs in annotations.
Here is the following exception I am getting:

org.apache.tapestry.BindingException
Error converting value for parameter updateComponents: No type
converter for type java.util.Collection is available.
binding:ExpressionBinding[InvestigationsConsole 'selectedCases', currCase.id]
component:$InvestigationsConsole_20@1f64d29[InvestigationsConsole]
location:

Annotation @org.apache.tapestry.annotations.Component(inheritInformalParameters=false,
bindings=[listener=listener:toggleCase, parameters=ognl:currCase.id,
updateComponents=ognl:'selectedCases', currCase.id,
effects=template:{highlight:{selectedCases:'[255,255,184], 500,
500','${currCase}':'[255,255,184], 500, 500'}},
statusElement=literal:status], id=linkToggle,
type=tacos:AjaxDirectLink) of public abstract
net.sf.tacos.ajax.components.AjaxDirectLink
view.pages.InvestigationsConsole.getLinkToggle()

Here is my code for my page:

public abstract class InvestigationsConsole extends SecuredPage implements
		PageBeginRenderListener {

	public void pageBeginRender(PageEvent arg0) {
		ICaseHome caseHome = getCaseHome();

		Collection<TrCase> cases = caseHome
				.findCasesBySupportId(getVisitObject().getPortaluser()
						.getSupportid());
		
		if (cases.size() > 0) {
			setOpenCases(true);
		} else {
			setOpenCases(false);
		}
	}
	
	protected void finishLoad(){
		log.info("Setting selected Items");
		setSelectedItems(new HashSet());
	}

	public void toggleCase(IRequestCycle irc) {
		long caseid = (Long) irc.getListenerParameters()[0];
		TrCase trCase = getCaseHome().findCaseById(caseid);
		Set c = getSelectedItems();
		if (c.contains(trCase)) {
			c.remove(trCase);
		} else {
			c.add(trCase);
		}
		setSelectedItems(c);
		AjaxWebRequest ajax = (AjaxWebRequest) irc
				.getAttribute(AjaxWebRequest.AJAX_REQUEST);
		if (ajax != null)
			ajax.addStatusResponse("Case selected..");

	}
	
	public List getCases(){
		return new ArrayList(getCaseHome()
		.findCasesBySupportId(getVisitObject().getPortaluser()
				.getSupportid()));
	}
	
	
	//public abstract Collection<TrCase> getCases();
	//public abstract void setCases(Collection<TrCase> cases);
	@Persist
	public abstract Set getSelectedItems();
	public abstract void setSelectedItems(Set selectedItems);
	

	public void openCaseListener(IRequestCycle cycle) {
		cycle.activate(getOpenCasePage());
	}

	public abstract boolean isOpenCases();
	public abstract void setOpenCases(boolean openCases);
	public boolean isCurrSelected() {
		return getSelectedItems().contains(getCurrCase());
	}
	public abstract TrCase getCurrCase();
	public abstract void setSelectItem(Object selectItem);
	public abstract Object getSelectItem();

	// Annotations
	@InjectState("visit")
	public abstract Visit getVisitObject();

	@InjectPage("OpenCase")
	public abstract IPage getOpenCasePage();

	@InjectObject("service:trustedresponse.CaseHome")
	public abstract ICaseHome getCaseHome();
	
	@InjectObject("service:tacos.AjaxWebRequest")
	public abstract AjaxWebRequest getAjaxRequest();
	
	@Component(id="foreachCase", type="tacos:PartialFor", bindings = {
		"source=cases", "value=currCase"})
	public abstract PartialForBean getForeachCase();
		
	@Component(id="linkToggle", type="tacos:AjaxDirectLink",
			bindings = {"listener=listener:toggleCase",
			"parameters=ognl:currCase.id",
			"updateComponents=ognl:'selectedCases', currCase.id",
			"effects=template:{highlight:{selectedCases:'[255,255,184], 500,
500','${currCase}':'[255,255,184], 500, 500'}}",
			"statusElement=literal:status"})
	public abstract AjaxDirectLink getLinkToggle();


--
~chris

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


Re: Tacos AjaxDirectLink

Posted by Jesse Kuhnert <jk...@gmail.com>.
Ohhhh./...Took me a while to get it, try using the keyProvider parameter to
PartialFor.

On 1/11/06, Chris Chiappone <ch...@gmail.com> wrote:
>
> Still Confused.  I know that my selectedItems collection contains my
> object, yet the currSelected never returns true.  Actually it seems to
> only get called once when the page loads.  Shouldn't isCurrSelected()
> get executed everytime linkToggle listener gets called?
> I'll include my code again with some mods since last time:
>
>         public void toggleCase(IRequestCycle irc) {
>                 String caseid = (String) irc.getListenerParameters()[0];
>                 TrCase trCase = getCaseHome().findCaseById(Long.parseLong
> (caseid));
>                 Collection<TrCase> c = getSelectedItems();
>
>                 boolean contains = containsItem(c, trCase.getIdAsString
> ());
>
>                 if (contains) {
>                         log.info("Selected Item contains Case #"+
> trCase.getId());
>                         c.remove(trCase.getIdAsString());
>                 } else {
>                         log.info("Selected Item doesn't contain Case #"+
> trCase.getId());
>                         c.add(trCase);
>                 }
>                 setSelectedItems(c);
>                 AjaxWebRequest ajax = (AjaxWebRequest) irc
>                                 .getAttribute(AjaxWebRequest.AJAX_REQUEST
> );
>                 if (ajax != null)
>                         ajax.addStatusResponse("Case selected..");
>
>         }
>
>         public Collection<TrCase> getCases(){
>                 log.info("Getting cases from DB...");
>                 List cases = new ArrayList<TrCase>(getCaseHome()
>                 .findCasesBySupportId(getVisitObject().getPortaluser()
>                                 .getSupportid()));
>                 return cases;
>         }
>
>         private boolean containsItem(Collection<TrCase> c, String item){
>                 Iterator<TrCase> it = c.iterator();
>                 boolean contains = false;
>                 while(it.hasNext()){
>                         TrCase test = it.next();
>
>                         if(item.equals(test.getIdAsString())){
>                                 contains = true;
>                                 continue;
>                         }
>                 }
>                 return contains;
>         }
>
>         //public abstract Collection<TrCase> getCases();
>         //public abstract void setCases(Collection<TrCase> cases);
>         @Persist
>         public abstract Collection<TrCase> getSelectedItems();
>         public abstract void setSelectedItems(Collection<TrCase>
> selectedItems);
>
>
>         public void openCaseListener(IRequestCycle cycle) {
>                 cycle.activate(getOpenCasePage());
>         }
>
>         public abstract boolean isOpenCases();
>         public abstract void setOpenCases(boolean openCases);
>
>         public boolean isCurrSelected() {
>                 boolean contains = containsItem(getSelectedItems(),
> getCurrCase().getIdAsString());
>                 log.info("Current Selected returns "+ contains);
>                 return contains;
>         }
>
> Annotations in the same class:
>         @Component(id="foreachCase", type="tacos:PartialFor", bindings = {
>                 "source=cases", "value=currCase",
>                 "evenOdd=ognl:page.beans.evenOdd"})
>         public abstract PartialForBean getForeachCase();
>
>         @Component(id="linkToggle", type="tacos:AjaxDirectLink",
>                         bindings = {"listener=listener:toggleCase",
>                         "parameters=ognl:currCase.idAsString",
>                         "updateComponents=ognl:{'selectedCases',
> currCase.idAsString}",
>                         "effects=template:{highlight:{selectedCases:'[255,255,184],
> 500,
> 500','${currCase}':'[255,255,184], 500, 500'}}",
>                         "statusElement=literal:status"})
>         public abstract AjaxDirectLink getLinkToggle();
>
> And the html:
>
>                 <div jwcid="selectedCases@Any" id="selectedCases"><span
>                                                                 jwcid="@If"
> condition="ognl:not selectedItems.empty">
>                                                         <h3>Selected
> Cases</h3>
>                                                         <ul>
>                                                                 <li
> jwcid="@tacos:PartialFor" source="ognl:selectedItems"
>                                                                         value="ognl:selectItem"
> element="li"><span jwcid="@Insert"
>
>                                                                         value="ognl:
> selectItem.id" /></li>
>                                                         </ul>
>                                                         </span></div>
>                                                         <div
> id="status"></div>
>                                                         <div
> id="cases"><span jwcid="foreachCase">
>                                                         <div jwcid="@Any"
> class="ognl:beans.evenOdd.next"
>                                                                 id="ognl:
> currCase.id">
>
>                                                         <div><a
> jwcid="linkToggle" class="toggle"> <span jwcid="@Insert"
>                                                                 value="ognl:currSelected
> ? 'Hide' : 'Details'" /></a> <span
>                                                                 jwcid="@Insert"
> value="ognl:currCase.id"
>                                                                 class="ognl:currSelected
> ? 'detailHeading' : 'heading'" /></div>
>
>                                                         <span jwcid="@If"
> condition="ognl:currSelected">
>                                                         <div
> class="caseDetail">
>                                                         <div
> class="acase"><!-- <img jwcid="flagImage" width="34"
> height="18" />--><br />
>                                                         <span
> jwcid="@Insert" value="ognl:currCase.id" /></div>
>
>
> On 1/11/06, Jesse Kuhnert <jk...@gmail.com> wrote:
> > You shuold be able to,but are now getting into an area that is anyone's
> > guess. If you can provide me a web address to hit your page in, or a
> very
> > very easy to deploy web-app I can look further into it and make
> appropriate
> > documentation and/or library changes based on what you're running into..
> >
> > On 1/11/06, Edgar Chan Carrillo <ed...@gmail.com> wrote:
> > >
> > > Thanks for the response Jesse.
> > > Yes.I think it is.
> > > My page starts with a search option and an empty list...I do a search
> and
> > > render the result using PartialFor (a list of divs with ids
> corresponding
> > > of
> > > the ids of the objects'result query).
> > > Each generated div include an AjaxDirectLink to show aditional info
> for
> > > the
> > > element.
> > >
> > > The firefox dom inspector correctly shows the generated divs and ids,
> no
> > > matter how many times i perform the search. I think that means the dom
> > > objects already exists in the page by that time.
> > > Can i do this?
> > >
> > >
> >
> >
>
>
> --
> ~chris
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>

Re: Tacos AjaxDirectLink

Posted by Jesse Kuhnert <jk...@gmail.com>.
The PartialFor ~only~ renders nodes with an id matching the incoming request
id, if for whatever reason doing a toString() on the object binding for the
current value doesn't exactly match then it won't find your node, without a
key id at least.

Maybe this could be improved somehow.

On 1/11/06, Chris Chiappone <ch...@gmail.com> wrote:
>
> Jesse -
> Thanks a lot for all your help, that did the trick.  Although I wish I
> knew why that made the difference.  I guess I don't understand how the
> PartialFor varied from the regular For.
>
> Thanks again,
> ~chris
>
> On 1/11/06, Jesse Kuhnert <jk...@gmail.com> wrote:
> > I'm fairly certain now that the keyProvider will solve your delimna,
> either
> > that or use a normal For component and not PartialFor.
> >
> > On 1/11/06, Chris Chiappone <ch...@gmail.com> wrote:
> > >
> > > Update... It seems if I refresh the page then the selected items show
> > >
> > > On 1/11/06, Chris Chiappone <ch...@gmail.com> wrote:
> > > > Still Confused.  I know that my selectedItems collection contains my
> > > > object, yet the currSelected never returns true.  Actually it seems
> to
> > > > only get called once when the page loads.  Shouldn't
> isCurrSelected()
> > > > get executed everytime linkToggle listener gets called?
> > > > I'll include my code again with some mods since last time:
> > > >
> > > >        public void toggleCase(IRequestCycle irc) {
> > > >                String caseid = (String) irc.getListenerParameters
> ()[0];
> > > >                TrCase trCase = getCaseHome().findCaseById(
> Long.parseLong
> > > (caseid));
> > > >                Collection<TrCase> c = getSelectedItems();
> > > >
> > > >                boolean contains = containsItem(c,
> trCase.getIdAsString
> > > ());
> > > >
> > > >                if (contains) {
> > > >                        log.info("Selected Item contains Case #"+
> > > trCase.getId());
> > > >                        c.remove(trCase.getIdAsString());
> > > >                } else {
> > > >                        log.info("Selected Item doesn't contain Case
> #"+
> > > trCase.getId());
> > > >                        c.add(trCase);
> > > >                }
> > > >                setSelectedItems(c);
> > > >                AjaxWebRequest ajax = (AjaxWebRequest) irc
> > > >                                .getAttribute(
> AjaxWebRequest.AJAX_REQUEST
> > > );
> > > >                if (ajax != null)
> > > >                        ajax.addStatusResponse("Case selected..");
> > > >
> > > >        }
> > > >
> > > >        public Collection<TrCase> getCases(){
> > > >                log.info("Getting cases from DB...");
> > > >                List cases = new ArrayList<TrCase>(getCaseHome()
> > >
> >                .findCasesBySupportId(getVisitObject().getPortaluser()
> > > >                                .getSupportid()));
> > > >                return cases;
> > > >        }
> > > >
> > > >        private boolean containsItem(Collection<TrCase> c, String
> item){
> > > >                Iterator<TrCase> it = c.iterator();
> > > >                boolean contains = false;
> > > >                while(it.hasNext()){
> > > >                        TrCase test = it.next();
> > > >
> > > >                        if(item.equals(test.getIdAsString())){
> > > >                                contains = true;
> > > >                                continue;
> > > >                        }
> > > >                }
> > > >                return contains;
> > > >        }
> > > >
> > > >        //public abstract Collection<TrCase> getCases();
> > > >        //public abstract void setCases(Collection<TrCase> cases);
> > > >        @Persist
> > > >        public abstract Collection<TrCase> getSelectedItems();
> > > >        public abstract void setSelectedItems(Collection<TrCase>
> > > selectedItems);
> > > >
> > > >
> > > >        public void openCaseListener(IRequestCycle cycle) {
> > > >                cycle.activate(getOpenCasePage());
> > > >        }
> > > >
> > > >        public abstract boolean isOpenCases();
> > > >        public abstract void setOpenCases(boolean openCases);
> > > >
> > > >        public boolean isCurrSelected() {
> > > >                boolean contains = containsItem(getSelectedItems(),
> > > > getCurrCase().getIdAsString());
> > > >                log.info("Current Selected returns "+ contains);
> > > >                return contains;
> > > >        }
> > > >
> > > > Annotations in the same class:
> > > >        @Component(id="foreachCase", type="tacos:PartialFor",
> bindings =
> > > {
> > > >                "source=cases", "value=currCase",
> > > >                "evenOdd=ognl:page.beans.evenOdd"})
> > > >        public abstract PartialForBean getForeachCase();
> > > >
> > > >        @Component(id="linkToggle", type="tacos:AjaxDirectLink",
> > > >                        bindings = {"listener=listener:toggleCase",
> > > >                        "parameters=ognl:currCase.idAsString",
> > > >                        "updateComponents=ognl:{'selectedCases',
> > > currCase.idAsString}",
> > >
> >                        "effects=template:{highlight:{selectedCases:'[255,255,184],
> > > 500,
> > > > 500','${currCase}':'[255,255,184], 500, 500'}}",
> > > >                        "statusElement=literal:status"})
> > > >        public abstract AjaxDirectLink getLinkToggle();
> > > >
> > > > And the html:
> > > >
> > > >                <div jwcid="selectedCases@Any"
> id="selectedCases"><span
> > >
> >                                                                jwcid="@If"
> > > condition="ognl:not selectedItems.empty">
> > > >                                                        <h3>Selected
> > > Cases</h3>
> > > >                                                        <ul>
> > > >                                                                <li
> > > jwcid="@tacos:PartialFor" source="ognl:selectedItems"
> > >
> >                                                                        value="ognl:selectItem"
> > > element="li"><span jwcid="@Insert"
> > >
> > >
> >                                                                        value="ognl:
> > > selectItem.id" /></li>
> > > >                                                        </ul>
> > > >                                                        </span></div>
> > > >                                                        <div
> > > id="status"></div>
> > > >                                                        <div
> > > id="cases"><span jwcid="foreachCase">
> > > >                                                        <div
> jwcid="@Any"
> > > class="ognl:beans.evenOdd.next"
> > >
> >                                                                id="ognl:
> > > currCase.id">
> > > >
> > > >                                                        <div><a
> > > jwcid="linkToggle" class="toggle"> <span jwcid="@Insert"
> > >
> >                                                                value="ognl:currSelected
> > > ? 'Hide' : 'Details'" /></a> <span
> > >
> >                                                                jwcid="@Insert"
> > > value="ognl:currCase.id"
> > >
> >                                                                class="ognl:currSelected
> > > ? 'detailHeading' : 'heading'" /></div>
> > > >
> > > >                                                        <span
> jwcid="@If"
> > > condition="ognl:currSelected">
> > > >                                                        <div
> > > class="caseDetail">
> > > >                                                        <div
> > > class="acase"><!-- <img jwcid="flagImage" width="34"
> > > > height="18" />--><br />
> > > >                                                        <span
> > > jwcid="@Insert" value="ognl:currCase.id" /></div>
> > > >
> > > >
> > > > On 1/11/06, Jesse Kuhnert <jk...@gmail.com> wrote:
> > > > > You shuold be able to,but are now getting into an area that is
> > > anyone's
> > > > > guess. If you can provide me a web address to hit your page in, or
> a
> > > very
> > > > > very easy to deploy web-app I can look further into it and make
> > > appropriate
> > > > > documentation and/or library changes based on what you're running
> > > into..
> > > > >
> > > > > On 1/11/06, Edgar Chan Carrillo <ed...@gmail.com>
> wrote:
> > > > > >
> > > > > > Thanks for the response Jesse.
> > > > > > Yes.I think it is.
> > > > > > My page starts with a search option and an empty list...I do a
> > > search and
> > > > > > render the result using PartialFor (a list of divs with ids
> > > corresponding
> > > > > > of
> > > > > > the ids of the objects'result query).
> > > > > > Each generated div include an AjaxDirectLink to show aditional
> info
> > > for
> > > > > > the
> > > > > > element.
> > > > > >
> > > > > > The firefox dom inspector correctly shows the generated divs and
> > > ids, no
> > > > > > matter how many times i perform the search. I think that means
> the
> > > dom
> > > > > > objects already exists in the page by that time.
> > > > > > Can i do this?
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > > > --
> > > > ~chris
> > > >
> > >
> > >
> > > --
> > > ~chris
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> > >
> > >
> >
> >
>
>
> --
> ~chris
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>

Re: Tacos AjaxDirectLink

Posted by Chris Chiappone <ch...@gmail.com>.
Jesse -
Thanks a lot for all your help, that did the trick.  Although I wish I
knew why that made the difference.  I guess I don't understand how the
PartialFor varied from the regular For.

Thanks again,
~chris

On 1/11/06, Jesse Kuhnert <jk...@gmail.com> wrote:
> I'm fairly certain now that the keyProvider will solve your delimna, either
> that or use a normal For component and not PartialFor.
>
> On 1/11/06, Chris Chiappone <ch...@gmail.com> wrote:
> >
> > Update... It seems if I refresh the page then the selected items show
> >
> > On 1/11/06, Chris Chiappone <ch...@gmail.com> wrote:
> > > Still Confused.  I know that my selectedItems collection contains my
> > > object, yet the currSelected never returns true.  Actually it seems to
> > > only get called once when the page loads.  Shouldn't isCurrSelected()
> > > get executed everytime linkToggle listener gets called?
> > > I'll include my code again with some mods since last time:
> > >
> > >        public void toggleCase(IRequestCycle irc) {
> > >                String caseid = (String) irc.getListenerParameters()[0];
> > >                TrCase trCase = getCaseHome().findCaseById(Long.parseLong
> > (caseid));
> > >                Collection<TrCase> c = getSelectedItems();
> > >
> > >                boolean contains = containsItem(c, trCase.getIdAsString
> > ());
> > >
> > >                if (contains) {
> > >                        log.info("Selected Item contains Case #"+
> > trCase.getId());
> > >                        c.remove(trCase.getIdAsString());
> > >                } else {
> > >                        log.info("Selected Item doesn't contain Case #"+
> > trCase.getId());
> > >                        c.add(trCase);
> > >                }
> > >                setSelectedItems(c);
> > >                AjaxWebRequest ajax = (AjaxWebRequest) irc
> > >                                .getAttribute(AjaxWebRequest.AJAX_REQUEST
> > );
> > >                if (ajax != null)
> > >                        ajax.addStatusResponse("Case selected..");
> > >
> > >        }
> > >
> > >        public Collection<TrCase> getCases(){
> > >                log.info("Getting cases from DB...");
> > >                List cases = new ArrayList<TrCase>(getCaseHome()
> > >                .findCasesBySupportId(getVisitObject().getPortaluser()
> > >                                .getSupportid()));
> > >                return cases;
> > >        }
> > >
> > >        private boolean containsItem(Collection<TrCase> c, String item){
> > >                Iterator<TrCase> it = c.iterator();
> > >                boolean contains = false;
> > >                while(it.hasNext()){
> > >                        TrCase test = it.next();
> > >
> > >                        if(item.equals(test.getIdAsString())){
> > >                                contains = true;
> > >                                continue;
> > >                        }
> > >                }
> > >                return contains;
> > >        }
> > >
> > >        //public abstract Collection<TrCase> getCases();
> > >        //public abstract void setCases(Collection<TrCase> cases);
> > >        @Persist
> > >        public abstract Collection<TrCase> getSelectedItems();
> > >        public abstract void setSelectedItems(Collection<TrCase>
> > selectedItems);
> > >
> > >
> > >        public void openCaseListener(IRequestCycle cycle) {
> > >                cycle.activate(getOpenCasePage());
> > >        }
> > >
> > >        public abstract boolean isOpenCases();
> > >        public abstract void setOpenCases(boolean openCases);
> > >
> > >        public boolean isCurrSelected() {
> > >                boolean contains = containsItem(getSelectedItems(),
> > > getCurrCase().getIdAsString());
> > >                log.info("Current Selected returns "+ contains);
> > >                return contains;
> > >        }
> > >
> > > Annotations in the same class:
> > >        @Component(id="foreachCase", type="tacos:PartialFor", bindings =
> > {
> > >                "source=cases", "value=currCase",
> > >                "evenOdd=ognl:page.beans.evenOdd"})
> > >        public abstract PartialForBean getForeachCase();
> > >
> > >        @Component(id="linkToggle", type="tacos:AjaxDirectLink",
> > >                        bindings = {"listener=listener:toggleCase",
> > >                        "parameters=ognl:currCase.idAsString",
> > >                        "updateComponents=ognl:{'selectedCases',
> > currCase.idAsString}",
> > >                        "effects=template:{highlight:{selectedCases:'[255,255,184],
> > 500,
> > > 500','${currCase}':'[255,255,184], 500, 500'}}",
> > >                        "statusElement=literal:status"})
> > >        public abstract AjaxDirectLink getLinkToggle();
> > >
> > > And the html:
> > >
> > >                <div jwcid="selectedCases@Any" id="selectedCases"><span
> > >                                                                jwcid="@If"
> > condition="ognl:not selectedItems.empty">
> > >                                                        <h3>Selected
> > Cases</h3>
> > >                                                        <ul>
> > >                                                                <li
> > jwcid="@tacos:PartialFor" source="ognl:selectedItems"
> > >                                                                        value="ognl:selectItem"
> > element="li"><span jwcid="@Insert"
> >
> > >                                                                        value="ognl:
> > selectItem.id" /></li>
> > >                                                        </ul>
> > >                                                        </span></div>
> > >                                                        <div
> > id="status"></div>
> > >                                                        <div
> > id="cases"><span jwcid="foreachCase">
> > >                                                        <div jwcid="@Any"
> > class="ognl:beans.evenOdd.next"
> > >                                                                id="ognl:
> > currCase.id">
> > >
> > >                                                        <div><a
> > jwcid="linkToggle" class="toggle"> <span jwcid="@Insert"
> > >                                                                value="ognl:currSelected
> > ? 'Hide' : 'Details'" /></a> <span
> > >                                                                jwcid="@Insert"
> > value="ognl:currCase.id"
> > >                                                                class="ognl:currSelected
> > ? 'detailHeading' : 'heading'" /></div>
> > >
> > >                                                        <span jwcid="@If"
> > condition="ognl:currSelected">
> > >                                                        <div
> > class="caseDetail">
> > >                                                        <div
> > class="acase"><!-- <img jwcid="flagImage" width="34"
> > > height="18" />--><br />
> > >                                                        <span
> > jwcid="@Insert" value="ognl:currCase.id" /></div>
> > >
> > >
> > > On 1/11/06, Jesse Kuhnert <jk...@gmail.com> wrote:
> > > > You shuold be able to,but are now getting into an area that is
> > anyone's
> > > > guess. If you can provide me a web address to hit your page in, or a
> > very
> > > > very easy to deploy web-app I can look further into it and make
> > appropriate
> > > > documentation and/or library changes based on what you're running
> > into..
> > > >
> > > > On 1/11/06, Edgar Chan Carrillo <ed...@gmail.com> wrote:
> > > > >
> > > > > Thanks for the response Jesse.
> > > > > Yes.I think it is.
> > > > > My page starts with a search option and an empty list...I do a
> > search and
> > > > > render the result using PartialFor (a list of divs with ids
> > corresponding
> > > > > of
> > > > > the ids of the objects'result query).
> > > > > Each generated div include an AjaxDirectLink to show aditional info
> > for
> > > > > the
> > > > > element.
> > > > >
> > > > > The firefox dom inspector correctly shows the generated divs and
> > ids, no
> > > > > matter how many times i perform the search. I think that means the
> > dom
> > > > > objects already exists in the page by that time.
> > > > > Can i do this?
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> > > --
> > > ~chris
> > >
> >
> >
> > --
> > ~chris
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> >
> >
>
>


--
~chris

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


Re: Tacos AjaxDirectLink

Posted by Jesse Kuhnert <jk...@gmail.com>.
I'm fairly certain now that the keyProvider will solve your delimna, either
that or use a normal For component and not PartialFor.

On 1/11/06, Chris Chiappone <ch...@gmail.com> wrote:
>
> Update... It seems if I refresh the page then the selected items show
>
> On 1/11/06, Chris Chiappone <ch...@gmail.com> wrote:
> > Still Confused.  I know that my selectedItems collection contains my
> > object, yet the currSelected never returns true.  Actually it seems to
> > only get called once when the page loads.  Shouldn't isCurrSelected()
> > get executed everytime linkToggle listener gets called?
> > I'll include my code again with some mods since last time:
> >
> >        public void toggleCase(IRequestCycle irc) {
> >                String caseid = (String) irc.getListenerParameters()[0];
> >                TrCase trCase = getCaseHome().findCaseById(Long.parseLong
> (caseid));
> >                Collection<TrCase> c = getSelectedItems();
> >
> >                boolean contains = containsItem(c, trCase.getIdAsString
> ());
> >
> >                if (contains) {
> >                        log.info("Selected Item contains Case #"+
> trCase.getId());
> >                        c.remove(trCase.getIdAsString());
> >                } else {
> >                        log.info("Selected Item doesn't contain Case #"+
> trCase.getId());
> >                        c.add(trCase);
> >                }
> >                setSelectedItems(c);
> >                AjaxWebRequest ajax = (AjaxWebRequest) irc
> >                                .getAttribute(AjaxWebRequest.AJAX_REQUEST
> );
> >                if (ajax != null)
> >                        ajax.addStatusResponse("Case selected..");
> >
> >        }
> >
> >        public Collection<TrCase> getCases(){
> >                log.info("Getting cases from DB...");
> >                List cases = new ArrayList<TrCase>(getCaseHome()
> >                .findCasesBySupportId(getVisitObject().getPortaluser()
> >                                .getSupportid()));
> >                return cases;
> >        }
> >
> >        private boolean containsItem(Collection<TrCase> c, String item){
> >                Iterator<TrCase> it = c.iterator();
> >                boolean contains = false;
> >                while(it.hasNext()){
> >                        TrCase test = it.next();
> >
> >                        if(item.equals(test.getIdAsString())){
> >                                contains = true;
> >                                continue;
> >                        }
> >                }
> >                return contains;
> >        }
> >
> >        //public abstract Collection<TrCase> getCases();
> >        //public abstract void setCases(Collection<TrCase> cases);
> >        @Persist
> >        public abstract Collection<TrCase> getSelectedItems();
> >        public abstract void setSelectedItems(Collection<TrCase>
> selectedItems);
> >
> >
> >        public void openCaseListener(IRequestCycle cycle) {
> >                cycle.activate(getOpenCasePage());
> >        }
> >
> >        public abstract boolean isOpenCases();
> >        public abstract void setOpenCases(boolean openCases);
> >
> >        public boolean isCurrSelected() {
> >                boolean contains = containsItem(getSelectedItems(),
> > getCurrCase().getIdAsString());
> >                log.info("Current Selected returns "+ contains);
> >                return contains;
> >        }
> >
> > Annotations in the same class:
> >        @Component(id="foreachCase", type="tacos:PartialFor", bindings =
> {
> >                "source=cases", "value=currCase",
> >                "evenOdd=ognl:page.beans.evenOdd"})
> >        public abstract PartialForBean getForeachCase();
> >
> >        @Component(id="linkToggle", type="tacos:AjaxDirectLink",
> >                        bindings = {"listener=listener:toggleCase",
> >                        "parameters=ognl:currCase.idAsString",
> >                        "updateComponents=ognl:{'selectedCases',
> currCase.idAsString}",
> >                        "effects=template:{highlight:{selectedCases:'[255,255,184],
> 500,
> > 500','${currCase}':'[255,255,184], 500, 500'}}",
> >                        "statusElement=literal:status"})
> >        public abstract AjaxDirectLink getLinkToggle();
> >
> > And the html:
> >
> >                <div jwcid="selectedCases@Any" id="selectedCases"><span
> >                                                                jwcid="@If"
> condition="ognl:not selectedItems.empty">
> >                                                        <h3>Selected
> Cases</h3>
> >                                                        <ul>
> >                                                                <li
> jwcid="@tacos:PartialFor" source="ognl:selectedItems"
> >                                                                        value="ognl:selectItem"
> element="li"><span jwcid="@Insert"
>
> >                                                                        value="ognl:
> selectItem.id" /></li>
> >                                                        </ul>
> >                                                        </span></div>
> >                                                        <div
> id="status"></div>
> >                                                        <div
> id="cases"><span jwcid="foreachCase">
> >                                                        <div jwcid="@Any"
> class="ognl:beans.evenOdd.next"
> >                                                                id="ognl:
> currCase.id">
> >
> >                                                        <div><a
> jwcid="linkToggle" class="toggle"> <span jwcid="@Insert"
> >                                                                value="ognl:currSelected
> ? 'Hide' : 'Details'" /></a> <span
> >                                                                jwcid="@Insert"
> value="ognl:currCase.id"
> >                                                                class="ognl:currSelected
> ? 'detailHeading' : 'heading'" /></div>
> >
> >                                                        <span jwcid="@If"
> condition="ognl:currSelected">
> >                                                        <div
> class="caseDetail">
> >                                                        <div
> class="acase"><!-- <img jwcid="flagImage" width="34"
> > height="18" />--><br />
> >                                                        <span
> jwcid="@Insert" value="ognl:currCase.id" /></div>
> >
> >
> > On 1/11/06, Jesse Kuhnert <jk...@gmail.com> wrote:
> > > You shuold be able to,but are now getting into an area that is
> anyone's
> > > guess. If you can provide me a web address to hit your page in, or a
> very
> > > very easy to deploy web-app I can look further into it and make
> appropriate
> > > documentation and/or library changes based on what you're running
> into..
> > >
> > > On 1/11/06, Edgar Chan Carrillo <ed...@gmail.com> wrote:
> > > >
> > > > Thanks for the response Jesse.
> > > > Yes.I think it is.
> > > > My page starts with a search option and an empty list...I do a
> search and
> > > > render the result using PartialFor (a list of divs with ids
> corresponding
> > > > of
> > > > the ids of the objects'result query).
> > > > Each generated div include an AjaxDirectLink to show aditional info
> for
> > > > the
> > > > element.
> > > >
> > > > The firefox dom inspector correctly shows the generated divs and
> ids, no
> > > > matter how many times i perform the search. I think that means the
> dom
> > > > objects already exists in the page by that time.
> > > > Can i do this?
> > > >
> > > >
> > >
> > >
> >
> >
> > --
> > ~chris
> >
>
>
> --
> ~chris
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>

Re: Tacos AjaxDirectLink

Posted by Chris Chiappone <ch...@gmail.com>.
Update... It seems if I refresh the page then the selected items show

On 1/11/06, Chris Chiappone <ch...@gmail.com> wrote:
> Still Confused.  I know that my selectedItems collection contains my
> object, yet the currSelected never returns true.  Actually it seems to
> only get called once when the page loads.  Shouldn't isCurrSelected()
> get executed everytime linkToggle listener gets called?
> I'll include my code again with some mods since last time:
>
>        public void toggleCase(IRequestCycle irc) {
>                String caseid = (String) irc.getListenerParameters()[0];
>                TrCase trCase = getCaseHome().findCaseById(Long.parseLong(caseid));
>                Collection<TrCase> c = getSelectedItems();
>
>                boolean contains = containsItem(c, trCase.getIdAsString());
>
>                if (contains) {
>                        log.info("Selected Item contains Case #"+ trCase.getId());
>                        c.remove(trCase.getIdAsString());
>                } else {
>                        log.info("Selected Item doesn't contain Case #"+ trCase.getId());
>                        c.add(trCase);
>                }
>                setSelectedItems(c);
>                AjaxWebRequest ajax = (AjaxWebRequest) irc
>                                .getAttribute(AjaxWebRequest.AJAX_REQUEST);
>                if (ajax != null)
>                        ajax.addStatusResponse("Case selected..");
>
>        }
>
>        public Collection<TrCase> getCases(){
>                log.info("Getting cases from DB...");
>                List cases = new ArrayList<TrCase>(getCaseHome()
>                .findCasesBySupportId(getVisitObject().getPortaluser()
>                                .getSupportid()));
>                return cases;
>        }
>
>        private boolean containsItem(Collection<TrCase> c, String item){
>                Iterator<TrCase> it = c.iterator();
>                boolean contains = false;
>                while(it.hasNext()){
>                        TrCase test = it.next();
>
>                        if(item.equals(test.getIdAsString())){
>                                contains = true;
>                                continue;
>                        }
>                }
>                return contains;
>        }
>
>        //public abstract Collection<TrCase> getCases();
>        //public abstract void setCases(Collection<TrCase> cases);
>        @Persist
>        public abstract Collection<TrCase> getSelectedItems();
>        public abstract void setSelectedItems(Collection<TrCase> selectedItems);
>
>
>        public void openCaseListener(IRequestCycle cycle) {
>                cycle.activate(getOpenCasePage());
>        }
>
>        public abstract boolean isOpenCases();
>        public abstract void setOpenCases(boolean openCases);
>
>        public boolean isCurrSelected() {
>                boolean contains = containsItem(getSelectedItems(),
> getCurrCase().getIdAsString());
>                log.info("Current Selected returns "+ contains);
>                return contains;
>        }
>
> Annotations in the same class:
>        @Component(id="foreachCase", type="tacos:PartialFor", bindings = {
>                "source=cases", "value=currCase",
>                "evenOdd=ognl:page.beans.evenOdd"})
>        public abstract PartialForBean getForeachCase();
>
>        @Component(id="linkToggle", type="tacos:AjaxDirectLink",
>                        bindings = {"listener=listener:toggleCase",
>                        "parameters=ognl:currCase.idAsString",
>                        "updateComponents=ognl:{'selectedCases', currCase.idAsString}",
>                        "effects=template:{highlight:{selectedCases:'[255,255,184], 500,
> 500','${currCase}':'[255,255,184], 500, 500'}}",
>                        "statusElement=literal:status"})
>        public abstract AjaxDirectLink getLinkToggle();
>
> And the html:
>
>                <div jwcid="selectedCases@Any" id="selectedCases"><span
>                                                                jwcid="@If" condition="ognl:not selectedItems.empty">
>                                                        <h3>Selected Cases</h3>
>                                                        <ul>
>                                                                <li jwcid="@tacos:PartialFor" source="ognl:selectedItems"
>                                                                        value="ognl:selectItem" element="li"><span jwcid="@Insert"
>                                                                        value="ognl:selectItem.id" /></li>
>                                                        </ul>
>                                                        </span></div>
>                                                        <div id="status"></div>
>                                                        <div id="cases"><span jwcid="foreachCase">
>                                                        <div jwcid="@Any" class="ognl:beans.evenOdd.next"
>                                                                id="ognl:currCase.id">
>
>                                                        <div><a jwcid="linkToggle" class="toggle"> <span jwcid="@Insert"
>                                                                value="ognl:currSelected ? 'Hide' : 'Details'" /></a> <span
>                                                                jwcid="@Insert" value="ognl:currCase.id"
>                                                                class="ognl:currSelected ? 'detailHeading' : 'heading'" /></div>
>
>                                                        <span jwcid="@If" condition="ognl:currSelected">
>                                                        <div class="caseDetail">
>                                                        <div class="acase"><!-- <img jwcid="flagImage" width="34"
> height="18" />--><br />
>                                                        <span jwcid="@Insert" value="ognl:currCase.id" /></div>
>
>
> On 1/11/06, Jesse Kuhnert <jk...@gmail.com> wrote:
> > You shuold be able to,but are now getting into an area that is anyone's
> > guess. If you can provide me a web address to hit your page in, or a very
> > very easy to deploy web-app I can look further into it and make appropriate
> > documentation and/or library changes based on what you're running into..
> >
> > On 1/11/06, Edgar Chan Carrillo <ed...@gmail.com> wrote:
> > >
> > > Thanks for the response Jesse.
> > > Yes.I think it is.
> > > My page starts with a search option and an empty list...I do a search and
> > > render the result using PartialFor (a list of divs with ids corresponding
> > > of
> > > the ids of the objects'result query).
> > > Each generated div include an AjaxDirectLink to show aditional info for
> > > the
> > > element.
> > >
> > > The firefox dom inspector correctly shows the generated divs and ids, no
> > > matter how many times i perform the search. I think that means the dom
> > > objects already exists in the page by that time.
> > > Can i do this?
> > >
> > >
> >
> >
>
>
> --
> ~chris
>


--
~chris

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


Re: Tacos AjaxDirectLink

Posted by Chris Chiappone <ch...@gmail.com>.
Still Confused.  I know that my selectedItems collection contains my
object, yet the currSelected never returns true.  Actually it seems to
only get called once when the page loads.  Shouldn't isCurrSelected()
get executed everytime linkToggle listener gets called?
I'll include my code again with some mods since last time:

	public void toggleCase(IRequestCycle irc) {
		String caseid = (String) irc.getListenerParameters()[0];
		TrCase trCase = getCaseHome().findCaseById(Long.parseLong(caseid));
		Collection<TrCase> c = getSelectedItems();
		
		boolean contains = containsItem(c, trCase.getIdAsString());
		
		if (contains) {
			log.info("Selected Item contains Case #"+ trCase.getId());
			c.remove(trCase.getIdAsString());
		} else {
			log.info("Selected Item doesn't contain Case #"+ trCase.getId());
			c.add(trCase);
		}
		setSelectedItems(c);
		AjaxWebRequest ajax = (AjaxWebRequest) irc
				.getAttribute(AjaxWebRequest.AJAX_REQUEST);
		if (ajax != null)
			ajax.addStatusResponse("Case selected..");

	}
	
	public Collection<TrCase> getCases(){
		log.info("Getting cases from DB...");
		List cases = new ArrayList<TrCase>(getCaseHome()
		.findCasesBySupportId(getVisitObject().getPortaluser()
				.getSupportid()));
		return cases;
	}
	
	private boolean containsItem(Collection<TrCase> c, String item){
		Iterator<TrCase> it = c.iterator();
		boolean contains = false;
		while(it.hasNext()){
			TrCase test = it.next();
			
			if(item.equals(test.getIdAsString())){
				contains = true;
				continue;
			}
		}
		return contains;
	}
	
	//public abstract Collection<TrCase> getCases();
	//public abstract void setCases(Collection<TrCase> cases);
	@Persist
	public abstract Collection<TrCase> getSelectedItems();
	public abstract void setSelectedItems(Collection<TrCase> selectedItems);
	

	public void openCaseListener(IRequestCycle cycle) {
		cycle.activate(getOpenCasePage());
	}

	public abstract boolean isOpenCases();
	public abstract void setOpenCases(boolean openCases);
	
	public boolean isCurrSelected() {
		boolean contains = containsItem(getSelectedItems(),
getCurrCase().getIdAsString());
		log.info("Current Selected returns "+ contains);
		return contains;
	}

Annotations in the same class:
	@Component(id="foreachCase", type="tacos:PartialFor", bindings = {
		"source=cases", "value=currCase",
		"evenOdd=ognl:page.beans.evenOdd"})
	public abstract PartialForBean getForeachCase();
		
	@Component(id="linkToggle", type="tacos:AjaxDirectLink",
			bindings = {"listener=listener:toggleCase",
			"parameters=ognl:currCase.idAsString",
			"updateComponents=ognl:{'selectedCases', currCase.idAsString}",
			"effects=template:{highlight:{selectedCases:'[255,255,184], 500,
500','${currCase}':'[255,255,184], 500, 500'}}",
			"statusElement=literal:status"})
	public abstract AjaxDirectLink getLinkToggle();

And the html:

		<div jwcid="selectedCases@Any" id="selectedCases"><span
								jwcid="@If" condition="ognl:not selectedItems.empty">
							<h3>Selected Cases</h3>
							<ul>
								<li jwcid="@tacos:PartialFor" source="ognl:selectedItems"
									value="ognl:selectItem" element="li"><span jwcid="@Insert"
									value="ognl:selectItem.id" /></li>
							</ul>
							</span></div>
							<div id="status"></div>
							<div id="cases"><span jwcid="foreachCase">
							<div jwcid="@Any" class="ognl:beans.evenOdd.next"
								id="ognl:currCase.id">

							<div><a jwcid="linkToggle" class="toggle"> <span jwcid="@Insert"
								value="ognl:currSelected ? 'Hide' : 'Details'" /></a> <span
								jwcid="@Insert" value="ognl:currCase.id"
								class="ognl:currSelected ? 'detailHeading' : 'heading'" /></div>

							<span jwcid="@If" condition="ognl:currSelected">
							<div class="caseDetail">
							<div class="acase"><!-- <img jwcid="flagImage" width="34"
height="18" />--><br />
							<span jwcid="@Insert" value="ognl:currCase.id" /></div>


On 1/11/06, Jesse Kuhnert <jk...@gmail.com> wrote:
> You shuold be able to,but are now getting into an area that is anyone's
> guess. If you can provide me a web address to hit your page in, or a very
> very easy to deploy web-app I can look further into it and make appropriate
> documentation and/or library changes based on what you're running into..
>
> On 1/11/06, Edgar Chan Carrillo <ed...@gmail.com> wrote:
> >
> > Thanks for the response Jesse.
> > Yes.I think it is.
> > My page starts with a search option and an empty list...I do a search and
> > render the result using PartialFor (a list of divs with ids corresponding
> > of
> > the ids of the objects'result query).
> > Each generated div include an AjaxDirectLink to show aditional info for
> > the
> > element.
> >
> > The firefox dom inspector correctly shows the generated divs and ids, no
> > matter how many times i perform the search. I think that means the dom
> > objects already exists in the page by that time.
> > Can i do this?
> >
> >
>
>


--
~chris

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


Re: Tacos AjaxDirectLink

Posted by Jesse Kuhnert <jk...@gmail.com>.
You shuold be able to,but are now getting into an area that is anyone's
guess. If you can provide me a web address to hit your page in, or a very
very easy to deploy web-app I can look further into it and make appropriate
documentation and/or library changes based on what you're running into..

On 1/11/06, Edgar Chan Carrillo <ed...@gmail.com> wrote:
>
> Thanks for the response Jesse.
> Yes.I think it is.
> My page starts with a search option and an empty list...I do a search and
> render the result using PartialFor (a list of divs with ids corresponding
> of
> the ids of the objects'result query).
> Each generated div include an AjaxDirectLink to show aditional info for
> the
> element.
>
> The firefox dom inspector correctly shows the generated divs and ids, no
> matter how many times i perform the search. I think that means the dom
> objects already exists in the page by that time.
> Can i do this?
>
>

Re: Tacos AjaxDirectLink

Posted by Edgar Chan Carrillo <ed...@gmail.com>.
Thanks for the response Jesse.
Yes.I think it is.
My page starts with a search option and an empty list...I do a search and
render the result using PartialFor (a list of divs with ids corresponding of
the ids of the objects'result query).
Each generated div include an AjaxDirectLink to show aditional info for the
element.

The firefox dom inspector correctly shows the generated divs and ids, no
matter how many times i perform the search. I think that means the dom
objects already exists in the page by that time.
Can i do this?

Re: Tacos AjaxDirectLink

Posted by Jesse Kuhnert <jk...@gmail.com>.
Oh right, so are you adding an element that doesn't already exist on your
client side page? Ie, if you did a view->source on your web browser (more
likely dom inspector with firefox will be better since view source is only
good for the original page render) would you be able to find the element
who's id you are updating?

Basically, you can't refresh an item on a page using updateComponents if it
doesn't already exist. One way to work around this is to do something like:

<div jwcid="@Any" id="yourid" >
<span jwcif="@If" condition="condition causing your element to display or
not">
etc...
</span>
</div>

The only reason I don't add elements to the page that don't already exist is
that this would cause a whole new set of features that would allow people to
specify ~where~ these elements should go, otherwise I'd just have to append
it to the body or some other similar non likely place.

Is this what you guys are experiencing?


On 1/10/06, Edgar Chan Carrillo <ed...@gmail.com> wrote:
>
> Hi! something similar its happening to me.  i add another element to the
> updateComponents outside of PartialFor  and that element works nice, but
> the
> inside one doesnt.
>
> The log4j says that AjaxDirectServiceImp is refreshing the 2 components
> but
> the DojoResponseBuilder only do cleanupAfterRender on the element outside
> of
> PartialFor.
>
> The ids of the generated document and debug info match but nothing happen.
>
>

Re: Tacos AjaxDirectLink

Posted by Edgar Chan Carrillo <ed...@gmail.com>.
Hi! something similar its happening to me.  i add another element to the
updateComponents outside of PartialFor  and that element works nice, but the
inside one doesnt.

The log4j says that AjaxDirectServiceImp is refreshing the 2 components but
the DojoResponseBuilder only do cleanupAfterRender on the element outside of
PartialFor.

The ids of the generated document and debug info match but nothing happen.

Re: Tacos AjaxDirectLink

Posted by Jesse Kuhnert <jk...@gmail.com>.
Have you followed the tutorial here
http://tacos.sourceforge.net/userguide/Debugging.html on installing and
using the debug console?

It is very hard to be completely sure without more information, but I would
definitely start with that..I also noticed your code pasted earlier had a
selectItem binding, but your currSelected method was checking a set or map
instance instead. Maybe you are setting the selectItem manually into the set
from another method but I would double check.

The debug console will reveal everything on the client side for you though,
so hopefully all doubt will be eliminated once you have debugging on the
client & server covered.

On 1/10/06, Chris Chiappone <ch...@gmail.com> wrote:
>
> Jesse,
> Thanks for the input.  You were correct in that by wrapping my
> currCase.id in a String would fix the problem.  So currently it seems
> to be working except for the linkToggle listener.
>
> I have been staring for hours at this code and still cannot under
> stand why my currSelected never returns true.  My page correctly
> displays the selectedItems since its notempty so I know that the
> collection should contain my object, but It doesn't seem to.  I know
> i'm probably missing something simple but i can't seem to find it.
>
> Here is my html page just so you can see whats going on, and where I
> may be having my issue.  Thanks for the help.
>
>                 <div jwcid="selectedCases@Any" id="selectedCases"><span
>                                                                 jwcid="@If"
> condition="ognl:not selectedItems.empty">
>                                                         <h3>Selected
> Cases</h3>
>                                                         <ul>
>                                                                 <li
> jwcid="@tacos:PartialFor" source="ognl:selectedItems"
>                                                                         value="ognl:selectItem"
> element="li"><span jwcid="@Insert"
>
>                                                                         value="ognl:
> selectItem.id" /></li>
>                                                         </ul>
>                                                         </span></div>
>                                                         <div
> id="status"></div>
>                                                         <div
> id="cases"><span jwcid="foreachCase">
>                                                         <div jwcid="@Any"
> class="ognl:beans.evenOdd.next"
>                                                                 id="ognl:
> currCase.id">
>
>                                                         <div><a
> jwcid="linkToggle" class="toggle"> <span jwcid="@Insert"
>                                                                 value="ognl:currSelected
> ? 'Hide' : 'Details'" /></a> <span
>                                                                 jwcid="@Insert"
> value="ognl:currCase.id"
>                                                                 class="ognl:currSelected
> ? 'detailHeading' : 'heading'" /></div>
>
>                                                         <span jwcid="@If"
> condition="ognl:currSelected">
>                                                         <div
> class="caseDetail">
>                                                         <div
> class="acase"><!-- <img jwcid="flagImage" width="34"
> height="18" />--><br />
>                                                         <span
> jwcid="@Insert" value="ognl:currCase.id" /></div>
>           Show stuff...                                         </div>
>                                                         </span></div>
>                                                         </span></div>
>
>                                                         <div
> id="partialWait">Processing...</div>
>
>
> On 1/10/06, Jesse Kuhnert <jk...@gmail.com> wrote:
> > Hmm...That is a weird exception..Javadocs says it's because two
> different
> > types of objects are being bound into the array. It may be an oversight
> on
> > my part for the updateComponents binding, but I am guessing that
> > currCase.idis an integer or some other none string data that isn't
> > getting interpreted
> > properly.
> >
> > For the time being can you wrap java.lang.String.valueOf(currCase.id) to
> see
> > if it fixes it? I'll revisit the way I'm taking updateComponents
> parameter
> > in if that is the case.
> >
> > On 1/10/06, Chris Chiappone <ch...@gmail.com> wrote:
> > >
> > > Sorry I wrote too soon, I didn't put '{ }' around the updateComponents
> > > binding.
> > > Unfortunately I still get an exception.  This time without much debug
> > > that I can make sense of:
> > >
> > > org.apache.hivemind.ApplicationRuntimeException
> > >
> > > component: $InvestigationsConsole_20@1f7562b[InvestigationsConsole]
> > > location: context:/InvestigationsConsole.html
> > >
> > > java.lang.ArrayStoreException
> > >
> > > Stack Trace:
> > > java.lang.System.arraycopy(Native Method)
> > > java.util.ArrayList.toArray(ArrayList.java:305)
> > > net.sf.tacos.ajax.components.AjaxDirectLink.getLink(
> AjaxDirectLink.java
> > > :69)
> > > org.apache.tapestry.link.DefaultLinkRenderer.constructURL(
> > > DefaultLinkRenderer.java:112)
> > > org.apache.tapestry.link.DefaultLinkRenderer.renderLink(
> > > DefaultLinkRenderer.java:62)
> > > org.apache.tapestry.link.AbstractLinkComponent.renderComponent(
> > > AbstractLinkComponent.java:95)
> > > org.apache.tapestry.AbstractComponent.render(AbstractComponent.java
> :617)
> > > org.apache.tapestry.AbstractComponent.renderBody(
> AbstractComponent.java
> > > :434)
> > > net.sf.tacos.ajax.components.PartialForBean.renderComponent(
> > > PartialForBean.java:201)
> > > $PartialForBean_21.renderComponent($PartialForBean_21.java)
> > > org.apache.tapestry.AbstractComponent.render(AbstractComponent.java
> :617)
> > > org.apache.tapestry.AbstractComponent.renderBody(
> AbstractComponent.java
> > > :434)
> > > org.apache.tapestry.components.IfBean.renderComponent(IfBean.java:86)
> > > $IfBean_5.renderComponent($IfBean_5.java)
> > > org.apache.tapestry.AbstractComponent.render(AbstractComponent.java
> :617)
> > > org.apache.tapestry.AbstractComponent.renderBody(
> AbstractComponent.java
> > > :434)
> > > org.apache.tapestry.components.RenderBody.renderComponent(
> RenderBody.java
> > > :44)
> > > $RenderBody_17.renderComponent($RenderBody_17.java)
> > > org.apache.tapestry.AbstractComponent.render(AbstractComponent.java
> :617)
> > > org.apache.tapestry.AbstractComponent.renderBody(
> AbstractComponent.java
> > > :434)
> > > org.apache.tapestry.html.Body.renderComponent(Body.java:129)
> > > $Body_15.renderComponent($Body_15.java)
> > > org.apache.tapestry.AbstractComponent.render(AbstractComponent.java
> :617)
> > > org.apache.tapestry.AbstractComponent.renderBody(
> AbstractComponent.java
> > > :434)
> > > org.apache.tapestry.html.Shell.renderComponent(Shell.java:114)
> > >
> > >
> > >
> > > On 1/10/06, Chris Chiappone <ch...@gmail.com> wrote:
> > > > Hi I am trying to get the use the tacos AjaxDirectLink component.  I
> > > > pretty much using the example given on the website except
> substituting
> > > > the .page specs in annotations.
> > > > Here is the following exception I am getting:
> > > >
> > > > org.apache.tapestry.BindingException
> > > > Error converting value for parameter updateComponents: No type
> > > > converter for type java.util.Collection is available.
> > > > binding:ExpressionBinding[InvestigationsConsole 'selectedCases',
> > > currCase.id]
> > > > component:$InvestigationsConsole_20@1f64d29[InvestigationsConsole]
> > > > location:
> > > >
> > > > Annotation @org.apache.tapestry.annotations.Component
> > > (inheritInformalParameters=false,
> > > > bindings=[listener=listener:toggleCase, parameters=ognl:currCase.id,
> > > > updateComponents=ognl:'selectedCases', currCase.id,
> > > > effects=template:{highlight:{selectedCases:'[255,255,184], 500,
> > > > 500','${currCase}':'[255,255,184], 500, 500'}},
> > > > statusElement=literal:status], id=linkToggle,
> > > > type=tacos:AjaxDirectLink) of public abstract
> > > > net.sf.tacos.ajax.components.AjaxDirectLink
> > > > view.pages.InvestigationsConsole.getLinkToggle()
> > > >
> > > > Here is my code for my page:
> > > >
> > > > public abstract class InvestigationsConsole extends SecuredPage
> > > implements
> > > >                PageBeginRenderListener {
> > > >
> > > >        public void pageBeginRender(PageEvent arg0) {
> > > >                ICaseHome caseHome = getCaseHome();
> > > >
> > > >                Collection<TrCase> cases = caseHome
> > >
> > >
> >                                .findCasesBySupportId(getVisitObject().getPortaluser()
> > > >                                                .getSupportid());
> > > >
> > > >                if (cases.size() > 0) {
> > > >                        setOpenCases(true);
> > > >                } else {
> > > >                        setOpenCases(false);
> > > >                }
> > > >        }
> > > >
> > > >        protected void finishLoad(){
> > > >                log.info("Setting selected Items");
> > > >                setSelectedItems(new HashSet());
> > > >        }
> > > >
> > > >        public void toggleCase(IRequestCycle irc) {
> > > >                long caseid = (Long) irc.getListenerParameters()[0];
> > > >                TrCase trCase = getCaseHome().findCaseById(caseid);
> > > >                Set c = getSelectedItems();
> > > >                if (c.contains(trCase)) {
> > > >                        c.remove(trCase);
> > > >                } else {
> > > >                        c.add(trCase);
> > > >                }
> > > >                setSelectedItems(c);
> > > >                AjaxWebRequest ajax = (AjaxWebRequest) irc
> > > >                                .getAttribute(
> AjaxWebRequest.AJAX_REQUEST
> > > );
> > > >                if (ajax != null)
> > > >                        ajax.addStatusResponse("Case selected..");
> > > >
> > > >        }
> > > >
> > > >        public List getCases(){
> > > >                return new ArrayList(getCaseHome()
> > >
> >                .findCasesBySupportId(getVisitObject().getPortaluser()
> > > >                                .getSupportid()));
> > > >        }
> > > >
> > > >
> > > >        //public abstract Collection<TrCase> getCases();
> > > >        //public abstract void setCases(Collection<TrCase> cases);
> > > >        @Persist
> > > >        public abstract Set getSelectedItems();
> > > >        public abstract void setSelectedItems(Set selectedItems);
> > > >
> > > >
> > > >        public void openCaseListener(IRequestCycle cycle) {
> > > >                cycle.activate(getOpenCasePage());
> > > >        }
> > > >
> > > >        public abstract boolean isOpenCases();
> > > >        public abstract void setOpenCases(boolean openCases);
> > > >        public boolean isCurrSelected() {
> > > >                return getSelectedItems().contains(getCurrCase());
> > > >        }
> > > >        public abstract TrCase getCurrCase();
> > > >        public abstract void setSelectItem(Object selectItem);
> > > >        public abstract Object getSelectItem();
> > > >
> > > >        // Annotations
> > > >        @InjectState("visit")
> > > >        public abstract Visit getVisitObject();
> > > >
> > > >        @InjectPage("OpenCase")
> > > >        public abstract IPage getOpenCasePage();
> > > >
> > > >        @InjectObject("service:trustedresponse.CaseHome")
> > > >        public abstract ICaseHome getCaseHome();
> > > >
> > > >        @InjectObject("service:tacos.AjaxWebRequest")
> > > >        public abstract AjaxWebRequest getAjaxRequest();
> > > >
> > > >        @Component(id="foreachCase", type="tacos:PartialFor",
> bindings =
> > > {
> > > >                "source=cases", "value=currCase"})
> > > >        public abstract PartialForBean getForeachCase();
> > > >
> > > >        @Component(id="linkToggle", type="tacos:AjaxDirectLink",
> > > >                        bindings = {"listener=listener:toggleCase",
> > > >                        "parameters=ognl:currCase.id",
> > > >                        "updateComponents=ognl:'selectedCases',
> > > currCase.id",
> > >
> >                        "effects=template:{highlight:{selectedCases:'[255,255,184],
> > > 500,
> > > > 500','${currCase}':'[255,255,184], 500, 500'}}",
> > > >                        "statusElement=literal:status"})
> > > >        public abstract AjaxDirectLink getLinkToggle();
> > > >
> > > >
> > > > --
> > > > ~chris
> > > >
> > >
> > >
> > > --
> > > ~chris
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> > >
> > >
> >
> >
>
>
> --
> ~chris
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>

Re: Tacos AjaxDirectLink

Posted by Chris Chiappone <ch...@gmail.com>.
Jesse,
Thanks for the input.  You were correct in that by wrapping my
currCase.id in a String would fix the problem.  So currently it seems
to be working except for the linkToggle listener.

I have been staring for hours at this code and still cannot under
stand why my currSelected never returns true.  My page correctly
displays the selectedItems since its notempty so I know that the
collection should contain my object, but It doesn't seem to.  I know
i'm probably missing something simple but i can't seem to find it.

Here is my html page just so you can see whats going on, and where I
may be having my issue.  Thanks for the help.

		<div jwcid="selectedCases@Any" id="selectedCases"><span
								jwcid="@If" condition="ognl:not selectedItems.empty">
							<h3>Selected Cases</h3>
							<ul>
								<li jwcid="@tacos:PartialFor" source="ognl:selectedItems"
									value="ognl:selectItem" element="li"><span jwcid="@Insert"
									value="ognl:selectItem.id" /></li>
							</ul>
							</span></div>
							<div id="status"></div>
							<div id="cases"><span jwcid="foreachCase">
							<div jwcid="@Any" class="ognl:beans.evenOdd.next"
								id="ognl:currCase.id">

							<div><a jwcid="linkToggle" class="toggle"> <span jwcid="@Insert"
								value="ognl:currSelected ? 'Hide' : 'Details'" /></a> <span
								jwcid="@Insert" value="ognl:currCase.id"
								class="ognl:currSelected ? 'detailHeading' : 'heading'" /></div>

							<span jwcid="@If" condition="ognl:currSelected">
							<div class="caseDetail">
							<div class="acase"><!-- <img jwcid="flagImage" width="34"
height="18" />--><br />
							<span jwcid="@Insert" value="ognl:currCase.id" /></div>
	  Show stuff...						</div>
							</span></div>
							</span></div>

							<div id="partialWait">Processing...</div>


On 1/10/06, Jesse Kuhnert <jk...@gmail.com> wrote:
> Hmm...That is a weird exception..Javadocs says it's because two different
> types of objects are being bound into the array. It may be an oversight on
> my part for the updateComponents binding, but I am guessing that
> currCase.idis an integer or some other none string data that isn't
> getting interpreted
> properly.
>
> For the time being can you wrap java.lang.String.valueOf(currCase.id) to see
> if it fixes it? I'll revisit the way I'm taking updateComponents parameter
> in if that is the case.
>
> On 1/10/06, Chris Chiappone <ch...@gmail.com> wrote:
> >
> > Sorry I wrote too soon, I didn't put '{ }' around the updateComponents
> > binding.
> > Unfortunately I still get an exception.  This time without much debug
> > that I can make sense of:
> >
> > org.apache.hivemind.ApplicationRuntimeException
> >
> > component: $InvestigationsConsole_20@1f7562b[InvestigationsConsole]
> > location: context:/InvestigationsConsole.html
> >
> > java.lang.ArrayStoreException
> >
> > Stack Trace:
> > java.lang.System.arraycopy(Native Method)
> > java.util.ArrayList.toArray(ArrayList.java:305)
> > net.sf.tacos.ajax.components.AjaxDirectLink.getLink(AjaxDirectLink.java
> > :69)
> > org.apache.tapestry.link.DefaultLinkRenderer.constructURL(
> > DefaultLinkRenderer.java:112)
> > org.apache.tapestry.link.DefaultLinkRenderer.renderLink(
> > DefaultLinkRenderer.java:62)
> > org.apache.tapestry.link.AbstractLinkComponent.renderComponent(
> > AbstractLinkComponent.java:95)
> > org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:617)
> > org.apache.tapestry.AbstractComponent.renderBody(AbstractComponent.java
> > :434)
> > net.sf.tacos.ajax.components.PartialForBean.renderComponent(
> > PartialForBean.java:201)
> > $PartialForBean_21.renderComponent($PartialForBean_21.java)
> > org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:617)
> > org.apache.tapestry.AbstractComponent.renderBody(AbstractComponent.java
> > :434)
> > org.apache.tapestry.components.IfBean.renderComponent(IfBean.java:86)
> > $IfBean_5.renderComponent($IfBean_5.java)
> > org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:617)
> > org.apache.tapestry.AbstractComponent.renderBody(AbstractComponent.java
> > :434)
> > org.apache.tapestry.components.RenderBody.renderComponent(RenderBody.java
> > :44)
> > $RenderBody_17.renderComponent($RenderBody_17.java)
> > org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:617)
> > org.apache.tapestry.AbstractComponent.renderBody(AbstractComponent.java
> > :434)
> > org.apache.tapestry.html.Body.renderComponent(Body.java:129)
> > $Body_15.renderComponent($Body_15.java)
> > org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:617)
> > org.apache.tapestry.AbstractComponent.renderBody(AbstractComponent.java
> > :434)
> > org.apache.tapestry.html.Shell.renderComponent(Shell.java:114)
> >
> >
> >
> > On 1/10/06, Chris Chiappone <ch...@gmail.com> wrote:
> > > Hi I am trying to get the use the tacos AjaxDirectLink component.  I
> > > pretty much using the example given on the website except substituting
> > > the .page specs in annotations.
> > > Here is the following exception I am getting:
> > >
> > > org.apache.tapestry.BindingException
> > > Error converting value for parameter updateComponents: No type
> > > converter for type java.util.Collection is available.
> > > binding:ExpressionBinding[InvestigationsConsole 'selectedCases',
> > currCase.id]
> > > component:$InvestigationsConsole_20@1f64d29[InvestigationsConsole]
> > > location:
> > >
> > > Annotation @org.apache.tapestry.annotations.Component
> > (inheritInformalParameters=false,
> > > bindings=[listener=listener:toggleCase, parameters=ognl:currCase.id,
> > > updateComponents=ognl:'selectedCases', currCase.id,
> > > effects=template:{highlight:{selectedCases:'[255,255,184], 500,
> > > 500','${currCase}':'[255,255,184], 500, 500'}},
> > > statusElement=literal:status], id=linkToggle,
> > > type=tacos:AjaxDirectLink) of public abstract
> > > net.sf.tacos.ajax.components.AjaxDirectLink
> > > view.pages.InvestigationsConsole.getLinkToggle()
> > >
> > > Here is my code for my page:
> > >
> > > public abstract class InvestigationsConsole extends SecuredPage
> > implements
> > >                PageBeginRenderListener {
> > >
> > >        public void pageBeginRender(PageEvent arg0) {
> > >                ICaseHome caseHome = getCaseHome();
> > >
> > >                Collection<TrCase> cases = caseHome
> >
> > >                                .findCasesBySupportId(getVisitObject().getPortaluser()
> > >                                                .getSupportid());
> > >
> > >                if (cases.size() > 0) {
> > >                        setOpenCases(true);
> > >                } else {
> > >                        setOpenCases(false);
> > >                }
> > >        }
> > >
> > >        protected void finishLoad(){
> > >                log.info("Setting selected Items");
> > >                setSelectedItems(new HashSet());
> > >        }
> > >
> > >        public void toggleCase(IRequestCycle irc) {
> > >                long caseid = (Long) irc.getListenerParameters()[0];
> > >                TrCase trCase = getCaseHome().findCaseById(caseid);
> > >                Set c = getSelectedItems();
> > >                if (c.contains(trCase)) {
> > >                        c.remove(trCase);
> > >                } else {
> > >                        c.add(trCase);
> > >                }
> > >                setSelectedItems(c);
> > >                AjaxWebRequest ajax = (AjaxWebRequest) irc
> > >                                .getAttribute(AjaxWebRequest.AJAX_REQUEST
> > );
> > >                if (ajax != null)
> > >                        ajax.addStatusResponse("Case selected..");
> > >
> > >        }
> > >
> > >        public List getCases(){
> > >                return new ArrayList(getCaseHome()
> > >                .findCasesBySupportId(getVisitObject().getPortaluser()
> > >                                .getSupportid()));
> > >        }
> > >
> > >
> > >        //public abstract Collection<TrCase> getCases();
> > >        //public abstract void setCases(Collection<TrCase> cases);
> > >        @Persist
> > >        public abstract Set getSelectedItems();
> > >        public abstract void setSelectedItems(Set selectedItems);
> > >
> > >
> > >        public void openCaseListener(IRequestCycle cycle) {
> > >                cycle.activate(getOpenCasePage());
> > >        }
> > >
> > >        public abstract boolean isOpenCases();
> > >        public abstract void setOpenCases(boolean openCases);
> > >        public boolean isCurrSelected() {
> > >                return getSelectedItems().contains(getCurrCase());
> > >        }
> > >        public abstract TrCase getCurrCase();
> > >        public abstract void setSelectItem(Object selectItem);
> > >        public abstract Object getSelectItem();
> > >
> > >        // Annotations
> > >        @InjectState("visit")
> > >        public abstract Visit getVisitObject();
> > >
> > >        @InjectPage("OpenCase")
> > >        public abstract IPage getOpenCasePage();
> > >
> > >        @InjectObject("service:trustedresponse.CaseHome")
> > >        public abstract ICaseHome getCaseHome();
> > >
> > >        @InjectObject("service:tacos.AjaxWebRequest")
> > >        public abstract AjaxWebRequest getAjaxRequest();
> > >
> > >        @Component(id="foreachCase", type="tacos:PartialFor", bindings =
> > {
> > >                "source=cases", "value=currCase"})
> > >        public abstract PartialForBean getForeachCase();
> > >
> > >        @Component(id="linkToggle", type="tacos:AjaxDirectLink",
> > >                        bindings = {"listener=listener:toggleCase",
> > >                        "parameters=ognl:currCase.id",
> > >                        "updateComponents=ognl:'selectedCases',
> > currCase.id",
> > >                        "effects=template:{highlight:{selectedCases:'[255,255,184],
> > 500,
> > > 500','${currCase}':'[255,255,184], 500, 500'}}",
> > >                        "statusElement=literal:status"})
> > >        public abstract AjaxDirectLink getLinkToggle();
> > >
> > >
> > > --
> > > ~chris
> > >
> >
> >
> > --
> > ~chris
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> >
> >
>
>


--
~chris

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


Re: Tacos AjaxDirectLink

Posted by Jesse Kuhnert <jk...@gmail.com>.
Hmm...That is a weird exception..Javadocs says it's because two different
types of objects are being bound into the array. It may be an oversight on
my part for the updateComponents binding, but I am guessing that
currCase.idis an integer or some other none string data that isn't
getting interpreted
properly.

For the time being can you wrap java.lang.String.valueOf(currCase.id) to see
if it fixes it? I'll revisit the way I'm taking updateComponents parameter
in if that is the case.

On 1/10/06, Chris Chiappone <ch...@gmail.com> wrote:
>
> Sorry I wrote too soon, I didn't put '{ }' around the updateComponents
> binding.
> Unfortunately I still get an exception.  This time without much debug
> that I can make sense of:
>
> org.apache.hivemind.ApplicationRuntimeException
>
> component: $InvestigationsConsole_20@1f7562b[InvestigationsConsole]
> location: context:/InvestigationsConsole.html
>
> java.lang.ArrayStoreException
>
> Stack Trace:
> java.lang.System.arraycopy(Native Method)
> java.util.ArrayList.toArray(ArrayList.java:305)
> net.sf.tacos.ajax.components.AjaxDirectLink.getLink(AjaxDirectLink.java
> :69)
> org.apache.tapestry.link.DefaultLinkRenderer.constructURL(
> DefaultLinkRenderer.java:112)
> org.apache.tapestry.link.DefaultLinkRenderer.renderLink(
> DefaultLinkRenderer.java:62)
> org.apache.tapestry.link.AbstractLinkComponent.renderComponent(
> AbstractLinkComponent.java:95)
> org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:617)
> org.apache.tapestry.AbstractComponent.renderBody(AbstractComponent.java
> :434)
> net.sf.tacos.ajax.components.PartialForBean.renderComponent(
> PartialForBean.java:201)
> $PartialForBean_21.renderComponent($PartialForBean_21.java)
> org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:617)
> org.apache.tapestry.AbstractComponent.renderBody(AbstractComponent.java
> :434)
> org.apache.tapestry.components.IfBean.renderComponent(IfBean.java:86)
> $IfBean_5.renderComponent($IfBean_5.java)
> org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:617)
> org.apache.tapestry.AbstractComponent.renderBody(AbstractComponent.java
> :434)
> org.apache.tapestry.components.RenderBody.renderComponent(RenderBody.java
> :44)
> $RenderBody_17.renderComponent($RenderBody_17.java)
> org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:617)
> org.apache.tapestry.AbstractComponent.renderBody(AbstractComponent.java
> :434)
> org.apache.tapestry.html.Body.renderComponent(Body.java:129)
> $Body_15.renderComponent($Body_15.java)
> org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:617)
> org.apache.tapestry.AbstractComponent.renderBody(AbstractComponent.java
> :434)
> org.apache.tapestry.html.Shell.renderComponent(Shell.java:114)
>
>
>
> On 1/10/06, Chris Chiappone <ch...@gmail.com> wrote:
> > Hi I am trying to get the use the tacos AjaxDirectLink component.  I
> > pretty much using the example given on the website except substituting
> > the .page specs in annotations.
> > Here is the following exception I am getting:
> >
> > org.apache.tapestry.BindingException
> > Error converting value for parameter updateComponents: No type
> > converter for type java.util.Collection is available.
> > binding:ExpressionBinding[InvestigationsConsole 'selectedCases',
> currCase.id]
> > component:$InvestigationsConsole_20@1f64d29[InvestigationsConsole]
> > location:
> >
> > Annotation @org.apache.tapestry.annotations.Component
> (inheritInformalParameters=false,
> > bindings=[listener=listener:toggleCase, parameters=ognl:currCase.id,
> > updateComponents=ognl:'selectedCases', currCase.id,
> > effects=template:{highlight:{selectedCases:'[255,255,184], 500,
> > 500','${currCase}':'[255,255,184], 500, 500'}},
> > statusElement=literal:status], id=linkToggle,
> > type=tacos:AjaxDirectLink) of public abstract
> > net.sf.tacos.ajax.components.AjaxDirectLink
> > view.pages.InvestigationsConsole.getLinkToggle()
> >
> > Here is my code for my page:
> >
> > public abstract class InvestigationsConsole extends SecuredPage
> implements
> >                PageBeginRenderListener {
> >
> >        public void pageBeginRender(PageEvent arg0) {
> >                ICaseHome caseHome = getCaseHome();
> >
> >                Collection<TrCase> cases = caseHome
>
> >                                .findCasesBySupportId(getVisitObject().getPortaluser()
> >                                                .getSupportid());
> >
> >                if (cases.size() > 0) {
> >                        setOpenCases(true);
> >                } else {
> >                        setOpenCases(false);
> >                }
> >        }
> >
> >        protected void finishLoad(){
> >                log.info("Setting selected Items");
> >                setSelectedItems(new HashSet());
> >        }
> >
> >        public void toggleCase(IRequestCycle irc) {
> >                long caseid = (Long) irc.getListenerParameters()[0];
> >                TrCase trCase = getCaseHome().findCaseById(caseid);
> >                Set c = getSelectedItems();
> >                if (c.contains(trCase)) {
> >                        c.remove(trCase);
> >                } else {
> >                        c.add(trCase);
> >                }
> >                setSelectedItems(c);
> >                AjaxWebRequest ajax = (AjaxWebRequest) irc
> >                                .getAttribute(AjaxWebRequest.AJAX_REQUEST
> );
> >                if (ajax != null)
> >                        ajax.addStatusResponse("Case selected..");
> >
> >        }
> >
> >        public List getCases(){
> >                return new ArrayList(getCaseHome()
> >                .findCasesBySupportId(getVisitObject().getPortaluser()
> >                                .getSupportid()));
> >        }
> >
> >
> >        //public abstract Collection<TrCase> getCases();
> >        //public abstract void setCases(Collection<TrCase> cases);
> >        @Persist
> >        public abstract Set getSelectedItems();
> >        public abstract void setSelectedItems(Set selectedItems);
> >
> >
> >        public void openCaseListener(IRequestCycle cycle) {
> >                cycle.activate(getOpenCasePage());
> >        }
> >
> >        public abstract boolean isOpenCases();
> >        public abstract void setOpenCases(boolean openCases);
> >        public boolean isCurrSelected() {
> >                return getSelectedItems().contains(getCurrCase());
> >        }
> >        public abstract TrCase getCurrCase();
> >        public abstract void setSelectItem(Object selectItem);
> >        public abstract Object getSelectItem();
> >
> >        // Annotations
> >        @InjectState("visit")
> >        public abstract Visit getVisitObject();
> >
> >        @InjectPage("OpenCase")
> >        public abstract IPage getOpenCasePage();
> >
> >        @InjectObject("service:trustedresponse.CaseHome")
> >        public abstract ICaseHome getCaseHome();
> >
> >        @InjectObject("service:tacos.AjaxWebRequest")
> >        public abstract AjaxWebRequest getAjaxRequest();
> >
> >        @Component(id="foreachCase", type="tacos:PartialFor", bindings =
> {
> >                "source=cases", "value=currCase"})
> >        public abstract PartialForBean getForeachCase();
> >
> >        @Component(id="linkToggle", type="tacos:AjaxDirectLink",
> >                        bindings = {"listener=listener:toggleCase",
> >                        "parameters=ognl:currCase.id",
> >                        "updateComponents=ognl:'selectedCases',
> currCase.id",
> >                        "effects=template:{highlight:{selectedCases:'[255,255,184],
> 500,
> > 500','${currCase}':'[255,255,184], 500, 500'}}",
> >                        "statusElement=literal:status"})
> >        public abstract AjaxDirectLink getLinkToggle();
> >
> >
> > --
> > ~chris
> >
>
>
> --
> ~chris
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>

Re: Tacos AjaxDirectLink

Posted by Chris Chiappone <ch...@gmail.com>.
Sorry I wrote too soon, I didn't put '{ }' around the updateComponents binding.
Unfortunately I still get an exception.  This time without much debug
that I can make sense of:

org.apache.hivemind.ApplicationRuntimeException

component: $InvestigationsConsole_20@1f7562b[InvestigationsConsole]
location: context:/InvestigationsConsole.html

java.lang.ArrayStoreException

Stack Trace:
java.lang.System.arraycopy(Native Method)
java.util.ArrayList.toArray(ArrayList.java:305)
net.sf.tacos.ajax.components.AjaxDirectLink.getLink(AjaxDirectLink.java:69)
org.apache.tapestry.link.DefaultLinkRenderer.constructURL(DefaultLinkRenderer.java:112)
org.apache.tapestry.link.DefaultLinkRenderer.renderLink(DefaultLinkRenderer.java:62)
org.apache.tapestry.link.AbstractLinkComponent.renderComponent(AbstractLinkComponent.java:95)
org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:617)
org.apache.tapestry.AbstractComponent.renderBody(AbstractComponent.java:434)
net.sf.tacos.ajax.components.PartialForBean.renderComponent(PartialForBean.java:201)
$PartialForBean_21.renderComponent($PartialForBean_21.java)
org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:617)
org.apache.tapestry.AbstractComponent.renderBody(AbstractComponent.java:434)
org.apache.tapestry.components.IfBean.renderComponent(IfBean.java:86)
$IfBean_5.renderComponent($IfBean_5.java)
org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:617)
org.apache.tapestry.AbstractComponent.renderBody(AbstractComponent.java:434)
org.apache.tapestry.components.RenderBody.renderComponent(RenderBody.java:44)
$RenderBody_17.renderComponent($RenderBody_17.java)
org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:617)
org.apache.tapestry.AbstractComponent.renderBody(AbstractComponent.java:434)
org.apache.tapestry.html.Body.renderComponent(Body.java:129)
$Body_15.renderComponent($Body_15.java)
org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:617)
org.apache.tapestry.AbstractComponent.renderBody(AbstractComponent.java:434)
org.apache.tapestry.html.Shell.renderComponent(Shell.java:114)



On 1/10/06, Chris Chiappone <ch...@gmail.com> wrote:
> Hi I am trying to get the use the tacos AjaxDirectLink component.  I
> pretty much using the example given on the website except substituting
> the .page specs in annotations.
> Here is the following exception I am getting:
>
> org.apache.tapestry.BindingException
> Error converting value for parameter updateComponents: No type
> converter for type java.util.Collection is available.
> binding:ExpressionBinding[InvestigationsConsole 'selectedCases', currCase.id]
> component:$InvestigationsConsole_20@1f64d29[InvestigationsConsole]
> location:
>
> Annotation @org.apache.tapestry.annotations.Component(inheritInformalParameters=false,
> bindings=[listener=listener:toggleCase, parameters=ognl:currCase.id,
> updateComponents=ognl:'selectedCases', currCase.id,
> effects=template:{highlight:{selectedCases:'[255,255,184], 500,
> 500','${currCase}':'[255,255,184], 500, 500'}},
> statusElement=literal:status], id=linkToggle,
> type=tacos:AjaxDirectLink) of public abstract
> net.sf.tacos.ajax.components.AjaxDirectLink
> view.pages.InvestigationsConsole.getLinkToggle()
>
> Here is my code for my page:
>
> public abstract class InvestigationsConsole extends SecuredPage implements
>                PageBeginRenderListener {
>
>        public void pageBeginRender(PageEvent arg0) {
>                ICaseHome caseHome = getCaseHome();
>
>                Collection<TrCase> cases = caseHome
>                                .findCasesBySupportId(getVisitObject().getPortaluser()
>                                                .getSupportid());
>
>                if (cases.size() > 0) {
>                        setOpenCases(true);
>                } else {
>                        setOpenCases(false);
>                }
>        }
>
>        protected void finishLoad(){
>                log.info("Setting selected Items");
>                setSelectedItems(new HashSet());
>        }
>
>        public void toggleCase(IRequestCycle irc) {
>                long caseid = (Long) irc.getListenerParameters()[0];
>                TrCase trCase = getCaseHome().findCaseById(caseid);
>                Set c = getSelectedItems();
>                if (c.contains(trCase)) {
>                        c.remove(trCase);
>                } else {
>                        c.add(trCase);
>                }
>                setSelectedItems(c);
>                AjaxWebRequest ajax = (AjaxWebRequest) irc
>                                .getAttribute(AjaxWebRequest.AJAX_REQUEST);
>                if (ajax != null)
>                        ajax.addStatusResponse("Case selected..");
>
>        }
>
>        public List getCases(){
>                return new ArrayList(getCaseHome()
>                .findCasesBySupportId(getVisitObject().getPortaluser()
>                                .getSupportid()));
>        }
>
>
>        //public abstract Collection<TrCase> getCases();
>        //public abstract void setCases(Collection<TrCase> cases);
>        @Persist
>        public abstract Set getSelectedItems();
>        public abstract void setSelectedItems(Set selectedItems);
>
>
>        public void openCaseListener(IRequestCycle cycle) {
>                cycle.activate(getOpenCasePage());
>        }
>
>        public abstract boolean isOpenCases();
>        public abstract void setOpenCases(boolean openCases);
>        public boolean isCurrSelected() {
>                return getSelectedItems().contains(getCurrCase());
>        }
>        public abstract TrCase getCurrCase();
>        public abstract void setSelectItem(Object selectItem);
>        public abstract Object getSelectItem();
>
>        // Annotations
>        @InjectState("visit")
>        public abstract Visit getVisitObject();
>
>        @InjectPage("OpenCase")
>        public abstract IPage getOpenCasePage();
>
>        @InjectObject("service:trustedresponse.CaseHome")
>        public abstract ICaseHome getCaseHome();
>
>        @InjectObject("service:tacos.AjaxWebRequest")
>        public abstract AjaxWebRequest getAjaxRequest();
>
>        @Component(id="foreachCase", type="tacos:PartialFor", bindings = {
>                "source=cases", "value=currCase"})
>        public abstract PartialForBean getForeachCase();
>
>        @Component(id="linkToggle", type="tacos:AjaxDirectLink",
>                        bindings = {"listener=listener:toggleCase",
>                        "parameters=ognl:currCase.id",
>                        "updateComponents=ognl:'selectedCases', currCase.id",
>                        "effects=template:{highlight:{selectedCases:'[255,255,184], 500,
> 500','${currCase}':'[255,255,184], 500, 500'}}",
>                        "statusElement=literal:status"})
>        public abstract AjaxDirectLink getLinkToggle();
>
>
> --
> ~chris
>


--
~chris

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