Re: Wicket 1.5 - ModalWindow with page - abstract functions do not update model correct

2011-06-15 Thread Marieke Vandamme
Hello, 
Thanks for the response !
I'm not sure if the following code is what you want. I just update the
pageValue variable on the HomePage in the abstract function 'linkClicked'.
Following code is inside the HomePage constructor: 
pageValue = initial modal value;
final ModalWindow window = new ModalWindow(window);
window.setPageCreator(new ModalWindow.PageCreator() {
public Page createPage() {
return new ModalWindowPage(getPage().getPageReference()) {
@Override
public void linkClicked(String value) {
System.out.println(setting pageValue to [ + value
+ ]);
pageValue = value;
}
};
}
});
window.setWindowClosedCallback(new
ModalWindow.WindowClosedCallback() {
public void onClose(AjaxRequestTarget target) {
System.out.println(getting pageValue [ + pageValue + ]);
}
});

I get the following console output:
setting pageValue to [ModalWindowPage value]
getting pageValue [page value]

Thanks for the hint tot the inter-component events. 
Should I then pass the Panel or Page as IEventSink to the constructor of the
ModalWindowPage so I can use it in the send-function? 
I'm afraid I will forget to catch the event with the onEvent function. With
the abstract function I was sure that the event was catched...

How come this did work in wicket 1.4 and now functionality is lost? 

Thanks for any help ! Marieke Vandamme

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-1-5-ModalWindow-with-page-abstract-functions-do-not-update-model-correct-tp3596526p3598583.html
Sent from the Users forum 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 1.5 - ModalWindow with page - abstract functions do not update model correct

2011-06-15 Thread Marieke Vandamme
Hi, 

I just tried it with the inter-component events, and it's the same problem
as with the abstract functions..

Please try my code:
HomePage:
public class HomePage extends WebPage {

@Override
public void onEvent(IEvent? event) {
super.onEvent(event);
if (event.getPayload() instanceof String){
String value = (String)event.getPayload();
System.out.println(setting pagevalue to [ + value + ]);
((MyBean)getDefaultModelObject()).setValue1(value);
}
}

public HomePage (){
MyBean myBean = new MyBean();
myBean.setValue1(initial value);
setDefaultModel(new ModelMyBean(myBean));
final ModalWindow window = new ModalWindow(window);
window.setPageCreator(new ModalWindow.PageCreator() {
public Page createPage() {
return new ModalWindowPage(getPage());
}
});
window.setWindowClosedCallback(new
ModalWindow.WindowClosedCallback() {
public void onClose(AjaxRequestTarget target) {
System.out.println(getting pageValue [ +
((MyBean)getDefaultModelObject()).getValue1() + ]);
}
});
add(window);

add(new AjaxLink(lnk) {
@Override
public void onClick(AjaxRequestTarget target) {
window.show(target);
}
});  
}

public class MyBean implements Serializable {
private String value1;

/**
 * @return the value1
 */
public String getValue1() {
return value1;
}

/**
 * @param value1 the value1 to set
 */
public void setValue1(String value1) {
this.value1 = value1;
}
}
}


ModalWindowPage:
public class ModalWindowPage extends WebPage {
public ModalWindowPage(final IEventSink eventSink){
add(new AjaxLink(btn) {
@Override
public void onClick(AjaxRequestTarget target) {
send(eventSink, Broadcast.EXACT, ModalWindowPage value);
ModalWindow.closeCurrent(target);
}
});
}
}


Console output:
setting pagevalue 2 to [ModalWindowPage value]
getting pageValue [initial value]


Thanks a lot ! Marieke Vandamme

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-1-5-ModalWindow-with-page-abstract-functions-do-not-update-model-correct-tp3596526p3598621.html
Sent from the Users forum 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



Users, sessions, data...

2011-06-15 Thread Zeldor
Hi,

My last attempts to fix my session and advices here made me thinking if my
approach is good. So I'm curious - how do you handle users and their data?
In my case I have session, when user logs in entire entity gets loaded into
session. Later I get user data from that session and when he changes
anything it gets persisted to db. There is no direct interaction between
user and only that user can access his data. What is your approach? :)

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Users-sessions-data-tp3598626p3598626.html
Sent from the Users forum 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: Users, sessions, data...

2011-06-15 Thread Peter Karich
 Am 15.06.2011 08:36, schrieb Zeldor:
 Hi,

 My last attempts to fix my session and advices here made me thinking if my
 approach is good. So I'm curious - how do you handle users and their data?
 In my case I have session, when user logs in entire entity gets loaded into
 session. Later I get user data from that session and when he changes
 anything it gets persisted to db. There is no direct interaction between
 user and only that user can access his data. What is your approach? :)

My approach is: load user data every time from DB. This way your session
is always small

or take a look to LoadableDetachableModel:
https://cwiki.apache.org/WICKET/detachable-models.html

Regards,
Peter.

-- 
http://jetwick.com open twitter search


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



Re: Users, sessions, data...

2011-06-15 Thread Zeldor
But what are benefits of small session really? With entire user in session I
can skip getting data from db and serve data faster...

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Users-sessions-data-tp3598626p3598945.html
Sent from the Users forum 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: AutoCompleteTextField which uses an Object, not a String

2011-06-15 Thread Clint Checketts
Yesterday while playing with AutoCompleTextField, I created a quickstart to
show how it is 'broken'. I hadn't thought of using a converter. After using
a converter the component behaves as I'd expect.

So a simpler solution could be: 1) improve the AutoCompleteTextField's java
doc to explain using the converter 2) update the wicketExample page to
include an example using a converter, 3) add some logic, or an ease of use
hook so that AutoComplete can detect when its being used against objects
that aren't strings and is breaking.

