Browse Source

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

feature/big-screen
Yvan 4 years ago
parent
commit
fa823fd3f2
  1. 15
      designer-base/src/main/java/com/fr/design/locale/impl/SupportLocaleImpl.java
  2. 21
      designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/preview/ChartPreStylePreView.java
  3. 11
      designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/preview/ElementCasePreview.java
  4. 58
      designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/preview/PredefinedStylePreviewPane.java
  5. 55
      designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java
  6. 68
      designer-base/src/main/java/com/fr/design/upm/UpmFinder.java
  7. 15
      designer-base/src/main/resources/com/fr/design/mainframe/predefined/previewData

15
designer-base/src/main/java/com/fr/design/locale/impl/SupportLocaleImpl.java

@ -156,5 +156,20 @@ public enum SupportLocaleImpl implements SupportLocale {
set.add(Locale.TAIWAN);
return set;
}
},
/**
* 更新升级-社区菜单下
*/
UPDATE_COMMUNITY {
@Override
public Set<Locale> support() {
Set<Locale> set = new HashSet<>();
set.add(Locale.US);
set.add(Locale.KOREA);
set.add(Locale.CHINA);
set.add(Locale.TAIWAN);
return set;
}
}
}

21
designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/preview/ChartPreStylePreView.java

@ -4,15 +4,16 @@ import com.fr.base.chart.BaseChartCollection;
import com.fr.base.chart.BaseChartPainter;
import com.fr.base.chart.chartdata.CallbackEvent;
import com.fr.base.chart.result.WebChartIDInfo;
import com.fr.chart.base.ChartConstants;
import com.fr.chart.base.ChartPreStyleProvider;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.config.predefined.PredefinedStyle;
import com.fr.design.gui.chart.MiddleChartComponent;
import com.fr.general.Background;
import com.fr.plugin.chart.vanchart.VanChart;
import com.fr.script.Calculator;
import com.fr.stable.core.PropertyChangeListener;
import javax.swing.BorderFactory;
import java.util.List;
import java.awt.Dimension;
import java.awt.Graphics;
@ -32,6 +33,10 @@ public class ChartPreStylePreView extends MiddleChartComponent {
private CallbackEvent callbackEvent;
private static final int BOUNDS = 10;
private Background componentBackground;
public ChartPreStylePreView() {
}
@ -42,6 +47,7 @@ public class ChartPreStylePreView extends MiddleChartComponent {
public ChartPreStylePreView(ChartCollection cc, double scaleX, double scaleY) {
this.scaleX = scaleX;
this.scaleY = scaleY;
this.setBorder(BorderFactory.createEmptyBorder(5, 10, 10, 10));
populate(cc);
}
@ -51,18 +57,22 @@ public class ChartPreStylePreView extends MiddleChartComponent {
public void paintComponent(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
g2d.translate(ChartConstants.PREGAP4BOUNDS / 2, ChartConstants.PREGAP4BOUNDS / 2);
g2d.translate(BOUNDS, BOUNDS);
g2d.scale(scaleX, scaleY);
super.paintComponent(g);
drawChart(g2d);
g2d.scale(1 / scaleX, 1 / scaleY);
g2d.translate(-ChartConstants.PREGAP4BOUNDS / 2, -ChartConstants.PREGAP4BOUNDS / 2);
g2d.translate(-BOUNDS, -BOUNDS);
}
private void drawChart(Graphics2D g2d) {
Dimension d = getBounds().getSize();
int chartWidth = (int) (d.width / scaleX) - ChartConstants.PREGAP4BOUNDS;
int chartHeight = (int) (d.height / scaleX) - ChartConstants.PREGAP4BOUNDS;
int chartWidth = (int) (d.width / scaleX) - BOUNDS * 2;
int chartHeight = (int) (d.height / scaleX) - BOUNDS * 2;
if (componentBackground != null) {
Graphics clipg = g2d.create(0, 0, chartWidth, chartHeight);
componentBackground.paint(clipg, clipg.getClipBounds());
}
BaseChartPainter painter = chartCollection.createResultChartPainterWithOutDealFormula(Calculator.createCalculator(),
WebChartIDInfo.createEmptyDesignerInfo(), chartWidth, chartHeight);
painter.paint(g2d, chartWidth, chartHeight, 0, null, callbackEvent);
@ -74,6 +84,7 @@ public class ChartPreStylePreView extends MiddleChartComponent {
for (ChartPreStyleProvider chartPreStyleProvider : chartPreStyleProviders) {
chartPreStyleProvider.updatePreDefinedStyle(style);
}
componentBackground = style.getComponentStyle().getBorderStyle().getBackground();
vanChart.attrChange();
}

11
designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/preview/ElementCasePreview.java

@ -7,15 +7,15 @@ import com.fr.log.FineLoggerFactory;
import javax.swing.JPanel;
import javax.swing.JSeparator;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
/**
* Created by kerry on 2020-09-04
@ -51,8 +51,9 @@ public class ElementCasePreview extends ComponentPreviewPane {
jPanel.setOpaque(false);
jPanel.setBackground(null);
FRFont font = FRFont.getInstance();
FRFont titleFont = font.applySize(11).applyForeground(Color.decode("#63B2EE"));
FRFont endFont = font.applyForeground(Color.decode("#1B97FF"));
font = font.applySize(11);
FRFont titleFont = font.applySize(14).applyForeground(Color.decode("#63B2EE"));
FRFont endFont = font.applySize(11).applyForeground(Color.decode("#1B97FF"));
for (int i = 0; i < PREVIEW_DATA_LIST.size(); i++) {
FRFont frFont = font;
if (i == 0) {

58
designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/preview/PredefinedStylePreviewPane.java

@ -12,13 +12,10 @@ import com.fr.design.utils.ComponentUtils;
import com.fr.general.Background;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.chart.attr.axis.VanChartAxis;
import com.fr.plugin.chart.attr.plot.VanChartPlot;
import com.fr.plugin.chart.base.AttrLabel;
import com.fr.plugin.chart.base.VanChartTools;
import com.fr.plugin.chart.column.VanChartColumnPlot;
import com.fr.plugin.chart.line.VanChartLinePlot;
import com.fr.plugin.chart.vanchart.VanChart;
import com.fr.stable.Constants;
import javax.swing.JComponent;
import javax.swing.JPanel;
@ -38,14 +35,9 @@ public class PredefinedStylePreviewPane extends StyleSettingPreviewPane implemen
private double scaleX = 1.0;
private double scaleY = 1.0;
private ChartPreStylePreView columnChartPane;
private ChartPreStylePreView lineChartPane;
private int COLUMN_CHART_WIDTH = 297;
private int COLUMN_CHART_HEIGHT = 220;
public static final double CHART_SCALE = 0.6;
private int COLUMN_CHART_WIDTH = 517;
private int COLUMN_CHART_HEIGHT = 300;
public PredefinedStylePreviewPane() {
this(1.0, 1.0);
@ -57,21 +49,17 @@ public class PredefinedStylePreviewPane extends StyleSettingPreviewPane implemen
this.setBackground(Color.WHITE);
this.elementCasePreview = new ElementCasePreview();
this.add(initChartPreViewPane());
this.elementCasePreview.setPreferredSize(new Dimension(517, 250));
this.elementCasePreview.setPreferredSize(new Dimension(517, 190));
this.add(this.elementCasePreview);
}
private JPanel initChartPreViewPane() {
columnChartPane = new ChartPreStylePreView(initVanColumnChart(), CHART_SCALE, CHART_SCALE);
columnChartPane = new ChartPreStylePreView(initVanColumnChart());
columnChartPane.setPreferredSize(new Dimension(COLUMN_CHART_WIDTH, COLUMN_CHART_HEIGHT));
columnChartPane.setCallbackEvent(this);
lineChartPane = new ChartPreStylePreView(initVanLineChart(), CHART_SCALE, CHART_SCALE);
lineChartPane.setPreferredSize(new Dimension(220, 220));
lineChartPane.setCallbackEvent(this);
JPanel panel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
panel.add(columnChartPane);
panel.add(lineChartPane);
return panel;
}
@ -79,12 +67,11 @@ public class PredefinedStylePreviewPane extends StyleSettingPreviewPane implemen
private ChartCollection initVanColumnChart() {
try {
VanChart chart = (VanChart) ChartTypeManager.getInstance().getCharts(VanChartColumnPlot.VAN_CHART_COLUMN_PLOT_ID)[0].clone();
chart.getTitle().setPosition(Constants.LEFT);
VanChartTools vanChartTools = chart.getVanChartTools();
vanChartTools.setSort(false);
vanChartTools.setExport(false);
vanChartTools.setFullScreen(false);
VanChartPlot plot = chart.getPlot();
VanChartColumnPlot plot = chart.getPlot();
AttrLabel defaultAttrLabel = plot.getDefaultAttrLabel();
defaultAttrLabel.setEnable(true);
defaultAttrLabel.getAttrLabelDetail().getBorder().setBorderStyle(0);
@ -92,30 +79,14 @@ public class PredefinedStylePreviewPane extends StyleSettingPreviewPane implemen
plot.getConditionCollection().getDefaultAttr().addDataSeriesCondition(defaultAttrLabel);
plot.getLegend().setLegendVisible(false);
plot.getDataSheet().setVisible(true);
ChartCollection chartCollection = new ChartCollection(chart);
return chartCollection;
} catch (Exception ex) {
FineLoggerFactory.getLogger().error(ex.getMessage(), ex);
}
return null;
}
//折线图
private ChartCollection initVanLineChart() {
try {
VanChart chart = (VanChart) ChartTypeManager.getInstance().getCharts(VanChartLinePlot.VAN_CHART_LINE_PLOT)[0].clone();
chart.getTitle().setPosition(Constants.LEFT);
VanChartTools vanChartTools = chart.getVanChartTools();
vanChartTools.setSort(false);
vanChartTools.setExport(false);
vanChartTools.setFullScreen(false);
VanChartLinePlot plot = chart.getPlot();
plot.getLegend().setPosition(Constants.TOP);
VanChartAxis defaultXAxis = plot.getDefaultXAxis();
VanChartAxis defaultYAxis = plot.getDefaultYAxis();
Title title = new Title();
title.setTextObject(Toolkit.i18nText("Fine-Design_Chart_Category"));
defaultXAxis.setTitle(title);
defaultXAxis.setShowAxisTitle(true);
title.setTextObject(Toolkit.i18nText("Fine-Design_Chart_Axis_Title"));
title.getTextAttr().setRotation(-90);
defaultYAxis.setTitle(title);
defaultYAxis.setShowAxisTitle(true);
ChartCollection chartCollection = new ChartCollection(chart);
return chartCollection;
} catch (Exception ex) {
@ -142,11 +113,9 @@ public class PredefinedStylePreviewPane extends StyleSettingPreviewPane implemen
background.paint(g, new Rectangle2D.Double(0, 0, 517, 500));
this.columnChartPane.paintComponent(g);
g.translate(COLUMN_CHART_WIDTH, 0);
this.lineChartPane.paintComponent(g);
g.translate(-COLUMN_CHART_WIDTH, COLUMN_CHART_HEIGHT + 10);
g.translate(0, COLUMN_CHART_HEIGHT);
this.elementCasePreview.paintContent(g);
g.translate(0, -COLUMN_CHART_HEIGHT - 10);
g.translate(0, -COLUMN_CHART_HEIGHT);
// 恢复双缓冲
ComponentUtils.resetBuffer(dbcomponents);
@ -167,7 +136,6 @@ public class PredefinedStylePreviewPane extends StyleSettingPreviewPane implemen
public void refresh(PredefinedStyle style, boolean displayFormBackground) {
elementCasePreview.refresh(style);
columnChartPane.refresh(style);
lineChartPane.refresh(style);
background = displayFormBackground ? style.getFormBackground().getBackground() : style.getReportBackground();
this.repaint();
}

55
designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java

@ -54,9 +54,7 @@ import com.fr.design.mainframe.ToolBarNewTemplatePane;
import com.fr.design.menu.MenuDef;
import com.fr.design.menu.SeparatorDef;
import com.fr.design.menu.ShortCut;
import com.fr.design.menu.SnapChatMenuDef;
import com.fr.design.menu.ToolBarDef;
import com.fr.design.notification.SnapChatAllTypes;
import com.fr.design.os.impl.SupportOSImpl;
import com.fr.design.remote.action.RemoteDesignAuthManagerAction;
import com.fr.design.update.actions.SoftwareUpdateAction;
@ -530,35 +528,20 @@ public abstract class ToolBarMenuDock {
* @return 帮组菜单的子菜单
*/
public ShortCut[] createHelpShortCuts() {
final java.util.List<ShortCut> shortCuts = new ArrayList<ShortCut>();
final java.util.List<ShortCut> shortCuts = new ArrayList<>();
Locale locale = GeneralContext.getLocale();
LocaleCenter.buildAction(() -> shortCuts.add(new VideoAction()), SupportLocaleImpl.VIDEO);
LocaleCenter.buildAction(new LocaleAction() {
@Override
public void execute() {
shortCuts.add(new VideoAction());
}
}, SupportLocaleImpl.VIDEO);
LocaleCenter.buildAction(() -> shortCuts.add(new TutorialAction()), SupportLocaleImpl.TUTORIAL_HELP);
LocaleCenter.buildAction(new LocaleAction() {
@Override
public void execute() {
shortCuts.add(new TutorialAction());
}
}, SupportLocaleImpl.TUTORIAL_HELP);
LocaleCenter.buildAction(new LocaleAction() {
@Override
public void execute() {
shortCuts.add(new TechSupportAction());
}
}, SupportLocaleImpl.TECH_SUPPORT_HELP);
LocaleCenter.buildAction(() -> shortCuts.add(new TechSupportAction()), SupportLocaleImpl.TECH_SUPPORT_HELP);
//远程不使用更新升级,产品演示
if (WorkContext.getCurrent().isLocal()) {
shortCuts.add(new WebDemoAction());
shortCuts.add(new SoftwareUpdateAction());
if (!Locale.getDefault().equals(Locale.JAPAN) && !Locale.getDefault().equals(Locale.JAPANESE)) {
LocaleCenter.buildAction(() -> shortCuts.add(new SoftwareUpdateAction()), SupportLocaleImpl.UPDATE_HELP);
}
}
if (AlphaFineConfigManager.isALPHALicAvailable()) {
shortCuts.add(new AlphaFineAction());
@ -566,12 +549,7 @@ public abstract class ToolBarMenuDock {
shortCuts.add(SeparatorDef.DEFAULT);
if (DesignerEnvManager.getEnvManager().isOpenDebug()) {
OSSupportCenter.buildAction(new OSBasedAction() {
@Override
public void execute(Object... objects) {
shortCuts.add(new FineUIAction());
}
}, SupportOSImpl.FINEUI);
OSSupportCenter.buildAction(objects -> shortCuts.add(new FineUIAction()), SupportOSImpl.FINEUI);
}
shortCuts.add(new AboutAction());
@ -585,12 +563,12 @@ public abstract class ToolBarMenuDock {
* @return 社区菜单的子菜单
*/
public ShortCut[] createCommunityShortCuts() {
final java.util.List<ShortCut> shortCuts = new ArrayList<ShortCut>();
shortCuts.add(new BBSAction());
shortCuts.add(SeparatorDef.DEFAULT);
shortCuts.add(new VideoAction());
LocaleCenter.buildAction(new LocaleAction() {
@Override
@ -600,7 +578,7 @@ public abstract class ToolBarMenuDock {
}, SupportLocaleImpl.TUTORIAL_COMMUNITY);
shortCuts.add(new QuestionAction());
shortCuts.add(new TechSolutionAction());
shortCuts.add(SeparatorDef.DEFAULT);
LocaleCenter.buildAction(new LocaleAction() {
@ -630,9 +608,9 @@ public abstract class ToolBarMenuDock {
shortCuts.add(new TechSupportAction());
}
}, SupportLocaleImpl.TECH_SUPPORT_COMMUNITY);
shortCuts.add(SeparatorDef.DEFAULT);
shortCuts.add(new CenterAction());
shortCuts.add(new SignAction());
LocaleCenter.buildAction(new LocaleAction() {
@ -656,10 +634,7 @@ public abstract class ToolBarMenuDock {
public MenuDef createCommunityMenuDef() {
MenuDef menuDef = new SnapChatMenuDef(
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Community"),
'C',
SnapChatAllTypes.Menu.BBS);
MenuDef menuDef = new MenuDef(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Community"), 'C');
ShortCut[] otherCommunityShortCuts = createCommunityShortCuts();
for (ShortCut shortCut : otherCommunityShortCuts) {
menuDef.addShortCut(shortCut);

68
designer-base/src/main/java/com/fr/design/upm/UpmFinder.java

@ -10,6 +10,7 @@ import com.fr.design.update.ui.dialog.UpdateMainDialog;
import com.fr.event.Event;
import com.fr.event.EventDispatcher;
import com.fr.event.Listener;
import com.fr.general.GeneralContext;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StableUtils;
import com.fr.workspace.Workspace;
@ -17,6 +18,7 @@ import com.fr.workspace.WorkspaceEvent;
import javax.swing.*;
import java.io.File;
import java.util.Locale;
/**
* @author richie
@ -27,6 +29,7 @@ public class UpmFinder {
private static final String UPM_DIR = "/upm";
private static final String MAIN_RESOURCE_PATH = UPM_DIR + "/plugin_design.html";
private static final String JXBROWSER = "com.teamdev.jxbrowser.chromium.Browser";
public static String installHome = FRContext.getCommonOperator().getWebRootPath();
@ -56,39 +59,50 @@ public class UpmFinder {
}
public static void showUPMDialog() {
boolean flag = true;
boolean hasJxBrowser = true;
try {
Class.forName("com.teamdev.jxbrowser.chromium.Browser");
Class.forName(JXBROWSER);
} catch (ClassNotFoundException e) {
flag = false;
hasJxBrowser = false;
}
if (flag) {
if (!checkUPMResourcesExist()){
// upm下载
int val = FineJOptionPane.showConfirmDialog(null, Toolkit.i18nText("Fine-Design_Basic_Plugin_Shop_Need_Install"),
Toolkit.i18nText("Fine-Design_Basic_Confirm"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE);
if (val == JOptionPane.OK_OPTION){
try {
UpmResourceLoader.INSTANCE.download();
UpmResourceLoader.INSTANCE.install();
FineJOptionPane.showMessageDialog(null, Toolkit.i18nText("Fine-Design_Basic_Plugin_Shop_Installed"),
Toolkit.i18nText("Fine-Design_Basic_Message"), JOptionPane.INFORMATION_MESSAGE);
} catch (Exception e){
FineLoggerFactory.getLogger().error(e.getMessage(), e);
FineJOptionPane.showMessageDialog(null, Toolkit.i18nText("Fine-Design_Updater_Download_Failed"),
Toolkit.i18nText("Fine-Design_Basic_Message"), JOptionPane.INFORMATION_MESSAGE);
}
if (hasJxBrowser) {
showUpmPane();
} else {
showUpdatePane();
}
}
private static void showUpmPane() {
if (!checkUPMResourcesExist()){
// upm下载
int val = FineJOptionPane.showConfirmDialog(null, Toolkit.i18nText("Fine-Design_Basic_Plugin_Shop_Need_Install"),
Toolkit.i18nText("Fine-Design_Basic_Confirm"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE);
if (val == JOptionPane.OK_OPTION){
try {
UpmResourceLoader.INSTANCE.download();
UpmResourceLoader.INSTANCE.install();
FineJOptionPane.showMessageDialog(null, Toolkit.i18nText("Fine-Design_Basic_Plugin_Shop_Installed"),
Toolkit.i18nText("Fine-Design_Basic_Message"), JOptionPane.INFORMATION_MESSAGE);
} catch (Exception e){
FineLoggerFactory.getLogger().error(e.getMessage(), e);
FineJOptionPane.showMessageDialog(null, Toolkit.i18nText("Fine-Design_Updater_Download_Failed"),
Toolkit.i18nText("Fine-Design_Basic_Message"), JOptionPane.INFORMATION_MESSAGE);
}
}
else {
UpmShowPane upmPane = new UpmShowPane();
if (dialog == null) {
dialog = new UpmShowDialog(DesignerContext.getDesignerFrame(), upmPane);
}
dialog.setVisible(true);
}
else {
UpmShowPane upmPane = new UpmShowPane();
if (dialog == null) {
dialog = new UpmShowDialog(DesignerContext.getDesignerFrame(), upmPane);
}
} else {
FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Update_Info_Plugin_Message"));
dialog.setVisible(true);
}
}
private static void showUpdatePane() {
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Update_Info_Plugin_Message"));
if (!GeneralContext.getLocale().equals(Locale.JAPANESE) && !GeneralContext.getLocale().equals(Locale.JAPAN)
&& !Locale.getDefault().equals(Locale.JAPAN) && !Locale.getDefault().equals(Locale.JAPANESE)) {
UpdateMainDialog dialog = new UpdateMainDialog(DesignerContext.getDesignerFrame());
dialog.setAutoUpdateAfterInit();
dialog.showDialog();

15
designer-base/src/main/resources/com/fr/design/mainframe/predefined/previewData

@ -1,11 +1,6 @@
城市 当月目标 当月实际完成 月度完成率
南通市 324,646 324,646 105%
合肥市 248,938 348,938 103%
邵阳市 248,938 348,938 103%
九江市 248,938 348,938 103%
武汉市 248,938 348,938 103%
郑州市 248,938 348,938 103%
无锡市 248,938 348,938 103%
南京市 248,938 348,938 103%
苏州市 248,938 348,938 103%
合计 3200,425 2900,300 95%
南通市 324,646 324,646 100%
合肥市 248,938 348,938 140%
邵阳市 248,938 348,938 140%
苏州市 248,938 348,938 140%
合计 1,071,460 1,371,460 128%
Loading…
Cancel
Save