DB lookup time-out within DataTable Iterator

2010-09-06 Thread Frank Prins
Hi guys!
 
Breaking my head on the following, hopefully someone might be able to
give me a hint?
 
In a page which serves a view on a log database with quite a lot of
rows, I am using a DataTable to show the rows. The data for the table is
being served by a SortableDataProvider which looks a bit like this:
 
<...>
  public SortableSystemlogDataProvider(Map searchParams) {
// creating new instance, set default sorting, Search parameters,
counting dataset
this.dao = new H2InterfaceDaoImpl();
setSort("sl_id", false);
this.searchParams = searchParams;
this.systemlogListSize = dao.countAllSystemlogRows(searchParams);
  }
 
  public Iterator iterator(int first, int count) {
SortParam sp = getSort();
if (sp.getProperty() == null) {
  setSort("sl_id", false);
  sp = getSort();
}
// return iterator on search list by params
paginatedList = dao.selectSystemlogs(this.searchParams,
sp.getProperty(), sp.isAscending(), first, count);
return paginatedList.iterator();
  }
<...>

The issue I am running into at this moment is this: in case of large
datasets, the db call from within the iterator gives a timeout, and
returns null. In this case I would like to give the user a warning
modalwindow and the possibility to change the search options. Of course
I am able to catch the timeout, and return an empty set, but I cannot
see how to move on from that, as I am already within the DataTable.

Anyone has an idea on this?

Thanks in advance, regards,
Frank Prins

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



Re: Alert on ajax activity

2010-09-06 Thread koki142

Thank you all for your replies, I did what Pedro said and it works exactly as
I wanted!!!

Thanks!!
Oskar

-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Alert-on-ajax-activity-tp2527887p2529111.html
Sent from the Wicket - User 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: StringResourceModel - On the Fly

2010-09-06 Thread msantos

Thats solve the problem. I already have a resource bundle on the application,
but i was trying to eliminate it and just use the wicket StringResourceModel
witch is more easy to maintain all the pages of the application.

If there is no way to get the string from the .properties file of the page
on that moment, a i guess i will use the Java ResourceBundle.

Thank you all
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/StringResourceModel-On-the-Fly-tp2528345p2528689.html
Sent from the Wicket - User 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: StringResourceModel - On the Fly

2010-09-06 Thread Pedro Santos
Won't be reasonable use ResourceBundle directly in your case? Like:
ResourceBundle.getBundle( *.properties, locale).getString("msgResult")
Otherwise StringResourceModel just would delegate your call to this api...

On Mon, Sep 6, 2010 at 10:00 AM, msantos  wrote:

>
> Hello there.
>
> I am using the StringResourceModel to get from the *.properties file
> strings
> to the pages of my web app. and it is working fine.
>
> For instance:
>
> StringResourceModel emailLabelModel = new StringResourceModel("emailLabel",
> null);
> emailLabel = new Label("emailLabel", emailLabelModel);
>
> But when i need string from the file on the fly, not on the rendering fase,
> it raise an exception:
>
> StringResourceModel resultadoMsgModel = new
> StringResourceModel("msgResult",
> null);
> resultadoMsgModel.getString();
>
> java.util.MissingResourceException: Unable to find property: 'msgResult'
>
> Someone can explain why it happens and how can i get it work?
>
> Thanks a lot
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/StringResourceModel-On-the-Fly-tp2528345p2528345.html
> Sent from the Wicket - User 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
>
>


-- 
Pedro Henrique Oliveira dos Santos


Re: StringResourceModel - On the Fly

2010-09-06 Thread Gonzalo Aguilar Delgado
To be more clear I will paste some code:

public class Foo
{
public String getSomething()
{
frase = "field " + filterData.getFieldName() + " of " +
criteria.getDescription() + " is equal to " +
filter.getDataValue().getValue();

{

}

Should be translated to something similar to

"field ${fieldName} of ${fieldDescription} is equal to
${fieldDataValue}"

And have a way to access this as if we were in a component.

But how to do it inside a class that is not a component?



El lun, 06-09-2010 a las 18:41 +0200, Gonzalo Aguilar Delgado escribió:
> Hi MSantos, 
> 
> I have similar problem. I want to localize a string inside a class, but
> I think your approach is not the good solution. I will look around but
> If someone has any alternatives please say...
> 
> 
> Tnx.
> 
> 
> El lun, 06-09-2010 a las 06:00 -0700, msantos escribió:
> > Hello there. 
> > 
> > I am using the StringResourceModel to get from the *.properties file strings
> > to the pages of my web app. and it is working fine.
> > 
> > For instance: 
> > 
> > StringResourceModel emailLabelModel = new StringResourceModel("emailLabel",
> > null);
> > emailLabel = new Label("emailLabel", emailLabelModel);
> > 
> > But when i need string from the file on the fly, not on the rendering fase,
> > it raise an exception:
> > 
> > StringResourceModel resultadoMsgModel = new StringResourceModel("msgResult",
> > null);
> > resultadoMsgModel.getString();
> > 
> > java.util.MissingResourceException: Unable to find property: 'msgResult'
> > 
> > Someone can explain why it happens and how can i get it work?
> > 
> > Thanks a lot
> 
> 
> -
> 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: StringResourceModel - On the Fly

2010-09-06 Thread Gonzalo Aguilar Delgado
Hi MSantos, 

I have similar problem. I want to localize a string inside a class, but
I think your approach is not the good solution. I will look around but
If someone has any alternatives please say...


Tnx.


El lun, 06-09-2010 a las 06:00 -0700, msantos escribió:
> Hello there. 
> 
> I am using the StringResourceModel to get from the *.properties file strings
> to the pages of my web app. and it is working fine.
> 
> For instance: 
> 
> StringResourceModel emailLabelModel = new StringResourceModel("emailLabel",
> null);
> emailLabel = new Label("emailLabel", emailLabelModel);
> 
> But when i need string from the file on the fly, not on the rendering fase,
> it raise an exception:
> 
> StringResourceModel resultadoMsgModel = new StringResourceModel("msgResult",
> null);
> resultadoMsgModel.getString();
> 
> java.util.MissingResourceException: Unable to find property: 'msgResult'
> 
> Someone can explain why it happens and how can i get it work?
> 
> Thanks a lot


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



Re: Replace components with AjaxCheckbox

2010-09-06 Thread Igor Vaynberg
component = new Label("component", "is checked");
orginalComponent=component

-igor

On Mon, Sep 6, 2010 at 4:38 AM, Johan Haleby  wrote:
>
> I'm trying to replace a component when clicking on an AjaxCheckbox. The code
> looks something like this:
>
> AjaxCheckBox checkbox = new AjaxCheckBox("checkBox", new
> PropertyModel(this, "isChecked")) {
>        private static final long serialVersionUID = 4298312627418158465L;
>
>       �...@override
>        protected void onUpdate(AjaxRequestTarget target) {
>                final Component component;
>                if (isChecked) {
>                        System.out.println("is checked");
>                        component = new Label("component", "is checked");
>                } else {
>                        System.out.println("is NOT checked");
>                        component = originalComponent;
>                }
>                form.replace(component);
>                target.addComponent(form);
>        }
>
>       �...@override
>        protected boolean wantOnSelectionChangedNotifications() {
>                return true;
>        }
> };
>
> It works fine the first time I click on the check box, i.e. "is checked" is
> printed to the console and the label "is checked" is shown on the web pagfe.
> But when I click on the checkbox again (to uncheck it) "originalComponent"
> is never shown but "is NOT checked" is printed in the console. What am I
> doing wrong?
>
> /Johan
> --
> View this message in context: 
> http://apache-wicket.1842946.n4.nabble.com/Replace-components-with-AjaxCheckbox-tp2528243p2528243.html
> Sent from the Wicket - User 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



Re: Replace components with AjaxCheckbox

2010-09-06 Thread Alexander Morozov

Check this:
if (isChecked) { 
System.out.println("is checked"); 
component = new Label("component", "is checked"); 
/* output markup ID */
component.setOutputMarkupId(true);
} else { 
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Replace-components-with-AjaxCheckbox-tp2528243p2528388.html
Sent from the Wicket - User 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



StringResourceModel - On the Fly

2010-09-06 Thread msantos

Hello there. 

I am using the StringResourceModel to get from the *.properties file strings
to the pages of my web app. and it is working fine.

For instance: 

StringResourceModel emailLabelModel = new StringResourceModel("emailLabel",
null);
emailLabel = new Label("emailLabel", emailLabelModel);

But when i need string from the file on the fly, not on the rendering fase,
it raise an exception:

StringResourceModel resultadoMsgModel = new StringResourceModel("msgResult",
null);
resultadoMsgModel.getString();

java.util.MissingResourceException: Unable to find property: 'msgResult'

Someone can explain why it happens and how can i get it work?

Thanks a lot
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/StringResourceModel-On-the-Fly-tp2528345p2528345.html
Sent from the Wicket - User 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: Alert on ajax activity

2010-09-06 Thread robert.mcguinness


this snippet was handed to me long ago and I've slightly modified over time.



$().ready(function() {
$(document).click(clickFunc);

hideBusysign();

if (typeof Wicket == 'object' && typeof Wicket.Ajax == 'object') {
Wicket.Ajax.registerPreCallHandler(showBusysign);
Wicket.Ajax.registerPostCallHandler(hideBusysign);
Wicket.Ajax.registerFailureHandler(hideBusysign);
}

function hideBusysign() {
$("#ajaxLoader").hide();
}

function showBusysign() {
var ajaxLoader = $("#ajaxLoader");
var scrollPosition = $(window).scrollTop();
ajaxLoader.css('top', scrollPosition);
ajaxLoader.css('left', 20);
ajaxLoader.show();
}

function clickFunc(eventData) {

// IGNORE RIGHT CLICKS
if (window.event && event.button == 2) {
return;
}else if (eventData.which == 3) {
return;
}

var clickedElement = (window.event) ? event.srcElement :
eventData.target;
if ((clickedElement.tagName.toUpperCase() == 'A' &&
((clickedElement.target == null) || (clickedElement.target.length <= 0))
&& (clickedElement.href.lastIndexOf('#') !=
(clickedElement.href.length - 1)) && (!('nobusy' in clickedElement))
&& (clickedElement.href.indexOf('mailto') < 0)
&& (clickedElement.href.indexOf('WicketAjaxDebug') < 0) &&
(clickedElement.href.lastIndexOf('.doc') != (clickedElement.href.length -
4))
&& (clickedElement.href.lastIndexOf('.csv') !=
(clickedElement.href.length - 4))
&& (clickedElement.href.lastIndexOf('.xls') !=
(clickedElement.href.length - 4)) && ((clickedElement.onclick == null) ||
(clickedElement.onclick
.toString().indexOf('window.open') <= 0))
|| (clickedElement.parentNode != 'undefined' &&
clickedElement.parentNode.tagName != null &&
clickedElement.parentNode.tagName.toUpperCase() == 'A'
&& ((clickedElement.parentNode.target == null) ||
(clickedElement.parentNode.target.length <= 0))
&& (clickedElement.parentNode.href.indexOf('mailto')
< 0)
&& (clickedElement.parentNode.href.lastIndexOf('#')
!= (clickedElement.parentNode.href.length - 1))
&&
(clickedElement.parentNode.href.lastIndexOf('.doc') !=
(clickedElement.parentNode.href.length - 4))
&&
(clickedElement.parentNode.href.lastIndexOf('.csv') !=
(clickedElement.parentNode.href.length - 4))
&&
(clickedElement.parentNode.href.lastIndexOf('.xls') !=
(clickedElement.parentNode.href.length - 4)) &&
((clickedElement.parentNode.onclick == null) ||
(clickedElement.parentNode.onclick
.toString().indexOf('window.open') <= 0)))
|| (((clickedElement.onclick == null) ||
((clickedElement.onclick.toString().indexOf('confirm') <= 0)
&&
(clickedElement.onclick.toString().indexOf('alert') <= 0) &&
(clickedElement.onclick.toString().indexOf('Wicket.Palette') <= 0) &&
clickedElement.onclick.toString().indexOf("window.print") <= 0) )) &&
(clickedElement.tagName
.toUpperCase() == 'INPUT' &&
(clickedElement.type.toUpperCase() == 'BUTTON' ||
clickedElement.type.toUpperCase() == 'SUBMIT' || clickedElement.type
.toUpperCase() == 'IMAGE' {
showBusysign();
}
}

});


-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Alert-on-ajax-activity-tp2527887p2528293.html
Sent from the Wicket - User mailing list archive at Nabble.com.


WicketRuntimeException when injecting into hidden form field

2010-09-06 Thread Bernhard Schauer

Hello,

in wicket forms get a hidden field. I found on the web, that this hidden 
field is needed for some kind of event handling. (Anyone knows more 
details?)


I played around with XSS-Me 
(https://addons.mozilla.org/de/firefox/addon/7598/) a firefox plugin, 
that tries to find XSS vulnerabilities.
What the addon does, is that it injects some values into that hidden 
field, and then wicket throws :
   WicketRuntimeException: Attempt to access unknown request listener 
interface null


Has anyone an idea, how this exception could be prevented? or caught?

mfg bernhard

the full trace is:

ERROR - RequestCycle   - Attempt to access unknown request 
listener interface null
org.apache.wicket.WicketRuntimeException: Attempt to access unknown 
request listener interface null

   at org.apache.wicket.markup.html.form.Form.dispatchEvent(Form.java:1327)
   at 
org.apache.wicket.markup.html.form.Form.onFormSubmitted(Form.java:874)

   at sun.reflect.GeneratedMethodAccessor41.invoke(Unknown Source)
   at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

   at java.lang.reflect.Method.invoke(Method.java:597)
   at 
org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:182)
   at 
org.apache.wicket.request.target.component.listener.ListenerInterfaceRequestTarget.processEvents(ListenerInterfaceRequestTarget.java:73)
   at 
org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:92)
   at 
org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1250)

   at org.apache.wicket.RequestCycle.step(RequestCycle.java:1329)
   at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1428)
   at org.apache.wicket.RequestCycle.request(RequestCycle.java:545)
   at 
org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:479)
   at 
org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:312)
   at 
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1089)
   at 
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:365)
   at 
org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
   at 
org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
   at 
org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:712)

   at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
   at 
org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)

   at org.mortbay.jetty.Server.handle(Server.java:295)
   at 
org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:503)
   at 
org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:841)

   at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:639)
   at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:210)
   at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:379)
   at 
org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:226)
   at 
org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:442)
** 
 



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



Replace components with AjaxCheckbox

2010-09-06 Thread Johan Haleby

I'm trying to replace a component when clicking on an AjaxCheckbox. The code
looks something like this:

AjaxCheckBox checkbox = new AjaxCheckBox("checkBox", new
PropertyModel(this, "isChecked")) {
private static final long serialVersionUID = 4298312627418158465L;

@Override
protected void onUpdate(AjaxRequestTarget target) {
final Component component;
if (isChecked) {
System.out.println("is checked");
component = new Label("component", "is checked");
} else {
System.out.println("is NOT checked");
component = originalComponent;
}
form.replace(component);
target.addComponent(form);
}

@Override
protected boolean wantOnSelectionChangedNotifications() {
return true;
}
};

It works fine the first time I click on the check box, i.e. "is checked" is
printed to the console and the label "is checked" is shown on the web pagfe.
But when I click on the checkbox again (to uncheck it) "originalComponent"
is never shown but "is NOT checked" is printed in the console. What am I
doing wrong? 

