-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
nino.martinez.wael
committed
Jun 8, 2010
1 parent
599ec4f
commit e71c877
Showing
6 changed files
with
118 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
sandbox/trunk/WicketGuiceIOCBug/src/main/java/org/slurry/pages/EventDetachableModel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package org.slurry.pages; | ||
|
||
import org.apache.wicket.model.LoadableDetachableModel; | ||
import org.slurry.data.dao.interfaces.EventDao; | ||
import org.slurry.data.dataobjects.Event; | ||
|
||
import com.google.inject.Inject; | ||
|
||
public class EventDetachableModel extends LoadableDetachableModel<Event> { | ||
private EventDao eventDao; | ||
|
||
private Long id=null; | ||
|
||
public EventDetachableModel() { | ||
|
||
} | ||
|
||
public EventDetachableModel(Long id) { | ||
this.setId(id); | ||
} | ||
|
||
@Override | ||
protected Event load() { | ||
if(id!=null) | ||
{ | ||
return getEventDao().find(getId()); | ||
} | ||
else { | ||
return null; | ||
} | ||
} | ||
|
||
public void setId(Long id) { | ||
this.id = id; | ||
} | ||
|
||
public Long getId() { | ||
return id; | ||
} | ||
|
||
@Inject | ||
public void setEventDao(EventDao eventDao) { | ||
this.eventDao = eventDao; | ||
} | ||
|
||
public EventDao getEventDao() { | ||
return eventDao; | ||
} | ||
|
||
} |
25 changes: 25 additions & 0 deletions
25
sandbox/trunk/WicketGuiceIOCBug/src/main/java/org/slurry/pages/EventListDetachableModel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package org.slurry.pages; | ||
|
||
import java.util.List; | ||
|
||
import org.apache.wicket.injection.web.InjectorHolder; | ||
import org.apache.wicket.model.LoadableDetachableModel; | ||
import org.slurry.data.dao.interfaces.EventDao; | ||
import org.slurry.data.dataobjects.Event; | ||
|
||
import com.google.inject.Inject; | ||
|
||
public class EventListDetachableModel extends LoadableDetachableModel<List<Event>> { | ||
@Inject | ||
private EventDao eventDao; | ||
|
||
public EventListDetachableModel() { | ||
InjectorHolder.getInjector().inject(this); | ||
} | ||
|
||
@Override | ||
protected List<Event> load() { | ||
return eventDao.findAll(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters