You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Daniel Jue <te...@gmail.com> on 2007/05/29 17:58:04 UTC

T5: Example usage of visit(SelectModelVisitor obj) for SelectModel interface?

Hello all,

I have a

public class GenericSelectionModel<T> implements SelectModel {
...}

That I need to add this method to:

public void visit(SelectModelVisitor arg0) {...}

I think Howard added this in response to some enhancements to the T5
Palette component.  At the moment I can't quite wrap my head around
how to use it.  Any tips out there?

Thanks

Daniel

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


Re: T5: Example usage of visit(SelectModelVisitor obj) for SelectModel interface?

Posted by Daniel Jue <te...@gmail.com>.
I copied this code from AbstractSelectModel into my
GenericSelectionModel, and now it works again.  Later on I might see
if my GenericSelectionModel can just extend the Abstract one.

	public final void visit(SelectModelVisitor visitor) {
		List<OptionGroupModel> groups = getOptionGroups();

		if (groups != null) {
			for (OptionGroupModel groupModel : groups) {
				visitor.beginOptionGroup(groupModel);

				visitOptions(groupModel.getOptions(), visitor);

				visitor.endOptionGroup(groupModel);
			}
		}

		visitOptions(getOptions(), visitor);
	}

	private void visitOptions(List<OptionModel> options,
			SelectModelVisitor vistor) {
		if (options != null) {
			for (OptionModel optionModel : options)
				vistor.option(optionModel);
		}
	}




On 5/29/07, Daniel Jue <te...@gmail.com> wrote:
> Hello all,
>
> I have a
>
> public class GenericSelectionModel<T> implements SelectModel {
> ...}
>
> That I need to add this method to:
>
> public void visit(SelectModelVisitor arg0) {...}
>
> I think Howard added this in response to some enhancements to the T5
> Palette component.  At the moment I can't quite wrap my head around
> how to use it.  Any tips out there?
>
> Thanks
>
> Daniel
>

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


Re: T5: Example usage of visit(SelectModelVisitor obj) for SelectModel interface?

Posted by Howard Lewis Ship <hl...@gmail.com>.
Yes, its an enhancement to HTML that most (but not all) browsers no
support.  It's the right way to break a bunch of options into groups, with
the options indented under the corresponding labels.

On 5/29/07, Davor Hrg <hr...@gmail.com> wrote:
>
> Optiongroup is a SELECT tag feature,
> http://www.htmlhelp.com/reference/html40/forms/optgroup.html
>
> Davor Hrg
>
> On 5/29/07, Daniel Jue <te...@gmail.com> wrote:
> >
> > Great Howard!  Extending the abstract worked fine, and the last
> > explanation helped me grasp the usage.
> >
> > I've never dealt with "option groups" before, is that related somehow
> > to radio groups, or is that a term for multiple selections as seen
> > with Palette?
> >
> > On 5/29/07, Howard Lewis Ship <hl...@gmail.com> wrote:
> > > I should add; this visitor interface is how Select and Palette
> > components
> > > navigate the options and option groups in the correct render
> > order.  Moving
> > > that logic to the SelectModel removes a lot of repetitive code inside
> > the
> > > two components.
> > >
> > > On 5/29/07, Howard Lewis Ship <hl...@gmail.com> wrote:
> > > >
> > > > Hint #1: Connect to the source (that "arg0" means you haven't
> > connected
> > > > the JAR to source, so you miss out on all the Javadoc).
> > > >
> > > > Hint #2: I put the implementation of this into a base class you can
> > extend
> > > > from.
> > > >
> > > > On 5/29/07, Daniel Jue <te...@gmail.com> wrote:
> > > > >
> > > > > Hello all,
> > > > >
> > > > > I have a
> > > > >
> > > > > public class GenericSelectionModel<T> implements SelectModel {
> > > > > ...}
> > > > >
> > > > > That I need to add this method to:
> > > > >
> > > > > public void visit(SelectModelVisitor arg0) {...}
> > > > >
> > > > > I think Howard added this in response to some enhancements to the
> T5
> > > > > Palette component.  At the moment I can't quite wrap my head
> around
> > > > > how to use it.  Any tips out there?
> > > > >
> > > > > Thanks
> > > > >
> > > > > Daniel
> > > > >
> > > > >
> > ---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > > > > For additional commands, e-mail: users-help@tapestry.apache.org
> > > > >
> > > > >
> > > >
> > > >
> > > > --
> > > > Howard M. Lewis Ship
> > > > TWD Consulting, Inc.
> > > > Independent J2EE / Open-Source Java Consultant
> > > > Creator and PMC Chair, Apache Tapestry
> > > > Creator, Apache HiveMind
> > > >
> > > > Professional Tapestry training, mentoring, support
> > > > and project work.  http://howardlewisship.com
> > >
> > >
> > >
> > >
> > > --
> > > Howard M. Lewis Ship
> > > TWD Consulting, Inc.
> > > Independent J2EE / Open-Source Java Consultant
> > > Creator and PMC Chair, Apache Tapestry
> > > Creator, Apache HiveMind
> > >
> > > Professional Tapestry training, mentoring, support
> > > and project work.  http://howardlewisship.com
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
>



