Everyone, I got an answer on the IRC channel. The problem was rooted in that fact that I was trying to modify an attribute of a ListItem in a ListView and ListViews recreate list items at construction time by default.
Thanks, Philip A. Chapman wrote: > Everyone, > > I have written a subclass of AttributeModifier that I had hoped to use > to change an element's class attribute based on whether that item has > been selected. The setSelected(true) is called from a Link.onClick() > event method. However, when the page reloads, the element's class > attribute has not been modified to "selectedParameter" as I would have > expected. > > Any ideas what I am doing wrong? I do not get any errors. > > public class ReportParameterSelectionAttributeModifier extends > AttributeModifier > { > // CONSTANTS > > private static final long serialVersionUID = 1L; > public static final String SELECTED = "selectedParameter"; > public static final String UN_SELECTED = "unselectedParameter"; > > // CONSTRUCTORS > > public ReportParameterSelectionAttributeModifier() > { > super("class", true, new Model(UN_SELECTED)); > } > > // MEMBERS > > // METHODS > > public void setSelected(boolean selected) > { > // Just change what is in the model depending on whether > // the item is selected. > this.getReplaceModel().setObject( > null, selected ? SELECTED : UN_SELECTED > ); > } > } > -- Philip A. Chapman Application Development: Java, Visual Basic (MCP), PostgreSQL, MySQL, MSSQL Linux, Windows 9x, Windows NT, Windows 2000, Windows XP
signature.asc
Description: OpenPGP digital signature