You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Bruno Borges (JIRA)" <ji...@apache.org> on 2007/10/31 14:54:50 UTC

[jira] Created: (WICKET-1117) FormComponent.setType should be called in setModel

FormComponent.setType should be called in setModel
--------------------------------------------------

                 Key: WICKET-1117
                 URL: https://issues.apache.org/jira/browse/WICKET-1117
             Project: Wicket
          Issue Type: Improvement
          Components: wicket
    Affects Versions: 1.3.0-beta4
         Environment: Linux
            Reporter: Bruno Borges
             Fix For: 1.3.0-beta5


The method FormComponent.setType() is called in onBeforeRender() and this will happen everytime, without having changes in the Model.
The only way I see to change the Model's Component,  is calling setModel().
So, my suggestion is to override Component.setModel in FormComponent calling super.setModel, and after that update the type.

public Component setModel(final IModel model)
{
    Component component = super.setModel(model);
    updateType();
    return component;
}

protected void updateType()
{
	if (getType() == null)
	{
		// Set the type, but only if it's not a String (see WICKET-606).
		// Otherwise, getConvertEmptyInputStringToNull() won't work.
		Class type = getModelType(getModel());
		if (!String.class.equals(type))
		{
			setType(type);
		}
	}
}

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


[jira] Closed: (WICKET-1117) FormComponent.setType is called in AbstractTextComponent.onBeforeRender

Posted by "Johan Compagner (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-1117?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Johan Compagner closed WICKET-1117.
-----------------------------------

    Resolution: Fixed

instead of getType() == null we have now !getFlag(TYPE_RESOLVED)

> FormComponent.setType is called in AbstractTextComponent.onBeforeRender
> -----------------------------------------------------------------------
>
>                 Key: WICKET-1117
>                 URL: https://issues.apache.org/jira/browse/WICKET-1117
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket
>    Affects Versions: 1.3.0-beta4
>         Environment: Linux
>            Reporter: Bruno Borges
>            Assignee: Johan Compagner
>             Fix For: 1.3.0-beta5
>
>
> The method FormComponent.setType() is called in onBeforeRender() and this will happen everytime, without having changes in the Model.
> The only way I see to change the Model's Component,  is calling setModel().
> So, my suggestion is to override Component.setModel in AsbtractTextComponent calling super.setModel, and after that update the type.
> public Component setModel(final IModel model)
> {
>     Component component = super.setModel(model);
>     updateType();
>     return component;
> }
> protected void updateType()
> {
> 	if (getType() == null)
> 	{
> 		// Set the type, but only if it's not a String (see WICKET-606).
> 		// Otherwise, getConvertEmptyInputStringToNull() won't work.
> 		Class type = getModelType(getModel());
> 		if (!String.class.equals(type))
> 		{
> 			setType(type);
> 		}
> 	}
> }

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


[jira] Assigned: (WICKET-1117) FormComponent.setType is called in AbstractTextComponent.onBeforeRender

Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-1117?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Igor Vaynberg reassigned WICKET-1117:
-------------------------------------

    Assignee: Johan Compagner

i will defer this to you. i think this is tweaking just for the sake of tweaking. what we have now is not broken, and it hasnt shown up in my profiler yet.

> FormComponent.setType is called in AbstractTextComponent.onBeforeRender
> -----------------------------------------------------------------------
>
>                 Key: WICKET-1117
>                 URL: https://issues.apache.org/jira/browse/WICKET-1117
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket
>    Affects Versions: 1.3.0-beta4
>         Environment: Linux
>            Reporter: Bruno Borges
>            Assignee: Johan Compagner
>             Fix For: 1.3.0-beta5
>
>
> The method FormComponent.setType() is called in onBeforeRender() and this will happen everytime, without having changes in the Model.
> The only way I see to change the Model's Component,  is calling setModel().
> So, my suggestion is to override Component.setModel in AsbtractTextComponent calling super.setModel, and after that update the type.
> public Component setModel(final IModel model)
> {
>     Component component = super.setModel(model);
>     updateType();
>     return component;
> }
> protected void updateType()
> {
> 	if (getType() == null)
> 	{
> 		// Set the type, but only if it's not a String (see WICKET-606).
> 		// Otherwise, getConvertEmptyInputStringToNull() won't work.
> 		Class type = getModelType(getModel());
> 		if (!String.class.equals(type))
> 		{
> 			setType(type);
> 		}
> 	}
> }

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


[jira] Commented: (WICKET-1117) FormComponent.setType is called in AbstractTextComponent.onBeforeRender

Posted by "Johan Compagner (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-1117?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12539214 ] 

Johan Compagner commented on WICKET-1117:
-----------------------------------------

yes we have to call getModel at least once before the first onRender else the model doesn't have to be there.

And looking at the code now, even if the model changes we still expect the type to be the same, but i am fine with that...
Because for the same textfield the thing that is displays can constantly change? looks weird to me.

This is only a problem when the class is a String. Those are constantly being resolved, the rest are done once.
We could set a flag, TYPE_RESOLVED and test for that instead of getType()