-- 
Howard M. Lewis Ship
TWD Consulting, Inc.
Independent J2EE / Open-Source Java Consultant
Creator and PMC Chair, Apache Tapestry
Creator, Apache HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

Re: T5: Example usage of visit(SelectModelVisitor obj) for SelectModel interface?

Posted by Davor Hrg <hr...@gmail.com>.
Optiongroup is a SELECT tag feature,
http://www.htmlhelp.com/reference/html40/forms/optgroup.html

Davor Hrg

On 5/29/07, Daniel Jue <te...@gmail.com> wrote:
>
> Great Howard!  Extending the abstract worked fine, and the last
> explanation helped me grasp the usage.
>
> I've never dealt with "option groups" before, is that related somehow
> to radio groups, or is that a term for multiple selections as seen
> with Palette?
>
> On 5/29/07, Howard Lewis Ship <hl...@gmail.com> wrote:
> > I should add; this visitor interface is how Select and Palette
> components
> > navigate the options and option groups in the correct render
> order.  Moving
> > that logic to the SelectModel removes a lot of repetitive code inside
> the
> > two components.
> >
> > On 5/29/07, Howard Lewis Ship <hl...@gmail.com> wrote:
> > >
> > > Hint #1: Connect to the source (that "arg0" means you haven't
> connected
> > > the JAR to source, so you miss out on all the Javadoc).
> > >
> > > Hint #2: I put the implementation of this into a base class you can
> extend
> > > from.
> > >
> > > On 5/29/07, Daniel Jue <te...@gmail.com> wrote:
> > > >
> > > > Hello all,
> > > >
> > > > I have a
> > > >
> > > > public class GenericSelectionModel<T> implements SelectModel {
> > > > ...}
> > > >
> > > > That I need to add this method to:
> > > >
> > > > public void visit(SelectModelVisitor arg0) {...}
> > > >
> > > > I think Howard added this in response to some enhancements to the T5
> > > > Palette component.  At the moment I can't quite wrap my head around
> > > > how to use it.  Any tips out there?
> > > >
> > > > Thanks
> > > >
> > > > Daniel
> > > >
> > > >
> ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > > > For additional commands, e-mail: users-help@tapestry.apache.org
> > > >
> > > >
> > >
> > >
> > > --
> > > Howard M. Lewis Ship
> > > TWD Consulting, Inc.
> > > Independent J2EE / Open-Source Java Consultant
> > > Creator and PMC Chair, Apache Tapestry
> > > Creator, Apache HiveMind
> > >
> > > Professional Tapestry training, mentoring, support
> > > and project work.  http://howardlewisship.com
> >
> >
> >
> >
> > --
> > Howard M. Lewis Ship
> > TWD Consulting, Inc.
> > Independent J2EE / Open-Source Java Consultant
> > Creator and PMC Chair, Apache Tapestry
> > Creator, Apache HiveMind
> >
> > Professional Tapestry training, mentoring, support
> > and project work.  http://howardlewisship.com
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: T5: Example usage of visit(SelectModelVisitor obj) for SelectModel interface?

Posted by Daniel Jue <te...@gmail.com>.
Great Howard!  Extending the abstract worked fine, and the last
explanation helped me grasp the usage.

I've never dealt with "option groups" before, is that related somehow
to radio groups, or is that a term for multiple selections as seen
with Palette?

