Browse Source

Merge remote-tracking branch 'origin/final/10.0' into final/10.0

final/10.0
Hoky 3 years ago
parent
commit
c6ff1fe5c4
  1. 11
      designer-base/src/main/java/com/fr/design/dialog/InformationWarnPane.java
  2. 4
      designer-base/src/main/java/com/fr/design/mainframe/DesktopCardPane.java
  3. 4
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  4. 42
      designer-base/src/main/java/com/fr/design/utils/LoadingUtils.java
  5. 0
      designer-base/src/main/resources/com/fr/design/images/mainframe/loading.png
  6. 4
      designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java
  7. 6
      designer-form/src/main/java/com/fr/design/mainframe/share/sort/OnlineWidgetSortType.java
  8. 7
      designer-form/src/main/java/com/fr/design/mainframe/share/util/ShareComponentUtils.java
  9. 8
      designer-realize/src/main/java/com/fr/design/mainframe/app/DesignerAppUtils.java
  10. 4
      designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java

11
designer-base/src/main/java/com/fr/design/dialog/InformationWarnPane.java

@ -37,6 +37,17 @@ public class InformationWarnPane extends JPanel{
public void show() { public void show() {
showWindow(SwingUtilities.getWindowAncestor(this)).setVisible(true); showWindow(SwingUtilities.getWindowAncestor(this)).setVisible(true);
} }
public void showOnFront() {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
AlertDialog dialog = showWindow(SwingUtilities.getWindowAncestor(InformationWarnPane.this));
dialog.setVisible(true);
dialog.toFront();
}
});
}
public InformationWarnPane(String infor, String moreInfo, String title) { public InformationWarnPane(String infor, String moreInfo, String title) {
this.title = title; this.title = title;

4
designer-base/src/main/java/com/fr/design/mainframe/DesktopCardPane.java

@ -10,9 +10,11 @@ import com.fr.design.data.BasicTableDataTreePane;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.event.TargetModifiedEvent; import com.fr.design.event.TargetModifiedEvent;
import com.fr.design.event.TargetModifiedListener; import com.fr.design.event.TargetModifiedListener;
import com.fr.design.utils.LoadingUtils;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.JLayeredPane; import javax.swing.JLayeredPane;
import javax.swing.JPanel;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Component; import java.awt.Component;
@ -31,7 +33,7 @@ public class DesktopCardPane extends BasicPane implements TargetModifiedListener
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private JTemplate<?, ?> component; private JTemplate<?, ?> component;
private TransparentPane transparentPane = new TransparentPane(); private TransparentPane transparentPane = new TransparentPane();
private OpenLoadingPane loadingPane = new OpenLoadingPane(); private JPanel loadingPane = LoadingUtils.createLoadingPane();
private OpenFailedPane failedPane = new OpenFailedPane(); private OpenFailedPane failedPane = new OpenFailedPane();
private JLayeredPane layeredPane = new JLayeredPane() { private JLayeredPane layeredPane = new JLayeredPane() {
@Override @Override

4
designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java

@ -1096,7 +1096,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
String info = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Open-New_Form_Tip"); String info = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Open-New_Form_Tip");
String moreInfo = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Server_Version_Tip_More_Info"); String moreInfo = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Server_Version_Tip_More_Info");
if (showTipPane) { if (showTipPane) {
new InformationWarnPane(info, moreInfo, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips")).show(); new InformationWarnPane(info, moreInfo, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips")).showOnFront();
} }
return true; return true;
} }
@ -1119,7 +1119,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
String infor = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Template_Version_Not_Match", DesignUtils.parseVersion(xmlDesignerVersion)); String infor = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Template_Version_Not_Match", DesignUtils.parseVersion(xmlDesignerVersion));
String moreInfo = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Server_Version_Tip_More_Info"); String moreInfo = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Server_Version_Tip_More_Info");
if (showTipPane) { if (showTipPane) {
new InformationWarnPane(infor, moreInfo, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips")).show(); new InformationWarnPane(infor, moreInfo, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips")).showOnFront();
} }
return true; return true;
} }

42
designer-base/src/main/java/com/fr/design/mainframe/OpenLoadingPane.java → designer-base/src/main/java/com/fr/design/utils/LoadingUtils.java

