Re: show image retrieved from database

2015-03-25 Thread sabmoonie
I've been searching for solutions on how to show an image using its
location(absolute path) and your code helped me a lot. Been under stress the
past days due to this problem. Thanks Mr. ORACLEADF! 

Btw, for those who wants to know how to convert a File() to byte[] use this:

try {
File file = new File(imagefilePath);
byte[] byteArray = new byte[file.length()]();
byteArray = FileUtils.readFileToByteArray(file);  
 }catch(Exception e){
 e.printStackTrace();

 }


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/show-image-retrieved-from-database-tp4658009p4670098.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: AjaxRequests and middle mouse-clicks on links and buttons

2015-03-25 Thread Martin Grigorov
Hi,

I don't use a mouse (and I have no one around) so I cannot test the use
case.
I cannot see how
org.apache.wicket.ajax.markup.html.form.AjaxButton#onSubmit(org.apache.wicket.ajax.AjaxRequestTarget,
org.apache.wicket.markup.html.form.Form)
or 
org.apache.wicket.ajax.markup.html.AjaxLink#onClick(org.apache.wicket.ajax.AjaxRequestTarget)
would deliver null as a target.
The target is created
at org.apache.wicket.ajax.AbstractDefaultAjaxBehavior#onRequest(). Put a
breakpoint there is see what happens.

Martin Grigorov
Freelancer, available for hire!
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Wed, Mar 25, 2015 at 3:33 PM, Patrick Davids <
patrick.dav...@nubologic.com> wrote:

> Hi all,
> I have a problem here, I would like to ask you for feedback.
>
> I am not sure, if its more a jquery/js / wicket issue, so thanx in advance
> for any brainstorming and hints.
>
> Browsers often features the middle mouse button to open a link or button
> in a new tab.
> This is quite browser-specific, so I'm looking for the most independent
> solution.
>
> Clicking the middle mouse on a ajaxified Link or Button, the browser opens
> a new tab and starts a usual request cycle.
>
> This leads into wicket call e.g.
> onClick(AjaxRequestTarget target)
> but then the target parameter is null.
> (I cannot use AjaxFallbackLinks in my case)
>
> I'm able to handle this NPEs by implementing null-checks on every ajax
> link.
> Hmm... not the perfect solution.
>
> So, I could try to prevent middle mouse clicks by a global javascript on
> all pages.
> I've seen several scripts, and here also it seems to be very
> browser-specific (mousewheel, or not... event.which seem to differ and
> so...).
> Also, not my favorite solution, yet.
>
> Then I thought about wicket solution. Is there any possible way?
> I know about a IComponentOnConfigureListener, which can be used to have to
> implement an application-wide onConfigure() for any component in page
> hierarchy.
> Is there something siilar e.g. IComponentOnAjaxRequestListener?
> So I could implement some code there, checking for null and stop any
> further code-calls on ajaxified wicket components, to avoid running into
> NPEs in later code?
>
> All these are my thoughts for now.
>
> Thanx a lot for feedback...
>
> kind regards
> Patrick
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: Wicket in web-fragments environment

2015-03-25 Thread Martin Grigorov
Good to know there is no problem on our side!
Thanks, Patrick!

Martin Grigorov
Freelancer, available for hire!
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Wed, Mar 25, 2015 at 3:11 PM, Patrick Davids <
patrick.dav...@nubologic.com> wrote:

