wicket

Dynamic <optgroup> support in wicket

丶灬走出姿态 提交于 2019-12-04 07:35:39
I'm looking to render a <select> tag in my page using wicket, but group the options with <optgroup> , this was discussed on Separator in a Wicket DropDownChoice , but in the solutions there the <optgroup> assume that the <optgroup> tags are static, I'm wanting to pull both the options and the groups from a database. Use two nested repeaters to iterate over your groups and options: <select wicket:id="select"> <optgroup wicket:id="group"> <option wicket:id="option"></option> </optgroup> </select> I have had basically the same problem. After a few days looking for a short solution, I believe what

Wicket Dropdown with Autocomplete and Categories

寵の児 提交于 2019-12-04 05:57:44
问题 I need an autocomplete with a dropdown with results categorised like in HTML select - optgroup with keyboard navigation. I tried to implement a wicket Select component with groups based on this: Separator in a Wicket DropDownChoice with a textfield for search, but can't jump to select with "Arrow down". Any other ideas? 回答1: I think you best option is Select2 (example: https://select2.github.io/examples.html#themes-templating-responsive-design) and its Wicket integration: https://github.com

Wicket: how to handle long running tasks

余生颓废 提交于 2019-12-04 05:44:38
I've setup a Wicket + Hibernate + Spring Web application that involves gathering some data (having some files generated and returned), storing this in a database, creating some images and displaying all this on a webpage. This all works fine for short runs, but sometimes gathering the data (which involves some remote number crunching) takes too long (20+ minutes) and times out. I've tried to resolve this using two approaches, but both of them show some problems. The first approach was using AjaxLazyLoadPanel s and just doing everything within the getLazyLoadComponent. This worked fine for the

Close ModalWindow on keypress

杀马特。学长 韩版系。学妹 提交于 2019-12-04 05:21:14
I would like to be able to close a ModalWindow when the user presses a key, in my case ESC. I have a Javascript listener for the keypress which calls the click event of the cancel button's ID: jQuery("#"+modalWindowInfo.closeButtonId).click(); Is this the correct way to do it? I am wondering because it works in Chrome but not in FF, but it could be due my specific implementation. tetsuo The 'right' way to do it is to call the server, then close it with the response. You can do this with an ajax behavior: ModalTestPage.java public class ModalTestPage extends WebPage { public ModalTestPage

Java/Wicket: Compile Basic Hello World with Resources

谁说我不能喝 提交于 2019-12-04 04:58:34
I am following this example of a Hello World Wicket application https://www.ibm.com/developerworks/web/library/wa-aj-wicket/ In particular I placed HelloWorld.html in my source directory next to HelloWorld.java . My file structure looks like this: $ tree . ├── pom.xml ├── src │ ├── main │ │ ├── java │ │ │ └── com │ │ │ └── example │ │ │ └── wicket │ │ │ ├── HelloWorld.html │ │ │ ├── HelloWorld.java │ │ │ └── HelloWorldApplication.java │ │ ├── resources │ │ └── webapp │ │ └── WEB-INF │ │ └── web.xml │ └── test │ └── java └── wicketTest.iml However when I compile this to a war file, and load in

How do I keep entities (or their associations) attached to the current persistence context across multiple requests (using Wicket & JPA)?

和自甴很熟 提交于 2019-12-04 01:37:12
I am working on a Wicket-based web app on Java EE. I am trying to find a way to ensure that any entities used as model objects are always attached to the current EntityManager before Wicket tries to render any components. This way, when the components grab data from their model, the data can be lazily-loaded by the entity as needed. There are lots of tutorials out there, and some posts on here, referring to LoadableDetachableModels (LDM) as the solution. This has worked for us when we don't need to keep any state in-between requests. In these cases, whenever the page is rendered, the LDM will

Dynamic markup in Wicket

徘徊边缘 提交于 2019-12-03 23:36:06
Is it possible to generate the markup for a MarkupContainer dynamically, i.e. without storing an HTML file for it? I thought about reading the markup as a plain string from the database to offer CMS-like functionality. Interesting question and I'm not sure if it is possible, but my guess would be to start off looking at the IMarkupLoader and IMarkupResourceStreamProvider interfaces and implementing classes and see how far you get from there. I'd be interested in anything you find / implement that actually gets this done! Another (simpler) way to do it would be to use a label with disabled

Three tier layered application using Wicket + Spring + Hibernate. How would you handle transactions?

独自空忆成欢 提交于 2019-12-03 20:19:21
I'm thinking about using the Open Session In View (OSIV) filter or interceptor that comes with Spring, as it seems like a convenient way for me as a developer. If that's what you recommend, do you recommend using a filter or an interceptor and why? I'm also wondering how it will mix with HibernateTemplate and if I will lose the ability to mark methods as @Transactional(readOnly = true) etc and thus lose the ability to get some more fine grained transaction control? Is there some kind of best practice for how to integrate this kind of solution with a three tier architecture using Hibernate and

Injecting dependencies using @Autowired into objects created with “new …”

偶尔善良 提交于 2019-12-03 16:28:58
I have a problem with injecting a bean into a helper class. It works basically like this: I create an object in the page constructor that does some work, returns some data and I show these on the page. In this helper object, a service should be injected via @Autowired annotation. However, I always get a null pointer exception when I use it. I also tried @SpringBean but it didn't help. On the other hand, when I inject this service directly into the page with @SpringBean , it's accessible and works fine. Do you know where the problem is? This is the page: public class Page extends BasePage {

Wicket serving images from File System

佐手、 提交于 2019-12-03 16:28:53
I am pretty new to Wicket and i have some difficulties with using resource references. I am using wicket 1.5.4 and have following problem: I store images on the file system. I have class ImageElement which holds part of the file path relative to configured rootFilePath (i.e dir1/dir2/img1.png). On the page I add Image as follows: new Image("id",ImagesResourceReference.get(), pageParameters) where page parameters includes image path parameter (path="/dir1/dir2/img1.png"). My questions are: Is it the simplest way of serving images from the file system? Is it ok to use ResourceReference with