Re: WiQuery: positioning a dialog when reusing it
I have looked into that issue a bit further. On 17 August 2014 17:23, Mihir Chhaya mihir.chh...@gmail.com wrote: I have used WQuery Dialog for Wicket 1.4 and could make it work in center using setMinimumHeight and setMinimumWidth methods when adding dialog. That's true, but this is part of the problem. Since this only takes effect when adding the dialog, it will not change after the page (and therefore the generated Javascript code containing the settings) has been rendered. Since the dialog is shown using Javascript, Wicket will normally not even know about this. One can probably add some Javascript code to the links that open the dialog, but that does not seem very robust as there does not seem to be any official API for manipulations like this (one would have to read the generated Javascript code and write some stuff that changes the settings). I now ended up with two global dialogs, one for a small dialog that is shown in the center of the page and one for large dialogs that is positioned at the top. Not elegant, but it does the job. I actually doubt that using WiQuery for the dialogs actually leads to any benefit at all. I inherited the code I am working with, and not using Wicket's standard dialog API seems to make code harder to understand, less maintainable why not leading to obvious optimization. Cheers, Martin -- -- mdie...@gmail.com --/-- mar...@the-little-red-haired-girl.org - / http://herbert.the-little-red-haired-girl.org / - - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
WiQuery: positioning a dialog when reusing it
In my application I am using WiQuery's 'Dialog' for a global page dialog that gets constructed in my page base class. Each time I want to show a dialog I embed a different panel in it and then show it. Usually I would like to display smaller dialogs that fit on the screen using WindowPosition.CENTER while for larger (i.e. longer) dialogs WindowPosition.TOP would be more appropriate. Now I see that setting the window position on the already constructed Dialog object does not have any effect, the only way I can actually set the position is by setting the position after construction, i.e. before the dialog gets rendered for the first time. I actually found this by trial-and-error, and the (rather terse) WiQuery documentation does not give me much more of a hint. Thus asking you - is there a way to reposition a reused dialog? If yes, how? It seems so weird I did not find anything on this because this requirement seems fairly typical to me... Cheers, Martin -- -- mdie...@gmail.com --/-- mar...@the-little-red-haired-girl.org - / http://herbert.the-little-red-haired-girl.org / - - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Customizing or replacing MultiFileUploadField
I need to extend an existing component using a MultiFileUploadField in a way that the entries created after having selected files allow the user to add some information related to the individual uploads. The intended end result is somewhat like this: [select-button] Caption: blah blah x File 1[___] enter descriptive text here x File 2[___] enter descriptive text here [upload-and-save-button] As I found out the listing of entries in the above component works solely using Javascript. Now I need to decide what the best option is: (1) Add the missing functionality in Javascript (which looks pretty awkward to me, maybe also because of my poor knowledge of Javascript). (2) Replace MFUF by something that does the same but uses Wicket/Ajax for this. Are there any ready-to-use multiple upload components out there I could use for (2)? If not, any hints how to go about (1)? Cheers, Martin -- -- mdie...@gmail.com --/-- mar...@the-little-red-haired-girl.org - / http://herbert.the-little-red-haired-girl.org / - - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Back button
In my application I have an editor page. Pretty often we run into the problem of users saving their work, then remembering that there was something missing and using their browser's back button to get back into the editor. Since they will be using an old instance of the page with the old object, saving will fail with an optimistic locking exception. I know that this is not a totally wicket-specific problem, but I'd like to ask how to deal with this problem best? Will headers forbidding any kind of caching for those pages help? Any other hints? Cheers, M'bert -- --- / http://herbert.the-little-red-haired-girl.org / - =+= Eine Hund hat Herrchen und Frauchen..., eine Katze hat Personal! - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Strange: Ajax-updates from a form inside a modal dialogue echoed in the page underneath
I've just spent several hours trying to figure out what's going wrong here without any success. I am investigating a very strange effect: In my application I have a search panel in which several dropdowns are used to select search settings. Some of these settings depend on each other, so that they have their change events digested by AjaxFormComponentUpdatingBehavior. Now on a particular page I use a similar form for picking objects using a dialogue in a modal window. For convenience I've extracted the search form to a separate class which is now used in both search panels. Now, when the modal window is opened and the user selects entries from the dropdowns, the ajax updates caused by the above behaviours are echoed to the (still visible) search panel in the underlying page, i.e., selections in its dropdowns change etc. I checked the following things: - there are no hand-assigned markup IDs, i.e. the Ajax updates operate on unique IDs. - when I embed the panel in the page instead of a dialogue, the effect disappears (however this is no option my customer would accept) - using dumb copy-and-paste instead of inheritance for the two search forms does not help, i.e. the effect does not disappear Since the application I'm dealing with is pretty complex, also for confidence reasons, I can't really give any code examples here. I am using Wicket 6.12. Has anyone ever experienced an effect like this? Any workaround known? I feel pretty clueless with this problem.. Cheers, M'bert -- --- / http://herbert.the-little-red-haired-girl.org / - =+= Overflow on /dev/null, please empty the bit bucket. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Visual HTML diff in Wicket?
In my system there is an editorial submodule for creating HTML contents. As I am about to add a versioning history to it, I'd like to add some kind of visualisation of what changed from edit to edit. Does anyone here know of something like a library for this that can be used conveniently in a Wicket-based application? Free would be nice, but commercial (depending on the price, of course) would be an option, too. Cheers, M'bert -- --- / http://herbert.the-little-red-haired-girl.org / - =+= Albert Camus wrote that the only serious question is whether to kill yourself or not. Tom Robbins wrote that the only serious question is whether time has a beginning and an end. Camus clearly got up on the wrong side of bed, and Robbins must have forgotten to set the alarm. -- Tom Robbins - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Strange: Ajax-updates from a form inside a modal dialogue echoed in the page underneath
Martin, thanks a lot for your advice! On Thu, February 06, 2014, Martin Grigorov wrote: Check the Ajax response after selecting a component. It contains ajax-response with component id=... elements. The id attribute is used to find the old HTML element and to replace it with the new content. Since Wicket uses document.getElementByid() to find the old one I see no way how it will replace/update more than one HTML element in the page per component. So I guess there are components for both the elements in the modal and in the page. The best is to debug it and fix it. A workaround is to use a Page for the Modal instead of a Panel. Using the Ajax Debug panel I could track the problem down rather easily. While the actual form components were clean I found out that their surrounding containers, some of which were, too, updated using Ajax were given fixed markup IDs from within the Java code, so that I had two of them with the same IDs. Need to do a 'git blame' on that one :) Cheers, M'bert -- --- / http://herbert.the-little-red-haired-girl.org / - =+= manche meinen, lechts und rinks kann man nicht velwechsern. werch ein illtum! -- elnst jandr - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Running a TestNG test suite from a wicket page
On Mon, December 02, 2013, Paul Bors wrote: Have you considered Mockito to mock your POJOs for the test data and methods? I use that in conjunction with TestNG and then start the wicket app providing it mocked DAOs and POJOs. I've got pretty strong feelings about such frameworks, bluntly speaking, I consider them harmful. They look like a cool thing on first glance, but if you've got complex test cases in your business logic you end up recording complex sequences of mocked service responses and end up with write-only test code. People who use them for their code may have different experience, but since I usually work on large projects in teams of 2-5 people I've far too often had to understand and repair broken tests that were made unnecessarily complex due to the use of Eazymock or Mockito. Just for completeness I'm repeating once again what I already wrote about it a little before in this thread: I really don't like mocking services and DAOs at all, because in complex application this sooner or later leads you to testing against your particular implementation rather than your code's contract. In particular when mocking frameworks are used, this very easily leads to write-only test code. I've seen this on too many occasions and no longer believe that this is a wise approach. Also one needs to consider that many applications are pretty much data-driven (e.g. my system uses a document-based data model with nearly 100 different object variants), and loading and interpreting both schema and data is a crucial piece of the application and needs thorough testing, and you really want to do this on the real thing rather than on mocked services. But actually I wanted to report my progress on this issue here, since this might be of interest for others, too. I succeded with my approach and implemented my first tests yesterday. My setup is like this: 1. For testing, I deploy my test librariees into WEB-INF/lib, so that they can be used within the running webapp. Also I create a JAR file from all my integration tests and deploy it into the same location. 2. I create a wicket page and mount it somewhere (e.g. /test), make sure that it cannot be accessed in production environments :) 3. In that page, I locate the JAR with my tests: | @Nonnull | public static File getJarForClassName( String packageAndClassName ) { | URL url = ReflectionUtil.class.getClassLoader().getResource( packageAndClassName ); | if ( url == null ) { | throw new IllegalStateException( Unable to resolve resource + packageAndClassName ); | } | if ( !jar.equals( url.getProtocol() ) ) { | throw new IllegalStateException( Wrong protocol for + packageAndClassName + : + url.getProtocol() ); | } | String path = url.getPath(); | if ( path == null ) { | throw new IllegalStateException( No path for + packageAndClassName ); | } | int delimPos = path.indexOf( '!' ); | if ( delimPos = 0 ) { | throw new IllegalStateException( Cannot extract JAR path for + packageAndClassName + : + path ); | } | String jarPath = path.substring( file:.length(), delimPos ); | File result = new File( jarPath ); | if ( !result.isFile() ) { | throw new IllegalStateException( Something's wrong, no valid file for + packageAndClassName + : + jarPath ); | } | return result; | } 4. Then I set up TestNG in onConfigure(): | TestNG testNG = new TestNG(); | testNG.setTestJar( jarFile.getAbsolutePath() ); | testNG.setExcludedGroups( EXCLUDED_TEST_GROUPS ); | testNG.setGroups( INCLUDED_TEST_GROUPS ); | testNG.setOutputDirectory( outputDir.getAbsolutePath() ); | @SuppressWarnings( rawtypes ) | ListClass reporterList = Collections.Class singletonList( HTMLReporter.class ); | testNG.setListenerClasses( reporterList ); | int result = 0; | try { | testNG.run(); | result = testNG.getStatus(); | } catch ( TestNGException ex ) { | LOG.error( Exception caught, ex ); | error( ex.getMessage() ); | result = 1; | } 5. If the result is not 0, I throw an IllegalStateException, so that my ANT build fails: | if ( result != 0 ) { | throw new IllegalStateException( tests failed ); | } 6. Since my tests may run for a while i increase the timeout before wicket throws a pagemap-locked exception in the constructor: | if ( !TIMEOUT_FOR_TEST_PAGE.equals( VrmsApplication.get().getRequestCycleSettings().getTimeout() ) ) { | VrmsApplication.get().getRequestCycleSettings().setTimeout( TIMEOUT_FOR_TEST_PAGE ); | } 7. In ANT I create a test target like this: | target name=test-integration depends=check-wget,compile-tests,glassfish-start-if-necessary,glassfish-test-deploy | antcall target=run-test-integration/antcall | /target | | target name=run-test-integration | exec executable=wget failonerror=true | arg line=-O /dev/null --quiet http://localhost:8080/test; / | /exec | /target Now testing the business logic has
Re: Running a TestNG test suite from a wicket page
On Sat, November 30, 2013, Martin Grigorov wrote: Usually when running (WicketTester) tests people provide mock implementations of the external services like MQ, DB, ... It is much easier to return some mock data, either good data or broken, to your application and verify that it behaves correctly in both situations. I really don't like mocking services and DAOs at all, because in complex application this sooner or later leads you to testing against your particular implementation rather than your code's contract. In particular when mocking frameworks are used, this very easily leads to write-only test code. I've seen this on too many occasions and no longer believe that this is a wise approach. Also one needs to consider that many applications are pretty much data-driven (e.g. my system uses a document-based data model with nearly 100 different object variants), and loading and interpreting both schema and data is a crucial piece of the application and needs thorough testing, and you really want to do this on the real thing rather than on mocked services. If I were to start such a project today I'd rely on IOC frameworks like Spring or Guice trying to keep my modules' dependencies under control, so that I can write test data generators for all the scenarios I need to test. However in a legacy project this is not always an option because a pre-spring/guice architecture may lead to practically every module technically depending on the complete business logic, so that one would have to pretty much mock it all which will make the test code even more unmaintainable. In my case I'm fine using anonymized production data based on which I can write tests not relying on particular objects in the database but on classes of data that will be there instead. Now that's *why* I chose that approach. Still, if anybody has any experience with this kind of thing, I'd be happy to benefit from it :) Cheers, M'bert -- --- / http://herbert.the-little-red-haired-girl.org / - =+= Hlade's Law: If you have a difficult task, give it to a lazy person; they will find an easier way to do it. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Running a TestNG test suite from a wicket page
On Sun, December 01, 2013, Martin Grigorov wrote: In this case you may want to use Selenium/WebDriver tests. Or any kind of robot that will execute your test scenarios against a running web application. I am using geb for frontend tests. However frontend tests do not really help when testing complex cases within the business logic. As I wrote, one would normally create a test data generator to fill an in-memory database with stuff that you can rely on when running your tests. However due to the fact that this is a JEE application in which infrastructure like the database message queues etc. are provided by the container (glassfish) I would like to run tests against anonymised productive data. Thus I start the application within its JEE container with a fresh set of test data in the database and then run the test suite by wget-ing a page which runs my TestNG tests which have thus access to all those resources. As mentioned before, I am dealing with pre-spring/guice legacy code here, thus this is simply a pragmatic approach. In an ideal world I would not have to do this :) Cheers, M'bert -- --- / http://herbert.the-little-red-haired-girl.org / - =+= * Free Speech Online!!! Support the Blue Ribbon Campaign! * - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Running a TestNG test suite from a wicket page
As in my project a number of resources are only available within the running web application (e.g. message queues and DB access are provided by the Glassfish application server), I would like to run a TestNG suite from a wicket page, thus allowing me to test pieces of the code that depend on those (and other resources). I've taken a brief look at the TestNG command line interface, and it seems like doing what is being done in TestNG.main should more or less work. Rather ugly, but seemingly without alternative, I need to have TestNG in my webapp's CLASSPATH. The test classes I package into a JAR that I deploy with the webapp when I want to run the tests. Still I need to configure TestNG to load all tests from that JAR specifically, and I haven't yet figured out how to do this. Just thought that I might not be the first trying this, so if there's anyone out there who has some experience with it, I'd greatly appreciate some hint. Cheers, M'bert -- --- / http://herbert.the-little-red-haired-girl.org / - =+= That's right, yelled Vroomfondel, we demand rigidly defined areas of doubt and uncertainty! -- Douglas Adams - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: FileUPloadField alternatives?
On Tue, November 26, 2013, Martin Grigorov wrote: If I understand this correctly I might get away by producing a deployable in which that line is simply commented out (as it is intended for Chrome compatibility only)? Also, in a second No. This line is important to process the Ajax XML response. Yep, at a second glance I realised this :) worthwhile as changing the DOM while a request is still in progress does not look totally harmless to me either? Try it. Tried it, but the crash still occurs. If you have some more ideas, I'd greatly appreciate this. Actually that above hint seemed very likely a solution to me since the problem seems to occur on old hardware rather than on new one. I am currently trying to set up an old laptop with XP/IE8 hoping to be finally able to reproduce that problem. Cheers, M'bert -- --- / http://herbert.the-little-red-haired-girl.org / - =+= Who the fsck is General Failure, and why is he reading my disk? - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: FileUPloadField alternatives?
On Tue, November 26, 2013, Martin Grigorov wrote: If you have some more ideas, I'd greatly appreciate this. Try with MultiFileUploadField - http://www.wicket-library.com/wicket-examples-6.0.x/upload/multi?0 No change, still freezes... M'bert -- --- / http://herbert.the-little-red-haired-girl.org / - =+= Wie verhindert man, dass einem die Geige gestohlen wird? Man legt sie in einen Bratschenkasten... - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
FileUPloadField alternatives?
In my project I am experiencing IE8 crashes at (Ajax-based) file upload. This happens with some particular machines my client uses, and, no, replacing them is (unfortunately) not an option. I am therefore exploring alternatives, hoping that e.g. a flash- or javascript-based upload might not lead to this problem anymore (also, the possibility of uploading more than one file at a time yields some added value). To avoid having to rewrite lots of code, I would ideally like to find something that I can just replace my current FileUploadField/AjaxButton construction with. I took a look at Martin's repo and the file-upload example in it. Is there any way I can have my application notified by an Ajax call after the upload has been finished? Also, are there any other components that I could try? I took a look at wicket-uploadify, but that library is based on wicket 1.5, and apart from that I haven't found anything. Cheers, M'bert -- --- / http://herbert.the-little-red-haired-girl.org / - =+= Yoda of Borg I am. Assimilated you will be. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: FileUPloadField alternatives?
On Mon, November 25, 2013, Martin Grigorov wrote: In my project I am experiencing IE8 crashes at (Ajax-based) file upload. This happens with some particular machines my client uses, and, no, replacing them is (unfortunately) not an option. Can you explain what is the issue ? Maybe Wicket can workaround it ... I'll try to. Since I cannot reproduce the problem myself (on my IE8 the application works just fine), I can hardly describe much more than the symptoms. When uploading a file using an AjaxButton, the browser freezes after the upload has been processed on the server, i.e. the button stays 'pushed', and the browser needs to be closed using the task manager. The action behind my upload button is fully executed, i.e. the upload is being processed successfully, and the components that need Ajax update are added to the onSubmit method's ART. That's the last I see from that browser in the logs. In order to narrow down the problem I've created an upload test page. It contains a simple form with an FileUploadField/AjaxButton in it. Also there is the upload component panel we use in our application (it maintains a list of uploads that are updated via Ajax and shown under the upload button). Last Friday I made the trip to our customer's and took a closer look at one of the machines. All of them are WinXP/IE8 boxes, supposedly with identical configurations, but only some of them exhibit those crashes (but those do this each time we try). When running on Wicket 6.9.12 the browser crashes even with the simplest configuration (FileUploadField/AjaxButton). After downgrading to 6.8.0 (since there once was an issue in the wicket bugtracker), the browser survives that first check, but it crashes when trying out our application's upload component. This leads me to think that there is some Javascript/Ajax stuff involved in this crash. That's about all I know. I may give you access to that test page via email if you like to check yourself. I am not sure whether you will be able to use AjaxRequestTarget though. Because the Ajax call is made by the JS library, not with Wicket.Ajax.** APIs. So it will require some JS coding from you to process ajax-response in the library's onSuccess callback. That's what I feared :) This simply means that I will have to dig deeper into that particular upload library. Since I don't even know whether it will solve my problem I will have to consider... Also, are there any other components that I could try? I took a look at wicket-uploadify, but that library is based on wicket 1.5, and apart from that I haven't found anything. Is it hard to migrate it to 6.x ? It contains some Javascript that will most likely no longer work. Also it is totally undocumented, I don't know how to use it and if it even works. Actually I went into the same question, how can I notify my application so that I can use it the same way I used to use the stock FileUploadField. Cheers, M'bert -- --- / http://herbert.the-little-red-haired-girl.org / - =+= #define S Goodbye!\n main(){exit(printf(S) != strlen(S) ? 0 : 1);} - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: FileUPloadField alternatives?
On Mon, November 25, 2013, Martin Grigorov wrote: I guess that the problem is in https://github.com/apache/wicket/blob/master/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js?source=cc#L856 If I understand this correctly I might get away by producing a deployable in which that line is simply commented out (as it is intended for Chrome compatibility only)? Also, in a second approach, moving that line above the 'form.submit()' seems worthwhile as changing the DOM while a request is still in progress does not look totally harmless to me either? I'll have a go and have my customer try it (unfortunately I don't have physical access to a box that exhibits this problem). Cheers, M'bert -- --- / http://herbert.the-little-red-haired-girl.org / - =+= If you cannot convince them, confuse them. -- Harry S Truman - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Rendering a component into a String
In a legacy project I've inherited I've got a piece of code that no longer works since the project was upgraded from Wicket 1.4 to Wicket 6. It's about rendering a component (a Wicket panel) into a string in order to return it wrapped into a webservice reply. The webservice is based on Wicket, too. The webservice is based on a Javascript handshake - the client calls the service using a token connecting the user to his current session he has on the application, the service replies are rendered into an iframe and deliver their data through postMessage. Thus, when rendering a reply, I am basically rendering a Wicket page within the context of my session. Now one of my API's calls requires me to render a Wicket panel into a String, which is then wrapped into JSON as part of the respective call's reply. The legacy code used to do this roughly like this (changes for using the Wicket 6 API were applied, but this nevertheless never worked): - create a mock RequestCycle by creating a MockHttpSession, a MockHttpServletRequest and a MockHttpServletResponse, glue this all together to obtain a ServletWebRequest and a BufferedWebResponse and finaly use use Application.createRequestCycle() to create the RequestCycle object - the component wrapped into a ComponentRenderingRequestHandler - then this code is executed: |try { |requestCycle.scheduleRequestHandlerAfterCurrent(requestHandler); |try { |if ( !requestCycle.processRequestAndDetach() ) { |requestCycle.scheduleRequestHandlerAfterCurrent(new ErrorCodeRequestHandler((HttpServletResponse.SC_NOT_FOUND)); | } |} finally { |requestCycle.getResponse().close(); |} |return requestCycle.getResponse().toString(); |} finally { |requestCycle.detach(); |} I must admit I could not have written this myself :) Now when running this code, I run into two different exceptions: org.apache.wicket.WicketRuntimeException: Exception in rendering component: [Profile [Component id = profile]] at org.apache.wicket.Component.internalRenderComponent(Component.java:2576) [wicket-core-6.9.1.jar:6.9.1] at org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1493) ~[wicket-core-6.9.1.jar:6.9.1] at org.apache.wicket.Component.internalRender(Component.java:2379) [wicket-core-6.9.1.jar:6.9.1] at org.apache.wicket.Component.render(Component.java:2307) [wicket-core-6.9.1.jar:6.9.1] [...] Caused by: java.lang.NullPointerException: null at org.apache.wicket.markup.html.internal.Enclosure.isVisible(Enclosure.java:143) ~[wicket-core-6.9.1.jar:6.9.1] at org.apache.wicket.Component.determineVisibility(Component.java:4363) [wicket-core-6.9.1.jar:6.9.1] at org.apache.wicket.Component.internalBeforeRender(Component.java:916) [wicket-core-6.9.1.jar:6.9.1] at org.apache.wicket.Component.beforeRender(Component.java:991) [wicket-core-6.9.1.jar:6.9.1] at org.apache.wicket.Component.internalPrepareForRender(Component.java:2214) [wicket-core-6.9.1.jar:6.9.1] at org.apache.wicket.Component.render(Component.java:2303) [wicket-core-6.9.1.jar:6.9.1] at org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1390) ~[wicket-core-6.9.1.jar:6.9.1] at org.apache.wicket.MarkupContainer.renderAll(MarkupContainer.java:1554) ~[wicket-core-6.9.1.jar:6.9.1] at org.apache.wicket.MarkupContainer.renderComponentTagBody(MarkupContainer.java:1529) ~[wicket-core-6.9.1.jar:6.9.1] at org.apache.wicket.MarkupContainer.onComponentTagBody(MarkupContainer.java:1484) ~[wicket-core-6.9.1.jar:6.9.1] at org.apache.wicket.markup.html.panel.DefaultMarkupSourcingStrategy.onComponentTagBody(DefaultMarkupSourcingStrategy.java:71) ~[wicket-core-6.9.1.jar:6.9.1] at org.apache.wicket.Component.internalRenderComponent(Component.java:2549) [wicket-core-6.9.1.jar:6.9.1] The enclosure's child component is null, as we see here: |@Override |public boolean isVisible() |{ |return childComponent.determineVisibility() super.isVisible(); |} Below that exception I find the markup of a stack trace page in my logs. Below that markup I get another stack trace: java.lang.NullPointerException: null at org.apache.wicket.Component.internalPrepareForRender(Component.java:2224) ~[wicket-core-6.9.1.jar:6.9.1] at org.apache.wicket.Page.internalPrepareForRender(Page.java:241) ~[wicket-core-6.9.1.jar:6.9.1] at org.apache.wicket.Component.render(Component.java:2303) ~[wicket-core-6.9.1.jar:6.9.1] at org.apache.wicket.Page.renderPage(Page.java:1010) ~[wicket-core-6.9.1.jar:6.9.1] at org.apache.wicket.request.handler.render.WebPageRenderer.renderPage(WebPageRenderer.java:121) ~[wicket-core-6.9.1.jar:6.9.1] at
Re: Rendering a component into a String
On Wed, November 13, 2013, Martin Grigorov wrote: See the source of http://www.wicket-library.com/wicket-examples-6.0.x/mailtemplate/?2 example In short: instanciate my component, put it into a ComponentRenderer, be happy. That was astonishingly simple :) Cheers, M'bert -- --- / http://herbert.the-little-red-haired-girl.org / - =+= Steht ein Bratscher vor 'ner Kneipe. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Adding Wicket to an existing project with Guice
On a legacy project, there are two web frameworks in use, one for the frontend, one for the backoffice application. This project already uses Guice which is instanciated by a ContextListener which also does some initialisation code, like pulling up some particular Guice beans. Now in this project we want to rewrite one of the two frondends using Wicket. I would like to set up Wicket in a way that it uses the existing Guice infrastructure. The examples and tutorials I've found in the web so far always assume that Guice initialisation (i.e. creation of the injector) goes along with Wicket initialisation which does not seem to fit to what I am doing. Thus I wonder if someone can tell me how I need to configure Wicket to use the existing Guice injector? Any hint appreciated! M'bert -- --- / http://herbert.the-little-red-haired-girl.org / - =+= Perl ist der gegl�ckte Versuch, einen braindump direkt ausf�hrbar zu machen. -- Lutz Donnerhacke in dasr - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Adding Wicket to an existing project with Guice
On Thu, October 10, 2013, Martin Grigorov wrote: You can use org.apache.wicket.guice.GuiceComponentInjector#GuiceComponentInjector(Application app, Injector injector) constructor. I.e. in MyApp#init() do: getComponentInstantiationListeners().add(new GuiceComponentInjector(this, injectorReadFromServletContext)) Thank you, that was fairly easy (I had thought there had to be something as simple as that)! M'bert -- --- / http://herbert.the-little-red-haired-girl.org / - =+= Warum geht ein Bratscher nicht �ber einen Friedhof? Zu viele Kreuze... - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Test based on AbstractWicketTest fails with No RequestCycle is currently set
On Sat, September 07, 2013, Martin Grigorov wrote: com.mycompany.request.WicketContainerChecker.onInstantiation(WicketContainerChecker.java:48) What is this doing ? Does it start a new thread by chance ? Or doing something like: ThreadContext.detach() / ThreadContext.setRequestCycle(null) No, nothing of that kind. It's just a helper to make sure noone uses Ajax on components which are added to the markup as wicket:container wicket:id=../wicket:container The code goes like this: | public class WicketContainerChecker implements IComponentInstantiationListener { | private static final Behavior BEHAVIOR = new Behavior() { | private static final long serialVersionUID = 1L; | | @Override | public void onComponentTag( final Component component, final ComponentTag tag ) { | if ( tag instanceof WicketTag container.equals( tag.getName() ) component.getOutputMarkupId() ) { | throw new IllegalStateException( Component + component + requests a markup id ( + component.getMarkupId() + ) but is attached to + tag | + ! This will not work in deployment mode! ); | } | } | }; | | @Override | public void onInstantiation( Component component ) { | component.add( BEHAVIOR ); | } | } Cheers, M'bert -- --- / http://herbert.the-little-red-haired-girl.org / - =+= WE ARE THE BORG - RESISTANCE IS VOLTAGE DIVIDED BY CURRENT! - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Tests based on WicketTester: NPE in ConcatBundleResource.readAllResources
On Sat, September 07, 2013, Martin Grigorov wrote: Is there a chance that you create a bundle without any resource(reference) ? Not quite sure I understand this correctly, In YourApplication#init() you something like: getResourceBundles().addXyzBundle(Class, String, resourceReferences*). For some reason some of the references cannot load its resource data. OK, I've now isolated any code dealing with resource bundles for JS and CSS in my Application and created a TestApplication class in which this isolated method is overridden as empty, so that resources are not used at all. Now the test no longer fails. If I should need this piece to work with tests in the future, I guess I will have to go through the configuration (file system paths for the stuff loaded in the resources) to get this working? Thank you again! M'bert -- --- / http://herbert.the-little-red-haired-girl.org / - =+= Die groessten Liebesgeschichten sind die, die nie stattgefunden haben - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Test based on AbstractWicketTest fails with No RequestCycle is currently set
On Mon, September 09, 2013, Martin Dietze wrote: No, nothing of that kind. It's just a helper to make sure noone uses Ajax on components which are added to the markup as wicket:container wicket:id=../wicket:container OK, that one is solved, too. After replacing the Application used in this test by the one created to solve the other problem (related to the resources for JS and CSS), this problem disappeared. Obviously the problem I saw in the stack trace was misleading here. Cheers, M'bert -- --- / http://herbert.the-little-red-haired-girl.org / - =+= Ed is the standard text editor. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Tests based on WicketTester: NPE in ConcatBundleResource.readAllResources
I am currently trying to repair some old tests (which I did not even write myself) based on AbstractWicketTest and WicketTester. At the moment all tests derived from AbstractWicketTest or using TestNGWicketTester fail with some exception inside Wicket. Since I am rather unfamiliar with the wicket test infrastructure, I'd like to ask here, if the stuff below rings any bell with anyone of you? This second class of exceptions I get seems to be related to the fact that in our application all CSS and Javascript includes are handled by a ConcatBundeResource. At least that's the one where the test code crashes with an NPE. Again, the test is real simple, it consists of rendering a page and checking for exceptions etc., this is the code: |public void setUp() { |this.tester = new TestNGWicketTester( new MyApplication() ); |} |public void testRender() { |this.tester.startPage( ResetPasswordPage.class ); |this.tester.assertRenderedPage( ResetPasswordPage.class ); |} And the exception I am getting is the following: [testng] Caused by: java.lang.NullPointerException: null [testng] at org.apache.wicket.resource.bundles.ConcatBundleResource.readAllResources(ConcatBundleResource.java:169) ~[wicket-core-6.8.0.jar:6.8.0] [testng] at org.apache.wicket.resource.bundles.ConcatBundleResource.getCacheableResourceStream(ConcatBundleResource.java:226) ~[wicket-core-6.8.0.jar:6.8.0] [testng] at org.apache.wicket.request.resource.caching.version.LastModifiedResourceVersion.getVersion(LastModifiedResourceVersion.java:41) ~[wicket-core-6.8.0.jar:6.8.0] [testng] at org.apache.wicket.request.resource.caching.version.RequestCycleCachedResourceVersion.getVersion(RequestCycleCachedResourceVersion.java:97) ~[wicket-core-6.8.0.jar:6.8.0] [testng] at org.apache.wicket.request.resource.caching.FilenameWithVersionResourceCachingStrategy.decorateUrl(FilenameWithVersionResourceCachingStrategy.java:97) ~[wicket-core-6.8.0.jar:6.8.0] [testng] at org.apache.wicket.core.request.mapper.ResourceMapper.addCachingDecoration(ResourceMapper.java:228) ~[wicket-core-6.8.0.jar:6.8.0] [testng] at org.apache.wicket.core.request.mapper.ResourceMapper.mapHandler(ResourceMapper.java:199) ~[wicket-core-6.8.0.jar:6.8.0] [testng] at org.apache.wicket.request.mapper.CompoundRequestMapper.mapHandler(CompoundRequestMapper.java:215) ~[wicket-request-6.8.0.jar:6.8.0] [testng] at org.apache.wicket.util.tester.BaseWicketTester$TestRequestMapper.mapHandler(BaseWicketTester.java:2742) ~[wicket-core-6.8.0.jar:6.8.0] [testng] at org.apache.wicket.request.cycle.RequestCycle.mapUrlFor(RequestCycle.java:429) [wicket-core-6.8.0.jar:6.8.0] [testng] at org.apache.wicket.request.cycle.RequestCycle.urlFor(RequestCycle.java:529) [wicket-core-6.8.0.jar:6.8.0] The 'offending' code in ConcatResourceBunde looks like this: |private byte[] readAllResources(ListIResourceStream resources) throws IOException, |ResourceStreamNotFoundException |{ |ByteArrayOutputStream output = new ByteArrayOutputStream(); |for (IResourceStream curStream : resources) // This is line 169, where the NPE occurs! |IOUtils.copy(curStream.getInputStream(), output); | |byte[] bytes = output.toByteArray(); | |if (getCompressor() != null) |{ |String nonCompressed = new String(bytes, UTF-8); |bytes = getCompressor().compress(nonCompressed).getBytes(UTF-8); |} | |return bytes; |} Cheers, M'bert -- --- / http://herbert.the-little-red-haired-girl.org / - =+= manche meinen, lechts und rinks kann man nicht velwechsern. werch ein illtum! -- elnst jandr - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Tests based on WicketTester: NPE in ConcatBundleResource.readAllResources
On Fri, September 06, 2013, Martin Grigorov wrote: Is there a chance that you create a bundle without any resource(reference) ? Not quite sure I understand this correctly, I tried avoiding the use of the ConcatBundleResource altogether by overriding the method that creates it in my Application for my test. But this did not make any difference. Cheers, M'bert -- --- / http://herbert.the-little-red-haired-girl.org / - =+= Die Freiheit ist uns ein schoenes Weib. Sie hat einen Ober- und Unterleib. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Test based on AbstractWicketTest fails with No RequestCycle is currently set
On Fri, September 06, 2013, Martin Grigorov wrote: 2. #testAddingAndSwitchingFields you look at the wrong test we cannot help you when we have the wrong source given Yes, sorry, I picked the wrong stacktrace, however they're all identical anyway. The method 'testAddingAndSwitchingFields' starts the same way as 'testRender': |public void testAddingAndSwitchingFields( final int numberOfFields, final ListString switchButtonPaths, final ListString expectedFieldOrder ) { |final FeedbackFormSpec formSpec = FeedbackFormSpecTestFactory.createEmpty(); |this.tester.startPage( new FeedbackFormSpecEditorTestPage( formSpec ) ); |// ... I.e., the stacktrace below is exactly the same from the moment I instanciate the test page, and the super constructor is called. Here's the stacktrace again: org.apache.wicket.WicketRuntimeException: No RequestCycle is currently set! org.apache.wicket.Component.getRequest(Component.java:1803) org.apache.wicket.markup.html.WebPage.dirty(WebPage.java:318) org.apache.wicket.Page.dirty(Page.java:249) org.apache.wicket.Page.componentStateChanging(Page.java:926) org.apache.wicket.Component.addStateChange(Component.java:3527) org.apache.wicket.Behaviors.add(Behaviors.java:55) org.apache.wicket.Component.add(Component.java:4511) com.mycompany.request.WicketContainerChecker.onInstantiation(WicketContainerChecker.java:48) org.apache.wicket.application.ComponentInstantiationListenerCollection$1.notify(ComponentInstantiationListenerCollection.java:38) org.apache.wicket.application.ComponentInstantiationListenerCollection$1.notify(ComponentInstantiationListenerCollection.java:34) org.apache.wicket.util.listener.ListenerCollection.notify(ListenerCollection.java:80) org.apache.wicket.application.ComponentInstantiationListenerCollection.onInstantiation(ComponentInstantiationListenerCollection.java:33) org.apache.wicket.Component.init(Component.java:683) org.apache.wicket.MarkupContainer.init(MarkupContainer.java:121) org.apache.wicket.Page.init(Page.java:168) org.apache.wicket.Page.init(Page.java:132) org.apache.wicket.markup.html.WebPage.init(WebPage.java:76) com.mycompany.ui.components.types.FeedbackFormSpecEditorTestPage.init(FeedbackFormSpecEditorTestPage.java:38) com.mycompany.ui.components.types.FeedbackFormSpecEditorTest.testAddingAndSwitchingFields(FeedbackFormSpecEditorTest.java:80) M'bert -- --- / http://herbert.the-little-red-haired-girl.org / - =+= I am not in a hurry. I prefer to cross the town. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
May Ajax handlers in Wicket 6 slow down rendering?
Since Wicket 6 introduced jQuery as backend for Ajax, there are now rather many jquery-libraries included and there are rather long blocks of Javascript code executed at domready. One of our HTML designers now expressed his concern that on rather complex pages like ours this approach may slow down rendering pages on slow machines (our project is used by people from their workplaces where they - by company policy - have to use old IE browsers on often not exactly fast machines). Since I am not at all an expert in this field, I'm passing on this concern here, maybe any of the gurus around here can comment on this? One of the possible measures our HTMLer mentioned was bundling multiple Javascript-includes to a single one, is this something that can be done for the Javascript library includes added by Wicket? Cheers, M'bert -- --- / http://herbert.the-little-red-haired-girl.org / - =+= It was hard to code, so it should be hard to understand! - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: May Ajax handlers in Wicket 6 slow down rendering?
Than you for your help! On Thu, May 02, 2013, Martin Grigorov wrote: long blocks of Javascript code executed at domready. This depends on how many Ajax components/behaviors you have in your page and how many OnDomReadyHeaderItems are contributed. If you use JavaScript event delegation with Wicket Ajax Behavior that broadcasts events then you can decrease this dramatically. That sounds interesting, but - forgive me my ignorance - this is the first time I hear about this kind of thing. Can you hint me at some example? Cheers, M'bert -- --- / http://herbert.the-little-red-haired-girl.org / - =+= Katz' Law: Man and nations will act rationally when all other possibilities have been exhausted. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
After upgrade to Wicket 6: lots of 'java.io.IOException: Connection reset by peer' in my logs
After upgrading to Wicket 6, I am getting too many of exceptions like the ones below. They 'happen' either when delivering static contents, like Javascript files (via resource references) or even media contents like images or movies which are written into the response. I've appended two stacktraces, one for each of these two categories. The errors don't seem to occur on ordinary Wicket pages. The application is running in a glassfish container. Having searched google I've found a number of issues, but none of them seemed to match exactly. Thus, does the stuff below look familiar to anyone? Maybe there's a known issue that I'm not yet aware of? In any case I badly need some kind of workaround, since we really cannot roll back the system at this time. Cheers, m. == snip, here's a stacktrace for delivering a Javascript resource = ERROR 2013-04-15T10:45:00 [http-thread-pool-443-(31)] my.company.app.ui.pages.error.ErrorPage [-] [/wicket/resource/org.apache.wicket.resource.JQueryResourceReference/jquery/jquery.min-ver-E1288116312E4728F98923C79B034B67.js] An internal server error occured org.apache.wicket.protocol.http.servlet.ResponseIOException: org.apache.catalina.connector.ClientAbortException: java.io.IOException: Connection reset by peer at org.apache.wicket.protocol.http.servlet.ServletWebResponse.flush(ServletWebResponse.java:292) ~[wicket-core-6.6.0.jar:6.6.0] at org.apache.wicket.protocol.http.HeaderBufferingWebResponse.flush(HeaderBufferingWebResponse.java:99) ~[wicket-core-6.6.0.jar:6.6.0] at org.apache.wicket.request.resource.AbstractResource.flushResponseAfterHeaders(AbstractResource.java:676) ~[wicket-core-6.6.0.jar:6.6.0] at org.apache.wicket.request.resource.AbstractResource.setResponseHeaders(AbstractResource.java:662) ~[wicket-core-6.6.0.jar:6.6.0] at org.apache.wicket.request.resource.AbstractResource.respond(AbstractResource.java:513) ~[wicket-core-6.6.0.jar:6.6.0] at org.apache.wicket.request.handler.resource.ResourceRequestHandler.respond(ResourceRequestHandler.java:75) ~[wicket-core-6.6.0.jar:6.6.0] at org.apache.wicket.request.handler.resource.ResourceReferenceRequestHandler.respond(ResourceReferenceRequestHandler.java:108) ~[wicket-core-6.6.0.jar:6.6.0] at org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:840) ~[wicket-core-6.6.0.jar:6.6.0] at org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64) ~[wicket-request-6.6.0.jar:6.6.0] at org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:254) [wicket-core-6.6.0.jar:6.6.0] at org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:211) [wicket-core-6.6.0.jar:6.6.0] at org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:282) [wicket-core-6.6.0.jar:6.6.0] at org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:244) [wicket-core-6.6.0.jar:6.6.0] at org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:188) [wicket-core-6.6.0.jar:6.6.0] at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:267) [wicket-core-6.6.0.jar:6.6.0] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256) [web-core.jar:3.0.1] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:215) [web-core.jar:3.0.1] at my.company.commons.my.MyFilter.doFilter(MyFilter.java:799) [mc-commons-my-1.7.1.jar:$Rev: 17908 $] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256) [web-core.jar:3.0.1] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:215) [web-core.jar:3.0.1] at ch.qos.logback.classic.helpers.MDCInsertingServletFilter.doFilter(MDCInsertingServletFilter.java:51) [logback-classic-0.9.21.jar:na] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256) [web-core.jar:3.0.1] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:215) [web-core.jar:3.0.1] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:277) [web-core.jar:3.0.1] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188) [web-core.jar:3.0.1] at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641) [web-core.jar:3.0.1] at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97) [web-glue.jar:3.0.1] at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85) [web-glue.jar:3.0.1] at
Re: After upgrade to Wicket 6: lots of 'java.io.IOException: Connection reset by peer' in my logs
On Tue, April 16, 2013, Martin Grigorov wrote: Does these errors happen in any browser or only in IE ? I remember such problem in IE - the browser renders the page in modeX and during download of the resources switches to modeY, so it closes the opened connections and downloads the resource again. Either modeX or modeY is QuirksMode. I can't tell exactly. However I know that 70% of our users use IE, thus the probability is rather high. I'm not even sure if users would get to see the error page here, would they? If not, would it not suffice to just suppress redirecting to the error page here? The simple solution/workaround is to add meta http-equiv=X-UA-Compatible content=IE=edge to your pages. I must admit I don't have the guts to do this. We have a rather complex design and had so many compatibility isssues with the different IE versions that I'm pretty sure we would mess up things with this. If you agree that suppressing the redirect here would make sense, any idea where to do this? Cheers, M'bert -- --- / http://herbert.the-little-red-haired-girl.org / - =+= This parrot is no more. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: After upgrade to Wicket 6: lots of 'java.io.IOException: Connection reset by peer' in my logs
On Tue, April 16, 2013, Martin Grigorov wrote: I'm not sure what redirect you mean. I was referring to the fact that the error page was called here: | ERROR 2013-04-15T12:29:35 [http-thread-pool-443-(36)] my.company.app.ui.pages.error.ErrorPage [USER.8619] [/attachment/ARTICLE/540214/5/KN_120831_APP_015.JPG] An internal server error occured | org.apache.wicket.protocol.http.servlet.ResponseIOException: org.apache.catalina.connector.ClientAbortException: java.io.IOException: Broken pipe | at org.apache.wicket.protocol.http.servlet.ServletWebResponse.write(ServletWebResponse.java:126) ~[wicket-core-6.6.0.jar:6.6.0] | [...] If the error is the same as the one I'm talking about then you can safely ignore these errors. Your users do not see any problems at client side. Is there any reliable way to detect these 'ignorable' errors? If yes, I'd like to suppress the calls to ErrorPage here. P.S. Educate your users that they will have better experience by using modern browsers. How I would like to! Unfortunately 90% of my users access the pages from their respective workplaces, and unfortunately IE is still company policy there :( Cheers, M'bert -- --- / http://herbert.the-little-red-haired-girl.org / - =+= Ya dyshu - i znachit, ya lyublyu! Ya lyublyu - i znachit, ya zhivu! -- Vladimir Vysozkij - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Overriding Form.onFileUploadException in nested forms
I am using Wicket 6.6.0, and I'm running into a nasty problem with upload sizes. In a complex editor, there is an upload component which itself contains a Form with an AjaxButton for triggering the upload. If the upload exceeds the allowed max size, the SizeLimitExceededException is caught in the outer form, i.e. the form to which the upload component was added. Thus, I cannot override Form.onFileUploadException in my inner form and thus not implement a custom handling (this is necessary, as in this case I need to explicitly call FeedbackPanel.error on my upload component's FeedbackPanel and add update it via Ajax). Adding custom code to the outer form is not an option as this way I'd have to modify all users of my upload component. Is this a bug or a feature? M'bert -- --- / http://herbert.the-little-red-haired-girl.org / - =+= Wer bist du, ungezaehltes Frauenzimmer? Du bist - bist du? - Die Leute sagen, du waerest - lass sie sagen, sie wissen nicht, wie der Kirchturm steht. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Use Wicket to construct URLs from batch jobs
I recently migrated my legacy project from Wicket 1.4 to 6.6. In this project there is a batch job for sending out newsletters. As you might expect, in those newsletters there are links to contents from the system. In the old system this was done like this (1.4 code): | public CharSequence getApplicationRelativeUrlFor(IBookmarkablePageRequestTarget target) { | if (!MyApplication.exists()) { | final MyApplication application = (MyApplication) MyApplication.get(MyApplication); | MyApplication.set(application); | application.newRequestCycle(null, null); | } | for (final IRequestTargetUrlCodingStrategy strat : getCodingStrategies()) { | if (strat.matches(target)) { | final CharSequence relativeURL = strat.encode(target); | return relativeURL.toString(); | } | } | return null; | } The method 'getCodingStrategies()' returns all coding strategies that were created at startup and subsequently added to a list which is returned here. To me it seems like the above pretty much exploits some implementation details of Wicket 1.4, however my predecessors did not seem to know another way out. This project contains a bit of a content management system, in which for different kinds of contents there are different mount points and often even totally different IRequestTargetUrlCodinStrategy's, thus I don't really see any alternative to asking Wicket which has this information. Now, based on Wicket 6.6.0 the above does no longer work, obviously due to the way the 'Application' object is initialised and then stored. My code looks pretty much like this: | public CharSequence getApplicationRelativeUrlFor( BookmarkablePageRequestHandler handler) { | MyApplication application = WicketUtil.checkMyApplication(); | | try { | IRequestMapper mapper = application.getRootRequestMapper(); | if ( mapper == null ) { | throw new IllegalStateException( Internal error, no root request mapper configured! ); | } | final Url url = mapper.mapHandler( handler ); | return url; | } finally { | WicketUtil.cleanupDummyApplication( application ); | } | } If no application exists, I tried creating a dummy version of it, this is done somewhere inside the 'checkMyApplication()' method, and it boils down to this here: | public static MyApplication createDummyApplicationAndRequestCycle() { | MyApplication application = new MyApplication( true ); | final MockServletContext servletContext = new MockServletContext( application, null ); | application.setServletContext( servletContext ); | WicketFilter wicketFilter = new WicketFilter( application ); | try { | wicketFilter.init( true, new FilterConfig() { | @Override | public ServletContext getServletContext() { | return servletContext; | } | | @Override | public EnumerationString getInitParameterNames() { | return Collections.enumeration( Collections.String emptyList() ); | } | | @Override | public String getInitParameter( final String name ) { | return null; | } | | @Override | public String getFilterName() { | return MyApplication; | } | } ); | } catch ( final ServletException e ) { | throw new IllegalStateException( Exception caught, e ); | } | if ( RequestCycle.get() == null ) { | final ServletContext context = application.getServletContext(); | | final HttpSession newHttpSession = new MockHttpSession( context ); | final MockHttpServletRequest servletRequest = new MockHttpServletRequest( application, newHttpSession, context ) { | | @Override | public String getServletPath() { | return getServletPathOtherCodeReliesOn(); | } | }; | final MockHttpServletResponse servletResponse = new MockHttpServletResponse( servletRequest ); | | servletRequest.initialize(); | servletResponse.initialize(); | | final ServletWebRequest webRequest = new ServletWebRequest( servletRequest, servletRequest.getFilterPrefix() ); | | final WebResponse webResponse = new BufferedWebResponse( new ServletWebResponse( webRequest, servletResponse ) ); | | RequestCycle requestCycle = application.createRequestCycle( webRequest, webResponse ); | ThreadContext.setRequestCycle( requestCycle ); | } | | return application; | } Cleaning up the dummy application looks like this: | public static void cleanupDummyApplication( MyApplication application ) { | if ( !application.isDummy() ) { | return; | } | ThreadContext.setApplication( null ); | } Of course this is very inefficient if I have to do this each time a batch job queries for an URL. When I
Re: Use Wicket to construct URLs from batch jobs
On Thu, April 04, 2013, Martin Grigorov wrote: You can pass the application name (application.getName()) to the manually started threads and later use it to lookup the Application when needed: Application.get(appName). If you can understand Scala then you can use https://github.com/wicketstuff/core/blob/master/jdk-1.6-parent/scala-extensions-parent/wicket-scala/src/main/scala/org/wicketstuff/scala/FutureModel.scala#L53 as inspiration. Thanks, the 'detach()' call was useful. However it seems like I have now found out what my main mistake was. I obviously did not fully understand how Applications are created. When I create my own dummy application, I need to make sure that I choose a name different from what the Wicket filter I have configured in my web.xml uses, as that one will run into an exception when setting the name to a value for which there already is an application. Thus (in rough steps) my code now looks like this: 1. check if an Application is set, if yes, everything's fine 2. if not, check if a dummy Application with a given dummy-application-name exists, if no, create it under that name 3. set the dummy application in the ThreadContext 4. do your work 5. clean up the ThreadContext using 'detach()' This way my code seems to work. Anything else that I misunderstood? Cheers, M'bert -- --- / http://herbert.the-little-red-haired-girl.org / - =+= The only intuitive interface is the nipple. After that, it's all learned. -- Bruce Ediger - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: ./. from UrlRenderer.renderUrl()
On Tue, March 26, 2013, Martin Grigorov wrote: Can you reproduce the problem in a demo application? If YES - please attach it to a ticket in Jira. Thanks! https://issues.apache.org/jira/browse/WICKET-5123 M'bert -- --- / http://herbert.the-little-red-haired-girl.org / - =+= Arthur: It's at times like this I wish I'd listened to my mother Ford : Why, what did she say? Arthur: I don't know, I never listened - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
./. from UrlRenderer.renderUrl()
I found that in some situations, when Component.continueToOriginalDestination is called, the InterceptionData object used there internally points to the home page, i.e., the path element is empty. In that case the RequestCycle's UrlRenderer.renderUrl() produces ./.. This URL seems to cause problems with some browsers, e.g. in the IE I found this leading to 404 pages. I have fixed this by implementing my own UrlRenderer which produces an absolute path here (e.g. with an URL prefix 'http://xxx.yy/foo', an URL './.' would produce '/foo'). Just wondering, is there a problem with the way the default UrlRenderer produces such URLs? Cheers, M'bert -- --- / http://herbert.the-little-red-haired-girl.org / - =+= If life is a stage, I want some better lighting. If little else, the brain is an educational toy. -- Tom Robbins - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: ./. from UrlRenderer.renderUrl()
On Tue, March 26, 2013, Martin Grigorov wrote: Which version of Wicket do you use ? 6.6.0 Can you reproduce the problem in a demo application? If YES - please attach it to a ticket in Jira. Thanks! I'll have a look. Cheers, M'bert -- --- / http://herbert.the-little-red-haired-girl.org / - =+= Woher soll ich wissen, was ich denke, bevor ich hoere, was ich sage? - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Migration issue: update templates in a running system
I recently upgraded a legacy project from Wicket 1.4 to 6.6. In that project we provide a test system to our HTML designers, set up as follows: whenever a change is committed into the git, the test system pulls those changes and copies templates, JS and CSS files into the webapp. It seems like now, after the Wicket upgrade, certain changes in templates (e.g. changes to the markup of fragments) do no longer come through, i.e. it seems necessary to restart the system before the changes take effect. Could it be that this is a problem related to the new way of dealing with markup in Wicket? Or are we simply running into a cache problem here? If this is indeed related to Wicket's markup handling, is there any usable workaround? Restarting the system over and over makes work for our HTMLers rather slow and awkward. Cheers, M'bert -- --- / http://herbert.the-little-red-haired-girl.org / - =+= Man muss das Dreibein hin und wieder loben, dann geht es auch schonmal runter, den Muell wegbringen. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Migration issue: update templates in a running system
On Mon, March 25, 2013, Martin Grigorov wrote: Wicket reloads HTML templates only when running in Development mode. Do you run your app in Dev mode ? Yes, I do. And I did see some changes coming through (like adding a CSS-class to a div etc.), but today I was asked by our HTMLer, and like him I was unable to get the changes into my browsers, though the templates on the development system were the updated ones. I could only get the changes take effect by restarting the application. Cheers, M'bert -- --- / http://herbert.the-little-red-haired-girl.org / - =+= Warum ist ein Bratschensolo wie vorzeitige Ejakulation? Wenn man merkt, dass es kommt, ist es zu sp�t, etwas dagegen zu tun... - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Wicket 6: AjaxFormComponentUpdatingBehavior on dropdown leads to page reload
On Sat, March 09, 2013, Bernard wrote: I would try to debug the constructor of the page and/or override and debug life cycle methods of the page and then work up the call stack why they are executed. Thank you for your reply. Having slept a night over it I found the problem. Like a couple of times before, whenever it comes to request handling in a Wicket 1.5+ system, debugging mapRequest() in CompountRequestMapper is extremely helpful for understanding how your system works :) In my case one from a number of custom page mappers in my system (most of which derive from or wrap a MountedMapper) was the culprit. After doing some magic on the request, in mapRequest() it just returned a RenderPageRequestHandler instead of passing the request on to super.mapRequest(). I actually like the RequestMappers introduced in 1.5, but being so powerful they also exhibit plenty of ways to shoot yourself into the foot and produce rather bizarre effects.. Cheers, M'bert -- --- / http://herbert.the-little-red-haired-girl.org / - =+= In an organization, each person rises to the level of his own incompetency. -- The Peter Principle - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Wicket 6: AjaxFormComponentUpdatingBehavior on dropdown leads to page reload
I've just spent several hours trying to debug a rather strange effect with a dropdown and a AjaxFormComponentUpdatingBehavior. I have a component which is used in several places of the system. It contains a dropdown to which a AjaxFormComponentUpdatingBehavior is added. Whenever the user selects a value, a label is displayed underneath. This component has been in use in different parts of the system for quite some time now. After having upgraded to Wicket 6.6, it does no longer work - on one particular page. While on all other pages it works just fine, on that particular page every time I change something, the page reloads (just as if I had attached an AjaxFormSubmitBehavior (which of course I had not, actually there is not a single one used within the whole project). When doing this reloading, my AjaxFormSubmitBehavior's handler is never invoked. I checked the requests the browser gets to see, and it seems like there isn't any difference. Just in case, here's roughly what I get on the pages where it works: Path: http://localhost:8080/editor/editorial-tools/rundschreiben?7-1.IBehaviorListener.1-page~body-stage-stage_content-wrapped_content-content-editor-form-object_editor-groups-0-group-attributes-7-item-value-choice-ajax~holder-drop~downrubrik=Rundschreiben Method: POST The next request is an icon for the stuff displayed later. On the bad page, the request does not look too much different (it's just a different page): Path: http://localhost:8080/foo/bar/nav/foobar-xxx?14-1.IBehaviorListener.1-page~body-stage-stage_content-wrapped_content-foo~content-choice-ajax~holder-drop~downaction=newvariant=foo-sub-page Method: POST Only after it, I get the original path, but a redirect: : Path: http://localhost:8080/foo/bar/nav/foobar-xxx?action=newvariant=foo-sub-page Method: GET Status Text: 302 (Moved Temporarily) Now this indicates that something's going wrong in the Java code rather than in Javascript. I tried to find the point where the multiplexing is done and from where the Ajax behaviours are invoked, but I did not find it. Now I feel really clueless. Is there a wellknown Gotcha which simply I don't know of? Maybe anybody had the same problem before? Or, at least, where should I step into the Wicket code in order to find out where it goes wrong? Any help appreciated! Cheers, M'bert -- --- / http://herbert.the-little-red-haired-girl.org / - =+= Dann freuen wir uns und gehen weiter und denken noch im Kuessegeben: Wie nah sind uns manche Tote, wie tot sind uns manche, die leben. -- Wolf Biermann - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Timer-based update to various regions in a page - best approach?
My customer wants me to rewrite an existing application in a way, that the various regions (drag-and-droppable panels) are all updated every xy seconds (most of these panels contain things like list views with search results, the user's mailbox etc.). Following a - what I would call - naive approach, one could trigger updates via Ajax every xy seconds for each panel individually. However I see the risk here of creating too many simultaneous network connections. Since I've never build anything like this before, I'd appreciate some opinions / advice, how to approach this problem the Wicket way. Someone mentioned socket.io (which somewhat softens the client side prerequisites of native WebSockets), but is there any wrapper / adapter for Wicket yet? Also I feel a bit uneasy here, as the application already exists, so that the refactoring necessary to get the desired result might grow too high here? Another idea that has crossed my mind was a central Ajax updater, that collects instances of all components needing an update and then triggers a rerender for all of them at the same time. I have not tried this, and I wonder if it is a good idea at all (would it have a negative effect on user experience?). I'd love to read your comments :) M'bert -- --- / http://herbert.the-little-red-haired-girl.org / - =+= This parrot is no more. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Timer-based update to various regions in a page - best approach?
On Thu, March 07, 2013, Martin Grigorov wrote: Or you can use one Ajax timer that broadcasts an event to all components in the page and each component can decide whether to add itself to the target or not. That looks pretty interesting. If I understand you correctly, they would all add themselves to the same target, so that there will be only one update for all components with display-relevant changes? Cheers, M'bert -- --- / http://herbert.the-little-red-haired-girl.org / - =+= Es gibt Themen genug in Deinem eigenen Leben, und wenn sie einmal ausgehn, gibt es Themenlaeden. -- Die Sterne - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Timer-based update to various regions in a page - best approach?
On Thu, March 07, 2013, Sven Meier wrote: Our customer can live with the limitations of this solution: As long as the user doesn't do anything, he won't see any updated data. Unfortunately, ours won't :/ Cheers, M'bert -- --- / http://herbert.the-little-red-haired-girl.org / - =+= Its gone to meet its maker... Its gone to join the choir invisible... This Parrot is an Ex-Parrot! - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Infinite Scrolling in Wicket 6
I will soon have to implement infinite scrolling in my project and would thus like to know if there are already libraries or code snippets for this based on Wicket 6? What I found after a quick search was oegyscroll [1], but this seems to be based on Wicket 1.4.x. But as this feature is becoming increasingly popular, I'm sure that others have already implemented this kind of thing and can give me a recommendation? Cheers, M'bert [1] https://github.com/reaktor/oegyscroll -- --- / http://herbert.the-little-red-haired-girl.org / - =+= Ruft man einen Hund, dann kommt er. Ruft man eine Katze, dann nimmt sie das zur Kenntnis, und kommt gelegentlich darauf zurueck. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Migration issue: JavsScriptUtils.writeJavaScript() in onRender() does not seem to work with Ajax?
OK, I've changed the subject, as it seems like I'm running into a more general issue here. The original issue was JS code rendered into a flyout with search results in my application never made it into the markup the browser actually sees. Now I've identified another problem which seems identical in its cause. I have an editor component using CKEditor. The component derives from Panel. In its onRender() method it has the following code: |@Override |public void onRender() { |super.onRender(); |final Response response = getResponse(); |final String markupId = textField.getMarkupId(); |JavaScriptUtils.writeJavaScript( response, |if (CKEDITOR.instances[' + markupId + ']) CKEDITOR.remove(CKEDITOR.instances[' + markupId + ']); // |var editor_ + markupId + = CKEDITOR.replace(' + markupId + '); // |); |} This renders a little JS code block under the Wicket TextField instance that holds the text for CKEditor. The code works well if the editor component has been in the page from the beginning. However if I make the component visible via Ajax (e.g. after clicking an AjaxLink), the JS code is not rendered at all. I am still in the process of migrating my project from Wicket 1.4.x to 6.6.0. The above code worked flawlessly with 1.4.x. Am I making a mistake, or is this a problem in Wicket? Cheers, M'bert -- --- / http://herbert.the-little-red-haired-girl.org / - =+= Nachts wache ich schwei�gebadet auf, weil OE-begeisterte Newbies mit Bill Gates hinterm Newsserver Schwarze Messen feiern, und auch mein Psychologe ist schon total ratlos. Ich habe einfach fertig. -- anonymer Troll in dsnu - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Migration issue: JavsScriptUtils.writeJavaScript() in onRender() does not seem to work with Ajax?
On Mon, February 25, 2013, Martin Grigorov wrote: Such kind of code should really be executed within #renderHead() with OnDomReadyHeaderItem. Don't let any JS try to use your HTML DOM elements before the DOM is available. Thank you, in this case I get a Wicket Ajax error: | Wicket.Ajax: Wicket.Head.Contributor.processScript: [CKEDITOR.editor.replace] The element with id or name valueb54 was not found.: eval - if (CKEDITOR.instances['valueb54']) | CKEDITOR.remove(CKEDITOR.instances['valueb54']); var editor_valueb54 = CKEDITOR.replace('valueb54'); Another thing: if writing Javascript code into the response should not be done in onRender(), should not JavaScriptUtils.writeJavaScript() be made obsolete? Cheers, M'bert -- --- / http://herbert.the-little-red-haired-girl.org / - =+= Ed, the greatest WYGIWYG editor of all. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Migration issue: JavsScriptUtils.writeJavaScript() in onRender() does not seem to work with Ajax?
On Mon, February 25, 2013, Martin Dietze wrote: Thank you, in this case I get a Wicket Ajax error: | Wicket.Ajax: Wicket.Head.Contributor.processScript: [CKEDITOR.editor.replace] The element with id or name valueb54 was not found.: eval - if (CKEDITOR.instances['valueb54']) | CKEDITOR.remove(CKEDITOR.instances['valueb54']); var editor_valueb54 = CKEDITOR.replace('valueb54'); Sorry, I forgot to mention that of course the element with the id 'valueb54' does exist, it is the edit component which is just made visible through the Ajax call. Obviously the JS code is excecuted before the component has been placed in the DOM? Cheers, M'bert -- --- / http://herbert.the-little-red-haired-girl.org / - =+= Ich trink kein Wasser. Da ficken Fische drin... - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Migration issue: JavsScriptUtils.writeJavaScript() in onRender() does not seem to work with Ajax?
On Mon, February 25, 2013, Martin Grigorov wrote: The Ajax response processing looks like: - execute prependJavaScripts - replace components - execute ondomready scripts - execute appendJavascripts I.e. the component DOM element must be there. Show us your new code. Thanks, it's here: | @Override | public void renderHead( IHeaderResponse response ) { | super.renderHead( response ); | final String markupId = field.getMarkupId(); | String script = if (CKEDITOR.instances[' + markupId + ']) CKEDITOR.remove(CKEDITOR.instances[' + markupId + ']); // | + var editor_ + markupId + = CKEDITOR.replace(' + markupId + ');; | response.render( JavaScriptHeaderItem.forScript( script, null ) ); | } Cheers, M'bert -- --- / http://herbert.the-little-red-haired-girl.org / - =+= Ed, the greatest WYGIWYG editor of all. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Migration issue: JavsScriptUtils.writeJavaScript() in onRender() does not seem to work with Ajax?
On Mon, February 25, 2013, Martin Grigorov wrote: replace with: response.render( OnDomReadyHeaderItem.forScript( script ) ); OK, did that. Now I am running into a different error when I press save on my editor component. For this event I have an AjaxCallListener like this: | AjaxCallListener myAjaxCallListener = new AjaxCallListener(); | myAjaxCallListener.onBeforeSend( return for ( instance in CKEDITOR.instances ) CKEDITOR.instances[instance].updateElement(); ); This is necessary to copy the text the user has entered from the Javascript code back into the form component. On save I now get the following error: | Wicket.Ajax: An error occurred while executing Ajax request:ReferenceError: instance is not defined It looks to me like the script in OnDomReadyHeaderItem was executed allright, but the state inside the Javascript code has been lost in the meantime? Cheers, M'bert -- --- / http://herbert.the-little-red-haired-girl.org / - =+= Arthur: It's at times like this I wish I'd listened to my mother Ford : Why, what did she say? Arthur: I don't know, I never listened - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Migration issue: JavsScriptUtils.writeJavaScript() in onRender() does not seem to work with Ajax?
On Mon, February 25, 2013, Martin Grigorov wrote: | AjaxCallListener myAjaxCallListener = new AjaxCallListener(); | myAjaxCallListener.onBeforeSend( return for ( instance in CKEDITOR.instances ) CKEDITOR.instances[instance].updateElement(); ); except the leading return all looks OK to me. Add some logging with console.log() and see what is available in the context. OK, I got it, thought this would be nice to have in the archives for others. First, the return was of course not from the real code, I did some on-the-fly optimizing of the code to avoid unnecessary complexity in this example before I posted it. The culprit was basically the lack of three letters - var. The variable instance was not declared before use. While this is totally fine when executed in the browser, it throws an exception in the code environment in which Wicket calls this callback. This way the code works: | var instance; for ( instance in CKEDITOR.instances ) CKEDITOR.instances[instance].updateElement(); I had to ask my local JS guru for help, I would never have found this one alone. As I've run across a number of issues migrating from 1.4 to 6.6 now, I would like to suggest creating and continuously extending a Wiki page, like: Old patterns vs. New patterns, where we can just add such things (as: for Ajax, instead of JavaScriptUtils.writeJavaScript() inside onRender() use OnDomReadyHeaderItem.forScript() in renderHead()), so that they can be found more easily? Cheers, M'bert -- --- / http://herbert.the-little-red-haired-girl.org / - =+= Tower: Hoehe und Position? Pilot: Ich bin 1.80m und sitze vorne links. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Migration issue: JavsScriptUtils.writeJavaScript() in onRender() does not seem to work with Ajax?
On Mon, February 25, 2013, Martin Grigorov wrote: Well, I have written a Wiki page and few blog articles about the changes in Wicket 6 but it seems you haven't read them before asking :-) I understand your point well, I myself have often spent lots of time writing documentation which people do not read well enough. Honestly, I read the migration guides. Then I spent quite some days doing the work. Unfortunately there's always a bit going down the drain as the human brain does not always filter things the way we'd like it to :) In my opinion no one should use Component#onRender(). You should really understand how Wicket rendering internals work (MarkupStream, MarkupElement, component resolvers, etc.) to override it. There are hooks in Behavior class for almost everything a user code should ever need - beforeRender, afterRender, renderHead. It's good you point that out. Still I think a 'pattern migration guide' might help, and it should not be done by one person alone but the community (I'll gladly contribute everything I've run across). Thanks again for your help! Cheers, M'bert -- --- / http://herbert.the-little-red-haired-girl.org / - =+= Perl ist der gegl�ckte Versuch, einen braindump direkt ausf�hrbar zu machen. -- Lutz Donnerhacke in dasr - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: JavsScriptUtils.writeJavaScript() in onRender() after Ajax updates
On Fri, February 22, 2013, Sven Meier wrote: Which Wicket version? Is this rendered on an Ajax request? It's Wicket 6.6.0, and, yes, it's rendered on an Ajax request. Cheers, M'bert -- --- / http://herbert.the-little-red-haired-girl.org / - =+= Steht ein Bratscher vor 'ner Kneipe. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Migration issue: fire AjaxFormComponentUpdatingBehavior(change) by Javascript the Wicket 6 way?
I understand that with Wicket 6 the event handlers are no longer inline, thus calling input.onchange() will no longer work. But what do I now do instead? I have hand-written inputs which rely on onchange() being called via Javascript after user interaction. So what do I have to call inside my JS code to have a AjaxFormComponentUpdatingBehavior(change) invoked in my Java code? Cheers, M'bert -- --- / http://herbert.the-little-red-haired-girl.org / - =+= Hier ich bin, steine Dich wie ein Wirbelwind. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Render script tag for jQuery before all other Javscript statements in the header?
On Fri, February 22, 2013, Martin Grigorov wrote: Read http://wicketinaction.com/2012/07/wicket-6-resource-management/ Thanks, did so. I modified my code according to the example found here: http://www.wicket-library.com/wicket-examples-6.0.x/resourceaggregation/wicket/bookmarkable/org.apache.wicket.examples.source.SourcesPage?1SourcesPage_class=org.apache.wicket.examples.resourcedecoration.HomePagesource=HomePage.java My code now runs into an exception at rendering with this message: | Last cause: No FilteringHeaderResponse is present in the request | cycle. This may mean that you have not decorated the header | response with a FilteringHeaderResponse. Simply calling the | FilteringHeaderResponse constructor sets itself on the request | cycle WicketMessage: Exception in rendering component: | [HeaderResponseContainer [Component id = foo]] I could not find a hint on FilteringHeaderResponse and how I need to instanciate it, neither any example code was using it. From debugging my code I see that the exception occurs before my 'renderHead' is called, i.e. obviously instanciating FilteringHeaderResponse should have happened somewhere before. Is there any sample code available where I can see how to do this properly? Cheers, M'bert -- --- / http://herbert.the-little-red-haired-girl.org / - =+= manche meinen, lechts und rinks kann man nicht velwechsern. werch ein illtum! -- elnst jandr - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Render script tag for jQuery before all other Javscript statements in the header?
On Fri, February 22, 2013, Martin Grigorov wrote: At the bottom of the article there is a link to a demo application. See https://github.com/martin-g/blogs/blob/master/wicket6-resource-management/src/main/java/com/wicketinaction/ResourceManagementApplication.java#L100 But much simpler will be to use PriorityHeaderItem as explained in the article. Thank you, I did not expect it to be that simple :) Cheers, M'bert -- --- / http://herbert.the-little-red-haired-girl.org / - =+= Hier ich bin, steine Dich wie ein Wirbelwind. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
JavsScriptUtils.writeJavaScript() in onRender() after Ajax updates
I've implemented a live search functionality where after changes the search results get displayed in a flyout menu. In the search results I add a css class to the search terms for highlighting them. This is done in the onRender() method: | public abstract class LiveSearchResultsFragment extends Fragment { | | // ... | | @Override | public void onRender() { | final Response response = getResponse(); | // generate JS code | JavaScriptUtils.writeJavaScript(response, /* my JS code */); The above class is used to derive Subclasses in different pages where this functionality is needed. In the debugger I can see that the method is called and that the response contains the code I've inserted. However the changes never make it into the markup which is actually rendered. Is this kind of thing no longer supported, or *should* it work? Cheers, M'bert -- --- / http://herbert.the-little-red-haired-girl.org / - =+= WE ARE THE BORG - RESISTANCE IS VOLTAGE DIVIDED BY CURRENT! - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Style question: onInitialize() vs. onBeforeRender()
While porting my project from 1.4.x to 6.6.0, I've stumbled across the onInitialize() method which is now recommended for initializing components which need access to the page instance etc. In my project this had so far been done in onBeforeRender() (and this seems to still work fairly well). Is moving that code to onInitialize() in such cases generally advisable, if yes, should this be done immediately? Cheers, M'bert -- --- / http://herbert.the-little-red-haired-girl.org / - =+= That's right, yelled Vroomfondel, we demand rigidly defined areas of doubt and uncertainty! -- Douglas Adams - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Migration issue: page that writes binary data to the response
On Mon, February 18, 2013, Carl-Eric Menzel wrote: For generating binaries, I would *really* recommend doing this change. Pages simply are not a good fit for that. Also, it shouldn't be that big of a change, since you're writing to the Response anyway. Within AbstractResource's WriteCallback you're going to use the same Response object, so you can simply copy most of your code over without much change. IMO the problem is not that much how the response is generated, but how the component is already uses within the system. At this point creating a download link is simple as it simply is a BookmarkableLink to that page with the appropriate page parameters. Consequently, the download links are bookmarkable. I simply don't know whether any of our users depend on that feature. And, apart from that, porting a productive system from 1.4.x to 6.6.0 I still expect quite a few more issues, thus I'd prefer not to touch code that works. That brings me back to my question to the developers - are the problems I described in my original post 'by design', or would at least moving the adding of markup from the end of Page.onAfterRender() to an overridable method be a realistic option? Cheers, M'bert -- --- / http://herbert.the-little-red-haired-girl.org / - =+= Eine Hund hat Herrchen und Frauchen..., eine Katze hat Personal! - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Migration issue: page that writes binary data to the response
On Tue, February 19, 2013, Martin Grigorov wrote: You can use requestCycle.replaceAllRequestHandlers(new ResourceRequestHandler(new ByteArrayResource(byteArray))) in your page code. This will stop the page rendering and will return the byte[] from this response. You can still configure the ByteArrayResource - filename, disposition, etc. Thank you, I tried this (slightly corrected version): | RequestCycle.get().replaceAllRequestHandlers( new ResourceRequestHandler( new ByteArrayResource( mimeType, byteArray ), null ) ); But this triggers a ReplaceHandlerException at RequestHandlerStack.replaceAll() as at that time RequestHandlerStack.requestHandlers is not empty. This actually looks weird to me as I'd expect a 'replaceAll' method to replace what is already there. Maybe a bug here? Cheers, M'bert -- --- / http://herbert.the-little-red-haired-girl.org / - =+= No violence, gentlemen -- no violence, I beg of you! Consider the furniture! -- Sherlock Holmes - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Migration issue: page that writes binary data to the response
On Tue, February 19, 2013, Martin Grigorov wrote: This is how it works. #replaceAllRequestHandlers() throws an exception to stop doing whatever it does at the moment. #scheduleRequestHandlerAfterCurrent() just appends a new RH to the list and executes it when all previous are executed. Since there is no need to wait for any other scheduled I think you can use #replaceAllRHs(). What is the problem ? Thanks, I misunderstood the concept behind that exception and caught it. Now everything is fine. Cheers, M'bert -- --- / http://herbert.the-little-red-haired-girl.org / - =+= New members urgently required for SUICIDE CLUB, Watford area. -- Monty Python's Big Red Book - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Another Wicket 6 migration issue: drag and drop (so far done with wiquery)
On Fri, February 15, 2013, Emond Papegaaij wrote: DroppableBehavior is the replacement of DroppableAjaxBehavior. You use it like this: final DroppableBehavior droppableBehavior = new DroppableBehavior(); droppableBehavior.setDropEvent( new AjaxDropCallback() { protected void drop(AjaxRequestTarget target, Component source, Component dropped) { // [...] } } ); droppableBehavior.setAccept( new DroppableAccept( .fileItem ) ); droppableBehavior.setHoverClass( dropHover ); add( droppableBehavior ); Thank you very much! I just could not find any example from which to find out how to use it... Cheers, M'bert -- --- / http://herbert.the-little-red-haired-girl.org / - =+= Albert Camus wrote that the only serious question is whether to kill yourself or not. Tom Robbins wrote that the only serious question is whether time has a beginning and an end. Camus clearly got up on the wrong side of bed, and Robbins must have forgotten to set the alarm. -- Tom Robbins - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Migration issue: page that writes binary data to the response
In the project I'm currently porting from 1.4.x to 6.6.0 I've run into an issue with Wicket pages which stream binary data into the WebResponse (e.g. ZIP archives created on the fly). First thing I found was that obviously I *have* to create templates for these pages even though they are not going to be used for anything. The second thing is more serious: when writing to the response I get an IllegalStateException as the template code has already been written to it. This can be circumvented by calling Response.reset() before Response.write() in my code. However in development mode I still get an ISE as in Page.onAfterRender() there's this code here: | if (getApplication().getDebugSettings().isOutputMarkupContainerClassName()) | { | String className = Classes.name(getClass()); | getResponse().write(!-- Page Class ); | getResponse().write(className); | getResponse().write( END --\n); | } } Now of course I can write: | @Override | protected void onAfterRender() { | try { super.onAfterRender(); } catch (IllegalStateException e) { } | } ... but I guess we agree that while this works it is far from nice. I am not sure if I understand correctly what the above code is trying to tell me. Does it mean that I am simply not supposed to deliver my ZIP files by a Wicket page that way? If with today's Wicket version there's a different or even better way to do this, which one would that be? Else, would there be any harm in making the Page class more friendly to this kind of use, by e.g. putting the above if-statement into an overridable method and adding an option to the Component class to tell it that there's no markup for it and it should simply not expect any? Cheers, M'bert -- --- / http://herbert.the-little-red-haired-girl.org / - =+= My Hovercraft is full of eels! - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Migration issue: page that writes binary data to the response
On Mon, February 18, 2013, Carl-Eric Menzel wrote: Is there a particular reason you're using a page? One - unfortunately - big reason: it's legacy code (most of which I did not even write myself). The Wicket upgrade is badly needed for browser compatibiy, however I don't want to change code if it's not absolutely necessary. Cheers, M'bert -- --- / http://herbert.the-little-red-haired-girl.org / - =+= Man moechte ja lieber Auslaender sein als gieriges kleines Inlaenderschwein, doch wo das eine nicht geht, da faengt das andere an, und das Problem ist, dass man wo man ist nichts anderes sein kann... - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: 6.0 Migration issue: wrap Wicket Ajax JS-code as previously with AjaxCallDecorators
On Thu, February 14, 2013, Fred!!! wrote: it's possible to set an throtteling delay by Wicket AjaxRequestAttributes. Have a look at https://cwiki.apache.org/confluence/display/WICKET/Wicket+Ajax#WicketAjax-AjaxRequestAttributes Something like this: new AjaxEventBehavior(onkeydown){ void updateAjaxAttributes(AjaxRequestAttributes attr) { attributes.setThrottlingSettings(new ThrottlingSettings(id, delay)) } } That looks good, thank you! Cheers, M'bert -- --- / http://herbert.the-little-red-haired-girl.org / - =+= Die groessten Liebesgeschichten sind die, die nie stattgefunden haben - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Another Wicket 6 migration issue: drag and drop (so far done with wiquery)
Another thing I am stuck trying to port my project from Wicket 1.4.x to 6.6.0 is DND-mechanics which so far had been implemented using wiquery 1.2. As I see the 'DroppableAjaxBehavior' class has disappeared from wiquery since the 6.0 release. However no mention could be found on either migration pages or mailing lists. So far DND had been implemented like this: | final DroppableAjaxBehavior droppableBehavior = new DroppableAjaxBehaviorItemFoo() { | @Override | public void onDrop( ItemFoo item, AjaxRequestTarget target ) { | // [...] | } | }; | droppableBehaviour.getDroppableBehavior().setAccept( new DroppableAccept( .fileItem ) ); | droppableBehaviour.getDroppableBehavior().setHoverClass( dropHover ); | add( droppableBehaviour ); Now as there's no DroppableAjaxBehavior anymore and no hint on what replaced it I'm lost. I found a DroppableBehavior coming with wiquery 6.2.0, but I can't see how this could be a simple replacement, and to make things worse, there does not seem to be any sample code for 6.2.0-based DND around. Any hints? Cheers, M'bert -- --- / http://herbert.the-little-red-haired-girl.org / - =+= WE ARE THE BORG - RESISTANCE IS VOLTAGE DIVIDED BY CURRENT! - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Migration issue: code using MarkupStream.findCOmponentINdex
On Wed, February 13, 2013, Francois Meillet wrote: private boolean hasFragment(final String id, final Markup markup) { return markup.find(id) != null; } hope this help Thanks a lot! M'bert -- --- / http://herbert.the-little-red-haired-girl.org / - =+= Old programmers don't die; they just branch to a new address. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
6.0 Migration issue: wrap Wicket Ajax JS-code as previously with AjaxCallDecorators
In the project I'm currently migrating from Wicket 1.4 to 6.6 I have a few pieces of code where AjaxCallDecorator instances would wrap the Wicket-genrated JS code as shown in this little example: | return new AjaxCallDecorator() { | | @Override | public CharSequence decorateScript( final CharSequence script ) { | | return var field = findField(); var result = findResult(); // | + if (field.val().length 3) { // | + renderInvisible() // | + } else { // | + $.throttle( getTimeout(), new function() { + script + }); // | + }; | } | }; The problem I'm having here is that `$.throttle()' expects the actual script code as a function, which it then calls according to the set timeout. To me it seems like this is not possible with the APIs provided by Wicket 6.0, since I can add code to be executed before and after the Wicket-generated code respecitvely, but not *around* it. Maybe I haven't fully understood it and there actually is a way to implement similar functionality? I am rather unfamiliar with Javascript in general, maybe there's a better and easier way to port the above code to Wicket 6.0? As always grateful for any hint! M'bert -- --- / http://herbert.the-little-red-haired-girl.org / - =+= Wer bist du, ungezaehltes Frauenzimmer? Du bist - bist du? - Die Leute sagen, du waerest - lass sie sagen, sie wissen nicht, wie der Kirchturm steht. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Migration issue: code using MarkupStream.findCOmponentINdex
I am currently migrating a project based on Wicket 1.4 to 6.60. At some point in that project we have this code: | class Foo extends Panel { | // ... | private boolean hasFragment( final String fragmentId, final MarkupStream markupStream ) { | final boolean found = markupStream.findComponentIndex( null, fragmentId ) = 0; | return found; | } This code is used to find if the markup stream for this component contains the markup for a fragment with the given id. If found, this markup is used for initialising an inner fragment class with this markup. Using a self-defined scheme for defining the Wicket markup ids, this is used for allowing our HTML authors to define specialised views for a group of model objects (e.g. a creature has a generic view while cats and dogs have their own ones). Now the findComponentIndex method has disappeared from MarkupStream. How can I do what I used to do in Wicket 6.60? Cheers, M'bert -- --- / http://herbert.the-little-red-haired-girl.org / - =+= while (!asleep) ++sheep; - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Visibility change via Ajax does not apply in IE9
Not sure if this is a known issue, in a project using wicket-1.4.7 I have a page with an upload field which is triggered by an Ajax button. After upload some information about the upload is supposed to be made visible via Ajax. The component containing the form has outputMarkupId set to true, and it is added to the AjaxRequestTarget after submit. From the logs I can see that in onBeforeRender the ListView which is supposed to appear is updated (its populateItem method is called). Still it does not appear. The same applies to a label I added to the form in which I overrode isVisible depending on the upload state. This component has been working fine for over a year now, but as one of your customers has started using IE9 it turned out that in IE9 this does not work anymore. Is there a known incompatibility, or any other experience I can benefit from? Cheers, M'bert -- --- / http://herbert.the-little-red-haired-girl.org / - =+= Ruft man einen Hund, dann kommt er. Ruft man eine Katze, dann nimmt sie das zur Kenntnis, und kommt gelegentlich darauf zurueck. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Cache key collisions (IMarkupCacheKeyProvider)
On Tue, August 24, 2010, Igor Vaynberg wrote: IMarkupCacheKeyProvider is for advanced users. you have to know what you are doing when you implement the interface. OK, that's fine with me. Why not add a comment to the interface stating just this plus a hint that in general adding the fully qualified class name to the cache key is a good idea? Cheers, M'bert -- --- / http://herbert.the-little-red-haired-girl.org / - =+= Es genuegt nicht, keine Gedanken zu haben, man muss auch unfaehig sein, sie auszudruecken. -- Stanislav Jerzy Lec - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Cache key collisions (IMarkupCacheKeyProvider)
We've recently run into a situation where in an application the wrong markup was provided for a component implementing IMarkupCacheKeyProvider. It is pretty obvious how this happened, see below, but I'd like to ask whether this behaviour is actually what we want or a bug. We have two components, both rendering their cache keys in the same way: | public String getCacheKey( final MarkupContainer container, |final Class? containerClass ) { | return getId(); | } The cache key was implemented in this simplistic way as the component would always render markup of which the only dynamic bit is the ID (an inner component is created with that ID and then added to the component itself which derives from Panel). In their respective pages both components were used in a RepeatingView, thus their IDs were integer numbers as provided by newChildId(). After having successfully loaded the page containing the first of the two components loading the page containing the second component fails. Further analysis revealed the following: In MarkupCache#getMarkup() the respective components are returned as cache key providers; then getMarkupFromCache() is called on the cache key. The getMarkupFromCache() method has an argument `MarkupContainer container', but it is not used in the default implementation. Consequently, the markup cache returns the markup for the wrong component (since both happened to be created with the same IDs). This means that for the worst case one has to take care that the cache keys created in components such as the above need to be collision-free across the whole application. I can only speculate on why the respective component's container is ignored when looking up the markup from the cache. One could argue that this approach is simpler, also one could actually make use of this behaviour by reusing markup across components. The drawback is that this is error-prone (as in this case). Also if I use third-party components implementing IMarkupCacheKeyProvider the way they create their cache keys is beyond my control which makes keeping cache keys collision-free potentially problematic. As an immediate fix I think one should add a warning to the IMarkupCacheKeyProvider's JavaDoc pointing out that no checking of the components' hierarchy is performed, so that cache keys need to be application-wide unique. From my experience adding the fully qualified class name to the cache key is usually a good idea (unfortunately I had considered this unnecessary for such simplistic components)... Apart from that I'd like to ask whether this way of dealing with the markup cache is really what we want? Cheers, M'bert -- --- / http://herbert.the-little-red-haired-girl.org / - =+= Ich trink kein Wasser. Da ficken Fische drin... - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Solved: Track selected entries in either of a Palette's Choices components?
On Fri, December 25, 2009, Martin Dietze wrote: I desperately need to find out which entries in a Palette's two Choices components are selected, e.g. to allow additional operations on them using Ajax. I solved this issue. First of all: currently the AbstractOptions class used by Palette does not support accessing this information via Ajax because of these lines: | // A piece of javascript to avoid serializing the options during AJAX | // serialization. | getResponse().write( | JavascriptUtils.SCRIPT_OPEN_TAG + | if (typeof(Wicket) != \undefined\ typeof(Wicket.Form) != \undefined\) + | Wicket.Form.excludeFromAjaxSerialization. + getMarkupId() + ='true'; + | JavascriptUtils.SCRIPT_CLOSE_TAG); Thus, in order to get this working at all, we'll have to patch Wicket. The patch is very simple, we move this code into a separate method which can be overridden by derived classes. I created an issue for this and attached the patch [1]. Now having applied the patch we proceed as follows. First, we need to derive our own Choices and Selection components in which we override the above code by an empty method, so that we get the selection POSTed at all. Now we can override various methods as needed; in my case implementing a custom convertInput() method was sufficient, so that I could access the currently selected entries in the two SELECTs by calling their getConvertedInput() methods which seemed the least invasive change and least likely to cause any trouble with the Palette's core functionality. Next, I derived my own custom class from Palette in which I needed to override the factory methods for creating the Choices and Selection components. Pretty easy in the end. Cheers, M'bert [1] https://issues.apache.org/jira/secure/ManageAttachments.jspa?id=12444712 -- --- / http://herbert.the-little-red-haired-girl.org / - =+= Perl ist der gegl�ckte Versuch, einen braindump direkt ausf�hrbar zu machen. -- Lutz Donnerhacke in dasr - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Repost: Track selected entries in either of a Palette's Choices components?
I desperately need to find out which entries in a Palette's two Choices components are selected, e.g. to allow additional operations on them using Ajax. As I attached an OnChangeAjaxBehaviour to both of them I expect to be able to access this information just as after a form submit, but of course, the component must support this which it currently does not seem to do. I also subclassed Choices to add some of my own custom stuff, so I could as well set a default model and implement things like updateModel() and convertInput(), but having done so I find myself unable to find out how to set the right stuff in my code, the request parameters do not seem to contain anything usable. Could anybody give me a hint on what I need to do to support tracking the selected entries while still maintaining the Palette component's original functionality? Cheers, M'bert -- --- / http://herbert.the-little-red-haired-girl.org / - =+= i'll beleave this seams to be som curios behaviour. (from a bug tracker) - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Palette: how to track which entries in either choices element are selected?
For some very special usecase I need a Palette which allows me to track via Ajax which entries in either choices element are selected as long as I have not submitted the form. Just to clarify things: 'selected' in this context does not denote the elements in the 'selected' choices element but those options which the user has selected (with the mouse or keyboard). I tried to find out in the debugger how this all works, but it seems like there's quite a bit of Javascript involved. Maybe someone out there has already solved this problem and may help me out with some hint? Cheers, M'bert -- --- / http://herbert.the-little-red-haired-girl.org / - =+= Man moechte ja lieber Auslaender sein als gieriges kleines Inlaenderschwein, doch wo das eine nicht geht, da faengt das andere an, und das Problem ist, dass man wo man ist nichts anderes sein kann... - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Palette: how to track which entries in either choices element are selected?
On Wed, December 23, 2009, nino martinez wael wrote: From a very vague memory, it has a delimited number of choices in a string or something (in java script).. Yes, there's a lot of JS stuff involved. But since the Choices class is a FormComponent, should I not - if I attach an OnChangeAjaxBehaviour to the component - be able to get the selected option(s)? I mean, the OnChangeAjaxBehaviour performs all the actions which would normally be performed at form submit, so in principle I should be able to get access to this information without having to fiddle with Javascript, or am I wrong? I already subclassed Choices to add some of my own custom stuff, so I could as well set a default model and implement things like updateModel() and convertInput(), but having done so I find myself unable to find out how to set the right stuff in my code, the request parameters do not seem to contain anything usable... Cheers, M'bert -- --- / http://herbert.the-little-red-haired-girl.org / - =+= Was ist ein Cluster? Wenn vier Bratscher unisono spielen. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
onSubmit() not entered (IE6 and IE7)
I have repeatedly run into situations like this one: On very complex pages with lots of Ajax-stuff I sometimes get to a point where (reproducably) my form's onSubmit() method is never entered when submitting the form with a simple submit button. This problem occurs in IE6 and IE7. Usually as a workaround I ended up with one of these solutions (putting the one I like better first): (1) attaching the 'onSubmit()' method to the button rather than the form (2) making the button an AjaxButton with default form submit behaviour set to 'true' The first from these solutions does not work in some solutions, so that I have to switch to the second one. In a particular case I had today the submit button which did not work with IE6 and IE7 was supposed to perform an upload. Due to some issues still not resolved in wicket 1.4.3 I am currently unable to use Ajax for uploads in my project. So I ended up with a third workaround: (3) moved the upload stuff to a separate form on the page Solution (3) now works, but it is not nice, since due to the page's layout there's no way to place the upload somewhere where it looks nice. Unfortunately there's no reliable way to produce this kind of problem, at some place you'll 'just have it'. And since it happens in complex pages it is not really possible for me to provide example code here (commercial project, you know the story). Now first of all I would like to hear some comments - anyone else experienced similar problems? Also, as we may (almost) all agree that IE6 (and probably later versions as well) is brain damaged software that should be forbidden, it is still in use and needs to be suported. Thus: is there any chance we can track down problems like this and fix them within wicket? Cheers, M'bert -- --- / http://herbert.the-little-red-haired-girl.org / - =+= Immer Schwierigkeiten immer gerade so zu schaffen, und so macht man sich auf Dauer halt zum Schwierigkeitenaffen, trifft befreundete Primaten in den Kneipen und im Garten, wartend auf die grosse Sause oder einfach nur oder besser noch, die grosse Pause. -- Die Sterne - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: onSubmit() not entered (IE6 and IE7)
On Wed, December 16, 2009, Douglas Ferguson wrote: On Dec 16, 2009, at 7:42 AM, Martin Dietze wrote: I have repeatedly run into situations like this one: On very complex pages with lots of Ajax-stuff I sometimes get to a point where (reproducably) my form's onSubmit() method is never entered when submitting the form with a simple submit button. This problem occurs in IE6 and IE7. [...] Are you using an UploadProgressBar? No, just ordinary UploadField and Button type=submit. Cheers, M'bert -- --- / http://herbert.the-little-red-haired-girl.org / - =+= Interested in sophisticated fun? You, hubby, girl friends. The more the merrier. Get in touch with Kirby, through WASTE only, Box 7391, L.A. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: FileUploadField in a ModalWindow (wicket 1.4.3)?
On Tue, December 01, 2009, TahitianGabriel wrote: It looks like a bug, so maybe you can open a jira... Just added WICKET-2595. This bug may be related to WICKET-2433, but that one was supposed to be fixed in Wicket 1.4.2 while this problem was observed with 1.4.3. Cheers, M'bert -- --- / http://herbert.the-little-red-haired-girl.org / - =+= It was hard to code, so it should be hard to understand! - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
FileUploadField in a ModalWindow (wicket 1.4.3)?
Hi, I recently upgraded to wicket 1.4.3 as I heard that from version 1.4.1 and above file uploads are seamlessly handled even in Ajax based components. I now implemented a ModalWindow-based component with a Form, in it an ordinary FileUploadField and an AjaxButton for submitting the form. I placed ModalWindow in another Form as proposed by the JavaDoc. Now whenever I press the submit button the upload returned by the form is always null. I tried to find examples for ajax-based uploads in wicket 1.4.1 and above, but I could find nothing. Now I wonder, did I misinterpret the announcement of 1.4.1, or are there any known issues? Anything I should read before proceeding? Cheers, M'bert -- --- / http://herbert.the-little-red-haired-girl.org / - =+= Doch sie, die mich am meisten gequ�lt, ge�rgert, betr�bt, Die hat mich nie gehasset, und hat mich nie geliebt. -- H. Heine - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: FileUploadField in a ModalWindow (wicket 1.4.3)?
On Mon, November 30, 2009, Stefan Lindner wrote: And it works fine. With all browsers. Does it work without ModalWindow? I've had no time to check yet. The last thing I did today was try out the ajax upload example from wicketexamples which worked. I'll take a look at the sources tomorrow and probably post again :) Cheers, M'bert -- --- / http://herbert.the-little-red-haired-girl.org / - =+= I now declare this bizarre open! - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Validation: merging wicket and BL validation in Form
Hi, in our project we use a javax.validation implementation for validating our forms. However there are some cases in which we need to consider some information from wicket, like conversion errors etc. Thus merging Wicket's and our own validation results becomes an issue. A reasonable approach seems to be to intercept Wicket's default form processing just after Wicket's validation results have been calculated, add our own validation results and then carry on with default form processing. The only place where we can intercept seems to be Form.process(), but this method is deprecated. The comment advising us to use IFormSubmittingComponent did not help me to understand how to accomplish this without using the deprecated process() method. Now, is there something I missed or would it indeed be a good idea to have a well-defined (and not deprecated) point where we can add our own validation results to wickets' and add diagnosis messages to some form elements before form processing is continued? Cheers, M'bert -- --- / http://herbert.the-little-red-haired-girl.org / - =+= Ich trink kein Wasser. Da ficken Fische drin... - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Update rules in PackageResourceGuard
Hi, I added my own subclass of PackageResourceGuard to my application which provides a configurable interface to the extensions and file names blacklist. After a while I noticed that if I put e.g. 'xml' on my blacklist, the new rule works for all resources which I have not requested before, but already delivered resources are still available. I guess this must be due to some kind of caching? How can I enforce a new rule on resources even if they have been delivered before? Cheers, Martin -- --- / http://herbert.the-little-red-haired-girl.org / - =+= Was ist ein Cluster? Wenn vier Bratscher unisono spielen. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Update rules in PackageResourceGuard
On Thu, May 28, 2009, Igor Vaynberg wrote: can I enforce a new rule on resources even if they have been delivered before? clear your browser cache. Hmm, that was my first guess, I even accessed the page using a different browser. Cheers, Martin -- --- / http://herbert.the-little-red-haired-girl.org / - =+= Tower: Hoehe und Position? Pilot: Ich bin 1.80m und sitze vorne links. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: File retrieval vulnerabilities, bugs #1992, #1996
On Thu, May 21, 2009, Igor Vaynberg wrote: we should backport 1992, please open a jira issue to do that. I've already done this. I am currently investigating how I can block particular file types (the hint you gave in your second reply may be helpful here). Once I am confident that my backport works I may post my patch here or append it to the jira issue. Cheers, Martin -- --- / http://herbert.the-little-red-haired-girl.org / - =+= That's right, yelled Vroomfondel, we demand rigidly defined areas of doubt and uncertainty! -- Douglas Adams - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: File retrieval vulnerabilities, bugs #1992, #1996
On Thu, May 21, 2009, Igor Vaynberg wrote: we should backport 1992, please open a jira issue to do that. I just appended my backport to #1992, see [1]. I hope that's OK, I can still open a new jira if this is the preferred way to do this. Cheers, Martin [1] https://issues.apache.org/jira/browse/WICKET-1992 -- --- / http://herbert.the-little-red-haired-girl.org / - =+= Was ist ein Cluster? Wenn vier Bratscher unisono spielen. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Building 1.3.6 from the source, test failures
On Mon, May 18, 2009, Martijn Dashorst wrote: [quote order fixed] On Mon, May 18, 2009 at 4:49 PM, Martin Dietze d...@fh-wedel.de wrote: �I just checked out wicket 1.3.6 from the svn, changed into the wicket-1.3.6 directory, ran `mvn package' and ran across these Don't run the tests with java 6 Thank you, the tests now do no longer fail. Just out of curiousity, wasn't Java 6 supposed to be downward compatible? I find this extremly confusing... Cheers, Martin -- --- / http://herbert.the-little-red-haired-girl.org / - =+= * Free Speech Online!!! Support the Blue Ribbon Campaign! * - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Building 1.3.6 from the source, test failures
On Tue, May 19, 2009, Martijn Dashorst wrote: http://lmgtfy.com/?q=wicket+java+6+fails+unit+tests gives you: https://issues.apache.org/jira/browse/WICKET-708 And in comment [1] Juergen says: This is due to java 1.6. The hashmap hash code implementation has changed which leads to a different internal sequence of values within the map. Since tag attributes are based on hashmap ... Oh, that explains it, thanks. Leaves the question whether it is such a good idea to depend on the order of hash map entries in the tests while of cause well knowing that it's probably not too easy to come up with a good alternative approach :) Cheers, Martin -- --- / http://herbert.the-little-red-haired-girl.org / - =+= This parrot is no more. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
File retrieval vulnerabilities, bugs #1992, #1996
Hi, I just ported the patch fixing #1992 and #1996 back to Wicket 1.3.6. Unfortunately there is still a different issue which may or may not be related to these two. If, for instance, you open the hello world example app and append the string resources/org.apache.wicket.AbortException/Application_ru.xml to the URL, you will get the .xml file from the wicket jar file. This problem has obviously not been fixed by the above patch, I can still reproduce it if I build wicket 1.4 from the SVN and load the examples war file. Is there a bug filed for this problem (I find it difficult to construct the right search term for this)? Or, even better, is there already a patch for it available? Also, as the patch for #1992/#1996 has not yet been integrated into wicket 1.3.x, is there any interest in the backport or is it not needed / does it not make sense in wicket 1.3? Cheers, Martin -- --- / http://herbert.the-little-red-haired-girl.org / - =+= Ed, the greatest WYGIWYG editor of all. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Building 1.3.6 from the source, test failures
Hi, I just checked out wicket 1.3.6 from the svn, changed into the wicket-1.3.6 directory, ran `mvn package' and ran across these test failures: Failed tests: test_1(org.apache.wicket.markup.html.header.testing.HeaderTest) testRenderHomePage_7(org.apache.wicket.markup.html.basic.SimplePageTest) testHeaderContribution1(org.apache.wicket.ajax.AjaxRequestTargetTest) testHeaderContribution3(org.apache.wicket.ajax.AjaxRequestTargetTest) test_2(org.apache.wicket.markup.html.header.inheritance.InheritanceHeadTest) testDomReadyOrder(org.apache.wicket.ajax.DomReadyOrderTest) testDetachPageAjaxRequest(org.apache.wicket.ComponentTest) This is the test log for the first test: --- Test set: org.apache.wicket.markup.html.header.testing.HeaderTest --- Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.101 sec FAILURE! test_1(org.apache.wicket.markup.html.header.testing.HeaderTest) Time elapsed: 0.022 sec FAILURE! junit.framework.ComparisonFailure: org/apache/wicket/markup/html/header/testing/TestPage_ExpectedResult.html expected:...languange=javascript id=org-apache-wicket-mark up-html-header-testing-TestExtendedPanel-0... but was:...id=org-apache-wicket-markup-html-header-testing-TestExtendedPanel-0 languange=javascript... at junit.framework.Assert.assertEquals(Assert.java:81) at org.apache.wicket.util.diff.DiffUtil.validatePage(DiffUtil.java:156) at org.apache.wicket.util.tester.WicketTester.assertResultPage(WicketTester.java:542) at org.apache.wicket.WicketTestCase.executeTest(WicketTestCase.java:84) at org.apache.wicket.markup.html.header.testing.HeaderTest.test_1(HeaderTest.java:43) $ java -version java version 1.6.0_07 Java(TM) SE Runtime Environment (build 1.6.0_07-b06) Java HotSpot(TM) Server VM (build 10.0-b23, mixed mode) I have seen older references to this problem in the web, but (a) no clear solution and (b) wonder why the problem is (still?) there? Any hint? Martin -- --- / http://herbert.the-little-red-haired-girl.org / - =+= In my glass coffin I am waiting - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Interfaces for component hierarchies (e.g. Buttons)?
On Tue, October 07, 2008, Jeremy Thomerson wrote: Maybe supply some code as an example of what you're doing. I really didn't understand your scenario below. See the code below. I use a button panel which allows me to setup form buttons in different ways within a page class hierarchy, i.e. an edit page inherits from a create page but has a button more. Now I want to be able to add ajax buttons to the button panel. public class MyButton extends Button { private final String buttonType; public static enum ButtonType { BUTTON(button), SUBMIT(submit), RESET(reset); private final String buttonType; private ButtonType(String buttonType) { this.buttonType = buttonType; } public String getButtonType() { return this.buttonType; } } public MyButton(String id, IModel model, ButtonType buttonType) { super(id, model); this.buttonType = buttonType.getButtonType(); } public String getButtonType() { return this.buttonType; } } public class ButtonPanel extends Panel implements IMarkupResourceStreamProvider { private static final String CSS_CLASS = buttonPanel; private final String cssClass; private ListButtonWithType buttons; public ButtonPanel(String id, ListButtonWithType buttons, String cssClass) { super(id); this.buttons = buttons; this.cssClass = cssClass; if (buttons != null buttons.size() 0) { for (ButtonWithType b : buttons) { add(b); } } } @Override public IResourceStream getMarkupResourceStream(MarkupContainer container, Class containerClass) { StringBuilder result = new StringBuilder(); result.append( div class=\ + this.cssClass + \\n); int i = 0; for (ButtonWithType b : this.buttons) { result.append(div class=\ + this.cssClass + (i == 0 ? button leftButton : button) + \\n); result.append( input wicket:id=\ + b.getId() + \\n); result.append( type=\ + b.getButtonType() + \ class=\ + this.cssClass + \ /\n); result.append(/div\n); ++i; } result.append( /div\n); return new StringResourceStream(wicket:panel\n + result.toString(); + /wicket:panel\n); } } Martin -- --- / http://herbert.the-little-red-haired-girl.org / - =+= Wer bist du, ungezaehltes Frauenzimmer? Du bist - bist du? - Die Leute sagen, du waerest - lass sie sagen, sie wissen nicht, wie der Kirchturm steht. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Interfaces for component hierarchies (e.g. Buttons)?
Hi, I am currently running into the following: I extend the button class by a snappy foo-feature. I build stuff which uses it. Now I need a foo-ified AjaxButton within this infrastructure. The obvious way to do this is to write an interface FooButton which gives me this foo-feature. However FooButton is by itself not a Button, nor can I make it one since the Button class is an abstract class, not an interface. Just wondering, whould it be a good idea to add such interfaces to the Wicket-API? Or am I missing something? Cheers, Martin -- --- / http://herbert.the-little-red-haired-girl.org / - =+= Was ist der Unterschied zwischen einer Bratsche und einer Waschmaschine? Die Waschmaschine vibriert, kommt erst am Ende ins Schleudern, und was rauskommt, ist sauber. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Addition [Re: Interfaces for component hierarchies (e.g. Buttons)?]
On Tue, October 07, 2008, Martin Dietze wrote: Just wondering, whould it be a good idea to add such interfaces to the Wicket-API? Or am I missing something? commenting on my comments: (1) This would of course mean to interface-ify basically the whole component type hierarchy, since in order to addOrReplace such a beast it has to be an instance of a Component. (2) Yes, I have heard of instanceof and type casts, but do we really want to have to use them? I don't. Cheers, Martin -- --- / http://herbert.the-little-red-haired-girl.org / - =+= I am not in a hurry. I prefer to cross the town. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Interfaces for component hierarchies (e.g. Buttons)?
On Tue, October 07, 2008, Jeremy Thomerson wrote: Depending on what you are doing, you may want to try implementing the foo feature code as a behavior. Behaviors are like plugins for components, and can be used on any component. So, if it is possible to implement your functionality as a behavior, then you could add it to the button or ajax button, or a link, etc. I don't think this would help in my particular case. I extended the Button class by additional properties which I render into the markup in another component which implements IMarkupResourceStreamProvider. Thus the additional property needs to be visible from the outside. Cheers, Martin -- --- / http://herbert.the-little-red-haired-girl.org / - =+= Tower: Hoehe und Position? Pilot: Ich bin 1.80m und sitze vorne links. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RadioGroup to select DataTable rows, any example?
Hello, I am still fairly new to Wicket and currently trying to create a table with a still unknown number of entries from which one row can be selected. I created a table using the DefaultDataTable class, was able to fill it using PropertyColumn for data columns and AbstractColum for links (e.g. to entry-specific edit or view pages) and the table looks fine. However I am still unable to add radio box inputs to one of the table's columns. I read the wiki article in [1] and two older threads in this list which seemed to help the original posters, but as it seems my understanding of Wicket's concepts is still too limited for this to help me, so that I would like to ask if anyone has a working code example (Java code and HTML snippet) and would be so kind to post it here? Cheers, Martin [1] http://cwiki.apache.org/WICKET/using-radiogroups.html -- --- / http://herbert.the-little-red-haired-girl.org / - =+= Steht ein Bratscher vor 'ner Kneipe. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]