if (constants == null) { constants = type.getDeclaringClass().getEnumConstants(); }
    protected Layout getLayout(Object object, Class type) {        return new Layout() {            @Override            public HtmlComponent createComponent(Object targetObject, Class type) {                Enum enumerate = (Enum) targetObject;                                HtmlMenu menu = new HtmlMenu();                                String defaultOptionTitle = getDefaultTitle();                menu.createDefaultOption(defaultOptionTitle).setSelected(enumerate == null);                                Object[] constants = type.getEnumConstants();                for (Object object : constants) {                    Enum oneEnum = (Enum) object;                    String description = RenderUtils.getEnumString(oneEnum, getBundle());                                        HtmlMenuOption option = menu.createOption(description);                    option.setValue(oneEnum.toString());                                        if (enumerate != null && oneEnum.equals(enumerate)) {                        option.setSelected(true);                    }                }                                menu.setConverter(new EnumConverter());                menu.setTargetSlot((MetaSlotKey) getInputContext().getMetaObject().getKey());                                return menu;            }            // TODO: refactor this, probably mode to HtmlMenu, duplicate id=menu.getDefaultTitle            private String getDefaultTitle() {                if (getDefaultText() == null) {                    return RenderUtils.getResourceString("renderers.menu.default.title");                }                else {                    if (isKey()) {                        return RenderUtils.getResourceString(getBundle(), getDefaultText());                    }                    else {                        return getDefaultText();                    }                }            }                    };    }