I'll open a Jira, attach the quickstart and attach a patch that takes care
of those 3 pieces. Yesterday I glanced at the ObjectAutoComplete and it
looks very powerful, but maybe even more complex.

My initial desire was that an AutoCompleteTextField mirror how a
DropDownChoice behaves by default. I'll try to demonstrate that in my patch.

-Clint



On Tue, Jun 14, 2011 at 10:51 PM, Igor Vaynberg igor.vaynb...@gmail.comwrote:

 we dont need to deprecate the existing one. it does something that
 object-autocomplete does not - lets you enter free-form-text with some
 assistance.

 -igor

 On Tue, Jun 14, 2011 at 6:55 PM, Jeremy Thomerson
 jer...@wickettraining.com wrote:
  I'd be up for at least moving the ObjectAutoComplete into core and adding
  @Deprecated to the existing one before 1.5.0 if there is consensus on it.
 
  --
  Jeremy Thomerson
  http://wickettraining.com
  *Need a CMS for Wicket?  Use Brix! http://brixcms.org*
 
  On Tue, Jun 14, 2011 at 11:27 AM, James Carman
  ja...@carmanconsulting.comwrote:
 
  On Tue, Jun 14, 2011 at 11:25 AM, Clint Checketts checke...@gmail.com
  wrote:
   Is there a good reason (besides backwards compatiblity) that the
   objectautocomplete hasn't replaced the broken string based one in
   wicket-extensions?
  
   It seems like AutoComplete should behave as similarly to
 DropDownChoice
  as
   possible. As it currently is, IChoiceRenderer feels broken with it.
  
 
  I would think it should have at least made its way into the core or
  extension by now.  There have been enough requests for it.
 
  -
  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




Re: Users, sessions, data...

2011-06-15 Thread Alexander Morozov

Zeldor wrote:
 
 But what are benefits of small session really? With entire user in session
 I can skip getting data from db and serve data faster...
 

In clustered env small session get replicated much faster. I think that
wicket's session shouldn't be used for storing any business data. Any data
should be attached and loaded on per-component level, i.e. on demand (either
from DB or external cache).


-
--
http://www.linkedin.com/in/amorozov
--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Users-sessions-data-tp3598626p3599303.html
Sent from the Users forum 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: Users, sessions, data...

2011-06-15 Thread Peter Karich

 But what are benefits of small session really? With entire user in session I
 can skip getting data from db and serve data faster...

wicket's (de-)serialization is not done in 0ms ;)

but if that works for you then this strategy is great.

and also if you have a lot of users or big user data (or both)
then you'll quickly run out of memory for your app server

another problem is that you'll have to make sure that the user is always
redirected to
the same server/node with the user its session data, which makes load
balancing more complicated.

-- 
http://jetwick.com open twitter search


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



Deploiment problem of wicket application with Jboss 5.1

2011-06-15 Thread Thomas Franconville

Hi all,

I am deploying my wicket application as an EAR with maven using JMX 
deploiment of JBoss.
When I use the web application, the directory 
[Jboss_home]/default/tmp/vfs-nested.tmp is growing until saturated the 
hardrive (several gigabytes !), duplicating all the jar and war in the ear.

When the disk is saturated, I have this stack

2011-06-15 11:06:41,220 INFO  [STDOUT] (ModificationWatcher Task) ERROR 
- Task   - Unhandled exception thrown by user code 
in task ModificationWatcher
java.lang.RuntimeException: Failed to read zip file: 
org.jboss.virtual.plugins.context.zip.ZipFileWrapper@1d295de - 
D:\Workspaces\UbiAnt\HemisEAR\target\Hemis.ear
at 
org.jboss.virtual.plugins.context.zip.ZipEntryContext.ensureEntries(ZipEntryContext.java:628)
at 
org.jboss.virtual.plugins.context.zip.ZipEntryContext.checkIfModified(ZipEntryContext.java:773)
at 
org.jboss.virtual.plugins.context.zip.ZipEntryContext.getChild(ZipEntryContext.java:817)
at 
org.jboss.virtual.plugins.context.zip.ZipEntryHandler.createChildHandler(ZipEntryHandler.java:191)
at 
org.jboss.virtual.plugins.context.AbstractVirtualFileHandler.structuredFindChild(AbstractVirtualFileHandler.java:684)
at 
org.jboss.virtual.plugins.context.zip.ZipEntryHandler.getChild(ZipEntryHandler.java:165)
at 
org.jboss.virtual.plugins.context.DelegatingHandler.getChild(DelegatingHandler.java:107)

at org.jboss.virtual.VirtualFile.findChild(VirtualFile.java:457)
at 
org.jboss.virtual.plugins.vfs.VirtualFileURLConnection.resolveVirtualFile(VirtualFileURLConnection.java:106)
at 
org.jboss.virtual.plugins.vfs.VirtualFileURLConnection.getVirtualFile(VirtualFileURLConnection.java:118)
at 
org.jboss.virtual.plugins.vfs.VirtualFileURLConnection.getInputStream(VirtualFileURLConnection.java:93)
at 
org.apache.wicket.util.io.Connections.close(Connections.java:127)
at 
org.apache.wicket.util.io.Connections.getLastModified(Connections.java:87)
at 
org.apache.wicket.util.resource.UrlResourceStream.lastModifiedTime(UrlResourceStream.java:233)
at 
org.apache.wicket.markup.MarkupResourceStream.lastModifiedTime(MarkupResourceStream.java:149)
at 
org.apache.wicket.util.watch.ModificationWatcher$1.run(ModificationWatcher.java:153)

at org.apache.wicket.util.thread.Task$1.run(Task.java:115)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.io.IOException: Espace insuffisant sur le disque
at java.io.FileOutputStream.writeBytes(Native Method)
at java.io.FileOutputStream.write(FileOutputStream.java:260)
at 
java.io.BufferedOutputStream.write(BufferedOutputStream.java:105)