@ -1,35 +1,29 @@
package com.fr.design.mainframe; package com.fr.design.utils;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import javax.swing.ImageIcon;
import javax.swing.JPanel;
import java.awt.Color; import java.awt.Color;
import java.awt.Component; import java.awt.Component;
import java.awt.Container; import java.awt.Container;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.LayoutManager; import java.awt.LayoutManager;
import javax.swing.ImageIcon;
import javax.swing.JPanel;
/**
* @author hades
* @version 10.0
* Created by hades on 2021/4/9
*/
public class OpenLoadingPane extends JPanel {
private static final ImageIcon LOADING_ICON = new ImageIcon(IOUtils.readImage("/com/fr/design/images/mainframe/openloading.png")); public class LoadingUtils {
private static final ImageIcon LOADING_ICON = new ImageIcon(IOUtils.readImage("/com/fr/design/images/mainframe/loading.png"));
private static final Color TIP_COLOR = new Color(108, 174, 235); private static final Color TIP_COLOR = new Color(108, 174, 235);
private static final int Y_GAP = 50; private static final int Y_GAP = 50;
private static final int X_GAP = 10; private static final int X_GAP = 10;
private UILabel loadingLabel; public static JPanel createLoadingPane() {
private UILabel tipLabel; JPanel jPanel = new JPanel();
UILabel loadingLabel = new UILabel(LOADING_ICON);
public OpenLoadingPane() { UILabel tipLabel = new UILabel(Toolkit.i18nText("Fine-Design_Loading"));
tipLabel.setForeground(TIP_COLOR);
setLayout(new LayoutManager() { jPanel.setLayout(new LayoutManager() {
@Override @Override
public void removeLayoutComponent(Component comp) { public void removeLayoutComponent(Component comp) {
} }
@ -64,12 +58,10 @@ public class OpenLoadingPane extends JPanel {
public void addLayoutComponent(String name, Component comp) { public void addLayoutComponent(String name, Component comp) {
} }
}); });
setBackground(Color.WHITE);
loadingLabel = new UILabel(LOADING_ICON);
tipLabel = new UILabel(Toolkit.i18nText("Fine-Design_Open_Template_Loading"));
tipLabel.setForeground(TIP_COLOR);
add(loadingLabel);
add(tipLabel);
jPanel.setBackground(Color.WHITE);
jPanel.add(loadingLabel);
jPanel.add(tipLabel);
return jPanel;
} }
} }

0
designer-base/src/main/resources/com/fr/design/images/mainframe/openloading.png → designer-base/src/main/resources/com/fr/design/images/mainframe/loading.png

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

4
designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java

@ -196,7 +196,9 @@ public class FormParaWidgetPane extends JPanel {
JPanel componentsPara = new JPanel(new FlowLayout(FlowLayout.LEFT)); JPanel componentsPara = new JPanel(new FlowLayout(FlowLayout.LEFT));
WidgetOption[] chartOptions = loadChartOptions(); WidgetOption[] chartOptions = loadChartOptions();
for (WidgetOption chartOption : chartOptions) { for (WidgetOption chartOption : chartOptions) {
componentsPara.add(new ToolBarButton(chartOption)); ToolBarButton button = new ToolBarButton(chartOption);
button.setPreferredSize(new Dimension(widgetButtonWidth, widgetButtonHeight));
componentsPara.add(button);
} }
int x = COMMON_CHAR_NUM * (widgetButtonWidth + smallGAP); int x = COMMON_CHAR_NUM * (widgetButtonWidth + smallGAP);
int y = (int) Math.ceil(chartOptions.length / ((double) COMMON_CHAR_NUM)) * (widgetButtonHeight + smallGAP); int y = (int) Math.ceil(chartOptions.length / ((double) COMMON_CHAR_NUM)) * (widgetButtonHeight + smallGAP);

6
designer-form/src/main/java/com/fr/design/mainframe/share/sort/OnlineWidgetSortType.java

@ -27,7 +27,11 @@ public enum OnlineWidgetSortType implements SortType<OnlineShareWidget> {
public int compare(OnlineShareWidget o1, OnlineShareWidget o2) { public int compare(OnlineShareWidget o1, OnlineShareWidget o2) {
double t1 = getSortValue(o1, parameterMap); double t1 = getSortValue(o1, parameterMap);
double t2 = getSortValue(o2, parameterMap); double t2 = getSortValue(o2, parameterMap);
return ComparatorUtils.compareCommonType(t2, t1); // Comparator中比较double/float相等时,不允许误差. 否则会违背 "若x = y , y = z, 则x = z"的约定。
// 因为允许误差的情况下,x和y间的误差在允许范围内,被判定相等,y和间的误差在允许范围内,被判定相等,
// 但x和z间的误差可能超出允许范围,从而不相等,因此会违背上述约定。
// 产生IllegalArgumentException: Comparison method violates its general contract!
return Double.compare(t2, t1);
} }
}); });
} }

7
designer-form/src/main/java/com/fr/design/mainframe/share/util/ShareComponentUtils.java

