Seems to have chopped of my return line, which was:
return "(less than)font style=\"background-color: " +
color + "\"(greater than)" + value + "(less than)/font(greater than)";
(less than) = <
(greater than) = >
Hope it works this time
satar wrote:
>
> So I decided that I am not experienced enough yet with Wicket or using
> inmethod DataGrid to try to do images but would like to at least change
> the background color based on an integer value. This is what I did but
> still think it is somewhat lame and probably there is a much better
> approach:
>
> For my column that contains an Integer in its model I did the following:
>
> @Override
> public boolean isEscapeMarkup() {
> return false;
> }
>
> @Override
> protected IConverter getConverter(final Class<?> varType) {
> return new IConverter() {
> //serialVersionUID.
> private static final long serialVersionUID = 1L;
>
> public Object convertToObject(String value,
> java.util.Locale locale) {
> // TODO Auto-generated method stub
> return null;
> }
>
> public String convertToString(Object value,
> java.util.Locale locale) {
>
> String color = "white";
>
> switch ((Integer) value) {
> case 0 : color = "gray";
> case 1 : color = "black";
> case 2 : color = "red";
> case 3 : color = "yellow";
> case 4 : color = "blue";
> case 5 : color = "green";
> }
> return "" + value + "";
> }
>
> };
> }
>
>
--
View this message in context:
http://www.nabble.com/A-packaged-resource-that-has-a-variable-image-based-on-component--value-tp24422634p24424855.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]