forked from fanruan/design
Browse Source
Merge in DESIGN/design from ~HADES/design:release/10.0 to release/10.0 * commit '6026f0d575fd41c4ce7f68da6ee22e5f63bf8e82': REPORT-60887 MAC OS x电脑上 编辑按钮飘移zheng-1641779399395
Hades
3 years ago
3 changed files with 67 additions and 0 deletions
@ -0,0 +1,47 @@
|
||||
package com.fr.design.designer.ui; |
||||
|
||||
import com.fr.design.designer.creator.XCreator; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.Iterator; |
||||
import java.util.List; |
||||
|
||||
|
||||
/** |
||||
* 把弹窗统一管理起来 防止出现异常情况下游离的弹窗 |
||||
* |
||||
* @author hades |
||||
* @version 10.0 |
||||
* Created by hades on 2021/11/02 |
||||
*/ |
||||
public class PopupDialogContext { |
||||
|
||||
private static List<SelectedPopupDialog> dialogs = new ArrayList<>(); |
||||
|
||||
public static void add(SelectedPopupDialog selectedPopupDialog) { |
||||
if (dialogs.contains(selectedPopupDialog)) { |
||||
return; |
||||
} |
||||
dialogs.add(selectedPopupDialog); |
||||
} |
||||
|
||||
public static void remove(SelectedPopupDialog selectedPopupDialog) { |
||||
dialogs.remove(selectedPopupDialog); |
||||
} |
||||
|
||||
public static void checkSelectedPop(XCreator creator) { |
||||
Iterator<SelectedPopupDialog> iterator = dialogs.iterator(); |
||||
List<SelectedPopupDialog> removedDialog = new ArrayList<>(); |
||||
while (iterator.hasNext()) { |
||||
SelectedPopupDialog dialog = iterator.next(); |
||||
if (dialog.isVisible() && creator != dialog.getCreator()) { |
||||
iterator.remove(); |
||||
removedDialog.add(dialog); |
||||
} |
||||
} |
||||
for (SelectedPopupDialog dialog : removedDialog) { |
||||
dialog.setVisible(false); |
||||
} |
||||
} |
||||
|
||||
} |
Loading…
Reference in new issue