You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Alec Swan <al...@gmail.com> on 2011/02/01 02:51:51 UTC

Mapping wicket:id to component without changing Java code

Hello,

I would like to add credit card processing form to many different pages in
my application. However, I don't know which pages it will be added to and it
is up to the web designer to decide.

I would like to allow the web designer to be able to put <div
wicket:id="creditCardForm"/> anywhere in HTML. This would typically cause
Wicket to throw an error saying that a matching component was not added.

Is there a way to configure Wicket to somehow add an instance of
CreditCardForm class whenever it sees <div wicket:id="creditCardForm"/>?

Thanks,

Alec

Re: Mapping wicket:id to component without changing Java code

Posted by Jeremy Thomerson <je...@wickettraining.com>.
create your own component resolver

Jeremy Thomerson
http://wickettraining.com
-- sent from my "smart" phone, so please excuse spelling, formatting, or
compiler errors

On Jan 31, 2011 7:52 PM, "Alec Swan" <al...@gmail.com> wrote:

Hello,

I would like to add credit card processing form to many different pages in
my application. However, I don't know which pages it will be added to and it
is up to the web designer to decide.

I would like to allow the web designer to be able to put <div
wicket:id="creditCardForm"/> anywhere in HTML. This would typically cause
Wicket to throw an error saying that a matching component was not added.

Is there a way to configure Wicket to somehow add an instance of
CreditCardForm class whenever it sees <div wicket:id="creditCardForm"/>?

Thanks,

Alec

Re: Mapping wicket:id to component without changing Java code

Posted by splitshade <ma...@googlemail.com>.
Hi,

some days ago, I experimented with exactly the same usecase (letting
webdesigners place components on a Wicket Page), i wrote a small BlogEntry
(unfortunately in German, but maybe Google could translate).

http://splitshade.wordpress.com/2011/01/27/wicket-markup-komponenten-braucht-man-das/

Bye 

Martin
-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Mapping-wicket-id-to-component-without-changing-Java-code-tp3250381p3262231.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: Mapping wicket:id to component without changing Java code

Posted by msj121 <ms...@gmail.com>.
Not sure how to e-mail someone directly as e-mails are hidden.... But it's
okay, I will probably look to implement an existing open source system with
Wicket, I am just curious if anyone would want to work on building a
specific open source idea for wicket either from scratch or properly
building off a basic system....

If I build an e-commerce system from scratch I certainly wouldn't want to do
it alone.... But I wish you luck with your system.

Matthew
-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Mapping-wicket-id-to-component-without-changing-Java-code-tp3250381p3256939.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: Mapping wicket:id to component without changing Java code

Posted by Alec Swan <al...@gmail.com>.
Thank you everybody for the clever ideas.

msj121, I just started building the credit card form and was planning to
just use Authorize.net APIs. This is not directly related to Wicket, so we
should take this discussion off this forum. Email me directly if you have
some thoughts or just wanted to bounce ideas off.

Thanks,

Alec

On Tue, Feb 1, 2011 at 8:50 AM, James Carman <ja...@carmanconsulting.com>wrote:

> On Tue, Feb 1, 2011 at 10:27 AM, msj121 <ms...@gmail.com> wrote:
> >
> > You can add an empty label to replace the content if not adding the
> > component.
>
> Or, use EmptyPanel or a plain ole WebMarkupContainer?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Mapping wicket:id to component without changing Java code

Posted by James Carman <ja...@carmanconsulting.com>.
On Tue, Feb 1, 2011 at 10:27 AM, msj121 <ms...@gmail.com> wrote:
>
> You can add an empty label to replace the content if not adding the
> component.

Or, use EmptyPanel or a plain ole WebMarkupContainer?

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


Re: Mapping wicket:id to component without changing Java code

Posted by msj121 <ms...@gmail.com>.
You can add an empty label to replace the content if not adding the
component. You can have a repeating list if you have lots of dynamic
content, this way whatever you add to the list is added or you can just add
an empty component.

It does seem odd to me that in your html you know whether to add the credit
card div, but in Wicket you do not... that is certainly unclear to me.

Btw, I am building an e-commerce solution myself, are you using an
opensource platform or building it yourself?

> Hello,
>
> I would like to add credit card processing form to many different pages in
> my application. However, I don't know which pages it will be added to and
> it
> is up to the web designer to decide.
>
> I would like to allow the web designer to be able to put<div
> wicket:id="creditCardForm"/>  anywhere in HTML. This would typically cause
> Wicket to throw an error saying that a matching component was not added.
>
> Is there a way to configure Wicket to somehow add an instance of
> CreditCardForm class whenever it sees<div wicket:id="creditCardForm"/>?
>
> Thanks,
>
> Alec
> 
-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Mapping-wicket-id-to-component-without-changing-Java-code-tp3250381p3251809.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: Mapping wicket:id to component without changing Java code

Posted by Andrea Del Bene <ad...@ciseonweb.it>.
Hi Alec,

I don't think Wicket has a configuration option that can help you. But 
you can create a web page superclass that parses HTML and adds your form 
if it finds tag <div wicket:id="creditCardForm"/>.
For example you can override onInitialize method and add something like 
this:


MarkupParser markupParser = new MarkupParser(new XmlPullParser(), new 
MarkupResourceStream(getMarkupStream().getResource()));
Markup markup = markupParser.parse();

for(int i = 0; i < markup.size(); i++) {
             if(markup.get(i) instanceof ComponentTag){
                 String markupId = (ComponentTag) markup.get(i);
                 //if markupid is equals to "creditCardForm" add form
             }
}



bye.
> Hello,
>
> I would like to add credit card processing form to many different pages in
> my application. However, I don't know which pages it will be added to and it
> is up to the web designer to decide.
>
> I would like to allow the web designer to be able to put<div
> wicket:id="creditCardForm"/>  anywhere in HTML. This would typically cause
> Wicket to throw an error saying that a matching component was not added.
>
> Is there a way to configure Wicket to somehow add an instance of
> CreditCardForm class whenever it sees<div wicket:id="creditCardForm"/>?
>
> Thanks,
>
> Alec
>

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