Browse Source

Merge pull request #6505 in DESIGN/design from release/11.0 to feature/x

* commit '10b496ce277e3c045f3334e697b0993e498b6fcf':
  REPORT-61618 复用组件生成时带“-”,导致部分公式失效@Jaimme
  REPORT-59744 聚合报表块手动修改位置以后,点击空白处位置偏移
  REPORT-61708 FR11内置的组件更新替换
  REPORT-57521 切换环境的代码放到edt线程
  REPORT-57521
  REPORT-57521
  REPORT-57521 去掉websocket断开提示延迟
  REPORT-57521
  REPORT-57521 远程设计时websocket断开情况下的提示优化
  CHART-21570 大屏模板适配11.0 图表组件没有跟随主题选项
  REPORT-61900 【主题切换】主题管理页面,右下角应该改成关闭按钮,不是完成
feature/x
superman 3 years ago
parent
commit
61e4b9ab5e
  1. 2
      designer-base/src/main/java/com/fr/design/data/BasicTableDataUtils.java
  2. 42
      designer-base/src/main/java/com/fr/design/gui/icombobox/ColorSchemeComboBox.java
  3. 9
      designer-base/src/main/java/com/fr/design/mainframe/chart/mode/ChartEditContext.java
  4. 0
      designer-base/src/main/java/com/fr/design/mainframe/chart/mode/ChartEditMode.java
  5. 20
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ColorSelectBoxWithThemeStyle.java
  6. 5
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartLabelContentPane.java
  7. 3
      designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java
  8. 6
      designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartTitlePane.java
  9. 14
      designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartBaseAxisPane.java
  10. 3
      designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/gauge/VanChartGaugeDetailAxisPane.java
  11. 3
      designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartAreaBackgroundPane.java
  12. 5
      designer-chart/src/main/java/com/fr/van/chart/designer/style/datasheet/VanChartDataSheetPane.java
  13. 4
      designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterLabelContentPane.java
  14. 50
      designer-form/src/main/java/com/fr/design/mainframe/share/util/InstallComponentHelper.java
  15. 88
      designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java
  16. 4
      designer-realize/src/main/java/com/fr/poly/group/PolyBoundsGroup.java

2
designer-base/src/main/java/com/fr/design/data/BasicTableDataUtils.java

