Wicket 7 : Image markup inside label problem

2017-10-22 Thread kyc
During upgrading our site from wicket 1.8 to wicket 7.X, we found problem to
display label with an image path inside.  The problem doesn't happen in
earlier version.

//the following text is store in properties file in real case
String remindMessage = "some text at the beginning 
<\"images/icon/add.gif\">   something text at the end"

form.add(new Label("remindMsg",
remindMessage).setEscapeModelStrings(false));

The label image is displayed correctly first time loading the page. 
However, the render image path does not exist after submit the form.

We have around a hundred of this cases.  Anyone knows good method to do the
fix?




--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

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



Re: Wicket 7 : Image markup inside label problem

2017-10-22 Thread Maxim Solodovnik
Can you provide quick start?

On Mon, Oct 23, 2017 at 11:27 AM, kyc  wrote:

> During upgrading our site from wicket 1.8 to wicket 7.X, we found problem
> to
> display label with an image path inside.  The problem doesn't happen in
> earlier version.
>
> //the following text is store in properties file in real case
> String remindMessage = "some text at the beginning
> <\"images/icon/add.gif\">   something text at the end"
>
> form.add(new Label("remindMsg",
> remindMessage).setEscapeModelStrings(false));
>
> The label image is displayed correctly first time loading the page.
> However, the render image path does not exist after submit the form.
>
> We have around a hundred of this cases.  Anyone knows good method to do the
> fix?
>
>
>
>
> --
> Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-
> f1842947.html
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


-- 
WBR
Maxim aka solomax


Re: Wicket 7 : Image markup inside label problem

2017-10-24 Thread kyc
Hi Maxim,

Thanks for your reply.  The following is sample to repeat the problem

HTML:
http://wicket.apache.org/";>





JAVA: 
public ShowLabelPage() {
super();

String htmlWithImgTag = "some text at the beginning 
<\"images/icon/add.gif\">   something text at the end" ;
add(new Label("message", 
htmlWithImgTag).setEscapeModelStrings(false)); 
}   

URL to load the page 
http://127.0.0.1:8080/PROJ_NAME/Vl6T6Ar3EKbsmKcONvJ0cb8_mXFWRue8M31YADuxq5cljiqq36WNE18GAPuD17Q8SSeAzJ9vUbqR88VssCATvhmaI-sJ571s/Vl64f/l6T59


 

There are images under
WebContent/images/icon/add.gif

















--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

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



Re: Wicket 7 : Image markup inside label problem

2017-10-24 Thread kyc
The following is sample code to repeat the problem.

HTML:
http://wicket.apache.org/";>





JAVA: 
public ShowLabelPage() {
super();

String htmlWithImgTag = "some text at the beginning 
<\"images/icon/add.gif\">   something text at the end" ;
add(new Label("message", 
htmlWithImgTag).setEscapeModelStrings(false)); 
}   

URL to load the page 
http://127.0.0.1:8080/PROJ_NAME/Vl6T6Ar3EKbsmKcONvJ0cb8_mXFWRue8M31YADuxq5cljiqq36WNE18GAPuD17Q8SSeAzJ9vUbqR88VssCATvhmaI-sJ571s/Vl64f/l6T59


 

There are images under
WebContent/images/icon/add.gif













--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

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



Re: Wicket 7 : Image markup inside label problem

2017-10-24 Thread Maxim Solodovnik
I was hoping to see quickstart  :)
So I have created one for you: https://github.com/solomax/label-with-image
It seems to work as expected
Please check it and compare with your code

On Wed, Oct 25, 2017 at 10:30 AM, kyc  wrote:

> The following is sample code to repeat the problem.
>
> HTML:
> http://wicket.apache.org/";>
> 
>
> 
> 
>
> JAVA:
> public ShowLabelPage() {
> super();
>
> String htmlWithImgTag = "some text at the beginning
> <\"images/icon/add.gif\">   something text at the end" ;
> add(new Label("message", htmlWithImgTag).
> setEscapeModelStrings(false));
> }
>
> URL to load the page
> http://127.0.0.1:8080/PROJ_NAME/Vl6T6Ar3EKbsmKcONvJ0cb8_
> mXFWRue8M31YADuxq5cljiqq36WNE18GAPuD17Q8SSeAzJ9vUbqR88VssCAT
> vhmaI-sJ571s/Vl64f/l6T59
>
>  Screenshot_-_10_25_2017_%2C_11_23_28_AM.png>
>
> There are images under
> WebContent/images/icon/add.gif
>
>
>
>
>
>
>
>
>
>
>
>
>
> --
> Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-
> f1842947.html
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


-- 
WBR
Maxim aka solomax


Re: Wicket 7 : Image markup inside label problem

2017-10-24 Thread kyc
You need to add the following to WicketApplication.java to reach the problem


setRootRequestMapper(new CryptoMapper(getRootRequestMapper(), this)); 



My whole site is encrypted and the slashes are included in the encrypted
characters causing the problem

Broken image path: 
http://127.0.0.1:8080/PROJ_NAME/Vl6T6Ar3EKbsmKcONvJ0cb8_mXFWRue8M31YADuxq5cljiqq36WNE18GAPuD17Q8SSeAzJ9vUbqR88VssCATvhmaI-sJ571s/Vl64f/images/icon/add.gif
 


--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

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



Re: Wicket 7 : Image markup inside label problem

2017-10-24 Thread Maxim Solodovnik
I have added mapper
https://github.com/solomax/label-with-image/commit/743af75f453952361ef49ee4d13a774a040581bc
Everything seems to work

I'm using "mvn clean jetty:run" command

On Wed, Oct 25, 2017 at 11:15 AM, kyc  wrote:

> You need to add the following to WicketApplication.java to reach the
> problem
>
> setRootRequestMapper(new CryptoMapper(getRootRequestMapper(), this));
>
>
>
> My whole site is encrypted and the slashes are included in the encrypted
> characters causing the problem
>
> Broken image path:
> http://127.0.0.1:8080/PROJ_NAME/Vl6T6Ar3EKbsmKcONvJ0cb8_
> mXFWRue8M31YADuxq5cljiqq36WNE18GAPuD17Q8SSeAzJ9vUbqR88VssCAT
> vhmaI-sJ571s/Vl64f/images/icon/add.gif
>
>
> --
> Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-
> f1842947.html
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


-- 
WBR
Maxim aka solomax


Re: Wicket 7 : Image markup inside label problem

2017-10-24 Thread kyc
Add one more level, you can see the problem

1. Copy HomePage .java .html to DetailPage .java .html in the same folder

2. In HomePage.java, add the following code:

add(new Link("goDetail"){
@Override
public void onClick() {
setResponsePage(DetailPage.class);
}
});

3. In HomePage.html


--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

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



Re: Wicket 7 : Image markup inside label problem

2017-10-25 Thread Maxim Solodovnik
OK I have updated quick-start with additional page

The behavior you are observing is reproducible
The issue seems to be caused by the fact image URL is relative
In the updated quickstart I made it absolute and everything works as
expected

PS please propose PRs to this simple quick-start to speed-up investigating
:)

On Wed, Oct 25, 2017 at 1:34 PM, kyc  wrote:

> Add one more level, you can see the problem
>
> 1. Copy HomePage .java .html to DetailPage .java .html in the same folder
>
> 2. In HomePage.java, add the following code:
>
> add(new Link("goDetail"){
> @Override
> public void onClick() {
> setResponsePage(DetailPage.class);
> }
> });
>
> 3. In HomePage.html
>
>
> --
> Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-
> f1842947.html
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


-- 
WBR
Maxim aka solomax


Re: Wicket 7 : Image markup inside label problem

2017-10-25 Thread kyc
We have hundreds of html code with image tags in properties file which is a
little bit different with the simple quick-start example.  Therefore, we
don't prefer to wrapped the Label tag to solve the problem. 

(We try this
https://ci.apache.org/projects/wicket/guide/7.x/single.html#_generating_html_markup_from_code
but not like this solution)

We are looking a solution to make a single point of change.

--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

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



Re: Wicket 7 : Image markup inside label problem

2017-10-25 Thread Maxim Solodovnik
You can register additional ResourceMapper at application level which will
serve images from images/ folder
This way static image URL will be crypted 

On Thu, Oct 26, 2017 at 9:29 AM, kyc  wrote:

> We have hundreds of html code with image tags in properties file which is a
> little bit different with the simple quick-start example.  Therefore, we
> don't prefer to wrapped the Label tag to solve the problem.
>
> (We try this
> https://ci.apache.org/projects/wicket/guide/7.x/
> single.html#_generating_html_markup_from_code
> but not like this solution)
>
> We are looking a solution to make a single point of change.
>
> --
> Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-
> f1842947.html
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


-- 
WBR
Maxim aka solomax


Re: Wicket 7 : Image markup inside label problem

2017-10-25 Thread kyc
Do you know the exact coding?   I can’t find the solution in the existing
resources.

--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

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



Re: Wicket 7 : Image markup inside label problem

2017-10-26 Thread Maxim Solodovnik
Hello,

just have checked everything one more time.
After following changes are made:
https://github.com/solomax/label-with-image/commit/578cf393e46d7f51f6fc7754c2e27a943096850e
everything works as expected with relative URLs
The reason is: image location  is invalid
for DetailPage, as soon as it is changed to be valid:
../../images/icon/add.png everything works flawlesly

Maybe you can unify your code as follows:
1) change all  inside labels with 
2) create CSS .add with background image of your choice
3) get working app :)))

On Thu, Oct 26, 2017 at 10:25 AM, kyc  wrote:

> Do you know the exact coding?   I can’t find the solution in the existing
> resources.
>
> --
> Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-
> f1842947.html
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


-- 
WBR
Maxim aka solomax


Re: Wicket 7 : Image markup inside label problem

2017-10-26 Thread kyc
In real case, the htmlWithImgTag is shared to use in both pages (locating in
properties files).  Moreover, the encrytped path is not guarantee the
slashes generated. 

If I have hundreds of this kind of code to upgrade, it is difficult to
convert all to css (not guarantee it works) and the code is not
maintainable.

--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

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



Re: Wicket 7 : Image markup inside label problem

2017-10-26 Thread Maxim Solodovnik
Actually CSS solution is more maintainable because
1) your label is created once for ex. as 
2) later on you can change size, image, border etc. without updating your
label
3) your label in this case can be on any level of your application i.e.
same label can be used on /home, /home/my/, /home/my/test .. it will
work since all image paths are relative to CSS
4) you can re-use same CSS class anywhere in your code
5) both CSS and images will be better cached
6) images can be inlined this will give you performance increase by
reducing the number of requests
7) you can provide CSS specializations to change the look of your
".image-add" based on parent element without any changes to labels :)

same time "the encrytped path is not guarantee the slashes generated" this
means you have to specify absolute path to your images or handle the depth
by your-self :(

In my applications I prefer to use CSS 


On Fri, Oct 27, 2017 at 8:25 AM, kyc  wrote:

> In real case, the htmlWithImgTag is shared to use in both pages (locating
> in
> properties files).  Moreover, the encrytped path is not guarantee the
> slashes generated.
>
> If I have hundreds of this kind of code to upgrade, it is difficult to
> convert all to css (not guarantee it works) and the code is not
> maintainable.
>
> --
> Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-
> f1842947.html
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


-- 
WBR
Maxim aka solomax