Browse Source

Merge remote-tracking branch 'origin/feature/x' into feature/x

feature/x
Hoky 3 years ago
parent
commit
425f081cb2
  1. 8
      designer-base/src/main/java/com/fr/design/DesignerEnvManager.java
  2. 3
      designer-base/src/main/java/com/fr/design/actions/help/AboutPane.java
  3. 4
      designer-base/src/main/java/com/fr/design/actions/help/TutorialAction.java
  4. 4
      designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java
  5. 2
      designer-base/src/main/java/com/fr/design/login/DesignerLoginHelper.java
  6. 14
      designer-base/src/main/java/com/fr/design/login/config/DesignerLoginConfigManager.java
  7. 14
      designer-base/src/main/java/com/fr/design/login/guide/DesignerGuideHelper.java
  8. 5
      designer-base/src/main/java/com/fr/design/mainframe/chart/mode/ChartEditContext.java
  9. 5
      designer-base/src/main/java/com/fr/design/mainframe/check/CheckFontInfoDialog.java
  10. 14
      designer-base/src/main/java/com/fr/design/mainframe/toast/DesignerToastMsgUtil.java
  11. 7
      designer-base/src/main/java/com/fr/design/mainframe/toast/ToastMsgDialog.java
  12. 11
      designer-base/src/main/java/com/fr/design/utils/gui/AdjustWorkBookDefaultStyleUtils.java
  13. 7
      designer-base/src/main/java/com/fr/env/HelpLink.java
  14. 10
      designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java
  15. 3
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartFillStylePane.java
  16. 4
      designer-chart/src/main/java/com/fr/van/chart/designer/component/marker/VanChartImageMarkerPane.java
  17. 4
      designer-chart/src/main/java/com/fr/van/chart/designer/type/AbstractVanChartTypePane.java
  18. 13
      designer-chart/src/main/java/com/fr/van/chart/map/designer/type/GisLayerPane.java
  19. 6
      designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/StylePane.java
  20. 108
      designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java
  21. 6
      designer-realize/src/main/java/com/fr/design/report/ReportStylePane.java

8
designer-base/src/main/java/com/fr/design/DesignerEnvManager.java

