Browse Source

Merge pull request #6496 in DESIGN/design from release/10.0 to bugfix/10.0

* commit 'eafddf1151974a17dd02643102eb742fdedde701':
  REPORT-61306 设计器缩放时,显示通知的弹窗未跟随设计器内部界面,而是固定显示在右侧
  REPORT-60887 MAC OS x电脑上 编辑按钮飘移
bugfix/10.0
superman 3 years ago
parent
commit
ed0aa27a7a
  1. 5
      designer-base/src/main/java/com/fr/design/notification/ui/NotificationCenterDialog.java
  2. 3
      designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java
  3. 47
      designer-form/src/main/java/com/fr/design/designer/ui/PopupDialogContext.java
  4. 17
      designer-form/src/main/java/com/fr/design/designer/ui/SelectedPopupDialog.java

5
designer-base/src/main/java/com/fr/design/notification/ui/NotificationCenterDialog.java

@ -2,6 +2,7 @@ package com.fr.design.notification.ui;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.notification.Notification;
import com.fr.design.notification.NotificationCenter;
import java.awt.BorderLayout;
@ -119,7 +120,7 @@ public class NotificationCenterDialog extends JDialog {
if (winSize.width > screenSize.width) {
winSize.width = screenSize.width;
}
//这里设置位置:水平居中,竖直偏上
win.setLocation(screenSize.width - winSize.width - 90, 50);
win.setLocation((DesignerContext.getDesignerFrame().getWidth() - winSize.width - 100 + DesignerContext.getDesignerFrame().getX()),
DesignerContext.getDesignerFrame().getY() + winSize.height);
}
}

3
designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java

@ -11,6 +11,7 @@ import com.fr.design.designer.beans.AdapterBus;
import com.fr.design.designer.beans.ComponentAdapter;
import com.fr.design.designer.beans.events.DesignerEditor;
import com.fr.design.designer.beans.models.SelectionModel;
import com.fr.design.designer.ui.PopupDialogContext;
import com.fr.design.designer.ui.SelectedPopupDialog;
import com.fr.design.fun.ShareWidgetUIProcessor;
import com.fr.design.fun.WidgetPropertyUIProvider;
@ -778,6 +779,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
if (popup == null) {
popup = new SelectedPopupDialog(this, designer);
}
PopupDialogContext.checkSelectedPop(this);
JFrame frame = LogMessageBar.getInstance().getLogFrame();
if (frame!= null && frame.isActive()) {
return;
@ -876,6 +878,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
if (popup != null) {
popup.setVisible(false);
}
PopupDialogContext.checkSelectedPop(this);
}
public void processPopup(boolean canVisible) {

47
designer-form/src/main/java/com/fr/design/designer/ui/PopupDialogContext.java

@ -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);
}
}
}

17
designer-form/src/main/java/com/fr/design/designer/ui/SelectedPopupDialog.java

@ -25,11 +25,14 @@ public class SelectedPopupDialog extends JDialog {
private boolean canVisible = true;
private final XCreator creator;
public SelectedPopupDialog(XCreator creator, FormDesigner designer) {
super(OperatingSystem.isMacos() ? new JFrame() : DesignerContext.getDesignerFrame());
this.setUndecorated(true);
this.setModal(false);
this.setFocusableWindowState(false);
this.creator = creator;
controlPanel = new PopupControlPanel(creator, designer);
this.getContentPane().add(controlPanel);
this.setSize(controlPanel.getDefaultDimension());
@ -44,6 +47,16 @@ public class SelectedPopupDialog extends JDialog {
return controlPanel.hasVisibleButtons();
}
@Override
public void setVisible(boolean visible) {
super.setVisible(visible);
if (visible) {
PopupDialogContext.add(this);
} else {
PopupDialogContext.remove(this);
}
}
public void setRelativeBounds(Rectangle rectangle) {
this.controlPanel.setRelativeBounds(rectangle);
}
@ -55,4 +68,8 @@ public class SelectedPopupDialog extends JDialog {
public void setCanVisible(boolean canVisible) {
this.canVisible = canVisible;
}
public XCreator getCreator() {
return this.creator;
}
}

Loading…
Cancel
Save