> FormComponent.setType is called in AbstractTextComponent.onBeforeRender
> -----------------------------------------------------------------------
>
>                 Key: WICKET-1117
>                 URL: https://issues.apache.org/jira/browse/WICKET-1117
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket
>    Affects Versions: 1.3.0-beta4
>         Environment: Linux
>            Reporter: Bruno Borges
>             Fix For: 1.3.0-beta5
>
>
> The method FormComponent.setType() is called in onBeforeRender() and this will happen everytime, without having changes in the Model.
> The only way I see to change the Model's Component,  is calling setModel().
> So, my suggestion is to override Component.setModel in AsbtractTextComponent calling super.setModel, and after that update the type.
> public Component setModel(final IModel model)
> {
>     Component component = super.setModel(model);
>     updateType();
>     return component;
> }
> protected void updateType()
> {
> 	if (getType() == null)
> 	{
> 		// Set the type, but only if it's not a String (see WICKET-606).
> 		// Otherwise, getConvertEmptyInputStringToNull() won't work.
> 		Class type = getModelType(getModel());
> 		if (!String.class.equals(type))
> 		{
> 			setType(type);
> 		}
> 	}
> }

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


[jira] Commented: (WICKET-1117) FormComponent.setType is called in AbstractTextComponent.onBeforeRender

Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-1117?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12539185 ] 

Igor Vaynberg commented on WICKET-1117:
---------------------------------------

what about compound models where the model is resolved when  getmodel() is invoked without setmodel() ever being called?

> FormComponent.setType is called in AbstractTextComponent.onBeforeRender
> -----------------------------------------------------------------------
>
>                 Key: WICKET-1117
>                 URL: https://issues.apache.org/jira/browse/WICKET-1117
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket
>    Affects Versions: 1.3.0-beta4
>         Environment: Linux
>            Reporter: Bruno Borges
>             Fix For: 1.3.0-beta5
>
>
> The method FormComponent.setType() is called in onBeforeRender() and this will happen everytime, without having changes in the Model.
> The only way I see to change the Model's Component,  is calling setModel().
> So, my suggestion is to override Component.setModel in AsbtractTextComponent calling super.setModel, and after that update the type.
> public Component setModel(final IModel model)
> {
>     Component component = super.setModel(model);
>     updateType();
>     return component;
> }
> protected void updateType()
> {
> 	if (getType() == null)
> 	{
> 		// Set the type, but only if it's not a String (see WICKET-606).
> 		// Otherwise, getConvertEmptyInputStringToNull() won't work.
> 		Class type = getModelType(getModel());
> 		if (!String.class.equals(type))
> 		{
> 			setType(type);
> 		}
> 	}
> }

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


[jira] Updated: (WICKET-1117) FormComponent.setType is called in AbstractTextComponent.onBeforeRender

Posted by "Bruno Borges (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-1117?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bruno Borges updated WICKET-1117:
---------------------------------

    Description: 
The method FormComponent.setType() is called in onBeforeRender() and this will happen everytime, without having changes in the Model.
The only way I see to change the Model's Component,  is calling setModel().
So, my suggestion is to override Component.setModel in AsbtractTextComponent calling super.setModel, and after that update the type.

public Component setModel(final IModel model)
{
    Component component = super.setModel(model);
    updateType();
    return component;
}

protected void updateType()
{
	if (getType() == null)
	{
		// Set the type, but only if it's not a String (see WICKET-606).
		// Otherwise, getConvertEmptyInputStringToNull() won't work.
		Class type = getModelType(getModel());
		if (!String.class.equals(type))
		{
			setType(type);
		}
	}
}

  was:
The method FormComponent.setType() is called in onBeforeRender() and this will happen everytime, without having changes in the Model.
The only way I see to change the Model's Component,  is calling setModel().
So, my suggestion is to override Component.setModel in FormComponent calling super.setModel, and after that update the type.

public Component setModel(final IModel model)
{
    Component component = super.setModel(model);
    updateType();
    return component;
}

protected void updateType()
{
	if (getType() == null)
	{
		// Set the type, but only if it's not a String (see WICKET-606).
		// Otherwise, getConvertEmptyInputStringToNull() won't work.
		Class type = getModelType(getModel());
		if (!String.class.equals(type))
		{
			setType(type);
		}
	}
}

        Summary: FormComponent.setType is called in AbstractTextComponent.onBeforeRender  (was: FormComponent.setType should be called in setModel)

> FormComponent.setType is called in AbstractTextComponent.onBeforeRender
> -----------------------------------------------------------------------
>
>                 Key: WICKET-1117
>                 URL: https://issues.apache.org/jira/browse/WICKET-1117
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket
>    Affects Versions: 1.3.0-beta4
>         Environment: Linux
>            Reporter: Bruno Borges
>             Fix For: 1.3.0-beta5
>
>
> The method FormComponent.setType() is called in onBeforeRender() and this will happen everytime, without having changes in the Model.
> The only way I see to change the Model's Component,  is calling setModel().
> So, my suggestion is to override Component.setModel in AsbtractTextComponent calling super.setModel, and after that update the type.
> public Component setModel(final IModel model)
> {
>     Component component = super.setModel(model);
>     updateType();
>     return component;
> }
> protected void updateType()
> {
> 	if (getType() == null)
> 	{
> 		// Set the type, but only if it's not a String (see WICKET-606).
> 		// Otherwise, getConvertEmptyInputStringToNull() won't work.
> 		Class type = getModelType(getModel());
> 		if (!String.class.equals(type))
> 		{
> 			setType(type);
> 		}
> 	}
> }

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