[[iconName]]
= `iconName()`

:Notice: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at. http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR  CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.


Every object is represented by an icon; this is based on the domain object's simple name.
The xref:vw:ROOT:about.adoc[Web UI (Wicket viewer)] searches for the image in the same package as the `.class` file for the domain object or in the `images` package.
It will find any matching name and one of the following suffixes `.png`, `.gif`, `.jpeg`, `.jpg` or `.svg`.
If none is found, then `Default.png` will be used as fallback.

The `iconName()` allows the icon that to be used to change for individual object instances.
These are usually quite subtle, for example to reflect the particular status of an object.
The value returned by the `iconName()` method is added as a suffix to the base icon name.

For example, in a todo app we can use this technique to add an overlay for todo items that have been completed:

image::reference-methods/reserved/iconName/differing.png[width="200px"]



The screenshot below shows the location of these `.png` icon files:

image::reference-methods/reserved/iconName/png-files.png[width="200px"]



The code to accomplish this is straightforward:

[source,java]
----
public class ToDoItem ... {
    public String iconName() {
        return !isComplete() ? "todo" : "done";
    }
    ...
}
----

