Re: Can html file name be different from page class name?

2011-04-23 Thread hariharansrc
wicket is component oriented framework it is the ease that we can write java
class for html file and thus we can apply software engineering principles.
what is the problem for just naming java class and the html file the same
name

can you tell the reason why you want to do that?



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Can-html-file-name-be-different-from-page-class-name-tp3466229p3471085.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: Forcing parent CSS to be contributed after all child CSS

2011-04-23 Thread Alec Swan
Thanks for the ideas, Clint. The child components do not know about
parent CSS, so I decided to use more specific CSS selectors in the
parent CSS to accomplish what I needed.

Alec

On Sat, Apr 23, 2011 at 4:35 PM, Clint Checketts  wrote:
> I recall reading an article once noting that you could contribute the CSS
> file noted in the parent class again in the child component and Wicket is
> smart enough to not duplicate the contribution, but it still forces the CSS
> file to appear later.
>
> You also may consider changing the parent CSS rules to be more specific or
> generic (depending on your intentions), to allow them to cascade.
>
> -Clint
>
> On Sat, Apr 23, 2011 at 5:05 PM, Alec Swan  wrote:
>
>> Hello,
>>
>> I have a component tree where some components contribute CSS. I have
>> inline CSS for the parent component that should be contributed last in
>> order to override CSS of child components.
>>
>> Children components contribute their CSS in their constructors using
>> add(new StyleSheetReference("cssId", getClass(), "/css/styles.css")).
>> I have to use this approach because other approaches don't work with
>> panel swapping (I have yet to create a JIRA issue for this).
>>
>> The parent component is contributing CSS by calling
>> response.renderString("body {background-color:red}") from
>> IHeaderContributor#renderHead(IHeaderResponse).
>>
>> I tried contributing parent CSS in parents onInitialize() and
>> onBeforeRender(), but children's CSS always get written last.
>>
>> Is there any way to force parent's CSS to be contributed last?
>>
>> Thanks,
>>
>> Alec
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>>
>

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



Re: formComponentPanel with content generated by RepeatingView

2011-04-23 Thread Pedro Santos
On Sat, Apr 23, 2011 at 2:45 PM, kamiseq  wrote:

> heh i thought I was smart :] as each component in FormComponentPanel is
> converted and validated so it would be easy to intercept value set on
> components model and add it to List (which is model of whole FCPanel)
> because Im not really converting components value to something bigger.
>
> the only problem is getting value for each component as interface is only
> getObject and setObject so there is no information model could decide which
> value goes to which component
>

Use a ListView instead of RepeatingView, it recreate its list item
components each render and it already resolve which value goes to which
component.


> ;]
>
> pozdrawiam
> Paweł Kamiński
>
> kami...@gmail.com
> pkaminski@gmail.com
> __
>



-- 
Pedro Henrique Oliveira dos Santos


Re: Forcing parent CSS to be contributed after all child CSS

2011-04-23 Thread Clint Checketts
I recall reading an article once noting that you could contribute the CSS
file noted in the parent class again in the child component and Wicket is
smart enough to not duplicate the contribution, but it still forces the CSS
file to appear later.

You also may consider changing the parent CSS rules to be more specific or
generic (depending on your intentions), to allow them to cascade.

-Clint

On Sat, Apr 23, 2011 at 5:05 PM, Alec Swan  wrote:

> Hello,
>
> I have a component tree where some components contribute CSS. I have
> inline CSS for the parent component that should be contributed last in
> order to override CSS of child components.
>
> Children components contribute their CSS in their constructors using
> add(new StyleSheetReference("cssId", getClass(), "/css/styles.css")).
> I have to use this approach because other approaches don't work with
> panel swapping (I have yet to create a JIRA issue for this).
>
> The parent component is contributing CSS by calling
> response.renderString("body {background-color:red}") from
> IHeaderContributor#renderHead(IHeaderResponse).
>
> I tried contributing parent CSS in parents onInitialize() and
> onBeforeRender(), but children's CSS always get written last.
>
> Is there any way to force parent's CSS to be contributed last?
>
> Thanks,
>
> Alec
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Forcing parent CSS to be contributed after all child CSS

2011-04-23 Thread Alec Swan
Hello,