/Johan
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Replace-components-with-AjaxCheckbox-tp2528243p2528243.html
Sent from the Wicket - User 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: Alert on ajax activity

2010-09-06 Thread Pedro Santos
You can use javascript call handlers, ex:

Wicket.Ajax.registerPreCallHandler(
function(){
window.onbeforeunload = function() {
return "There is some activity going on, please wait until
the activity indicator disappears";
};
 }
);
Wicket.Ajax.registerPostCallHandler(
function(){
window.onbeforeunload = null;
 }
);

On Mon, Sep 6, 2010 at 1:10 AM, koki142  wrote:

>
> Hi,
>
> I'm trying to show an alert if the user is going to move from current page
> while there is some ajax activity in the background. I have a chat program
> and sometimes if the user writes a message and clicks on different page,
> that message never reach the destination. I want to show something like
> "There is some activity going on, please wait until the activity indicator
> disappears".
>
> Is kind of the same Gmail does, any idea how to do this?
>
> Thank you!
> Oskar
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Alert-on-ajax-activity-tp2527887p2527887.html
> Sent from the Wicket - User 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
>
>


-- 
Pedro Henrique Oliveira dos Santos


Re: image path problem

2010-09-06 Thread Andrea Del Bene
Zeldor  gmail.com> writes:

> 
> 
> Hi,
> 
> I am trying to group all my images into one folder, but the problem is that
> I cannot get them displayed - that is as long as that folder path is higher
> in the hierarchy than my html files. 
> 
> So  images/image.jpg  works perfectly, but
> /src/main/resources/images/resources/image.jpg  does not, even though at
> preview it shows the image correctly.
> 
> I was trying to add src in the class or even use ResourceReference, but no
> luck. I am using Google Appengine, if it matters.
> 
> So, how to solve that? I'd really hat to put duplicates into every
> subfolder.
> 
> P.S. When we are at images - how can I secure my hierarchy when someone
> checks image details? Now it shows whole path to it, so like
> /src/main/resources/images/resources/image.jpg, but I'd want it to show only
> /image.jpg or nothing :)


Hi Zeldor,

you should take a look at class ContextImage in package
org.apache.wicket.markup.html.image. With this class you can easily load images
giving a path relative to the context root. 
But if you want to hide images hierarchy I think you should delegate image
fetching to a page or a servlet and call it in src attribute.

example:where  showimage is mapped to a
page or a servlet which retrieve the physic image path. However I' don't have
tried it.

bye bye!


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



Re: Radio buttons in modal window in IE6

2010-09-06 Thread Grafas

I still dont get where I'm wrong...
Here's the full code of radio buttons. This code is in a panel which is set
as modal window content.

JAVA code:
-
form = new Form("customerSearchForm");
add(form);

choiseGroup = new RadioGroup("searchParam", new PropertyModel(this,
"searchParam"));
choiseGroup.add(new Radio("p1", new Model(SearchParams.NAME)));
choiseGroup.add(new Radio("p2", new Model(SearchParams.CODE)));
choiseGroup.add(new Radio("p3", new Model(SearchParams.CIF)));
choiseGroup.add(new Radio("p4", new Model(SearchParams.ACC_NUMBER)));
choiseGroup.add(new Radio("p5", new Model(SearchParams.CARD_NUMBER)));
form.add(choiseGroup);

form.add(new TextField("searchString", new PropertyModel(this,
"searchString")));

final WebMarkupContainer container = new
WebMarkupContainer("resultContainer");
container.setOutputMarkupId(true);
add(container);
form.add(new IndicatingAjaxButton("search", form) {

@Override
protected void onSubmit(AjaxRequestTarget target, Form form) {
<.. doing searching stuff here>
target.addComponent(container);
}
});

HTML:
--










:Search 
string:





But every time I submit that form model object is NAME and in browser radio
button "jumps" from whatever I checked to the first one although I never
relaod the radio button part. Only search result container is added to a
target to display search results.


-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Radio-buttons-in-modal-window-in-IE6-tp2403103p2528111.html
Sent from the Wicket - User 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