A simple Wicket component to render a Vue app

2024-01-19 Thread Kent Tong
Hi,

I have written a simple Wicket component that allows you to easily render a
Vue 3 app in Java. This component is implemented in about just 130 lines of
code (including Java, HTML and js), so there is no risk in using it.
<https://github.com/freemant2000/WicketVueApp#how-to-use>How to use

Suppose that you want a Vue app on an HTML page like below:

https://.../vue.js&quot</a>;>


var app = Vue.createApp({
data() {
return {a: 4, b: "Hi"};
},
template: `<span @click='m1()'>{{a}} {{b}}<span>`,
methods {
m1() {
console.log(this.a);
}
},
});
app.mount('#app1')


And you want to generate this from a Wicket page. To do that, you can use
the WicketVueApp component provided by this project.

First, add the dependency:


   com.ttdev
   wicket-vue-app-core
   1.0.2


Your Wicket page should be like:

import com.ttdev.WicketVueApp;
public class GetStartedDemo extends WebPage {
  public GetStartedDemo() {
HashMap state = new HashMap<>();
state.put("a", 4);
state.put("b", "Hi");
WicketVueApp vwa=new WicketVueApp("wva",
new Model(state),
"m1() {console.log(this.a);}");
add(vwa);
  }
}

The template is provided in the HTML markup:


   {{a}} {{b}}

The WicketVueApp component will generate the desired HTML and js code
inside the  automatically. Now, run your Wicket webapp as usual and
you will see the Vue app working on your Wicket page.
Handling Vue events in Wicket

In the example above, suppose that you want to handle the click on the
server side (Wicket), all you need to do is to call a js method named "cb"
(standing for "call back") as shown below:


   {{a}} {{b}}

This cb method will use Wicket's ajax mechanism to send the request to the
Wicket side, where you can handle it by overriding the OnVueEvent method:

public class GetStartedDemo extends WebPage {
  public GetStartedDemo() {
HashMap state = new HashMap<>();
state.put("a", 4);
state.put("b", "Hi");
WicketVueApp vwa=new WicketVueApp("wva",
new Model(state)) {
  @Override
  public void onVueEvent(AjaxRequestTarget target, Map data) {
state.put("b", state.get("b")+"!");
  }
};
add(vwa);
  }
}

The cb method will automatically send the current state of the Vue app back
to the WicketVueApp component on server, which will use the data to update
itself own state, before calling its onVueEvent method. This way you will
have access to the latest state of the Vue app in the browser.

In this method you can further modify the state, which will be sent back to
the browser automatically to refresh the Vue app. Here, in this example,
the "b" variable's value will have an exclamation mark added to it.

Note that the AjaxRequestTarget one of the parameters, you can add other
ajax Wicket components to the target to have them refreshed.
<https://github.com/freemant2000/WicketVueApp#handling-vue-events-in-wicket>

-- 
Kent Tong
IT author and consultant, child education coach


Re: can't update wiki

2015-08-31 Thread Kent Tong
> I've added you to the group of collaborators.> You should be able to edit the 
> page now.

Dear Martin,

Thanks a lot!

-- 
Kent Tong
IT author and consultant, child education coach


can't update wiki

2015-08-30 Thread Kent Tong
Hi,

I'm trying to update my book's info and the tutorial URL address on
https://cwiki.apache.org/confluence/display/WICKET/Documentation+Index
but it seems that editing is disabled. Any help?

thanks!

-- 
Kent Tong
IT author and consultant, child education coach


Re: can't update wiki

2015-08-30 Thread Kent Tong
 Please give me the new content and I'll put it there for you.

I guess you'd like to update the content for
http://wicket.apache.org/learn/books/ewdww.html too?
Its source is at
https://github.com/apache/wicket-site/tree/asf-site/learn/books. Please
send us a Pull Request!

Dear Martin,

thanks for the help! I've created a pull request on github for the site.

However, I'd also like to update the wiki page at
https://cwiki.apache.org/confluence/display/WICKET/Documentation+Index:


...It covers Wicket v7 and v6...
...
Tutorials by Kent Tong (the URL should be
http://www.ttdev.com/EWDW/Chapters1-2.pdf)


Thanks!


-- 
Kent Tong
IT author and consultant, child education coach


Re: can't update wiki

2015-08-30 Thread Kent Tong
 Done!

Dear Martin,

Thanks! My Id is: KentTong.

Also thanks for the update! I'd like to fix the URL for Tutorials by Kent
Tong:
it should be
http://www.ttdev.com/EWDW/Chapters1-2.pdf instead of
http://www.agileskills2.org/EWDW/chapters1-3.pdf

thanks!


-- 
Kent Tong
IT author and consultant, child education coach


Wicket page test 3.0.1 is now available (for Wicket 7.0 and 6.x)

2015-08-26 Thread Kent Tong
Dear all,

Wicket page test 3.0.1 is now available. It now works with Wicket 7 (and
6.x) and can reliably wait for the loading of the response page.

It is a library allowing you to unit test your Wicket pages easily,
supporting AJAX and Javascript without changes to your pages.

It's available from maven central. Check out the tutorial at
http://wicketpagetest.sourceforge.net to get started!

-- 
Kent Tong
IT author and consultant, child education coach


Wicket page test 3.0.0 is now available (for Wicket 6.x)

2015-02-23 Thread Kent Tong
Dear all,

Wicket page test 3.0.0 is now available. It now works with Wicket 6.x and
Selenium 2. It is a library allowing you to unit test your Wicket pages
easily, supporting AJAX and Javascript without changes to your pages.

It's available from maven central. Check out the tutorial at
http://wicketpagetest.sourceforge.net to get started!

-- 
Kent Tong
IT author and consultant, TipTec Development


my book updated for Wicket 1.5.x

2011-12-29 Thread Kent Tong
Hi,

I've updated my book for Wicket 1.5.x. You may check it out or download the
first two chapters at http://agileskills2.org/EWDW

Thanks!


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



what could have caused this: a page ID in listener URL getting a wrong page instance

2011-11-03 Thread Kent Tong

Hi,

My users are frequently getting internal errors after a few minutes
of inactivity. From the log I can see that mostly this is caused by:

org.apache.wicket.WicketRuntimeException: component foo not found
on page XYZ[id = 3], listener interface...

The weird thing is that there is no foo component on page XYZ, but
it is on page ABC. It means that while the browser believes that page
3 is an instance of ABC, actually it is an instance of XYZ.

What could have caused this? I know this is a long shot, but just to
see if there is any (remote) ideas. I can rule out session expiration
as it only took a few minutes to occur.

We're using Wicket 1.4.9.

Thanks in advance!

--
Kent Tong
Useful  FREE software at http://www2.cpttm.org.mo/cyberlab/freeware

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



Re: what could have caused this: a page ID in listener URL getting a wrong page instance

2011-11-03 Thread Kent Tong
Hi Martijn,

Thanks for the pointer! I'll give it a go.




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



Strange issue in RequestCycle

2011-10-16 Thread Kent Tong
Hi,

In 1.5, the request cycle (indirectly) contains a stack of request handlers.
According to the Java docs, it seems the purpose is to allow a request
handler to execute another request handler in its respond() method by
calling the execute() method in the request cycle. However:

a) There seems to be no code in Wicket doing that and I don't see why
one would want to do that. What's the use case?

b) There is no execute() method in the RequestCycle class at all. So
there is actually no way for a request handler to call execute() on invoke
another. Does it mean that there is inconsistency here?

c) Even if there were a way to execute another request handle inline,
there is only one scheduledAfterCurrent in the request cycle. This would
cause problems of the inlined request handle schedule another handler,
right?




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



Re: Strange issue in RequestCycle

2011-10-16 Thread Kent Tong

Hi Igor,

Thanks for the reply!

 the usecase is simple, one requesthandler handing work off to another
 one. an easy example is a request handler that handles a callback
 (such as a link being clicked) scheduling the handler that renders the
 page after it handled the click.

Yes, it is very common for one request handler *scheduling* another
to be executed after its own execution. However, I am referring to
one request handling *executing* another during its own execution.

 all scheduled handlers go into a queue and are executed in order.
 usually there are only two handlers scheduled - event handler and page
 renderer.

The code shows that the scheduled handler is stored into the single
scheduledAfterCurrent field in RequestHandlerStack, while the
requestHandlers linked-list is not really used. The only location
a request handler is added to the linked-list is in the execute()
method, but it is immediately removed after its execution.

--
Kent Tong
Useful news for CIO's at http://www2.cpttm.org.mo/cyberlab/cio-news

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



why generate hybrid URL for stateless page?

2011-09-13 Thread Kent Tong
Hi,

In 1.5 I found that even if a page is stateless, Wicket still generates
hybrid URLs (with PageInfo) for stateless links/forms. This is done in
AbstractBookmarkableMapper (see below). Any idea why? Thanks!