at org.jboss.virtual.VFSUtils.copyStream(VFSUtils.java:941)
at 
org.jboss.virtual.VFSUtils.copyStreamAndClose(VFSUtils.java:901)
at 
org.jboss.virtual.plugins.context.zip.ZipEntryContext.initEntries(ZipEntryContext.java:562)
at 
org.jboss.virtual.plugins.context.zip.ZipEntryContext.ensureEntries(ZipEntryContext.java:619)

... 17 more

My environnement is:
JBoss 5.1
Wicket 1.5-RC4.2
Jdk 1.6
I am still in development mode.
When I am working with the war with Jetty, I have no problem.

Is somebody can explain me what happen and give me any clue to go forward.

Thanks

Thomas


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



Re: Users, sessions, data...

2011-06-15 Thread Zeldor
Well, I'm hosting it on GAE and with new pricing model I have to worry about
instances, not memcache or things like that. And I don't have to do load
balancing. To be sure that data does not get lost between instances [which
could happen probably with big traffic and longer inactivity from user] I
can just have a check in getUser() method which could reload data from db if
needed. I wonder if enabling multithreading could cause problems...

Loading user every time from db would be probably too slow and could spin up
too many instances due to that. Right now it looks like I can get data fast
from session and do a persist in 15-30ms. Add time for all calculations of
course. Numbers may be different with more users though. 

Anyway, I'm fairly new to programming and Wicket, so I don't know what's
fast or reasonable. Just trying to figure if I'm going in good direction
before it's too late to change it. 

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Users-sessions-data-tp3598626p3599401.html
Sent from the Users forum 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: Deploiment problem of wicket application with Jboss 5.1

2011-06-15 Thread Avraham Rosenzweig
It's a known JBoss issue with a workaround:
http://community.jboss.org/message/8053

On Wed, Jun 15, 2011 at 4:32 PM, Thomas Franconville 
tfranconvi...@tetraedge.com wrote:

 Hi all,

 I am deploying my wicket application as an EAR with maven using JMX
 deploiment of JBoss.
 When I use the web application, the directory
 [Jboss_home]/default/tmp/vfs-nested.tmp is growing until saturated the
 hardrive (several gigabytes !), duplicating all the jar and war in the ear.
 When the disk is saturated, I have this stack

 2011-06-15 11:06:41,220 INFO  [STDOUT] (ModificationWatcher Task) ERROR -
 Task   - Unhandled exception thrown by user code in task
 ModificationWatcher
 java.lang.RuntimeException: Failed to read zip file:
 org.jboss.virtual.plugins.context.zip.ZipFileWrapper@1d295de -
 D:\Workspaces\UbiAnt\HemisEAR\target\Hemis.ear
at
 org.jboss.virtual.plugins.context.zip.ZipEntryContext.ensureEntries(ZipEntryContext.java:628)
at
 org.jboss.virtual.plugins.context.zip.ZipEntryContext.checkIfModified(ZipEntryContext.java:773)
at
 org.jboss.virtual.plugins.context.zip.ZipEntryContext.getChild(ZipEntryContext.java:817)
at
 org.jboss.virtual.plugins.context.zip.ZipEntryHandler.createChildHandler(ZipEntryHandler.java:191)
at
 org.jboss.virtual.plugins.context.AbstractVirtualFileHandler.structuredFindChild(AbstractVirtualFileHandler.java:684)
at
 org.jboss.virtual.plugins.context.zip.ZipEntryHandler.getChild(ZipEntryHandler.java:165)
at
 org.jboss.virtual.plugins.context.DelegatingHandler.getChild(DelegatingHandler.java:107)
at org.jboss.virtual.VirtualFile.findChild(VirtualFile.java:457)
at
 org.jboss.virtual.plugins.vfs.VirtualFileURLConnection.resolveVirtualFile(VirtualFileURLConnection.java:106)
at
 org.jboss.virtual.plugins.vfs.VirtualFileURLConnection.getVirtualFile(VirtualFileURLConnection.java:118)
at
 org.jboss.virtual.plugins.vfs.VirtualFileURLConnection.getInputStream(VirtualFileURLConnection.java:93)
at org.apache.wicket.util.io.Connections.close(Connections.java:127)
at
 org.apache.wicket.util.io.Connections.getLastModified(Connections.java:87)
at
 org.apache.wicket.util.resource.UrlResourceStream.lastModifiedTime(UrlResourceStream.java:233)
at
 org.apache.wicket.markup.MarkupResourceStream.lastModifiedTime(MarkupResourceStream.java:149)
at
 org.apache.wicket.util.watch.ModificationWatcher$1.run(ModificationWatcher.java:153)
at org.apache.wicket.util.thread.Task$1.run(Task.java:115)
at java.lang.Thread.run(Thread.java:662)
 Caused by: java.io.IOException: Espace insuffisant sur le disque
at java.io.FileOutputStream.writeBytes(Native Method)
at java.io.FileOutputStream.write(FileOutputStream.java:260)
at java.io.BufferedOutputStream.write(BufferedOutputStream.java:105)
at org.jboss.virtual.VFSUtils.copyStream(VFSUtils.java:941)
at org.jboss.virtual.VFSUtils.copyStreamAndClose(VFSUtils.java:901)
at
 org.jboss.virtual.plugins.context.zip.ZipEntryContext.initEntries(ZipEntryContext.java:562)
at
 org.jboss.virtual.plugins.context.zip.ZipEntryContext.ensureEntries(ZipEntryContext.java:619)