I have a component tree where some components contribute CSS. I have
inline CSS for the parent component that should be contributed last in
order to override CSS of child components.

Children components contribute their CSS in their constructors using
add(new StyleSheetReference("cssId", getClass(), "/css/styles.css")).
I have to use this approach because other approaches don't work with
panel swapping (I have yet to create a JIRA issue for this).

The parent component is contributing CSS by calling
response.renderString("body {background-color:red}") from
IHeaderContributor#renderHead(IHeaderResponse).

I tried contributing parent CSS in parents onInitialize() and
onBeforeRender(), but children's CSS always get written last.

Is there any way to force parent's CSS to be contributed last?

Thanks,

Alec

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



Re: CompoundPropertyModel and Image

2011-04-23 Thread andrea del bene

Hi,

I've checked Image's source class and it seems that it doesn't support 
compound models (see comments in method initModel()).

Hi there,

I have a rather simple problem, but could find a solution yet. I wanna
combine text and an image in ONE model. The image is defined by a
ContextRelativeResource. It works all as assumed, except for the
image. Here the whole thing:

public class Team extends WebPage
{
public static class TeamMember implements Serializable
{
final String name;
final Integer age;
final ContextRelativeResource picture;
//  final PackageResource picture;

public TeamMember (final String name, final Integer age, String 
pic)
{
this.name = name;
this.age = age;
this.picture = new ContextRelativeResource ("image/" + 
pic);
}
}

public Team ()
{
CompoundPropertyModel  tm = new
CompoundPropertyModel  (reneTm) ;
setDefaultModel (tm) ;

add (new Label ("name"));  // works with string
add (new Label ("age"));   // works with Integer

add (new Image ("picture")); // DOESNT WORK??

//  Image image = new Image ("picture", tm.getObject ().picture);
//image.getDefaultModelObject () == NULL  

}
}

For the completeness, here the markup:















It seems, that Image doesnt use the CompoundPropertyModel which I set
as the default model. If I would use Label instead of Image, the
correct ContextRelativeResource will be retrieved from the model.

What did I do wrong, or how to combine text and image in one Model??

Regards,
Rene

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





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



Re: formComponentPanel with content generated by RepeatingView

2011-04-23 Thread kamiseq
heh i thought I was smart :] as each component in FormComponentPanel is
converted and validated so it would be easy to intercept value set on
components model and add it to List (which is model of whole FCPanel)
because Im not really converting components value to something bigger.

the only problem is getting value for each component as interface is only
getObject and setObject so there is no information model could decide which
value goes to which component

;]

pozdrawiam
Paweł Kamiński

kami...@gmail.com
pkaminski@gmail.com
__


CompoundPropertyModel and Image

2011-04-23 Thread Rene Stolle
Hi there,

I have a rather simple problem, but could find a solution yet. I wanna
combine text and an image in ONE model. The image is defined by a
ContextRelativeResource. It works all as assumed, except for the
image. Here the whole thing:

public class Team extends WebPage
{
public static class TeamMember implements Serializable
{
final String name;
final Integer age;
final ContextRelativeResource picture;
//  final PackageResource picture;

public TeamMember (final String name, final Integer age, String 
pic)
{
this.name = name;
this.age = age;
this.picture = new ContextRelativeResource ("image/" + 
pic);
}
}

public Team ()
{
CompoundPropertyModel tm = new
CompoundPropertyModel (reneTm) ;
setDefaultModel (tm) ;

add (new Label ("name"));  // works with string
add (new Label ("age"));   // works with Integer

add (new Image ("picture")); // DOESNT WORK??

//  Image image = new Image ("picture", tm.getObject ().picture);
//image.getDefaultModelObject () == NULL  

}
}

For the completeness, here the markup:















It seems, that Image doesnt use the CompoundPropertyModel which I set
as the default model. If I would use Label instead of Image, the
correct ContextRelativeResource will be retrieved from the model.

What did I do wrong, or how to combine text and image in one Model??

Regards,
Rene

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



Re: Understanding Wicket 1.5 page mapping

2011-04-23 Thread Alexandros Karypidis

Thx!

On Sat, 23 Apr 2011 14:11:56 +0300, Alexandros Karypidis  
 wrote:



Hello,

