Re: Multiple user inputs created dynamically.
On Wed, Jan 5, 2011 at 8:59 PM, Henrique Boregio wrote: > Hello, I have a product published on a page, and users can ask the > owner of this product a question. Only the owner can then answer it. > > A product can have many questions. But each question only has one > answer, which is answered by the owner. > > What I am trying to do is have a listView listing all of the questions > users have made, and next to each one, a textField and a button for > the owner of the product to answer it. > > So, it there are 5 unanswered questions, there would be 5 different > textFields with 5 different buttons next to it. The owner would then > have the choice to answer each one of them separately. > > How can I develop this? Since I want the answer button only to refer > to the textField next to it, not the whole form, and I don't know > before hand how many textFields and buttons I will need. They would > have to be loaded dynamically, depending on the amount of new > questions that were made. > > Thanks. > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > > You can put individual forms in each listview item and that form can be just for that particular question/answer pair. -- Jeremy Thomerson http://wickettraining.com *Need a CMS for Wicket? Use Brix! http://brixcms.org*
Multiple user inputs created dynamically.
Hello, I have a product published on a page, and users can ask the owner of this product a question. Only the owner can then answer it. A product can have many questions. But each question only has one answer, which is answered by the owner. What I am trying to do is have a listView listing all of the questions users have made, and next to each one, a textField and a button for the owner of the product to answer it. So, it there are 5 unanswered questions, there would be 5 different textFields with 5 different buttons next to it. The owner would then have the choice to answer each one of them separately. How can I develop this? Since I want the answer button only to refer to the textField next to it, not the whole form, and I don't know before hand how many textFields and buttons I will need. They would have to be loaded dynamically, depending on the amount of new questions that were made. Thanks. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: [Announce] Wicket Stuff Core 1.4.15 released
Hi Martin, I appreciate your thoughts on the wicketstuff/core branching. I can see how your approach would work with their not being a stable branch (and then no need to cherry-pick commits from the main development branch). I looked back at the history and not that many people ever used the stable branch so tagging releases against the main branches directly shouldn't have any negative impact. Actually I think it will be better this way because contributing developers don't need to do anything to get their recent updates included in the new release. I've deleted the core-1.4.15.x branch and I will try out this new approach either for the 1.4.15.1 point release of the 1.4.16 release which ever comes first. Mike Hi, seems quite complicated to me (one branch too much): I'd propose to keep the number of branches low, or even very low. Branches, at least to me, are the hotspots to commit code to, the code you'd like to live on in the upstream. As wicketstuff is sort of the tail of wicket, it should try to follow wickets branching and release behavior. In wicket I see two development hotspots represented in the wicket-1.4.x and trunk (aka. wicket-1.5.x) branch. These hotspots are quite distinct. If code is committed to one of them and the same functionality is needed in the other branch, most likely an automatic merge will not do. The branches differ in the api and a patch to be merged into the other branch will need to be merged by hand. Its quite obvious to any developer that code committed to the 1.4.x will not automatically find its way into the trunk. So, I'd say, if wicketstuff wants to be the reference point for stuff for wicket, it should only carry two branches. wicketstuff-core-1.4.x with the artifact/version wicketstuff-core-1.4-SNAPSHOT depending on wicket-1.4-SNAPSHOT and trunk with the artifact/version wicketstuff-core-1.5-SNAPSHOT depending on wicket-1.5-SNAPSHOT If a release is build it should first be decided on the wicket version this release depends on. Releases depending on wicket-1.4.[1..9] should be cut from the wicketstuff-core.1.4.x branch. The release tag name and the version name should follow wickets version naming. I. e. a release depending on wicket-1.4.15 should get a tag and version of wicketstuff-1.4.15.0 If a second release depending on the same wicket version is needed it should be called wicketstuff-1.4.15.1 So basically keep the number of branches code will be committed to low and keep the naming obvious for any developer, to make it easy to decide in which branch code needs to be committed to, to make it live in the upstream. mf Am 05.01.2011 um 03:47 schrieb Michael O'Cleirigh: Hello, Following the release of wicket 1.4.15 I've cut a matching release for wicketstuff-core. This release was delayed due to the migration from sourceforge and subversion to github. The artifacts have been promoted and will be synced into the maven central repository within 1-2 hours. They can be retrieved like this: org.wicketstuff wicket-shiro 1.4.15 The release tag is here:https://github.com/wicketstuff/core/tree/wicketstuff-core-1.4.15 The core-1.4.x branch now has a pom version of 1.4.16-SNAPSHOT (https://github.com/wicketstuff/core/tree/core-1.4.x). I've created a new stable branch core-1.4.15.x and it has a pom version of 1.4.15.1-SNAPSHOT (https://github.com/wicketstuff/core/tree/core-1.4.15.x). Release Notes - WicketStuff Core - Version 1.4.15: wicket-shiro: - org.wicketstuff.shiro.component.LoginPanel$SignInForm now extends StatelessForm instead of Form - org.wicketstuff.shiro.component.LoginPanel.onSignInSucceeded now redirects to homepage using setResponsePage(getApplication().getHomePage()) instead of setResponsePage(getApplication().getSessionSettings().getPageFactory().newPage(getApplication().getHomePage())) The plan is to release a 1.4.15.1 point release within one month from today. If you commit code and/or want a release sooner let me know as one month is the worst case target. Regards, Mike - 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 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Display component feedback message once: "safety net" renders them always before
On Wed, Jan 5, 2011 at 3:12 AM, Martin Grigorov wrote: > Hi Jeremy, > > In the blog you use code as: > > > 1. final TextField name = new TextField("name", new > PropertyModel(productModel, "name")); > 2. name.setRequired(true); > 3. name.add(new FeedbackPanel("nameFeedback", new > ComponentFeedbackMessageFilter(name))); > > > I wonder what kind of .html do you use for that snippet ? > > is > not HTML valid. > > Sorry, for my fiddling criticism. I know this is not the main topic of the > blog article ;-) Thanks Martin! I copied that example from a working example that I have... but in the working example, I have a border that adds the feedback panel and a css border for errors, etc. When I hastily stripped that out, I made a mistake writing that code in WordPress. It's corrected now. Thanks again! -- Jeremy Thomerson http://wickettraining.com Need a CMS for Wicket? Use Brix! http://brixcms.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Custom IUnauthorizedComponentInstantiationListener
if you want to hide unauthorized components you should use iauthorizationstrategy and veto component's RENDER action -igor On Wed, Jan 5, 2011 at 1:42 AM, Duro wrote: > Hi, i am trying to customize the behavior, when in a page a component is > found, that the current user is not authorized to while he is authorized to > the page. This by default throws an exception and i want to change it so, > that the component is simply not displayed. So i did this: in my web > application, that is subclass of AuthenticatedWebApplication i have this > init() method: > > @Override > protected void init() { > super.init(); > // we customize the default behavior, when there is an component in > page, that > // this user can't access. Default is an exception thrown, we just > set the > // component not visible > getSecuritySettings().setUnauthorizedComponentInstantiationListener( > new IUnauthorizedComponentInstantiationListener() { > �...@override > public void onUnauthorizedInstantiation(Component > component) { > if (component instanceof Page) { > onUnauthorizedPage((Page) component); > } else { > component.detach(); > } > } > }); > } > > as i can see, if the unauthorized object is a page, than i call > onUnauthorizedPage((Page) component) which redirects to login page, else i > destroy the component. > What comes out as result is that the user after accessing protected page is > redirected to login page, logs in and is authentificated but than somehow > the session is destroyed and new is created for some reason which results in > loosing the authentication and login page is displayed again. So the user > actually can't log in and always ends only in the login page. > thanks for help in advance, Juraj > > __ > Do You Yahoo!? > Sie sind Spam leid? Yahoo! Mail verfügt über einen herausragenden Schutz > gegen Massenmails. http://mail.yahoo.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: one form - two submit buttons with different behavior
thanks all for reply, I chose martin's solution which works for me in this particular case marek On Wed, 2011-01-05 at 13:19 +0100, Marek Pribyl wrote: > hi all, > I have form with two submit buttons & want different behavior for each > button. > > submitButton: > - standard submit button > - expected "onClick" behavior: validate form & save the form's model > (implemented in form's onSubmit() method) & redirect to another page > > ajaxButton: > - AjaxButton > - expected "onClick" behavior: validate form, if valid get form's model > & display it as XML in modal window for preview > > the problem is that form's onSubmit() is called when I click on > ajaxButton - I need to keep validation but do not call form's onSubmit() > method, i.e. stay on the current form page & do not save the model. > Is there any chance to do this wicket way? > > thanks, > marek - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Using CheckGroup with a listview
try lstUsers.setReuseItems(true) (see ListView javadoc) -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Using-CheckGroup-with-a-listview-tp3175047p3175610.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: one form - two submit buttons with different behavior
Hi Marek, you could override form method 'process(IFormSubmittingComponent submittingComponent) ' checking whether submittingComponent is submitButton or ajaxButton. submitButton follows standard behavior calling super.process(...), whereas ajaxButton just call validate(). But remember that form's onSubmit() must be called anyway, so as Pedro suggested you should move onSubmit code to submitButton. hi all, I have form with two submit buttons& want different behavior for each button. submitButton: - standard submit button - expected "onClick" behavior: validate form& save the form's model (implemented in form's onSubmit() method)& redirect to another page ajaxButton: - AjaxButton - expected "onClick" behavior: validate form, if valid get form's model & display it as XML in modal window for preview the problem is that form's onSubmit() is called when I click on ajaxButton - I need to keep validation but do not call form's onSubmit() method, i.e. stay on the current form page& do not save the model. Is there any chance to do this wicket way? thanks, marek - 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: one form - two submit buttons with different behavior
You can also move all your code from form.onSubmit to the standartButton.onSubmit On Wed, Jan 5, 2011 at 10:19 AM, Marek Pribyl wrote: > hi all, > I have form with two submit buttons & want different behavior for each > button. > > submitButton: > - standard submit button > - expected "onClick" behavior: validate form & save the form's model > (implemented in form's onSubmit() method) & redirect to another page > > ajaxButton: > - AjaxButton > - expected "onClick" behavior: validate form, if valid get form's model > & display it as XML in modal window for preview > > the problem is that form's onSubmit() is called when I click on > ajaxButton - I need to keep validation but do not call form's onSubmit() > method, i.e. stay on the current form page & do not save the model. > Is there any chance to do this wicket way? > > thanks, > marek > > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > > -- Pedro Henrique Oliveira dos Santos
Re: one form - two submit buttons with different behavior
An idea: in Form#onSubmit() check whether the current request is Ajax: if (AjaxRequestTarget.get() != null) return; // i.e. do not execute the method' body You can even check whether the submittingComponent is the AjaxButton and do nothing in that case only On Wed, Jan 5, 2011 at 1:19 PM, Marek Pribyl wrote: > hi all, > I have form with two submit buttons & want different behavior for each > button. > > submitButton: > - standard submit button > - expected "onClick" behavior: validate form & save the form's model > (implemented in form's onSubmit() method) & redirect to another page > > ajaxButton: > - AjaxButton > - expected "onClick" behavior: validate form, if valid get form's model > & display it as XML in modal window for preview > > the problem is that form's onSubmit() is called when I click on > ajaxButton - I need to keep validation but do not call form's onSubmit() > method, i.e. stay on the current form page & do not save the model. > Is there any chance to do this wicket way? > > thanks, > marek > > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > >
one form - two submit buttons with different behavior
hi all, I have form with two submit buttons & want different behavior for each button. submitButton: - standard submit button - expected "onClick" behavior: validate form & save the form's model (implemented in form's onSubmit() method) & redirect to another page ajaxButton: - AjaxButton - expected "onClick" behavior: validate form, if valid get form's model & display it as XML in modal window for preview the problem is that form's onSubmit() is called when I click on ajaxButton - I need to keep validation but do not call form's onSubmit() method, i.e. stay on the current form page & do not save the model. Is there any chance to do this wicket way? thanks, marek - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: [Announce] Wicket Stuff Core 1.4.15 released
Hi, seems quite complicated to me (one branch too much): I'd propose to keep the number of branches low, or even very low. Branches, at least to me, are the hotspots to commit code to, the code you'd like to live on in the upstream. As wicketstuff is sort of the tail of wicket, it should try to follow wickets branching and release behavior. In wicket I see two development hotspots represented in the wicket-1.4.x and trunk (aka. wicket-1.5.x) branch. These hotspots are quite distinct. If code is committed to one of them and the same functionality is needed in the other branch, most likely an automatic merge will not do. The branches differ in the api and a patch to be merged into the other branch will need to be merged by hand. Its quite obvious to any developer that code committed to the 1.4.x will not automatically find its way into the trunk. So, I'd say, if wicketstuff wants to be the reference point for stuff for wicket, it should only carry two branches. wicketstuff-core-1.4.x with the artifact/version wicketstuff-core-1.4-SNAPSHOT depending on wicket-1.4-SNAPSHOT and trunk with the artifact/version wicketstuff-core-1.5-SNAPSHOT depending on wicket-1.5-SNAPSHOT If a release is build it should first be decided on the wicket version this release depends on. Releases depending on wicket-1.4.[1..9] should be cut from the wicketstuff-core.1.4.x branch. The release tag name and the version name should follow wickets version naming. I. e. a release depending on wicket-1.4.15 should get a tag and version of wicketstuff-1.4.15.0 If a second release depending on the same wicket version is needed it should be called wicketstuff-1.4.15.1 So basically keep the number of branches code will be committed to low and keep the naming obvious for any developer, to make it easy to decide in which branch code needs to be committed to, to make it live in the upstream. mf Am 05.01.2011 um 03:47 schrieb Michael O'Cleirigh: > Hello, > > Following the release of wicket 1.4.15 I've cut a matching release for > wicketstuff-core. This release was delayed due to the migration from > sourceforge and subversion to github. > > The artifacts have been promoted and will be synced into the maven central > repository within 1-2 hours. > > They can be retrieved like this: > > > org.wicketstuff > wicket-shiro > 1.4.15 > > > The release tag is here: > https://github.com/wicketstuff/core/tree/wicketstuff-core-1.4.15 > > The core-1.4.x branch now has a pom version of 1.4.16-SNAPSHOT > (https://github.com/wicketstuff/core/tree/core-1.4.x). > > I've created a new stable branch core-1.4.15.x and it has a pom version of > 1.4.15.1-SNAPSHOT (https://github.com/wicketstuff/core/tree/core-1.4.15.x). > > Release Notes - WicketStuff Core - Version 1.4.15: > > wicket-shiro: >- org.wicketstuff.shiro.component.LoginPanel$SignInForm now extends > StatelessForm instead of Form >- org.wicketstuff.shiro.component.LoginPanel.onSignInSucceeded now > redirects to homepage using >setResponsePage(getApplication().getHomePage()) >instead of > > setResponsePage(getApplication().getSessionSettings().getPageFactory().newPage(getApplication().getHomePage())) > > > The plan is to release a 1.4.15.1 point release within one month from today. > If you commit code and/or want a release sooner let me know as one month is > the worst case target. > > Regards, > > Mike > > > > > - > 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: Using CheckGroup with a listview
ok. let me create a quickstart. Josh. On Wed, Jan 5, 2011 at 2:20 PM, Pedro Santos wrote: > Hi Josh, u are right, you code looks good also, can you provide an > quickstart? > > On Wed, Jan 5, 2011 at 8:32 AM, Josh Kamau wrote: > > > Pedros > > > > The CheckGroup component is part of a form that users > > CompoundPropertyModel. > > I thought i dont have to pass any thing to the constractor other than the > > id. > > > > i have however changed the constructor of CheckGroup to new > > CheckGroup("users", project.getUsers()); and it still hasnt worked. I > have > > also ensured that all my models override the Equals and HashCode methods. > > > > Josh. > > > > > > > > On Wed, Jan 5, 2011 at 1:15 PM, Pedro Santos > wrote: > > > > > On Wed, Jan 5, 2011 at 7:21 AM, Josh Kamau > > wrote: > > > > > > > Hi guys; > > > > > > > > I am trying to use a CheckGroup component in a form with a ListView > to > > > > generate a list of checks. Now, everytime i reload the page, it shows > > all > > > > the checkboxes checked instead of cheking only those that exist in > the > > > > model. Where am i going wrong? > > > > > > > > I have a Project entity that has many User entities. The form in > > question > > > > is > > > > for editing project, adding and removing users. I would like to load > > the > > > > page with all the Users but only the ones that exist in the project > are > > > > check.. I however always shows all checkboxes as checked. I have > > checked > > > > the > > > > database and the information there is correct. Where could i be going > > > > wrong? > > > > > > > > Here is the Java Code: > > > > > > > > private Form frmProject; > > > >private ListView lstUsers; > > > >private CheckGroup chbUsers ; > > > > > > > >@Inject > > > >private ProjectDao projectDao ; > > > > > > > >@Inject > > > >private UserDao userDao; > > > > > > > >public ModifyUsersPanel(String id, final Project project) { > > > >super(id); > > > > > > > >System.out.println("Project has initial " > > > > +project.getUsers().size()+ " users" ); > > > > > > > >frmProject = new Form("frmProject", new > > > > CompoundPropertyModel(project)); > > > >frmProject.setOutputMarkupId(true); > > > > > > > >chbUsers = new CheckGroup("users"); > > > > > > > > > > --> as the Check is being created as: new Check("checkbox", > > > item.getModel()) > > > you need to specify the selected users collection to CheckGroup, you > can > > > pass it as parameter > > > > > > > > > >chbUsers.add(new AjaxFormChoiceComponentUpdatingBehavior(){ > > > > > > > >@Override > > > >protected void onUpdate(AjaxRequestTarget target) { > > > >System.out.println("Project has " > > > > +project.getUsers().size()+ " users" ); > > > >projectDao.save(project); > > > >} > > > > > > > >}); > > > > > > > >lstUsers = new ListView("checkList", new > > > > LoadableDetachableModel>() { > > > > > > > >@Override > > > >protected List load() { > > > >return userDao.getAllUsers(); > > > >} > > > >}){ > > > > > > > >/** > > > > * > > > > */ > > > >private static final long serialVersionUID = 1L; > > > > > > > >@Override > > > >protected void populateItem(ListItem item) { > > > >item.add(new Check("checkbox", item.getModel())); > > > >item.add(new Label("lbFirstName", > > > > item.getModelObject().getFirstname())); > > > >item.add(new Label("lbLastName", > > > > item.getModelObject().getLastname())); > > > >} > > > > > > > >}; > > > > > > > >chbUsers.add(lstUsers); > > > >frmProject.add(chbUsers); > > > > > > > >add(frmProject); > > > >} > > > > > > > > Here is the HTML markup: > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >First Name > > > >Last Name > > > > > > > > > > > > > > > > > > > > > > > > > > > wicket:id="checkbox"> > > > >Bob > > > >Smith > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > Any help is appreciated. > > > > > > > > Kind regards. > > > > Josh. > > > > > > > > > > > > > > > > -- > > > Pedro Henrique Oliveira dos Santos > > > > > > > > > -- > Pedro Henrique Oliveira dos Santos >
Re: Using CheckGroup with a listview
Hi Josh, u are right, you code looks good also, can you provide an quickstart? On Wed, Jan 5, 2011 at 8:32 AM, Josh Kamau wrote: > Pedros > > The CheckGroup component is part of a form that users > CompoundPropertyModel. > I thought i dont have to pass any thing to the constractor other than the > id. > > i have however changed the constructor of CheckGroup to new > CheckGroup("users", project.getUsers()); and it still hasnt worked. I have > also ensured that all my models override the Equals and HashCode methods. > > Josh. > > > > On Wed, Jan 5, 2011 at 1:15 PM, Pedro Santos wrote: > > > On Wed, Jan 5, 2011 at 7:21 AM, Josh Kamau > wrote: > > > > > Hi guys; > > > > > > I am trying to use a CheckGroup component in a form with a ListView to > > > generate a list of checks. Now, everytime i reload the page, it shows > all > > > the checkboxes checked instead of cheking only those that exist in the > > > model. Where am i going wrong? > > > > > > I have a Project entity that has many User entities. The form in > question > > > is > > > for editing project, adding and removing users. I would like to load > the > > > page with all the Users but only the ones that exist in the project are > > > check.. I however always shows all checkboxes as checked. I have > checked > > > the > > > database and the information there is correct. Where could i be going > > > wrong? > > > > > > Here is the Java Code: > > > > > > private Form frmProject; > > >private ListView lstUsers; > > >private CheckGroup chbUsers ; > > > > > >@Inject > > >private ProjectDao projectDao ; > > > > > >@Inject > > >private UserDao userDao; > > > > > >public ModifyUsersPanel(String id, final Project project) { > > >super(id); > > > > > >System.out.println("Project has initial " > > > +project.getUsers().size()+ " users" ); > > > > > >frmProject = new Form("frmProject", new > > > CompoundPropertyModel(project)); > > >frmProject.setOutputMarkupId(true); > > > > > >chbUsers = new CheckGroup("users"); > > > > > > > --> as the Check is being created as: new Check("checkbox", > > item.getModel()) > > you need to specify the selected users collection to CheckGroup, you can > > pass it as parameter > > > > > > >chbUsers.add(new AjaxFormChoiceComponentUpdatingBehavior(){ > > > > > >@Override > > >protected void onUpdate(AjaxRequestTarget target) { > > >System.out.println("Project has " > > > +project.getUsers().size()+ " users" ); > > >projectDao.save(project); > > >} > > > > > >}); > > > > > >lstUsers = new ListView("checkList", new > > > LoadableDetachableModel>() { > > > > > >@Override > > >protected List load() { > > >return userDao.getAllUsers(); > > >} > > >}){ > > > > > >/** > > > * > > > */ > > >private static final long serialVersionUID = 1L; > > > > > >@Override > > >protected void populateItem(ListItem item) { > > >item.add(new Check("checkbox", item.getModel())); > > >item.add(new Label("lbFirstName", > > > item.getModelObject().getFirstname())); > > >item.add(new Label("lbLastName", > > > item.getModelObject().getLastname())); > > >} > > > > > >}; > > > > > >chbUsers.add(lstUsers); > > >frmProject.add(chbUsers); > > > > > >add(frmProject); > > >} > > > > > > Here is the HTML markup: > > > > > > > > > > > > > > > > > > > > > > > >First Name > > >Last Name > > > > > > > > > > > > > > > > > > > > wicket:id="checkbox"> > > >Bob > > >Smith > > > > > > > > > > > > > > > > > > > > > > > > > > > Any help is appreciated. > > > > > > Kind regards. > > > Josh. > > > > > > > > > > > -- > > Pedro Henrique Oliveira dos Santos > > > -- Pedro Henrique Oliveira dos Santos
Re: Using CheckGroup with a listview
Pedros The CheckGroup component is part of a form that users CompoundPropertyModel. I thought i dont have to pass any thing to the constractor other than the id. i have however changed the constructor of CheckGroup to new CheckGroup("users", project.getUsers()); and it still hasnt worked. I have also ensured that all my models override the Equals and HashCode methods. Josh. On Wed, Jan 5, 2011 at 1:15 PM, Pedro Santos wrote: > On Wed, Jan 5, 2011 at 7:21 AM, Josh Kamau wrote: > > > Hi guys; > > > > I am trying to use a CheckGroup component in a form with a ListView to > > generate a list of checks. Now, everytime i reload the page, it shows all > > the checkboxes checked instead of cheking only those that exist in the > > model. Where am i going wrong? > > > > I have a Project entity that has many User entities. The form in question > > is > > for editing project, adding and removing users. I would like to load the > > page with all the Users but only the ones that exist in the project are > > check.. I however always shows all checkboxes as checked. I have checked > > the > > database and the information there is correct. Where could i be going > > wrong? > > > > Here is the Java Code: > > > > private Form frmProject; > >private ListView lstUsers; > >private CheckGroup chbUsers ; > > > >@Inject > >private ProjectDao projectDao ; > > > >@Inject > >private UserDao userDao; > > > >public ModifyUsersPanel(String id, final Project project) { > >super(id); > > > >System.out.println("Project has initial " > > +project.getUsers().size()+ " users" ); > > > >frmProject = new Form("frmProject", new > > CompoundPropertyModel(project)); > >frmProject.setOutputMarkupId(true); > > > >chbUsers = new CheckGroup("users"); > > > > --> as the Check is being created as: new Check("checkbox", > item.getModel()) > you need to specify the selected users collection to CheckGroup, you can > pass it as parameter > > > >chbUsers.add(new AjaxFormChoiceComponentUpdatingBehavior(){ > > > >@Override > >protected void onUpdate(AjaxRequestTarget target) { > >System.out.println("Project has " > > +project.getUsers().size()+ " users" ); > >projectDao.save(project); > >} > > > >}); > > > >lstUsers = new ListView("checkList", new > > LoadableDetachableModel>() { > > > >@Override > >protected List load() { > >return userDao.getAllUsers(); > >} > >}){ > > > >/** > > * > > */ > >private static final long serialVersionUID = 1L; > > > >@Override > >protected void populateItem(ListItem item) { > >item.add(new Check("checkbox", item.getModel())); > >item.add(new Label("lbFirstName", > > item.getModelObject().getFirstname())); > >item.add(new Label("lbLastName", > > item.getModelObject().getLastname())); > >} > > > >}; > > > >chbUsers.add(lstUsers); > >frmProject.add(chbUsers); > > > >add(frmProject); > >} > > > > Here is the HTML markup: > > > > > > > > > > > > > > > >First Name > >Last Name > > > > > > > > > > > > > wicket:id="checkbox"> > >Bob > >Smith > > > > > > > > > > > > > > > > > > Any help is appreciated. > > > > Kind regards. > > Josh. > > > > > > -- > Pedro Henrique Oliveira dos Santos >
Re: Using CheckGroup with a listview
On Wed, Jan 5, 2011 at 7:21 AM, Josh Kamau wrote: > Hi guys; > > I am trying to use a CheckGroup component in a form with a ListView to > generate a list of checks. Now, everytime i reload the page, it shows all > the checkboxes checked instead of cheking only those that exist in the > model. Where am i going wrong? > > I have a Project entity that has many User entities. The form in question > is > for editing project, adding and removing users. I would like to load the > page with all the Users but only the ones that exist in the project are > check.. I however always shows all checkboxes as checked. I have checked > the > database and the information there is correct. Where could i be going > wrong? > > Here is the Java Code: > > private Form frmProject; >private ListView lstUsers; >private CheckGroup chbUsers ; > >@Inject >private ProjectDao projectDao ; > >@Inject >private UserDao userDao; > >public ModifyUsersPanel(String id, final Project project) { >super(id); > >System.out.println("Project has initial " > +project.getUsers().size()+ " users" ); > >frmProject = new Form("frmProject", new > CompoundPropertyModel(project)); >frmProject.setOutputMarkupId(true); > >chbUsers = new CheckGroup("users"); > --> as the Check is being created as: new Check("checkbox", item.getModel()) you need to specify the selected users collection to CheckGroup, you can pass it as parameter >chbUsers.add(new AjaxFormChoiceComponentUpdatingBehavior(){ > >@Override >protected void onUpdate(AjaxRequestTarget target) { >System.out.println("Project has " > +project.getUsers().size()+ " users" ); >projectDao.save(project); >} > >}); > >lstUsers = new ListView("checkList", new > LoadableDetachableModel>() { > >@Override >protected List load() { >return userDao.getAllUsers(); >} >}){ > >/** > * > */ >private static final long serialVersionUID = 1L; > >@Override >protected void populateItem(ListItem item) { >item.add(new Check("checkbox", item.getModel())); >item.add(new Label("lbFirstName", > item.getModelObject().getFirstname())); >item.add(new Label("lbLastName", > item.getModelObject().getLastname())); >} > >}; > >chbUsers.add(lstUsers); >frmProject.add(chbUsers); > >add(frmProject); >} > > Here is the HTML markup: > > > > > > > >First Name >Last Name > > > > > > wicket:id="checkbox"> >Bob >Smith > > > > > > > > > Any help is appreciated. > > Kind regards. > Josh. > -- Pedro Henrique Oliveira dos Santos
Re: Wicket web site down with a few hits
If you use some kind of Unix then run: kill -3 wrote: > > Hi Martin, > > What do you exactly mean for dump the threads? I am almost a newbie, I > cannot find any document that examplin this. > > I made a few more test logging Wicket. To have the web site going down I > need a few hits (close each other) on a bookmarkablepagelink. > > Here ( http://www.luchub.com/temp/info.txt > http://www.luchub.com/temp/info.txt ) is the log at the INFO level just as > an example. > > > After this, any other hit of the link doesn't produce any row. > > Here I link a debug level log of a 'pretty much the same' situation ( > http://www.luchub.com/temp/example.txt > http://www.luchub.com/temp/example.txt ) > > Thanks in advance > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/Wicket-web-site-down-with-a-few-hits-tp3174117p3175105.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: Wicket web site down with a few hits
Hi, thanks for the reply. Honestly I read a little bit around and using WicketServlet instead of wicketFilter is a kind of not reccomended. I would like to go for teh filter way, but thanks a lot for teh reply. Part of the reason is that I think that is impossible that a wicket app goes down because of 20 hits close each other. I'm wrong somewhere and I need you help gurus :-) If you need any other information please ask. Luca -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-web-site-down-with-a-few-hits-tp3174117p3175117.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
Custom IUnauthorizedComponentInstantiationListener
Hi, i am trying to customize the behavior, when in a page a component is found, that the current user is not authorized to while he is authorized to the page. This by default throws an exception and i want to change it so, that the component is simply not displayed. So i did this: in my web application, that is subclass of AuthenticatedWebApplication i have this init() method: @Override protected void init() { super.init(); // we customize the default behavior, when there is an component in page, that // this user can't access. Default is an exception thrown, we just set the // component not visible getSecuritySettings().setUnauthorizedComponentInstantiationListener( new IUnauthorizedComponentInstantiationListener() { @Override public void onUnauthorizedInstantiation(Component component) { if (component instanceof Page) { onUnauthorizedPage((Page) component); } else { component.detach(); } } }); } as i can see, if the unauthorized object is a page, than i call onUnauthorizedPage((Page) component) which redirects to login page, else i destroy the component. What comes out as result is that the user after accessing protected page is redirected to login page, logs in and is authentificated but than somehow the session is destroyed and new is created for some reason which results in loosing the authentication and login page is displayed again. So the user actually can't log in and always ends only in the login page. thanks for help in advance, Juraj __ Do You Yahoo!? Sie sind Spam leid? Yahoo! Mail verfügt über einen herausragenden Schutz gegen Massenmails. http://mail.yahoo.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Wicket web site down with a few hits
Hi Martin, What do you exactly mean for dump the threads? I am almost a newbie, I cannot find any document that examplin this. I made a few more test logging Wicket. To have the web site going down I need a few hits (close each other) on a bookmarkablepagelink. Here ( http://www.luchub.com/temp/info.txt http://www.luchub.com/temp/info.txt ) is the log at the INFO level just as an example. After this, any other hit of the link doesn't produce any row. Here I link a debug level log of a 'pretty much the same' situation ( http://www.luchub.com/temp/example.txt http://www.luchub.com/temp/example.txt ) Thanks in advance -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-web-site-down-with-a-few-hits-tp3174117p3175105.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
Using CheckGroup with a listview
Hi guys; I am trying to use a CheckGroup component in a form with a ListView to generate a list of checks. Now, everytime i reload the page, it shows all the checkboxes checked instead of cheking only those that exist in the model. Where am i going wrong? I have a Project entity that has many User entities. The form in question is for editing project, adding and removing users. I would like to load the page with all the Users but only the ones that exist in the project are check.. I however always shows all checkboxes as checked. I have checked the database and the information there is correct. Where could i be going wrong? Here is the Java Code: private Form frmProject; private ListView lstUsers; private CheckGroup chbUsers ; @Inject private ProjectDao projectDao ; @Inject private UserDao userDao; public ModifyUsersPanel(String id, final Project project) { super(id); System.out.println("Project has initial " +project.getUsers().size()+ " users" ); frmProject = new Form("frmProject", new CompoundPropertyModel(project)); frmProject.setOutputMarkupId(true); chbUsers = new CheckGroup("users"); chbUsers.add(new AjaxFormChoiceComponentUpdatingBehavior(){ @Override protected void onUpdate(AjaxRequestTarget target) { System.out.println("Project has " +project.getUsers().size()+ " users" ); projectDao.save(project); } }); lstUsers = new ListView("checkList", new LoadableDetachableModel>() { @Override protected List load() { return userDao.getAllUsers(); } }){ /** * */ private static final long serialVersionUID = 1L; @Override protected void populateItem(ListItem item) { item.add(new Check("checkbox", item.getModel())); item.add(new Label("lbFirstName", item.getModelObject().getFirstname())); item.add(new Label("lbLastName", item.getModelObject().getLastname())); } }; chbUsers.add(lstUsers); frmProject.add(chbUsers); add(frmProject); } Here is the HTML markup: First Name Last Name Bob Smith Any help is appreciated. Kind regards. Josh.
Re: Display component feedback message once: "safety net" renders them always before
Hi Jeremy, In the blog you use code as: 1. final TextField name = new TextField("name", new PropertyModel(productModel, "name")); 2. name.setRequired(true); 3. name.add(new FeedbackPanel("nameFeedback", new ComponentFeedbackMessageFilter(name))); I wonder what kind of .html do you use for that snippet ? is not HTML valid. Sorry, for my fiddling criticism. I know this is not the main topic of the blog article ;-) On Tue, Jan 4, 2011 at 5:13 PM, Jeremy Thomerson wrote: > On Thu, Dec 2, 2010 at 5:52 AM, Joseph Pachod wrote: > > > Hi > > > > I'm trying to apply the behaviors presented by Alastair Maw in his > > presentation Wicket Forms > > with Flair (cf > > > http://code.google.com/p/londonwicket/downloads/detail?name=LondonWicket-FormsWithFlair.pdf&can=2&q= > ) > > > > Basically, Alastair uses behavior to display feedback message specific to > > some components next to the component in question. > > > > We use our components in form with feedback panel, for non component > > specific messages. > > > > Overall, we would like these functionalities: > > A - no message should be rendered twice > > B - no message should be left unrendered (safety net) > > C - component specific message should be rendered next to their component > > D - when some messages were displayed next to their components, the > > feedback panel should display a message for it (like "one of more input > > didn't validate, please check them) > > > > In order to try to achieve that, I used the FeedbackMessage.isRendered() > > method in both the behaviors and the feedback panel > IFeedbackMessageFilter. > > > > As you've discovered, using the isRendered() method for this really is > difficult because it depends on the order of traversal. This makes it > brittle to use this for your "safety net" or "catch all" feedback panel. > > I had encountered this issue and for one of my training classes, I threw > together a solution. Your post prodded me to go ahead and post my solution > as a blog post. After dusting off my long-forgotten blog, here it is: > > http://www.jeremythomerson.com/blog/2011/01/catching-all-feedback-messages-that-arent-rendered-by-other-feedback-panels/(or > http://bit.ly/eHUEuN if that gets chopped up). > > Hopefully that helps someone. > > -- > Jeremy Thomerson > http://wickettraining.com > *Need a CMS for Wicket? Use Brix! http://brixcms.org* >