On 5/29/07, Howard Lewis Ship <hl...@gmail.com> wrote:
> I should add; this visitor interface is how Select and Palette components
> navigate the options and option groups in the correct render order.  Moving
> that logic to the SelectModel removes a lot of repetitive code inside the
> two components.
>
> On 5/29/07, Howard Lewis Ship <hl...@gmail.com> wrote:
> >
> > Hint #1: Connect to the source (that "arg0" means you haven't connected
> > the JAR to source, so you miss out on all the Javadoc).
> >
> > Hint #2: I put the implementation of this into a base class you can extend
> > from.
> >
> > On 5/29/07, Daniel Jue <te...@gmail.com> wrote:
> > >
> > > Hello all,
> > >
> > > I have a
> > >
> > > public class GenericSelectionModel<T> implements SelectModel {
> > > ...}
> > >
> > > That I need to add this method to:
> > >
> > > public void visit(SelectModelVisitor arg0) {...}
> > >
> > > I think Howard added this in response to some enhancements to the T5
> > > Palette component.  At the moment I can't quite wrap my head around
> > > how to use it.  Any tips out there?
> > >
> > > Thanks
> > >
> > > Daniel
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > > For additional commands, e-mail: users-help@tapestry.apache.org
> > >
> > >
> >
> >
> > --
> > Howard M. Lewis Ship
> > TWD Consulting, Inc.
> > Independent J2EE / Open-Source Java Consultant
> > Creator and PMC Chair, Apache Tapestry
> > Creator, Apache HiveMind
> >
> > Professional Tapestry training, mentoring, support
> > and project work.  http://howardlewisship.com
>
>
>
>
> --
> Howard M. Lewis Ship
> TWD Consulting, Inc.
> Independent J2EE / Open-Source Java Consultant
> Creator and PMC Chair, Apache Tapestry
> Creator, Apache HiveMind
>
> Professional Tapestry training, mentoring, support
> and project work.  http://howardlewisship.com
>

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


Re: T5: Example usage of visit(SelectModelVisitor obj) for SelectModel interface?

Posted by Howard Lewis Ship <hl...@gmail.com>.
I should add; this visitor interface is how Select and Palette components
navigate the options and option groups in the correct render order.  Moving
that logic to the SelectModel removes a lot of repetitive code inside the
two components.

On 5/29/07, Howard Lewis Ship <hl...@gmail.com> wrote:
>
> Hint #1: Connect to the source (that "arg0" means you haven't connected
> the JAR to source, so you miss out on all the Javadoc).
>
> Hint #2: I put the implementation of this into a base class you can extend
> from.
>
> On 5/29/07, Daniel Jue <te...@gmail.com> wrote:
> >
> > Hello all,
> >
> > I have a
> >
> > public class GenericSelectionModel<T> implements SelectModel {
> > ...}
> >
> > That I need to add this method to:
> >
> > public void visit(SelectModelVisitor arg0) {...}
> >
> > I think Howard added this in response to some enhancements to the T5
> > Palette component.  At the moment I can't quite wrap my head around
> > how to use it.  Any tips out there?
> >
> > Thanks
> >
> > Daniel
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
>
>
> --
> Howard M. Lewis Ship
> TWD Consulting, Inc.
> Independent J2EE / Open-Source Java Consultant
> Creator and PMC Chair, Apache Tapestry
> Creator, Apache HiveMind
>
> Professional Tapestry training, mentoring, support
> and project work.  http://howardlewisship.com




-- 
Howard M. Lewis Ship
TWD Consulting, Inc.
Independent J2EE / Open-Source Java Consultant
Creator and PMC Chair, Apache Tapestry
Creator, Apache HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

Re: T5: Example usage of visit(SelectModelVisitor obj) for SelectModel interface?

Posted by Howard Lewis Ship <hl...@gmail.com>.
Hint #1: Connect to the source (that "arg0" means you haven't connected the
JAR to source, so you miss out on all the Javadoc).

Hint #2: I put the implementation of this into a base class you can extend
from.

On 5/29/07, Daniel Jue <te...@gmail.com> wrote:
>
> Hello all,
>
> I have a
>
> public class GenericSelectionModel<T> implements SelectModel {
> ...}
>
> That I need to add this method to:
>
> public void visit(SelectModelVisitor arg0) {...}
>
> I think Howard added this in response to some enhancements to the T5
> Palette component.  At the moment I can't quite wrap my head around
> how to use it.  Any tips out there?
>
> Thanks
>
> Daniel
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Howard M. Lewis Ship
TWD Consulting, Inc.
Independent J2EE / Open-Source Java Consultant
Creator and PMC Chair, Apache Tapestry
Creator, Apache HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com