Re: wicket-event added twice problem

2008-08-28 Thread Tomasz Prus
In which Wicket version should be filtered?

2008/8/28 Tomasz Prus [EMAIL PROTECTED]

 Heh :) Lightbox, not livebox

 2008/8/28 Tomasz Prus [EMAIL PROTECTED]

 Wicket 1.3.4

 When i add livebox JS script and google maps then livebox doesn't work
 properly because wicket-event is added twice.

 2008/8/27 Matej Knopp [EMAIL PROTECTED]

 What wicket version? This should be filtered by wicket.

 -Matej

 On Wed, Aug 27, 2008 at 4:13 PM, Nino Saturnino Martinez Vazquez Wael
 [EMAIL PROTECTED] wrote:
  show us some code..:)
 
  Tomasz Prus wrote:
 
  Hi
 
  I have problem because wicket-event.js is added twice and couse error.
  (each
  component with wicket-event.js adds it)
 
  Please help, how can i add it only one?
 
  Similar problem is with css files
 
  Best regards,
  Tomek
 
 
 
  --
  -Wicket for love
 
  Nino Martinez Wael
  Java Specialist @ Jayway DK
  http://www.jayway.dk
  +45 2936 7684
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 

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






Re: wicket-event added twice problem

2008-08-28 Thread Tomasz Prus
I have inluded gmap component which adds wicket-event and i have other
component with:

script type=text/javascript
src=/resources/org.apache.wicket.markup.html.WicketEventReference/wicket-event.js/script
script type=text/javascript
Wicket.Event.add(window, domready, function() {
var gallery = new iCarousel(gallery_content, {
idPrevious: gallery_previous,
idNext: gallery_next,
idToggle: undefined,
item: {
klass: gallery_item,
size: 284
},
animation: {
type: fadeNscroll,
duration: 600,
amount: 1
}
});
var i = 0;
while($(thumb + i) != false) {
 $(thumb + i).addEvent(click, function(event){ new
Event(event).stop(); gallery.goTo(this.id.replace(/thumb/,'')); });
 i++;
}
  });
/script

and i think that wicket event object is recreated. Please give me some
advise?

2008/8/28 Tomasz Prus [EMAIL PROTECTED]

 In which Wicket version should be filtered?


 2008/8/28 Tomasz Prus [EMAIL PROTECTED]

 Heh :) Lightbox, not livebox

 2008/8/28 Tomasz Prus [EMAIL PROTECTED]

 Wicket 1.3.4

 When i add livebox JS script and google maps then livebox doesn't work
 properly because wicket-event is added twice.

 2008/8/27 Matej Knopp [EMAIL PROTECTED]

 What wicket version? This should be filtered by wicket.

 -Matej

 On Wed, Aug 27, 2008 at 4:13 PM, Nino Saturnino Martinez Vazquez Wael
 [EMAIL PROTECTED] wrote:
  show us some code..:)
 
  Tomasz Prus wrote:
 
  Hi
 
  I have problem because wicket-event.js is added twice and couse
 error.
  (each
  component with wicket-event.js adds it)
 
  Please help, how can i add it only one?
 
  Similar problem is with css files
 
  Best regards,
  Tomek
 
 
 
  --
  -Wicket for love
 
  Nino Martinez Wael
  Java Specialist @ Jayway DK
  http://www.jayway.dk
  +45 2936 7684
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 

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







Re: wicket-event added twice problem

2008-08-28 Thread Tomasz Prus
html


2008/8/28 Nino Saturnino Martinez Vazquez Wael [EMAIL PROTECTED]

 The other component, did you write the reference to wicket-event in html or
 via and header contributer..?


 Tomasz Prus wrote:

 I have inluded gmap component which adds wicket-event and i have other
 component with:

 script type=text/javascript

 src=/resources/org.apache.wicket.markup.html.WicketEventReference/wicket-event.js/script
script type=text/javascript
Wicket.Event.add(window, domready, function() {
var gallery = new iCarousel(gallery_content, {
idPrevious: gallery_previous,
idNext: gallery_next,
idToggle: undefined,
item: {
klass: gallery_item,
size: 284
},
animation: {
type: fadeNscroll,
duration: 600,
amount: 1
}
});
var i = 0;
while($(thumb + i) != false) {
 $(thumb + i).addEvent(click, function(event){ new
 Event(event).stop(); gallery.goTo(this.id.replace(/thumb/,'')); });
 i++;
}
  });