... 17 more

 My environnement is:
 JBoss 5.1
 Wicket 1.5-RC4.2
 Jdk 1.6
 I am still in development mode.
 When I am working with the war with Jetty, I have no problem.

 Is somebody can explain me what happen and give me any clue to go forward.

 Thanks

 Thomas


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




-- 
[]'s
Avraham Rosenzweig
avrah...@gmail.com


Re: Users, sessions, data...

2011-06-15 Thread Dan Retzlaff
One subtle gotcha to consider is that Wicket does not synchronize access to
your Session object when processing multiple requests by the same user.
Marking your Session's getters and setters as synchronized is sufficient
for simple data members, but typical use of entities cannot be considered
thread-safe. (With Hibernate this is clear because attached entities are
associated with a single Hibernate Session, which is definitely not
thread-safe. I'm not sure of the JPA equivalent terminology.)

For this reason, I maintain only the user ID in the Wicket Session, and
subclass WebRequestCycle to maintain request-scoped entities. (Your
WebRequestCycle is only used by the single thread servicing the request.)

Thanks to Igor and his Apache Wicket Cookbook for drawing my attention to
this issue. :)

Dan

On Wed, Jun 15, 2011 at 6:34 AM, Zeldor pgronkiew...@gmail.com wrote:

 Well, I'm hosting it on GAE and with new pricing model I have to worry
 about
 instances, not memcache or things like that. And I don't have to do load
 balancing. To be sure that data does not get lost between instances [which
 could happen probably with big traffic and longer inactivity from user] I
 can just have a check in getUser() method which could reload data from db
 if
 needed. I wonder if enabling multithreading could cause problems...

 Loading user every time from db would be probably too slow and could spin
 up
 too many instances due to that. Right now it looks like I can get data fast
 from session and do a persist in 15-30ms. Add time for all calculations of
 course. Numbers may be different with more users though.

 Anyway, I'm fairly new to programming and Wicket, so I don't know what's
 fast or reasonable. Just trying to figure if I'm going in good direction
 before it's too late to change it.

 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Users-sessions-data-tp3598626p3599401.html
 Sent from the Users forum 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: Deploiment problem of wicket application with Jboss 5.1

2011-06-15 Thread Thomas Franconville

I have added as specified the entry
entry
key${jboss.server.home.url}farm/key
valueinject bean=VfsNamesExceptionHandler//value
/entry*
into the file server\default\conf\bootstrap\vfs.xml
But it changes nothing.
They wrote about farm. I am in default configuration, so farm is not 
activated. I am not sure it is exactely the problem.

What mecanism is there into wicket of refresh ? Why it is scanning the ear ?

NB: I have had already seen this note but as it was specified on all 
configuration, I have already test this in the file 
**server\all\conf\bootstrap\vfs.xml, but it chanded nothing too.*


Le 15/06/2011 15:42, Avraham Rosenzweig a écrit :

It's a known JBoss issue with a workaround:
http://community.jboss.org/message/8053

On Wed, Jun 15, 2011 at 4:32 PM, Thomas Franconville
tfranconvi...@tetraedge.com  wrote:


Hi all,

I am deploying my wicket application as an EAR with maven using JMX
deploiment of JBoss.
When I use the web application, the directory
[Jboss_home]/default/tmp/vfs-nested.tmp is growing until saturated the
hardrive (several gigabytes !), duplicating all the jar and war in the ear.
When the disk is saturated, I have this stack

2011-06-15 11:06:41,220 INFO  [STDOUT] (ModificationWatcher Task) ERROR -
Task   - Unhandled exception thrown by user code in task
ModificationWatcher
java.lang.RuntimeException: Failed to read zip file:
org.jboss.virtual.plugins.context.zip.ZipFileWrapper@1d295de -
D:\Workspaces\UbiAnt\HemisEAR\target\Hemis.ear
at
org.jboss.virtual.plugins.context.zip.ZipEntryContext.ensureEntries(ZipEntryContext.java:628)
at
org.jboss.virtual.plugins.context.zip.ZipEntryContext.checkIfModified(ZipEntryContext.java:773)
at
org.jboss.virtual.plugins.context.zip.ZipEntryContext.getChild(ZipEntryContext.java:817)
at
org.jboss.virtual.plugins.context.zip.ZipEntryHandler.createChildHandler(ZipEntryHandler.java:191)
at
org.jboss.virtual.plugins.context.AbstractVirtualFileHandler.structuredFindChild(AbstractVirtualFileHandler.java:684)
at
org.jboss.virtual.plugins.context.zip.ZipEntryHandler.getChild(ZipEntryHandler.java:165)
at
org.jboss.virtual.plugins.context.DelegatingHandler.getChild(DelegatingHandler.java:107)
at org.jboss.virtual.VirtualFile.findChild(VirtualFile.java:457)
at
org.jboss.virtual.plugins.vfs.VirtualFileURLConnection.resolveVirtualFile(VirtualFileURLConnection.java:106)
at
org.jboss.virtual.plugins.vfs.VirtualFileURLConnection.getVirtualFile(VirtualFileURLConnection.java:118)
at
org.jboss.virtual.plugins.vfs.VirtualFileURLConnection.getInputStream(VirtualFileURLConnection.java:93)
at org.apache.wicket.util.io.Connections.close(Connections.java:127)
at
org.apache.wicket.util.io.Connections.getLastModified(Connections.java:87)
at
org.apache.wicket.util.resource.UrlResourceStream.lastModifiedTime(UrlResourceStream.java:233)
at
org.apache.wicket.markup.MarkupResourceStream.lastModifiedTime(MarkupResourceStream.java:149)
at
org.apache.wicket.util.watch.ModificationWatcher$1.run(ModificationWatcher.java:153)
at org.apache.wicket.util.thread.Task$1.run(Task.java:115)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.io.IOException: Espace insuffisant sur le disque
at java.io.FileOutputStream.writeBytes(Native Method)
at java.io.FileOutputStream.write(FileOutputStream.java:260)
at java.io.BufferedOutputStream.write(BufferedOutputStream.java:105)
at org.jboss.virtual.VFSUtils.copyStream(VFSUtils.java:941)
at org.jboss.virtual.VFSUtils.copyStreamAndClose(VFSUtils.java:901)
at
org.jboss.virtual.plugins.context.zip.ZipEntryContext.initEntries(ZipEntryContext.java:562)
at
org.jboss.virtual.plugins.context.zip.ZipEntryContext.ensureEntries(ZipEntryContext.java:619)
... 17 more

