Search in sources :

Example 1 with ModalityType

use of java.awt.Dialog.ModalityType in project vcell by virtualcell.

the class LWNamespace method getEquivalentModality.

/**
 * @param dialog not null
 * @return {@link LWModality} that best matches current dialog swing modality
 */
public static LWModality getEquivalentModality(Dialog dialog) {
    Objects.requireNonNull(dialog);
    final Logger lg = LGHolder.LG;
    ModalityType awtModality = dialog.getModalityType();
    switch(awtModality) {
        case MODELESS:
            return LWModality.MODELESS;
        case DOCUMENT_MODAL:
            return LWModality.PARENT_ONLY;
        default:
            if (lg.isEnabledFor(Level.WARN)) {
                lg.warn(ExecutionTrace.justClassName(dialog) + " titled " + dialog.getTitle() + " using unsupported modality " + awtModality);
            }
            return LWModality.PARENT_ONLY;
    }
}
Also used : Log4JLogger(org.apache.commons.logging.impl.Log4JLogger) Logger(org.apache.log4j.Logger) ModalityType(java.awt.Dialog.ModalityType)

Aggregations

ModalityType (java.awt.Dialog.ModalityType)1 Log4JLogger (org.apache.commons.logging.impl.Log4JLogger)1 Logger (org.apache.log4j.Logger)1