/script

 and i think that wicket event object is recreated. Please give me some
 advise?

 2008/8/28 Tomasz Prus [EMAIL PROTECTED]



 In which Wicket version should be filtered?


 2008/8/28 Tomasz Prus [EMAIL PROTECTED]



 Heh :) Lightbox, not livebox

 2008/8/28 Tomasz Prus [EMAIL PROTECTED]

 Wicket 1.3.4


 When i add livebox JS script and google maps then livebox doesn't work
 properly because wicket-event is added twice.

 2008/8/27 Matej Knopp [EMAIL PROTECTED]

 What wicket version? This should be filtered by wicket.


 -Matej

 On Wed, Aug 27, 2008 at 4:13 PM, Nino Saturnino Martinez Vazquez Wael
 [EMAIL PROTECTED] wrote:


 show us some code..:)

 Tomasz Prus wrote:


 Hi

 I have problem because wicket-event.js is added twice and couse


 error.


 (each
 component with wicket-event.js adds it)

 Please help, how can i add it only one?

 Similar problem is with css files

 Best regards,
 Tomek




 --
 -Wicket for love

 Nino Martinez Wael
 Java Specialist @ Jayway DK
 http://www.jayway.dk
 +45 2936 7684


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




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








 --
 -Wicket for love

 Nino Martinez Wael
 Java Specialist @ Jayway DK
 http://www.jayway.dk
 +45 2936 7684


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




wicket-event added twice problem

2008-08-27 Thread Tomasz Prus
Hi

I have problem because wicket-event.js is added twice and couse error. (each
component with wicket-event.js adds it)

Please help, how can i add it only one?

Similar problem is with css files

Best regards,
Tomek


Re: wicket-event added twice problem

2008-08-27 Thread Tomasz Prus
Wicket 1.3.4

When i add livebox JS script and google maps then livebox doesn't work
properly because wicket-event is added twice.

2008/8/27 Matej Knopp [EMAIL PROTECTED]

 What wicket version? This should be filtered by wicket.

 -Matej

 On Wed, Aug 27, 2008 at 4:13 PM, Nino Saturnino Martinez Vazquez Wael
 [EMAIL PROTECTED] wrote:
  show us some code..:)
 
  Tomasz Prus wrote:
 
  Hi
 
  I have problem because wicket-event.js is added twice and couse error.
  (each
  component with wicket-event.js adds it)
 
  Please help, how can i add it only one?
 
  Similar problem is with css files
 
  Best regards,
  Tomek
 
 
 
  --
  -Wicket for love
 
  Nino Martinez Wael
  Java Specialist @ Jayway DK
  http://www.jayway.dk
  +45 2936 7684
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 

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




Re: wicket-event added twice problem

2008-08-27 Thread Tomasz Prus
Heh :) Lightbox, not livebox

2008/8/28 Tomasz Prus [EMAIL PROTECTED]

 Wicket 1.3.4

 When i add livebox JS script and google maps then livebox doesn't work
 properly because wicket-event is added twice.

 2008/8/27 Matej Knopp [EMAIL PROTECTED]

 What wicket version? This should be filtered by wicket.

 -Matej

 On Wed, Aug 27, 2008 at 4:13 PM, Nino Saturnino Martinez Vazquez Wael
 [EMAIL PROTECTED] wrote:
  show us some code..:)
 
  Tomasz Prus wrote:
 
  Hi
 
  I have problem because wicket-event.js is added twice and couse error.
  (each
  component with wicket-event.js adds it)
 
  Please help, how can i add it only one?
 
  Similar problem is with css files
 
  Best regards,
  Tomek
 
 
 
  --
  -Wicket for love
 
  Nino Martinez Wael
  Java Specialist @ Jayway DK
  http://www.jayway.dk
  +45 2936 7684
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 

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





strange links

2008-06-06 Thread Tomasz Prus
I have links like this

a class=B href=../../../Logowanie

