Re: [Wicket-user] Modelling HashSets in a CheckBoxMultipleChoice
Affirmitive, the name is the the primary key in my role table On 5/2/07, Igor Vaynberg <[EMAIL PROTECTED]> wrote: so role.tostring() is consistent and can be used as id? because that is what will be used to figure out what is selected and what is not. -igor On 5/2/07, James Perry <[EMAIL PROTECTED]> wrote: > > The default id for the roles are 'user' and 'admin', which I feel does > not need rendered to any other values. > > On 5/2/07, Igor Vaynberg < [EMAIL PROTECTED]> wrote: > > > > is there a reason you are not using a choice renderer? > > > > -igor > > > > > > On 5/2/07, James Perry < [EMAIL PROTECTED] > wrote: > > > > > > I am having problems with this CheckBoxMultipleChoice component. I > > > have converted my hashset of roles into a list but it shows the roles as > > > check boxes; rather then choice of roles needed and their roles are > > > correctly selected. I don't know how I can achieve this?!?!? > > > > > > Here is my inner class: > > > > > > public EditBorrowerForm(final String id, final Borrower > > > borrower, final List roles) > > > { > > > super(id, new CompoundPropertyModel(borrower)); > > > > > > add(new Label("firstName")); > > > add(new Label("lastName")); > > > add(new Label("email")); > > > > > > // Create a required text field that edits the > > > borrowers's password > > > final TextField password = new TextField("password"); > > > password.setRequired(true); > > > final FormComponentFeedbackBorder passwordFeedback = new > > > FormComponentFeedbackBorder( > > > "passwordFeedback"); > > > add(passwordFeedback); > > > passwordFeedback.add(password); > > > > > > add(new CheckBox("enabled")); > > > add(new CheckBox("accountExpired")); > > > add(new CheckBox("accountLocked")); > > > add(new CheckBox("credentialsExpired")); > > > > > > List newList = new ArrayList(borrower.getRoles ()); > > > > > > LOG.debug("is newList empty? " + newList.isEmpty()); > > > > > > add(new CheckBoxMultipleChoice("roles", newList)); > > > > > > } > > > > > > Your suggestion does not have any values checked. > > > > > > On 4/30/07, Eelco Hillenius < [EMAIL PROTECTED] > wrote: > > > > > > > > new ArrayList(yourSet); > > > > > > > > Eelco > > > > > > > > > > > > On 4/30/07, James Perry <[EMAIL PROTECTED] > wrote: > > > > > I am trying to model a hashset in a wicket webpage that allows > > > > to edit an > > > > > user's details. I have a hashset of the user's roles however I > > > > cannot model > > > > > them using the CheckBoxMultipleChoice component. How can I model > > > > this > > > > > hashset so roles can selected and deselected. > > > > > > > > > > Thanks in advance, > > > > > > > > > > - James > > > > > > > > > > > > > > - > > > > > This SF.net email is sponsored by DB2 Express > > > > > Download DB2 Express C - the FREE version of DB2 express and > > > > take > > > > > control of your XML. No limits. Just data. Click to get it now. > > > > > http://sourceforge.net/powerbar/db2/ > > > > > ___ > > > > > Wicket-user mailing list > > > > > Wicket-user@lists.sourceforge.net > > > > > https://lists.sourceforge.net/lists/listinfo/wicket-user > > > > > > > > > > > > > > > > > > > > > > - > > > > This SF.net email is sponsored by DB2 Express > > > > Download DB2 Express C - the FREE version of DB2 express and take > > > > control of your XML. No limits. Just data. Click to get it now. > > > > http://sourceforge.net/powerbar/db2/ > > > >
Re: [Wicket-user] Modelling HashSets in a CheckBoxMultipleChoice
The default id for the roles are 'user' and 'admin', which I feel does not need rendered to any other values. On 5/2/07, Igor Vaynberg <[EMAIL PROTECTED]> wrote: is there a reason you are not using a choice renderer? -igor On 5/2/07, James Perry <[EMAIL PROTECTED] > wrote: > > I am having problems with this CheckBoxMultipleChoice component. I have > converted my hashset of roles into a list but it shows the roles as check > boxes; rather then choice of roles needed and their roles are correctly > selected. I don't know how I can achieve this?!?!? > > Here is my inner class: > > public EditBorrowerForm(final String id, final Borrower borrower, > final List roles) > { > super(id, new CompoundPropertyModel(borrower)); > > add(new Label("firstName")); > add(new Label("lastName")); > add(new Label("email")); > > // Create a required text field that edits the borrowers's > password > final TextField password = new TextField("password"); > password.setRequired(true); > final FormComponentFeedbackBorder passwordFeedback = new > FormComponentFeedbackBorder( > "passwordFeedback"); > add(passwordFeedback); > passwordFeedback.add(password); > > add(new CheckBox("enabled")); > add(new CheckBox("accountExpired")); > add(new CheckBox("accountLocked")); > add(new CheckBox("credentialsExpired")); > > List newList = new ArrayList(borrower.getRoles ()); > > LOG.debug("is newList empty? " + newList.isEmpty()); > > add(new CheckBoxMultipleChoice("roles", newList)); > } > > Your suggestion does not have any values checked. > > On 4/30/07, Eelco Hillenius < [EMAIL PROTECTED] > wrote: > > > > new ArrayList(yourSet); > > > > Eelco > > > > > > On 4/30/07, James Perry <[EMAIL PROTECTED] > wrote: > > > I am trying to model a hashset in a wicket webpage that allows to > > edit an > > > user's details. I have a hashset of the user's roles however I > > cannot model > > > them using the CheckBoxMultipleChoice component. How can I model > > this > > > hashset so roles can selected and deselected. > > > > > > Thanks in advance, > > > > > > - James > > > > > > > > - > > > This SF.net email is sponsored by DB2 Express > > > Download DB2 Express C - the FREE version of DB2 express and take > > > control of your XML. No limits. Just data. Click to get it now. > > > http://sourceforge.net/powerbar/db2/ > > > ___ > > > Wicket-user mailing list > > > Wicket-user@lists.sourceforge.net > > > https://lists.sourceforge.net/lists/listinfo/wicket-user > > > > > > > > > > > > - > > This SF.net email is sponsored by DB2 Express > > Download DB2 Express C - the FREE version of DB2 express and take > > control of your XML. No limits. Just data. Click to get it now. > > http://sourceforge.net/powerbar/db2/ > > ___ > > Wicket-user mailing list > > Wicket-user@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/wicket-user > > > > > > - > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > ___ > Wicket-user mailing list > Wicket-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wicket-user > > - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Modelling HashSets in a CheckBoxMultipleChoice
I am having problems with this CheckBoxMultipleChoice component. I have converted my hashset of roles into a list but it shows the roles as check boxes; rather then choice of roles needed and their roles are correctly selected. I don't know how I can achieve this?!?!? Here is my inner class: public EditBorrowerForm(final String id, final Borrower borrower, final List roles) { super(id, new CompoundPropertyModel(borrower)); add(new Label("firstName")); add(new Label("lastName")); add(new Label("email")); // Create a required text field that edits the borrowers's password final TextField password = new TextField("password"); password.setRequired(true); final FormComponentFeedbackBorder passwordFeedback = new FormComponentFeedbackBorder( "passwordFeedback"); add(passwordFeedback); passwordFeedback.add(password); add(new CheckBox("enabled")); add(new CheckBox("accountExpired")); add(new CheckBox("accountLocked")); add(new CheckBox("credentialsExpired")); List newList = new ArrayList(borrower.getRoles ()); LOG.debug("is newList empty? " + newList.isEmpty()); add(new CheckBoxMultipleChoice("roles", newList)); } Your suggestion does not have any values checked. On 4/30/07, Eelco Hillenius <[EMAIL PROTECTED]> wrote: new ArrayList(yourSet); Eelco On 4/30/07, James Perry <[EMAIL PROTECTED]> wrote: > I am trying to model a hashset in a wicket webpage that allows to edit an > user's details. I have a hashset of the user's roles however I cannot model > them using the CheckBoxMultipleChoice component. How can I model this > hashset so roles can selected and deselected. > > Thanks in advance, > > - James > > - > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > ___ > Wicket-user mailing list > Wicket-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wicket-user > > - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
[Wicket-user] Modelling HashSets in a CheckBoxMultipleChoice
I am trying to model a hashset in a wicket webpage that allows to edit an user's details. I have a hashset of the user's roles however I cannot model them using the CheckBoxMultipleChoice component. How can I model this hashset so roles can selected and deselected. Thanks in advance, - James - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
[Wicket-user] Can Wicket's CheckBoxMultipleChoice model a hashset?
I am trying to create an edit form which models the hashset of roles in a CheckBoxMultipleChoice; so many roles can be selected and displayed. How can I achieve this? Here is the class that that I am modelling and the EditForm page. *Borrower.java** package libhib.model; import org.acegisecurity.GrantedAuthority; import org.acegisecurity.userdetails.UserDetails; import org.apache.commons.lang.builder.ToStringBuilder; import org.apache.commons.lang.builder.ToStringStyle; import java.io.Serializable; import java.math.BigDecimal; import java.util.HashSet; import java.util.Set; /** * User: jamesperry * Date: 20-Mar-2007 * Time: 11:48:06 */ public class Borrower implements Serializable, UserDetails { private Long id; private int version; private String firstName; private String lastName; private String password; private String confirmPassword; private String address; private String email; private BigDecimal debt; private Set roles = new HashSet(); private boolean enabled = true; private boolean accountExpired = false; private boolean accountLocked = false; private boolean credentialsExpired = false; // contains the information about the book copies currently on loan to this Borrower private Set borrows = new HashSet(); private Set reservations = new HashSet(); public Borrower() { } public Borrower(String firstName, String lastName, String password, String address, String email) { assert email != null; this.firstName = firstName; this.lastName = lastName; this.password = password; this.address = address; this.email = email; this.debt = new BigDecimal(0); } public Long getId() { return id; } @SuppressWarnings({"UNUSED_SYMBOL"}) private void setId(Long id) { this.id = id; } public int getVersion() { return version; } public void setVersion(int version) { this.version = version; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } public BigDecimal getDebt() { return debt; } public void setDebt(BigDecimal debt) { this.debt = debt; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public Set getBorrows() { return borrows; } public void setBorrows(Set borrows) { this.borrows = borrows; } public Set getReservations() { return reservations; } private void setReservations(Set reservations) { this.reservations = reservations; } public void addReservation(Reservation rsv) { reservations.add(rsv); } public void removeReservation(Reservation rsv) { reservations.remove(rsv); } public void addBorrow(Borrow bor) { borrows.add(bor); } public void removeBorrow(Borrow bor) { borrows.remove(bor); } public String getPassword() { return password; } public void setPassword(String passworld) { this.password = passworld; } public void addRole(Role role) { this.getRoles().add(role); role.getUsers().add(this); } public GrantedAuthority[] getAuthorities() { return (GrantedAuthority[]) getRoles().toArray(new GrantedAuthority[0]); } public String getUsername() { return email; } public boolean isEnabled() { return enabled; } public boolean isAccountExpired() { return accountExpired; } public boolean isAccountNonExpired() { return !isAccountExpired(); } public boolean isAccountLocked() { return accountLocked; } public boolean isAccountNonLocked() { return !isAccountLocked(); } public boolean isCredentialsExpired() { return credentialsExpired; } public boolean isCredentialsNonExpired() { return !credentialsExpired; } public void setEnabled(boolean enabled) { this.enabled = enabled; } public boolean getEnabled() { return this.enabled; } public void setAccountExpired(boolean accountExpired) { this.accountExpired = accountExpired; } public boolean getAccountExpired() { return this.accountExpired; } public void setAccountLocked(boolean accountLocked) { this.accountLocked = accountLocked; } public boolean getAccountLocked() { return this.accountLocked;
[Wicket-user] Best way to model boolean values in a Form
I am experimenting with Wicket to use it for my dissertation. I am developing a basic book library application. I am creating an edit page which edits boolen values of a borrower object (isInDebt, isAccountExpired, etc.). I tried to map it with the following code, which is an inner-class: static public final class EditBorrowerForm extends Form { /** * Constructor * * @param id *id of form * @param book *Book model */ public EditBorrowerForm(final String id, final Borrower borrower) { super(id, new CompoundPropertyModel(borrower)); add(new Label("firstName")); add(new Label("lastName")); add(new Label("email")); // Create a required text field that edits the borrowers's password final TextField password = new TextField("password"); password.setRequired(true); final FormComponentFeedbackBorder passwordFeedback = new FormComponentFeedbackBorder( "passwordFeedback"); add(passwordFeedback); passwordFeedback.add(password); add(new CheckBox("enabled")); add(new CheckBox("accountExpired")); add(new CheckBox("accountLocked")); add(new CheckBox("credentialsExpired")); } /** * Show the resulting valid edit */ public final void onSubmit() { //To do! } } The problem I am finding is that the checkbox component gets it model object value from its corresponding get..() method but I want it to get its value from is...(). Is there a way to change Wicket from getting its is..() method rather then writing a get...() method. Is this a correct approach or is there a better practise? Look forward to your advice, - James - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
[Wicket-user] Proxy Error: Wicket Library Examples
I am trying to access the wicket library examples but there is a proxy error. James - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user