modalWindow can't be closed
hi, i have a problem , i have a modalWindow, there is a button in the modalWindow,when i click the button ,i want the modalWindow be closed ,but now it can not be be closed , below is my code , AjaxButton saveBtn = new AjaxButton("save") { @Override protected void onSubmit(AjaxRequestTarget target, Form form) { List list3 = peopleService.fetchBySearchCondition(searchCondition); List resultList = doTransLate(list3); File file = peopleService.exportExcelFile(resultList,formModel); IResourceStream is = new FileResourceStream(file); try { if (((WebRequest) getRequest()).getHttpServletRequest() .getHeader("User-Agent").toLowerCase().indexOf( "firefox") > 0) { getRequestCycle() .setRequestTarget( new ResourceStreamRequestTarget(is) .setFileName(new String(file .getName().getBytes( "UTF-8"), "ISO8859_1"))); } else { getRequestCycle().setRequestTarget( new ResourceStreamRequestTarget(is) .setFileName(URLEncoder.encode( file.getName(), "UTF-8") .replace("+", "%20"))); } } catch (UnsupportedEncodingException e) { e.printStackTrace(); } getRequestCycle().setRequestTarget(null); modalWindow.close(target); } @Override protected void onError(AjaxRequestTarget target, Form form) { target.addComponent(feedbackPanel); } }; form.add(saveBtn); thanks --jans
modalWindow can not be closed
there is some error in the last email i send, here is real code AjaxButton saveBtn = new AjaxButton("save") { @Override protected void onSubmit(AjaxRequestTarget target, Form form) { List list3 = peopleService.fetchBySearchCondition(searchCondition); List resultList = doTransLate(list3); File file = peopleService.exportExcelFile(resultList,formModel); IResourceStream is = new FileResourceStream(file); try { if (((WebRequest) getRequest()).getHttpServletRequest() .getHeader("User-Agent").toLowerCase().indexOf( "firefox") > 0) { getRequestCycle() .setRequestTarget( new ResourceStreamRequestTarget(is) .setFileName(new String(file .getName().getBytes( "UTF-8"), "ISO8859_1"))); } else { getRequestCycle().setRequestTarget( new ResourceStreamRequestTarget(is) .setFileName(URLEncoder.encode( file.getName(), "UTF-8") .replace("+", "%20"))); } } catch (UnsupportedEncodingException e) { e.printStackTrace(); } modalWindow.close(target); } @Override protected void onError(AjaxRequestTarget target, Form form) { target.addComponent(feedbackPanel); } }; form.add(saveBtn); thanks --jans
Re: Show/hide form components best practice
Please correct me if I'm wrong, but, once the component's validators have been passed, and when executing, for instance a FormValidator, you can get the converted input of the Checkbox. Then choose to use or not the input of the conditional field. Of course that prevents you from using setRequired on that field, because it would be executed as a Component Validator before the Form one. Hope that helps, Xavier 2010/6/16 Iain Reddick > I looked at this again today and realised that my examples are basically > broken (also typos in the last one :) ). > > Obviously, you can't use the converted input of a FormComponent before > validation has happened. This means that using the CheckBox converted input > to determine whether another form component is "used" in the submission is > wrong - it will only return the value it held before the submit. You would > actually have to look at the raw input. > > So I'm back at square one with this again. > > I suppose my question is "Is component visibility the only means of > determining whether a form component should be considered in the form submit > mechanism?". > > - Original Message - > From: "Iain Reddick" > To: users@wicket.apache.org > Sent: Wednesday, 9 June, 2010 8:35:13 PM > Subject: Re: Show/hide form components best practice > > Looking at the wicket source regarding this, I don't think it's possible > to get the desired behaviour. > > It looks like a new hook is needed in FormComponent.validate() that is > called before any of the other logic. > > Something like FormComponent.isUsed(). If this returns false, just exit > the validate() methods. > > Default FormComponent implementation would return true for this method, > but it can be overriden to provide the desired behaviour. > > As I understand the submit/validate/bind sequence, this would mean that > the form component's raw input is updated (which makes sense), but > validation/model object doesn't happen. > > Is this feasible, and would it impact elsewhere? > > > Here's an update of my previous example showing how it would be used: > > private class TestForm extends Form { > > private String always; > private boolean useOptional = false; > private String optional; > > public TestForm(String id) { > super(id); > > add( new TextField("always", new PropertyModel(this, > "always")).setRequired(true) ); > final CheckBox useOptionalCheck = new CheckBox( "useOptional", new > PropertyModel(this, "useOptional") ); > add( useOptionalCheck ); > add( new TextField("optional", new PropertyModel(this, "optional")) { > @Override public boolean isUsed() { > return ((Boolean)useOptionalCheck.getConvertedInput()).booleanValue(); > } > > @Override > public boolean isRequired() { > isUsed(); } > }.add(MinimumLengthValidator.minimumLength(3)) ); > } > > } > > > - Original Message - > From: "Xavier López" > To: users@wicket.apache.org > Sent: Thursday, 3 June, 2010 2:56:33 PM > Subject: Re: Show/hide form components best practice > > I'm with you on this one, this code feels like doing something that it > shouldn't, looks kind of bloated for such a simple and common > requirement. Maybe we need some stuffing of nice, pre-canned > FormValidators ? :) > > The problem with wicket's validators, as I see it, is that they are at a > Component level. They do their job based on that component's > input/state, only. In fact, they are called in Form's > validateComponents() one by one in > a traversal. If another component's input or state is required to > perform the validation, i'd do it inside a FormValidator. That copes > with your > requirement of "ignore the input for this component completely", > although I > don't know how would that be achieved. > > Of course, in all those comments, I assume you can not rely on > javascript nor ajax to perform those validations, in which case the > visibility approach > simply couldn't work. > > Cheers, > Xavier > > 2010/6/3 Iain Reddick > > > The problem with this approach is that you throw away all the nice, > > re-usable pre-canned validators that wicket has, and that it seems > > very "wrong". > > > > I'd actually push the behaviour I would like to see even further - in > > the example I gave, I don't even want the optional field to update > > it's model > > when the check box isn't selected. > > > > Effectively, I want to be able to specify logic which says "ignore the > > input for this component completely". Currently, the only way to do > > this is > > by using component visibility (unless I'm completely wrong on this). > > > > Xavier López wrote: > > > >> Hi Iain, > >> > >> I would do it like this, with a FormValidator. I moved the minimum > >> length validation also to the formValidator, because doing it with a > >> MinimumLenghtValidator would trigger it before the formValidator > >> executes, and may raise errors when the input is not valid (i.e. not > >> mandatory) : > >> > >> private class TestForm extends Form { > >> > >> IModel modelAlways; > >> IModel mo
Re: modalWindow can not be closed
What does your ajax return? are you using HTTPSessionStore? -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/modalWindow-can-not-be-closed-tp2258304p2258336.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: Using Wicket to build Application Portal
Hi Igor, I have started work on the pattern you suggested. This is what I have done so far but there seems to be some missing pieces when I integrate the tabs or try to fire them from container app, would be great to get some lead here. The Structure of the projects as follows. * Project: test-common Description: Will provide common interfaces that sub applications can use. One of them would be the CreateAppTab interface. *Interface to create a new tab, goes like this. * public ITab createAppTab();* Using maven POM I have marked it to be built into a *.jar* file.The built jar is available in the local maven repository so other applications can refer to it. *Project: test-container Description: Will be the base application that will contain sub-applications.* This has the WebApplication and also a Sub-classed Web Application. As Part of its POM, I have added *test-common* as a dependency. I build this project as a .*WAR *file. As part of its *WEB-INF/lib*, I find the* test-common.jar* At this point it satisfies the requirements of a Container Application that contains the module(jar) as part of it.( Please correct me if I have deviated) *Project:test-application-1* *Description: Will be one of the applications. Provides Tab(s) that will be associated with this app.* *Project will be built as a .jar* I do not have a Web Application as part of this project. I include a dependency to* test-common.jar* in test-application-1's POM. (Since I thought adding dependency to test-container.war did not seem sensible, correct me if I am wrong.) One of the panel class in this application implements the test-common's createAppTab interface and add's the returned ITab instance into a List. The List is added into an instance of TabbedPanel. The instance of TabbedPanel is added into the Panel. I have a corresponding basic markup for this Panel class. *Re-Visit test-container* I modified the test-container's POM to include test-application-1 as a dependency(jar) and built it into a .WAR. The war now contains two jars *test-common.jar and **test-application-1.jar Is this build strategy acceptable? In one build, able to include the dependent application's jar's into one single WAR. Doubts:* 1. I need to know how these individual applications/plugins will be fired to render the tabs (create an instance of the tabs) from the test-container. when the application is started on lands on the Home Page for instance? [On a side note what I did try on those lines was I created an instance of the sub-application's class that implemented the Tab Interface and added it to the home page instance. As in.. App1Tab tab1 = new App1Tab("someTab"); //This would fire the constructor and create the tab instances add(tab1); This was not a success, as it comes up with a Wicket runtime exception ITab.getPanel() returned a panel with invalid id [studyPanel]. You must always return a panel with id equal to the provided panelId parameter. TabbedPanel [8:stab:moduleTabsList] ITab index [0] ] Thanks for the time, will be great to hear from you on this. Regards Niv On Thu, Jun 10, 2010 at 11:46 AM, Igor Vaynberg wrote: > On Wed, Jun 9, 2010 at 8:20 PM, Nivedan Nadaraj > wrote: > > Hi Igor, > > > > Thank you for the quick response and what a ray of hope it brings! It > > certainly, from your experience seems to be a very good design approach. > I > > am excited to implement it. > > > > The question(s)/confirmation at this point in time is : > > > > 1.Will Application 2..(n) ever extend the sub-class Web Application > > provided by the Container Application? [I guess not, since Application-2 > > needs to be built as a jar and packaged with Container-Application's WAR. > > Which means sub application's (jars) will all be part of a Single Wicket > > Application instance] (Am I right?) > > correct, since 2..n are plugins rather then applications they do not > need their own application class. > > > 2. The Tab Provider Interface you mentioned that would be part of the > common > > jar in Container-Application; would that be a class like > > org.apache.wicket.extensions.markup.html.tabs.AbstractTab ? This is what > I > > have used at the moment. > > sure, that will work. usually i have something like this > > public interface MainTabProvider { ITab newMainTab(); } > > followed by > > public interface ApplicationPlugin extends TabProvider, .. bunch of > other interfaces > > -igor > > > > Appreciate your time. Glad to be using the right framework and not have > to > > switch to another framework. > > > > Many thanks > > Regards > > > > > > > > > > > > On Wed, Jun 9, 2010 at 10:44 PM, Igor Vaynberg >wrote: > > > >> ive done this many times already, wicket is perfect for things like > these. > >> > >> application 1 should be a simple wicket container app. this is a full > >> application with its own subclass of WicketApplication and is what is > >> going to be packaged as a war file. it should also have a module (jar) > >> with the int
Re: wicketstuff-repo
Any information on if and when wicketstuff will be back again? This is breaking our build since days now which is no fun ;-) We are using several non-core artifacts and building them from source is not a very desireable solution. Cheers, -Tom > - Ursprüngliche Nachricht - > Von: Michael O'Cleirigh > Gesendet: 15.06.10 15:23 Uhr > An: users@wicket.apache.org > Betreff: Re: wicketstuff-repo > > Hello, > > The release artifacts for wicketstuff-core since 1.4.7 have been > deployed through sonatype and are available through maven central. > > http://repo2.maven.org/maven2/org/wicketstuff/ > > This is only for the projects in wicketstuff-core directory structure, > if you are looking at one of the other projects you will have to > download the source and compile it right now until wicketstuff.org is > back up. > > Regards, > > Mike > > someone mentioned sonatype..Search the list for sonatype.. > > > > 2010/6/15 Marc Ende > > > > > >> Hi, > >> > >> is there another wicketstuff-repo (a mirror for example)? Wicketstuff is > >> now > >> down for some days and > >> I'll need some artifacts from the repo. > >> > >> marc > >> > >> > > > > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: wicketstuff-repo
Use an internal repository manager. Then you're not dependent on external infrastructure. Try archiva if you want a low key, low resource manager, or nexus or artifactory if you want more. Martijn On Thu, Jun 17, 2010 at 10:29 AM, "Thomas Götz" wrote: > Any information on if and when wicketstuff will be back again? This is > breaking our build since days now which is no fun ;-) > We are using several non-core artifacts and building them from source is not > a very desireable solution. > > Cheers, > -Tom > > >> - Ursprüngliche Nachricht - >> Von: Michael O'Cleirigh >> Gesendet: 15.06.10 15:23 Uhr >> An: users@wicket.apache.org >> Betreff: Re: wicketstuff-repo >> >> Hello, >> >> The release artifacts for wicketstuff-core since 1.4.7 have been >> deployed through sonatype and are available through maven central. >> >> http://repo2.maven.org/maven2/org/wicketstuff/ >> >> This is only for the projects in wicketstuff-core directory structure, >> if you are looking at one of the other projects you will have to >> download the source and compile it right now until wicketstuff.org is >> back up. >> >> Regards, >> >> Mike >> > someone mentioned sonatype..Search the list for sonatype.. >> > >> > 2010/6/15 Marc Ende >> > >> > >> >> Hi, >> >> >> >> is there another wicketstuff-repo (a mirror for example)? Wicketstuff is >> >> now >> >> down for some days and >> >> I'll need some artifacts from the repo. >> >> >> >> marc >> >> >> >> >> > >> >> >> - >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org >> For additional commands, e-mail: users-h...@wicket.apache.org > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > > -- 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.8 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: wicketstuff-repo
We are already using nexus, but unfortunately the wicketstuff repo is not yet proxied on it, so this does not really help us currently ;-) Yes, we could upload the artifacts manually (to nexus), but as it is a company-wide repo manager this option is not accessible to me (because not allowed). -Tom > - Ursprüngliche Nachricht - > Von: Martijn Dashorst > Gesendet: 17.06.10 10:32 Uhr > An: users@wicket.apache.org > Betreff: Re: wicketstuff-repo > > Use an internal repository manager. Then you're not dependent on > external infrastructure. Try archiva if you want a low key, low > resource manager, or nexus or artifactory if you want more. > > Martijn > > On Thu, Jun 17, 2010 at 10:29 AM, "Thomas Götz" wrote: > > Any information on if and when wicketstuff will be back again? This is > > breaking our build since days now which is no fun ;-) > > We are using several non-core artifacts and building them from source is > > not a very desireable solution. > > > > Cheers, > > -Tom > > > > > >> - Ursprüngliche Nachricht - > >> Von: Michael O'Cleirigh > >> Gesendet: 15.06.10 15:23 Uhr > >> An: users@wicket.apache.org > >> Betreff: Re: wicketstuff-repo > >> > >> Hello, > >> > >> The release artifacts for wicketstuff-core since 1.4.7 have been > >> deployed through sonatype and are available through maven central. > >> > >> http://repo2.maven.org/maven2/org/wicketstuff/ > >> > >> This is only for the projects in wicketstuff-core directory structure, > >> if you are looking at one of the other projects you will have to > >> download the source and compile it right now until wicketstuff.org is > >> back up. > >> > >> Regards, > >> > >> Mike > >> > someone mentioned sonatype..Search the list for sonatype.. > >> > > >> > 2010/6/15 Marc Ende > >> > > >> > > >> >> Hi, > >> >> > >> >> is there another wicketstuff-repo (a mirror for example)? Wicketstuff is > >> >> now > >> >> down for some days and > >> >> I'll need some artifacts from the repo. > >> >> > >> >> marc > >> >> > >> >> > >> > > >> > >> > >> - > >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > >> For additional commands, e-mail: users-h...@wicket.apache.org > > > > - > > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > > For additional commands, e-mail: users-h...@wicket.apache.org > > > > > > > > -- > 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.8 > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: AW: drag and drop
Hi, I've got a problem with my draggable Components and z-index. I do have several draggable WebMarkupContainers that are nested in also draggable Panels. I set the z-index with dragger.setRawOptions("zIndex: 101"); for the WebMarkupContainer dragger.setRawOptions("zIndex: 100"); for the Panel When I dragg the WebMarkupContainer, the ParentPanel also starts to move. When I only set dragger.setRawOptions("zIndex: 101"); for the WebMarkupContainer and don't set the zIndex for the Panel only the draggable WebMarkupContainer moves but the z-index does not work out of the area of the parent panel. I don't use the .ui-draggable-dragging {} for setting the z-index because I want to set different z-indexes for the draggable Components. Hope you can help me out Thanks a lot Bernd -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/drag-and-drop-tp1881857p2258492.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: Using Wicket to build Application Portal
Hi Igor, I have moved a bit forward since the last email but would like your thoughts on it. I am now able to render the top level tab from t*est-application-1*and test-application-2. This is after I resolved the Wicket Runtime Exception. Now going forward, this is how I fire the classes that provide the application tabs from the container application On the HomePage of the Container Application (for example) I instantiate the sub-application's tabs. StudyTab appStudy = new StudyTab("App1Tab"); add(appStudy); SubjectTab appParticipants = new SubjectTab("App2Tab"); add(appParticipants); The homepage.html contains a reference to the components App1Tab and App2Tab So I can see that each sub-application is contributing to the top level (container) menu's. Thus abstracting the details to each sub application. I am yet to render the sub-menus for each application but I guess that is easy since its within the context of each sub application. 1. I would like to get some confirmation if I am on the right path and is this how I should fire the sub-application's entry level tabs? 2. Is there a better way ? 3. Would like to post another question related to application context as part of sub-applications? How would application 1..n have reference to the application context? I guess will try to work it from my side in the meantime. Please let me know on #1 and #2 and if I have not deviated. Many thanks Regards Niv On Thu, Jun 17, 2010 at 4:21 PM, Nivedan Nadaraj wrote: > Hi Igor, > > I have started work on the pattern you suggested. This is what I have done > so far but there seems to be some missing pieces when I integrate the tabs > or try to fire them from container app, would be great to get some lead > here. > > The Structure of the projects as follows. > * > Project: test-common > Description: Will provide common interfaces that sub applications can use. > One of them would be the CreateAppTab interface. > *Interface to create a new tab, goes like this. > * > public ITab createAppTab();* > > Using maven POM I have marked it to be built into a *.jar* file.The built > jar is available in the local maven repository so other applications can > refer to it. > > > *Project: test-container > Description: Will be the base application that will contain > sub-applications.* > > This has the WebApplication and also a Sub-classed Web Application. As Part > of its POM, I have added *test-common* as a dependency. > I build this project as a .*WAR *file. As part of its *WEB-INF/lib*, I > find the* test-common.jar* > At this point it satisfies the requirements of a Container Application that > contains the module(jar) as part of it.( Please correct me if I have > deviated) > > *Project:test-application-1* > *Description: Will be one of the applications. Provides Tab(s) that will > be associated with this app.* *Project will be built as a .jar* > > I do not have a Web Application as part of this project. I include a > dependency to* test-common.jar* in test-application-1's POM. (Since I > thought adding dependency to test-container.war did not seem sensible, > correct me if I am wrong.) One of the panel class in this application > implements the test-common's createAppTab interface and add's the returned > ITab instance into a List. The List is added into an instance of > TabbedPanel. The instance of TabbedPanel is added into the Panel. I have a > corresponding basic markup for this Panel class. > > *Re-Visit test-container* > I modified the test-container's POM to include test-application-1 as a > dependency(jar) and built it into a .WAR. The war now contains two jars > *test-common.jar > and **test-application-1.jar > Is this build strategy acceptable? In one build, able to include the > dependent application's jar's into one single WAR. > > Doubts:* > > 1. I need to know how these individual applications/plugins will be fired > to render the tabs (create an instance of the tabs) from the test-container. > when the application is started on lands on the Home Page for instance? > > > [On a side note what I did try on those lines was I created an instance of > the sub-application's class that implemented the Tab Interface and added it > to the home page instance. > As in.. > App1Tab tab1 = new App1Tab("someTab"); //This would fire the constructor > and create the tab instances > add(tab1); > > This was not a success, as it comes up with a Wicket runtime exception > > ITab.getPanel() returned a panel with invalid id [studyPanel]. You must > always return a panel with id equal to the provided panelId parameter. > > TabbedPanel [8:stab:moduleTabsList] ITab index [0] > ] > > > Thanks for the time, will be great to hear from you on this. > > Regards > Niv > > > > > > > > On Thu, Jun 10, 2010 at 11:46 AM, Igor Vaynberg > wrote: > >> On Wed, Jun 9, 2010 at 8:20 PM, Nivedan Nadaraj >> wrote: >> > Hi Igor, >> > >> > Thank you for the quick response and what a ray of hope it brings! It >> > certainly, from you
Liferay portlet parameters in 1.4.8
We are trying to create parametrized portlet URLs to a maximized "stand-alone" portlet, and run into an issue where the constructor to the Page is invoked twice. But the second time, the query parameters are gone. Why does it create the view page twice? Or is it Liferay "magic" going on? (We should probably extend WicketPortlet and pick up parameters in processAction() though, but need to differentiate between this "external" URL request and internal portlet actions.) Med vennlig hilsen TOR IVER WILHELMSEN Senior systemutvikler Arrive AS T (+47) 48 16 06 18 E-post: toriv...@arrive.no http://www.arrive.no http://servicedesk.arrive.no
Boolean IChoiceRenderer and i18n
I've created a simple BooleanChoiceRenderer that I use along with ChoiceFilteredPropertyColumn that maps to a Boolean property. public class BooleanChoiceRenderer implements IChoiceRenderer { public BooleanChoiceRenderer() { } public Object getDisplayValue(Boolean object) { return object == null ? "" : object ? "Y" : "N"; } public String getIdValue(Boolean object, int index) { return object == null ? "" : object.toString(); } } This works fine, however, I'd like to use i18n and pull the values for True/False from a property file. Preferably a top level property file like WicketApplication.properties where I keep properties that are used throughout the app such as nullValid=Any (to replace "Choose one" in DDC). *What is the best way to achieve this? I've searched nabble for a while but didn't find anything :( *Is there some "Global" mechanism to make displayed values for Booleans throughout the app be certain values? so that each time I use a Column that maps to a Boolean property I don't need to override populateItem and decide what will be displayed for True/False. Thanks -Sam
Re: Boolean IChoiceRenderer and i18n
I would create a BooleanDropDownChoice component and put localizations on that component: that way it would be easier to reuse it for different "projects". For the IChoiceRenderer I would do something similar to EnumChoiceRenderer: i.e. return localized values for "Boolean.TRUE" and "Boolen.FALSE" using BooleanDropDownChoice component to retrieve those values. Best, Ernesto On Thu, Jun 17, 2010 at 2:45 PM, Sam Zilverberg wrote: > I've created a simple BooleanChoiceRenderer that I use along with > ChoiceFilteredPropertyColumn that maps to a Boolean property. > > public class BooleanChoiceRenderer implements IChoiceRenderer { > > public BooleanChoiceRenderer() { > } > > public Object getDisplayValue(Boolean object) { > return object == null ? "" : object ? "Y" : "N"; > } > > public String getIdValue(Boolean object, int index) { > return object == null ? "" : object.toString(); > } > } > > This works fine, however, I'd like to use i18n and pull the values for > True/False from a property file. > Preferably a top level property file like WicketApplication.properties where > I keep properties that are used throughout the app such as nullValid=Any (to > replace "Choose one" in DDC). > > *What is the best way to achieve this? I've searched nabble for a while but > didn't find anything :( > > *Is there some "Global" mechanism to make displayed values for Booleans > throughout the app be certain values? > so that each time I use a Column that maps to a Boolean property I don't > need to override populateItem and decide what will be displayed for > True/False. > > Thanks > -Sam > - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Creating and zipping binary files for download
Thank you very much for your suggestions. I was also thinking of creating folders with random names. I am using geotools libs to generate shapefiles set that I want to zip and stream back. I did not figure out yet how can I generate those files to stream using Geotools. 2010/6/15 Jeremy Thomerson > On Tue, Jun 15, 2010 at 5:24 AM, Alex Rass wrote: > > > You should consider that 2 users can be doing it at the same time. > > Which will lead to serious errors. > > I would suggest using a random file name (or one with session hash in the > > filename) so you avoid userA downloading userB's download.zip > > > > I would think that you should be able to just stream it right back to the > > client as a redirect or smth. This temporary file thing seems very > > improper. > > > > - Alex > > > > You don't even have to do all that random naming stuff yourself. Just use > a > Resource that's local to the user's session and Wicket will create the URL > for you. That also saves him from having to write it out to a file at all > - > he can just stream it back if desired. > > -- > Jeremy Thomerson > http://www.wickettraining.com >
Re: url params with ExternalLink
That would be true if we were using an XHTML doctype, but we've chosen html 4.01 strict. I have yet to be given a practical reason why XHTML is a good solution for the apps I'm building today. Either way, thanks again for the clarification. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/url-params-with-ExternalLink-tp2257905p2258832.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: gmail like file upload
On Wed, 2010-06-16 at 09:35 -0700, fachhoch wrote: > Please suggest me how to integrate google like fileupload in wicket Please define "google like fileupload" and we'll try to help you - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Validators on Required Fields
I'm using EmailAddressValidator on a form field with setRequired(false). The validator is triggering an invalid format message when the field is left blank. I'm having the same problem with RangeValidator against a custom currency class I've created. Shouldn't validation be skipped when the field is empty? When I use RangeValidator with Longs or Doubles, it behaves like I'd expect. I'm sure I'm missing something obvious but I've been scratching my head longer than I care to admit! Thanks.
Specific user/session properties and resources
I still want to use wicket message resource tags in my markup. But, I need a system to load and reload resources property data for each page and request. Or maybe load properties per user session. Is this possible using Wicket resource loader classes. Ideally, it looks like I should use a collection of labels, but I have code to use the wicket message tags. Can I have wicket messages reloaded at each page/request? This is what I am doing now, loading a property file on startup/init. But - import java.io.BufferedInputStream; import java.io.ByteArrayInputStream; import java.io.IOException; import java.util.InvalidPropertiesFormatException; import java.util.Locale; import java.util.Properties; import org.apache.wicket.Component; import org.apache.wicket.resource.loader.IStringResourceLoader; public class MyResourceLoader implements IStringResourceLoader { private Properties properties = new Properties(); public void loadProperties() { final BufferedInputStream bis = new BufferedInputStream(new ByteArrayInputStream(DevelopmentResources.XML_PROPS.getBytes())); try { properties.loadFromXML(bis); } catch (Exception e) { e.printStackTrace(); } finally { try { bis.close(); } catch (IOException e) { } } // End of try finally // } ... ... } Berlin Brown
RE: Wicket and mobile browsers
Martin, Nokia has never been able to do JavaScript right. The other traditional phone manufacturers have not done any better. Same is true for most everything about their phone (e.g. their user-interfaces). Most businesses I work with do not spend much time or money with this type of phone. For instance, if you point it to mobile.walmart.com, you get the most basic experience only. No JavaScript used in this one. Same is true for m.wellsfargo.com. If you use Android or an iPhone, there is plenty of Wicket JavaScript and the UI is significantly richer. One of the reasons for this is that while there are still many of these types of phones out there, their users do not use MWeb and have no ability to use apps. No sense spending money there when the majority of actual MWeb users have Web-Kit based browser that do Wicket Ajax perfectly. :) Best regards, Joachim On Thu, 2010-06-17 at 07:51 +1000, Chris Colman wrote: > Whoops! That should have read 'Nokia E51' - I accidentally mixed the > brand name of my previous phone with the model number of my current > phone. > > >Should a Motorola E51 be able to use a stock standard wicket site with > a > >bit of AJAX? Apparently its browser has javascript support (and it is > >enabled) but I can never get any parts of our wicket website that > >require AJAX to work on this phone. > > > >Any idea why not? > > > >>-Original Message- > >>From: Martin Funk [mailto:mafulaf...@googlemail.com] > >>Sent: Wednesday, 16 June 2010 7:10 PM > >>To: users@wicket.apache.org > >>Subject: Re: Wicket and mobile browsers > >> > >>Thank you for the hint, mobileaware wasn't on my radar so far. > >> > >>2010/6/15 Joachim F. Kainz > >> > >>> Martin, > >>> > >>> WURFL is a great solution, but there are some problems with keeping > >it > >>> up-to-date for commercial applications. > >>> > >>> http://www.mobileaware.com/ is a good commercial vendor I have used > >for > >>> m.wellsfarg.com and other sites. They have an extensive > >>> device-repository and a lot of other useful features for building > >MWeb > >>> sites. Downside: $$$ > >>> > >>> Best regards, > >>> > >>> Joachim > >>> > >>> On Tue, 2010-06-15 at 17:36 +0200, Martin Funk wrote: > >>> > >>> > Hi Giovanni, > >>> > > >>> > on what basis do you do the device recognition and classification? > >>> > > >>> > Currently we are looking into wurfl http://wurfl.sourceforge.net/ > >>> > Any opion on tha? Or do you know of an alternative to wurfl? > >>> > > >>> > mf > >>> > > >>> > 2010/6/15 Joachim F. Kainz > >>> > > >>> > > Giovanni, > >>> > > > >>> > > I am one of the developers of mobile.walmart.com. We are using > >Wicket > >>> to > >>> > > support all types of cell phones, but most of our traffic is > from > >>smart > >>> > > phones. If you point to our site using iPhone, Blackberry, and > >>Motorola > >>> > > Razor you get three different experience. All three experiences > >are > >>> > > backed by the same Java code. > >>> > > > >>> > > We have nothing to do with visural wicket (even though at first > >>glance > >>> > > it looks interesting). Our opensource components are at > >>> > > http://code.google.com/p/jolira-tools/ > >>> > > > >>> > > Best regards, > >>> > > > >>> > > Joachim > >>> > > http://www.jolira.com > >>> > > > >>> > > On Sun, 2010-04-18 at 13:02 -0500, Jeremy Thomerson wrote: > >>> > > > >>> > > > There are many classes of smart phones available. Some > support > >n > >>JS, > >>> > > some > >>> > > > very limited, while others support just about anything you can > >put > >>in > >>> a > >>> > > > regular browser. Because of this, you may use the same java > >code > >>> with > >>> > > three > >>> > > > or four different styles of markup so that each browser class > >has > >>its > >>> own > >>> > > > markup. > >>> > > > > >>> > > > Search the list for "mobile.walmart.com" and see the post made > >by > >>> the > >>> > > guys > >>> > > > that created that site. It talked about this. They also > >released > >>> some > >>> > > open > >>> > > > source components - visural wicket. > >>> > > > > >>> > > > -- > >>> > > > Jeremy Thomerson > >>> > > > http://www.wickettraining.com > >>> > > > > >>> > > > > >>> > > > > >>> > > > On Sun, Apr 18, 2010 at 3:17 AM, Giovanni > > >>> wrote: > >>> > > > > >>> > > > > I need to write a web application which will be accessed via > >>mobile > >>> > > > > browsers from smartphones. > >>> > > > > > >>> > > > > What are the smartphone browsers which work well with > Wicket? > >>> > > > > > >>> > > > > What kind of attention should I pay during the development > of > >>> Wicket > >>> > > > > applications for mobile devices? > >>> > > > > > >>> > > > > Is there any tutorial about developing Wicket applications > >for > >>> mobile > >>> > > > > target browsers? > >>> > > > > > >>> > > > > Thanks in advance for any help. > >>> > > > > > >>> > > > > giovanni > >>> > > > > > >>> > > > > > >>> > > > > > >>> > > > > > >>> > > > >>> > > > >---
Re: Validators on Required Fields
On Thu, Jun 17, 2010 at 9:47 AM, Brad Grier wrote: > I'm using EmailAddressValidator on a form field with setRequired(false). > The validator is triggering an invalid format message when the field is left > blank. I'm having the same problem with RangeValidator against a custom > currency class I've created. Shouldn't validation be skipped when the field > is empty? When I use RangeValidator with Longs or Doubles, it behaves like > I'd expect. I'm sure I'm missing something obvious but I've been scratching > my head longer than I care to admit! > > Thanks. There's a method validateOnNullValue that should be returning false by default. This should make it skip the validation on an empty value. I'd suggest that you create a quickstart that reproduces the bug. Typically you will find some error in the code while doing this. If not, you can submit the quickstart to JIRA and we will take a look since it would be a bug. -- Jeremy Thomerson http://www.wickettraining.com
Re: Making rows of DefaultDataTable into links
Thanks, Jeremy, I think having a real link outweighs having the whole row being a pseudo link, so I'm going to just have the ID column value be a link. But thanks for the advice; it's still informative. On Wed, Jun 16, 2010 at 2:20 AM, Jeremy Thomerson wrote: > On Wed, Jun 16, 2010 at 1:17 AM, Ray Weidner < > ray.weidner.develo...@gmail.com> wrote: > > > Hi all, > > > > Forgive my ignorance if this is too obvious. I'm using DefaultDataTable > to > > display search results, and that's working fine. What I'd like to do is > > make each row of the table a hyperlink to the view/edit page of the > record > > in question. How can I do this? > > > > I was able to add links to a column, although they don't show up in the > > browser as actual links. Rather, they appear as text with associate > > javascript to process an onclick event. Here's the custom column I > created > > for this purpose: > > > > private class IncidentLinkPropertyColumn extends PropertyColumn > > { > > > > public IncidentLinkPropertyColumn (IModel nameModel, String > > propertyName) { > > super (nameModel, propertyName); > > } > > @Override > > public void populateItem (Item > item, > > String componentId, > > IModel model) { > > PageParameters params = new PageParameters (); > > params.put ("incidentId", model.getObject ().getRecordId ()); > > item.add (new LabelLink (componentId, CreateOrEditIncidentPage.class, > > params)); > > } > > > > private class LabelLink extends BookmarkablePageLink { > > private static final long serialVersionUID = 3429331456890689136L; > > > > public LabelLink (String componentId, Class pageType, > > PageParameters parameters) { > > super (componentId, pageType, parameters); > > } > > @Override > > protected void onComponentTagBody (MarkupStream markupStream, > ComponentTag > > openTag) { > > replaceComponentTagBody (markupStream, openTag, "click here!"); > > } > > } > > } > > > > As I said, I'd like the rows to be links to the IncidentReport, but > barring > > that, it would be nice if the link column actually appeared as links, so > > users can right-click to open in a separate tab. If necessary, I can > draft > > an informational column (like ID) to serve as a link, as long as it is a > > true link (so it will be visually obvious, as well as retaining > right-click > > functionality). > > > > Any ideas? Thanks in advance. > > > > to make the rows into links, override newItem (or whatever the name is - it > starts with new) that creates a new row. then you could add an onclick to > the row item, or even an ajaxeventbehavior("onclick") to do some ajax > behavior > > to make the column into a real link, you'll need to use a fragment since > the > default html for a cell is just a span. > > -- > Jeremy Thomerson > http://www.wickettraining.com >
ResourceStreamLocator and mvn resource:resource copying resources in the right directory
Hi all, I need to change the development enviroment for IResourceStreamLocator locator = new ResourceStreamLocator(new Path(new Folder("html"))); getResourceSettings().setResourceStreamLocator(locator); but, what I also need is that maven copy the resources form src/main/resources to src/main/WEB-INF/html. This is needed because when maven creates the war file the resources should also be located in that directory. I've tried org.apache.maven.plugins maven-resources-plugin 2.4.1 copy-package-config package copy-resources ${basedir}/html ${basedir}/src/main/resources true and I got [1] Inside the definition for plugin 'maven-resources-plugin' specify the following: ... VALUE . I don't know what else to do thanks in advance -- Fernando Wermus. www.linkedin.com/in/fernandowermus
Dynamic Resources, Properties
I want to be able to use the StringResourceModel, but I want to use a property "string" that is loaded when the page is loaded. Basically, I want to set a dynamic property object? With this code below, how can I do this. public class SomePanel extends BaseContentPanel { private static final long serialVersionUID = 1L; public SomePanel(String id) { super(id); add(new Label("weatherMessage", new StringResourceModel("weather.message", this, null))); } } Berlin Brown
RE: AW: drag and drop
This is a question for jQuery-UI mailing lists. It's independent from the jWicket implementation. -Ursprüngliche Nachricht- Von: DerBernd [mailto:beha...@web.de] Gesendet: Donnerstag, 17. Juni 2010 11:35 An: users@wicket.apache.org Betreff: Re: AW: drag and drop Hi, I've got a problem with my draggable Components and z-index. I do have several draggable WebMarkupContainers that are nested in also draggable Panels. I set the z-index with dragger.setRawOptions("zIndex: 101"); for the WebMarkupContainer dragger.setRawOptions("zIndex: 100"); for the Panel When I dragg the WebMarkupContainer, the ParentPanel also starts to move. When I only set dragger.setRawOptions("zIndex: 101"); for the WebMarkupContainer and don't set the zIndex for the Panel only the draggable WebMarkupContainer moves but the z-index does not work out of the area of the parent panel. I don't use the .ui-draggable-dragging {} for setting the z-index because I want to set different z-indexes for the draggable Components. Hope you can help me out Thanks a lot Bernd -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/drag-and-drop-tp1881857p2258492.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 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Dynamic Resources, Properties
Label label = new Label("weatherMessage", new AbstractReadOnlyModel() { private static final long serialVersionUID = 1L; @Override public String getObject() { if(condition) return SomePanel .this.getString("weather.message"); else return SomePanel .this.getString("weather.message1"); } }); Ernesto On Thu, Jun 17, 2010 at 9:55 PM, Brown, Berlin [GCG-PFS] wrote: > I want to be able to use the StringResourceModel, but > > I want to use a property "string" that is loaded when the page is > loaded. > > Basically, I want to set a dynamic property object? > > With this code below, how can I do this. > > > public class SomePanel extends BaseContentPanel { > > private static final long serialVersionUID = 1L; > > public SomePanel(String id) { > super(id); > > add(new Label("weatherMessage", new > StringResourceModel("weather.message", this, null))); > > > } > } > > > Berlin Brown > - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Using Wicket to build Application Portal
On Thu, Jun 17, 2010 at 3:14 AM, Nivedan Nadaraj wrote: > Hi Igor, > > I have moved a bit forward since the last email but would like your thoughts > on it. I am now able to render the top level tab from > t*est-application-1*and test-application-2. This is after I resolved > the Wicket Runtime > Exception. > > Now going forward, this is how I fire the classes that provide the > application tabs from the container application > > On the HomePage of the Container Application (for example) > > I instantiate the sub-application's tabs. > > StudyTab appStudy = new StudyTab("App1Tab"); > add(appStudy); > > SubjectTab appParticipants = new SubjectTab("App2Tab"); > add(appParticipants); > > The homepage.html contains a reference to the components App1Tab and App2Tab > > > > > So I can see that each sub-application is contributing to the top level > (container) menu's. Thus abstracting the details to each sub application. I > am yet to render the sub-menus for each application but I guess that is easy > since its within the context of each sub application. > > 1. I would like to get some confirmation if I am on the right path and is > this how I should fire the sub-application's entry level tabs? you are on the right track. > 2. Is there a better way ? you are doing the discovery of sub-applications manually - eg hardcoding it into the container project, it would be nicer if they were automatically discovered at runtime. you can use whatever discovery mechanism you want, for example you can use java's service provider http://java.sun.com/j2se/1.4.2/docs/guide/jar/jar.html#Service Provider > 3. Would like to post another question related to application context as > part of sub-applications? How would application 1..n have reference to the > application context? I guess will try to work it from my side in the > meantime. what is the application context? the instance of application? it can be pulled out from any wicket thread using Application.get() -igor > > Please let me know on #1 and #2 and if I have not deviated. > > Many thanks > Regards > Niv > > > > On Thu, Jun 17, 2010 at 4:21 PM, Nivedan Nadaraj wrote: > >> Hi Igor, >> >> I have started work on the pattern you suggested. This is what I have done >> so far but there seems to be some missing pieces when I integrate the tabs >> or try to fire them from container app, would be great to get some lead >> here. >> >> The Structure of the projects as follows. >> * >> Project: test-common >> Description: Will provide common interfaces that sub applications can use. >> One of them would be the CreateAppTab interface. >> *Interface to create a new tab, goes like this. >> * >> public ITab createAppTab();* >> >> Using maven POM I have marked it to be built into a *.jar* file.The built >> jar is available in the local maven repository so other applications can >> refer to it. >> >> >> *Project: test-container >> Description: Will be the base application that will contain >> sub-applications.* >> >> This has the WebApplication and also a Sub-classed Web Application. As Part >> of its POM, I have added *test-common* as a dependency. >> I build this project as a .*WAR *file. As part of its *WEB-INF/lib*, I >> find the* test-common.jar* >> At this point it satisfies the requirements of a Container Application that >> contains the module(jar) as part of it.( Please correct me if I have >> deviated) >> >> *Project:test-application-1* >> *Description: Will be one of the applications. Provides Tab(s) that will >> be associated with this app.* *Project will be built as a .jar* >> >> I do not have a Web Application as part of this project. I include a >> dependency to* test-common.jar* in test-application-1's POM. (Since I >> thought adding dependency to test-container.war did not seem sensible, >> correct me if I am wrong.) One of the panel class in this application >> implements the test-common's createAppTab interface and add's the returned >> ITab instance into a List. The List is added into an instance of >> TabbedPanel. The instance of TabbedPanel is added into the Panel. I have a >> corresponding basic markup for this Panel class. >> >> *Re-Visit test-container* >> I modified the test-container's POM to include test-application-1 as a >> dependency(jar) and built it into a .WAR. The war now contains two jars >> *test-common.jar >> and **test-application-1.jar >> Is this build strategy acceptable? In one build, able to include the >> dependent application's jar's into one single WAR. >> >> Doubts:* >> >> 1. I need to know how these individual applications/plugins will be fired >> to render the tabs (create an instance of the tabs) from the test-container. >> when the application is started on lands on the Home Page for instance? >> >> >> [On a side note what I did try on those lines was I created an instance of >> the sub-application's class that implemented the Tab Interface and added it >> to the home page instance. >> As in.. >> App1Tab tab1 = new App1Ta
Re: Specific user/session properties and resources
scanning for i18n resources is expensive, that is why they are cached. if you want something more dynamic perhaps you should not use wicket's i18n mechanism to accomplish it. -igor On Thu, Jun 17, 2010 at 8:22 AM, Brown, Berlin [GCG-PFS] wrote: > I still want to use wicket message resource tags in my markup. But, I > need a system to load and reload resources property data for each page > and request. > Or maybe load properties per user session. Is this possible using > Wicket resource loader classes. > > Ideally, it looks like I should use a collection of labels, but I have > code to use the wicket message tags. Can I have wicket messages > reloaded at each page/request? > > This is what I am doing now, loading a property file on startup/init. > But > - > > import java.io.BufferedInputStream; > import java.io.ByteArrayInputStream; > import java.io.IOException; > import java.util.InvalidPropertiesFormatException; > import java.util.Locale; > import java.util.Properties; > > import org.apache.wicket.Component; > import org.apache.wicket.resource.loader.IStringResourceLoader; > > > public class MyResourceLoader implements IStringResourceLoader { > > private Properties properties = new Properties(); > > public void loadProperties() { > > final BufferedInputStream bis = new BufferedInputStream(new > ByteArrayInputStream(DevelopmentResources.XML_PROPS.getBytes())); > try { > properties.loadFromXML(bis); > } catch (Exception e) { > e.printStackTrace(); > } finally { > try { > bis.close(); > } catch (IOException e) { > } > } // End of try finally // > } > > ... > ... > > } > > Berlin Brown > - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
inconsistency in property expression when using . for self reference
hi Let's consider this class : class Container { String string = "foo"; List strings = Arrays.asList(new String[]{"test"}); } This would work: new PropertyModel(container, ".string").getObject() => returns "foo" but this doesn't: new PropertyModel(container, ".strings[0]").getObject() it fails with org.apache.wicket.WicketRuntimeException: no get method defined for class: class org.demo.PropertyModelTest$Container expression: strings Similarly, this doesn't work: new PropertyModel(container, ".").getObject() exception is :java.lang.StringIndexOutOfBoundsException: String index out of range: 0 In the end, should the dot being allowed for self reference ? It's already used as the property separator, so it would be quite misleading. I've attached some proper junit test for these points. ++ josephpackage org.demo; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import junit.framework.TestCase; import org.apache.wicket.model.PropertyModel; public class PropertyModelTest extends TestCase { static class Container { String string = "test"; List strings = Arrays.asList(new String[]{"test"}); } public void testDotNavigationOnSelf() throws Exception { Container container = new Container(); assertEquals(container, new PropertyModel(container, ".") .getObject()); } public void testDotNavigationOnNonCollection() throws Exception { Container container = new Container(); String test = "foo"; container.string = test; assertEquals(test, new PropertyModel(container, ".string") .getObject()); } public void testDotNavigationOnCollection() throws Exception { Container container = new Container(); container.strings = new ArrayList(); String test = "foo"; container.strings.add(test); assertEquals(test, new PropertyModel(container, ".strings[0]") .getObject()); } public void testNavigationOnCollection() throws Exception { Container container = new Container(); container.strings = new ArrayList(); String test = "test"; container.strings.add(test); assertEquals(test, new PropertyModel(container, "strings[0]") .getObject()); } } - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
RE: modalWindow can not be closed
Hi, Not sure if there is any kind of exception thrown within your code, if any other than UnsupportedEncodingException, the modalWindow.close(target) is not reachable. You can try to place it into the final block. Best Regards, Aaron Wang OLL DCS - OCHL/ZHA *(86-756)3396170 *aaron.w...@oocl.com -Original Message- From: 蔡茂昌 [mailto:caimaochang.c...@gmail.com] Sent: Thursday, June 17, 2010 3:24 PM To: users@wicket.apache.org Subject: modalWindow can not be closed there is some error in the last email i send, here is real code AjaxButton saveBtn = new AjaxButton("save") { @Override protected void onSubmit(AjaxRequestTarget target, Form form) { List list3 = peopleService.fetchBySearchCondition(searchCondition); List resultList = doTransLate(list3); File file = peopleService.exportExcelFile(resultList,formModel); IResourceStream is = new FileResourceStream(file); try { if (((WebRequest) getRequest()).getHttpServletRequest() .getHeader("User-Agent").toLowerCase().indexOf( "firefox") > 0) { getRequestCycle() .setRequestTarget( new ResourceStreamRequestTarget(is) .setFileName(new String(file .getName().getBytes( "UTF-8"), "ISO8859_1"))); } else { getRequestCycle().setRequestTarget( new ResourceStreamRequestTarget(is) .setFileName(URLEncoder.encode( file.getName(), "UTF-8") .replace("+", "%20"))); } } catch (UnsupportedEncodingException e) { e.printStackTrace(); } modalWindow.close(target); } @Override protected void onError(AjaxRequestTarget target, Form form) { target.addComponent(feedbackPanel); } }; form.add(saveBtn); thanks --jans IMPORTANT NOTICE Email from OOCL is confidential and may be legally privileged. If it is not intended for you, please delete it immediately unread. The internet cannot guarantee that this communication is free of viruses, interception or interference and anyone who communicates with us by email is taken to accept the risks in doing so. Without limitation, OOCL and its affiliates accept no liability whatsoever and howsoever arising in connection with the use of this email. Under no circumstances shall this email constitute a binding agreement to carry or for provision of carriage services by OOCL, which is subject to the availability of carrier's equipment and vessels and the terms and conditions of OOCL's standard bill of lading which is also available at http://www.oocl.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Using Wicket to build Application Portal
Hi Igor Thank you for that. Discovery of sub-applications using the 'provider-lookup' mechanism sounds pretty cool. I will investigate that concept and work on it, The # 3. :I I guess If I work on it things will get clearer and if something is not would bounce it off you. Many thanks for the valuable guidance. Regards Niv On Fri, Jun 18, 2010 at 4:32 AM, Igor Vaynberg wrote: > On Thu, Jun 17, 2010 at 3:14 AM, Nivedan Nadaraj > wrote: > > Hi Igor, > > > > I have moved a bit forward since the last email but would like your > thoughts > > on it. I am now able to render the top level tab from > > t*est-application-1*and test-application-2. This is after I resolved > > the Wicket Runtime > > Exception. > > > > Now going forward, this is how I fire the classes that provide the > > application tabs from the container application > > > > On the HomePage of the Container Application (for example) > > > > I instantiate the sub-application's tabs. > > > > StudyTab appStudy = new StudyTab("App1Tab"); > > add(appStudy); > > > > SubjectTab appParticipants = new SubjectTab("App2Tab"); > > add(appParticipants); > > > > The homepage.html contains a reference to the components App1Tab and > App2Tab > > > > > > > > > > So I can see that each sub-application is contributing to the top level > > (container) menu's. Thus abstracting the details to each sub application. > I > > am yet to render the sub-menus for each application but I guess that is > easy > > since its within the context of each sub application. > > > > 1. I would like to get some confirmation if I am on the right path and is > > this how I should fire the sub-application's entry level tabs? > > you are on the right track. > > > 2. Is there a better way ? > > you are doing the discovery of sub-applications manually - eg > hardcoding it into the container project, it would be nicer if they > were automatically discovered at runtime. you can use whatever > discovery mechanism you want, for example you can use java's service > provider http://java.sun.com/j2se/1.4.2/docs/guide/jar/jar.html#Service > Provider > > > 3. Would like to post another question related to application context as > > part of sub-applications? How would application 1..n have reference to > the > > application context? I guess will try to work it from my side in the > > meantime. > > what is the application context? the instance of application? it can > be pulled out from any wicket thread using Application.get() > > -igor > > > > Please let me know on #1 and #2 and if I have not deviated. > > > > Many thanks > > Regards > > Niv > > > > > > > > On Thu, Jun 17, 2010 at 4:21 PM, Nivedan Nadaraj >wrote: > > > >> Hi Igor, > >> > >> I have started work on the pattern you suggested. This is what I have > done > >> so far but there seems to be some missing pieces when I integrate the > tabs > >> or try to fire them from container app, would be great to get some lead > >> here. > >> > >> The Structure of the projects as follows. > >> * > >> Project: test-common > >> Description: Will provide common interfaces that sub applications can > use. > >> One of them would be the CreateAppTab interface. > >> *Interface to create a new tab, goes like this. > >> * > >> public ITab createAppTab();* > >> > >> Using maven POM I have marked it to be built into a *.jar* file.The > built > >> jar is available in the local maven repository so other applications can > >> refer to it. > >> > >> > >> *Project: test-container > >> Description: Will be the base application that will contain > >> sub-applications.* > >> > >> This has the WebApplication and also a Sub-classed Web Application. As > Part > >> of its POM, I have added *test-common* as a dependency. > >> I build this project as a .*WAR *file. As part of its *WEB-INF/lib*, I > >> find the* test-common.jar* > >> At this point it satisfies the requirements of a Container Application > that > >> contains the module(jar) as part of it.( Please correct me if I have > >> deviated) > >> > >> *Project:test-application-1* > >> *Description: Will be one of the applications. Provides Tab(s) that will > >> be associated with this app.* *Project will be built as a .jar* > >> > >> I do not have a Web Application as part of this project. I include a > >> dependency to* test-common.jar* in test-application-1's POM. (Since I > >> thought adding dependency to test-container.war did not seem sensible, > >> correct me if I am wrong.) One of the panel class in this application > >> implements the test-common's createAppTab interface and add's the > returned > >> ITab instance into a List. The List is added into an instance of > >> TabbedPanel. The instance of TabbedPanel is added into the Panel. I have > a > >> corresponding basic markup for this Panel class. > >> > >> *Re-Visit test-container* > >> I modified the test-container's POM to include test-application-1 as a > >> dependency(jar) and built it into a .WAR. The war now contains two jars > *test-common.jar > >>
Re: inconsistency in property expression when using . for self reference
Please attach to a JIRA [https://issues.apache.org/jira/browse/WICKET] so that it doesn't get lost. On Thu, Jun 17, 2010 at 4:13 PM, Joseph Pachod wrote: > hi > > Let's consider this class : > class Container { > String string = "foo"; > > List strings = Arrays.asList(new String[]{"test"}); > } > > This would work: > new PropertyModel(container, ".string").getObject() > => returns "foo" > > but this doesn't: > new PropertyModel(container, ".strings[0]").getObject() > it fails with > org.apache.wicket.WicketRuntimeException: no get method defined for class: > class org.demo.PropertyModelTest$Container expression: strings > > Similarly, this doesn't work: > new PropertyModel(container, ".").getObject() > exception is :java.lang.StringIndexOutOfBoundsException: String index out > of range: 0 > > > In the end, should the dot being allowed for self reference ? It's already > used as the property separator, so it would be quite misleading. > > I've attached some proper junit test for these points. > > ++ > joseph > > > > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > -- Jeremy Thomerson http://www.wickettraining.com
Confirmation dialog during file upload
Hello, I have a form which allows a user to upload a file. The form is patterned after upload Wicket example. If the file being uploaded will overwrite an existing file I need to prompt the user if they want to replace the existing file or not. What's the best way to implement this functionality? Thanks - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: ResourceStreamLocator and mvn resource:resource copying resources in the right directory
If you haven't customized the resource locator your telling wicket to look sibling directory to your classpath root WEB-INF/classes which "I THINK" is where wicket will start looking for resources. It may be easier to use the build helper plugin which handles resources much better than maven does on it's own. On Thu, Jun 17, 2010 at 3:31 PM, Fernando Wermus wrote: > Hi all, >I need to change the development enviroment for > >IResourceStreamLocator locator = >new ResourceStreamLocator(new Path(new Folder("html"))); > getResourceSettings().setResourceStreamLocator(locator); > > but, what I also need is that maven copy the resources form > src/main/resources to src/main/WEB-INF/html. This is needed because when > maven creates the war file the resources should also be located in that > directory. > > I've tried > > > org.apache.maven.plugins > maven-resources-plugin > 2.4.1 > > > copy-package-config > package > > copy-resources > > > ${basedir}/html > > > > ${basedir}/src/main/resources > > true > > > > > > > > and I got > > [1] Inside the definition for plugin 'maven-resources-plugin' specify the > following: > > > ... > VALUE > . > > > I don't know what else to do > > thanks in advance > -- > Fernando Wermus. > > www.linkedin.com/in/fernandowermus >
Re: modalWindow can not be closed
i have set a breakpoint on modalWindow.close(target) ,, it reached ,but modalWindow still could not be closed ,is there any other suggestion? 2010/6/18 > Hi, > > Not sure if there is any kind of exception thrown within your code, if any > other than UnsupportedEncodingException, the modalWindow.close(target) is > not reachable. > You can try to place it into the final block. > > Best Regards, > Aaron Wang > OLL DCS - OCHL/ZHA > *(86-756)3396170 *aaron.w...@oocl.com > > > -Original Message- > From: 蔡茂昌 [mailto:caimaochang.c...@gmail.com] > Sent: Thursday, June 17, 2010 3:24 PM > To: users@wicket.apache.org > Subject: modalWindow can not be closed > > there is some error in the last email i send, here is real code > > AjaxButton saveBtn = new AjaxButton("save") { > @Override > protected void onSubmit(AjaxRequestTarget target, Form form) { > >List list3 = > peopleService.fetchBySearchCondition(searchCondition); >List resultList = doTransLate(list3); >File file = peopleService.exportExcelFile(resultList,formModel); >IResourceStream is = new FileResourceStream(file); >try { > if (((WebRequest) getRequest()).getHttpServletRequest() > .getHeader("User-Agent").toLowerCase().indexOf( > "firefox") > 0) { > getRequestCycle() >.setRequestTarget( > new ResourceStreamRequestTarget(is) >.setFileName(new String(file > .getName().getBytes( >"UTF-8"), > "ISO8859_1"))); > } else { > getRequestCycle().setRequestTarget( >new ResourceStreamRequestTarget(is) > .setFileName(URLEncoder.encode( >file.getName(), "UTF-8") >.replace("+", "%20"))); > } >} catch (UnsupportedEncodingException e) { > e.printStackTrace(); >} >modalWindow.close(target); > } > @Override > protected void onError(AjaxRequestTarget target, Form form) { >target.addComponent(feedbackPanel); > } > }; > form.add(saveBtn); > > thanks > > --jans > > IMPORTANT NOTICE > Email from OOCL is confidential and may be legally privileged. If it is > not > intended for you, please delete it immediately unread. The internet > cannot guarantee that this communication is free of viruses, interception > or interference and anyone who communicates with us by email is taken > to accept the risks in doing so. Without limitation, OOCL and its > affiliates > accept no liability whatsoever and howsoever arising in connection with > the use of this email. Under no circumstances shall this email constitute > a binding agreement to carry or for provision of carriage services by OOCL, > which is subject to the availability of carrier's equipment and vessels and > the terms and conditions of OOCL's standard bill of lading which is also > available at http://www.oocl.com. > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > >
Re: Using Wicket to build Application Portal
Hi Igor, I went through the provider-lookup mechanism and as I study the current project structure it seems to relate to the concept of Extension Mechansim.( http://java.sun.com/docs/books/tutorial/ext/basics/install.html) Am I correct? 1. the *t*est-common.jar that provides the interface to build the tabs acts as the Service.* 2. *the test-application-1.jar providing the actual implementation of the Service will be the Service Provider.* 3.* Since test-application-1.jar is within the application classpath of test-container application*, if* I added a file modified/added an entry into * *META-INF/services/org.commons.MainTabProvider 4. And add a line into this file pointing to the provider org.testapp1.provider.MainTabProvider # Provider Implementation for MainTabProvider interface 5. With # 3 and #4 implemented, can the test-container application can now reference the provider implementation to get to the tabs? So it does not directly hardcode the classes to get the tab items but gets it via the provider. Questions: 1. What *extension* or type of file would META-INF/services/org.commons.MainTabProvider be? 2. When I built sub-application using Maven I do not see the *services*folder as part of META-INF by default. How can I get that as part of the maven build? 3. Once available as part of the services directory under META-INF, how will the container application gain access to the *implementation*? Can I just say MainTabProvider.*createAppTab()? It has to somehow return the instance of the provider so wondering if there must be a lookup ? Will be great to hear from you on this, In the meantime will do my research and hope to get there Thanks Niv * * * On Fri, Jun 18, 2010 at 10:16 AM, Nivedan Nadaraj wrote: > Hi Igor > > Thank you for that. Discovery of sub-applications using the > 'provider-lookup' mechanism sounds pretty cool. > I will investigate that concept and work on it, > > The # 3. :I I guess If I work on it things will get clearer and if > something is not would bounce it off you. > > Many thanks for the valuable guidance. > > Regards > Niv > > > On Fri, Jun 18, 2010 at 4:32 AM, Igor Vaynberg wrote: > >> On Thu, Jun 17, 2010 at 3:14 AM, Nivedan Nadaraj >> wrote: >> > Hi Igor, >> > >> > I have moved a bit forward since the last email but would like your >> thoughts >> > on it. I am now able to render the top level tab from >> > t*est-application-1*and test-application-2. This is after I resolved >> > the Wicket Runtime >> > Exception. >> > >> > Now going forward, this is how I fire the classes that provide the >> > application tabs from the container application >> > >> > On the HomePage of the Container Application (for example) >> > >> > I instantiate the sub-application's tabs. >> > >> > StudyTab appStudy = new StudyTab("App1Tab"); >> > add(appStudy); >> > >> > SubjectTab appParticipants = new SubjectTab("App2Tab"); >> > add(appParticipants); >> > >> > The homepage.html contains a reference to the components App1Tab and >> App2Tab >> > >> > >> > >> > >> > So I can see that each sub-application is contributing to the top level >> > (container) menu's. Thus abstracting the details to each sub >> application. I >> > am yet to render the sub-menus for each application but I guess that is >> easy >> > since its within the context of each sub application. >> > >> > 1. I would like to get some confirmation if I am on the right path and >> is >> > this how I should fire the sub-application's entry level tabs? >> >> you are on the right track. >> >> > 2. Is there a better way ? >> >> you are doing the discovery of sub-applications manually - eg >> hardcoding it into the container project, it would be nicer if they >> were automatically discovered at runtime. you can use whatever >> discovery mechanism you want, for example you can use java's service >> provider http://java.sun.com/j2se/1.4.2/docs/guide/jar/jar.html#Service >> Provider >> >> > 3. Would like to post another question related to application context as >> > part of sub-applications? How would application 1..n have reference to >> the >> > application context? I guess will try to work it from my side in the >> > meantime. >> >> what is the application context? the instance of application? it can >> be pulled out from any wicket thread using Application.get() >> >> -igor >> > >> > Please let me know on #1 and #2 and if I have not deviated. >> > >> > Many thanks >> > Regards >> > Niv >> > >> > >> > >> > On Thu, Jun 17, 2010 at 4:21 PM, Nivedan Nadaraj > >wrote: >> > >> >> Hi Igor, >> >> >> >> I have started work on the pattern you suggested. This is what I have >> done >> >> so far but there seems to be some missing pieces when I integrate the >> tabs >> >> or try to fire them from container app, would be great to get some lead >> >> here. >> >> >> >> The Structure of the projects as follows. >> >> * >> >> Project: test-common >> >> Description: Will provide common interfaces that sub applications can >> use. >>
Re: Encoding for wicket:message tag
> We are using wicket:message tag to generate content for WAP. > > Wap is strict XML so it does not allow special characters. Is there a > way to force wicket:message tag to escape encode its message? I think you've found an enhancement opportunity for Wicket. You may file an enhancement request for it. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
SV: Dynamic Resources, Properties
> add(new Label("weatherMessage", new > StringResourceModel("weather.message", this, null))); If you put a property weather.message into the page's properties file then it will load from there (even if you provide a "default" in the panel's properties file). Is that what you mean? Properties are only read once no matter where they are resolved from. - Tor Iver - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Confirmation dialog during file upload
> I have a form which allows a user to upload a file. The form is > patterned after upload Wicket example. > > If the file being uploaded will overwrite an existing file I need to > prompt the user if they want to replace the existing file or not. > What's the best way to implement this functionality? There is nothing special about it. Just display a confirmation page. Only if the user chooses to go ahead, will it save the file. Below is an example doing that written in Scala (as my exercise in learning Scala): class MyPage extends WebPage { val f = new Form[Unit]("f") { override def onSubmit = { val exists = true if (exists) { setResponsePage(new ConfirmSavePage(upload.getFileUpload)) } else { Console.println("saving the file "+upload.getFileUpload.getClientFileName) } } } add(f) val upload = new FileUploadField("upload") f.add(upload) } class ConfirmSavePage(upload: FileUpload) extends WebPage { val f = new Form[Unit]("f") { override def onSubmit = { Console.println("saving the file "+upload.getClientFileName) } } add(f) val cancel = new Button("cancel") { override def onSubmit = { Console.println("Aborting") setResponsePage(classOf[MyPage]) } } f.add(cancel) } - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org