Re: AjaxFallbackDefaultDataTable: cell not receiving event after sorting

2013-06-09 Thread dlock
Hi Sven.
I created a QuickStart as per your suggestion and in the process of writing
it I discovered what the issue was.

Basically the mark-up had an erroneous enclosure tag defined which was
causing the problem.  

body
wicket:panel
*div wicket:enclosure=table*

[table]

   * /div*
/wicket:panel
/body

Removing the enclosure tag rectified the problem.  

At least now I know how to create a QuickStart :)

Thanks for you help.
dl



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/AjaxFallbackDefaultDataTable-cell-not-receiving-event-after-sorting-tp4659277p4659303.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: Quick fix for the dreaded org.hibernate.LazyInitializationException with WicketTester

2013-06-09 Thread vzog
I managed to make a similar workaround to enable reopening of session in unit
tests using your approach. I'm using wicket 6.7, hibernate 4 and spring
3.2.2.
please let me know if you have any problem in this configuration
Thanks a lot

Leon Nieuwoudt wrote
 Hi all,
 
 After about 5 minutes of omfg not that error again, I think I found a
 quick hack to avoid org.hibernate.LazyInitializationException with
 WicketTester. I've checked everywhere on the lists but didn't find a
 similar
 solution, so apologies if someone else already posted this. There may also
 be a better way to do it.
 
 If I can explain it properly:
 
 * I have an abstract BaseAdminApplication class that extends
 WebApplication,
 and does the standard application configurations (mounting/stuff), but no
 Spring injection configuration yet.
 
 * Then I have a SpringAdminApplication that extends from
 BaseAdminApplication. This is referenced for the normal
 applicationContext.xml, and correctly configures Spring Injection.
 
 * There is another subclass, called JUnitAdminApplication, that also
 extends
 from BaseAdminApplication. This is referenced in the Unit Testing
 application context.
 
 * The JUnitAdminApplication mimics the OSIV pattern, inside Wicket's
 WebSession.attach() and .detach() methods.
 
 * Configure Spring Injection outside of the WebApplication. For some
 reason
 there were odd errors when configuring during the WebApplication.init()
 process.
 
 I do hope it makes sense. Unfortunately I can't give out all the code, but
 I'm sure it'll set the next person on the right track before redoing tests
 with Selenium at the 11th hour. So far there are no strange surprises,
 yet.
 
 ---
 
 package com.SECRETAPP.web;
 
 import ..;
 
 public class JUnitAdminApplication extends BaseAdminApplication {
 @Autowired
 SessionFactory sessionFactory;
 
 @Override
 public Session newSession(Request request, Response response) {
 return new WebSession(request) {
 @Override
 protected void attach() {
 // Do the attach magic that I don't care about right now
 super.attach();
 
 // Force the creation of a new Hibernate session using
 Spring
 SessionFactoryUtils.getSession(sessionFactory, true);
 
 // Force the session to be closed only when we tell it to
 // By default, the Hibernate session is closed somewhere
 during
 // the request cycle. Similar to OpenSessionInViewFilter
 SessionFactoryUtils.initDeferredClose(sessionFactory);
 }
 
 
 @Override
 protected void detach() {
 super.detach();
 // Only close the Hibernate Session now, after all
 rendering
 is done
 SessionFactoryUtils.processDeferredClose(sessionFactory);
 }
 
 };
 }
 
 // Other code...
 }
 
 
 
 In com/SECRETAPP/web/BaseTester-context.xml ..
 beans.
 
 context:component-scan base-package=com.SECRETAPP /
 
 bean id=wicketApplication
 class=com.SECRETAPP.web.JUnitAdminApplication/
 
 

 
 /beans
 
 
 In my WicketTestBase abstract class...
 
 public abstract class WicketTestBase {
 
 // Stripped code
 
 protected WicketTester createTester() {
 if(tester != null) {
 return tester;
 }
 WebApplication app = (WebApplication)
 applicationContext.getBean(wicketApplication);
 
 tester = new WicketTester(app) {
 
 @Override
 public ServletContext newServletContext(String path) {
 MockServletContext servletContext = (MockServletContext)
 super.newServletContext(path);
 
 
 servletContext.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE,
 applicationContext);
 return servletContext;
 }
 };
 
 app.addComponentInstantiationListener(new
 SpringComponentInjector(tester.getApplication(), applicationContext,
 true))
 
 // Stripped code
 
 return tester;
 }
 }





--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Quick-fix-for-the-dreaded-org-hibernate-LazyInitializationException-with-WicketTester-tp1864931p4659304.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



Wicket context menu component

2013-06-09 Thread bronius
Hello,

I needed context menu component, but surprisingly it does not exit for
current version, so decided to roll my own, even though i have very little
Wicket experience and know absolutely nothing about jquery, so im like that
dog :) 
http://apache-wicket.1842946.n4.nabble.com/file/n4659306/7TjIrsT.jpg 

Anyway I managed to get something working like this (maybe it will be
helpful for someone or maybe someone smarter will show me my mistakes):
1. Added https://github.com/sebfz1/wicket-jquery-ui dependency.
2. Chosen to use this jquery plugin:
http://medialize.github.io/jQuery-contextMenu/index.html
3. After spending some time I managed to create Behavior like this:

public class ContextMenuBehavior extends JQueryAbstractBehavior {

private static final long serialVersionUID = 1L;

private String selector;

private ListMenuItem menuItems;

public ContextMenuBehavior(String selector, ListMenuItem menuItems) {
super(contextMenu);
this.selector = selector;
this.menuItems = menuItems;

add(new JavaScriptResourceReference(ContextMenuBehavior.class,
jquery.ui.position.js));
add(new JavaScriptResourceReference(ContextMenuBehavior.class,
jquery.contextMenu.js));
add(new CssResourceReference(ContextMenuBehavior.class,
jquery.contextMenu.css));
}

@Override
protected String $() {
// build menu items for jquery
StringBuilder items = new StringBuilder(items: {);
int nbOfMenuItems = menuItems.size();
for (int i = 0; i  nbOfMenuItems; i++) {
MenuItem menuItem = menuItems.get(i);
items.append(').append(menuItem.getId()).append(': {name:
').append(menuItem.getTitle().getObject()).append(', icon:
').append(menuItem.getIcon()).append('});
if (i  nbOfMenuItems - 1) {
items.append(,);
}
}
items.append(});
return String.format($(function(){$.contextMenu({selector: '%s',
callback: function(key, options) {var m = 'clicked: ' + key; window.console
 console.log(m) || alert(m); }, %s});});, selector, items.toString());
}

}

4. $() method just prints jquery context menu initialization stuff from
here: http://medialize.github.io/jQuery-contextMenu/demo.html

5. Now when add this behavior to Page and add div class=userContextMenu to
html right click on it gives me context menu so its working. Clicking on
menu also shows me simple alert message as it is in callback parameter.

6. So far so good, but now Im interested in how to link this to wicket
component listener. I will put this menu on multiple links, so i would like
to receive both on which link user clicked for context menu and which menu
item he have chosen. How would you implement this? Also am I even on the
right track? Is it good approach? Im sorry if this is stupid question :)



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-context-menu-component-tp4659306.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



Apache Wicket + Ace Editor

2013-06-09 Thread Shengche Hsiao
Hello everyone

I want to integrate ace editor into my wicket project, but after gooogled I
failed to do it.
Is anyone give my some advise?



-
We do this not because it is easy. We do this because it is hard.
--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Apache-Wicket-Ace-Editor-tp4659307.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