My environnement is:
JBoss 5.1
Wicket 1.5-RC4.2
Jdk 1.6
I am still in development mode.
When I am working with the war with Jetty, I have no problem.

Is somebody can explain me what happen and give me any clue to go forward.

Thanks

Thomas


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








Re: Deploiment problem of wicket application with Jboss 5.1

2011-06-15 Thread Thomas Franconville

The workaround is not so far.
I try to put the target directory as a key of the vfs.xml file and it 
works. It duplicates only once files so no more problem of space.
BUT it is not so good for me as each developer has directory different, 
and when we work with remote server, the directory is where wagon is 
copying file. JMX lets file where they are.


I go back with my question about wicket, because of, with any other ear 
without wicket, there is no problem.

What is doing wicket to give jboss a such problem ?

Le 15/06/2011 17:29, Thomas Franconville a écrit :

I have added as specified the entry
entry
key${jboss.server.home.url}farm/key
valueinject bean=VfsNamesExceptionHandler//value
/entry*
into the file server\default\conf\bootstrap\vfs.xml
But it changes nothing.
They wrote about farm. I am in default configuration, so farm is not 
activated. I am not sure it is exactely the problem.
What mecanism is there into wicket of refresh ? Why it is scanning the 
ear ?


NB: I have had already seen this note but as it was specified on all 
configuration, I have already test this in the file 
**server\all\conf\bootstrap\vfs.xml, but it chanded nothing too.*


Le 15/06/2011 15:42, Avraham Rosenzweig a écrit :

It's a known JBoss issue with a workaround:
http://community.jboss.org/message/8053

On Wed, Jun 15, 2011 at 4:32 PM, Thomas Franconville
tfranconvi...@tetraedge.com  wrote:


Hi all,

I am deploying my wicket application as an EAR with maven using JMX
deploiment of JBoss.
When I use the web application, the directory
[Jboss_home]/default/tmp/vfs-nested.tmp is growing until saturated the
hardrive (several gigabytes !), duplicating all the jar and war in 
the ear.

When the disk is saturated, I have this stack

2011-06-15 11:06:41,220 INFO  [STDOUT] (ModificationWatcher Task) 
ERROR -
Task   - Unhandled exception thrown by user code 
in task

ModificationWatcher
java.lang.RuntimeException: Failed to read zip file:
org.jboss.virtual.plugins.context.zip.ZipFileWrapper@1d295de -
D:\Workspaces\UbiAnt\HemisEAR\target\Hemis.ear
at
org.jboss.virtual.plugins.context.zip.ZipEntryContext.ensureEntries(ZipEntryContext.java:628) 


at
org.jboss.virtual.plugins.context.zip.ZipEntryContext.checkIfModified(ZipEntryContext.java:773) 


at
org.jboss.virtual.plugins.context.zip.ZipEntryContext.getChild(ZipEntryContext.java:817) 


at
org.jboss.virtual.plugins.context.zip.ZipEntryHandler.createChildHandler(ZipEntryHandler.java:191) 


at
org.jboss.virtual.plugins.context.AbstractVirtualFileHandler.structuredFindChild(AbstractVirtualFileHandler.java:684) 


at
org.jboss.virtual.plugins.context.zip.ZipEntryHandler.getChild(ZipEntryHandler.java:165) 


at
org.jboss.virtual.plugins.context.DelegatingHandler.getChild(DelegatingHandler.java:107) 

at 
org.jboss.virtual.VirtualFile.findChild(VirtualFile.java:457)

at
org.jboss.virtual.plugins.vfs.VirtualFileURLConnection.resolveVirtualFile(VirtualFileURLConnection.java:106) 


at
org.jboss.virtual.plugins.vfs.VirtualFileURLConnection.getVirtualFile(VirtualFileURLConnection.java:118) 


at
org.jboss.virtual.plugins.vfs.VirtualFileURLConnection.getInputStream(VirtualFileURLConnection.java:93) 

at 
org.apache.wicket.util.io.Connections.close(Connections.java:127)

at
org.apache.wicket.util.io.Connections.getLastModified(Connections.java:87) 


at
org.apache.wicket.util.resource.UrlResourceStream.lastModifiedTime(UrlResourceStream.java:233) 


at
org.apache.wicket.markup.MarkupResourceStream.lastModifiedTime(MarkupResourceStream.java:149) 


at
org.apache.wicket.util.watch.ModificationWatcher$1.run(ModificationWatcher.java:153) 


at org.apache.wicket.util.thread.Task$1.run(Task.java:115)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.io.IOException: Espace insuffisant sur le disque
at java.io.FileOutputStream.writeBytes(Native Method)
at java.io.FileOutputStream.write(FileOutputStream.java:260)
at 
java.io.BufferedOutputStream.write(BufferedOutputStream.java:105)

at org.jboss.virtual.VFSUtils.copyStream(VFSUtils.java:941)
at 
org.jboss.virtual.VFSUtils.copyStreamAndClose(VFSUtils.java:901)

at
org.jboss.virtual.plugins.context.zip.ZipEntryContext.initEntries(ZipEntryContext.java:562) 