in page source. My boss wants i remove these dots.

Can anyone help me ?


Re: strange links

2008-06-06 Thread Tomasz Prus
What is the reason? Why it is useful for website and why there is no option
to disable it?



2008/6/6 Matej Knopp [EMAIL PROTECTED]:

 The dots are there for a reason. Wicket generates relative URLs.

 -Matej

 On Fri, Jun 6, 2008 at 8:44 AM, Tomasz Prus [EMAIL PROTECTED] wrote:
  I have links like this
 
  a class=B href=../../../Logowanie
 
  in page source. My boss wants i remove these dots.
 
  Can anyone help me ?
 

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




how can ..

2008-05-23 Thread Tomasz Prus
How can i prepare url like this: ../London/9.html

I need that city and advertNumber parameters be always at the end of url.

Can You help me?

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



Re: how can ..

2008-05-23 Thread Tomasz Prus
Do You know SEO optimized urls like
http://www.nabble.com/Page-reload-after-file-upload-td15869570.html ?

2008/5/23 Thomas Mäder [EMAIL PROTECTED]:

 What are you trying to achieve? Why do you need a text url instead of a
 link
 to a page?

 Thomas

 On Fri, May 23, 2008 at 9:07 AM, Tomasz Prus [EMAIL PROTECTED] wrote:

  How can i prepare url like this: ../London/9.html
 
  I need that city and advertNumber parameters be always at the end of url.
 
  Can You help me?
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 



Re: how can ..

2008-05-23 Thread Tomasz Prus
My boss wants such urls

2008/5/23 Tomasz Prus [EMAIL PROTECTED]:

 Do You know SEO optimized urls like
 http://www.nabble.com/Page-reload-after-file-upload-td15869570.html ?

 2008/5/23 Thomas Mäder [EMAIL PROTECTED]:

 What are you trying to achieve? Why do you need a text url instead of a
 link
 to a page?

 Thomas

 On Fri, May 23, 2008 at 9:07 AM, Tomasz Prus [EMAIL PROTECTED] wrote:

  How can i prepare url like this: ../London/9.html
 
  I need that city and advertNumber parameters be always at the end of
 url.
 
  Can You help me?
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 





Re: how can ..

2008-05-23 Thread Tomasz Prus
What strategy should i use to achive such url:
http://isport.eu/en/premier-league/liverpool-fc/news-19-2008-0.html ?

2008/5/23 Jonas [EMAIL PROTECTED]:

 Have you looked in the wiki?
 http://cwiki.apache.org/WICKET/reference-library.html
 This might be what you're looking for:
 http://cwiki.apache.org/WICKET/seo-search-engine-optimization.html


 On Fri, May 23, 2008 at 9:46 AM, Tomasz Prus [EMAIL PROTECTED] wrote:
  My boss wants such urls
 
  2008/5/23 Tomasz Prus [EMAIL PROTECTED]:
 
  Do You know SEO optimized urls like
  http://www.nabble.com/Page-reload-after-file-upload-td15869570.html ?
 
  2008/5/23 Thomas Mäder [EMAIL PROTECTED]:
 
  What are you trying to achieve? Why do you need a text url instead of a
  link
  to a page?
 
  Thomas
 
  On Fri, May 23, 2008 at 9:07 AM, Tomasz Prus [EMAIL PROTECTED]
 wrote:
 
   How can i prepare url like this: ../London/9.html
  
   I need that city and advertNumber parameters be always at the end of
  url.
  
   Can You help me?
  
   -
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
  
  
 
 
 
 

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




Re: how can ..

2008-05-23 Thread Tomasz Prus
hey, can you help me ?!!!