@ -11,7 +11,7 @@ import com.fr.stable.StringUtils;
* Created by hades on 2020/4/27
*/
public abstract class BasicTableDataUtils {
private static final String SEPARATOR = "-";
private static final String SEPARATOR = "_";
private static final int LEN = 2;

42
designer-base/src/main/java/com/fr/design/gui/icombobox/ColorSchemeComboBox.java

@ -8,17 +8,12 @@ import com.fr.cert.token.lang.Collections;
import com.fr.chart.base.ChartConstants;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.chart.mode.ChartEditContext;
import com.fr.general.GeneralUtils;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JLabel;
import javax.swing.JList;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
@ -27,6 +22,12 @@ import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.LinearGradientPaint;
import java.awt.geom.Rectangle2D;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* @author Bjorn
@ -69,21 +70,22 @@ public class ColorSchemeComboBox extends UIComboBox {
Iterator names = config.names();
if (preDefined) {
ColorInfo colorInfo = new ColorInfo();
List<Color> list = new ArrayList<>();
colorInfo.setColors(list);
TemplateTheme templateTheme = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getTemplateTheme();
ThemedChartSeriesColor themedChartSeriesColor = templateTheme.getChartStyle().getThemedChartSeriesColor();
if (themedChartSeriesColor.isCombineColor()) {
colorInfo.setGradient(false);
list.addAll(templateTheme.getColorScheme().getColors());
} else {
colorInfo.setGradient(true);
list.add(themedChartSeriesColor.getBeginColor());
list.add(themedChartSeriesColor.getEndColor());
if (ChartEditContext.supportTheme()) {
ColorInfo colorInfo = new ColorInfo();
List<Color> list = new ArrayList<>();
colorInfo.setColors(list);
TemplateTheme templateTheme = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getTemplateTheme();
ThemedChartSeriesColor themedChartSeriesColor = templateTheme.getChartStyle().getThemedChartSeriesColor();
if (themedChartSeriesColor.isCombineColor()) {
colorInfo.setGradient(false);
list.addAll(templateTheme.getColorScheme().getColors());
} else {
colorInfo.setGradient(true);
list.add(themedChartSeriesColor.getBeginColor());
list.add(themedChartSeriesColor.getEndColor());
}
colorSchemes.put(Toolkit.i18nText("Fine-Design_Chart_Follow_Theme"), colorInfo);
}
colorSchemes.put(Toolkit.i18nText("Fine-Design_Chart_Follow_Theme"), colorInfo);
} else {
//添加默认的方案和第一个方案
String defaultName = config.getCurrentStyle();

9
designer-chart/src/main/java/com/fr/design/mainframe/chart/mode/ChartEditContext.java → designer-base/src/main/java/com/fr/design/mainframe/chart/mode/ChartEditContext.java

@ -23,4 +23,13 @@ public class ChartEditContext {
public static boolean normalMode() {
return current == ChartEditMode.NORMAL;
}
/**
* 是否支持 主题样式 设置
*
* @return duchamp大屏模板模式 不支持
*/
public static boolean supportTheme() {
return !duchampMode();
}
}

0
designer-chart/src/main/java/com/fr/design/mainframe/chart/mode/ChartEditMode.java → designer-base/src/main/java/com/fr/design/mainframe/chart/mode/ChartEditMode.java

20
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ColorSelectBoxWithThemeStyle.java

@ -5,7 +5,7 @@ import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
import com.fr.design.mainframe.chart.mode.ChartEditContext;
import com.fr.design.style.color.ColorSelectBox;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
@ -39,18 +39,16 @@ public class ColorSelectBoxWithThemeStyle extends BasicPane {
}
private void initContent() {
double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
double[] columnSize = {f, e};
double p = TableLayout.PREFERRED;
double[] rowSize = {p, p, p};
UILabel text = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Color"), SwingConstants.LEFT);
Component[][] components = {
Component[][] components = ChartEditContext.supportTheme() ? new Component[][]{
new Component[]{text, preButton},
new Component[]{null, colorSelectBox},
} : new Component[][]{
new Component[]{text, colorSelectBox}
};
JPanel gapTableLayoutPane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize);
JPanel gapTableLayoutPane = TableLayout4VanChartHelper.createGapTableLayoutPane(components);
this.setLayout(new BorderLayout());
this.add(gapTableLayoutPane, BorderLayout.CENTER);
}
@ -66,7 +64,7 @@ public class ColorSelectBoxWithThemeStyle extends BasicPane {
private void checkPreButton() {
colorSelectBox.setVisible(preButton.getSelectedIndex() == CUSTOM);
this.setPreferredSize(preButton.getSelectedIndex() == CUSTOM ? new Dimension(0, 55) : new Dimension(0, 23));
this.setPreferredSize(ChartEditContext.supportTheme() && preButton.getSelectedIndex() == CUSTOM ? new Dimension(0, 55) : new Dimension(0, 23));
}
public String title4PopupWindow() {
@ -74,14 +72,14 @@ public class ColorSelectBoxWithThemeStyle extends BasicPane {
}
public void populate(ColorWithThemeStyle colorWithPreStyle) {
preButton.setSelectedIndex(colorWithPreStyle.isThemed() ? PREDEFINED_STYLE : CUSTOM);
preButton.setSelectedIndex(ChartEditContext.supportTheme() && colorWithPreStyle.isThemed() ? PREDEFINED_STYLE : CUSTOM);
colorSelectBox.setSelectObject(colorWithPreStyle.getColor());
checkPreButton();
}
public ColorWithThemeStyle update() {
ColorWithThemeStyle colorWithPreStyle = new ColorWithThemeStyle();
colorWithPreStyle.setThemed(preButton.getSelectedIndex() == PREDEFINED_STYLE);
colorWithPreStyle.setThemed(ChartEditContext.supportTheme() && preButton.getSelectedIndex() == PREDEFINED_STYLE);
colorWithPreStyle.setColor(colorSelectBox.getSelectObject());
return colorWithPreStyle;
}

5
designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartLabelContentPane.java

@ -1,6 +1,7 @@
package com.fr.van.chart.designer.component;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPaneWithThemeStyle;
import com.fr.design.mainframe.chart.mode.ChartEditContext;
import com.fr.plugin.chart.base.AttrTooltipContent;
import com.fr.plugin.chart.type.TextAlign;
import com.fr.van.chart.designer.style.VanChartStylePane;
@ -25,7 +26,7 @@ public class VanChartLabelContentPane extends VanChartTooltipContentPane {
}
public JPanel createCommonStylePane() {
if (isInCondition()) {
if (isInCondition() || !ChartEditContext.supportTheme()) {
return super.createCommonStylePane();
}
setTextAttrPane(new ChartTextAttrPaneWithThemeStyle());
@ -37,7 +38,7 @@ public class VanChartLabelContentPane extends VanChartTooltipContentPane {
}
public void updateTextAttr(AttrTooltipContent attrTooltipContent) {
if (isInCondition()) {
if (isInCondition() || !ChartEditContext.supportTheme()) {
super.updateTextAttr(attrTooltipContent);
return;
}

3
designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java

@ -16,6 +16,7 @@ import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.PaneTitleConstants;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPaneWithThemeStyle;
import com.fr.design.mainframe.chart.mode.ChartEditContext;
import com.fr.design.utils.gui.UIComponentUtils;
import com.fr.plugin.chart.attr.VanChartLegend;
import com.fr.plugin.chart.type.LayoutType;
@ -288,7 +289,7 @@ public class VanChartPlotLegendPane extends BasicPane {
}
private JPanel createTitleStylePane() {
textAttrPane = new ChartTextAttrPaneWithThemeStyle();
textAttrPane = ChartEditContext.supportTheme() ? new ChartTextAttrPaneWithThemeStyle() : new ChartTextAttrPane();
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Widget_Style"), textAttrPane);
}

6
designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartTitlePane.java

@ -17,8 +17,10 @@ import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.PaneTitleConstants;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPaneWithThemeStyle;
import com.fr.design.mainframe.chart.info.ChartInfoCollector;
import com.fr.design.mainframe.chart.mode.ChartEditContext;
import com.fr.design.utils.gui.UIComponentUtils;
import com.fr.plugin.chart.attr.VanChartTitle;
import com.fr.plugin.chart.vanchart.VanChart;
@ -57,7 +59,7 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane<VanChart> {
private JPanel titlePane;
private TinyFormulaPane titleContent;
private ChartTextAttrPaneWithThemeStyle textAttrPane;
private ChartTextAttrPane textAttrPane;
private UIButtonGroup<Integer> alignmentPane;
private VanChartBackgroundWithOutShadowWithRadiusPane backgroundPane;
private UIToggleButton useHtml;
@ -188,7 +190,7 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane<VanChart> {
}
private JPanel createTitleStylePane() {
textAttrPane = new ChartTextAttrPaneWithThemeStyle();
textAttrPane = ChartEditContext.supportTheme() ? new ChartTextAttrPaneWithThemeStyle() : new ChartTextAttrPane();
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Widget_Style"), textAttrPane);
}

14
designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartBaseAxisPane.java

@ -22,6 +22,7 @@ import com.fr.design.mainframe.chart.PaneTitleConstants;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPaneWithThemeStyle;
import com.fr.design.mainframe.chart.gui.style.ColorSelectBoxWithThemeStyle;
import com.fr.design.mainframe.chart.mode.ChartEditContext;
import com.fr.design.utils.gui.UIComponentUtils;
import com.fr.design.widget.FRWidgetFactory;
import com.fr.plugin.chart.attr.axis.VanChartAxis;
@ -380,10 +381,21 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
}
protected ChartTextAttrPane getChartTextAttrPane() {
return new ChartTextAttrPaneWithThemeStyle() {
return ChartEditContext.supportTheme() ? new ChartTextAttrPaneWithThemeStyle() {
protected double getEdithAreaWidth() {
return TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH;
}
} : new ChartTextAttrPane() {
@Override
protected JPanel getContentPane(JPanel buttonPane) {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH;
double[] columnSize = {f, e};
double[] rowSize = {p, p, p};
return TableLayout4VanChartHelper.createGapTableLayoutPane(getComponents(buttonPane), rowSize, columnSize);
}
};
}

3
designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/gauge/VanChartGaugeDetailAxisPane.java

@ -9,6 +9,7 @@ import com.fr.design.mainframe.chart.PaneTitleConstants;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPaneWithAuto;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPaneWithThemeStyle;
import com.fr.design.mainframe.chart.mode.ChartEditContext;
import com.fr.design.style.color.ColorSelectBox;
import com.fr.plugin.chart.attr.axis.VanChartAxis;
import com.fr.plugin.chart.attr.axis.VanChartGaugeAxis;
@ -103,7 +104,7 @@ public class VanChartGaugeDetailAxisPane extends VanChartValueAxisPane {
if (isMulti(gaugeStyle)) {
return new ChartTextAttrPaneWithAuto(FontAutoType.SIZE_AND_COLOR);
} else {
return new ChartTextAttrPaneWithThemeStyle();
return ChartEditContext.supportTheme() ? new ChartTextAttrPaneWithThemeStyle() : new ChartTextAttrPane();
}
}

3
designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartAreaBackgroundPane.java

@ -8,6 +8,7 @@ import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.PaneTitleConstants;
import com.fr.design.mainframe.chart.mode.ChartEditContext;
import com.fr.van.chart.designer.AbstractVanChartScrollPane;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.component.background.VanChartBackgroundPane;
@ -49,7 +50,7 @@ public class VanChartAreaBackgroundPane extends AbstractVanChartScrollPane<Chart
if(isPlot) {
chartBackgroundPane = new VanChartBackgroundPane();
} else {
chartBackgroundPane = new VanChartBackgroundPaneWithThemeStyle();
chartBackgroundPane = ChartEditContext.supportTheme() ? new VanChartBackgroundPaneWithThemeStyle() : new VanChartBackgroundPane();
}
double p = TableLayout.PREFERRED;

5
designer-chart/src/main/java/com/fr/van/chart/designer/style/datasheet/VanChartDataSheetPane.java

@ -12,6 +12,7 @@ import com.fr.design.mainframe.chart.PaneTitleConstants;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPaneWithThemeStyle;
import com.fr.design.mainframe.chart.info.ChartInfoCollector;
import com.fr.design.mainframe.chart.mode.ChartEditContext;
import com.fr.general.ComparatorUtils;
import com.fr.plugin.chart.VanChartAttrHelper;
import com.fr.plugin.chart.attr.plot.VanChartRectanglePlot;
@ -106,11 +107,11 @@ public class VanChartDataSheetPane extends AbstractVanChartScrollPane<Chart> {
}
protected VanChartBorderPane createBorderPanePane() {
return new VanChartBorderPaneWithPreStyle();
return ChartEditContext.supportTheme() ? new VanChartBorderPaneWithPreStyle() : new VanChartBorderPane();
}
protected ChartTextAttrPane createChartTextAttrPane() {
return new ChartTextAttrPaneWithThemeStyle();
return ChartEditContext.supportTheme() ? new ChartTextAttrPaneWithThemeStyle() : new ChartTextAttrPane();
}
@Override

4
designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterLabelContentPane.java

@ -1,6 +1,8 @@
package com.fr.van.chart.scatter;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPaneWithThemeStyle;
import com.fr.design.mainframe.chart.mode.ChartEditContext;
import com.fr.plugin.chart.base.AttrTooltipContent;
import com.fr.van.chart.designer.component.VanChartHtmlLabelPane;
import com.fr.van.chart.designer.component.VanChartHtmlLabelPaneWithBackGroundLabel;
@ -28,7 +30,7 @@ public class VanChartScatterLabelContentPane extends VanChartScatterTooltipCont
if (isInCondition()) {
return super.createCommonStylePane();
}
setTextAttrPane(new ChartTextAttrPaneWithThemeStyle());
setTextAttrPane(ChartEditContext.supportTheme() ? new ChartTextAttrPaneWithThemeStyle() : new ChartTextAttrPane());
JPanel stylePanel = new JPanel(new BorderLayout());
stylePanel.add(getTextAttrPane(), BorderLayout.CENTER);

50
designer-form/src/main/java/com/fr/design/mainframe/share/util/InstallComponentHelper.java

@ -19,9 +19,10 @@ import java.io.InputStream;
* @Date: 2020/12/4
*/
public class InstallComponentHelper {
private static final String PRE_INSTALL_PATH = "/com/fr/form/share/components";
private static final String[] PRE_INSTALL_COMPONENTS = new String[]{
private static String sharePath = ComponentPath.SHARE_PATH.path();
private static final String[] OLD_PRE_INSTALL_COMPONENTS = new String[]{
"单行指标卡.f3df58b3-4302-4cab-ab77-caaf225de60a.reu",
"分层雷达图-深色.49f8397c-e6a6-482a-acc7-46d8cec353a4.reu",
"红绿灯表格-浅色.d0466992-328a-4ccf-ad67-6cbc844d669c.reu",
@ -29,12 +30,24 @@ public class InstallComponentHelper {
"三列指标卡.61a83d18-a162-4dc3-aa57-3b954edaf82e.reu",
"透明按钮切换图表.e373e13a-3da0-4c29-91bc-9ae804241023.reu"
};
private static final String[] PRE_INSTALL_COMPONENTS = new String[]{
"三色指标卡-酷炫蓝.d96f451f-c74c-45df-b056-0906b42870c7.reu",
"刻度槽型仪表盘-酷炫蓝.982ba9a3-f38b-48df-a7ae-80fcce0d74d1.reu",
"大屏标题-酷炫蓝.35f08184-2339-4a7d-9a6a-ea5bacc6829a.reu",
"柱形折线组合图-酷炫蓝.b7d66ba1-2a51-4640-a50e-2869694b748a.reu",
"渐变柱形图-酷炫蓝.786a4e7a-22d5-4f55-a857-42e3ddd54b70.reu",
"环形饼图-酷炫蓝.c9258ee9-7dee-4f56-aa2e-31b9fd7de818.reu"
};
public static void installPreComponent() {
if (needPreInstallComponent()) {
String[] components = WorkContext.getWorkResource().list(sharePath, new ReuFilter());
String[] dirs = WorkContext.getWorkResource().list(sharePath, new DirFilter());
if (needPreInstallComponent(components, dirs)) {
installShareComponents(PRE_INSTALL_PATH, PRE_INSTALL_COMPONENTS);
} else if (needReplaceOldComponent(components, dirs)) {
clearOldComponent(OLD_PRE_INSTALL_COMPONENTS);
installShareComponents(PRE_INSTALL_PATH, PRE_INSTALL_COMPONENTS);
}
}
public static void installShareComponents(String resourcePath, String[] components) {
@ -42,18 +55,36 @@ public class InstallComponentHelper {
try {
InputStream inputStream = InstallComponentHelper.class.getResourceAsStream(StableUtils.pathJoin(resourcePath, componentPath));
byte[] data = ResourceIOUtils.inputStream2Bytes(inputStream);
WorkContext.getWorkResource().write(StableUtils.pathJoin(ComponentPath.SHARE_PATH.path(), componentPath), data);
WorkContext.getWorkResource().write(StableUtils.pathJoin(sharePath, componentPath), data);
} catch (Exception e) {
FineLoggerFactory.getLogger().error("install Component filed" + e.getMessage(), e);
}
}
}
private static boolean needPreInstallComponent() {
private static boolean needReplaceOldComponent(String[] components, String[] dirs) {
if ((dirs != null && ArrayUtils.isNotEmpty(dirs)) || (components != null && components.length != 6)) {
return false;
}
for (String componentPath : components) {
if (!ArrayUtils.contains(OLD_PRE_INSTALL_COMPONENTS, componentPath)) {
return false;
}
}
return true;
}
private static void clearOldComponent(String[] components) {
for(String componentPath : components) {
WorkContext.getWorkResource().delete(StableUtils.pathJoin(sharePath, componentPath));
}
}
private static boolean needPreInstallComponent(String[] components, String[] dirs) {
try {
//老用户或者组件库里已有组件,不预装组件
SnapChat snapChat = SnapChatFactory.createSnapChat(false, SnapChatKeys.COMPONENT);
return !snapChat.hasRead() && !hasComponentInstalled();
return !snapChat.hasRead() && !hasComponentInstalled(components, dirs);
} catch (Throwable e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
@ -63,10 +94,7 @@ public class InstallComponentHelper {
/**
* 判断是否已有组件被安装
*/
private static boolean hasComponentInstalled() {
String sharePath = ComponentPath.SHARE_PATH.path();
String[] components = WorkContext.getWorkResource().list(sharePath, new ReuFilter());
String[] dirs = WorkContext.getWorkResource().list(sharePath, new DirFilter());
private static boolean hasComponentInstalled(String[] components, String[] dirs) {
return components != null && ArrayUtils.isNotEmpty(components)
|| (dirs != null && ArrayUtils.isNotEmpty(dirs));
}

88
designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java

@ -3,11 +3,14 @@ package com.fr.design.mainframe.socketio;
import com.fr.config.RemoteConfigEvent;
import com.fr.decision.webservice.utils.DecisionServiceConstants;
import com.fr.design.DesignerEnvManager;
import com.fr.design.EnvChangeEntrance;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.env.DesignerWorkspaceInfo;
import com.fr.design.env.DesignerWorkspaceInfoContext;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.loghandler.DesignerLogger;
import com.fr.design.mainframe.share.ui.base.MouseClickListener;
import com.fr.design.mainframe.toast.DesignerToastMsgUtil;
@ -21,10 +24,16 @@ import com.fr.log.FineLoggerFactory;
import com.fr.report.RemoteDesignConstants;
import com.fr.serialization.SerializerHelper;
import com.fr.stable.ArrayUtils;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import com.fr.third.apache.log4j.spi.LoggingEvent;
import com.fr.third.org.apache.http.client.config.RequestConfig;
import com.fr.third.org.apache.http.client.methods.CloseableHttpResponse;
import com.fr.third.org.apache.http.client.methods.HttpGet;
import com.fr.third.org.apache.http.conn.ssl.NoopHostnameVerifier;
import com.fr.third.org.apache.http.conn.ssl.TrustSelfSignedStrategy;
import com.fr.third.org.apache.http.impl.client.CloseableHttpClient;
import com.fr.third.org.apache.http.impl.client.HttpClients;
import com.fr.third.org.apache.http.ssl.SSLContexts;
import com.fr.web.WebSocketConfig;
import com.fr.web.socketio.WebSocketProtocol;
@ -39,7 +48,9 @@ import io.socket.emitter.Emitter;
import javax.net.ssl.SSLContext;
import javax.swing.BorderFactory;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.UIManager;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Cursor;
@ -52,7 +63,6 @@ import java.net.URL;
import java.security.KeyStore;
import java.util.Arrays;
import java.util.Timer;
import java.util.TimerTask;
public class DesignerSocketIO {
@ -69,6 +79,7 @@ public class DesignerSocketIO {
private static Status status = Status.Disconnected;
private static Timer disConnectHintTimer = null;
private static long disConnectHintTimerDelay = 3000;
private static final int TIMEOUT = 5000;
//维护一个当前工作环境的uri列表
private static String[] uri;
//维护一个关于uri列表的计数器
@ -196,7 +207,7 @@ public class DesignerSocketIO {
private static final Emitter.Listener failRetry = new Emitter.Listener() {
@Override
public void call(Object... args) {
showConnectionLostDialog();
showSocketDisconnectToast();
printLog(args, PrintEventLogImpl.WARN, "failed args: {}");
status = Status.Disconnecting;
socket.close();
@ -235,30 +246,27 @@ public class DesignerSocketIO {
@Override
public void call(Object... objects) {
FineLoggerFactory.getLogger().info("start disConnectHintTimer");
disConnectHintTimer = new Timer();
disConnectHintTimer.schedule(new TimerTask() {
@Override
public void run() {
try {
/*
* todo 远程心跳断开不一定 socket 断开 和远程紧密相关的业务都绑定在心跳上切换成心跳断开之后进行提醒
* socket 只用推日志和通知配置变更
*/
printLog(objects, PrintEventLogImpl.ERROR, "disConnected args: {}");
if (status != Status.Disconnecting) {
showConnectionLostDialog();
}
status = Status.Disconnected;
} finally {
disConnectHintTimer.cancel();
disConnectHintTimer = null;
}
}
}, disConnectHintTimerDelay);
/*
* todo 远程心跳断开不一定 socket 断开 和远程紧密相关的业务都绑定在心跳上切换成心跳断开之后进行提醒
* socket 只用推日志和通知配置变更
*/
printLog(objects, PrintEventLogImpl.ERROR, "disConnected args: {}");
if (status != Status.Disconnecting) {
dealWithSocketDisconnect();
}
status = Status.Disconnected;
}
};
private static void showConnectionLostDialog() {
private static void dealWithSocketDisconnect() {
if (checkRPCConnect()) {
showSocketDisconnectToast();
} else {
showRPCDisconnectDialog();
}
}
private static void showSocketDisconnectToast() {
try {
UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override
@ -294,6 +302,40 @@ public class DesignerSocketIO {
return jPanel;
}
private static void showRPCDisconnectDialog() {
UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override
public void run() {
FineJOptionPane.showMessageDialog(
DesignerContext.getDesignerFrame(),
Toolkit.i18nText("Fine-Design_Basic_Remote_Disconnected"),
UIManager.getString("OptionPane.messageDialogTitle"),
JOptionPane.ERROR_MESSAGE,
UIManager.getIcon("OptionPane.errorIcon"));
EnvChangeEntrance.getInstance().chooseEnv();
}
});
}
private static boolean checkRPCConnect() {
CloseableHttpClient httpclient = HttpClients.createDefault();
WorkspaceConnectionInfo info = getConnectionInfo();
HttpGet httpGet = new HttpGet(StableUtils.pathJoin(info.getUrl(), WorkspaceConstants.CONTROLLER_PREFIX, WorkspaceConstants.VT));
RequestConfig requestConfig = RequestConfig
.custom()
.setConnectTimeout(TIMEOUT)
.setConnectionRequestTimeout(TIMEOUT)
.build();
httpGet.setConfig(requestConfig);
try {
CloseableHttpResponse response = httpclient.execute(httpGet);
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e, e.getMessage());
return false;
}
return true;
}
//配置变更监听器
private static final Emitter.Listener modifyConfig = new Emitter.Listener() {
@Override

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

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

Loading…
Cancel
Save