Browse Source

Merge branch 'release/10.0' of https://code.fineres.com/scm/~henry.wang/design into release/10.0

zheng-1641779399395
Henry.Wang 3 years ago
parent
commit
e1d8523c51
  1. 5
      designer-base/src/main/java/com/fr/design/mainframe/share/collect/ComponentCollector.java
  2. 5
      designer-base/src/main/java/com/fr/design/notification/ui/NotificationCenterDialog.java
  3. 3
      designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java
  4. 47
      designer-form/src/main/java/com/fr/design/designer/ui/PopupDialogContext.java
  5. 17
      designer-form/src/main/java/com/fr/design/designer/ui/SelectedPopupDialog.java
  6. 4
      designer-realize/src/main/java/com/fr/poly/group/PolyBoundsGroup.java

5
designer-base/src/main/java/com/fr/design/mainframe/share/collect/ComponentCollector.java

@ -288,6 +288,8 @@ public class ComponentCollector implements XMLable {
private JSONArray getGroupingDetail() { private JSONArray getGroupingDetail() {
JSONArray ja = JSONFactory.createJSON(JSON.ARRAY); JSONArray ja = JSONFactory.createJSON(JSON.ARRAY);
try {
DefaultShareGroupManager.getInstance().refresh();
Group[] groups = DefaultShareGroupManager.getInstance().getAllGroup(); Group[] groups = DefaultShareGroupManager.getInstance().getAllGroup();
for(Group group : groups) { for(Group group : groups) {
JSONObject jo = JSONFactory.createJSON(JSON.OBJECT); JSONObject jo = JSONFactory.createJSON(JSON.OBJECT);
@ -295,6 +297,9 @@ public class ComponentCollector implements XMLable {
jo.put(CONTAIN_AMOUNT, group.getAllBindInfoList().length); jo.put(CONTAIN_AMOUNT, group.getAllBindInfoList().length);
ja.add(jo); ja.add(jo);
} }
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage());
}
return ja; return ja;
} }

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.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.notification.Notification; import com.fr.design.notification.Notification;
import com.fr.design.notification.NotificationCenter; import com.fr.design.notification.NotificationCenter;
import java.awt.BorderLayout; import java.awt.BorderLayout;
@ -119,7 +120,7 @@ public class NotificationCenterDialog extends JDialog {
if (winSize.width > screenSize.width) { if (winSize.width > screenSize.width) {
winSize.width = screenSize.width; winSize.width = screenSize.width;
} }
//这里设置位置:水平居中,竖直偏上 win.setLocation((DesignerContext.getDesignerFrame().getWidth() - winSize.width - 100 + DesignerContext.getDesignerFrame().getX()),
win.setLocation(screenSize.width - winSize.width - 90, 50); 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.ComponentAdapter;
import com.fr.design.designer.beans.events.DesignerEditor; import com.fr.design.designer.beans.events.DesignerEditor;
import com.fr.design.designer.beans.models.SelectionModel; 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.designer.ui.SelectedPopupDialog;
import com.fr.design.fun.ShareWidgetUIProcessor; import com.fr.design.fun.ShareWidgetUIProcessor;
import com.fr.design.fun.WidgetPropertyUIProvider; import com.fr.design.fun.WidgetPropertyUIProvider;
@ -778,6 +779,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
if (popup == null) { if (popup == null) {
popup = new SelectedPopupDialog(this, designer); popup = new SelectedPopupDialog(this, designer);
} }
PopupDialogContext.checkSelectedPop(this);
JFrame frame = LogMessageBar.getInstance().getLogFrame(); JFrame frame = LogMessageBar.getInstance().getLogFrame();
if (frame!= null && frame.isActive()) { if (frame!= null && frame.isActive()) {
return; return;
@ -876,6 +878,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
if (popup != null) { if (popup != null) {
popup.setVisible(false); popup.setVisible(false);
} }
PopupDialogContext.checkSelectedPop(this);
} }
public void processPopup(boolean canVisible) { 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 boolean canVisible = true;
private final XCreator creator;
public SelectedPopupDialog(XCreator creator, FormDesigner designer) { public SelectedPopupDialog(XCreator creator, FormDesigner designer) {
super(OperatingSystem.isMacos() ? new JFrame() : DesignerContext.getDesignerFrame()); super(OperatingSystem.isMacos() ? new JFrame() : DesignerContext.getDesignerFrame());
this.setUndecorated(true); this.setUndecorated(true);
this.setModal(false); this.setModal(false);
this.setFocusableWindowState(false); this.setFocusableWindowState(false);
this.creator = creator;
controlPanel = new PopupControlPanel(creator, designer); controlPanel = new PopupControlPanel(creator, designer);
this.getContentPane().add(controlPanel); this.getContentPane().add(controlPanel);
this.setSize(controlPanel.getDefaultDimension()); this.setSize(controlPanel.getDefaultDimension());
@ -44,6 +47,16 @@ public class SelectedPopupDialog extends JDialog {
return controlPanel.hasVisibleButtons(); 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) { public void setRelativeBounds(Rectangle rectangle) {
this.controlPanel.setRelativeBounds(rectangle); this.controlPanel.setRelativeBounds(rectangle);
} }
@ -55,4 +68,8 @@ public class SelectedPopupDialog extends JDialog {
public void setCanVisible(boolean canVisible) { public void setCanVisible(boolean canVisible) {
this.canVisible = canVisible; this.canVisible = canVisible;
} }
public XCreator getCreator() {
return this.creator;
}
} }

4
designer-realize/src/main/java/com/fr/poly/group/PolyBoundsGroup.java

@ -52,7 +52,7 @@ public class PolyBoundsGroup implements GroupModel {
@Override @Override
public Object getValue(int row, int column) { public Object getValue(int row, int column) {
UnitRectangle ur = block.getBounds(); UnitRectangle ur = block.getBounds();
Rectangle r = ur.toRectangle(resolution); Rectangle r = ur.toRoundRectangle(resolution);
if (column == 0) { if (column == 0) {
switch (row) { switch (row) {
case 0: case 0:
@ -83,7 +83,7 @@ public class PolyBoundsGroup implements GroupModel {
if (column == 1) { if (column == 1) {
int v = value == null ? 0 : ((Number) value).intValue(); int v = value == null ? 0 : ((Number) value).intValue();
UnitRectangle ur = block.getBounds(); UnitRectangle ur = block.getBounds();
Rectangle r = ur.toRectangle(resolution); Rectangle r = ur.toRoundRectangle(resolution);
switch (row) { switch (row) {
case 0: case 0:
r.x = v; r.x = v;

Loading…
Cancel
Save