Browse Source

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

bugfix/11.0
Henry.Wang 3 years ago
parent
commit
71fa1c8dc0
  1. 42
      designer-base/src/main/java/com/fr/design/gui/icombobox/ColorSchemeComboBox.java
  2. 950
      designer-base/src/main/java/com/fr/design/javascript/ExportJavaScriptPane.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. 6
      designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeGridPagesPane.java
  6. 15
      designer-base/src/main/java/com/fr/design/mainframe/toast/DesignerToastMsgUtil.java
  7. 6
      designer-base/src/main/java/com/fr/design/mainframe/toast/ToastMsgDialog.java
  8. 20
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ColorSelectBoxWithThemeStyle.java
  9. 5
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartLabelContentPane.java
  10. 3
      designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java
  11. 6
      designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartTitlePane.java
  12. 14
      designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartBaseAxisPane.java
  13. 3
      designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/gauge/VanChartGaugeDetailAxisPane.java
  14. 3
      designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartAreaBackgroundPane.java
  15. 5
      designer-chart/src/main/java/com/fr/van/chart/designer/style/datasheet/VanChartDataSheetPane.java
  16. 4
      designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterLabelContentPane.java
  17. 50
      designer-form/src/main/java/com/fr/design/mainframe/share/util/InstallComponentHelper.java
  18. 62
      designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java

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();

950
designer-base/src/main/java/com/fr/design/javascript/ExportJavaScriptPane.java

File diff suppressed because it is too large Load Diff

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

6
designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeGridPagesPane.java