at
org.jboss.virtual.plugins.context.zip.ZipEntryContext.ensureEntries(ZipEntryContext.java:619) 


... 17 more

My environnement is:
JBoss 5.1
Wicket 1.5-RC4.2
Jdk 1.6
I am still in development mode.
When I am working with the war with Jetty, I have no problem.

Is somebody can explain me what happen and give me any clue to go 
forward.


Thanks

Thomas


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












Re: Deploiment problem of wicket application with Jboss 5.1

2011-06-15 Thread Peter Ertl
Google Translate tells me:

'Espace insuffisant sur le disque' - 'Not enough space on disk'

So did you check your free disk space?


Am 15.06.2011 um 15:32 schrieb Thomas Franconville:

 Hi all,
 
 I am deploying my wicket application as an EAR with maven using JMX 
 deploiment of JBoss.
 When I use the web application, the directory 
 [Jboss_home]/default/tmp/vfs-nested.tmp is growing until saturated the 
 hardrive (several gigabytes !), duplicating all the jar and war in the ear.
 When the disk is saturated, I have this stack
 
 2011-06-15 11:06:41,220 INFO  [STDOUT] (ModificationWatcher Task) ERROR - 
 Task   - Unhandled exception thrown by user code in task 
 ModificationWatcher
 java.lang.RuntimeException: Failed to read zip file: 
 org.jboss.virtual.plugins.context.zip.ZipFileWrapper@1d295de - 
 D:\Workspaces\UbiAnt\HemisEAR\target\Hemis.ear
at 
 org.jboss.virtual.plugins.context.zip.ZipEntryContext.ensureEntries(ZipEntryContext.java:628)
at 
 org.jboss.virtual.plugins.context.zip.ZipEntryContext.checkIfModified(ZipEntryContext.java:773)
at 
 org.jboss.virtual.plugins.context.zip.ZipEntryContext.getChild(ZipEntryContext.java:817)
at 
 org.jboss.virtual.plugins.context.zip.ZipEntryHandler.createChildHandler(ZipEntryHandler.java:191)
at 
 org.jboss.virtual.plugins.context.AbstractVirtualFileHandler.structuredFindChild(AbstractVirtualFileHandler.java:684)
at 
 org.jboss.virtual.plugins.context.zip.ZipEntryHandler.getChild(ZipEntryHandler.java:165)
at 
 org.jboss.virtual.plugins.context.DelegatingHandler.getChild(DelegatingHandler.java:107)
at org.jboss.virtual.VirtualFile.findChild(VirtualFile.java:457)
at 
 org.jboss.virtual.plugins.vfs.VirtualFileURLConnection.resolveVirtualFile(VirtualFileURLConnection.java:106)
at 
 org.jboss.virtual.plugins.vfs.VirtualFileURLConnection.getVirtualFile(VirtualFileURLConnection.java:118)
at 
 org.jboss.virtual.plugins.vfs.VirtualFileURLConnection.getInputStream(VirtualFileURLConnection.java:93)
at org.apache.wicket.util.io.Connections.close(Connections.java:127)
at 
 org.apache.wicket.util.io.Connections.getLastModified(Connections.java:87)
at 
 org.apache.wicket.util.resource.UrlResourceStream.lastModifiedTime(UrlResourceStream.java:233)
at 
 org.apache.wicket.markup.MarkupResourceStream.lastModifiedTime(MarkupResourceStream.java:149)
at 
 org.apache.wicket.util.watch.ModificationWatcher$1.run(ModificationWatcher.java:153)
at org.apache.wicket.util.thread.Task$1.run(Task.java:115)
at java.lang.Thread.run(Thread.java:662)
 Caused by: java.io.IOException: Espace insuffisant sur le disque
at java.io.FileOutputStream.writeBytes(Native Method)
at java.io.FileOutputStream.write(FileOutputStream.java:260)
at java.io.BufferedOutputStream.write(BufferedOutputStream.java:105)
at org.jboss.virtual.VFSUtils.copyStream(VFSUtils.java:941)
at org.jboss.virtual.VFSUtils.copyStreamAndClose(VFSUtils.java:901)
at 
 org.jboss.virtual.plugins.context.zip.ZipEntryContext.initEntries(ZipEntryContext.java:562)
at 
 org.jboss.virtual.plugins.context.zip.ZipEntryContext.ensureEntries(ZipEntryContext.java:619)
... 17 more
 
 My environnement is:
 JBoss 5.1
 Wicket 1.5-RC4.2
 Jdk 1.6
 I am still in development mode.
 When I am working with the war with Jetty, I have no problem.
 
 Is somebody can explain me what happen and give me any clue to go forward.
 
 Thanks
 
 Thomas
 
 
 -
 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



TextField and Java Number

2011-06-15 Thread Corbin, James
I am creating an input field that should accept numbers only, so I defined my 
TextField component as follows,

TextFieldNumber(String markupId, IModelNumber model)

I am forcing the model update by adding 
AjaxFormComponentUpdatingBehavior(onblur)...

The model doesn't appear to be getting updated (works okay if defined as 
TextFieldString).

I am wondering if the alternate constructor format is required to make it work 
with types not derived from a String, as in,

TextFieldNumber(String markupId, IModelNumber model, Number.class)  // 
explicitly specify the type

I thought moving to support generics in wicket eliminated the need for this 
kind of syntax.

Is specifying the type (e.g., class) the solution,  or do I need to add a 
specific type converter for type Number???

Thanks,
J.D.


Re: TextField and Java Number

2011-06-15 Thread James Carman
Number is abstract.  How is TextField supposed to be able to
instantiate one using the text?  You can't use one of the subclasses?