if (requestHandler instanceof BookmarkableListenerInterfaceRequestHandler)
{
// listener interface URL with page class information
BookmarkableListenerInterfaceRequestHandler handler =
(BookmarkableListenerInterfaceRequestHandler)requestHandler;
Class? extends IRequestablePage pageClass = handler.getPageClass();
if (!checkPageClass(pageClass))
{
return null;
}
Integer renderCount = null;
if (handler.getListenerInterface().isIncludeRenderCount())
{
renderCount = handler.getRenderCount();
}
PageInfo pageInfo = new PageInfo(handler.getPageId());
ComponentInfo componentInfo = new ComponentInfo(renderCount,
requestListenerInterfaceToString(handler.getListenerInterface()),
handler.getComponentPath(),
handler.getBehaviorIndex());
UrlInfo urlInfo = new UrlInfo(new PageComponentInfo(pageInfo,
componentInfo),
pageClass, handler.getPageParameters());
return buildUrl(urlInfo);
}



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



Re: how to test what radio is checked in a radiogroup?

2011-08-22 Thread Kent Tong
 In my unit test, I try to check what radio is selected, but I don't find
 how...

You may check out http://wicketpagetest.sourceforge.net which will work
for this use case.



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



Re: Unit testing wicket

2011-07-19 Thread Kent Tong
Hi Niranjan,

 If I add more than one test case, setUp method is called more than
 twice and wicket throws the exception Application name can only be set
 once..

You may want to take a look at http://wicketpagetest.sourceforge.net
which is much easier to use.




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



Re: [VOTE] Behavior of CheckBox With Respect to setRequired(true)

2011-04-04 Thread Kent Tong

Hi,

As the guy who started that old thread and the old vote, I vote +1
for (2).

--
Kent Tong
Useful news for network admins at 
http://www2.cpttm.org.mo/cyberlab/netadmin-news


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



Re: Strange behaviour in WicketTester when Ajax-clicking on a deselected checkbox

2011-04-04 Thread Kent Tong

I've got an AjaxCheckbox with a PropertyModel. When ajax-clicking in

 in WicketTester, when the model is true, everything works as expected
 but ajax-clicking it when the model is false doesn't result in a call
 of the model's setter even in onUpdate is executed (Breakpoints and
 jUnit-Asserts)

You may take a look at http://wicketpagetest.sourceforge.net which
supports true Ajax testing.

--
Kent Tong
Useful  FREE software at http://www2.cpttm.org.mo/cyberlab/freeware

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



Re: Wickettester, cookies and redirects in Wicket 1.4.15

2011-02-02 Thread Kent Tong
 Hi, I currently have an application reading a cookie in my session. All
 of my unit tests where the pattern is: Create page - submit form -
 redirect to new page fails to read this cookie after the redirect to new
 page.

Have you tried http://wicketpagetest.sourceforge.net which supports
this case automatically.


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



some thoughts on the component hierarchy hell

2010-11-07 Thread Kent Tong

Hi,

I've a blog entry on this issue:

http://www.dzone.com/links/r/scala_exercise_6_tackling_the_wicket_hierarchy_mi.html

definitely not a solution, but just some ideas.

--
Kent Tong, Msc, PMP, CISSP, ITIL Foundation
Senior manager of IT dept, CPTTM
Authorized training for Adobe, Aruba, Cisco, Microsoft, SUN

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



Re: how to pass initial request parameters with WicketTester

2010-11-02 Thread Kent Tong

 Any clue on how to pass the initial request parameters to
 WicketTester? The productive code seems to work (checked that with
 some logging output), but we'd like to create a valid test case.

You may try http://wicketpagetest.sourceforge.net which will work
for your case as it doesn't change Wicket's server side processing.

--
Kent Tong
Post questions on our IT support forum (http://www2.cpttm.org.mo/forum).
Responses are guaranteed in 3 working days.

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



Re: New App - Best Practices

2010-10-04 Thread Kent Tong

 Now I have to build a small app to manage small accounting and
 logistics for my wife's Business

 She is opening a small printing shop for small business labels, such
 as wine bottle labels, clothing labels, bags, etc.

I am quite surprised to see so many suggestions, while all there
is known is the above brief description :-)

My suggestion is to avoid writing any code at all :-) For example,
check out the open source, free or paid applications that can do
what you want (eg, sql-ledger for accounting), then customize them
as needed.

--
Kent Tong
Useful news for network admins at 
http://www2.cpttm.org.mo/cyberlab/netadmin-news


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



Re: WicketTester and https

2010-09-01 Thread Kent Tong

 is there a way to test Pages that have the @RequireHttps annotation?

You can try http://wicketpagetest.sourceforge.net which should support
https testing.

--
Kent Tong
Useful  FREE software at http://www2.cpttm.org.mo/cyberlab/freeware

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



Wicket page test 2.0.0 is now available (for Wicket 1.5)

2010-08-14 Thread Kent Tong
Dear all,

Wicket page test 2.0.0 is now available. It is the first version
that works with Wicket 1.5-M1 and onwards. It is a library allowing
you to unit test your Wicket pages easily, supporting AJAX and
Javascript without changes to your pages.

Get it from maven as described in http://wicketpagetest.sourceforge.net/


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



Re: Testing modal window

2010-08-13 Thread Kent Tong

Hi Anna,

 I am trying to write a test case to test that the parent page gets
 updated with new values once the modal window closes.

