Send an object to page

2010-11-01 Thread Gustavo Henrique
hi!

what better way to send an object to webpage?
I'm sending in constructor but the URI is not friendly.

thanks!


statelessform and ajaxsubmitlink in the same page

2010-07-25 Thread Gustavo Henrique
Hi!
I have a page with 1 statelessform and another form that use ajaxsubmitlink.
I overrides the isStateless method to return false to avoid ajaxsubmitlink
fail but when the normal form is submited wicket throws exception with text:
... deserializing proxy
Is possible have a statelessform and ajaxsubmitlink in the same page?

thanks!


How to put a loading cursor in ajaxsubmitlink?

2010-07-24 Thread Gustavo Henrique
Hi!
How to put a loading cursor in ajaxsubmitlink?

thanks!


Re: Change from development to deployment mode in maven2

2010-07-20 Thread Gustavo Henrique
Hi!
Now it is ok!

// web.xml
context-param
param-nameconfiguration/param-name
param-valuedevelopment/param-value
/context-param


// add plugin in pom.xml
plugin
groupIdorg.apache.maven.plugins/groupId
artifactIdmaven-antrun-plugin/artifactId
executions
execution
phaseprocess-classes/phase
configuration
tasks
replace file=${basedir}/target/web.xml
token=development value=deployment/
/tasks
/configuration
goals
goalrun/goal
/goals
/execution
/executions
/plugin


Thanks!


2010/7/19 Brian Topping topp...@codehaus.org

 Setting the JVM property is great because you can do it on your deployment
 server, so the same WAR runs in debug mode on all but the deployment
 machines.

 If you want Maven to fix the setting on a build, you can create a
 properties file:

wicket.configuration = ${deploy.type}

 Then create one or more profiles in your pom, one of them set as a default
 profile.  In them, have Maven do a substitution on deploy.type for either
 'development' or 'deployment'.

 Profiles are great for automated builds since the profile can be specified
 on the command line in the CI system.

 Brian


 On Jul 19, 2010, at 1:14 PM, Major Péter wrote:

  Hi,
 
  you could configure the wicket.configuration with JVM properties too, so
  you can have always enabled the production mode in web.xml, and override
  it with your dev server JVM property. See the JavaDoc for
  Application#getConfigurationType.
 
  Regards,
  Peter
 
  2010-07-19 19:10 keltezéssel, Gustavo Henrique írta:
  Hi!
  I'm using wicket in development mode but I need to change to deployment
 mode
  when maven is called. How I configure maven to change that mode when it
 is
  to generate war file?
 
  thanks!
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 


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




-- 
Gustavo Henrique
blog.gustavohenrique.net


Change from development to deployment mode in maven2

2010-07-19 Thread Gustavo Henrique
Hi!
I'm using wicket in development mode but I need to change to deployment mode
when maven is called. How I configure maven to change that mode when it is
to generate war file?

thanks!


Form an external file or as inner class of page?

2010-07-07 Thread Gustavo Henrique
Hi!
Is better put a class form as inner class in page or an external file
imported in page?
For example, I did have to add a cookie in onSubmit method so was need to
put the form class inside an WebPage class.

thanks!


how to pass parameters to javascript function?

2010-06-29 Thread Gustavo Henrique
Hi!
I need to put in the page a javascript function with name and Id of
customer. I'm using a label component because I don't know others solutions.
Any idea?

Thanks!


Testing wicket pages in project with maven structure

2010-06-05 Thread Gustavo Henrique
Hi!
I'm trying using WicketTester but I got an error:
org.apache.wicket.markup.MarkupNotFoundException: Markup of type 'html' for
component 'br.com.ecommerce.wicket.pages.ContactPage' not found.

I changed the html dir using the trick with PathStripperLocator class and
this works. But the test not found the html pages.
My WicketApplication class:
@Override
protected void init() {
super.init();
IResourceSettings resourceSettings = getResourceSettings();
resourceSettings.addResourceFolder(/WEB-INF/html);
resourceSettings.setResourceStreamLocator(new
PathStripperLocator());
}

My simple test page in src/test/java:

public class ContactPageTest extends TestCase {
   private WicketTester tester;
   public void setUp() {
  tester = new WicketTester(new WicketApplication());
   }

   public void testMyPageBasicRender() {
  tester.startPage(ContactPage.class);
  tester.assertRenderedPage(ContactPage.class);
   }
}

So how do I test a wicket page?

thanks!


Testing wicket pages in project with maven structure

2010-06-05 Thread Gustavo Henrique
Hi!
I'm trying using WicketTester but I got an error:
org.apache.wicket.markup.
MarkupNotFoundException: Markup of type 'html' for component
'br.com.ecommerce.wicket.pages.ContactPage' not found.

I changed the html dir using the trick with PathStripperLocator class and
this works. But the test not found the html pages.
My WicketApplication class:
@Override
protected void init() {
super.init();
IResourceSettings resourceSettings = getResourceSettings();
resourceSettings.addResourceFolder(/WEB-INF/html);
resourceSettings.setResourceStreamLocator(new
PathStripperLocator());
}

My simple test page in src/test/java:

public class ContactPageTest extends TestCase {
   private WicketTester tester;
   public void setUp() {
  tester = new WicketTester(new WicketApplication());
   }