@ -8,14 +8,11 @@ import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWTitleLayout; import com.fr.design.designer.creator.XWTitleLayout;
import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.FormSelection;
import com.fr.design.mainframe.JForm;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.form.share.SharableWidgetProvider; import com.fr.form.share.SharableWidgetProvider;
import com.fr.form.share.bean.ShareLayoutWidget; import com.fr.form.share.bean.ShareLayoutWidget;
import com.fr.form.share.constants.ComponentPath; import com.fr.form.share.constants.ComponentPath;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
@ -38,9 +35,7 @@ public class ShareComponentUtils {
public static XCreator createXCreator(Widget creatorSource, String shareId, SharableWidgetProvider provider) { public static XCreator createXCreator(Widget creatorSource, String shareId, SharableWidgetProvider provider) {
XCreator xCreator; XCreator xCreator;
if (creatorSource instanceof WCardMainBorderLayout) { if (creatorSource instanceof ShareLayoutWidget) {
xCreator = XCreatorUtils.createXCreator(creatorSource, new Dimension(500, 300));
} else if (creatorSource instanceof ShareLayoutWidget) {
xCreator = XCreatorUtils.createXCreator(((ShareLayoutWidget) creatorSource).getWidget(), new Dimension(provider.getWidth(), provider.getHeight())); xCreator = XCreatorUtils.createXCreator(((ShareLayoutWidget) creatorSource).getWidget(), new Dimension(provider.getWidth(), provider.getHeight()));
} else { } else {
xCreator = XCreatorUtils.createXCreator(creatorSource, new Dimension(provider.getWidth(), provider.getHeight())); xCreator = XCreatorUtils.createXCreator(creatorSource, new Dimension(provider.getWidth(), provider.getHeight()));

8
designer-realize/src/main/java/com/fr/design/mainframe/app/DesignerAppUtils.java

@ -8,7 +8,6 @@ import com.fr.design.extra.exe.callback.ModifyStatusCallback;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.app.PluginRemote.PluginStatus; import com.fr.design.mainframe.app.PluginRemote.PluginStatus;
import com.fr.design.ui.util.UIUtil;
import com.fr.locale.InterProviderFactory; import com.fr.locale.InterProviderFactory;
import com.fr.plugin.context.PluginMarker; import com.fr.plugin.context.PluginMarker;
import com.fr.plugin.context.PluginMarkerAdapter; import com.fr.plugin.context.PluginMarkerAdapter;
@ -27,6 +26,7 @@ import com.fr.third.guava.cache.CacheBuilder;
import com.fr.third.guava.collect.Multimap; import com.fr.third.guava.collect.Multimap;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import javax.swing.SwingUtilities;
import java.time.Duration; import java.time.Duration;
import java.util.Collection; import java.util.Collection;
import java.util.Map; import java.util.Map;
@ -167,8 +167,8 @@ public class DesignerAppUtils {
disable.clear(); disable.clear();
// 从所有未安装中过滤远程未启用的,添加到未启用列表 // 从所有未安装中过滤远程未启用的,添加到未启用列表
disable.addAll(notInstall.stream().filter(plugin -> disable.addAll(notInstall.stream().filter(plugin ->
pluginRemoteStatus.containsKey(plugin.getPluginID()) pluginRemoteStatus.containsKey(plugin.getPluginID())
&& !pluginRemoteStatus.get(plugin.getPluginID()).isRunning()) && !pluginRemoteStatus.get(plugin.getPluginID()).isRunning())
.collect(Collectors.toList())); .collect(Collectors.toList()));
// 清理未安装中所有远程安装过的插件(包含启用和未启用) // 清理未安装中所有远程安装过的插件(包含启用和未启用)
notInstall.removeIf(adapter -> pluginRemoteStatus.containsKey(adapter.getPluginID())); notInstall.removeIf(adapter -> pluginRemoteStatus.containsKey(adapter.getPluginID()));
@ -183,7 +183,7 @@ public class DesignerAppUtils {
// 试图获取多行读取错误提示并缓存待处理列表 // 试图获取多行读取错误提示并缓存待处理列表
String detail = dealWithErrorDetailMultiLineAndCache(path); String detail = dealWithErrorDetailMultiLineAndCache(path);
if (detail.length() > 0) { if (detail.length() > 0) {
UIUtil.invokeLaterIfNeeded(() -> { SwingUtilities.invokeLater(() -> {
if (WorkContext.getCurrent().isLocal()) { if (WorkContext.getCurrent().isLocal()) {
UIExpandDialog.Builder() UIExpandDialog.Builder()
.owner(DesignerContext.getDesignerFrame()) .owner(DesignerContext.getDesignerFrame())

4
designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java

@ -834,7 +834,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
//显示set和tip //显示set和tip
setCardPane.setPreferredSize(new Dimension(156, 20)); setCardPane.setPreferredSize(new Dimension(156, 20));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, VGAP); TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, VGAP);
tipCardPane.setPreferredSize(new Dimension(224, 40)); tipCardPane.setPreferredSize(new Dimension(224, 50));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 4, VGAP_INNER); TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 4, VGAP_INNER);
} else { } else {
//未定义 //未定义
@ -958,7 +958,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
//显示set和tip //显示set和tip
setCardPane.setPreferredSize(new Dimension(156, 20)); setCardPane.setPreferredSize(new Dimension(156, 20));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, VGAP); TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, VGAP);
tipCardPane.setPreferredSize(new Dimension(224, 40)); tipCardPane.setPreferredSize(new Dimension(224, 50));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 4, VGAP_INNER); TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 4, VGAP_INNER);
break; break;
case EVEN: case EVEN:

Loading…
Cancel
Save