On Wed, Jun 15, 2011 at 5:20 PM, Corbin, James jcor...@iqnavigator.com wrote:
 I am creating an input field that should accept numbers only, so I defined my 
 TextField component as follows,

 TextFieldNumber(String markupId, IModelNumber model)

 I am forcing the model update by adding 
 AjaxFormComponentUpdatingBehavior(onblur)...

 The model doesn't appear to be getting updated (works okay if defined as 
 TextFieldString).

 I am wondering if the alternate constructor format is required to make it 
 work with types not derived from a String, as in,

 TextFieldNumber(String markupId, IModelNumber model, Number.class)  // 
 explicitly specify the type

 I thought moving to support generics in wicket eliminated the need for this 
 kind of syntax.

 Is specifying the type (e.g., class) the solution,  or do I need to add a 
 specific type converter for type Number???

 Thanks,
 J.D.


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



Re: Deploiment problem of wicket application with Jboss 5.1

2011-06-15 Thread Thomas Franconville
Yes, before deploying and using the wicket application, I have had 4Go 
space left on my disk.
After, 0 octet is left as the [Jboss_home]/default/tmp/vfs-nested.tmp 
directory growing as non sense with with jar and war contained into the 
ear were duplicated as space left.
It is as wicket find that the ear change and force to redeploy and 
then jboss find that the ear change and redeploy and so on until that no 
more space left.
It appends on my windows machine, but also on our linux machine were we 
integrate the application.


Le 15/06/2011 20:10, Peter Ertl a écrit :

Google Translate tells me:

'Espace insuffisant sur le disque' -  'Not enough space on disk'

So did you check your free disk space?


Am 15.06.2011 um 15:32 schrieb Thomas Franconville:


Hi all,

I am deploying my wicket application as an EAR with maven using JMX deploiment 
of JBoss.
When I use the web application, the directory 
[Jboss_home]/default/tmp/vfs-nested.tmp is growing until saturated the hardrive 
(several gigabytes !), duplicating all the jar and war in the ear.
When the disk is saturated, I have this stack

2011-06-15 11:06:41,220 INFO  [STDOUT] (ModificationWatcher Task) ERROR - Task  
 - Unhandled exception thrown by user code in task 
ModificationWatcher
java.lang.RuntimeException: Failed to read zip file: 
org.jboss.virtual.plugins.context.zip.ZipFileWrapper@1d295de - 
D:\Workspaces\UbiAnt\HemisEAR\target\Hemis.ear
at 
org.jboss.virtual.plugins.context.zip.ZipEntryContext.ensureEntries(ZipEntryContext.java:628)
at 
org.jboss.virtual.plugins.context.zip.ZipEntryContext.checkIfModified(ZipEntryContext.java:773)
at 
org.jboss.virtual.plugins.context.zip.ZipEntryContext.getChild(ZipEntryContext.java:817)
at 
org.jboss.virtual.plugins.context.zip.ZipEntryHandler.createChildHandler(ZipEntryHandler.java:191)
at 
org.jboss.virtual.plugins.context.AbstractVirtualFileHandler.structuredFindChild(AbstractVirtualFileHandler.java:684)
at 
org.jboss.virtual.plugins.context.zip.ZipEntryHandler.getChild(ZipEntryHandler.java:165)
at 
org.jboss.virtual.plugins.context.DelegatingHandler.getChild(DelegatingHandler.java:107)
at org.jboss.virtual.VirtualFile.findChild(VirtualFile.java:457)
at 
org.jboss.virtual.plugins.vfs.VirtualFileURLConnection.resolveVirtualFile(VirtualFileURLConnection.java:106)
at 
org.jboss.virtual.plugins.vfs.VirtualFileURLConnection.getVirtualFile(VirtualFileURLConnection.java:118)
at 
org.jboss.virtual.plugins.vfs.VirtualFileURLConnection.getInputStream(VirtualFileURLConnection.java:93)
at org.apache.wicket.util.io.Connections.close(Connections.java:127)
at 
org.apache.wicket.util.io.Connections.getLastModified(Connections.java:87)
at 
org.apache.wicket.util.resource.UrlResourceStream.lastModifiedTime(UrlResourceStream.java:233)
at 
org.apache.wicket.markup.MarkupResourceStream.lastModifiedTime(MarkupResourceStream.java:149)
at 
org.apache.wicket.util.watch.ModificationWatcher$1.run(ModificationWatcher.java:153)
at org.apache.wicket.util.thread.Task$1.run(Task.java:115)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.io.IOException: Espace insuffisant sur le disque
at java.io.FileOutputStream.writeBytes(Native Method)
at java.io.FileOutputStream.write(FileOutputStream.java:260)
at java.io.BufferedOutputStream.write(BufferedOutputStream.java:105)
at org.jboss.virtual.VFSUtils.copyStream(VFSUtils.java:941)
at org.jboss.virtual.VFSUtils.copyStreamAndClose(VFSUtils.java:901)
at 
org.jboss.virtual.plugins.context.zip.ZipEntryContext.initEntries(ZipEntryContext.java:562)
at 
org.jboss.virtual.plugins.context.zip.ZipEntryContext.ensureEntries(ZipEntryContext.java:619)
... 17 more

My environnement is:
JBoss 5.1
Wicket 1.5-RC4.2
Jdk 1.6
I am still in development mode.
When I am working with the war with Jetty, I have no problem.

Is somebody can explain me what happen and give me any clue to go forward.

Thanks

Thomas


-
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







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



Re: Wicket 1.5 - ModalWindow with page - abstract functions do not update model correct

2011-06-15 Thread Andrea Del Bene

Hi Marieke ,

I've tried your code and I have your same problem. Tomorrow I will try 
to investigate further and maybe I will create an issue.




Hi,

I just tried it with the inter-component events, and it's the same problem
as with the abstract functions..