@ -139,7 +139,7 @@ public class TemplateThemeGridPagesPane extends JPanel {
public UIButton[] createRightButtons() {
UIButton[] buttons = new UIButton[] {};
buttons = ArrayUtils.addAll(buttons, createExtraButtons());
buttons = ArrayUtils.addAll(buttons, createCompleteButton());
buttons = ArrayUtils.addAll(buttons, createCloseButton());
return buttons;
}
@ -180,8 +180,8 @@ public class TemplateThemeGridPagesPane extends JPanel {
return uiButtonList.toArray(new UIButton[]{});
}
private UIButton createCompleteButton() {
UIButton button = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Manager_Dialog_Complete"));
private UIButton createCloseButton() {
UIButton button = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Manager_Dialog_Close"));
button.setName(COMPLETE_BUTTON);
button.addActionListener(new ActionListener() {
@Override

15
designer-base/src/main/java/com/fr/design/mainframe/toast/DesignerToastMsgUtil.java

@ -31,14 +31,6 @@ public class DesignerToastMsgUtil {
}
public static ToastMsgDialog createPromptDialog(String text) {
return createDialog(PROMPT_ICON, toastPane(text), DesignerContext.getDesignerFrame());
}
public static ToastMsgDialog createPromptDialog(JPanel contentPane) {
return createDialog(PROMPT_ICON, contentPane, DesignerContext.getDesignerFrame());
}
public static void toastPrompt(JPanel contendPane) {
toastPane(PROMPT_ICON, contendPane, DesignerContext.getDesignerFrame());
}
@ -76,11 +68,6 @@ public class DesignerToastMsgUtil {
}
private static void toastPane(Icon icon, JPanel contendPane, Window parent) {
ToastMsgDialog dialog = createDialog(icon, contendPane, parent);
dialog.setVisible(true);
}
private static ToastMsgDialog createDialog(Icon icon, JPanel contendPane, Window parent) {
JPanel pane = FRGUIPaneFactory.createBorderLayout_S_Pane();
UILabel uiLabel = new UILabel(icon);
uiLabel.setVerticalAlignment(SwingConstants.TOP);
@ -95,7 +82,7 @@ public class DesignerToastMsgUtil {
} else {
dialog = new ToastMsgDialog((Frame) parent, pane);
}
return dialog;
dialog.setVisible(true);
}

6
designer-base/src/main/java/com/fr/design/mainframe/toast/ToastMsgDialog.java

@ -24,7 +24,6 @@ public class ToastMsgDialog extends UIDialog {
private ScheduledExecutorService TIMER;
private int hide_height = 0;
private JPanel contentPane;
private boolean show = false;
public ToastMsgDialog(Frame parent, JPanel panel) {
super(parent);
@ -66,7 +65,6 @@ public class ToastMsgDialog extends UIDialog {
public void display(JPanel outerJPanel) {
show = true;
outerJPanel.setLocation(0, -hide_height);
ScheduledExecutorService TIP_TOOL_TIMER = createToastScheduleExecutorService();
TIP_TOOL_TIMER.scheduleAtFixedRate(new Runnable() {
@ -100,7 +98,6 @@ public class ToastMsgDialog extends UIDialog {
TIP_TOOL_TIMER.shutdown();
ToastMsgDialog.this.setVisible(false);
ToastMsgDialog.this.dispose();
ToastMsgDialog.this.show = false;
}
outerJPanel.setLocation(point.x, point.y - 5);
Dimension dimension = ToastMsgDialog.this.getSize();
@ -162,7 +159,4 @@ public class ToastMsgDialog extends UIDialog {
super.dispose();
}
public boolean isShow() {
return show;
}
}

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

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

@ -3,19 +3,15 @@ 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;
import com.fr.design.mainframe.toast.ToastMsgDialog;
import com.fr.design.ui.util.UIUtil;
import com.fr.design.utils.BrowseUtils;
import com.fr.event.EventDispatcher;
import com.fr.general.CloudCenter;
import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.report.RemoteDesignConstants;
@ -33,24 +29,20 @@ import com.fr.workspace.Workspace;
import com.fr.workspace.base.WorkspaceConstants;
import com.fr.workspace.connect.WorkspaceConnection;
import com.fr.workspace.connect.WorkspaceConnectionInfo;
import com.fr.workspace.server.socket.SocketInfoOperator;
import io.socket.client.IO;
import io.socket.client.Socket;
import io.socket.emitter.Emitter;
import javax.net.ssl.SSLContext;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Cursor;
import java.awt.event.MouseEvent;
import java.io.File;
import java.io.FileInputStream;
import java.security.KeyStore;
import java.util.Arrays;
import javax.net.ssl.SSLContext;
import javax.swing.*;
import java.io.IOException;
import java.net.URI;
import java.net.URL;
import java.security.KeyStore;
import java.util.Arrays;
import java.util.Timer;
import java.util.TimerTask;
@ -62,7 +54,6 @@ public class DesignerSocketIO {
Disconnecting
}
private static final String WEBSOCKET_HELP_DOC = CloudCenter.getInstance().acquireUrlByKind("websocketConnect", "https://help.fanruan.com/finereport/doc-view-2512.html");
private static final String HTTPS = "https";
private static final String HTTP = "http";
private static Socket socket = null;
@ -75,7 +66,6 @@ public class DesignerSocketIO {
private static int count;
// 当前webSocket选择的协议
private static String currentProtocol;
private static ToastMsgDialog dialog = null;
public static void close() {
@ -143,7 +133,7 @@ public class DesignerSocketIO {
String certPath = connection.getCertPath();
String certSecretKey = connection.getCertSecretKey();
if (StringUtils.isBlank(certPath) || StringUtils.isBlank(certSecretKey)) {
return SSLContexts.createDefault();
return SSLContexts.createDefault();
}
KeyStore trustStore = KeyStore.getInstance(KeyStore.getDefaultType());
try (FileInputStream keystore = new FileInputStream(new File(certPath))) {
@ -196,7 +186,6 @@ public class DesignerSocketIO {
private static final Emitter.Listener failRetry = new Emitter.Listener() {
@Override
public void call(Object... args) {
showConnectionLostDialog();
printLog(args, PrintEventLogImpl.WARN, "failed args: {}");
status = Status.Disconnecting;
socket.close();
@ -263,13 +252,13 @@ public class DesignerSocketIO {
UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override
public void run() {
if (dialog == null) {
dialog = DesignerToastMsgUtil.createPromptDialog(createDialogContent());
}
if (!dialog.isShow()) {
dialog.setVisible(true);
}
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();
}
});
} catch (Exception e) {
@ -277,23 +266,6 @@ public class DesignerSocketIO {
}
}
private static JPanel createDialogContent() {
JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
jPanel.add(new UILabel(Toolkit.i18nText("Fine-Design_WebSocket_Lost_Tip")), BorderLayout.WEST);
UILabel hyperLinkLabel = new UILabel(Toolkit.i18nText("Fine-Design_WebSocket_Lost_Tip_HyperLink_Text"));
hyperLinkLabel.addMouseListener(new MouseClickListener() {
@Override
public void mouseClicked(MouseEvent e) {
BrowseUtils.browser(WEBSOCKET_HELP_DOC);
}
});
hyperLinkLabel.setBorder(BorderFactory.createEmptyBorder(0, 3, 0, 0));
hyperLinkLabel.setForeground(Color.BLUE);
hyperLinkLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
jPanel.add(hyperLinkLabel, BorderLayout.CENTER);
return jPanel;
}
//配置变更监听器
private static final Emitter.Listener modifyConfig = new Emitter.Listener() {
@Override
@ -346,4 +318,4 @@ public class DesignerSocketIO {
};
}
}
}
Loading…
Cancel
Save