Re: Issues with HeaderResponseContainerFilteringHeaderResponse
Ah, sweet. Thanks for digging that up Jeremy. Alec, since we were pressed for time, I piggybacked off your code to get something working @Override protected void init() { super.init(); /* * Adds custom skin at the end of the header */ setHeaderResponseDecorator(new IHeaderResponseDecorator() { public IHeaderResponse decorate(IHeaderResponse response) { return new DecoratingHeaderResponse(response) { @Override public void close() { String css = null; if(MyWebSession.get() != null) css = MyWebSession.get().getCssStyle(); if(css != null !wasRendered(css)) { renderString(style + css + /style); } super.close(); } }; } }); } I chose not to override renderString(), because I didn't want to break anything that might use it. Also, we don't know what css we want to add when the application gets initialized; we have to wait till the user has authenticated. So, I stuck our css in the session after authentication and had the decorator pull it from there. When we get a chance I will swap this out for the bucket method for it's added flexibility, but this does work for now. Thanks again guys, Loren On Wed, Aug 3, 2011 at 9:58 PM, Jeremy Thomerson jer...@wickettraining.comwrote: That thread is here: http://tinyurl.com/3fnery2 In it there's a link to a tar of a project that's still hosted on my site. -- Jeremy Thomerson http://wickettraining.com *Need a CMS for Wicket? Use Brix! http://brixcms.org* On Wed, Aug 3, 2011 at 1:21 PM, Martin Grigorov mgrigo...@apache.org wrote: Hi Loren, See whether you can find the mail mentioned in https://cwiki.apache.org/confluence/display/WICKET/Resource+decoration in the mail archives. Jeremy attached the raw application in this mail thread and I transformed it to proper wicket-example for 1.5 On Wed, Aug 3, 2011 at 6:36 PM, Loren Cole loren.c...@gmail.com wrote: Hey guys, thanks for your responses. We're still using 1.4, it looks like it will be a few months till we get to upgrade and use all the improvements that have been made to resource handling in 1.5. In 1.4 it appears that you cannot put a bucket in the header without things getting confused and failing to close. Does anyone know why this is the case, or if there is a way around it while still getting things in a head tag? Martin, since we're using an older version I'm having trouble taking advantage of your excellent advise, but I see elsewhere on the list, you mention that this aggregation example should work in 1.4 also. Do you perhaps have an example of that I could look at? The 1.4 equivalent of MergedResourcesResource in particular is eluding me. Am I right in thinking that aggregation will be required to order my css contributions in 1.4? At this point in development, the performance boost doesn't necessarily offset the extra trouble of tracking down what stylesheet or js library a problem is in, so I'd rather avoid it if possible. Thanks, Loren -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Issues with HeaderResponseContainerFilteringHeaderResponse
Hey guys, thanks for your responses. We're still using 1.4, it looks like it will be a few months till we get to upgrade and use all the improvements that have been made to resource handling in 1.5. In 1.4 it appears that you cannot put a bucket in the header without things getting confused and failing to close. Does anyone know why this is the case, or if there is a way around it while still getting things in a head tag? Martin, since we're using an older version I'm having trouble taking advantage of your excellent advise, but I see elsewhere on the list, you mention that this aggregation example should work in 1.4 also. Do you perhaps have an example of that I could look at? The 1.4 equivalent of MergedResourcesResource in particular is eluding me. Am I right in thinking that aggregation will be required to order my css contributions in 1.4? At this point in development, the performance boost doesn't necessarily offset the extra trouble of tracking down what stylesheet or js library a problem is in, so I'd rather avoid it if possible. Thanks, Loren
Re: Issues with HeaderResponseContainerFilteringHeaderResponse
Under normal circumstances I would, but I don't have my css in a file. It gets pulled from a database and stashed in the session. All the header contributer classes and resource references assume there's a file somewhere with this info. But in my case there is not. And, even id I did stuff this data into a file it still wouldn't fix my problem, because the customer defined css needs to override everything else with the same css selector. If another component added a header contributor afterwards that would not be the case. - Loren On Tue, Jul 19, 2011 at 11:35 PM, Jeremy Thomerson jer...@wickettraining.com wrote: To start, don't use a Label to contribute css. Use a header contributor. That's what they're made for. On 2011 7 19 13:22, Loren Cole loren.c...@gmail.com wrote: We're making our application skinable, but I'm having some trouble getting user specified css into the right place in the header. We're working in a distributed environment, so instead of saving their css in the file system we're putting it in our database, and in order to get the cascade to work properly we need to add this css after all the others. Here's how I'm adding it: StandardPage.java onInitialize() //Add any override style Tenant tenant = MyWebSession.get().getTenant(); Css css = cssRepository.GetStyleByTenant(tenant); if(tenant.getBranding() css != null) { add(new Label(style, css.getStyle())); } } StandardPage.html wicket:head style type=text/css wicket:id=style/style /wicket:head - So the issue is that thet style tag comes before all my header contributions. I've tried specifying a header response decorator like so: Application.java public static final String HEADER_FILTER_NAME = myHeaderBucket; init() { super.init(); setHeaderResponseDecorator(new IHeaderResponseDecorator() { HeaderResponseContainerFilteringHeaderResponse.IHeaderResponseFilter[] filters = {new CssAcceptingHeaderResponseFilter(HEADER_FILTER_NAME)}; @Override public IHeaderResponse decorate(IHeaderResponse response) { return new HeaderResponseContainerFilteringHeaderResponse(response, HEADER_FILTER_NAME, filters); } }); } StandardPage.html wicket:head div wicket:id=myHeaderBucket/div style type=text/css wicket:id=style/style /wicket:head -- Unfortunately I'm getting this exception when I instantiate a page: 12:28:04,097 INFO [STDOUT] 2011-07-19 12:28:04.096 [http-127.0.0.1-8080-1] [127.0.0.1] [T:2] [U:3 - joe_sharp] [com.transverse.bleep.wicket.desktop.DesktopPage] ERROR org.apache.wicket.RequestCycle 1529 - Exception in rendering component: [MarkupContainer [Component id = headerBucket]] org.apache.wicket.WicketRuntimeException: Exception in rendering component: [MarkupContainer [Component id = headerBucket]] at org.apache.wicket.Component.renderComponent(Component.java:2729) ~[wicket-1.4.17.jar:1.4.17] at org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1539) ~[wicket-1.4.17.jar:1.4.17] at org.apache.wicket.Component.render(Component.java:2521) ~[wicket-1.4.17.jar:1.4.17] ... Caused by: java.lang.RuntimeException: there was an error processing the header response - you tried to render a bucket of response from HeaderResponseContainerFilteringHeaderResponse, but it had not yet run and been closed. this should occur when the header container that is standard in wicket renders, so perhaps you have done something to keep that from rendering? at org.apache.wicket.resource.filtering.HeaderResponseFilteredResponseContainer.onComponentTagBody(HeaderResponseFilteredResponseContainer.java:67) ~[wicket-1.4.17.jar:1.4.17] at org.apache.wicket.Component.renderComponent(Component.java:2690) ~[wicket-1.4.17.jar:1.4.17] ... 81 common frames omitted Any ideas on what I'm doing wrong? Is there an easier approach I can take? Thanks, Loren
Issues with HeaderResponseContainerFilteringHeaderResponse
We're making our application skinable, but I'm having some trouble getting user specified css into the right place in the header. We're working in a distributed environment, so instead of saving their css in the file system we're putting it in our database, and in order to get the cascade to work properly we need to add this css after all the others. Here's how I'm adding it: StandardPage.java onInitialize() //Add any override style Tenant tenant = MyWebSession.get().getTenant(); Css css = cssRepository.GetStyleByTenant(tenant); if(tenant.getBranding() css != null) { add(new Label(style, css.getStyle())); } } StandardPage.html wicket:head style type=text/css wicket:id=style/style /wicket:head - So the issue is that thet style tag comes before all my header contributions. I've tried specifying a header response decorator like so: Application.java public static final String HEADER_FILTER_NAME = myHeaderBucket; init() { super.init(); setHeaderResponseDecorator(new IHeaderResponseDecorator() { HeaderResponseContainerFilteringHeaderResponse.IHeaderResponseFilter[] filters = {new CssAcceptingHeaderResponseFilter(HEADER_FILTER_NAME)}; @Override public IHeaderResponse decorate(IHeaderResponse response) { return new HeaderResponseContainerFilteringHeaderResponse(response, HEADER_FILTER_NAME, filters); } }); } StandardPage.html wicket:head div wicket:id=myHeaderBucket/div style type=text/css wicket:id=style/style /wicket:head -- Unfortunately I'm getting this exception when I instantiate a page: 12:28:04,097 INFO [STDOUT] 2011-07-19 12:28:04.096 [http-127.0.0.1-8080-1] [127.0.0.1] [T:2] [U:3 - joe_sharp] [com.transverse.bleep.wicket.desktop.DesktopPage] ERROR org.apache.wicket.RequestCycle 1529 - Exception in rendering component: [MarkupContainer [Component id = headerBucket]] org.apache.wicket.WicketRuntimeException: Exception in rendering component: [MarkupContainer [Component id = headerBucket]] at org.apache.wicket.Component.renderComponent(Component.java:2729) ~[wicket-1.4.17.jar:1.4.17] at org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1539) ~[wicket-1.4.17.jar:1.4.17] at org.apache.wicket.Component.render(Component.java:2521) ~[wicket-1.4.17.jar:1.4.17] ... Caused by: java.lang.RuntimeException: there was an error processing the header response - you tried to render a bucket of response from HeaderResponseContainerFilteringHeaderResponse, but it had not yet run and been closed. this should occur when the header container that is standard in wicket renders, so perhaps you have done something to keep that from rendering? at org.apache.wicket.resource.filtering.HeaderResponseFilteredResponseContainer.onComponentTagBody(HeaderResponseFilteredResponseContainer.java:67) ~[wicket-1.4.17.jar:1.4.17] at org.apache.wicket.Component.renderComponent(Component.java:2690) ~[wicket-1.4.17.jar:1.4.17] ... 81 common frames omitted Any ideas on what I'm doing wrong? Is there an easier approach I can take? Thanks, Loren
Re: Set default coding strategy
Awesome. We are already using wicketstuff-annotation, annotating the base class is the (now obvious) solution we were looking for. Thanks, Loren On Fri, Apr 1, 2011 at 4:10 AM, Mike Mander wicket-m...@gmx.de wrote: Am 31.03.2011 17:39, schrieb Loren Cole: We're using annotations to mount our pages, and would like to set things up so they use HybridUrlCodingStrategy by default. Does anyone know of a way to do this? Thanks, Loren Maybe you can write your own mount method mountHybrid and overload it. Then you can call this methods. Overwriting mount methods in application seems to be forbidden (final) and in these methods there is no entry point for startegy instanciation. Another (realy great) tool for mounting pages is in wicketstuff-annotation project. There you can set strategy to use in every page itself and if you derive all your pages from a base class you can annotate this class with a HybridUrlCodingStrategy. Hth Mike - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Set default coding strategy
We're using annotations to mount our pages, and would like to set things up so they use HybridUrlCodingStrategy by default. Does anyone know of a way to do this? Thanks, Loren
Unable to find the markup for the component.
I've got a situation where we're lifting a panel out of a page and making it the content of a modal window, like so: @Override public void setPage(final WebPage page) { Component panel; if(page instanceof EmbeddedPage) { logger.debug(embedded panel p... + page.get(popcontainer:content)); panel = page.get(popcontainer:content); if(panel != null) { this.setContent(panel); } } We implemented a lot of modals using setPage, but had performance issues and found that using panels fixed them, so it being close to a release this is the solution we used. Unfortunately we're now having problems with feedback panels on those modals; we get the following error when trying to update them: WicketMessage: Unable to find the markup for the component. That may be due to transparent containers or components implementing IComponentResolver: [MarkupContainer [Component id = feedback]] Does anyone have any advise on how to fix this? I'm working on the assumption that the code above is breaking the hierarchy, is there a way to repair it? Thanks, Loren - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
DropDownChoice with tooltip
I needed tooltip functionality on a dropdownchoice component and I have a work around but it involved copying a bunch of existing code because I couldn't figure out an easy way to add title to an html select-option. The IChoiceRenderer passed into the DropDownChoice only has getter/setters for Value and id. It would have been nice for the AbstractChoice to call getToolTip or loop through behaviors at the option level in the AbstractChoice.appendOptionHtml() function, this would allow us to override the html output a little easier. Is there a better way to do this? -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/DropDownChoice-with-tooltip-tp3067946p3067946.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Lazy Load Panel at runtime from another jar
I have simple plugin frame work for my app. I load plug-in's at startup. What I would like is to have the plug-in supply a panel for exposing the plugin's functionality. So a wicket page loads, the app determines if pluginA is available and calls, pluginA.getPanel(). pluginA is in a separate jar, the class and html file. When the application runs I get : (UrlResourceStream.java:108) - cannot convert url: jar:file://localhostc:/foo/extenders/pluginA.jar!/pluginA.html to file (URI is not hierarchical), falling back to the inputstream for polling I'm not sure if the resource loader is finding the html file or it simply cannot load the html file. Is this a classpath issue or do I need to do something special to allow loading panels from jar's at runtime. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Lazy-Load-Panel-at-runtime-from-another-jar-tp3026325p3026325.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: AccordionPanel works on web page but not in another panel
Example of valid markup (component on a page): wicket:panel dl class=accordion-menu wicket:panel dt class=a-m-t wicket:id=titleMenuItem1/dt dd class=a-m-d div class=bd wicket:id=content wicket:panel Give it some content! /wicket:panel /div /dd /wicket:panel wicket:panel dt class=a-m-t wicket:id=titleMenuItem2/dt dd class=a-m-d div class=bd wicket:id=content wicket:panel Give it some content! /wicket:panel /div /dd /wicket:panel /dl wicket:child/ /wicket:panel Example of invalid (component within another panel) dl class=accordion-menu dt class=a-m-tMenuItem1/dt dd class=a-m-d div class=bd Give it some content! /div /dd dt class=a-m-tMenuItem2/dt dd class=a-m-d div class=bd Give it some content! /div /dd /dl as you can see I'm missing some key elements that are required to make the markup complete. I'm missing something simple, I'm just not competent enough to find it. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/AccordionPanel-works-on-web-page-but-not-in-another-panel-tp2333034p2333185.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Models not updating when submitting form with AjaxButton
I can't seem to get my models to update when I submit a form using AjaxButton. Originally my code looked like this, and I though it should just work, but when you click the submit link parentService is null and bundles and elements are empty lists.: class AddServices extends BasePage { AbacusService parentService = new AbacusService(); ListServicePlan bundles = new ArrayList(); ListServicePlan elements = new ArrayList(); public AddServices(final ModalWindow window, final OrderModel order) { add(new Label(id, new Model(order.getId(; Form form = new Form(form); add(form); final FeedbackPanel feedback = new FeedbackPanel(feedback); feedback.setOutputMarkupId(true); form.add(feedback); form.add(new DropDownChoice(parent, new PropertyModel(this, parentService), Application.orderDao.getPossibleParents(order.getId()), new ChoiceRenderer(fullName))); form.add(new ListMultipleChoice(bundles, new PropertyModel(this, bundles), Application.orderDao.getBundleTemplates(), new ChoiceRenderer(serviceTypeAndName))); form.add(new ListMultipleChoice(elements, new PropertyModel(this, elements), Application.orderDao.getBundleTemplates(), new ChoiceRenderer(serviceTypeAndName))); AjaxButton submit = new AjaxButton(submit, form) { @Override protected void onSubmit(AjaxRequestTarget target, Form form) { info(submitting form); info(parent = + parentService.toString()); info(elements = + elements.toString()); info(bundles = + bundles.toString()); //Application.orderDao.addServices(elements, order.getId(), parent, null); //window.close(target); } @Override protected void onError(AjaxRequestTarget target, Form form) { error(Grrr Arrg); target.addComponent(feedback); } }; form.add(submit); } } So, I thought maybe I was expecting too much of AjaxButton and manually updated these variables in an AjaxFormComponentUpdatingBehavior like so: ListMultipleChoice bundleChoice = new ListMultipleChoice(bundles, new Model(), Application.orderDao.getBundleTemplates(), new ChoiceRenderer(serviceTypeAndName)); bundleChoice.add(new AjaxFormComponentUpdatingBehavior(onchange) { @Override protected void onUpdate(AjaxRequestTarget target) { info(model: + this.getComponent().getModelObject().toString()); bundles = (ListServicePlan) this.getComponent().getModelObject(); target.addComponent(feedback); } }); form.add(bundleChoice); Now when I select things off the components the feedback panel updates with the things I've selected, but when it gets to the submit method I still have empty lists and a null, and I am seriously confused as to why. Everything works properly if I forgo submitting via Ajax and just override the form's onSubmit(), but I'd like to shove this page into a modal window and so need the ajax bit to close the window.. What am I missing?
AccordionPanel works on web page but not in another panel
Wicket 1.4 and using the AccordionPanel/AccordionPanelItem src from the wicket-contrib-accordion area. I can place this component on a web page via and it works fine. When I try to place this same component in another tab panel it fails. The page actually hangs with no output. I used fiddler to view the output and the markup is missing the leading and some of the other markup is also missing. I looked at a post where another user had wrapped the AccordionPanel in a WebMarkupContainer but when I do that the browser complains that I am missing all the markup for the panel. It almost appears that the markup isn't being generated. Failed to render. [MarkupContainer [Component id = accordionMenu]] [MarkupContainer [Component id = 0]] [MarkupContainer [Component id = item]] [Component id = title] [MarkupContainer [Component id = content]] [MarkupContainer [Component id = 0]] [MarkupContainer [Component id = item]] [Component id = label] [MarkupContainer [Component id = 1]] [MarkupContainer [Component id = item]] [Component id = title] [MarkupContainer [Component id = content]] [MarkupContainer [Component id = 0]] [MarkupContainer [Component id = item]] I tried adding container.setOutputMarkupId(true); but this doesn't have any effect. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/AccordionPanel-works-on-web-page-but-not-in-another-panel-tp2333034p2333034.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Exempt pages from pagemap
Unfortunately no, in most cases I'm using LoadableDetachable models. Thanks, Loren On Wed, May 19, 2010 at 5:09 AM, Martijn Dashorst martijn.dasho...@gmail.com wrote: Are your models static instead of LoadableDetachable and/or PropertyModels? Martijn On Tue, May 18, 2010 at 10:38 PM, Loren Cole loren.c...@gmail.com wrote: I've got a couple of pages which display data that changes often and I want to be sure that when a user hits refresh they get a fresh new copy of that page. Unfortunately, if I've used setResponsePage(new MyPage(params); to get to these pages, then a refresh does not update the data, while hitting the back button and resubmitting or clicking a link to the bookmarkable page does. Is there a way I can simply exempt these pages from the cache using wicket 1.3.7? Thanks, Loren -- Become a Wicket expert, learn from the best: http://wicketinaction.com Apache Wicket 1.4 increases type safety for web applications Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.4.7 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Exempt pages from pagemap
I've got a couple of pages which display data that changes often and I want to be sure that when a user hits refresh they get a fresh new copy of that page. Unfortunately, if I've used setResponsePage(new MyPage(params); to get to these pages, then a refresh does not update the data, while hitting the back button and resubmitting or clicking a link to the bookmarkable page does. Is there a way I can simply exempt these pages from the cache using wicket 1.3.7? Thanks, Loren
Re: Page model returning null
Oh. That is embarrassing. Sorry for taking your time. On Mon, Nov 2, 2009 at 7:47 PM, Jeremy Thomerson jer...@wickettraining.comwrote: On Mon, Nov 2, 2009 at 4:57 PM, Loren Cole loren.c...@gmail.com wrote: HomePage hp = (HomePage) this.findPage(); ModelEntity account = (ModelEntity) parent.getInnermostModel(); Is this just a typo? You're getting the home page and then getting the innermost model from something else? Shouldn't it be hp.getModel()? -- Jeremy Thomerson http://www.wickettraining.com
Page model returning null
I've got the following bits of code: public HomePage(PageParameters parms) { this(); Long accountId = parms.getLong(accountId); account = new ModelEntity(Account.class, accountId); setModel(account); ... public class EditContactDetails extends Panel{ public EditContactDetails(String id, final ModelEntity contact){ super(id); Form form = new Form(form, new CompoundPropertyModel(contactObj)){ @Override protected void onSubmit(){ //do stuff //redraw the page HomePage hp = (HomePage) this.findPage(); ModelEntity account = (ModelEntity) parent.getInnermostModel(); facade.logSevere(account.toString()); hp.reloadAccount(account); } }; ... getInnermostModel() is returning null, instead of the model I set it to when loading the page. This all used to work until I added a panel to hierarchy above EditContactDetails and I'm not sure why I can't get my hands on the model now. I'm using wicket 1.3.5. Are there circumstances where findPage() would return a new instance of HomePage? Logging tells me that HomePage's model does not contain null at the time it is set, and I'm not explicitly setting it anywhere else, is there some trickery that could be resetting it for me? Thanks for you time. Loren
Re: Override IE AutoComplete with wicket's AutoCompleteTextField
I ran into this problem on firefox 3.0 using wicket 1.3.5. Firefox wanted autocomplete=off, instead of autocomplete=false which is what AutoCompleteTextField was using. W3schools doesn't specify a value for this attribute, so I'm assuming it's not all ironed out yet. I fixed it with the following, but haven't tested on ie. myAutocompleteTextField.add(new AttributeModifier(autocomplete, new Model(off))); - Loren On Thu, Apr 17, 2008 at 2:13 PM, Ryan Sonnek ryan.son...@gmail.com wrote: Glad you liked it...That's actually my blog. =) you may want to check out the updated version of the autocomplete wicket components... http://jroller.com/wireframe/entry/from_components_to_behaviors On Thu, Apr 17, 2008 at 10:59 AM, ak ansa...@yahoo.com wrote: Thank you Ryan and Gerolf. I also came across this useful post for anyone reading this thread ... http://www.jroller.com/wireframe/entry/wicket_autocomplete_text_field -Andy -- View this message in context: http://www.nabble.com/Override-IE-AutoComplete-with-Wicket%27s-AutoCompleteTextField-tp16733561p16745438.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Wicket, Jboss, EJB3
I've been using wicket-contrib-javaee-1.1 with glassfish for a while and it works fairly well, but the powers that be have decided we should try porting to JBoss and I cannot for the life of me get injection to work with Wicket on JBoss-5.1.0.GA. Has anyone else done this? If so what did you need to do to make it work? Thanks, Loren
Re: Wicket, Jboss, EJB3
You are a gentleman and a scholar. Thanks! - Loren On Fri, Jul 24, 2009 at 5:34 PM, Marcin Palka marcin.pa...@gmail.comwrote: Looks like it works with 5.1GA too. See attached quickstart project. It's a maven-based enterprise application project that consists of a EJB, WAR and EAR modules. Build it and deploy the EAR into your JBoss AS. Please note that you have to configure your JBoss home folder to the top level pom file (look at the bottom of the file, jboss.home property). cheers, Marcin http://www.nabble.com/file/p24652774/SampleEA.zip SampleEA.zip -- View this message in context: http://www.nabble.com/Wicket%2C-Jboss%2C-EJB3-tp24650609p24652774.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: building extensible components
by class proliferation you mean having to extend a base class? well, I mean using three classes to do what I've been accomplishing with one - it struck me as off, but I'm sure you guys know what you're about :) Jonathan, thanks for the advise.
building extensible components
I'm building an app that will have *lots* of panels that all follow a very similar pattern: They have a form and a static view whose visibility gets toggled when when you click edit/cancel|save|delete They display a warning if their model is empty They pop up a warning when you delete them They allow you to edit their model I've written a few and realized that I am cutting and pasting way too much code; so, I want to build an abstract superclass, but am having trouble figuring out how. Hopefully someone here may be able to help. I need my subclasses to add markup to both the static and form components, which I believe rules out markup inheritance because I would have to use wicket:child/ twice and can't imagine wicket being able to figure out what I meant. The other option I see is to create a panel for both the static content and the form, and to extend the superclass to specify which panels to include for each, which seems workable but ugly... Am I missing something, is there a better way? The super class I want to write would look something like this, I just can't figure out how to associate the markup: public abstract class AttributePanel extends Panel { WebMarkupContainer staticContainer = new WebMarkupContainer(static); WebMarkupContainer dynamicContainer = new WebMarkupContainer(dynamic); AjaxLink editLink; Form form; Label unprovisioned = new Label(unprovisioned, No provisioning data has been entered for this service, perhaps you should add it now...);; Attributable attribute; //the model ComponentFeedbackPanel feedback = new ComponentFeedbackPanel(feedback, this); String ConfirmationMsg = You sure?; public AttributePanel(final String id, final ModelService service) { super(id, service); // add static stuff staticContainer.setOutputMarkupId(true) .setOutputMarkupPlaceholderTag(true); add(staticContainer); staticContainer.add(unprovisioned.setVisible(false)); if (attribute.getRefItemID()==null) { unprovisioned.setVisible(true); } populateStaticContainer(); //add some components specific to the subclass //add dynamic stuff dynamicContainer.setOutputMarkupId(true) .setOutputMarkupPlaceholderTag(true); add(dynamicContainer); form = new Form(form); form.add(new AjaxButton(submitButton, form) { @Override protected void onSubmit(AjaxRequestTarget target, Form form) { save(); ServicePanel parent = (ServicePanel) findParent(ServicePanel.class); parent.addOrReplace(this); target.addComponent(parent); } @Override protected void onError(AjaxRequestTarget target, Form form) { target.addComponent(feedback); } }); feedback.setOutputMarkupId(true); form.add(feedback); dynamicContainer.add(form); populateDynamicContainer(); //add some components specific to the subclass // Link to show form editLink = new AjaxLink(edit) { @Override public void onClick(AjaxRequestTarget target) { showForm(target); } }; staticContainer.add(editLink); // Link to return to static view without saving any changes form.add(new AjaxLink(cancel) { public void onClick(AjaxRequestTarget target) { hideForm(target); } }); //link to delete attribute form.add(new Link(deprovision) { @Override public void onClick() { deprovision(); ServicePanel parent = (ServicePanel) findParent(ServicePanel.class); parent.addOrReplace(this); } }.add(new SimpleAttributeModifier(onclick, return confirm(' +getConfirmationMsg()+'); ))); } private void showForm(AjaxRequestTarget target) { staticContainer.setVisible(true); dynamicContainer.setVisible(false); target.addComponent(staticContainer); target.addComponent(dynamicContainer); } private void hideForm(AjaxRequestTarget target) { staticContainer.setVisible(true); dynamicContainer.setVisible(false); target.addComponent(staticContainer); target.addComponent(dynamicContainer); } private String getConfirmationMsg(){ return ConfirmationMsg; } abstract void populateStaticContainer(); abstract void populateDynamicContainer(); abstract boolean save(); abstract boolean deprovision(); } Thanks! Loren
Re: building extensible components
No that is pretty much what I meant. The composition solution would involve and abstract superclass and then for each kind of widget a fairly trivial implementation of the superclass, a static panel, and a dynamic panel. It's just that all that class proliferation gives me a nasty feeling and I'd like avoid it if possible. Any other ideas? Thanks, Loren
Re: Problems Refreshin a Image from AjaxLink
I haven't found anything that does a good job covering Wicket 1.3 and I haven't looked at books which cover older versions. There is Enjoying Web Development With Wicket which is available as an ebook, but it is really a series of how-to's - fairly superficial, with no real discussion of how the guts of the thing work or best practices. Wicket in Action is definitely a long way from finished but the available chapters do provide a good grounding in fundamental concepts like models and page layout/navigation. On Dec 22, 2007 2:50 PM, Marco Santos [EMAIL PROTECTED] wrote: Thanks a lot! I worked! Tell me, do you know a good book about wicket? I have red the 1st chapter o Wicket in Action from manning and it seams nice, but it is not finished yet. Thanks again! --ms Matej Knopp-2 wrote: Image doesn't change because it's being cached by the browser. To ensure that browser doesn't cache the image you need to append a string to url that changes on every refresh. Just like NonCachingImage does. -Matej On Dec 22, 2007 8:53 PM, Marco Santos [EMAIL PROTECTED] wrote: Hello there! I'm with problems refreshing an Image. On my web application i'm trying to refresh or change an Image that is on a Panel. On the panel there is a Image (it is rendered the first time) and a label. Outside the panel i have AjaxLink's (that are images too) that refresh the panel, and consequently the components on it, the image and the label. when the link is clicked, the label e refreshed with the new text, but the image still the same. The code is the following: /** *The Panel with the image to be refreshed: *(the label on the panel is freshed when the link is pressed. **/ public class PhotoPanel extends Panel { /** Creates a new instance of PhotoPanel*/ public PhotoPanel(String id, byte[] photoData, int size, Integer index) { super(id); setOutputMarkupId(true); MyImage mainPhoto = new MyImage(mainPhoto, photoData, size);//component that extends Image mainPhoto.setOutputMarkupId(true); Label label = new Label(index, MYLABEL: + index.toString ()); add(mainPhoto); add(label); } } /** * The AjaxLink's on a Parent panel that holds a panel with the links, and the panel with the image * to be refreshed **/ private class PhotoSlideLink extends AjaxLink { private byte[] photoSlideData = null; Integer index = 0; public PhotoSlideLink(String id, byte[] photoSlideData ) { super(id); this.photoSlideData = photoSlideData ; MyImage photoSlide = new MyImage(photoSlide, photoSlideData , 100); add(photoSlide ); } @Override public void onClick(AjaxRequestTarget ajaxRequestTarget) { Panel newMainPhotoPanel = new PhotoPanel(mainPhotoPanel, photoSlideData , MAIN_PHOTO_SIZE, index++); newMainPhotoPanel .setOutputMarkupId(true); /*the first PhotoPanel created when the page was loaded*/ mainPhotoPanel.replaceWith(newMainPhotoPanel); mainPhotoPanel= newMainPhotoPanel ; ajaxRequestTarget.addComponent(newMainPhotoPanel); } } Does any one know why refreshing the panel, the label change, but not the image? Am i forgetting to do something? Thanks a lot -- View this message in context: http://www.nabble.com/Problems-Refreshin-a-Image-from-AjaxLink-tp14472713p14472713.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/Problems-Refreshin-a-Image-from-AjaxLink-tp14472713p14473189.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Custom styles for trees
I'd like to remove the folder and page icons from a LinkTree and I'm not entirely sure how to go about it. As far as I can tell I need to create a LinkIconPanel instead and then add a blank image component to it... Or is there some way I can reference the image and set it's visible flag? Why isn't this all done in css? or is it and I'm just missing something... Many thanks for any help, - Loren
Re: Custom styles for trees
Ah! thank you. I apologize if I'm resurrecting a dead horse, but why isn't this done with css? I saw some discussion about it from last summer, but the last comment in the thread suggested that the status quo was easy enough. My unasked for two cents is any thing you can do to isolate look and feel from code is a good thing, and overriding a css class to get this effect is more intuitive than overriding a method in the super class. Are there any plans to change this? - Loren On Dec 12, 2007 3:28 PM, Matej Knopp [EMAIL PROTECTED] wrote: You need to override the getImageResourceReference method of LabelIconPanel (or LinkIconPanel). Look at the default implementation in LabelIconPanel. -Matej On Dec 12, 2007 9:27 PM, Loren Cole [EMAIL PROTECTED] wrote: I'd like to remove the folder and page icons from a LinkTree and I'm not entirely sure how to go about it. As far as I can tell I need to create a LinkIconPanel instead and then add a blank image component to it... Or is there some way I can reference the image and set it's visible flag? Why isn't this all done in css? or is it and I'm just missing something... Many thanks for any help, - Loren - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]