Please try my code:
HomePage:
public class HomePage extends WebPage {



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



RE: TextField and Java Number

2011-06-15 Thread Corbin, James
LOL...good point...so the type Number.class was probably a bad choice :) I'm 
going with a BigDecimal as my type as that should support all my needs.

Thanks,
J.D.

-Original Message-
From: jcar...@carmanconsulting.com [mailto:jcar...@carmanconsulting.com] On 
Behalf Of James Carman
Sent: Wednesday, June 15, 2011 3:30 PM
To: users@wicket.apache.org
Subject: Re: TextField and Java Number

Number is abstract.  How is TextField supposed to be able to
instantiate one using the text?  You can't use one of the subclasses?

On Wed, Jun 15, 2011 at 5:20 PM, Corbin, James jcor...@iqnavigator.com wrote:
 I am creating an input field that should accept numbers only, so I defined my 
 TextField component as follows,

 TextFieldNumber(String markupId, IModelNumber model)

 I am forcing the model update by adding 
 AjaxFormComponentUpdatingBehavior(onblur)...

 The model doesn't appear to be getting updated (works okay if defined as 
 TextFieldString).

 I am wondering if the alternate constructor format is required to make it 
 work with types not derived from a String, as in,

 TextFieldNumber(String markupId, IModelNumber model, Number.class)  // 
 explicitly specify the type

 I thought moving to support generics in wicket eliminated the need for this 
 kind of syntax.

 Is specifying the type (e.g., class) the solution,  or do I need to add a 
 specific type converter for type Number???

 Thanks,
 J.D.


-
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



RE: TextField and Java Number

2011-06-15 Thread Corbin, James
Good point.  Number is not the appropriate type in this case.  I think I should

-Original Message-
From: jcar...@carmanconsulting.com [mailto:jcar...@carmanconsulting.com] On 
Behalf Of James Carman
Sent: Wednesday, June 15, 2011 3:30 PM
To: users@wicket.apache.org
Subject: Re: TextField and Java Number

Number is abstract.  How is TextField supposed to be able to
instantiate one using the text?  You can't use one of the subclasses?

On Wed, Jun 15, 2011 at 5:20 PM, Corbin, James jcor...@iqnavigator.com wrote:
 I am creating an input field that should accept numbers only, so I defined my 
 TextField component as follows,

 TextFieldNumber(String markupId, IModelNumber model)

 I am forcing the model update by adding 
 AjaxFormComponentUpdatingBehavior(onblur)...

 The model doesn't appear to be getting updated (works okay if defined as 
 TextFieldString).

 I am wondering if the alternate constructor format is required to make it 
 work with types not derived from a String, as in,

 TextFieldNumber(String markupId, IModelNumber model, Number.class)  // 
 explicitly specify the type

 I thought moving to support generics in wicket eliminated the need for this 
 kind of syntax.

 Is specifying the type (e.g., class) the solution,  or do I need to add a 
 specific type converter for type Number???

 Thanks,
 J.D.


-
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



wicket-rest and Wicket 1.5-RC4.2: MarkupNotFoundException: Can not determine Markup

2011-06-15 Thread gerar
Hi,

I've tried to port http://wicket-rest.googlecode.com/svn to Wicket
1.5-RC4.2.
That took some minor changes like the package that PageParameters is in, the
way the HttpServletRequest is fetched and the onRender methods.

All compiles well. However, when I make a request in a browser for a URL
like http://localhost:8080/wicket-rest-example/person-api/xml;, I get
errors like this one:

org.apache.wicket.markup.MarkupNotFoundException: Can not determine Markup.
Component is not yet connected to a parent. [Page class =
org.innobuilt.wicket.rest.example.pages.PersonXmlRestService, id = 2, render
count = 1]

When using Wicket 1.4.x, that all works fine.

Does anyone have an idea what is going on?

Cheers,

Gerar

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/wicket-rest-and-Wicket-1-5-RC4-2-MarkupNotFoundException-Can-not-determine-Markup-tp3600779p3600779.html
Sent from the Users forum 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



autocomplete editable label

2011-06-15 Thread wmike1...@gmail.com
Is there any way to combine the function of the auto complete text field and
the function of the ajaxEditableLabel?

I'd like to click some text, have an editable text box appear, and have it
autocomplete for me.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/autocomplete-editable-label-tp3600846p3600846.html
Sent from the Users forum 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



Debouncing ajax calls..

2011-06-15 Thread Tom Howe
Hi, is there a supported way to make setThottleDelay keep resetting the
timer and only action the event after the last change.

I can see 'postponeTimerOnUpdate' as an option to Wicket.Throttler in the
wicket ajax js but dont know how to activate it.

Should I manually create a wicket.throttler and just call it myself?


I'm using wicket 1.4.17


Thanks, Tom


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 MapLong, Cheese cheeses = new HashMapLong, Cheese();

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 ListCheese getCheeses() {
		ListCheese tmpList = new ArrayListCheese(cheeses.values());
		return tmpList ;
	}

}
package com.brie.dtoo;

import java.util.List;

public interface CheeseDAO {
	public Cheese getCheese(Long id);
	public ListCheese 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;
import com.brie.dtoo.CheeseDAOImpl;

public class CheeseDetach extends LoadableDetachableModelCheese {
	
	private static final long serialVersionUID = 1L;
	private final Long id;
	
	

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

2011-06-15 Thread Dan Retzlaff
Look carefully at the ListView's constructor arguments. It wants an
IModelListCheese, not an IModelCheese 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 br...@brie.com 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



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
 IModelListCheese, not an IModelCheese 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 br...@brie.com 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 MapLong, Cheese cheeses = new HashMapLong, Cheese();

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 ListCheese getCheeses() {
		ListCheese tmpList