Nifty and modality

Hi all,
short question: is it possible to enable modality directly to a nifty element (panel)? I am aware about the popup controller, but I don’t want to use it.

To the best of my knowledge Nifty does not have any type of modality method so you would have to write your own. Here’s a code snippet of what I’ve done that allows me to achieve this among other things:

public static void disableElement(final Element element, final boolean disable) {
    if (disable) {
    } else { element.enable(); }

    for (Element e : element.getElements()) {
        disableElement(e, disable);

Simply pass the root element to this method and that element, all child elements, children of those children and so on will be disabled or enabled. So if you’re creating your own popup window or something you could just pass the root element containing all elements you want to disable to this method then create your popup window and display it.