> Hi Martin,
> while creating the quickstart the problem disappeared.
> Its working.
>
> I figured out, I had some wrong configurations in my m2e eclipse project
> specific settings while migration my project structure to web-fragments
> structure.
> Due to that my classpatch settings were wrong and packaging of jars were
> incorrect. ;-)
>
> kind regards
> Patrick
>
> Am 17.03.2015 um 10:47 schrieb Martin Grigorov:
>
>> Oh, right!
>>
>> So /META-INF/web-fragment.xml and de.example.infrastructure.wicket.
>> MyWicketApplication are in the same .jar file ?
>> It seems the code at
>> https://github.com/apache/wicket/blob/master/wicket-
>> core/src/main/java/org/apache/wicket/protocol/http/
>> ContextParamWebApplicationFactory.java#L64-L72
>> doesn't work in this case.
>> Please create a quickstart and attach it to a ticket in JIRA.
>> Thanks!
>>
>>
>>
>> Martin Grigorov
>> Freelancer, available for hire!
>> Wicket Training and Consulting
>> https://twitter.com/mtgrigorov
>>
>> On Tue, Mar 17, 2015 at 11:24 AM, Patrick Davids <
>> patrick.dav...@nubologic.com> wrote:
>>
>>  I dont have a annotated WebFilter sub-class.
>>>
>>> I just splitted my web.xml into fragments.
>>> So, my web-fragment.xml looks like this.
>>>
>>>
>>> http://java.sun.com/xml/ns/javaee";
>>>   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>>>   xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
>>> http://java.sun.com/xml/ns/javaee/web-fragment_3_0.xsd";
>>>   version="3.0"
>>>   id="myApp">
>>>
>>>  
>>>  wicket.myapp
>>>  org.apache.wicket.protocol.http.
>>> WicketFilter
>>>  
>>>  applicationClassName
>>>   de.example.infrastructure.wicket.
>>> MyWicketApplication
>>>  
>>>  
>>>
>>>  
>>>  wicket.myapp
>>>  /*
>>>  
>>>
>>>
>>> 
>>>
>>> Patrick
>>>
>>> Am 17.03.2015 um 10:10 schrieb Martin Grigorov:
>>>
>>>  Please share also the code of the @WebFilter class.

 Martin Grigorov
 Freelancer, available for hire!
 Wicket Training and Consulting
 https://twitter.com/mtgrigorov

 On Tue, Mar 17, 2015 at 11:01 AM, Patrick Davids <
 patrick.dav...@nubologic.com> wrote:

   Hi Martin,

> sorry, for delay...
>
> This is the stacktrace.
>
> kind regards
> Patrick
>
> Information: Starting Servlet Engine: Apache Tomcat/7.0.59
> ERROR [WicketFilter] - The initialization of an application with name
> 'wicket.myapp' has failed.
> org.apache.wicket.WicketRuntimeException: Unable to create application
> of
> class de.example.infrastructure.wicket.MyWicketApplication
>   at org.apache.wicket.protocol.http.
> ContextParamWebApplicationFact
> ory.createApplication(ContextParamWebApplicationFactory.java:86)
>   at org.apache.wicket.protocol.http.
> ContextParamWebApplicationFact
> ory.createApplication(ContextParamWebApplicationFactory.java:50)
>   at org.apache.wicket.protocol.http.WicketFilter.init(
> WicketFilter.java:387)
>   at org.apache.wicket.protocol.http.WicketFilter.init(
> WicketFilter.java:353)
>   at org.apache.catalina.core.ApplicationFilterConfig.
> initFilter(
> ApplicationFilterConfig.java:279)
>   at org.apache.catalina.core.ApplicationFilterConfig.
> getFilter(
> ApplicationFilterConfig.java:260)
>   at org.apache.catalina.core.ApplicationFilterConfig.
> (ApplicationFilterConfig.java:105)
>   at org.apache.catalina.core.StandardContext.filterStart(
> StandardContext.java:4854)
>   at org.apache.catalina.core.StandardContext.startInternal(
> StandardContext.java:5542)
>   at org.apache.catalina.util.LifecycleBase.start(
> LifecycleBase.java:150)
>   at org.apache.catalina.core.ContainerBase$StartChild.call(
> ContainerBase.java:1575)
>   at org.apache.catalina.core.ContainerBase$StartChild.call(
> ContainerBase.java:1565)
>   at java.util.concurrent.FutureTask.run(FutureTask.java:262)
>   at java.util.concurrent.ThreadPoolExecutor.runWorker(
> ThreadPoolExecutor.java:1145)
>   at java.util.concurrent.ThreadPoolExecutor$Worker.run(
> ThreadPoolExecutor.java:615)
>   at java.lang.Thread.run(Thread.java:744)
> Caused by: java.lang.ClassNotFoundException:
> de.example.infrastructure.
> wicket.MyWicketApplication
>   at org.apache.catalina.loader.WebappClassLoader.loadClass(
> WebappClassLoader.java:1720)
>

Re: Issues with multiple FeedbackPanels

2015-03-25 Thread mscoon
Hi,

Feedback panels show all messages by default. You will need to provide a
way for them to filter the messages that each should show.

Look at FeedbackPanel#setFilter(IFeedbackMessageFilter).

Marios

On Wed, Mar 25, 2015 at 2:46 PM, avchavan 
wrote:

> Hi, I have 2 FeedbackPanels on my screen and whenever i try to set error it
> gets added to both the FeedbackPanels.
>
> final FeedbackPanel panel1 = new FeedbackPanel("panel1");
> final FeedbackPanel panel2 = new FeedbackPanel("panel2");
> //vdp & gdp are some dataproviders i have
> if (vdp.hasError()){
> toonMeer.setVisible(false);
>
>
> vertegenwoordigdeMelding.error(this.funcMeldingen.getMessage(vdp.getErrorcode()));
> vertegenwoordigdeMelding.add(new
> AttributeModifier("style",
> "color:red"));
> vertegenwoordigdeMelding.setVisible(true);
> }else if((int)vdp.size() == 0){
> vertegenwoordigdeMelding.info("U bent door niemand
> vertegenwoordigde");
> vertegenwoordigdeMelding.add(new
> AttributeModifier("style", ""));
> vertegenwoordigdeMelding.setVisible(true);
> }
>
> if (gdp.hasError()){
> toonMeer2.setVisible(false);
>
>
> gemachtigdeMelding.error(this.funcMeldingen.getMessage(gdp.getErrorcode()));
> gemachtigdeMelding.add(new
> AttributeModifier("style", "color:red"));
> gemachtigdeMelding.setVisible(true);
> }else if((int)gdp.size() == 0){
> gemachtigdeMelding.info("U bent door niemand
> gemachtigd");
> gemachtigdeMelding.add(new
> AttributeModifier("style", ""));
> gemachtigdeMelding.setVisible(true);
> }
>
> I have a listView as well which sets the error in certain scenarios:
> if(this.panel.equalsIgnoreCase("panel1")){
> this.getParent().getParent().get("panel1").error("some message");
> this.getParent().getParent().get("panel1").setVisible(true);
> }else{
> this.getParent().getParent().get("panel2").error("some message");
> this.getParent().getParent().get("panel2").setVisible(true);
> }
> The code works but the messages are displayed in both the FeedbackPanels.
>
> Could you please guide me in right direction?
> Thanks.
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Issues-with-multiple-FeedbackPanels-tp4670087.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
>
>


AjaxRequests and middle mouse-clicks on links and buttons

2015-03-25 Thread Patrick Davids

Hi all,
I have a problem here, I would like to ask you for feedback.

I am not sure, if its more a jquery/js / wicket issue, so thanx in 
advance for any brainstorming and hints.


Browsers often features the middle mouse button to open a link or button 
in a new tab.
This is quite browser-specific, so I'm looking for the most independent 
solution.


Clicking the middle mouse on a ajaxified Link or Button, the browser 
opens a new tab and starts a usual request cycle.


This leads into wicket call e.g.
onClick(AjaxRequestTarget target)
but then the target parameter is null.
(I cannot use AjaxFallbackLinks in my case)

I'm able to handle this NPEs by implementing null-checks on every ajax link.
Hmm... not the perfect solution.

So, I could try to prevent middle mouse clicks by a global javascript on 
all pages.
I've seen several scripts, and here also it seems to be very 
browser-specific (mousewheel, or not... event.which seem to differ and 
so...).

Also, not my favorite solution, yet.

Then I thought about wicket solution. Is there any possible way?
I know about a IComponentOnConfigureListener, which can be used to have 
to implement an application-wide onConfigure() for any component in page 
hierarchy.

Is there something siilar e.g. IComponentOnAjaxRequestListener?
So I could implement some code there, checking for null and stop any 
further code-calls on ajaxified wicket components, to avoid running into 
NPEs in later code?


All these are my thoughts for now.

Thanx a lot for feedback...

kind regards
Patrick

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



Re: Wicket in web-fragments environment

2015-03-25 Thread Patrick Davids

Hi Martin,
while creating the quickstart the problem disappeared.
Its working.

I figured out, I had some wrong configurations in my m2e eclipse project 
specific settings while migration my project structure to web-fragments 
structure.
Due to that my classpatch settings were wrong and packaging of jars were 
incorrect. ;-)


kind regards
Patrick

Am 17.03.2015 um 10:47 schrieb Martin Grigorov:

Oh, right!

So /META-INF/web-fragment.xml and de.example.infrastructure.wicket.
MyWicketApplication are in the same .jar file ?
It seems the code at
https://github.com/apache/wicket/blob/master/wicket-core/src/main/java/org/apache/wicket/protocol/http/ContextParamWebApplicationFactory.java#L64-L72
doesn't work in this case.
Please create a quickstart and attach it to a ticket in JIRA.
Thanks!



Martin Grigorov
Freelancer, available for hire!
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Tue, Mar 17, 2015 at 11:24 AM, Patrick Davids <
patrick.dav...@nubologic.com> wrote:


I dont have a annotated WebFilter sub-class.

I just splitted my web.xml into fragments.
So, my web-fragment.xml looks like this.


http://java.sun.com/xml/ns/javaee";
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-fragment_3_0.xsd";
  version="3.0"
  id="myApp">

 
 wicket.myapp
 org.apache.wicket.protocol.http.
WicketFilter
 
 applicationClassName
  de.example.infrastructure.wicket.
MyWicketApplication
 
 

 
 wicket.myapp
 /*
 




Patrick

Am 17.03.2015 um 10:10 schrieb Martin Grigorov:


Please share also the code of the @WebFilter class.

Martin Grigorov
Freelancer, available for hire!
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Tue, Mar 17, 2015 at 11:01 AM, Patrick Davids <
patrick.dav...@nubologic.com> wrote:

  Hi Martin,

sorry, for delay...

This is the stacktrace.

kind regards
Patrick

Information: Starting Servlet Engine: Apache Tomcat/7.0.59
ERROR [WicketFilter] - The initialization of an application with name
'wicket.myapp' has failed.
org.apache.wicket.WicketRuntimeException: Unable to create application
of
class de.example.infrastructure.wicket.MyWicketApplication
  at org.apache.wicket.protocol.http.
ContextParamWebApplicationFact
ory.createApplication(ContextParamWebApplicationFactory.java:86)
  at org.apache.wicket.protocol.http.
ContextParamWebApplicationFact
ory.createApplication(ContextParamWebApplicationFactory.java:50)
  at org.apache.wicket.protocol.http.WicketFilter.init(
WicketFilter.java:387)
  at org.apache.wicket.protocol.http.WicketFilter.init(
WicketFilter.java:353)
  at org.apache.catalina.core.ApplicationFilterConfig.initFilter(
ApplicationFilterConfig.java:279)
  at org.apache.catalina.core.ApplicationFilterConfig.getFilter(
ApplicationFilterConfig.java:260)
  at org.apache.catalina.core.ApplicationFilterConfig.
(ApplicationFilterConfig.java:105)
  at org.apache.catalina.core.StandardContext.filterStart(
StandardContext.java:4854)
  at org.apache.catalina.core.StandardContext.startInternal(
StandardContext.java:5542)
  at org.apache.catalina.util.LifecycleBase.start(
LifecycleBase.java:150)
  at org.apache.catalina.core.ContainerBase$StartChild.call(
ContainerBase.java:1575)
  at org.apache.catalina.core.ContainerBase$StartChild.call(
ContainerBase.java:1565)
  at java.util.concurrent.FutureTask.run(FutureTask.java:262)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(
ThreadPoolExecutor.java:1145)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(
ThreadPoolExecutor.java:615)
  at java.lang.Thread.run(Thread.java:744)
Caused by: java.lang.ClassNotFoundException: de.example.infrastructure.
wicket.MyWicketApplication
  at org.apache.catalina.loader.WebappClassLoader.loadClass(
WebappClassLoader.java:1720)
  at org.apache.catalina.loader.WebappClassLoader.loadClass(
WebappClassLoader.java:1571)
  at java.lang.Class.forName0(Native Method)
  at java.lang.Class.forName(Class.java:270)
  at org.apache.wicket.protocol.http.
ContextParamWebApplicationFact
ory.createApplication(ContextParamWebApplicationFactory.java:72)
  ... 15 more
Mrz 17, 2015 8:22:57 AM org.apache.catalina.core.StandardContext
filterStart
Schwerwiegend: Exception starting filter wicket.myapp
javax.servlet.ServletException: org.apache.wicket.
WicketRuntimeException:
Unable to create application of class de.example.infrastructure.
wicket.MyWicketApplication
  at org.apache.wicket.protocol.http.WicketFilter.init(
WicketFilter.java:452)
  at org.apache.wicket.protocol.http.WicketFilter.init(
WicketFilter.java:353)
  

Issues with multiple FeedbackPanels

2015-03-25 Thread avchavan
Hi, I have 2 FeedbackPanels on my screen and whenever i try to set error it
gets added to both the FeedbackPanels.

final FeedbackPanel panel1 = new FeedbackPanel("panel1");
final FeedbackPanel panel2 = new FeedbackPanel("panel2");
//vdp & gdp are some dataproviders i have
if (vdp.hasError()){
toonMeer.setVisible(false);

vertegenwoordigdeMelding.error(this.funcMeldingen.getMessage(vdp.getErrorcode()));
vertegenwoordigdeMelding.add(new 
AttributeModifier("style",
"color:red"));
vertegenwoordigdeMelding.setVisible(true);
}else if((int)vdp.size() == 0){
vertegenwoordigdeMelding.info("U bent door niemand 
vertegenwoordigde");
vertegenwoordigdeMelding.add(new 
AttributeModifier("style", ""));
vertegenwoordigdeMelding.setVisible(true);
}

if (gdp.hasError()){
toonMeer2.setVisible(false);

gemachtigdeMelding.error(this.funcMeldingen.getMessage(gdp.getErrorcode()));
gemachtigdeMelding.add(new AttributeModifier("style", 
"color:red"));
gemachtigdeMelding.setVisible(true);
}else if((int)gdp.size() == 0){
gemachtigdeMelding.info("U bent door niemand 
gemachtigd");
gemachtigdeMelding.add(new AttributeModifier("style", 
""));
gemachtigdeMelding.setVisible(true);
}

I have a listView as well which sets the error in certain scenarios:
if(this.panel.equalsIgnoreCase("panel1")){
this.getParent().getParent().get("panel1").error("some message");
this.getParent().getParent().get("panel1").setVisible(true);
}else{
this.getParent().getParent().get("panel2").error("some message");
this.getParent().getParent().get("panel2").setVisible(true);
}
The code works but the messages are displayed in both the FeedbackPanels.

Could you please guide me in right direction?
Thanks.


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Issues-with-multiple-FeedbackPanels-tp4670087.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