2008/5/23 Tomasz Prus [EMAIL PROTECTED]:

 What strategy should i use to achive such url:
 http://isport.eu/en/premier-league/liverpool-fc/news-19-2008-0.html ?

 2008/5/23 Jonas [EMAIL PROTECTED]:

 Have you looked in the wiki?
 http://cwiki.apache.org/WICKET/reference-library.html
 This might be what you're looking for:
 http://cwiki.apache.org/WICKET/seo-search-engine-optimization.html


 On Fri, May 23, 2008 at 9:46 AM, Tomasz Prus [EMAIL PROTECTED] wrote:
  My boss wants such urls
 
  2008/5/23 Tomasz Prus [EMAIL PROTECTED]:
 
  Do You know SEO optimized urls like
  http://www.nabble.com/Page-reload-after-file-upload-td15869570.html ?
 
  2008/5/23 Thomas Mäder [EMAIL PROTECTED]:
 
  What are you trying to achieve? Why do you need a text url instead of a
  link
  to a page?
 
  Thomas
 
  On Fri, May 23, 2008 at 9:07 AM, Tomasz Prus [EMAIL PROTECTED]
 wrote:
 
   How can i prepare url like this: ../London/9.html
  
   I need that city and advertNumber parameters be always at the end of
  url.
  
   Can You help me?
  
  
 -
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
  
  
 
 
 
 

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





OpenSessionInView and LazyInitializationException

2008-05-07 Thread Tomasz Prus
I had such configuration:

?xml version=1.0 encoding=UTF-8?
web-app id=WebApp_ID version=2.4 xmlns=http://java.sun.com/xml/ns/j2ee;
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=
http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd;

context-param
param-namecontextConfigLocation/param-name
param-value/WEB-INF/carpartswebsite-servlet.xml/param-value
/context-param

listener

listener-classorg.springframework.web.context.ContextLoaderListener/listener-class
/listener

servlet
servlet-namecarpartswebsite/servlet-name

servlet-classorg.springframework.web.servlet.DispatcherServlet/servlet-class
load-on-startup1/load-on-startup
  /servlet

  servlet
servlet-namewicket/servlet-name

servlet-classorg.apache.wicket.protocol.http.WicketServlet/servlet-class
init-param
param-nameapplicationFactoryClassName/param-name

param-valueorg.apache.wicket.spring.SpringWebApplicationFactory/param-value
/init-param
load-on-startup1/load-on-startup
/servlet

  servlet-mapping
servlet-namewicket/servlet-name
url-pattern/*/url-pattern
  /servlet-mapping

  servlet
servlet-nameXFireSOAPServlet/servlet-name

servlet-classorg.codehaus.xfire.spring.XFireSpringServlet/servlet-class
load-on-startup1/load-on-startup
/servlet

servlet-mapping
servlet-nameXFireSOAPServlet/servlet-name
url-pattern/services/*/url-pattern
/servlet-mapping

  filter
filter-nameOpenSessionInViewFilter/filter-name

filter-classpl.mainseek.car.commons.CarPartsOpenSessionInViewFilter/filter-class
  /filter

  filter-mapping
filter-nameOpenSessionInViewFilter/filter-name
url-pattern/*/url-pattern
  /filter-mapping

welcome-file-list
welcome-fileindex.jsp/welcome-file
welcome-fileindex.html/welcome-file
  /welcome-file-list
/web-app


.. and this was working, but when i've changed servlet mapping to filter
mapping:

?xml version=1.0?
web-app xmlns=http://java.sun.com/xml/ns/j2ee; xmlns:xsi=
http://www.w3.org/TR/xmlschema-1/;
xsi:schemaLocation=http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd;
version=2.4
context-param
param-namecontextConfigLocation/param-name
param-value/WEB-INF/carpartswebsite-servlet.xml/param-value
/context-param

listener

listener-classorg.springframework.web.context.ContextLoaderListener/listener-class
/listener

!--servlet
servlet-namecarpartswebsite/servlet-name

servlet-classorg.springframework.web.servlet.DispatcherServlet/servlet-class
load-on-startup1/load-on-startup
  /servlet--

filter
filter-nameWicketFilter/filter-name

filter-classorg.apache.wicket.protocol.http.WicketFilter/filter-class
init-param
param-nameapplicationFactoryClassName/param-name

param-valueorg.apache.wicket.spring.SpringWebApplicationFactory/param-value
param-nameapplicationBean/param-name
param-valuewicketApplication/param-value
/init-param
/filter
filter-mapping
filter-nameWicketFilter/filter-name
url-pattern/*/url-pattern
dispatcherREQUEST/dispatcher
dispatcherERROR/dispatcher

error-page
error-code404/error-code
location/404/location
/error-page
/filter-mapping

