ListView multiple windows
Hello everyone. Preamble: I want to forbid simultaneous login of the same user from different clients. In particular I must handle opening of new window in the same session (Ctrl+N in IE). To achieve this I override WebPage.onNewBrowserWindow(). Here is the use case that causes a problem. 1. A user successfully logs in with IE. 2. The user presses Ctrl+N 3. Static html-page containing info that my app doesn't support multiple windows gets displayed in a new window. 4. The user clicks on a link that is located within ListView in the initial window and 5. Gets the following exception: 2007-11-16 13:01:40,304 ERROR [wicket.RequestCycle] - java.lang.NullPointerException at wicket.request.compound.DefaultRequestTargetResolverStrategy.resolveListenerInterfaceTarget(DefaultRequestTargetResolverStrategy.java:295) at wicket.request.compound.DefaultRequestTargetResolverStrategy.resolveRenderedPage(DefaultRequestTargetResolverStrategy.java:228) at wicket.request.compound.DefaultRequestTargetResolverStrategy.resolve(DefaultRequestTargetResolverStrategy.java:153) at wicket.request.compound.AbstractCompoundRequestCycleProcessor.resolve(AbstractCompoundRequestCycleProcessor.java:48) at wicket.RequestCycle.step(RequestCycle.java:992) at wicket.RequestCycle.steps(RequestCycle.java:1084) at wicket.RequestCycle.request(RequestCycle.java:454) at wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:219) at javax.servlet.http.HttpServlet.service(HttpServlet.java:707) at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362) at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:712) at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405) at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:211) at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139) at org.mortbay.jetty.Server.handle(Server.java:313) at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:506) at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:830) at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:514) at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211) at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:381) at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:396) at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:442) The problem is that link in ListView may not be resolved. I guess this is because it was in some way "detached" from parent ListView. How to "refresh" that ListView? Or maybe some other ideas? wheleph -- View this message in context: http://www.nabble.com/ListView-multiple-windows-tf4820497.html#a13791076 Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Disabling Palette buttons
I solved the problem by creating custom add and remove buttons. It turned out that the original buttons that are used by Palette are not subclasses of Button but subclasses of WebMarkupContainer and hence they don't properly support disabled state and generating of markup id. I wonder why plain buttons were not used. Now I use the following subclass and it works just fine: [code] private class PupilPalette extends Palette { private static final long serialVersionUID = 6962784629546969362L; private Button addButton; private Button removeButton; public PupilPalette(final String id, final IModel model, final IModel choicesModel, final IChoiceRenderer choiceRenderer, final int rows, final boolean allowOrder) { super(id, model, choicesModel, choiceRenderer, rows, allowOrder); setOutputMarkupId(true); getRecorderComponent().add(new AjaxFormComponentUpdatingBehavior("onchange") { private static final long serialVersionUID = -1322527042794395640L; @Override protected void onUpdate(final AjaxRequestTarget target) { checkButtonsEnabled(); target.addComponent(addButton); target.addComponent(removeButton); } }); checkButtonsEnabled(); } /** * Checks whether the add or remove buttons are enabled. */ private void checkButtonsEnabled() { addButton.setEnabled(availablePupils.size() != selectedPupils.size()); removeButton.setEnabled(!selectedPupils.isEmpty()); } /** [EMAIL PROTECTED] */ @Override protected Component newAvailableHeader(final String componentId) { return new Label(componentId, getString("available.pupils")); } /** [EMAIL PROTECTED] */ @Override protected Component newSelectedHeader(final String componentId) { return new Label(componentId, getString("selected.pupils")); } /** [EMAIL PROTECTED] */ @Override protected Component newAddComponent() { addButton = new Button("addButton", new Model("->")) { private static final long serialVersionUID = 0L; protected void onComponentTag(final ComponentTag tag) { super.onComponentTag(tag); tag.getAttributes().put("onclick", PupilPalette.this.getAddOnClickJS()); } }; addButton.add(new Image("image", new ResourceReference(Palette.class, "add.gif"))); addButton.setOutputMarkupId(true); return addButton; } /** [EMAIL PROTECTED] */ @Override protected Component newRemoveComponent() { removeButton = new Button("removeButton") { private static final long serialVersionUID = 1L; protected void onComponentTag(final ComponentTag tag) { super.onComponentTag(tag); tag.getAttributes().put("onclick", PupilPalette.this.getRemoveOnClickJS()); } }; removeButton.add(new Image("image", new ResourceReference(Palette.class, "remove.gif"))); removeButton.setOutputMarkupId(true); return removeButton; } } [/code] wheleph -- View this message in context: http://www.nabble.com/Disabling-Palette-buttons-tf4732206.html#a13545250 Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Disabling Palette buttons
Hello everyone! I want to disable remove button when the list of selected choices is empty. Below is my sublclass. But when I click on the button browser says that "Component with id [[contentPanel_pupilForm_pupilPalette_addButton]] a was not found while trying to perform markup update. ..." As you see I call setOutputMarkupId(true). What's wrong? [code] private class PupilPalette extends Palette { private Component addButton; private Component removeButton; public PupilPalette(final String id, final IModel model, final IModel choicesModel, final IChoiceRenderer choiceRenderer, final int rows, final boolean allowOrder) { super(id, model, choicesModel, choiceRenderer, rows, allowOrder); setOutputMarkupId(true); getRecorderComponent().add(new AjaxFormComponentUpdatingBehavior("onchange") { @Override protected void onUpdate(final AjaxRequestTarget target) { addButton.setEnabled(availablePupils.size() == selectedPupils.size()); removeButton.setEnabled(selectedPupils.isEmpty()); target.addComponent(addButton); target.addComponent(removeButton); } }); } /** [EMAIL PROTECTED] */ @Override protected Component newAvailableHeader(final String componentId) { return new Label(componentId, getString("available.pupils")); } /** [EMAIL PROTECTED] */ @Override protected Component newSelectedHeader(final String componentId) { return new Label(componentId, getString("selected.pupils")); } /** [EMAIL PROTECTED] */ @Override protected Component newAddComponent() { addButton = super.newAddComponent(); addButton.setOutputMarkupId(true); return addButton; } /** [EMAIL PROTECTED] */ @Override protected Component newRemoveComponent() { removeButton = super.newRemoveComponent(); removeButton.setOutputMarkupId(true); return removeButton; } } [/code] wheleph -- View this message in context: http://www.nabble.com/Disabling-Palette-buttons-tf4732206.html#a13531373 Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: disabling of AjaxSubmitLink
Matej Knopp-2 wrote: > > It is already fixed in 1.3. > > -Matej > Thanks Matej. I explored the source of Wicket 1.3 and picked up the solution from there. wheleph -- View this message in context: http://www.nabble.com/disabling-of-AjaxSubmitLink-tf4712370.html#a13483161 Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
disabling of AjaxSubmitLink
Hello everyone! I use Wicket 1.2.6 and when I try to disable AjaxSubmitLink via link.setEnabled(false) call it really doesn't react on clicks but it still looks like a regular link in browser. I mean that in resulting markup it's represented by <a> element. But similar disabledLink substitutes <a> element with <span> and thus looks like a plain text. Thus the current behavior of disabled AjaxSubmitLink is not consistent with Link's. Shouldn't it be corrected it the futher versions of Wicket? wheleph -- View this message in context: http://www.nabble.com/disabling-of-AjaxSubmitLink-tf4712370.html#a13469788 Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: IE DownloadLink problems
wheleph wrote: > > Content-Disposition attachment; filename=%D0%A1 ... > I wonder what encoding is it? > It's url encoding. I used URLCodec from commons-codec (http://commons.apache.org/codec/) package to encode file name for IE but for FF I still need Base64 or Q-encoding. That's why I need to detect the type of user's browser and send appropriately encoded file name (see the snippet below). I think it would be nice improvement for DownloadLink to perform the encoding of file name internally. [code] WebResponse r = (WebResponse) requestCycle.getResponse(); WebClientInfo clientInfo = (WebClientInfo) requestCycle.getClientInfo(); final String userAgent = clientInfo.getUserAgent(); logger.info("userAgent: " + userAgent); StringEncoder codec = null; if (userAgent.indexOf("MSIE") != -1) { codec = new URLCodec(); } else { codec = new BCodec(); } final String name = ecoFile.getName(); String encodedName = null; try { encodedName = codec.encode(name); } catch (EncoderException e) { encodedName = ecoFile.getName(); final String message = "Error while encoding name " + name + " with codec " + codec; logger.warn(message, e); } r.setAttachmentHeader(encodedName); // copy byte stream from file to response... [/code] wheleph -- View this message in context: http://www.nabble.com/IE-DownloadLink-problems-tf4697141.html#a13462367 Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: IE DownloadLink problems
I Explored :) that IE expects input Content-Disposition attachment; filename=%D0%A1 ... instead of Content-Disposition attachment; filename==?utf-8?Q?=D0=A1 ... I wonder what kind of encoding is it? wheleph -- View this message in context: http://www.nabble.com/IE-DownloadLink-problems-tf4697141.html#a13428214 Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
IE DownloadLink problems
Hello everyone! I've got a problem using DownloadLink. When a name of a file that is referenced by DownloadLink contains non-ASCII characters I get "CAC96UV" instead of "Кириллица.txt" in Internet Explorer download prompt. I encode the name in Q-encoding, and this doesn't help. Firefox displays this name well. Here's the headers the browser receives: DateFri, 26 Oct 2007 12:43:47 GMT Content-Length 1406 content-disposition attachment; filename="=?utf-8?Q?todo.txt?=" Server Jetty(6.1.5) Any ideas? wheleph -- View this message in context: http://www.nabble.com/IE-DownloadLink-problems-tf4697141.html#a1342 Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Intercept AjaxRequestTarget
Hello everyone! My application has a lot of ajax components. And every time validation error occurs I need to add my FeedbackPanel to AjaxRequestTarget. Is there a way to do it automatically? I mean to add my FeedbackPanel to every ajax response wheleph -- View this message in context: http://www.nabble.com/Intercept-AjaxRequestTarget-tf4691130.html#a13407618 Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Changing selection in RadioChoice
Now I decided to use RadioGroup with nested Radios. To each radio I attach AjaxEventBehavior for onclick event and update my model taking into account the index of radio clicked. This workaround perfectly satisfies me. Thanks everybody for help. wheleph -- View this message in context: http://www.nabble.com/Changing-selection-in-RadioChoice-tf4675928.html#a13367355 Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Changing selection in RadioChoice
I'm using Wicket 1.2.6. There's no AjaxFormChoiceComponentUpdatingBehavior wheleph -- View this message in context: http://www.nabble.com/Changing-selection-in-RadioChoice-tf4675928.html#a13359898 Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Two forms on single page
How to submit two forms by clicking on one link? wheleph -- View this message in context: http://www.nabble.com/Two-forms-on-single-page-tf4675929.html#a13359615 Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Changing selection in RadioChoice
Hello everyone! I need to capture changing selection in RadioChoice component. Of course I could override wantOnSelectionChangedNotifications() and onSelectionChanged(java.lang.Object newSelection) methods. But in this case page reloading occurs which is not desired (because other fields get reset). I'd like to use Ajax here but simply adding AjaxFormSubmitBehavior to RadioChoice component doesn't work. Any other ideas? wheleph -- View this message in context: http://www.nabble.com/Changing-selection-in-RadioChoice-tf4675928.html#a13359614 Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: palette problem
Al Maw wrote: > > See http://issues.apache.org/jira/browse/WICKET-459. > > Regards, > > Al > -- > Alastair Maw > Wicket-biased blog at http://herebebeasties.com > Thanks a lot Al and severian. Your suggestions helped me to solve my problem. To summarize: 1. I didn't know that list of available elements must contain also list of selected elements (thanks to severian) 2. I provided instance of IChoiceRenderer created by simple new ChoiceRenderer() call (thanks to Al) wheleph -- View this message in context: http://www.nabble.com/palette-problem-tf4413718.html#a12612598 Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
palette problem
Hello everyone! I've got a problem using component Palette from Wicket-Extensions-1.2.6. The code I use to add Palette on a Form is cited below: --- final Form pupilForm = new PupilForm("pupilForm"); List available = new ArrayList(); available.add("third"); available.add("fourth"); List selected = new ArrayList(); selected.add("first"); selected.add("second"); final Palette pupilPalette = new Palette("pupilPalette", new Model((Serializable) selected), new Model((Serializable)available), new ChoiceRenderer(), 10, false); pupilForm.add(pupilPalette); add(pupilForm); --- Instead of availableselected | third |->| first | | fourth |<-| second | I get ||->| third| ||<-| | I guess this is one of those stupid mistakes you'll never find in your own code. What's wrong with it? wheleph -- View this message in context: http://www.nabble.com/palette-problem-tf4413718.html#a12590320 Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: palette problem
severian wrote: > > The available list should include the full set I think, not just those > that are not currently selected. > > Severian. > > I've tried this. It doesn't help - final Form pupilForm = new PupilForm("pupilForm"); String first = "first"; String second = "second"; List available = new ArrayList(); available.add("third"); available.add("fourth"); available.add(first); available.add(second); List selected = new ArrayList(); selected.add(first); selected.add(second); final Palette pupilPalette = new Palette("pupilPalette", new Model((Serializable) selected), new Model( (Serializable)available), new ChoiceRenderer(), 10, false); pupilForm.add(pupilPalette); add(pupilForm); -- View this message in context: http://www.nabble.com/palette-problem-tf4413718.html#a12590662 Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]