If you use http://wicketpagetest.sourceforge.net, you can test it
easily like:

 DefaultSelenium selenium = ...;
 WicketSelenium ws = ...;
 ws.openBookmarkablePage(AddDataPage.class);
 selenium.click(wicket=//openModal);
 ws.waitUntilAjaxDone();
 selenium.click(wicket=//modal//closeModal);
 ws.waitUntilAjaxDone();

assuming that you the button to open the modal window has a Wicket ID of
openModal, the modal window's Wicket ID is modal, the button in the
modal window to close it has a Wicket ID of closeModal.

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



Wicket page test 1.6.1 is now available

2010-08-11 Thread Kent Tong
Dear all,

Wicket page test 1.6.1 is now available. It is a library allowing
you to unit test your Wicket pages easily, supporting AJAX and
Javascript without changes to your pages.

This minor release contains the follow changes:

* Fixed issue 3043110[1].
* Fixed issue 3037392[2].
* Fixed issue 3037395[3].

Get it from maven as described in http://wicketpagetest.sourceforge.net/



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



Re: Disabling serialization in wicket tester....

2010-07-31 Thread Kent Tong

 I would like very much to disable serialization in wicket tester. I
 am using pages with mockito mocks that are not serializable (and why
 should they in a unit test). I am using workarounds now.

You can take a look at http://wicketpagetest.sourceforge.net which
allows you to inject non-serializable mocks into your pages.


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



Re: WicketTester and Palette component

2010-07-31 Thread Kent Tong

Hi Loic,

If you use wicket page test (http://wicketpagetest.sourceforge.net), you
can test it like:

  DefaultSelenium selenium = WebPageTestContext.getSelenium();
  WicketSelenium ws = new WicketSelenium(selenium);
  ws.openBookmarkablePage(PalettePage.class);
  String[] allProducts = selenium.getSelectOptions(wicket=//choices);
  assert allProducts.length == 3;
  assert allProducts[0].equals(ball pen);
  assert allProducts[1].equals(eraser);
  assert allProducts[2].equals(paper clip);
  selenium.select(wicket=//choices, eraser);
  selenium.click(wicket=//addButton);
  ...

There is a full example at 
http://wicketpagetest.sourceforge.net/examples.html


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



Re: Browser Back Button and WicketTester

2010-07-17 Thread Kent Tong

 Does WicketTester emulate the browser back button? E.g.

Please take a look at http://wicketpagetest.sourceforge.net
which supports the back button.

--
Kent Tong
Useful news for software developers at 
http://www2.cpttm.org.mo/cyberlab/softdev/newsletter


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



Wicket page test 1.6 is now available

2010-07-10 Thread Kent Tong
Dear all,

Wicket page test 1.6 is now available. It is a library allowing
you to unit test your Wicket pages easily, supporting AJAX and
Javascript without changes to your pages.

This release contains the follow changes:

* Support manual testing: allow some things to be mocked, without
starting Selenium.
* Include a factory to create change-resisting mocks.
* Fixed issue 3024401[1].
* Fixed issue 3008847[2].
* Fixed issue 3008846[3]. That is, now it works with Wicket 1.4.9.

Get it from maven as described in http://wicketpagetest.sourceforge.net/



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



Getting started with Scala, Spring, Hibernate Wicket

2010-06-19 Thread Kent Tong
Hi,

I've written a tutorial on this topic. You may check it out at
http://www.dzone.com/links/getting_started_with_scala_spring_hibernate_wicket.html




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



Re: Getting started with Scala, Spring, Hibernate Wicket

2010-06-19 Thread Kent Tong
Hi James,

 Why is spring-orm version 3.0.1.RELEASE and not 3.0.3.RELEASE?  Why
 not just uset a {spring.version} property in your POM so that it all
 stays in synch?

Thanks for your good advice. I've updated the tutorial.

 Why do you have page - service - dao?  Why not just talk directly to
 the DAO for the getAll() method.  This level of indirection just
 causes more code (and confusion) in your simple example.  Is this just
 a best practice that you've devised?  I've never really understood
 folks' aversion to talking to the DAOs from the view layer, especially
 when it means you have to have duplicate methods in your service layer
 to do so.  It just doesn't make sense to me.

I agree that if the service is simply delegating to the DAO without
adding anything, then it is probably be a good idea to merge them.
However, this sample application is meant to demonstrate how to do
it in a general case where the service does more than simple delegation.




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



Re: Encoding for wicket:message tag

2010-06-18 Thread Kent Tong
 We are using wicket:message tag to generate content for WAP.

 Wap is strict XML so it does not allow special characters. Is there a
 way to force wicket:message tag to escape encode its message?

I think you've found an enhancement opportunity for Wicket. You may file
an enhancement request for it.



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



Re: Confirmation dialog during file upload

2010-06-18 Thread Kent Tong
 I have a form which allows a user to upload a file. The form is
 patterned after upload Wicket example.

 If the file being uploaded will overwrite an existing file I need to
 prompt the user if they want to replace the existing file or not.
 What's the best way to implement this functionality?

There is nothing special about it. Just display a confirmation page. Only
if the user chooses to go ahead, will it save the file. Below is an example
doing that written in Scala (as my exercise in learning Scala):

class MyPage extends WebPage {
  val f = new Form[Unit](f) {
override def onSubmit = {
  val exists = true
  if (exists) {
setResponsePage(new ConfirmSavePage(upload.getFileUpload))
  } else {
Console.println(saving the file
+upload.getFileUpload.getClientFileName)
  }
}
  }
  add(f)
  val upload = new  FileUploadField(upload)
  f.add(upload)

}

class ConfirmSavePage(upload: FileUpload) extends WebPage {
  val f = new Form[Unit](f) {
override def onSubmit = {
  Console.println(saving the file +upload.getClientFileName)
}
  }
  add(f)
  val cancel = new Button(cancel) {
override def onSubmit = {
  Console.println(Aborting)
  setResponsePage(classOf[MyPage])
}
  }
  f.add(cancel)
}


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



Re: Confirmation dialog during file upload

2010-06-18 Thread Kent Tong
Sorry, there is a bug in the code: You should never keep a FileUpload
object across requests. So, you need to copy the data into somewhere else.


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



Re: Confirmation dialog during file upload

2010-06-18 Thread Kent Tong
 1. User clicks Upload button and form submission request is sent to the
 server
 2. The code on the server detect the file name collision and causes a
 ModalWindow to display

These can be done with an AjaxButton to send the upload request. Then
show the ModalWindow in onSubmit().

 3.1 If the user clicks Confirm button then upload form submission is
 resumed.

The Confirm button would be another AjaxButton then. Just save the
file in onSubmit(). Of course, make sure you copied the file content
in the first place for use here.




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



Re: Unit Test InMethod DataGrid

2010-06-03 Thread Kent Tong

Hi Ronan,

Looking at the output of WicketTester.debugComponentTrees() I can see 
that the grid row is the deepest level with a wicket id:

...
panel:storyGrid:form:bodyContainer:body:row:2:item 
com.inmethod.grid.common.AbstractGridRow


If you use http://wicketpagetest.sourceforge.net, then you can test
it easily like:

   Selenium s = ...;
   assert 
s.getText(wicket=//storyGrid//body//row[2]//item[3]).equals(foo;


In this example you're checking the the 3rd cell in the 2nd row (both
are 0-based).

--
Kent Tong
Useful news for CIO's at http://www2.cpttm.org.mo/cyberlab/cio-news

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



Re: How to test a link in wicket:links

2010-06-03 Thread Kent Tong

Hi Kent,

Thanks for the answer, but that looks like it requires Spring, I'm not using
Spring. I was hoping to use the test framework that is included in Wicket,
not go outside it. 


Well, it doesn't require you to use Spring in your code. However, it is
indeed assumed that you're using a IoC framework (eg, Spring or Guice).
Why? Only when you do, is it possible to really unit test a page,
otherwise your page will be invoking the real business logic and
database access in the tests.


I come across this doing a demo of Wicket and it kind of broke the whole
spiel about Look, you can do unittests of the GUI!! thing.


That's exactly the point. If your tests are touching the database, then
they aren't really unit tests anymore.

--
Kent Tong
Borrow IT books for free at http://www2.cpttm.org.mo/cyberlab/mslib

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



Re: How to test a link in wicket:links

2010-05-28 Thread Kent Tong
Hi Peter,

 If I use wicket:link around a link, how can I click on it with
 WicketTester.clickLink()? It don't have a wicket:id so what would the path
 be?

Please try http://wicketpagetest.sourceforge.net which supports testing
the links. You can do it like:

  selenium.click(link=My Page);
  ...




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



Wicket page test 1.5 is now available

2010-05-15 Thread Kent Tong
Dear all,

Wicket page test 1.5 is now available. It is a library allowing you
to unit test your Wicket pages easily, supporting AJAX and
Javascript without changes to your pages.

New features implemented in this version:

* Start the Selenium server automatically.
* Support JUnit4 in addition to TestNG.
* Support unit testing the navigation within the Breadcrumb subsystem
* Open a Component in a page for unit testing
* Fixed issue 2998400.

Get it from maven as described in http://wicketpagetest.sourceforge.net/


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



Re: Testing wicket pages in isolation (wickettester)

2010-05-13 Thread Kent Tong

Hi Vincent,

You can use a page navigator interface. See the example Checking if a
Wicket page is passing the correct data to the next page on
http://wicketpagetest.sourceforge.net/examples.html


--
Kent Tong, Msc, PMP, CISSP, ITIL Foundation
Senior manager of IT dept, CPTTM
Authorized training for Adobe, Aruba, Cisco, Microsoft, SUN

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



Wicket page test 1.4 is now available

2010-04-30 Thread Kent Tong
Dear all,

Wicket page test 1.4 is now available. It is a library allowing you
to unit test your Wicket pages easily, supporting AJAX and
Javascript without changes to your pages.

New features implemented in this version:

* Provide a super easy way to locate a DOM element with the Wicket ID. For
example, to locate the input element generated by a TextField with
wicket:id=productName, just use wicket=//productName as the locator. To
locate such element in the 3rd form with wicket:id=myForm, use
wicket=//myForm[3]//productName.

Get it from maven as described in http://wicketpagetest.sourceforge.net/



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



Re: using selenium

2010-04-28 Thread Kent Tong

Hi Joe,

Take a look at http://wicketpagetest.sourceforge.net which allows you to
locate an html element
with something like wicket=//myTextField

--
Kent Tong
Case studies on ITIL, Linux, OpenOffice and Extreme Programming at
http://www2.cpttm.org.mo/cyberlab

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



Re: WicketTester fails with a custom WebRequestCodingStrategy

2010-04-24 Thread Kent Tong
Hi Martin,

You may take a look at http://wicketpagetest.sourceforge.net/ which will work
for your case.




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



my book updated for Wicket 1.4.x

2010-04-16 Thread Kent Tong
Hi,

I've updated my book for Wicket 1.4.x. You may check it out or download the
first two chapters at http://agileskills2.org/EWDW



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



WICKET-2832

2010-04-13 Thread Kent Tong

Dear all,

Any idea on
https://issues.apache.org/jira/browse/WICKET-2832 ? If it is fine, I
may take some time to create  submit a patch.

--
Kent Tong
Case studies on ITIL, Linux, OpenOffice and Extreme Programming at
http://www2.cpttm.org.mo/cyberlab

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



Re: WICKET-2832

2010-04-13 Thread Kent Tong


igor.vaynberg wrote:
 
 what about https://issues.apache.org/jira/browse/WICKET-1830 ?
 

Didn't notice that. wicket:path would work. However, I really think my
solution is better because
you don't need to specify the full path (which may change easily). In most
case, one only needs
to specify wicket=//my-component-id.


-
--
Kent Tong
Better way to unit test Wicket pages (http://wicketpagetest.sourceforge.net)
Books on CXF, Axis2, Wicket, JSF (http://agileskills2.org)
-- 
View this message in context: 
http://old.nabble.com/WICKET-2832-tp28228278p28237092.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: FormTester with dynamic fields

2010-04-11 Thread Kent Tong


Anna Simbirtsev wrote:
 
 There is also an ADD MORE button, that adds more of those on the page.
 ...
 But that does not work.
 

If it is an AjaxButton, then WicketTester will not execute the Javascript.
To test the
effects as seen in the browser, you may try
http://wicketpagetest.sourceforge.net.


-
--
Kent Tong
Better way to unit test Wicket pages (http://wicketpagetest.sourceforge.net)
Books on CXF, Axis2, Wicket, JSF (http://agileskills2.org)
-- 
View this message in context: 
http://old.nabble.com/FormTester-with-dynamic-fields-tp28193951p28207809.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



Wicket page test 1.3 is now available

2010-03-26 Thread Kent Tong
Dear all,

Wicket page test 1.3 is now available. It is a library allowing you
to unit test your Wicket pages easily, supporting AJAX and
Javascript without changes to your pages.

New features implemented in this version:

* Provide a generic starter page to launch another page whose
constructor needs some arguments.
* Provide a page navigator to inspect the arguments passed to the
response page.
* Easier way to open a page.

Get it from maven as described in http://wicketpagetest.sourceforge.net/

--
Author of books for learning CXF, Axis2, Wicket, JSF
(http://www.agileskills2.org)


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



Re: FormTester - submitting more than once

2010-03-12 Thread Kent Tong


Tony Wu-5 wrote:
 
 However, I can't
 do this unit test in Wicket because a FormTester can only submit once. I
 can't resetup the FormTester data because the 2nd submit button (checkout)
 requires a state that the 1st submit button sets.
 

Yes, you can make it work if you use http://wicketpagetest.sourceforge.net/

-
--
Kent Tong
Better way to unit test Wicket pages (http://wicketpagetest.sourceforge.net)
Books on CXF, Axis2, Wicket, JSF (http://agileskills2.org)
-- 
View this message in context: 
http://old.nabble.com/FormTester---submitting-more-than-once-tp27873217p27874748.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: FormTester - submitting more than once

2010-03-12 Thread Kent Tong


Tony Wu-5 wrote:
 
 Any way to do it without running Selenium?
 

Not that I know of. What's the problem of running Selenium?

-
--
Kent Tong
Better way to unit test Wicket pages (http://wicketpagetest.sourceforge.net)
Books on CXF, Axis2, Wicket, JSF (http://agileskills2.org)
-- 
View this message in context: 
http://old.nabble.com/FormTester---submitting-more-than-once-tp27873217p27885114.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: Configure wicketpagetest to multi eclipse project layout

2010-03-10 Thread Kent Tong

Hi Per,


Newgro wrote:
 
 I think this is because the web.xml file is located in the webapp project
 and the selenium default configuration points to src/main/webapp in the
 test project.
 

You can create a com.ttdev.wicketpagetest.Configuration to specify your
webapp root. For
an example of how to make it take effect, see the Overriding web.xml
example at 
http://wicketpagetest.sourceforge.net/examples.html.


-
--
Kent Tong
Better way to unit test Wicket pages (http://wicketpagetest.sourceforge.net)
Books on CXF, Axis2, Wicket, JSF (http://agileskills2.org)
-- 
View this message in context: 
http://old.nabble.com/Configure-wicketpagetest-to-multi-eclipse-project-layout-tp27849140p27858206.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



Announce: wicket page test 1.2 is now available

2010-03-06 Thread Kent Tong

Dear all,

Wicket page test allows you to unit test Wicket pages easily including
its AJAX functionality.

Major enhancements in 1.2 is that now you can wait for the completion
of Ajax easily, without writing any Javascript. For example, in a test
case, do something like:

WicketSelenium ws = new WicketSelenium(selenium);
selenium.click(link=Calculate next); //this is an ajax link
ws.waitUntilAjaxDone();
assert selenium.getText(output).equals(Current: 1);

For more info, please see http://wicketpagetest.sourceforge.net/


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



Re: Can't get FormTester.submitLink to work (required testfield always missing)

2010-03-04 Thread Kent Tong


jn73 wrote:
 
 My problem is that even when i set a value on the
 RequiredTextField the form submission is failing - because of that the
 required field is missing.
 

Please try http://wicketpagetest.sourceforge.net. It should work.

-
--
Kent Tong
Better way to unit test Wicket pages (http://wicketpagetest.sourceforge.net)
Books on CXF, Axis2, Wicket, JSF (http://agileskills2.org)
-- 
View this message in context: 
http://old.nabble.com/Can%27t-get-FormTester.submitLink-to-work-%28required-testfield-always--missing%29-tp27783318p27788850.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: Wicket tests without FormTester

2010-03-04 Thread Kent Tong


alexander.elsholz wrote:
 
 exists a possibility to test, for example a dropdownchoice without
 formtester?
 

Try http://wicketpagetest.sourceforge.net which should work fine.

-
--
Kent Tong
Better way to unit test Wicket pages (http://wicketpagetest.sourceforge.net)
Books on CXF, Axis2, Wicket, JSF (http://agileskills2.org)
-- 
View this message in context: 
http://old.nabble.com/Wicket-tests-without-FormTester-tp22609725p27788858.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: How to write a testcase for CheckGroupSelector.

2010-02-06 Thread Kent Tong


vermas wrote:
 
 How to write a testcase for CheckGroupSelector.
 

Try http://wicketpagetest.sourceforge.net/ which supports execution of
Javascript in the tests.


-
--
Kent Tong
Better way to unit test Wicket pages (http://wicketpagetest.sourceforge.net)
Books on CXF, Axis2, Wicket, JSF (http://agileskills2.org)
-- 
View this message in context: 
http://old.nabble.com/How-to-write-a-testcase-for-CheckGroupSelector.-tp27473254p27485560.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: Wicket, Spring 3 and UnitTesting

2010-01-29 Thread Kent Tong


Jochen Mader-2 wrote:
 
 Just figured out how to do UnitTesting with Spring 3 and Wicket.
 

An alternative is to use http://wicketpagetest.sourceforge.net. It works
fine with Spring 3.0 without changing any of your code.

-
--
Kent Tong
Better way to unit test Wicket pages (http://wicketpagetest.sourceforge.net)
Books on CXF, Axis2, Wicket, JSF (http://agileskills2.org)
-- 
View this message in context: 
http://old.nabble.com/Wicket%2C-Spring-3-and-UnitTesting-tp27320784p27380973.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: functional testing

2010-01-24 Thread Kent Tong

For functional testing, I'd suggest Selenium.

For unit testing of Wicket pages, I'd suggest Wicket Page Test
(http://wicketpagetest.sourceforge.net).

-
--
Kent Tong
Better way to unit test Wicket pages (http://wicketpagetest.sourceforge.net)
Books on CXF, Axis2, Wicket, JSF (http://http://agileskills2.org)
-- 
View this message in context: 
http://old.nabble.com/functional-testing-tp27278781p27301553.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



Announce: wicket page test 1.1.0 available

2010-01-16 Thread Kent Tong

Dear all,

wicket page test allows you to unit test Wicket pages including its
AJAX functionality.

Major enhancements in 1.1.0:
* It now supports Google Guice along with the existing support for
Spring (Thanks to our new member developer, Andy Chu).
* It is now organized in modules so that you won't be including,
say, Selenium and Jetty code at runtime.

Fore more info, please see http://wicketpagetest.sourceforge.net/


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



Re: Wicket and Spring - mocking a particular bean when Wicket is in development mode?

2010-01-08 Thread Kent Tong


Liam Clarke-Hutchinson-3 wrote:
 
 how can I provide this bean instead of the real bean,
 based on the value of WebApplication.getConfigurationType()?
 

Take a look at http://wicketpagetest.sourceforge.net. Even though it was
designed
to support unit testing in mind, there is no reason why it can't be used in
system 
tests.

-
--
Kent Tong
Better way to unit test Wicket pages (http://wicketpagetest.sourceforge.net)
Books on CXF, Axis2, Wicket, JSF (http://http://agileskills2.org)
-- 
View this message in context: 
http://old.nabble.com/Wicket-and-Spring---mocking-a-particular-bean-when-Wicket-is-in--development-mode--tp27067859p27085762.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: Testing AjaxSubmitLink#onSubmit() with WicketTester @L

2009-12-29 Thread Kent Tong


Pieter Degraeuwe wrote:
 
 This seems to be quite useful.
 
 However, do you have a solution to avoit the 'sleep(...)' methods for ajax
 calls?
 When you have a lot of these tests, your testcyclus will be too long...
 (Maybe there is a way to detect when the ajax calls are ended?)
 

The call to sleep() method is used to simulate a slow responding method. It
is 
not needed at all. The detection is done by selenium.waitForCondition(some 
javascript).

-
--
Kent Tong
Better way to unit test Wicket pages (http://wicketpagetest.sourceforge.net)
Books on CXF, Axis2, Wicket, JSF (http://http://agileskills2.org)
-- 
View this message in context: 
http://old.nabble.com/Re%3A-Testing-AjaxSubmitLink-onSubmit%28%29-with-WicketTester-%40L-tp26947384p26954770.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: Testing AjaxSubmitLink#onSubmit() with WicketTester @L

2009-12-29 Thread Kent Tong


Pieter Degraeuwe wrote:
 
 ah, ok. I didn't notice that.
 
 Any idea how to that javascript condition should look like in a general
 way?
 (Is there some wichet hook available for this?)
 I'm looking for a generic approach; I don't want to clutter my tests with
 code like wait until component contains value x, etc.)
 

The javascript condition is usually testing for existence of some HTML
element 
changed by AJAX and is identified by an XPath like:

 
selenium.waitForCondition(selenium.isElementPresent('//some-eleme...@some-attr=\foo\'));

In my view, this is part of the test: it is part of the expected behavior
that
is specific to the function concerned.


-
--
Kent Tong
Better way to unit test Wicket pages (http://wicketpagetest.sourceforge.net)
Books on CXF, Axis2, Wicket, JSF (http://http://agileskills2.org)
-- 
View this message in context: 
http://old.nabble.com/Re%3A-Testing-AjaxSubmitLink-onSubmit%28%29-with-WicketTester-%40L-tp26947384p26955427.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: Testing AjaxSubmitLink#onSubmit() with WicketTester @L

2009-12-28 Thread Kent Tong


alecswan1 wrote:
 
 So, how do I test AjaxSubmitLink#onSubmit(AjaxRequestTarget target, Form
 form) method?
 

You may try using http://wicketpagetest.sourceforge.net/ to test it instead.
It
supports real AJAX.

-
--
Kent Tong
Better way to unit test Wicket pages (http://wicketpagetest.sourceforge.net)
Books on CXF, Axis2, Wicket, JSF (http://http://agileskills2.org)
-- 
View this message in context: 
http://old.nabble.com/Re%3A-Testing-AjaxSubmitLink-onSubmit%28%29-with-WicketTester-%40L-tp26947384p26951953.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: unit test of AjaxLazyLoadPanel and ModalWindow

2009-12-16 Thread Kent Tong


Bernard Lupin wrote:
 
 As suggested by message subject, you had a problem for testing
 AjaxLazyLoadPanel and ModalWindow. You provided a solution for the first
 case (great!), but there is nothing in this thread about testing
 ModelWindow.
 

try http://wicketpagetest.sourceforge.net/examples.html which supports AJAX
without any special work
by you.



-
--
Kent Tong
Better way to unit test Wicket pages (http://wicketpagetest.sourceforge.net)
-- 
View this message in context: 
http://old.nabble.com/unit-test-of-AjaxLazyLoadPanel-and-ModalWindow-tp16851306p26809771.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: Canoo WebTest

2009-12-11 Thread Kent Tong


Per-Olof Norén wrote:
 
 I´m currently working on a project where we run JUnit, Wicket-Tester and
 canoo web tests on a wicket-spring application.
 The application is to a large degree ajax-based and as far we can tell
 canoo is silently ignoring to run wicket ajax-javascript for eg onClick
 events.
 

Take a look at http://wicketpagetest.sourceforge.net which allows you to
test AJAX.



-
--
Kent Tong
Better way to unit test Wicket pages (http://wicketpagetest.sourceforge.net)
-- 
View this message in context: 
http://old.nabble.com/Canoo-WebTest-tp26724748p26755311.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: Wicket tester test coverage

2009-11-27 Thread Kent Tong



zedros wrote:
 
 I saw it, but we're using guice (when, it wouldn't be a show stopper
 in the end). Still, on the technical side, there's also this issue
 with selenium using mostly id, whereas wicket'ids change with each
 request... How do you solve this issue ?
 

If the element is not in a loop, just specify the HTML ID in the template. 
If it is in a loop, use xpath.


zedros wrote:
 
 on a broader picture, my main question was about the way you proceed,
 Do you test every page, including every validator or.. ? If doing so,
 for pages that quite often are then not touched much, i would fear the
 time needed for proper testing quite hard to justify. Am i wrong here
 ?

I test my code based on risk. If it is the code that is frequently use, has
a high impact if it breaks, or is likely to contain bugs, I'll test it more 
thoroughly.


-
--
Kent Tong
Better way to unit test Wicket pages (http://wicketpagetest.sourceforge.net)
-- 
View this message in context: 
http://old.nabble.com/Wicket-tester-test-coverage-tp26505428p26541425.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: Wicket tester test coverage

2009-11-25 Thread Kent Tong


zedros wrote:
 
 I was under the assumption that unit testing isn't valuable for GUI,
 esp. web gui, since the effort is too important... I think I even read
 uncle bob saying so. How do you suggest to write/do TDD for web pages
 ?
 

Without reference to his article, I can only guess that it may be pointless 
to test the position or the color of a button in automated tests.  On the
other hand, functionality of GUI can definitely be tested. For example,
I am writing a Wicket application with TDD (sort of) with the library shown
in my signature. It is working very well.


-
--
Kent Tong
Better way to unit test Wicket pages (http://wicketpagetest.sourceforge.net)
-- 
View this message in context: 
http://old.nabble.com/Wicket-tester-test-coverage-tp26505428p26509652.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: Wicket tester test coverage

2009-11-25 Thread Kent Tong



Pierre Goupil wrote:
 
 I use it, and what I'm looking for is a mean to ensure my test coverage.
 

If you're using TDD, you will have developed the page and the unit test for
that 
page at the same time and by definition you won't have a page that is not 
tested.

-
--
Kent Tong
Better way to unit test Wicket pages (http://wicketpagetest.sourceforge.net)
-- 
View this message in context: 
http://old.nabble.com/Wicket-tester-test-coverage-tp26505428p26509669.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: Wicket tester test coverage

2009-11-24 Thread Kent Tong



Pierre Goupil wrote:
 
 So I'm looking for a way to list all Page instances in a Wicket app, which
 could then allow me to be sure that they are all covered by a test. And
 when
 it's done maybe I could use the same system in order to ensure that
 Selenium
 (the automated functional testing tool) has covered all my pages as well
 (more deeply).
 

What you need is TDD. Once you adopt TDD, you will have every page tested.

-
--
Kent Tong
Better way to unit test Wicket pages (http://wicketpagetest.sourceforge.net)
-- 
View this message in context: 
http://old.nabble.com/Wicket-tester-test-coverage-tp26505428p26507647.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: Can i convince WicketTester to click a label?

2009-11-18 Thread Kent Tong


Newgro wrote:
 
 It's clear to me that there is no ajax event behavior added to the label.
 But can i test the html event? I would like to get this by WicketTester
 and not by external Tester (Fitnesse, Selenium etc.).
 

Would running Selenium internally work? If so, please see
http://wicketpagetest.sourceforge.net for more info.


-
--
Kent Tong
Wicket tutorials freely available at http://www.agileskills2.org/EWDW
Axis2 tutorials freely available at http://www.agileskills2.org/DWSAA
-- 
View this message in context: 
http://old.nabble.com/Can-i-convince-WicketTester-to-click-a-label--tp26405924p26406051.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



small library to unit test Wicket pages

2009-11-08 Thread Kent Tong

Dear all,

I've made a small library to unit test Wicket pages: It launches Jetty
to run your webapp in-process and launches the Selenium client. Then you
inject POJO mock objects into @SpringBean annotated fields and use the
Selenium client to drive your page.

Why I think it is useful?
* The key benefit is that you can control the right thing (the data your
pages get, from the services), and then observe the right thing (HTML
DOM elements, possible manipulated by Javascript/AJAX).

* Your real application is run. You don't need to modify it in anyway.

* It's very easy to implement as it relies on well established tools
(Selenium and Jetty). It means it can easily be kept updated with new
versions of Wicket.

* Potentially this approach can be applied to frameworks other than
Wicket.

You're welcome to test it. Visit
http://wicketpagetest.sourceforge.net/index.html for more info.

--
Kent Tong
Useful  FREE software at http://www2.cpttm.org.mo/cyberlab/freeware

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



Re: users, please give us your opinion: what is your take on generics with Wicket

2008-06-03 Thread Kent Tong

   [x] Can best be done in a limited fashion, where we only generify
IModel but not components.
   [x] Whatever choice ultimately made, I'll happily convert/ start
using 1.4 and up.

I basically agree to what Igor says on this issue.


-
--
Kent Tong
Wicket tutorials freely available at http://www.agileskills2.org/EWDW
Axis2 tutorials freely available at http://www.agileskills2.org/DWSAA
-- 
View this message in context: 
http://www.nabble.com/users%2C-please-give-us-your-opinion%3A-what-is-your-take-on-generics-with-Wicket-tp17589984p17618364.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: VOTE: Generics of IDataProvider

2008-04-29 Thread Kent Tong

[ ] IDataProviderI,T
[x] IteratorIModelT , drop model
[ ] Leave as is.

Leaving it as is just doesn't make sense as it doesn't support the use case
on hand.

Using IDataProviderI, T is OK too. For those whose I == T, we can always
have a convenient base class:

abstract class ModelProviderT implements IDataProviderT, T {
  IModelT model(T object) {
return object;
  }
}

IteratorIModelT will make the interface simpler. For those who
need to wrap domain objects as models, we can provide a wrapper
iterator:

abstract class ModelWrapperIteratorT implements IteratorT {
  ModelWrapperIterator(IteratorT source) {
...
  }
  abstract IModelT map(T sourceElement);
}



-
--
Kent Tong
Wicket tutorials freely available at http://www.agileskills2.org/EWDW
Axis2 tutorials freely available at http://www.agileskills2.org/DWSAA
-- 
View this message in context: 
http://www.nabble.com/VOTE%3A-Generics-of-IDataProvider-tp16871723p16957615.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Testing (Ajax)TabbedPanel

2008-02-29 Thread Kent Tong


Sven Schliesing wrote:
 
 This works quite good. But I'm having problems with using too much 
 internal knowledge (e.g. the tabs-container id) of the AjaxTabbedPanel.
 

You can always create your own TabPanelTester that may have a getTab(id) 
method. This class will encapsulate the internal knowledge.


-
--
Kent Tong
Wicket tutorials freely available at http://www.agileskills2.org/EWDW
Axis2 tutorials freely available at http://www.agileskills2.org/DWSAA
-- 
View this message in context: 
http://www.nabble.com/Testing-%28Ajax%29TabbedPanel-tp15739429p15772312.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Wicket Wizard form need to add custom validation to each panel

2008-02-29 Thread Kent Tong


AshleyAbraham wrote:
 
I am working on a wicket wizard component, I am trying to add an
 AbstractFormValidation to each wizardStep, so when the wizardStep is
 added/replaced the wizard form will know how to custom validate that
 particular wizardStep.
 

Why not add the form validator to the wizard step? It has an add() method
exactly
for this purpose.


-
--
Kent Tong
Wicket tutorials freely available at http://www.agileskills2.org/EWDW
Axis2 tutorials freely available at http://www.agileskills2.org/DWSAA
-- 
View this message in context: 
http://www.nabble.com/Wicket-Wizard-form-need-to-add-custom-validation-to-each-panel-tp15746917p15772387.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Page markup caching

2008-02-29 Thread Kent Tong


hbf wrote:
 
 Has anybody implemented page caching for Wicket? If possible, I'd  
 like to store the markup of a page in ehcache so that subsequent requests
 can be
 served without invoking the rendering mechanism of the framework at all.
 

You may try overriding the onRender() method in the Page class in
your own page class to retrieve the cached output.

However, I really don't think this is necessary as Wicket pages involves
no compilation of any kind like OGNL, the render time should be quite
consistent.


-
--
Kent Tong
Wicket tutorials freely available at http://www.agileskills2.org/EWDW
Axis2 tutorials freely available at http://www.agileskills2.org/DWSAA
-- 
View this message in context: 
http://www.nabble.com/Page-markup-caching-tp15734416p15772444.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Small shared resource question...

2008-02-28 Thread Kent Tong

Try:

public class P1 extends WebPage {
private ResourceReference resourceRef;

static {
WebApplication app = (WebApplication) Application.get();
mount(app, Locale.ENGLISH);
mount(app, Locale.CHINESE);
}

private static void mount(WebApplication app, Locale locale) {
ResourceReference resourceRef = makeResourceReference();
resourceRef.setLocale(locale);
app.mountSharedResource(/download/cvs_ + locale + .pdf, 
resourceRef
.getSharedResourceKey());
}

@Override
protected void onBeforeRender() {
super.onBeforeRender();
resourceRef.setLocale(getLocale());
}

public P1() {
resourceRef = makeResourceReference();
ResourceLink link = new ResourceLink(link, resourceRef);
add(link);
Link changeLocale = new Link(changeLocale) {
private int n = 0;

@Override
public void onClick() {
n++;
Locale newLocale = (n % 2 == 0) ? Locale.ENGLISH
: Locale.CHINESE;
getSession().setLocale(newLocale);
}
};
add(changeLocale);
}

private static ResourceReference makeResourceReference() {
return new ResourceReference(cvs.pdf) {
@Override
protected Resource newResource() {
return new PDFResource(getLocale());
}
};
}

}
public class PDFResource extends DynamicWebResource {

public PDFResource(Locale locale) {
super(locale);
}

@Override
protected ResourceState getResourceState() {
ResourceState state = new ResourceState() {

@Override
public byte[] getData() {
return readPDF();
}

@Override
public String getContentType() {
return application/pdf;
}

};
return state;
}

protected byte[] readPDF() {
try {
File f = new File(c:/tmp/cvs_+getLocale()+.pdf);
FileInputStream s = new FileInputStream(f);
byte[] content = new byte[(int) f.length()];
s.read(content);
s.close();
return content;
} catch (IOException e) {
throw new RuntimeException(e);
}
}

}


-
--
Kent Tong
Wicket tutorials freely available at http://www.agileskills2.org/EWDW
Axis2 tutorials freely available at http://www.agileskills2.org/DWSAA
-- 
View this message in context: 
http://www.nabble.com/Re%3A-Small-shared-resource-question...-tp15663443p15737491.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Small shared resource question...

2008-02-27 Thread Kent Tong


Sebastiaan van Erk wrote:
 
 In my web page with the resource link I do the following:
 
   fragment.add(new ResourceLink(cvEnglishLink, new 
 ResourceReference(cvs_en.pdf)) {
   @Override
   public boolean isVisible() {
   return en.equals(getLocale().getLanguage());
   }
   });
 

Try:

public class P1 extends WebPage {
public P1() {
ResourceReference resourceRef = new 
ResourceReference(cvs.pdf) {
protected Resource newResource() {
return new PDFResource(getLocale());
}
};
resourceRef.setLocale(getLocale()); //THIS IS THE LINE
ResourceLink link = new ResourceLink(link, resourceRef);
add(link);
}
}



-
--
Kent Tong
Wicket tutorials freely available at http://www.agileskills2.org/EWDW
Axis2 tutorials freely available at http://www.agileskills2.org/DWSAA
-- 
View this message in context: 
http://www.nabble.com/Re%3A-Small-shared-resource-question...-tp15663443p15714682.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Small shared resource question...

2008-02-27 Thread Kent Tong


Sebastiaan van Erk wrote:
 
 As far as I can tell, there's still only 1 resource, which has the 
 locale of the page (at creation time).
 

Every time the page is rendered, it will generate a different variant of
the resource reference due to the setLocale() call.


Sebastiaan van Erk wrote:
 
 But I have a link on the page which allows you to change the locale. 
 This link is stateful, so it just calls the callback on the current page 
 and sets the locale.
 

No problem. If the link is a normal link (not ajax), you'll render the
page again and thus will have a new resource reference. If it's
ajax, you need to put the setLocale() call into a callback and
refresh the link.


-
--
Kent Tong
Wicket tutorials freely available at http://www.agileskills2.org/EWDW
Axis2 tutorials freely available at http://www.agileskills2.org/DWSAA
-- 
View this message in context: 
http://www.nabble.com/Re%3A-Small-shared-resource-question...-tp15663443p15727184.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Wicket as a front controller ?

2008-02-25 Thread Kent Tong
smallufo smallufo at gmail.com writes:

 I just need to redirect.
 If bbAuth token is correct , then set correct Wicket Session and redirect to
 proper page.
 If incorrect , then redirect to another page.

To redirect, try:

public class P1 extends WebPage {
@Override
protected void onBeforeRender() {
super.onBeforeRender();
throw new RestartResponseException(P2.class);
}

}
--
Kent Tong
Wicket book with free chapters at http://www.agileskills2.org/EWDW



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Wicket as a front controller ?

2008-02-24 Thread Kent Tong


smallufo wrote:
 
 Thank you , but I want a (bookmarkable) page without HTML
 Is it possible ?
 

What do you want to output?

-
--
Kent Tong
Wicket tutorials freely available at http://www.agileskills2.org/EWDW
Axis2 tutorials freely available at http://www.agileskills2.org/DWSAA
-- 
View this message in context: 
http://www.nabble.com/Wicket-as-a-front-controller---tp15656646p15664148.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Accessing prototype scoped panel beans using @SpringBean annotation

2008-02-23 Thread Kent Tong


Ned Collyer wrote:
 
 Spring is meant to be the factory :).  Isn't that a big part of why we use
 Spring?
 
 Incidently there is a Classes class that has some handy cached stuff for
 resolving class references.
 see org.apache.wicket.util.lang.Classes
 

You can certain make the PanelFactory a spring bean:

public class TestPage extends WebPage {
@SpringBean(name = panelFactory)
private PanelFactory panelFactory;

public TestPage() {
add(panelFactory.getPanel(testPanelOne));
}

}
bean id=config class=myapp.Config scope=singleton
property name=panelClass
valuemyapp.TestPanel/value
/property
/bean
bean id=panelFactory class=myapp.PanelFactory scope=singleton
property name=config ref=config/
/bean


The Wicket Classes class is not meant for performance. Normal classloaders
probable 
provide better caching support. It was introduced to fix concurrency
problems.


-
--
Kent Tong
Wicket tutorials freely available at http://www.agileskills2.org/EWDW
Axis2 tutorials freely available at http://www.agileskills2.org/DWSAA
-- 
View this message in context: 
http://www.nabble.com/Accessing-prototype-scoped-panel-beans-using-%40SpringBean-annotation-tp15627974p15651407.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Wicket LinkTree subtree collapse/expand

2008-02-23 Thread Kent Tong


Sebastiaan van Erk wrote:
 
 Ok, thanks for the quick reply. :-)
 
 https://issues.apache.org/jira/browse/WICKET-1366
 

I've added some comments to it. For a workaround, try:

tree = new LinkTree(t, model) {
protected Component newNodeComponent(String id, IModel model) {
return new LinkIconPanel(id, model, this) {
protected void onNodeLinkClicked(TreeNode node,
BaseTree tree, AjaxRequestTarget 
target) {
tree.getTreeState().selectNode(node,

!tree.getTreeState().isNodeSelected(node));
onClicked(node, tree, target);
}
protected Component newContentComponent(String 
componentId,
BaseTree tree, IModel model) {
return new Label(componentId, 
getNodeTextModel(model));
}
};
}

protected void onClicked(TreeNode node, BaseTree tree,
AjaxRequestTarget target) {
if (!node.isLeaf()) {
if (tree.getTreeState().isNodeExpanded(node)) {
collapseAll(node);
} else {
expandAll(node);
}
tree.updateTree(target);
} else {
System.out.println(Arrays
.toString(((DefaultMutableTreeNode) 
node)
.getUserObjectPath()));
}
}
};



-
--
Kent Tong
Wicket tutorials freely available at http://www.agileskills2.org/EWDW
Axis2 tutorials freely available at http://www.agileskills2.org/DWSAA
-- 
View this message in context: 
http://www.nabble.com/Wicket-LinkTree-subtree-collapse-expand-tp15639680p15651849.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Custom validation message for 'int'?

2008-02-23 Thread Kent Tong


florin.g wrote:
 
 I cannot seem to find a way to provide a custom validation message for
 'int'. (I learned for most others).
 fieldName.int does not work
 fieldName.Integer does not work
 fieldName.Number does not work
 

fieldName.int


-
--
Kent Tong
Wicket tutorials freely available at http://www.agileskills2.org/EWDW
Axis2 tutorials freely available at http://www.agileskills2.org/DWSAA
-- 
View this message in context: 
http://www.nabble.com/Custom-validation-message-for-%27int%27--tp15651406p15652093.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Custom validation message for 'int'?

2008-02-23 Thread Kent Tong


florin.g wrote:
 
 I cannot seem to find a way to provide a custom validation message for
 'int'. (I learned for most others).
 fieldName.int does not work
 fieldName.Integer does not work
 fieldName.Number does not work
 

fieldName.int is the one to use. Make sure you have reloaded your app.
Otherwise, post 
your code.

-
--
Kent Tong
Wicket tutorials freely available at http://www.agileskills2.org/EWDW
Axis2 tutorials freely available at http://www.agileskills2.org/DWSAA
-- 
View this message in context: 
http://www.nabble.com/Custom-validation-message-for-%27int%27--tp15651406p15652102.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: AjaxFormSubmitBehavior and setDefaultFormProcessing(false)?

2008-02-23 Thread Kent Tong


Juha Alatalo wrote:
 
 In this case I have to visit different page when browse is chosen. When 
 I come back form is cleared, isn't it?
 

Have you tried just clearing the feedback messages?

-
--
Kent Tong
Wicket tutorials freely available at http://www.agileskills2.org/EWDW
Axis2 tutorials freely available at http://www.agileskills2.org/DWSAA
-- 
View this message in context: 
http://www.nabble.com/AjaxFormSubmitBehavior-and-setDefaultFormProcessing%28false%29--tp15609891p15652225.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Wicket as a front controller ?

2008-02-23 Thread Kent Tong


smallufo wrote:
 
 I have a normal wicket webapp , but I need one endpoint to process
 Yahoo's
 bbAuth's request.
 Yes , I can write normal servlet to process this , but normal servlet
 lacks
 of spring injection and cannot access to wicket's environment.
 

Have you tried using a bookmarkabke page as the endpoint? Something like
http://foo.com/MyApp/app/?wicket:bookmarkablePage=:com.foo.MyApp.MyPage


-
--
Kent Tong
Wicket tutorials freely available at http://www.agileskills2.org/EWDW
Axis2 tutorials freely available at http://www.agileskills2.org/DWSAA
-- 
View this message in context: 
http://www.nabble.com/Wicket-as-a-front-controller---tp15656646p15660420.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Accessing prototype scoped panel beans using @SpringBean annotation

2008-02-22 Thread Kent Tong


Ned Collyer wrote:
 
 There are a few ways to approach this, ie, having some class loader which
 resolves given string class references, and those strings are wired in
 through spring.  This works - but feels a bit hacky.
 

I don't know why you feel this hacky. It looks clean and easy to me:

public class TestPage extends WebPage {
@SpringBean(name = config)
private Config config;

public TestPage() {
add(PanelFactory.getPanel(config, testPanelOne));
}
}

public class PanelFactory {
public static Panel getPanel(Config config, String id) {
Class? extends Panel c =
Class.forName(config.getPanelClass()).asSubclass(Panel.class);
Constructor? extends Panel constructor = 
c.getConstructor(String.class);
return constructor.newInstance(id);
}
}



-
--
Kent Tong
Wicket tutorials freely available at http://www.agileskills2.org/EWDW
Axis2 tutorials freely available at http://www.agileskills2.org/DWSAA
-- 
View this message in context: 
http://www.nabble.com/Accessing-prototype-scoped-panel-beans-using-%40SpringBean-annotation-tp15627974p15648766.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Helloworld Application cant be started

2008-01-23 Thread Kent Tong


gbak1 wrote:
 
 Im a newbie and am having problems with the helloworld example.
 I have created an ant script to create an application WAR and I can deploy
 this WAR to tomcat (running on fedora7).
 After deploy, Tomcat fails to start the application and displays the
 following message: FAIL - Application at context path
 /HelloWorldApplication could not be started.
 This only occurs when I include the filter tags which I copied and pasted
 from the example and which I modified to suit my own helloworld
 application.
 Im now down to guessing and hope someone can point me in the right
 direction.
 

Most likely you're missing some jars. Wicket needs some jars not included in
the
distribution. You may follow my tutorial to get started (see my signature
for
the URL).


-
--
Kent Tong
Wicket tutorials freely available at http://www.agileskills2.org/EWDW
Axis2 tutorials freely available at http://www.agileskills2.org/DWSAA
-- 
View this message in context: 
http://www.nabble.com/Helloworld-Application-cant-be-started-tp15039388p15056909.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



required for Checkbox

2008-01-07 Thread Kent Tong

Hi,

I observed that if required is set to true for a Checkbox, Wicket will
ensure that the Checkbox is checked. If it is cleared by the user, it
will be treated as an error. See 
https://issues.apache.org/jira/browse/WICKET-1221 and
https://issues.apache.org/jira/browse/WICKET-1260 for some
background.

For me, required means that a value must be provided. For a 
check box, if it is checked, it has a value of true. if it is unchecked, it 
has a value of false. So it always satisfy required. Treating required 
as having a value of true doesn't sound correct to me.

If we consider the error message that should be used, for the case of
forcing the user to check the box (eg, [x] I have read the agreement), 
it should say you must check xxx, which is quite different from the 
error message for required: you must provide xxx.

For the use case of forcing a checked check box, I think an CheckedValidator 
should be used, which can provide a much better default error message.

Not that it's an important, but just to see what others think.

-
--
Kent Tong
Wicket tutorials freely available at http://www.agileskills2.org/EWDW
Axis2 tutorials freely available at http://www.agileskills2.org/DWSAA
-- 
View this message in context: 
http://www.nabble.com/%22required%22-for-Checkbox-tp14662131p14662131.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: facebook support

2007-11-08 Thread Kent Tong


Matt Jensen-2 wrote:
 
 I am working on this, though I'm trying to leave the door open to also 
 supporting MySpace in the future.  I have not done much yet--and nothing 
 Wicket-specific--but I do plan to include a Wicket module.
 

Have you considered Google's OpenSocial API?

-
--
Kent Tong
Wicket tutorials freely available at http://www.agileskills2.org/EWDW
-- 
View this message in context: 
http://www.nabble.com/facebook-support-tf4773546.html#a13660095
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Locale change on Image with Resource results in broken images

2007-10-13 Thread Kent Tong


Jonas-21 wrote:
 
 I think LocalizedImageResource.setSrcAttribute(...) shouldn't
 reset the resource field if locales (and styles) don't match, since
 Resource doesn't seem to be locale/style specific (unlike
 ResourceReference) and cannot be reloaded/recomputed
 as the commentary suggests if the
 Image(String id, Resource imageResource) constructor was
 used.
 

This indeed looks like a bug to me.


-
--
Kent Tong
Wicket tutorials freely available at http://www.agileskills2.org/EWDW
-- 
View this message in context: 
http://www.nabble.com/Locale-change-on-Image-with-Resource-results-in-broken-images-tf4613589.html#a13190540
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Ajax paging navigation link exception

2007-10-13 Thread Kent Tong


kent lai wrote:
 
   Anyway I am using AjaxPagingNavigator, and wheneven i do a double  
 click(or however many times, my mouse *is* kinda faulty in that it  
 triggers multiple clicks sometimes), i get the following,
 
   WicketMessage: Unable to find AjaxPagingNavigator component in  
 hierarchy starting from [MarkupContainer [Component id = pageLink,  
 page = No Page, path = 0:pageLink.AjaxPagingNavigationLink]]
 

Are you using the latest v1.3?

-
--
Kent Tong
Wicket tutorials freely available at http://www.agileskills2.org/EWDW
-- 
View this message in context: 
http://www.nabble.com/Ajax-paging-navigation-link-exception-tf4612911.html#a13195781
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Configuring DatePicker

2007-10-13 Thread Kent Tong


Christopher Gardner-2 wrote:
 
 Does anyone have any examples of configuring DatePicker?  I'd like to
 limit the minimal date, for example.  I subclassed it and overrode
 configure() to set what I thought the Yahoo documentation said to to
 specify the minimal date, but to no avail.
 

The code below works fine for me:

TextField d = new TextField(d);
d.add(new DatePicker() {
protected void configure(Map widgetProperties) {
widgetProperties.put(mindate, 10/3/2007);
super.configure(widgetProperties);
}
});


-
--
Kent Tong
Wicket tutorials freely available at http://www.agileskills2.org/EWDW
-- 
View this message in context: 
http://www.nabble.com/Configuring-DatePicker-tf4616962.html#a13195942
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: RFE: DataTable colgroup

2007-10-13 Thread Kent Tong


Jan Kriesten wrote:
 
 might be, but it's a nice feature for just styling col-width and
 col-alignment.
 actually, this would be an optional add-on, no replacement for
 IStyledColumn.
 
 since it is pretty easy to implement, what are the pitfalls when have it
 added?
 

All mozilla-based browsers don't support it due to an alleged contradiction
between 
HTML4 and CSS (see https://bugzilla.mozilla.org/show_bug.cgi?id=915#c27).


-
--
Kent Tong
Wicket tutorials freely available at http://www.agileskills2.org/EWDW
-- 
View this message in context: 
http://www.nabble.com/RFE%3A-DataTablecolgroup-tf4618089.html#a13196020
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Empty ListChoice

2007-10-12 Thread Kent Tong


Matt Jensen-2 wrote:
 
 Is there any way to get a ListChoice to render as empty (no options) 
 when its choice model is empty?  By default, Choose One appears.  If I 
 set nullValid to true, an empty item appears which is still selectable.  
 I would like to have the list come up completely empty if the choice 
 model is empty, and I'd like to do it without creating a new component 
 (though obviously I will do that if it is what is needed.)
 

Try:

ListChoice lc = new ListChoice(lc, ...) {
protected CharSequence getDefaultChoice(Object selected) {
return ;
}
};

-
--
Kent Tong
Wicket tutorials freely available at http://www.agileskills2.org/EWDW
-- 
View this message in context: 
http://www.nabble.com/Empty-ListChoice-tf4604759.html#a13172939
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Validating a NonZero Values and Validators Project in General

2007-10-12 Thread Kent Tong


Francisco Diaz Trepat - gmail wrote:
 
 Although I think maybe there are some validators we would all use like
 those
 already included in wicket.
 

nonzero positive: NumberValidator.minimum(1)
nonzero negative: NumberValidator.maximum(-1)
nonzero positive or negative: do as Gwyn suggested. If you insist on using a
pre-built
validator, try PatternValidator([+|-]?(\\d)*[1-9](\\d)*) but then the
model has to
be a String, not a number.


-
--
Kent Tong
Wicket tutorials freely available at http://www.agileskills2.org/EWDW
-- 
View this message in context: 
http://www.nabble.com/Validating-a-NonZero-Values-and-Validators-Project-in-General-tf4609372.html#a13172551
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Empty ListChoice

2007-10-12 Thread Kent Tong


Matt Jensen-2 wrote:
 
 I believe that doing this causes the list to contain one empty, but 
 still selectable, element.  That is what I am trying to avoid--I just 
 want a plain empty list.  I'm starting to wonder whether empty lists are 
 considered to not be the Wicket way, as it seems like it should be 
 easier than this.  Does ListChoice *intentionally* not allow for an 
 empty list?  I expected to find something like 
 allowEmpty(boolean)...but no dice.
 

Have you tried my code? The list has no selectable entry.


-
--
Kent Tong
Wicket tutorials freely available at http://www.agileskills2.org/EWDW
-- 
View this message in context: 
http://www.nabble.com/Empty-ListChoice-tf4604759.html#a13186476
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Wicket tutorials updated for beta4

2007-10-12 Thread Kent Tong

Hi,

I've updated my free Wicket tutorials to beta4. They're available at 
http://www.agileskills2.org/EWDW/index.html


-
--
Kent Tong
Wicket tutorials freely available at http://www.agileskills2.org/EWDW
-- 
View this message in context: 
http://www.nabble.com/Wicket-tutorials-updated-for-beta4-tf4617202.html#a13186497
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: CompoundPropertyModel stops working when form validation fails.

2007-10-08 Thread Kent Tong


Fabio Fioretti wrote:
 
 You were right Kent, thanks a lot! Calling clearInput() in the
 updating behavior really fixes the problem.
 
 What I miss now is why the CompoundPropertyModel breaks if the form is
 not manually reset by calling clearInput(). Is it a bug or a feature?
 :)
 

It's a feature. When the selection changes, the user might have entered
something into say a text field. Generally we don't want to lose that
input (because all you want to do may be to show or hide a certain component
depending on the selection), therefore it is saved and redisplayed to the 
user. By default it is clear only when the form is submitted and validation 
is passed successfully.


-
--
Kent Tong
Wicket tutorials freely available at http://www.agileskills2.org/EWDW
-- 
View this message in context: 
http://www.nabble.com/CompoundPropertyModel-stops-working-when-form-validation-fails.-tf4562483.html#a13092730
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: CompoundPropertyModel stops working when form validation fails.

2007-10-05 Thread Kent Tong


Fabio Fioretti wrote:
 
 This is what I do, basically:
 1) Select a choice from the ListChoice;
 2) The form automatically fills with the data of the selected
 recommendation instance;
 3) Modify the data in the form so that validation will fail;
 4) Submit data -- validation fails;
 5) Select another choice from the ListChoice;
 6) The form doesn't get updated anymore (and keeps showing old data of
 the recommendation instance that failed validation)
 

I suppose you're using wantOnSelectionChangedNotifications() to trigger
the refresh? In that case it won't refresh any input entered by the user.
Validation plays no role here because such a form refresh does NOT invoke
the validation logic.

In order to refresh the data and erase what the user has entered, call
clearInput() on the form:

ListChoice recommendation = new ListChoice(recommendation, ...) {
protected boolean wantOnSelectionChangedNotifications() {
return true;
}
protected void onSelectionChanged(Object newSelection) {
recommendationForm.clearInput();
}
};

--
Kent Tong
Wicket tutorials freely available at http://www.agileskills2.org/EWDW
-- 
View this message in context: 
http://www.nabble.com/CompoundPropertyModel-stops-working-when-form-validation-fails.-tf4562483.html#a13057990
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



  1   2   >