}
@Override
public void addModal(Component component, ModalListener listener,
Integer modalDepth) {
RootPaneContainer rootPane = getRootPaneContainer();
if (rootPane == null) {
return;
}
if (rootPane instanceof JFrame) {
Modal.addModal((JFrame) rootPane, component, listener, modalDepth);
} else if (rootPane instanceof JDialog) {
Modal.addModal((JDialog) rootPane, component, listener, modalDepth);
} else if (rootPane instanceof JInternalFrame) {
Modal
.addModal((JInternalFrame) rootPane, component, listener, modalDepth);
} else {
return;
}
List<RootPaneContainer> rootPanes = getRootPaneContainers(getGroupId());
// TODO amarrado a defaultcontroller
if (getModalGroupName() != null) {
String groupName = getModalGroupName().toLowerCase();
for (Controller controller : Application.getControllerManager().getAll()) {
if (controller.getModalGroupName() != null) {
String groupNameTemp = controller.getModalGroupName().toLowerCase();
if (groupName.equals(groupNameTemp)) {
DefaultController<?> c = (DefaultController<?>) controller;
RootPaneContainer rootPaneTemp = c.getRootPaneContainer();
if (rootPaneTemp != null
&& rootPanes.contains(rootPaneTemp) == false) {
rootPanes.add(rootPaneTemp);
}
}