Hi,
ReadOnlyPropertyModel will be problematic, because than the TextFiled always
has to be readonly. But I do have the need that the TextFiled only has to be
readonly in the case of vehicleType = E.
Please find again the code:
private TextField vehicleTypeField(final String id, final TBPosition position)
{
final TextField field = new TextField(id, vehicleTypeModel(position))
{
private static final long serialVersionUID = -7101271673345103957L;
@Override
public boolean isVisible()
{
return isVehicleTypeVisible();
}
@Override
protected void onDisabled(final ComponentTag tag)
{
String vehicleType = E; //only for Test
if (vehicleType.equalsIgnoreCase(E))
tag.put(readonly, readonly);
}
@Override
public boolean isEnabled()
{
// return position.getVehicleType().equalsIgnoreCase(E);
// only for test
String vehicleType = E;
return !vehicleType.equalsIgnoreCase(E);
}
};
field.add(new ValueHelperOnDoubleClickBehavior(popupPanelVehicleType,
HelperValues.VEHICLE_TYPES));
return field;
}
private IModel vehicleTypeModel(final TBPosition position)
{
return new Model()
{
private static final long serialVersionUID = 1L;
@Override
public Object getObject()
{
return position.getVehicleType();
}
@Override
public void setObject(final Object object)
{
position.setVehicleType((String) object);
}
};
}
-Ursprüngliche Nachricht-
Von: splitshade [mailto:martin.dil...@googlemail.com]
Gesendet: Donnerstag, 6. Oktober 2011 12:54
An: users@wicket.apache.org
Betreff: Re: set a TextField Componet to readonly
The interesting part is not visible in your source, the Method:
vehicleTypeModel(position)
You could use some kind of readOnlyModel here - Please check
ReadOnlyPropertyModel for example.
regards
Martin
--
View this message in context:
http://apache-wicket.1842946.n4.nabble.com/set-a-TextField-Componet-to-readonly-tp3877659p3877723.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
-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org