@ -885,6 +885,14 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
designerLoginConfigManager.setPluginRemindOnFirstLaunch(pluginRemindOnFirstLaunch);
}
public boolean isUseOldVersionLogin() {
return designerLoginConfigManager.isUseOldVersionLogin();
}
public void setUseOldVersionLogin(boolean useOldVersionLogin) {
designerLoginConfigManager.setUseOldVersionLogin(useOldVersionLogin);
}
/**
* 内置服务器是否使用时启动
*

3
designer-base/src/main/java/com/fr/design/actions/help/AboutPane.java

@ -14,7 +14,6 @@ import com.fr.general.CloudCenter;
import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralContext;
import com.fr.general.GeneralUtils;
import com.fr.i18n.UrlI18nManager;
import com.fr.locale.InterProviderFactory;
import com.fr.stable.ProductConstants;
import com.fr.stable.StringUtils;
@ -83,7 +82,7 @@ public class AboutPane extends JPanel {
addPhoneAndQQPane(contentPane);
// 官网
JPanel urlActionPane = getURLActionPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Official_Website"), UrlI18nManager.getInstance().getI18nUrl("website"));
JPanel urlActionPane = getURLActionPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Official_Website"), CloudCenter.getInstance().acquireConf("website." + GeneralContext.getLocale(), ProductConstants.WEBSITE_URL));
// 支持邮箱
String defaultEmail = CloudCenter.getInstance().acquireConf("support.email", ProductConstants.SUPPORT_EMAIL);

4
designer-base/src/main/java/com/fr/design/actions/help/TutorialAction.java

@ -3,9 +3,9 @@ package com.fr.design.actions.help;
import com.fr.design.i18n.Toolkit;
import com.fr.design.login.AbstractDesignerSSO;
import com.fr.design.menu.MenuKeySet;
import com.fr.general.CloudCenter;
import com.fr.general.GeneralContext;
import com.fr.general.http.HttpToolbox;
import com.fr.i18n.UrlI18nManager;
import com.fr.stable.CommonUtils;
import com.fr.stable.ProductConstants;
import com.fr.stable.StringUtils;
@ -28,7 +28,7 @@ public class TutorialAction extends AbstractDesignerSSO {
@Override
public String getJumpUrl() {
return UrlI18nManager.getInstance().getI18nUrl("help");
return CloudCenter.getInstance().acquireUrlByKind(createDocKey(), "http://help.finereport.com");
}
// 生成帮助文档 sitecenter key, help.zh_CN.10

4
designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java

@ -16,8 +16,8 @@ import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.utils.BrowseUtils;
import com.fr.file.filter.ChooseFileFilter;
import com.fr.general.CloudCenter;
import com.fr.general.ComparatorUtils;
import com.fr.i18n.UrlI18nManager;
import com.fr.stable.ArrayUtils;
import com.fr.stable.EncodeConstants;
import com.fr.stable.StringUtils;
@ -159,7 +159,7 @@ public class JDBCDefPane extends JPanel {
odbcTipsLink.setPreferredSize(new Dimension(GraphHelper.getWidth(Toolkit.i18nText("Fine-Design_Basic_Odbc_Tips")), odbcTipsLink.getPreferredSize().height));
odbcTipsLink.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
String url = UrlI18nManager.getInstance().getI18nUrl("odbc.help");
String url = CloudCenter.getInstance().acquireUrlByKind("odbc.help");
BrowseUtils.browser(url);
}
});

2
designer-base/src/main/java/com/fr/design/login/DesignerLoginHelper.java

@ -47,7 +47,7 @@ public class DesignerLoginHelper {
}
public static void showLoginDialog(DesignerLoginSource source, Map<String, String> params, Window window) {
if (!SupportOSImpl.DESIGNER_LOGIN.support()) {
if (!SupportOSImpl.DESIGNER_LOGIN.support() || DesignerEnvManager.getEnvManager().isUseOldVersionLogin()) {
WebViewDlgHelper.createLoginDialog(window);
return;
}

14
designer-base/src/main/java/com/fr/design/login/config/DesignerLoginConfigManager.java

@ -70,6 +70,10 @@ public class DesignerLoginConfigManager implements XMLReadable, XMLWriter {
* 插件管理第一次启动时的提醒
*/
private boolean pluginRemindOnFirstLaunch = true;
/**
* 使用旧版登录
*/
private boolean useOldVersionLogin = false;
private DesignerLoginConfigManager() {
@ -98,6 +102,7 @@ public class DesignerLoginConfigManager implements XMLReadable, XMLWriter {
this.setLastLoginAccount(reader.getAttrAsString("lastLoginAccount", StringUtils.EMPTY));
this.setLoginRemindBeforeJumpBBS(reader.getAttrAsBoolean("loginRemindBeforeJumpBBS", true));
this.setPluginRemindOnFirstLaunch(reader.getAttrAsBoolean("pluginRemindOnFirstLaunch", true));
this.setUseOldVersionLogin(reader.getAttrAsBoolean("useOldVersionLogin", false));
}
}
@ -117,6 +122,7 @@ public class DesignerLoginConfigManager implements XMLReadable, XMLWriter {
writer.attr("lastLoginAccount", lastLoginAccount);
writer.attr("loginRemindBeforeJumpBBS", loginRemindBeforeJumpBBS);
writer.attr("pluginRemindOnFirstLaunch", pluginRemindOnFirstLaunch);
writer.attr("useOldVersionLogin", useOldVersionLogin);
writer.end();
}
@ -223,4 +229,12 @@ public class DesignerLoginConfigManager implements XMLReadable, XMLWriter {
public void setPluginRemindOnFirstLaunch(boolean pluginRemindOnFirstLaunch) {
this.pluginRemindOnFirstLaunch = pluginRemindOnFirstLaunch;
}
public boolean isUseOldVersionLogin() {
return useOldVersionLogin;
}
public void setUseOldVersionLogin(boolean useOldVersionLogin) {
this.useOldVersionLogin = useOldVersionLogin;
}
}