!--servlet
servlet-namewicket/servlet-name

servlet-classorg.apache.wicket.protocol.http.WicketServlet/servlet-class
init-param
param-nameapplicationFactoryClassName/param-name

param-valueorg.apache.wicket.spring.SpringWebApplicationFactory/param-value
/init-param
load-on-startup1/load-on-startup
/servlet

  servlet-mapping
servlet-namewicket/servlet-name
url-pattern/*/url-pattern
  /servlet-mapping--

  servlet
servlet-nameXFireSOAPServlet/servlet-name

servlet-classorg.codehaus.xfire.spring.XFireSpringServlet/servlet-class
load-on-startup1/load-on-startup
/servlet

servlet-mapping
servlet-nameXFireSOAPServlet/servlet-name
url-pattern/services/*/url-pattern
/servlet-mapping

  filter
filter-nameOpenSessionInViewFilter/filter-name

filter-classpl.mainseek.car.commons.CarPartsOpenSessionInViewFilter/filter-class
  /filter

  filter-mapping
filter-nameOpenSessionInViewFilter/filter-name
url-pattern/*/url-pattern
  /filter-mapping

welcome-file-list
welcome-fileindex.jsp/welcome-file
welcome-fileindex.html/welcome-file
  /welcome-file-list
/web-app

.. it doesn't work. I get the org.hibernate.LazyInitializationException.

Please, help me !!! :)


AjaxLink doesn't work for Wicket 1.3.3 ?

2008-04-14 Thread Tomasz Prus
I have AjaxLink which works good in Wicket 1.3.2 but doens't work whe i
change version to 1.3.3.

package pl.mainseek.car.wicket.components;

import java.util.Arrays;
import java.util.List;

import org.apache.wicket.PageParameters;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
import org.apache.wicket.ajax.markup.html.AjaxLink;
import org.apache.wicket.markup.html.form.Button;
import org.apache.wicket.markup.html.form.DropDownChoice;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.form.IChoiceRenderer;
import org.apache.wicket.markup.html.form.RequiredTextField;
import org.apache.wicket.markup.html.form.StatelessForm;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.CompoundPropertyModel;
import org.apache.wicket.model.Model;
import org.apache.wicket.spring.injection.annot.SpringBean;

import pl.mainseek.car.dao.CarsDAO;
import pl.mainseek.car.entities.CarModel;
import pl.mainseek.car.entities.CarPart.Condition;
import pl.mainseek.car.wicket.CommonWebPage;
import pl.mainseek.car.wicket.models.SearchCarPartsModel;
import pl.mainseek.car.wicket.pages.AdvertismentsList;
import pl.mainseek.forum.wicket.pages.ForumList;

public class SearchPanel extends Panel {

public static final String FORUM_OPTION = forum;
public static final String ADS_OPTION = ads;

@SpringBean
private CarsDAO carsDAO;

//keys
private static final String ADVANCED_SEARCH_BUTTON_KEY =
advanced.search.button;

//wicket:ids
public static final String SEARCH_FORM = search_form;
public static final String CONDITION = condition;
public static final String CAR_MODEL = carModel;
public static final String CAR_MARK = carMark;
public static final String QUERY = query;
public static final String ADVANCED_SEARCH = advanced_search;
public static final String SEARCH_BUTTON = search_button;
public static final String SEARCH_WHERE = searchWhere;

private final DropDownChoice searchWhereDDC, carMarkDDC, carModelDDC,
conditionDDC;
private final RequiredTextField queryField;

private final String[] searchWhereKeys = new String[] {ADS_OPTION,
FORUM_OPTION};

//model
private SearchCarPartsModel carPartsModel;

public SearchPanel(String id, SearchCarPartsModel model) {
super(id);
this.carPartsModel = model;
final Form searchForm = new StatelessForm(SEARCH_FORM, new
CompoundPropertyModel(carPartsModel)) {
@Override
protected void onSubmit() {
super.onSubmit();
setRedirect(true);
PageParameters pageParameters = new PageParameters();
pageParameters.add(query, carPartsModel.getQuery());
if(carPartsModel.getCarModel() != null) {
pageParameters.add(carModel,
String.valueOf(carPartsModel.getCarModel().getId()));
} else if(carPartsModel.getCarMark() != null) {
pageParameters.add(carMark,
String.valueOf(carPartsModel.getCarMark().getId()));
}
if(carPartsModel.getSearchWhere().equals(ADS_OPTION)) {
if(carPartsModel.getCondition() != null) {
pageParameters.add(condition,
carPartsModel.getCondition().toString().toLowerCase());
}
setResponsePage(AdvertismentsList.class,
pageParameters);
} else
if(carPartsModel.getSearchWhere().equals(FORUM_OPTION)) {
setResponsePage(ForumList.class, pageParameters);
}
}
};
searchForm.setOutputMarkupId(true);
queryField = new RequiredTextField(QUERY);
searchWhereDDC = getSearchWhereDDC(searchForm);
conditionDDC = getConditionDDC(searchForm);
ListCarModel carModels =
carsDAO.getCarModels(carPartsModel.getCarMark());
carModelDDC = getCarModelDDC(carModels);
carMarkDDC = getCarMarkDDC(carModels);
carMarkDDC.setVisible(false);
carModelDDC.setVisible(false);
conditionDDC.setVisible(false);

searchForm.add(queryField);
searchForm.add(searchWhereDDC);
searchForm.add(conditionDDC);
searchForm.add(carMarkDDC);
searchForm.add(carModelDDC);
final AjaxLink advancedSearch = new AjaxLink(ADVANCED_SEARCH) {
@Override public void onClick(AjaxRequestTarget target) {
carMarkDDC.setVisible(!carMarkDDC.isVisible());
carModelDDC.setVisible(!carModelDDC.isVisible());
conditionDDC.setVisible(!carModelDDC.isVisible());
if(carMarkDDC.isVisible()){
carMarkDDC.setChoices(carsDAO.getAllCarMarks());
}
target.addComponent(searchForm);
}
};
searchForm.add(advancedSearch);
searchForm.add(new 

Re: I have an error when try to test submit using FormTester

2008-04-09 Thread Tomasz Prus
Can You give mi more details how remove the
UrlCompressingWebRequestProcessor because i don't have any idea?




I have an error when try to test submit using FormTester

2008-04-09 Thread Tomasz Prus
I have test and formTester.submit(); throws an error:

java.lang.NumberFormatException: For input string: p:form
at java.lang.NumberFormatException.forInputString(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at
org.apache.wicket.protocol.http.request.urlcompressing.UrlCompressor.getComponentAndInterfaceForUID(UrlCompressor.java:122)
at
org.apache.wicket.protocol.http.request.urlcompressing.UrlCompressingWebRequestProcessor.resolveListenerInterfaceTarget(UrlCompressingWebRequestProcessor.java:79)
at
org.apache.wicket.request.AbstractRequestCycleProcessor.resolveRenderedPage(AbstractRequestCycleProcessor.java:461)
at
org.apache.wicket.protocol.http.WebRequestCycleProcessor.resolve(WebRequestCycleProcessor.java:139)
at org.apache.wicket.RequestCycle.step(RequestCycle.java:1224)
at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1331)
at org.apache.wicket.RequestCycle.request(RequestCycle.java:493)
at
org.apache.wicket.protocol.http.MockWebApplication.processRequestCycle(MockWebApplication.java:401)
at org.apache.wicket.util.tester.FormTester.submit(FormTester.java:617)
at
pl.mainseek.forum.wicket.components.AddQuestionPanelTest.testSubmit(AddQuestionPanelTest.java:48)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.junit.internal.runners.TestMethod.invoke(TestMethod.java:59)
at
org.junit.internal.runners.MethodRoadie.runTestMethod(MethodRoadie.java:98)
at org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:79)
at
org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:87)
at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:77)
at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:42)
at
org.junit.internal.runners.JUnit4ClassRunner.invokeTestMethod(JUnit4ClassRunner.java:88)
at
org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51)
at
org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44)
at
org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27)
at
org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37)
at
org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42)
at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)

Sources:

public class AddQuestionPanelTest extends AbstractWebPageContext {

private static final String FORM_PATH =
DummyPageWithAddQuestionPanel.PANEL_NAME + : + AddQuestionPanel.FORM_NAME;
private FakeForumService forumService;

@Before public void setUp() throws Exception {
super.setUp();
forumService = MockFactory.makeMock(FakeForumService.class);
getMockContext().putBean(forumService, forumService);
}

@Test public void testCreate() {
getTester().startPage(DummyPageWithAddQuestionPanel.class);
getTester().assertRenderedPage(DummyPageWithAddQuestionPanel.class);
getTester().assertNoErrorMessage();


getTester().assertComponent(DummyPageWithAddQuestionPanel.PANEL_NAME,
Panel.class);
getTester().assertComponent(FORM_PATH, Form.class);
getTester().assertComponent(FORM_PATH + : +
AddQuestionPanel.SUBJECT, RequiredTextField.class);
getTester().assertComponent(FORM_PATH + : + AddQuestionPanel.BODY,
TextArea.class);
}

@Test public void testSubmit() {
getTester().startPage(DummyPageWithAddQuestionPanel.class);

FormTester formTester = getTester().newFormTester(FORM_PATH);
formTester.setValue(AddQuestionPanel.SUBJECT, s);
formTester.setValue(AddQuestionPanel.BODY, b);
getTester().debugComponentTrees();
formTester.submit();
}

}

public class AddQuestionPanel extends Panel {

public static final String ADD_QUESTION_BUTTON = addQuestionButton;
public static final String SUBJECT = subject;
public static final String BODY = body;
public static final String FORM_NAME = form;

private Message message;

public AddQuestionPanel(String id, final User user, final MessageService
forumService) {
super(id);
message = new Message(, , user);
Form form = new 

Re: I have an error when try to test submit using FormTester

2008-04-09 Thread Tomasz Prus
Thank You very many  :)

I overide method newRequestCycleProcessor in my MockApplication and submit
works now for me:



@Override
protected IRequestCycleProcessor newRequestCycleProcessor() {
IRequestCycleProcessor newRequestCycleProcessor =
super.newRequestCycleProcessor();

return new UrlCompressingWebRequestProcessor() {

@Override
protected IRequestTarget resolveListenerInterfaceTarget(final
RequestCycle requestCycle,
final Page page, final String componentPath, String
interfaceName,
final RequestParameters requestParameters)
{
String pageRelativeComponentPath =
Strings.afterFirstPathComponent(componentPath,
Component.PATH_SEPARATOR);
Component component = null;
if (page instanceof WebPage 
!IResourceListener.equals(interfaceName))
{
//ComponentAndInterface cai =
((WebPage)page).getUrlCompressor().getComponentAndInterfaceForUID(pageRelativeComponentPath);
UrlCompressor.ComponentAndInterface cai = null;
if (cai != null)
{
interfaceName = cai.getInterfaceName();
component = cai.getComponent();
}
}

requestParameters.setInterfaceName(interfaceName);

if
(interfaceName.equals(IRedirectListener.INTERFACE.getName()))
{
return new RedirectPageRequestTarget(page);
}
else if
(interfaceName.equals(INewBrowserWindowListener.INTERFACE.getName()))
{
return
INewBrowserWindowListener.INTERFACE.newRequestTarget(page, page,
INewBrowserWindowListener.INTERFACE,
requestParameters);
}
else
{
// Get the listener interface we need to call
final RequestListenerInterface listener =
RequestListenerInterface
.forName(interfaceName);
if (listener == null)
{
throw new WicketRuntimeException(
Attempt to access unknown request listener
interface  + interfaceName);
}

// Get component
if (component == null)
{
if (Strings.isEmpty(pageRelativeComponentPath))
{
component = page;
}
else
{
component = page.get(pageRelativeComponentPath);
}
}

if (component == null)
{
// still null? that's not right
throw new WicketRuntimeException(cannot resolve
component with path ' +
pageRelativeComponentPath + ', listener  +
listener +  on page  + page);
}

if (!component.isEnableAllowed())
{
throw new UnauthorizedActionException(component,
Component.ENABLE);
}

// Ask the request listener interface object to create a
request
// target
return listener.newRequestTarget(page, component,
listener, requestParameters);
}
}
};
}