* @param unit an <code>Unit</code> value
     * @return an <code>Image</code> value
     */
    public Image getOccupationIndicatorImage(Graphics g, Unit unit) {
        Color backgroundColor = lib.getColor(unit.getOwner());
        Color foregroundColor = getForegroundColor(backgroundColor);
        String occupationString;
        if (!freeColClient.getMyPlayer().owns(unit)) {
            occupationString = (unit.isNaval())
                ? Integer.toString(unit.getVisibleGoodsCount())
                : Messages.message("model.unit.occupation.activeNoMovesLeft");
        } else {
            occupationString = (unit.isUnderRepair())
                ? "model.unit.occupation.underRepair"
                : (unit.getTradeRoute() != null)
                ? "model.unit.occupation.inTradeRoute"
                : (unit.getDestination() != null)
                ? "model.unit.occupation.goingSomewhere"
                : (unit.getState() == Unit.UnitState.IMPROVING
                    && unit.getWorkImprovement() != null)
                ? (unit.getWorkImprovement().getType().getId()
                    + ".occupationString")
                : (unit.getState() == Unit.UnitState.ACTIVE
                    && unit.getMovesLeft() == 0)
                ? "model.unit.occupation.activeNoMovesLeft"
                : ("model.unit.occupation."
                    + unit.getState().toString().toLowerCase(Locale.US));
            occupationString = Messages.message(occupationString);
            if (unit.getState() == Unit.UnitState.FORTIFIED) {
                foregroundColor = Color.GRAY;
            }
        }

        // Lookup in the cache if the image has been generated already
        String key = "dynamic.occupationIndicator." + occupationString
            + "." + Integer.toHexString(backgroundColor.getRGB());
        Image img = (Image) ResourceManager.getImage(key,
                                                     lib.getScalingFactor());
        if (img == null) {
            img = lib.createChip(occupationString, Color.BLACK,
                                 backgroundColor, foregroundColor);
            ResourceManager.addGameMapping(key, new ImageResource(img));
        }
        return img;
    }