14
designer-base/src/main/java/com/fr/design/login/guide/DesignerGuideHelper.java

@ -8,9 +8,7 @@ import com.fr.design.login.utils.DesignerLoginUtils;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.os.impl.SupportOSImpl;
import com.fr.design.update.push.DesignerPushUpdateManager;
import com.fr.general.CloudCenter;
import com.fr.general.CloudCenterConfig;
import com.fr.general.http.HttpToolbox;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
import javax.swing.WindowConstants;
@ -39,7 +37,11 @@ public class DesignerGuideHelper {
public static void prepareShowGuideDialog() {
// 如果存在更新升级的弹窗,则不显示引导页面
if (!DesignerLoginUtils.isOnline() || !SupportOSImpl.DESIGNER_LOGIN.support() || !FRContext.isChineseEnv() || DesignerPushUpdateManager.getInstance().isShouldPopUp()) {
if (!DesignerLoginUtils.isOnline()
|| !SupportOSImpl.DESIGNER_LOGIN.support()
|| !FRContext.isChineseEnv()
|| DesignerPushUpdateManager.getInstance().isShouldPopUp()
|| DesignerEnvManager.getEnvManager().isUseOldVersionLogin()) {
return;
}
if (isActivatedForOneWeek()) {
@ -52,7 +54,11 @@ public class DesignerGuideHelper {
DesignerContext.getDesignerFrame().addDesignerOpenedListener(new DesignerOpenedListener() {
@Override
public void designerOpened() {
try {
showGuideDialog();
} catch (Throwable t) {
FineLoggerFactory.getLogger().warn(t.getMessage(), t);
}
}
});
}

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

@ -1,6 +1,7 @@
package com.fr.design.mainframe.chart.mode;
import com.fr.common.annotations.Open;
import com.fr.design.base.mode.DesignModeContext;
/**
* @author shine
@ -27,9 +28,9 @@ public class ChartEditContext {
/**
* 是否支持 主题样式 设置
*
* @return duchamp大屏模板模式 不支持
* @return duchamp大屏模板模式 不支持 图表组件&cpt组件中的图表 都不支持
*/
public static boolean supportTheme() {
return !duchampMode();
return !DesignModeContext.isDuchampMode();
}
}

5
designer-base/src/main/java/com/fr/design/mainframe/check/CheckFontInfoDialog.java

@ -7,8 +7,8 @@ import com.fr.design.i18n.DesignSizeI18nManager;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.CloudCenter;
import com.fr.general.IOUtils;
import com.fr.i18n.UrlI18nManager;
import javax.swing.BorderFactory;
import javax.swing.JDialog;
@ -49,8 +49,7 @@ public class CheckFontInfoDialog extends JDialog implements ActionListener {
JPanel messagePanel = FRGUIPaneFactory.createVerticalFlowLayout_S_Pane(true);
MessageWithLink linkMessage = new MessageWithLink(Toolkit.i18nText("Fine_Designer_Check_Font_Message"),
Toolkit.i18nText("Fine_Designer_Check_Font_Install_Font"),
UrlI18nManager.getInstance().getI18nUrl("help.install.font")
);
CloudCenter.getInstance().acquireUrlByKind("help.install.font", "https://help.fanruan.com/finereport/doc-view-3999.html"));
linkMessage.setPreferredSize(DesignSizeI18nManager.getInstance().i18nDimension("com.fr.design.mainframe.check.CheckFontInfoDialog.messageWithLink"));
messagePanel.add(linkMessage);

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

@ -31,13 +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 +69,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 +83,7 @@ public class DesignerToastMsgUtil {
} else {
dialog = new ToastMsgDialog((Frame) parent, pane);
}
return dialog;
dialog.setVisible(true);
}

7
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,5 @@ public class ToastMsgDialog extends UIDialog {
super.dispose();
}
public boolean isShow() {
return show;
}
}

11
designer-base/src/main/java/com/fr/design/utils/gui/AdjustWorkBookDefaultStyleUtils.java

@ -43,4 +43,15 @@ public class AdjustWorkBookDefaultStyleUtils {
return DesignModeContext.isDuchampMode() ? TEMPLATE_BACKGROUND : color;
}
/**
* cpt模板是否支持跟随主题选项
* 单元格样式
* 悬浮元素样式
* 纸张背景入口大屏模板屏蔽掉了 忽略
* @return 大屏模板中cpt组件不支持
*/
public static boolean supportTheme() {
return !DesignModeContext.isDuchampMode();
}
}