Could you post some pseudo-code on what your request mapper looks like?  
I have a similar use-case but I wasn't able to follow. I created a  
"MyRequestMapper" class that wraps the default root mapper:


setRootRequestMapper(new MyRequestMapper(getRootRequestMapper()));


public class MyRequestMapper implements IRequestMapper {
private final IRequestMapper wrappedMapper;


public MyRequestMapper(IRequestMapper wrappedMapper) {
this.wrappedMapper = wrappedMapper;
}
...
mapRequest()
mapHandler()
getCompativilityScore()
...
}

Currently I delegate to the "wrapped" handler. What I would like to do  
is peek at the URL (i.e. request.getUrl()), then decide based on some  
logic which page to render. However, mapRequest() returns an  
"IRequestHandler". I would've liked to return same page class like this:



@Override
public IRequestHandler mapRequest(Request request) {
List segments = request.getUrl().getSegments();
if (existsPerson(segments.get(0)) {
==>  return PersonPage.class;
} else if (existsProduct(segments.get(0)) {
==>  return ProductPage.class;
}
return wrappedMapper.mapRequest(request);
}

How would I go about doing that?

On Fri, 22 Apr 2011 23:48:54 +0300, drewzilla80  
 wrote:


Thanks, Martin. That's what I already ended up doing as it turns out (I  
dug

into the code and noticed the method you specified). I've got my whole
original use case working very nicely indeed - thanks for your help.

dz

--
View this message in context:  
http://apache-wicket.1842946.n4.nabble.com/Understanding-Wicket-1-5-page-mapping-tp3467619p3468850.html

Sent from the Users forum mailing list archive at Nabble.com.

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


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


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



Re: Understanding Wicket 1.5 page mapping

2011-04-23 Thread drewzilla80
Try creating a method such as this;

private IRequestHandler renderPage(Class
pageClass, PageParameters pageParameters) {
PageProvider pageProvider = new PageProvider(pageClass,
pageParameters);
pageProvider.setPageSource(Application.get().getMapperContext());
return new RenderPageRequestHandler(pageProvider,
RenderPageRequestHandler.RedirectPolicy.NEVER_REDIRECT);
}

You can call this method from your mapRequest(...) implementation, passing
in the page class and any parameters to go with it.

You don't theoretically need to specify the redirect policy but it is a
workaround due to a bug in 1.5-rc3 that issues 302 redirect when it
shouldn't be doing so.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Understanding-Wicket-1-5-page-mapping-tp3467619p3469896.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: Understanding Wicket 1.5 page mapping

2011-04-23 Thread Alexandros Karypidis

Hello,

Could you post some pseudo-code on what your request mapper looks like? I  
have a similar use-case but I wasn't able to follow. I created a  
"MyRequestMapper" class that wraps the default root mapper:


setRootRequestMapper(new MyRequestMapper(getRootRequestMapper()));


public class MyRequestMapper implements IRequestMapper {
private final IRequestMapper wrappedMapper;


public MyRequestMapper(IRequestMapper wrappedMapper) {
this.wrappedMapper = wrappedMapper;
}
...
mapRequest()
mapHandler()
getCompativilityScore()
...
}

Currently I delegate to the "wrapped" handler. What I would like to do is  
peek at the URL (i.e. request.getUrl()), then decide based on some logic  
which page to render. However, mapRequest() returns an "IRequestHandler".  
I would've liked to return same page class like this:



@Override
public IRequestHandler mapRequest(Request request) {
List segments = request.getUrl().getSegments();
if (existsPerson(segments.get(0)) {
==>  return PersonPage.class;
} else if (existsProduct(segments.get(0)) {
==>  return ProductPage.class;
}
return wrappedMapper.mapRequest(request);
}

How would I go about doing that?

On Fri, 22 Apr 2011 23:48:54 +0300, drewzilla80   
wrote:


Thanks, Martin. That's what I already ended up doing as it turns out (I  
dug

into the code and noticed the method you specified). I've got my whole
original use case working very nicely indeed - thanks for your help.

dz

--
View this message in context:  
http://apache-wicket.1842946.n4.nabble.com/Understanding-Wicket-1-5-page-mapping-tp3467619p3468850.html

Sent from the Users forum mailing list archive at Nabble.com.

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


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