Re: Wicket spring security sample app

2012-01-23 Thread Brian Lavender
Quick Start for getting Wicktopia running or at least see it running. I
wasn't sure how to run Wicketopia. Certainly James can post these
details, but I thought I would since he hasn't yet. Or, maybe it is
posted somewhere else. 

$ git clone https://github.com/jwcarman/Wicketopia.git 
$ cd Wicketopia 
$ mvn install 
$ cd example
$ mvn exec:java \
 -Dexec.mainClass="org.wicketopia.example.web.util.Start" \
 -Dexec.classpathScope="test 

 Point your browser to the following.

http://localhost:8080  


On Mon, Jan 23, 2012 at 01:10:07PM -0800, Brian Lavender wrote:
> The following worked.
> 
> $ mvn install 
> 
> How do I run the Start class?
> 
> I tried the following, but I get a class not found error. Usually, I have run
> classes inside the src/java area, but not in src/test .
> 
> $ cd example
> $ mvn exec:java -Dexec.mainClass="org.wicketopia.example.web.util.Start"
> 
> brian
> 
> On Fri, Jan 20, 2012 at 06:14:24PM -0500, James Carman wrote:
> > Run mvn install from the top-level directory.
> > 
> > Then, in the example webapp project, there is a class called Start:
> > 
> > https://github.com/jwcarman/Wicketopia/blob/master/example/src/test/java/org/wicketopia/example/web/util/Start.java
> > 
> > Run that.  Good luck!
> > 
> > On Thu, Jan 19, 2012 at 5:35 PM, Brian Lavender  wrote:
> > > James,
> > >
> > > I cloned the repository.
> > >
> > > $ git clone https://github.com/jwcarman/Wicketopia.git
> > > $ cd Wicketopia
> > > $ mvn eclipse:eclipse
> > >
> > > a few errors including the below error.
> > >
> > > [ERROR] Failed to execute goal on project wicketopia-persistence: Could 
> > > not resolve dependencies for project 
> > > org.wicketopia:wicketopia-persistence:jar:1.0-SNAPSHOT: Could not find 
> > > artifact org.wicketopia:wicketopia:jar:1.0-20110328.173826-2 in 
> > > sonatype-nexus-snapshots 
> > > (https://oss.sonatype.org/content/repositories/snapshots) -> [Help 1]
> > > [ERROR]
> > >
> > > Imported it into Eclipse.
> > >
> > > Which test case do I run?
> > >
> > > I tried changing into the example directory and doing a "mvn 
> > > eclipse:eclipse" too, but it gave the below error.
> > >
> > > [ERROR] Failed to execute goal on project wicketopia-example: Could not 
> > > resolve dependencies for project 
> > > org.wicketopia:wicketopia-example:war:1.0-SNAPSHOT: The following 
> > > artifacts could not be resolved: 
> > > org.wicketopia:wicketopia:jar:1.0-SNAPSHOT, 
> > > org.wicketopia:wicketopia-joda:jar:1.0-SNAPSHOT, 
> > > org.wicketopia:wicketopia-cdi-weld:jar:1.0-SNAPSHOT, 
> > > org.wicketopia:wicketopia-spring-security:jar:1.0-SNAPSHOT, 
> > > org.wicketopia:wicketopia-hibernate:jar:1.0-SNAPSHOT, 
> > > org.wicketopia:wicketopia:jar:tests:1.0-SNAPSHOT: Failure to find 
> > > org.wicketopia:wicketopia:jar:1.0-20110328.173826-2 in 
> > > https://oss.sonatype.org/content/repositories/snapshots was cached in the 
> > > local repository, resolution will not be reattempted until the update 
> > > interval of sonatype-nexus-snapshots has elapsed or updates are forced -> 
> > > [Help 1]
> > >
> > >
> > > brian
> > >
> > > On Wed, Jan 18, 2012 at 06:58:08AM -0500, James Carman wrote:
> > >> Either way, you can open it in your IDE and run the jetty test server
> > >> that's included.  That's how I run it usually so that I can easily
> > >> debug and play around.
> > >>
> > >> On Wed, Jan 18, 2012 at 6:57 AM, James Carman
> > >>  wrote:
> > >> > I don't know if the plugin is turned on for the example application.
> > >> > But, you'd need to make sure you are in the example module before you
> > >> > try.
> > >> >
> > >> > On Wed, Jan 18, 2012 at 1:15 AM, Brian Lavender  wrote:
> > >> >> On Sun, Jan 15, 2012 at 12:36:48PM +0200, Martin Grigorov wrote:
> > >> >>> See https://github.com/jwcarman/Wicketopia
> > >> >>
> > >> >> Maybe I missed something, but I wasn't able to do a
> > >> >>
> > >> >> mvn jetty:run
> > >> >>
> > >> >> or did the war package run after generating a war file.
> > >> >>
> > >> >> brian
> > >> >&

Re: Wicket spring security sample app

2012-01-23 Thread Brian Lavender
The following worked.

$ mvn install 

How do I run the Start class?

I tried the following, but I get a class not found error. Usually, I have run
classes inside the src/java area, but not in src/test .

$ cd example
$ mvn exec:java -Dexec.mainClass="org.wicketopia.example.web.util.Start"

brian

On Fri, Jan 20, 2012 at 06:14:24PM -0500, James Carman wrote:
> Run mvn install from the top-level directory.
> 
> Then, in the example webapp project, there is a class called Start:
> 
> https://github.com/jwcarman/Wicketopia/blob/master/example/src/test/java/org/wicketopia/example/web/util/Start.java
> 
> Run that.  Good luck!
> 
> On Thu, Jan 19, 2012 at 5:35 PM, Brian Lavender  wrote:
> > James,
> >
> > I cloned the repository.
> >
> > $ git clone https://github.com/jwcarman/Wicketopia.git
> > $ cd Wicketopia
> > $ mvn eclipse:eclipse
> >
> > a few errors including the below error.
> >
> > [ERROR] Failed to execute goal on project wicketopia-persistence: Could not 
> > resolve dependencies for project 
> > org.wicketopia:wicketopia-persistence:jar:1.0-SNAPSHOT: Could not find 
> > artifact org.wicketopia:wicketopia:jar:1.0-20110328.173826-2 in 
> > sonatype-nexus-snapshots 
> > (https://oss.sonatype.org/content/repositories/snapshots) -> [Help 1]
> > [ERROR]
> >
> > Imported it into Eclipse.
> >
> > Which test case do I run?
> >
> > I tried changing into the example directory and doing a "mvn 
> > eclipse:eclipse" too, but it gave the below error.
> >
> > [ERROR] Failed to execute goal on project wicketopia-example: Could not 
> > resolve dependencies for project 
> > org.wicketopia:wicketopia-example:war:1.0-SNAPSHOT: The following artifacts 
> > could not be resolved: org.wicketopia:wicketopia:jar:1.0-SNAPSHOT, 
> > org.wicketopia:wicketopia-joda:jar:1.0-SNAPSHOT, 
> > org.wicketopia:wicketopia-cdi-weld:jar:1.0-SNAPSHOT, 
> > org.wicketopia:wicketopia-spring-security:jar:1.0-SNAPSHOT, 
> > org.wicketopia:wicketopia-hibernate:jar:1.0-SNAPSHOT, 
> > org.wicketopia:wicketopia:jar:tests:1.0-SNAPSHOT: Failure to find 
> > org.wicketopia:wicketopia:jar:1.0-20110328.173826-2 in 
> > https://oss.sonatype.org/content/repositories/snapshots was cached in the 
> > local repository, resolution will not be reattempted until the update 
> > interval of sonatype-nexus-snapshots has elapsed or updates are forced -> 
> > [Help 1]
> >
> >
> > brian
> >
> > On Wed, Jan 18, 2012 at 06:58:08AM -0500, James Carman wrote:
> >> Either way, you can open it in your IDE and run the jetty test server
> >> that's included.  That's how I run it usually so that I can easily
> >> debug and play around.
> >>
> >> On Wed, Jan 18, 2012 at 6:57 AM, James Carman
> >>  wrote:
> >> > I don't know if the plugin is turned on for the example application.
> >> > But, you'd need to make sure you are in the example module before you
> >> > try.
> >> >
> >> > On Wed, Jan 18, 2012 at 1:15 AM, Brian Lavender  wrote:
> >> >> On Sun, Jan 15, 2012 at 12:36:48PM +0200, Martin Grigorov wrote:
> >> >>> See https://github.com/jwcarman/Wicketopia
> >> >>
> >> >> Maybe I missed something, but I wasn't able to do a
> >> >>
> >> >> mvn jetty:run
> >> >>
> >> >> or did the war package run after generating a war file.
> >> >>
> >> >> brian
> >> >> --
> >> >> Brian Lavender
> >> >> http://www.brie.com/brian/
> >> >>
> >> >> "There are two ways of constructing a software design. One way is to
> >> >> make it so simple that there are obviously no deficiencies. And the 
> >> >> other
> >> >> way is to make it so complicated that there are no obvious 
> >> >> deficiencies."
> >> >>
> >> >> Professor C. A. R. Hoare
> >> >> The 1980 Turing award lecture
> >> >>
> >> >> -
> >> >> 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

Still trying to get the Spring security with auth-roles

2012-01-19 Thread Brian Lavender
Can someone add the Spring Security for me?

I have this simple web app from the Wicket examples (slightly modified)
that uses Wicket-auth-roles and I just can't seem to wire in the
spring security. Right now, authman has the users and hard coded in
com.foobar.MyAuthenticatedWebSession. I would like to have it so it is
using Spring Security so that I can use either hard coded or switch it
to an LDAP storage. Is there someone who can do it so I can see?

http://brie.com/brian/wicket/authman.zip

I tried following the page at 
https://cwiki.apache.org/WICKET/spring-security-and-wicket-auth-roles.html
and I still have yet to succeed. :-(

Thanks,

brian
-- 
Brian Lavender
http://www.brie.com/brian/

"There are two ways of constructing a software design. One way is to
make it so simple that there are obviously no deficiencies. And the other
way is to make it so complicated that there are no obvious deficiencies."

Professor C. A. R. Hoare
The 1980 Turing award lecture

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



Re: Wicket spring security sample app

2012-01-19 Thread Brian Lavender
James,

I cloned the repository. 

$ git clone https://github.com/jwcarman/Wicketopia.git
$ cd Wicketopia
$ mvn eclipse:eclipse

a few errors including the below error.

[ERROR] Failed to execute goal on project wicketopia-persistence: Could not 
resolve dependencies for project 
org.wicketopia:wicketopia-persistence:jar:1.0-SNAPSHOT: Could not find artifact 
org.wicketopia:wicketopia:jar:1.0-20110328.173826-2 in sonatype-nexus-snapshots 
(https://oss.sonatype.org/content/repositories/snapshots) -> [Help 1]
[ERROR] 

Imported it into Eclipse.

Which test case do I run? 

I tried changing into the example directory and doing a "mvn eclipse:eclipse" 
too, but it gave the below error.

[ERROR] Failed to execute goal on project wicketopia-example: Could not resolve 
dependencies for project org.wicketopia:wicketopia-example:war:1.0-SNAPSHOT: 
The following artifacts could not be resolved: 
org.wicketopia:wicketopia:jar:1.0-SNAPSHOT, 
org.wicketopia:wicketopia-joda:jar:1.0-SNAPSHOT, 
org.wicketopia:wicketopia-cdi-weld:jar:1.0-SNAPSHOT, 
org.wicketopia:wicketopia-spring-security:jar:1.0-SNAPSHOT, 
org.wicketopia:wicketopia-hibernate:jar:1.0-SNAPSHOT, 
org.wicketopia:wicketopia:jar:tests:1.0-SNAPSHOT: Failure to find 
org.wicketopia:wicketopia:jar:1.0-20110328.173826-2 in 
https://oss.sonatype.org/content/repositories/snapshots was cached in the local 
repository, resolution will not be reattempted until the update interval of 
sonatype-nexus-snapshots has elapsed or updates are forced -> [Help 1]


brian

On Wed, Jan 18, 2012 at 06:58:08AM -0500, James Carman wrote:
> Either way, you can open it in your IDE and run the jetty test server
> that's included.  That's how I run it usually so that I can easily
> debug and play around.
> 
> On Wed, Jan 18, 2012 at 6:57 AM, James Carman
>  wrote:
> > I don't know if the plugin is turned on for the example application.
> > But, you'd need to make sure you are in the example module before you
> > try.
> >
> > On Wed, Jan 18, 2012 at 1:15 AM, Brian Lavender  wrote:
> >> On Sun, Jan 15, 2012 at 12:36:48PM +0200, Martin Grigorov wrote:
> >>> See https://github.com/jwcarman/Wicketopia
> >>
> >> Maybe I missed something, but I wasn't able to do a
> >>
> >> mvn jetty:run
> >>
> >> or did the war package run after generating a war file.
> >>
> >> brian
> >> --
> >> Brian Lavender
> >> http://www.brie.com/brian/
> >>
> >> "There are two ways of constructing a software design. One way is to
> >> make it so simple that there are obviously no deficiencies. And the other
> >> way is to make it so complicated that there are no obvious deficiencies."
> >>
> >> Professor C. A. R. Hoare
> >> The 1980 Turing award lecture
> >>
> >> -
> >> 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
> 

-- 
Brian Lavender
http://www.brie.com/brian/

"There are two ways of constructing a software design. One way is to
make it so simple that there are obviously no deficiencies. And the other
way is to make it so complicated that there are no obvious deficiencies."

Professor C. A. R. Hoare
The 1980 Turing award lecture

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



Re: Wicket spring security sample app

2012-01-17 Thread Brian Lavender
On Sun, Jan 15, 2012 at 12:36:48PM +0200, Martin Grigorov wrote:
> See https://github.com/jwcarman/Wicketopia

Maybe I missed something, but I wasn't able to do a 

mvn jetty:run

or did the war package run after generating a war file. 

brian
-- 
Brian Lavender
http://www.brie.com/brian/

"There are two ways of constructing a software design. One way is to
make it so simple that there are obviously no deficiencies. And the other
way is to make it so complicated that there are no obvious deficiencies."

Professor C. A. R. Hoare
The 1980 Turing award lecture

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



Wicket spring security sample app

2012-01-14 Thread Brian Lavender
Does someone have a sample of the current spring security with Wicket 
auth-roles?
One that I can do the following.

mvn jetty:run

and see it run? 

brian
-- 
Brian Lavender
http://www.brie.com/brian/

"There are two ways of constructing a software design. One way is to
make it so simple that there are obviously no deficiencies. And the other
way is to make it so complicated that there are no obvious deficiencies."

Professor C. A. R. Hoare
The 1980 Turing award lecture

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



Re: Why does my DAO need to implement serialization?

2011-06-16 Thread Brian Lavender
Where can I find a sample or Javadoc for wicket-ioc?

brian

On Thu, Jun 16, 2011 at 11:11:05AM -0700, Igor Vaynberg wrote:
> you should inject your dao using one of the provided wicket-ioc
> modules such as spring or guice. this will create a proxy that is
> serializable instead of requiring the actual object you are injecting
> to be serializable.
> 
> -igor
> 
> 
> On Thu, Jun 16, 2011 at 11:00 AM, Brian Lavender  wrote:
> > It seems that I have to extend the serializable interface for
> > my DAO in order not to get errors. Should I be putting it
> > in the WebSession area, or elsewhere?
> >
> > I have the full context of the sample at the following. It is
> > a simple Maven project.
> > http://brie.com/brian/wicket/zebra00.zip
> >
> >
> > public interface CheeseDAO extends java.io.Serializable {
> >        public Cheese getCheese(Long id);
> >        public List getCheeses();
> > }
> >
> > public class CheesrSession extends WebSession {
> >  private CheeseDAO myDAO = new CheeseDAOImpl();
> >
> >        public CheeseDAO getDAO() {
> >                  return myDAO;
> >        }
> >
> > }
> >
> >
> > Thanks,
> >
> > brian
> > --
> > Brian Lavender
> > http://www.brie.com/brian/
> >
> > "There are two ways of constructing a software design. One way is to
> > make it so simple that there are obviously no deficiencies. And the other
> > way is to make it so complicated that there are no obvious deficiencies."
> >
> > Professor C. A. R. Hoare
> > The 1980 Turing award lecture
> >
> > -
> > 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
> 

-- 
Brian Lavender
http://www.brie.com/brian/

"There are two ways of constructing a software design. One way is to
make it so simple that there are obviously no deficiencies. And the other
way is to make it so complicated that there are no obvious deficiencies."

Professor C. A. R. Hoare
The 1980 Turing award lecture

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



Why does my DAO need to implement serialization?

2011-06-16 Thread Brian Lavender
It seems that I have to extend the serializable interface for
my DAO in order not to get errors. Should I be putting it
in the WebSession area, or elsewhere?

I have the full context of the sample at the following. It is
a simple Maven project.
http://brie.com/brian/wicket/zebra00.zip


public interface CheeseDAO extends java.io.Serializable {
public Cheese getCheese(Long id);
public List getCheeses();
}

public class CheesrSession extends WebSession {
  private CheeseDAO myDAO = new CheeseDAOImpl();

public CheeseDAO getDAO() { 
  return myDAO; 
}

}


Thanks,

brian
-- 
Brian Lavender
http://www.brie.com/brian/

"There are two ways of constructing a software design. One way is to
make it so simple that there are obviously no deficiencies. And the other
way is to make it so complicated that there are no obvious deficiencies."

Professor C. A. R. Hoare
The 1980 Turing award lecture

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



Re: How do I create a detachable model for a ListView?

2011-06-15 Thread Brian Lavender
Dan, thank you for pointing that out. That makes more sense. So, it looks
like now that my List of Cheeses will not get cached between pages saving
space? And this is because the model doesn't do anything for detach but
only does load, so every time, it will get it from the DAO?

Here is the code for my index page. Supporting code files are attached.

public class Index extends CheesrPage {
public Index() {

CheeseDAO dao = new CheeseDAOImpl();
CheeseDetach myDetach = new CheeseDetach(dao);

CheeseList myCheeseList = new CheeseList("cheeses", myDetach, 
getCart());
add(myCheeseList);

[snip]
}

On Wed, Jun 15, 2011 at 06:35:25PM -0700, Dan Retzlaff wrote:
> Look carefully at the ListView's constructor arguments. It wants an
> IModel>, not an IModel which is what your current
> CheeseDetach provides. Depending on your goals, you can either (1) change
> CheeseDetach.load() to call getCheeses(), or (2) change the constructor to
> accept a list of cheeses and retain a list of cheese IDs, and query for
> those cheeses individually in CheeseDetach.load().
> 
> On Wed, Jun 15, 2011 at 5:38 PM, Brian Lavender  wrote:
> 
> > I am trying to create a ListView using a detachable model, but I just
> > can't seem to figure out how to construct my DetachableModel. Basically, I
> > would like to create a detachable model and then pass it to my constructor
> > for a CheeseList.  This is built upon the code for the  examples for
> > Wicket in Action [1] by Dashorst in Chapter 4.3.  My DAO can return the
> > cheese based upon id or it can also return the list of cheeses. What
> > code do I need to put in CheeseDetach for my detachable model?
> >
> >
> > CheeseDAO myDAO = new CheeseDAOImpl();
> >
> > // Can I make CheeseDetach construct it using the DAO as follows?
> > CheeseDetach myDetach = new CheeseDetach(myDAO);
> >
> >  // ListView can take list or Model as constructor.
> >  // How does the model work for a ListView?
> >  CheeseList myCheeseList = new CheeseList("cheeses", myDetach,
> > getCart());
> >
> >  // Add ListView to page
> >
> >  add(myCheeseList);
> >
> >
> > 1. https://code.google.com/p/wicketinaction/downloads/list
> > --
> > Brian Lavender
> > http://www.brie.com/brian/
> >
> > "There are two ways of constructing a software design. One way is to
> > make it so simple that there are obviously no deficiencies. And the other
> > way is to make it so complicated that there are no obvious deficiencies."
> >
> > Professor C. A. R. Hoare
> > The 1980 Turing award lecture
> >
> >
> > -
> > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> > For additional commands, e-mail: users-h...@wicket.apache.org
> >

-- 
Brian Lavender
http://www.brie.com/brian/

"There are two ways of constructing a software design. One way is to
make it so simple that there are obviously no deficiencies. And the other
way is to make it so complicated that there are no obvious deficiencies."

Professor C. A. R. Hoare
The 1980 Turing award lecture
package com.brie.dtoo;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class CheeseDAOImpl implements CheeseDAO {
	private static final Map cheeses = new HashMap();

static {
cheeses.put(1L, new Cheese());
cheeses.put(2L, new Cheese());
cheeses.put(3L, new Cheese());

Cheese cheese = cheeses.get(1L);
cheese.setId(1L);
cheese.setName("Gouda");
cheese.setDescription("Gouda is a yellowish Dutch cheese named after the city of Gouda. The cheese is made from cow's milk that is cultured and heated until the curd is separate from the whey. About ten percent of the mixture is curds which are pressed into circular moulds for several hours.");
cheese.setPrice(2.95);

cheese = cheeses.get(2L);
cheese.setId(2L);
cheese.setName("Edam");
cheese.setDescription("Edam (Dutch Edammer) is a Dutch cheese that is traditionally sold as spheres with pale yellow interior and a coat of paraffin. Its Spanish name is queso de bola, literally 'ball cheese'. It is named after the town of Edam in the province of North Holland[1], where the cheese is coated for export and for tourist high season. Edam which has aged for at least 17 weeks is coated with black wax, rather than the usual red or yellow.");
cheese.setPrice(1.25);

cheese = cheeses.get(3L);
cheese.setId(3L);
cheese.setName(&q

How do I create a detachable model for a ListView?

2011-06-15 Thread Brian Lavender
I am trying to create a ListView using a detachable model, but I just
can't seem to figure out how to construct my DetachableModel. Basically, I
would like to create a detachable model and then pass it to my constructor
for a CheeseList.  This is built upon the code for the  examples for
Wicket in Action [1] by Dashorst in Chapter 4.3.  My DAO can return the
cheese based upon id or it can also return the list of cheeses. What
code do I need to put in CheeseDetach for my detachable model?


 CheeseDAO myDAO = new CheeseDAOImpl();

 // Can I make CheeseDetach construct it using the DAO as follows?
 CheeseDetach myDetach = new CheeseDetach(myDAO);

  // ListView can take list or Model as constructor.
  // How does the model work for a ListView?
  CheeseList myCheeseList = new CheeseList("cheeses", myDetach, 
getCart());

  // Add ListView to page

  add(myCheeseList);


1. https://code.google.com/p/wicketinaction/downloads/list
-- 
Brian Lavender
http://www.brie.com/brian/

"There are two ways of constructing a software design. One way is to
make it so simple that there are obviously no deficiencies. And the other
way is to make it so complicated that there are no obvious deficiencies."

Professor C. A. R. Hoare
The 1980 Turing award lecture
package com.brie.dtoo;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class CheeseDAOImpl implements CheeseDAO {
	private static final Map cheeses = new HashMap();

static {
cheeses.put(1L, new Cheese());
cheeses.put(2L, new Cheese());
cheeses.put(3L, new Cheese());

Cheese cheese = cheeses.get(1L);
cheese.setId(1L);
cheese.setName("Gouda");
cheese.setDescription("Gouda is a yellowish Dutch cheese named after the city of Gouda. The cheese is made from cow's milk that is cultured and heated until the curd is separate from the whey. About ten percent of the mixture is curds which are pressed into circular moulds for several hours.");
cheese.setPrice(2.95);

cheese = cheeses.get(2L);
cheese.setId(2L);
cheese.setName("Edam");
cheese.setDescription("Edam (Dutch Edammer) is a Dutch cheese that is traditionally sold as spheres with pale yellow interior and a coat of paraffin. Its Spanish name is queso de bola, literally 'ball cheese'. It is named after the town of Edam in the province of North Holland[1], where the cheese is coated for export and for tourist high season. Edam which has aged for at least 17 weeks is coated with black wax, rather than the usual red or yellow.");
cheese.setPrice(1.25);

cheese = cheeses.get(3L);
cheese.setId(3L);
cheese.setName("Old Amsterdam");
cheese.setDescription("Old Amsterdam is a Dutch gourmet cheese that is ripened to perfection and regularly checked for flavor. It is a gourmet cheese of exceptionally high and consistent quality, with a buttery mature aged Gouda flavor that cuts with ease.");
cheese.setPrice(3.10);
}


	public Cheese getCheese(Long id) {
		return cheeses.get(id);
	}

	public List getCheeses() {
		List tmpList = new ArrayList(cheeses.values());
		return tmpList ;
	}

}
package com.brie.dtoo;

import java.util.List;

public interface CheeseDAO {
	public Cheese getCheese(Long id);
	public List getCheeses();
}
package com.brie.dtoo;

import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.link.Link;
import org.apache.wicket.markup.html.list.ListItem;
import org.apache.wicket.markup.html.list.ListView;
import org.apache.wicket.model.LoadableDetachableModel;
import org.apache.wicket.model.PropertyModel;

import com.brie.dtoo.callbacks.CheeseDetach;
import com.brie.dtoo.callbacks.CheeseList;



public class Index extends CheesrPage {
  public Index() {
	  
 

	  CheeseList myCheeseList = new CheeseList("cheeses", getCheeses(), getCart());
	  
	  // 
	  
	  add(myCheeseList);
	  
	  
	  add(new ListView("cart", new PropertyModel
(this, "cart.cheeses")) {

@Override
protected void populateItem(ListItem item) {
	Cheese cheese = (Cheese) item.getModelObject();

	item.add(new Label("name", cheese.getName()));
	item.add(new Label("price", "$" + cheese.getPrice()));

	item.add(new Link("remove", item.getModel()) {
		@Override
		public void onClick() {
			Cheese selected = (Cheese) getModelObject();
			getCart().getCheeses().remove(selected);
		}
	});
}

			});
			add(new Label("total", "$" + getCart().getTotal()));
  }
  
  
}
package com.brie.dtoo.callbacks;

import org.apache.wicket.model.LoadableDetachableModel;



import com.brie.dtoo.Cheese;
import com.brie.dtoo.CheeseDAO;
impor

CompoundPropertyModel for label?

2011-06-12 Thread Brian Lavender
Is it possible to use a compound property model for a label?

I tried adding labels using the following, but when I run it,
the label comes out with what appears to be a reference to the
model.

customer = new Customer();
customer.setFirstName("Jimmy");
customer.setLastName("Dean");
customer.getAddress().setStreet("123 Easy Street");

myModel = new CompoundPropertyModel(customer);

firstNameLabel = new Label("firstName",myModel);
add(firstNameLabel);
lastNameLabel = new Label("lastName",myModel);
add(lastNameLabel);
add(new Label("street.address", myModel))

CodeResult
firstName from Compound Property Model  com.brie.dtoo.Customer@7cb44d
lastName from Compound Property Model   com.brie.dtoo.Customer@7cb44d
street.address from Compound Property Model com.brie.dtoo.Customer@7cb44d

brian
-- 
Brian Lavender
http://www.brie.com/brian/

"There are two ways of constructing a software design. One way is to
make it so simple that there are obviously no deficiencies. And the other
way is to make it so complicated that there are no obvious deficiencies."

Professor C. A. R. Hoare
The 1980 Turing award lecture

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



Blog on my experiences learning Wicket

2011-06-08 Thread Brian Lavender
Hello everyone, 

I have been blogging regarding my experience using Wicket based upon my
experience learning Wicket using the "Wicket in Action" book by Dashorst
et al. using different takes or perhaps just my experience breaking down
the examples from the book. In others, I do a simple additions. My issue
with the book code is that it is in just one big example and it was not
clear how to me how to break out the pieces. Since the example code is 
Apache license, I just hacked them differently releasing with the same
license. I of errors, so please comment if you find that things aren't
quite right.

http://brie.com/brian/blog/?cat=8

Thus far, my blog entries focus on a simple project importable into Eclipse
and runnable using Maven. You can either download each sample referencing the 
blog
entry, or just download and hack them directly.

http://brie.com/brian/wicket/

And yes, my blog uses Wordpress, not Wicket quite yet.

brian
-- 
Brian Lavender
http://www.brie.com/brian/

"There are two ways of constructing a software design. One way is to
make it so simple that there are obviously no deficiencies. And the other
way is to make it so complicated that there are no obvious deficiencies."

Professor C. A. R. Hoare
The 1980 Turing award lecture

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