7
designer-base/src/main/java/com/fr/env/HelpLink.java vendored

@ -1,7 +1,7 @@
package com.fr.env;
import com.fr.i18n.UrlI18nManager;
import com.fr.general.locale.LocaleCenter;
import com.fr.general.locale.LocaleMark;
import com.fr.locale.InterProviderFactory;
import com.fr.stable.StringUtils;
import java.util.HashMap;
@ -18,7 +18,8 @@ public class HelpLink {
public static String getLink(String solution) {
Map<String, String> map = new HashMap<>();
String link = UrlI18nManager.getInstance().getI18nUrl("help.remote.design");
LocaleMark<String> linkMark = LocaleCenter.getMark(RemoteDesignLocaleMark.class);
String link = linkMark.getValue();
map.put(InterProviderFactory.getProvider().getLocText("Fine-Core_Remote_Design_Change_PassWord"), StringUtils.EMPTY);
map.put(InterProviderFactory.getProvider().getLocText("Fine-Core_Remote_Design_Cert_Error_Solution"), link);
map.put(InterProviderFactory.getProvider().getLocText("Fine-Core_Remote_Design_Connection_Unknown_Error_Solution"), link);

10
designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java

@ -11,8 +11,10 @@ import com.fr.design.ChartTypeInterfaceManager;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.chart.info.ChartInfoCollector;
import com.fr.design.mainframe.chart.mode.ChartEditContext;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.chart.vanchart.VanChart;
import javax.swing.BorderFactory;
import javax.swing.DefaultListCellRenderer;
@ -23,10 +25,10 @@ import javax.swing.JSplitPane;
import javax.swing.ListCellRenderer;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.awt.Color;
import java.awt.Component;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
public class ChartTypePane extends ChartCommonWizardPane implements CallbackEvent {
private static final long serialVersionUID = -1175602484968520546L;
@ -153,6 +155,10 @@ public class ChartTypePane extends ChartCommonWizardPane implements CallbackEven
}
}
if (!ChartEditContext.supportTheme() && chart4Update instanceof VanChart) {
((VanChart) chart4Update).setAutoThemeCustom();
}
update(chart4Update);
}

3
designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartFillStylePane.java

