You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Johan Compagner (JIRA)" <ji...@apache.org> on 2007/11/14 14:11:43 UTC

[jira] Closed: (WICKET-1160) AjaxEditableLabel#setModel() is broken

     [ https://issues.apache.org/jira/browse/WICKET-1160?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Johan Compagner closed WICKET-1160.
-----------------------------------

       Resolution: Fixed
    Fix Version/s: 1.3.0-rc2
         Assignee: Johan Compagner

applied

> AjaxEditableLabel#setModel() is broken
> --------------------------------------
>
>                 Key: WICKET-1160
>                 URL: https://issues.apache.org/jira/browse/WICKET-1160
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket-extensions
>            Reporter: Peter Ertl
>            Assignee: Johan Compagner
>             Fix For: 1.3.0-rc2
>
>         Attachments: AjaxEditableLabel.patch
>
>
> The following code
>             AjaxEditableLabel label = new AjaxEditableLabel("someid");
>             label.setModel(...);
> will throw an NullPointerException.
> The reason is...
> 	public final Component setModel(IModel model)
> 	{
> 		super.setModel(model);
> 		*** getLabel().setModel(model); ****
> 		getEditor().setModel(model);
> 		return this;
> 	}
> getLabel() returns null because the label is not initialized.
> I suggest the following fix:
> 	protected final Component getLabel()
> 	{
> 		return label;
> 	}
> should be changed to
> 	protected final Component getLabel()
> 	{
> 		if (label == null)
> 		{
> 			initLabelAndEditor(getParentModel());
> 		}
> 		return label;
> 	}
> this is similar to getEditor() which already initializes the component if it is null...

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.