   public void testMyPageBasicRender() {
  tester.startPage(ContactPage.class);
  tester.assertRenderedPage(ContactPage.class);
   }
}

So how do I test a wicket page?

thanks!


Re: Testing wicket pages in project with maven structure

2010-06-05 Thread Gustavo Henrique
I already tried that but failed. Only pass an instance of application class
to the tester don't work. Is need configure the pom.xml too or put the html
dir on build path.

I resolved configuring the pom.xml as:

   resource
filteringfalse/filtering
directorysrc/main/webapp/WEB-INF/html/directory
includes
include**/include
/includes
/resource

Thanks!


Convention for classes name

2010-06-05 Thread Gustavo Henrique
Hi!
Is there any name convention for classes using wicket?
I'm using that model: CustomerPage, OrderPanel, ProductAddForm. What you
think about?

Thanks!


Re: problem with WicketTester to load template

2010-04-12 Thread Gustavo Henrique
org.apache.wicket.WicketRuntimeException: path: 'Example:username' does not
exist for page: Example
at
org.apache.wicket.util.tester.BaseWicketTester.fail(BaseWicketTester.java:1344)
at
org.apache.wicket.util.tester.BaseWicketTester.getComponentFromLastRenderedPage(BaseWicketTester.java:472)
at
com.b2w.controlpanel.test.page.LoginTest.testLoginPageComponents(LoginTest.java:23)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at
org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
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)


Thanks!


Re: problem with WicketTester to load template

2010-04-12 Thread Gustavo Henrique
I'm sorry! Blank is the constructor. It is a wrong word, because in my
source the class name is Blank (only for test) and I renamed for Example in
this post!


Re: problem with WicketTester to load template

2010-04-12 Thread Gustavo Henrique
Yes, the problem is the word void in the constructor. Now is ok!
Thank you guys!


problem with WicketTester to load template

2010-04-11 Thread Gustavo Henrique
hi guys!
I have been a problem using WicktTester. When I run a simple test, wicket
throws an exception because can't load the template html. But if I access
page via browser, wicket works fine.

the source code:

CustomerApplicationTest.java
http://pastebin.com/tRJ9hNuk

Example.java
http://pastebin.com/CW8BDPYE

ExampleTest.java
http://pastebin.com/uBBRAcSW

Example.html
html
body
input type=text wicket:id=username id=username
/body
/html

Thanks!


Create cookie before redirect

2010-04-01 Thread Gustavo Henrique
Hi!
I need to create a cookie and redirect to page in other app, but when I try
redirect the cookie is not send in response:

Form loginForm = new StatelessForm(loginForm) {
  protected void onSubmit() {
  try {
  Customer authenticatedCustomer =
customerAuthentication.authenticateByLogin( getFormFieldValue(username),
getFormFieldValue(password));
  getWebRequestCycle().getWebResponse().addCookie( new
CustomerCookie( authenticatedCustomer, getDomainName() ) );
  getPage().getResponse().redirect(http://domain.com/myapp;);
  } catch(CustomerAuthenticationException e) {
  add( new Label(customerAuthenticationFailure,
getString(customerAuthenticationFailure)));
  }
  }

  protected String getFormFieldValue(String field) {
  return get(field).getModelObjectAsString();
  }
}


Re: A web site developed with Wicket

2010-03-31 Thread Gustavo Henrique
could you release the wicket code for us?
that would be a great help for the community.

thanks!


How to integrate wicket and velocity?

2010-03-26 Thread Gustavo Henrique
Can anyone tell me where I find a good documentation about this integration?

Thanks!


Get hiddenfield value on onError method

2010-03-10 Thread Gustavo Henrique
How I get the hiddenfield value on Form's onError  method?

thanks!


Label state after submit

2010-03-09 Thread Gustavo Henrique
Hi!
How I can keep the label's states values after form submit?
My app update the values of 3 labels using ajax, but when the form is
submited and not pass in validation, the label's value are missing.

Thanks!


Re: Label state after submit

2010-03-09 Thread Gustavo Henrique
In a rgister form, I find the address by postal code (ajax) and show in the
page using labels. The user can submit the form (not ajax). if invalid form,
the same page is showed. all the textfields values self keep but the labels
values are missing.


Re: Label state after submit

2010-03-09 Thread Gustavo Henrique
The problem is diferent but is related with the previous post.


Create a label in onUpdate method using ajax (AjaxFormComponentUpdatingBehavior)

2010-03-08 Thread Gustavo Henrique
Hi guys!

I'm trying create a label contain an error message after ajax request, but
no success. I can't use FeedbackPanel because it changes the design.
So I did:

final Label label = new Label(postalCodeNotExisti);
label.setOutputMarkupId(true);

final RequiredTextField postalCodeComplement = (RequiredTextField) new
RequiredTextField(individualAddresses.postalCodeComplement,
new PropertyModel(postalCode, postalCodeComplement))
.add(StringValidator.exactLength(3))
.add(new AjaxFormComponentUpdatingBehavior(onblur) {

   @Override
   protected void onUpdate(AjaxRequestTarget target) {
   RequestCycle requestCycle = RequestCycle.get();
   String postalCode =
requestCycle.getRequest().getParameter(postalCode);
   target.addComponent(getFormComponent());
   target.addComponent(label);
   }
}).setOutputMarkupId(true);

add(postalCodeComplement);


Not happens! No errors and no label!
Why?

Thanks!