@ -6,6 +6,7 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerBean;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.chart.mode.ChartEditContext;
import com.fr.design.mainframe.predefined.ui.detail.ColorFillStylePane;
import com.fr.design.utils.gui.GUICoreUtils;
@ -63,7 +64,7 @@ public class VanChartFillStylePane extends ColorFillStylePane implements Designe
}
public void updateBean(AttrFillStyle attrFillStyle) {
if (getStyleSelectBox().getSelectedIndex() == 0) {
if (getStyleSelectBox().getSelectedIndex() == 0 && ChartEditContext.supportTheme()) {
attrFillStyle.setThemed(true);
return;
}

4
designer-chart/src/main/java/com/fr/van/chart/designer/component/marker/VanChartImageMarkerPane.java

@ -31,8 +31,8 @@ public class VanChartImageMarkerPane extends BasicBeanPane<VanChartAttrMarker> {
public VanChartImageMarkerPane() {
imageBackgroundPane = new ImageBackgroundQuickPane(false);
imageBackgroundPane.setPreferredSize(getImageBackgroundPreferredSize(imageBackgroundPane.getPreferredSize()));
width = new UISpinnerWithPx(0, 100, 0.5, 30);
height = new UISpinnerWithPx(0, 100, 0.5, 30);
width = new UISpinnerWithPx(0, Integer.MAX_VALUE, 0.5, 30);
height = new UISpinnerWithPx(0, Integer.MAX_VALUE, 0.5, 30);
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;

4
designer-chart/src/main/java/com/fr/van/chart/designer/type/AbstractVanChartTypePane.java

@ -24,6 +24,7 @@ import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane;
import com.fr.design.mainframe.chart.gui.type.ChartImagePane;
import com.fr.design.mainframe.chart.info.ChartInfoCollector;
import com.fr.design.mainframe.chart.mode.ChartEditContext;
import com.fr.general.Background;
import com.fr.js.NameJavaScriptGroup;
import com.fr.log.FineLoggerFactory;
@ -152,6 +153,9 @@ public abstract class AbstractVanChartTypePane extends AbstractChartTypePane<Van
//切换类型埋点
ChartInfoCollector.getInstance().updateChartTypeTime(chart, oldPlot.getPlotID());
}
if (!ChartEditContext.supportTheme()) {
chart.setAutoThemeCustom();
}
if (!acceptDefinition(chart.getChartDataDefinition(), newPlot)) {
chart.setChartDataDefinition(null);
}

13
designer-chart/src/main/java/com/fr/van/chart/map/designer/type/GisLayerPane.java

@ -9,6 +9,7 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.mode.ChartEditContext;
import com.fr.general.ComparatorUtils;
import com.fr.plugin.chart.base.GisLayer;
import com.fr.plugin.chart.map.VanChartMapPlot;
@ -84,7 +85,7 @@ public class GisLayerPane extends JPanel implements UIObserver {
private JPanel createGISLayerPane() {
gisButton = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Mode_Auto"),
Toolkit.i18nText("Fine-Design_Form_Widget_Style_Standard"), Toolkit.i18nText("Fine-Design_Chart_Custom")});
gisButton.setSelectedIndex(0);
gisButton.setSelectedIndex(ChartEditContext.supportTheme() ? 0 : 1);
gisGaoDeLayer = new UIComboBox(MapLayerConfigManager.getGaoDeLayerItems());
gisButton.addActionListener(event -> {
refreshZoomLevel();
@ -236,9 +237,19 @@ public class GisLayerPane extends JPanel implements UIObserver {
}
public void resetGisLayer(VanChartMapPlot mapPlot) {
if (ChartEditContext.supportTheme()) {
GisLayer defaultGisLayer = mapPlot.getDefaultGisLayer();
mapPlot.setGisLayer(defaultGisLayer);
populate(defaultGisLayer);
} else {
GaoDeGisType gaoDeGisType = mapPlot.getDefaultGisLayerType();
mapPlot.getGisLayer().setGisLayerType(GISLayerType.GAO_DE_API);
mapPlot.getGisLayer().setLayerName(gaoDeGisType.getTypeName());
mapPlot.getGisLayer().setGaoDeGisType(gaoDeGisType);
populate(mapPlot.getGisLayer());
}
}
public void populate(GisLayer layer) {

6
designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/StylePane.java

@ -13,6 +13,7 @@ import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.utils.gui.AdjustWorkBookDefaultStyleUtils;
import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory;
@ -38,6 +39,7 @@ public class StylePane extends BasicPane implements UIObserver {
public static final int DEFAULT_SELECTED_INDEX = 0;
private final UIButtonGroup<String> followingThemeButtonGroup;
private JPanel followingThemePane;
private final CustomStylePane customStylePane;
private final ThemedCellStyleListPane themedCellStyleListPane;
private final CardLayout cardLayout;
@ -64,7 +66,7 @@ public class StylePane extends BasicPane implements UIObserver {
private void initializePane() {
setLayout(new BorderLayout(0, IntervalConstants.INTERVAL_L1));
add(createFollowingThemePane(), BorderLayout.NORTH);
add(followingThemePane = createFollowingThemePane(), BorderLayout.NORTH);
contentPane = createTabbedContentPane();
add(contentPane, BorderLayout.CENTER);
}
@ -226,6 +228,8 @@ public class StylePane extends BasicPane implements UIObserver {
setSelectedIndex(1);
customStylePane.populateBean(style);
}
//单元格配置界面是单例 所以直接在populate的时候把跟随主题的按钮组设置不可见
followingThemePane.setVisible(AdjustWorkBookDefaultStyleUtils.supportTheme());
}
private void fireStateChanged() {

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

@ -7,33 +7,20 @@ 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;
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;
@ -42,27 +29,22 @@ 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.JOptionPane;
import javax.swing.JPanel;
import javax.swing.UIManager;
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;
public class DesignerSocketIO {
@ -72,21 +54,18 @@ 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;
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列表的计数器
private static int count;
// 当前webSocket选择的协议
private static String currentProtocol;
private static ToastMsgDialog dialog = null;
public static void close() {
@ -207,7 +186,6 @@ public class DesignerSocketIO {
private static final Emitter.Listener failRetry = new Emitter.Listener() {
@Override
public void call(Object... args) {
showSocketDisconnectToast();
printLog(args, PrintEventLogImpl.WARN, "failed args: {}");
status = Status.Disconnecting;
socket.close();
@ -246,63 +224,31 @@ 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) {
dealWithSocketDisconnect();
showConnectionLostDialog();
}
status = Status.Disconnected;
} finally {
disConnectHintTimer.cancel();
disConnectHintTimer = null;
}
};
private static void dealWithSocketDisconnect() {
if (checkRPCConnect()) {
showSocketDisconnectToast();
} else {
showRPCDisconnectDialog();
}
}, disConnectHintTimerDelay);
}
};
private static void showSocketDisconnectToast() {
private static void showConnectionLostDialog() {
try {
UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override
public void run() {
if (dialog == null) {
dialog = DesignerToastMsgUtil.createPromptDialog(createDialogContent());
}
if (!dialog.isShow()) {
dialog.setVisible(true);
}
}
});
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
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 void showRPCDisconnectDialog() {
UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override
public void run() {
@ -315,25 +261,9 @@ public class DesignerSocketIO {
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;
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
return true;
}
//配置变更监听器

6
designer-realize/src/main/java/com/fr/design/report/ReportStylePane.java

@ -27,6 +27,7 @@ import com.fr.design.style.BorderUtils;
import com.fr.design.style.FRFontPane;
import com.fr.design.style.FormatPane;
import com.fr.design.style.background.BackgroundPane;
import com.fr.design.utils.gui.AdjustWorkBookDefaultStyleUtils;
import com.fr.general.FRFont;
import com.fr.grid.selection.CellSelection;
import com.fr.grid.selection.FloatSelection;
@ -66,6 +67,7 @@ public class ReportStylePane extends BasicPane {
private final CellStylePreviewPane previewArea;
private final UIButtonGroup<String> followingThemeButtonGroup;
private JPanel followingThemePane;
private final CustomFloatStyleSettingPane customStylePane;
private final ThemedFloatStyleSettingPane themedFloatStyleSettingPane;
private final CardLayout cardLayout;
@ -106,7 +108,7 @@ public class ReportStylePane extends BasicPane {
add(createPreviewPane(), BorderLayout.NORTH);
JPanel settingContainer = FRGUIPaneFactory.createBorderLayout_S_Pane();
JPanel followingThemePane = createFollowingThemePane();
followingThemePane = createFollowingThemePane();
followingThemePane.setBorder(BorderFactory.createEmptyBorder(20, 0, 10, 0));
settingContainer.add(followingThemePane, BorderLayout.NORTH);
settingContainer.add(contentPane, BorderLayout.CENTER);
@ -319,6 +321,8 @@ public class ReportStylePane extends BasicPane {
setSelectedIndex(1);
customStylePane.populateBean(style);
}
followingThemePane.setVisible(AdjustWorkBookDefaultStyleUtils.supportTheme());
}
public void updatePreviewArea() {

Loading…
Cancel
Save