Browse Source

Merge branch 'release/10.0' of https://code.fineres.com/scm/~lucian.chen/design.git into release/10.0

security/10.0
lucian 3 years ago
parent
commit
7fe13cd9ea
  1. 8
      build.gradle
  2. 25
      designer-base/src/main/java/com/fr/design/border/UIRoundedBorder.java
  3. 147
      designer-base/src/main/java/com/fr/design/data/datapane/connect/DBCPAttrPane.java
  4. 5
      designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java
  5. 47
      designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCConnectionDef.java
  6. 6
      designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java
  7. 35
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ClassTableDataPane.java
  8. 4
      designer-base/src/main/java/com/fr/design/editor/editor/Editor.java
  9. 30
      designer-base/src/main/java/com/fr/design/gui/frpane/UIPercentDragPane.java
  10. 57
      designer-base/src/main/java/com/fr/design/gui/icombobox/LineComboBox.java
  11. 8
      designer-base/src/main/java/com/fr/design/gui/ipasswordfield/UIPasswordFieldWithFixedLength.java
  12. 9
      designer-base/src/main/java/com/fr/design/gui/ispinner/UISpinner.java
  13. 10
      designer-base/src/main/java/com/fr/design/gui/style/BackgroundPane.java
  14. 7
      designer-base/src/main/java/com/fr/design/gui/style/BackgroundSpecialPane.java
  15. 4
      designer-base/src/main/java/com/fr/design/locale/impl/BbsRegisterMark.java
  16. 4
      designer-base/src/main/java/com/fr/design/locale/impl/BbsResetMark.java
  17. 4
      designer-base/src/main/java/com/fr/design/login/AbstractDesignerSSO.java
  18. 6
      designer-base/src/main/java/com/fr/design/login/guide/DesignerGuideHelper.java
  19. 3
      designer-base/src/main/java/com/fr/design/login/message/DesignerMessageHelper.java
  20. 19
      designer-base/src/main/java/com/fr/design/login/utils/DesignerLoginUtils.java
  21. 19
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java
  22. 15
      designer-base/src/main/java/com/fr/design/mainframe/OpenLoadingPane.java
  23. 84
      designer-base/src/main/java/com/fr/design/mainframe/SafeWindowListener.java
  24. 23
      designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/ImagePreviewPane.java
  25. 2
      designer-base/src/main/java/com/fr/design/mainframe/form/FormECDesignerProvider.java
  26. 24
      designer-base/src/main/java/com/fr/design/ui/ModernUIPane.java
  27. 24
      designer-base/src/main/java/com/fr/design/ui/compatible/BuilderDiff.java
  28. 20
      designer-base/src/main/java/com/fr/design/ui/compatible/ModernUIPaneFactory.java
  29. 301
      designer-base/src/main/java/com/fr/design/ui/compatible/NewModernUIPane.java
  30. 3
      designer-base/src/main/java/com/fr/design/ui/compatible/NxComplexInterceptRequestCallback.java
  31. 14
      designer-base/src/main/java/com/fr/design/ui/compatible/NxInterceptRequestCallback.java
  32. 502
      designer-base/src/main/java/com/fr/design/upm/NewUpmBridge.java
  33. 4
      designer-base/src/main/java/com/fr/design/upm/UpmBridge.java
  34. 3
      designer-base/src/main/java/com/fr/design/upm/UpmFinder.java
  35. 35
      designer-base/src/main/java/com/fr/design/upm/UpmShowPane.java
  36. 30
      designer-base/src/main/java/com/fr/design/upm/exec/NewUpmBrowserExecutor.java
  37. 19
      designer-base/src/main/java/com/fr/design/versioncheck/VersionCheckUtils.java
  38. 48
      designer-base/src/main/java/com/fr/design/widget/WidgetBoundsPaneFactory.java
  39. 4
      designer-base/src/main/java/com/fr/env/CheckServiceDialog.java
  40. 3
      designer-base/src/main/java/com/fr/env/RemoteEnvPane.java
  41. 148
      designer-base/src/main/java/com/fr/env/utils/DesignerInteractionHistory.java
  42. 15
      designer-base/src/main/java/com/fr/start/server/FineEmbedServerActivator.java
  43. 1
      designer-base/src/main/resources/com/fr/design/i18n/dimension_en.properties
  44. 3
      designer-base/src/main/resources/com/fr/design/i18n/dimension_ja_JP.properties
  45. 3
      designer-base/src/main/resources/com/fr/design/i18n/dimension_ko_KR.properties
  46. 3
      designer-base/src/main/resources/com/fr/design/i18n/dimension_zh.properties
  47. 3
      designer-base/src/main/resources/com/fr/design/i18n/dimension_zh_TW.properties
  48. BIN
      designer-base/src/main/resources/com/fr/design/images/buttonicon/icon_border_image_help.png
  49. BIN
      designer-base/src/main/resources/com/fr/design/images/buttonicon/icon_choose_inset.png
  50. BIN
      designer-base/src/main/resources/com/fr/design/images/buttonicon/icon_delete_inset.png
  51. BIN
      designer-base/src/main/resources/com/fr/design/images/buttonicon/icon_inset_both_selected.png
  52. BIN
      designer-base/src/main/resources/com/fr/design/images/buttonicon/icon_inset_both_unselected.png
  53. BIN
      designer-base/src/main/resources/com/fr/design/images/buttonicon/icon_inset_left_selected.png
  54. BIN
      designer-base/src/main/resources/com/fr/design/images/buttonicon/icon_inset_left_unselected.png
  55. BIN
      designer-base/src/main/resources/com/fr/design/images/buttonicon/icon_inset_right_selected.png
  56. BIN
      designer-base/src/main/resources/com/fr/design/images/buttonicon/icon_inset_right_unselected.png
  57. BIN
      designer-base/src/main/resources/com/fr/design/images/buttonicon/icon_lock_disabled.png
  58. BIN
      designer-base/src/main/resources/com/fr/design/images/buttonicon/icon_lock_enabled.png
  59. BIN
      designer-base/src/main/resources/com/fr/design/images/buttonicon/icon_unlock_disabled.png
  60. BIN
      designer-base/src/main/resources/com/fr/design/images/buttonicon/icon_unlock_enabled.png
  61. BIN
      designer-base/src/main/resources/com/fr/design/images/control/edit_lock.png
  62. BIN
      designer-base/src/main/resources/com/fr/design/images/control/edit_unlock.png
  63. BIN
      designer-base/src/main/resources/com/fr/design/images/control/show_edit.png
  64. BIN
      designer-base/src/main/resources/com/fr/design/images/control/show_setting.png
  65. BIN
      designer-base/src/main/resources/com/fr/design/images/mainframe/openloading.png
  66. BIN
      designer-base/src/main/resources/com/fr/design/images/transparent_background.jpg
  67. 9
      designer-chart/src/main/java/com/fr/design/chart/gui/ChartWidgetOption.java
  68. 12
      designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartEditPane.java
  69. 252
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java
  70. 9
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypePane.java
  71. 14
      designer-chart/src/main/java/com/fr/van/chart/bubble/VanChartBubbleStylePane.java
  72. 5
      designer-chart/src/main/java/com/fr/van/chart/custom/style/VanChartCustomStylePane.java
  73. 8
      designer-chart/src/main/java/com/fr/van/chart/designer/PlotFactory.java
  74. 63
      designer-chart/src/main/java/com/fr/van/chart/designer/TableLayout4VanChartHelper.java
  75. 17
      designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichEditorPane.java
  76. 252
      designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePane.java
  77. 2
      designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePaneWithMapZoom.java
  78. 2
      designer-chart/src/main/java/com/fr/van/chart/designer/style/HeatMapRangeLegendPane.java
  79. 36
      designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java
  80. 2
      designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartRangeLegendPane.java
  81. 26
      designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartStylePane.java
  82. 25
      designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartTitlePane.java
  83. 21
      designer-chart/src/main/java/com/fr/van/chart/designer/style/VanLegendPaneWidthOutFixedCheck.java
  84. 21
      designer-chart/src/main/java/com/fr/van/chart/designer/style/VanLegendPaneWidthOutHighlight.java
  85. 9
      designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartTimeAxisPane.java
  86. 52
      designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartAreaBackgroundPane.java
  87. 15
      designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartAreaPane.java
  88. 2
      designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/other/VanChartDrillMapInteractivePane.java
  89. 1
      designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/SeriesTypeUseComboxPaneWithOutFilter.java
  90. 45
      designer-chart/src/main/java/com/fr/van/chart/map/designer/style/label/VanChartMapLabelContentPane.java
  91. 16
      designer-chart/src/main/java/com/fr/van/chart/pie/RadiusCardLayoutPane.java
  92. 2
      designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapter.java
  93. 7
      designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java
  94. 17
      designer-form/src/main/java/com/fr/design/designer/beans/events/DesignerEditor.java
  95. 29
      designer-form/src/main/java/com/fr/design/designer/beans/location/AccessDirection.java
  96. 11
      designer-form/src/main/java/com/fr/design/designer/beans/location/Bottom.java
  97. 11
      designer-form/src/main/java/com/fr/design/designer/beans/location/Left.java
  98. 20
      designer-form/src/main/java/com/fr/design/designer/beans/location/LeftBottom.java
  99. 23
      designer-form/src/main/java/com/fr/design/designer/beans/location/LeftTop.java
  100. 13
      designer-form/src/main/java/com/fr/design/designer/beans/location/Right.java
  101. Some files were not shown because too many files have changed in this diff Show More

8
build.gradle

@ -60,10 +60,10 @@ allprojects {
implementation 'com.fr.third:jxbrowser:6.23' implementation 'com.fr.third:jxbrowser:6.23'
implementation 'com.fr.third:jxbrowser-mac:6.23' implementation 'com.fr.third:jxbrowser-mac:6.23'
implementation 'com.fr.third:jxbrowser-win64:6.23' implementation 'com.fr.third:jxbrowser-win64:6.23'
implementation 'com.fr.third:jxbrowser-v7:7.5' implementation 'com.fr.third:jxbrowser-v7:7.7'
implementation 'com.fr.third:jxbrowser-mac-v7:7.5' implementation 'com.fr.third:jxbrowser-mac-v7:7.7'
implementation 'com.fr.third:jxbrowser-win64-v7:7.5' implementation 'com.fr.third:jxbrowser-win64-v7:7.7'
implementation 'com.fr.third:jxbrowser-swing:7.5' implementation 'com.fr.third:jxbrowser-swing-v7:7.7'
implementation 'com.fr.third.server:servlet-api:3.0' implementation 'com.fr.third.server:servlet-api:3.0'
implementation 'org.swingexplorer:swexpl:2.0.1' implementation 'org.swingexplorer:swexpl:2.0.1'
implementation 'org.swingexplorer:swag:1.0' implementation 'org.swingexplorer:swag:1.0'

25
designer-base/src/main/java/com/fr/design/border/UIRoundedBorder.java

@ -1,32 +1,33 @@
package com.fr.design.border; package com.fr.design.border;
import com.fr.base.GraphHelper; import com.fr.base.GraphHelper;
import com.fr.stable.GraphDrawHelper;
import javax.swing.border.LineBorder; import javax.swing.border.LineBorder;
import java.awt.Color; import java.awt.*;
import java.awt.Component;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.geom.RoundRectangle2D; import java.awt.geom.RoundRectangle2D;
public class UIRoundedBorder extends LineBorder { public class UIRoundedBorder extends LineBorder {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private BasicStroke stroke4Thickness;
private int roundedCorner; private int roundedCorner;
private int lineStyle; private int lineStyle;
public UIRoundedBorder(Color color) { public UIRoundedBorder(Color color) {
super(color); super(color);
this.stroke4Thickness = new BasicStroke(thickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER);
} }
public UIRoundedBorder(Color color, int thickness){ public UIRoundedBorder(Color color, int thickness){
super(color, thickness); super(color, thickness);
this.stroke4Thickness = new BasicStroke(thickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER);
} }
public UIRoundedBorder(Color color, int thickness, int roundedCorners){ public UIRoundedBorder(Color color, int thickness, int roundedCorners){
super(color, thickness, true); super(color, thickness, true);
this.stroke4Thickness = new BasicStroke(thickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER);
this.roundedCorner = roundedCorners; this.roundedCorner = roundedCorners;
} }
@ -51,7 +52,19 @@ public class UIRoundedBorder extends LineBorder {
Graphics2D g2d = (Graphics2D)g; Graphics2D g2d = (Graphics2D)g;
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2d.setColor(lineColor); g2d.setColor(lineColor);
GraphHelper.draw(g2d, new RoundRectangle2D.Double(x, y, width - 1.0D, height - 1.0D, roundedCorner, roundedCorner), lineStyle);
Shape shape = new RoundRectangle2D.Double(x, y, width - 1.0D, height - 1.0D, roundedCorner, roundedCorner);
if (stroke4Thickness != null) {
Stroke oldStroke = g2d.getStroke();
g2d.setStroke(stroke4Thickness);
g2d.draw(shape);
g2d.setStroke(oldStroke);
} else {
GraphHelper.draw(g2d, shape, lineStyle);
}
g2d.setColor(oldColor); g2d.setColor(oldColor);
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
} }

147
designer-base/src/main/java/com/fr/design/data/datapane/connect/DBCPAttrPane.java

@ -1,8 +1,9 @@
package com.fr.design.data.datapane.connect; package com.fr.design.data.datapane.connect;
import com.fr.base.GraphHelper;
import com.fr.data.impl.JDBCDatabaseConnection; import com.fr.data.impl.JDBCDatabaseConnection;
import com.fr.data.pool.DBCPConnectionPoolAttr; import com.fr.data.pool.DBCPConnectionPoolAttr;
import com.fr.design.constants.UIConstants; import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.editor.editor.IntegerEditor; import com.fr.design.editor.editor.IntegerEditor;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
@ -12,14 +13,36 @@ import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import java.awt.BorderLayout; import com.fr.general.ComparatorUtils;
import java.awt.Component; import com.fr.stable.StringUtils;
import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Window;
import java.awt.event.InputMethodEvent;
import java.awt.event.InputMethodListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.util.HashMap;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class DBCPAttrPane extends BasicPane { public class DBCPAttrPane extends BasicPane {
public static final int TIME_MULTIPLE = 1000; public static final int TIME_MULTIPLE = 1000;
private static final Pattern FETCHSIZE_PATTERN = Pattern.compile("^0$|^[1-9][\\d]*[\\d]*$");;
private static final Pattern CHAR_NEED_ESCAPE = Pattern.compile("[?|$^*\\\\\\[\\](){}.+]");
private static final int MAX_FETCHSIZE = 1000000;
private static final Map<String, Integer> DEFAULT_FETCHSIZE_MAP = new HashMap<>();
private static final int ORACLE_DEFAULT_FETCHSIZE = 128;
private static final int DB2_DEFAULT_FETCHSIZE = 50;
private static final int POSTGRE_DEFAULT_FETCHSIZE = 10000;
private static final int EMPTY_FETCHSIZE = -2;
// carl:DBCP的一些属性 // carl:DBCP的一些属性
private IntegerEditor DBCP_INITIAL_SIZE = new IntegerEditor(); private IntegerEditor DBCP_INITIAL_SIZE = new IntegerEditor();
private IntegerEditor DBCP_MAX_ACTIVE = new IntegerEditor(); private IntegerEditor DBCP_MAX_ACTIVE = new IntegerEditor();
@ -36,11 +59,24 @@ public class DBCPAttrPane extends BasicPane {
private IntegerEditor DBCP_NUMTESTSPEREVICTIONRUN = new IntegerEditor(); private IntegerEditor DBCP_NUMTESTSPEREVICTIONRUN = new IntegerEditor();
private IntegerEditor DBCP_MINEVICTABLEIDLETIMEMILLIS = new IntegerEditor(); private IntegerEditor DBCP_MINEVICTABLEIDLETIMEMILLIS = new IntegerEditor();
private UITextField FETCHSIZE = new UITextField();
private JPanel defaultPane;
private JPanel northFlowPane;
private JPanel southFlowPane;
static {
DEFAULT_FETCHSIZE_MAP.put("Oracle", ORACLE_DEFAULT_FETCHSIZE);
DEFAULT_FETCHSIZE_MAP.put("DB2", DB2_DEFAULT_FETCHSIZE);
DEFAULT_FETCHSIZE_MAP.put("Postgre", POSTGRE_DEFAULT_FETCHSIZE);
}
public DBCPAttrPane() { public DBCPAttrPane() {
JPanel defaultPane = this; defaultPane = this;
// JPanel northFlowPane // JPanel northFlowPane
JPanel northFlowPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); northFlowPane = FRGUIPaneFactory.createTitledBorderPane(Toolkit.i18nText("Fine-Design_Basic_ConnectionPool_Attr"));
northFlowPane.setPreferredSize(new Dimension(630, 320));
defaultPane.add(northFlowPane, BorderLayout.NORTH); defaultPane.add(northFlowPane, BorderLayout.NORTH);
DBCP_VALIDATION_QUERY.setColumns(15); DBCP_VALIDATION_QUERY.setColumns(15);
@ -67,7 +103,6 @@ public class DBCPAttrPane extends BasicPane {
DBCP_MINEVICTABLEIDLETIMEMILLIS}}; DBCP_MINEVICTABLEIDLETIMEMILLIS}};
JPanel contextPane = TableLayoutHelper.createGapTableLayoutPane(comps, rowSize, columnSize, 10, 4); JPanel contextPane = TableLayoutHelper.createGapTableLayoutPane(comps, rowSize, columnSize, 10, 4);
contextPane.setBorder(BorderFactory.createMatteBorder(1, 1, 1, 1, UIConstants.LINE_COLOR));
northFlowPane.add(contextPane); northFlowPane.add(contextPane);
} }
@ -89,6 +124,14 @@ public class DBCPAttrPane extends BasicPane {
this.DBCP_MINEVICTABLEIDLETIMEMILLIS.setValue(dbcpAttr.getMinEvictableIdleTimeMillis() / TIME_MULTIPLE); this.DBCP_MINEVICTABLEIDLETIMEMILLIS.setValue(dbcpAttr.getMinEvictableIdleTimeMillis() / TIME_MULTIPLE);
this.DBCP_NUMTESTSPEREVICTIONRUN.setValue(dbcpAttr.getNumTestsPerEvictionRun()); this.DBCP_NUMTESTSPEREVICTIONRUN.setValue(dbcpAttr.getNumTestsPerEvictionRun());
this.DBCP_TIMEBETWEENEVICTIONRUNSMILLS.setValue(dbcpAttr.getTimeBetweenEvictionRunsMillis()); this.DBCP_TIMEBETWEENEVICTIONRUNSMILLS.setValue(dbcpAttr.getTimeBetweenEvictionRunsMillis());
Integer fetchSize = DEFAULT_FETCHSIZE_MAP.get(JDBCConnectionDef.getInstance().getDatabaseName());
if (fetchSize != null) {
if (jdbcDatabase.getFetchSize() == EMPTY_FETCHSIZE) {
this.FETCHSIZE.setText(StringUtils.EMPTY);
} else {
this.FETCHSIZE.setText(jdbcDatabase.getFetchSize() == -1 ? String.valueOf(fetchSize) : String.valueOf(jdbcDatabase.getFetchSize()));
}
}
} }
public void update(JDBCDatabaseConnection jdbcDatabase) { public void update(JDBCDatabaseConnection jdbcDatabase) {
@ -109,10 +152,98 @@ public class DBCPAttrPane extends BasicPane {
dbcpAttr.setMinEvictableIdleTimeMillis(((Number) this.DBCP_MINEVICTABLEIDLETIMEMILLIS.getValue()).intValue() * TIME_MULTIPLE); dbcpAttr.setMinEvictableIdleTimeMillis(((Number) this.DBCP_MINEVICTABLEIDLETIMEMILLIS.getValue()).intValue() * TIME_MULTIPLE);
dbcpAttr.setNumTestsPerEvictionRun(((Number) this.DBCP_NUMTESTSPEREVICTIONRUN.getValue()).intValue()); dbcpAttr.setNumTestsPerEvictionRun(((Number) this.DBCP_NUMTESTSPEREVICTIONRUN.getValue()).intValue());
dbcpAttr.setTimeBetweenEvictionRunsMillis(((Number) this.DBCP_TIMEBETWEENEVICTIONRUNSMILLS.getValue()).intValue()); dbcpAttr.setTimeBetweenEvictionRunsMillis(((Number) this.DBCP_TIMEBETWEENEVICTIONRUNSMILLS.getValue()).intValue());
Integer fetchSize = DEFAULT_FETCHSIZE_MAP.get(JDBCConnectionDef.getInstance().getDatabaseName());
if (fetchSize != null) {
if (StringUtils.isEmpty(this.FETCHSIZE.getText())) {
jdbcDatabase.setFetchSize(EMPTY_FETCHSIZE);
} else {
jdbcDatabase.setFetchSize(Integer.parseInt(this.FETCHSIZE.getText()));
}
}
}
@Override
public BasicDialog showWindow(Window window) {
String databaseName = JDBCConnectionDef.getInstance().getDatabaseName();
if (showOtherConfig(databaseName)) {
southFlowPane = FRGUIPaneFactory.createTitledBorderPane(Toolkit.i18nText("Fine-Design_Report_Other"));
southFlowPane.setPreferredSize(new Dimension(630, 200));
double f = TableLayout.FILL;
double[] rowSize = {f};
double otherColumnSize = GraphHelper.getWidth(Toolkit.i18nText("Fine-Design_Basic_Connection_Pool_Evictionruns_millis")) + 6;
double[] columnSize = {otherColumnSize, otherColumnSize};
FETCHSIZE.addKeyListener(fetchSizeKeyListener);
FETCHSIZE.addInputMethodListener(fetchSizeInputMethodListener);
FETCHSIZE.setHorizontalAlignment(JTextField.RIGHT);
Component[][] comps = {
{new UILabel("Fetchsize:", SwingConstants.RIGHT), FETCHSIZE}
};
JPanel otherConfigPane = TableLayoutHelper.createGapTableLayoutPane(comps, rowSize, columnSize, 10, 4);
southFlowPane.add(otherConfigPane);
defaultPane.removeAll();
defaultPane.add(northFlowPane, BorderLayout.NORTH);
defaultPane.add(southFlowPane, BorderLayout.SOUTH);
} else {
if (southFlowPane != null) {
defaultPane.remove(southFlowPane);
}
}
return this.showWindow(window, null);
}
private boolean showOtherConfig(Object dbType) {
return ComparatorUtils.equals(dbType, "Oracle") || ComparatorUtils.equals(dbType, "DB2") || ComparatorUtils.equals(dbType, "Postgre");
}
KeyListener fetchSizeKeyListener = new KeyAdapter() {
@Override
public void keyReleased(KeyEvent e) {
String fetchSize = FETCHSIZE.getText();
if (!isFetchSizeValid(fetchSize)) {
FETCHSIZE.setText(fetchSize.replaceAll(getCharNeedReplace(e.getKeyChar()), ""));
if (!isFetchSizeValid(FETCHSIZE.getText())) {
FETCHSIZE.setText(StringUtils.EMPTY);
}
} else if (FETCHSIZE.getText().length() > String.valueOf(MAX_FETCHSIZE).length() || Long.parseLong(FETCHSIZE.getText()) > MAX_FETCHSIZE) {
FETCHSIZE.setText(String.valueOf(MAX_FETCHSIZE));
}
}
};
InputMethodListener fetchSizeInputMethodListener = new InputMethodListener() {
@Override
public void inputMethodTextChanged(InputMethodEvent event) {
if (null == event.getText()) {
return;
}
char ch = event.getText().current();
if (!(ch >= '0' && ch <= '9')) {
event.consume();
}
}
@Override
public void caretPositionChanged(InputMethodEvent event) {
}
};
private boolean isFetchSizeValid(String fetchSize) {
return FETCHSIZE_PATTERN.matcher(fetchSize).find();
}
private String getCharNeedReplace(char c) {
String charNeedReplace = c + "";
Matcher matcher = CHAR_NEED_ESCAPE.matcher(charNeedReplace);
if (matcher.find()) {
charNeedReplace = "\\" + charNeedReplace;
}
return charNeedReplace;
} }
@Override @Override
protected String title4PopupWindow() { protected String title4PopupWindow() {
return Toolkit.i18nText("Fine-Design_Basic_ConnectionPool_Attr"); return Toolkit.i18nText("Fine-Design_Basic_Advanced_Setup");
} }
} }

5
designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java

@ -12,7 +12,6 @@ import com.fr.data.solution.entity.DriverPage;
import com.fr.data.solution.processor.ClassNotFoundExceptionSolutionProcessor; import com.fr.data.solution.processor.ClassNotFoundExceptionSolutionProcessor;
import com.fr.data.solution.processor.SolutionProcessor; import com.fr.data.solution.processor.SolutionProcessor;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.ActionLabel; import com.fr.design.gui.ilable.ActionLabel;
@ -338,7 +337,7 @@ public abstract class DatabaseConnectionPane<E extends com.fr.data.impl.Connecti
Toolkit.i18nText("Fine-Design_Basic_Advanced") Toolkit.i18nText("Fine-Design_Basic_Advanced")
)); ));
if (mainPanel instanceof JDBCDefPane) { if (mainPanel instanceof JDBCDefPane) {
ActionLabel actionLabel = new ActionLabel(Toolkit.i18nText("Fine-Design_Basic_ConnectionPool_Attr")); ActionLabel actionLabel = new ActionLabel(Toolkit.i18nText("Fine-Design_Basic_Advanced_Setup"));
actionLabel.addActionListener(new ActionListener() { actionLabel.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
JDialog wDialog = createJDialog(); JDialog wDialog = createJDialog();
@ -418,7 +417,7 @@ public abstract class DatabaseConnectionPane<E extends com.fr.data.impl.Connecti
return false; return false;
} }
protected static BasicPane getAdvancedAttrPane() { protected static DBCPAttrPane getAdvancedAttrPane() {
return dbcpAttrPane; return dbcpAttrPane;
} }

47
designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCConnectionDef.java

@ -0,0 +1,47 @@
package com.fr.design.data.datapane.connect;
import com.fr.data.impl.JDBCDatabaseConnection;
/**
* JDBCDefPane和DBCPAttrPane沟通的桥梁
*
*/
public class JDBCConnectionDef {
private static volatile JDBCConnectionDef instance;
private String databaseName;
private JDBCDatabaseConnection connection;
public static JDBCConnectionDef getInstance() {
if (instance == null) {
synchronized (JDBCConnectionDef.class) {
if (instance == null) {
instance = new JDBCConnectionDef();
}
}
}
return instance;
}
private JDBCConnectionDef() {
}
public String getDatabaseName() {
return databaseName;
}
public void setDatabaseName(String databaseName) {
this.databaseName = databaseName;
}
public JDBCDatabaseConnection getConnection() {
return connection;
}
public void setConnection(String databaseName, JDBCDatabaseConnection connection) {
this.databaseName = databaseName;
this.connection = connection;
}
}

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

@ -52,8 +52,8 @@ public class JDBCDefPane extends JPanel {
public static final String DRIVER_TYPE = "driver_type"; public static final String DRIVER_TYPE = "driver_type";
public static final String USER_NAME = "user_name"; public static final String USER_NAME = "user_name";
private static final String OTHER_DB = "Others"; private static final String OTHER_DB = "Others";
private static final Pattern ORACLE_URL = Pattern.compile("^jdbc:oracle:thin:@[/]*([-0-9a-zA-Z_\\.]+)(:([0-9]+|port))?([:/](.*))?.*", Pattern.CASE_INSENSITIVE); private static final Pattern ORACLE_URL = Pattern.compile("^jdbc:oracle:thin:@[/]*([-0-9a-zA-Z_\\.\\\\]+)(:([0-9]+|port))?([:/](.*))?.*", Pattern.CASE_INSENSITIVE);
private static final Pattern GENERAL_URL = Pattern.compile("^jdbc:(mysql|sqlserver|db2|derby|postgresql|inceptor|inceptor2|hive2)://([-0-9a-zA-Z_\\.]+)(:([0-9]+|port))?((/|;DatabaseName=)(.*))?.*", Pattern.CASE_INSENSITIVE); private static final Pattern GENERAL_URL = Pattern.compile("^jdbc:(mysql|sqlserver|db2|derby|postgresql|inceptor|inceptor2|hive2)://([-0-9a-zA-Z_\\.\\\\]+)(:([0-9]+|port))?((/|;DatabaseName=)(.*))?.*", Pattern.CASE_INSENSITIVE);
private static final Pattern PORT = Pattern.compile("^0$|^[1-9][\\d]*[\\d]*$"); private static final Pattern PORT = Pattern.compile("^0$|^[1-9][\\d]*[\\d]*$");
private static final Pattern CHAR_NEED_ESCAPE = Pattern.compile("[?|$^*\\\\\\[\\](){}.+]"); private static final Pattern CHAR_NEED_ESCAPE = Pattern.compile("[?|$^*\\\\\\[\\](){}.+]");
// 编码转换. // 编码转换.
@ -330,6 +330,8 @@ public class JDBCDefPane extends JPanel {
jdbcDatabase.setDatabase(StringUtils.EMPTY); jdbcDatabase.setDatabase(StringUtils.EMPTY);
} }
changePane(dbtypeComboBox.getSelectedItem()); changePane(dbtypeComboBox.getSelectedItem());
JDBCConnectionDef.getInstance().setConnection((String) dbtypeComboBox.getSelectedItem(), jdbcDatabase);
DatabaseConnectionPane.JDBC.getAdvancedAttrPane().populate(jdbcDatabase);
} }
}; };

35
designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ClassTableDataPane.java

@ -4,7 +4,6 @@ import com.fr.base.Parameter;
import com.fr.data.impl.ClassTableData; import com.fr.data.impl.ClassTableData;
import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.formula.JavaEditorPane;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itableeditorpane.ParameterTableModel; import com.fr.design.gui.itableeditorpane.ParameterTableModel;
@ -15,14 +14,18 @@ import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.script.Calculator; import com.fr.script.Calculator;
import com.fr.stable.ParameterProvider; import com.fr.stable.ParameterProvider;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.stable.project.ProjectConstants; import com.fr.stable.project.ProjectConstants;
import javax.swing.*; import javax.swing.BorderFactory;
import java.awt.*; import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dialog;
import java.awt.Dimension;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
@ -65,30 +68,6 @@ public class ClassTableDataPane extends AbstractTableDataPane<ClassTableData> {
dlg.setVisible(true); dlg.setVisible(true);
} }
}); });
UIButton editButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Edit"));
editButton.setPreferredSize(new Dimension(
editButton.getPreferredSize().width,
classNameTextField.getPreferredSize().height));
reportletNamePane.add(editButton);
editButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
final JavaEditorPane javaEditorPane = new JavaEditorPane(classNameTextField.getText(), JavaEditorPane.DEFAULT_TABLEDATA_STRING);
final BasicDialog dlg = javaEditorPane.showMediumWindow(SwingUtilities.getWindowAncestor(ClassTableDataPane.this),
new DialogActionAdapter() {
public void doOk() {
classNameTextField.setText(javaEditorPane.getClassText());
}
});
javaEditorPane.addSaveActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
dlg.doOK();
}
});
dlg.setVisible(true);
}
});
Component[][] components = { Component[][] components = {
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_DS_Class_Name") + ":"), reportletNamePane}, {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_DS_Class_Name") + ":"), reportletNamePane},

4
designer-base/src/main/java/com/fr/design/editor/editor/Editor.java

@ -4,6 +4,7 @@
package com.fr.design.editor.editor; package com.fr.design.editor.editor;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.*;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
@ -34,6 +35,9 @@ public abstract class Editor<T> extends JComponent {
// 约定图片的文件名为this.getName(),处理起来方便些 // 约定图片的文件名为this.getName(),处理起来方便些
// b:这里国际化没有考虑 // b:这里国际化没有考虑
public Icon getIcon() { public Icon getIcon() {
if (StringUtils.isEmpty(this.getIconName())) {
return null;
}
String iconName = "com/fr/design/images/buttonicon/" + this.getIconName() + ".png"; String iconName = "com/fr/design/images/buttonicon/" + this.getIconName() + ".png";
try { try {
return BaseUtils.readIcon(iconName); return BaseUtils.readIcon(iconName);

30
designer-base/src/main/java/com/fr/design/gui/frpane/UIPercentDragPane.java

@ -0,0 +1,30 @@
package com.fr.design.gui.frpane;
import com.fr.design.gui.ilable.UILabel;
import javax.swing.*;
import java.awt.*;
/**
* @author Starryi
* @version 10.0.18
* Created by Starryi on 2021/7/3
*/
public class UIPercentDragPane extends JPanel {
private final UINumberDragPane dragPane = new UINumberDragPane(0, 100, 1);
public UIPercentDragPane() {
setLayout(new BorderLayout());
add(dragPane, BorderLayout.CENTER);
add(new UILabel(" %"), BorderLayout.EAST);
}
public void populateBean(double value) {
dragPane.populateBean(value * 100);
}
public double updateBean() {
return dragPane.updateBean() / 100.0;
}
}

57
designer-base/src/main/java/com/fr/design/gui/icombobox/LineComboBox.java

@ -3,22 +3,14 @@
*/ */
package com.fr.design.gui.icombobox; package com.fr.design.gui.icombobox;
import com.fr.base.FRContext;
import com.fr.base.GraphHelper; import com.fr.base.GraphHelper;
import com.fr.base.ScreenResolution;
import com.fr.general.FRFont;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import java.awt.Component; import com.fr.stable.StringUtils;
import java.awt.Dimension;
import java.awt.Font; import javax.swing.*;
import java.awt.FontMetrics; import java.awt.*;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.geom.GeneralPath; import java.awt.geom.GeneralPath;
import java.awt.geom.Point2D; import java.awt.geom.Point2D;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JLabel;
import javax.swing.JList;
/** /**
@ -59,6 +51,13 @@ public class LineComboBox extends UIComboBox {
this.setSelectedItem(new Integer(style)); this.setSelectedItem(new Integer(style));
} }
protected String toStringFromStyle(int style) {
if (style == Constants.LINE_NONE) {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_None");
}
return null;
}
/** /**
* CellRenderer. * CellRenderer.
*/ */
@ -67,31 +66,27 @@ public class LineComboBox extends UIComboBox {
JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
JLabel comp= (JLabel)super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); JLabel comp= (JLabel)super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
this.style = ((Integer) value).intValue(); this.style = ((Integer) value).intValue();
comp.setText(null); String displayString = toStringFromStyle(style);
if (StringUtils.isNotEmpty(displayString)) {
comp.setText(" " + displayString);
} else {
comp.setText(null);
}
return comp; return comp;
} }
public void paint(Graphics g) { public void paint(Graphics g) {
super.paint(g); super.paint(g);
Graphics2D g2d = (Graphics2D) g; if (StringUtils.isEmpty(toStringFromStyle(style))) {
Graphics2D g2d = (Graphics2D) g;
Dimension d = getSize();
g2d.setColor(getForeground()); Dimension d = getSize();
g2d.setColor(getForeground());
FRFont font = FRContext.getDefaultValues().getFRFont();
int resolution = ScreenResolution.getScreenResolution();
Font rfont = font.applyResolutionNP(resolution);
g2d.setFont(rfont);
FontMetrics fm = GraphHelper.getFontMetrics(rfont);
if (style == Constants.LINE_NONE) {
//draw "none" string
GraphHelper.drawString(g2d, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_None"), 4, (d.height - fm.getHeight()) / 2D + fm.getAscent());
} else {
GraphHelper.drawLine(g2d, 4, d.height / 2D, d.width - 8D, d.height / 2D, style); GraphHelper.drawLine(g2d, 4, d.height / 2D, d.width - 8D, d.height / 2D, style);
}
if(isShowAxisWithLineStyle()) { // 带有坐标轴箭头的样式.
if(isShowAxisWithLineStyle()) { // 带有坐标轴箭头的样式. drawArrow(g2d, new Point2D.Double(4, d.height / 2D), new Point2D.Double(d.width - 8D, d.height / 2D));
drawArrow(g2d, new Point2D.Double(4, d.height / 2D), new Point2D.Double(d.width - 8D, d.height / 2D)); }
} }
} }

8
designer-base/src/main/java/com/fr/design/gui/ipasswordfield/UIPasswordFieldWithFixedLength.java

@ -68,7 +68,13 @@ public class UIPasswordFieldWithFixedLength extends UIPassWordField {
this.addMouseListener(new MouseAdapter() { this.addMouseListener(new MouseAdapter() {
@Override @Override
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
UIPasswordFieldWithFixedLength.this.clearPassword = true; UIPasswordFieldWithFixedLength.this.clearPassword = true;
}
@Override
public void mousePressed(MouseEvent e) {
// 防止拖动进入
UIPasswordFieldWithFixedLength.this.clearPassword = true;
} }
}); });
this.addKeyListener(new KeyAdapter() { this.addKeyListener(new KeyAdapter() {

9
designer-base/src/main/java/com/fr/design/gui/ispinner/UISpinner.java

@ -58,6 +58,7 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver
* Spinner内的数字文本框长度 * Spinner内的数字文本框长度
*/ */
private int numberFieldColumns; private int numberFieldColumns;
private boolean hasTextFieldFocus = false;
public UISpinner() { public UISpinner() {
@ -318,7 +319,7 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver
@Override @Override
public void mouseWheelMoved(MouseWheelEvent e) { public void mouseWheelMoved(MouseWheelEvent e) {
if (isEnabled() && e.getScrollType() == MouseWheelEvent.WHEEL_UNIT_SCROLL) { if (hasTextFieldFocus && isEnabled() && e.getScrollType() == MouseWheelEvent.WHEEL_UNIT_SCROLL) {
setValue(value - e.getWheelRotation()); setValue(value - e.getWheelRotation());
} }
} }
@ -330,8 +331,14 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver
textField.getDocument().removeDocumentListener(docListener); textField.getDocument().removeDocumentListener(docListener);
textField.getDocument().addDocumentListener(docListener); textField.getDocument().addDocumentListener(docListener);
textField.addFocusListener(new FocusAdapter() { textField.addFocusListener(new FocusAdapter() {
@Override
public void focusGained(FocusEvent e) {
hasTextFieldFocus = true;
}
@Override @Override
public void focusLost(FocusEvent e) { public void focusLost(FocusEvent e) {
hasTextFieldFocus = false;
textField.getDocument().removeDocumentListener(docListener); textField.getDocument().removeDocumentListener(docListener);
textField.setValue(value); textField.setValue(value);
textField.getDocument().addDocumentListener(docListener); textField.getDocument().addDocumentListener(docListener);

10
designer-base/src/main/java/com/fr/design/gui/style/BackgroundPane.java

@ -70,13 +70,13 @@ public class BackgroundPane extends AbstractBasicStylePane {
double f = TableLayout.FILL; double f = TableLayout.FILL;
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{null, null}, new Component[]{null},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Fill") + " ", SwingConstants.LEFT),typeComboBox}, new Component[]{typeComboBox},
new Component[]{null, centerPane} new Component[]{centerPane}
}; };
double[] rowSize = {p, p, p}; double[] rowSize = {p, p, p};
double[] columnSize = {p,f}; double[] columnSize = {f};
int[][] rowCount = {{1, 1},{1, 1},{1, 1}}; int[][] rowCount = {{1},{1},{1}};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_LARGE, LayoutConstants.VGAP_MEDIUM); JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_LARGE, LayoutConstants.VGAP_MEDIUM);
this.add(panel, BorderLayout.CENTER); this.add(panel, BorderLayout.CENTER);

7
designer-base/src/main/java/com/fr/design/gui/style/BackgroundSpecialPane.java

@ -39,7 +39,7 @@ public class BackgroundSpecialPane extends BackgroundPane{
fireStateChanged(); fireStateChanged();
} }
}); });
GradientBackgroundQuickPane gradientPane = new GradientBackgroundQuickPane(); GradientBackgroundQuickPane gradientPane = createGradientBackgroundQuickPane();
gradientPane.registerChangeListener(new UIObserverListener() { gradientPane.registerChangeListener(new UIObserverListener() {
@Override @Override
public void doChange() { public void doChange() {
@ -68,4 +68,9 @@ public class BackgroundSpecialPane extends BackgroundPane{
return kinds.toArray(new BackgroundQuickPane[kinds.size()]); return kinds.toArray(new BackgroundQuickPane[kinds.size()]);
} }
protected GradientBackgroundQuickPane createGradientBackgroundQuickPane() {
// 使用默认的150宽度构建渐变条
return new GradientBackgroundQuickPane();
}
} }

4
designer-base/src/main/java/com/fr/design/locale/impl/BbsRegisterMark.java

@ -16,8 +16,8 @@ import java.util.Map;
public class BbsRegisterMark implements LocaleMark<String> { public class BbsRegisterMark implements LocaleMark<String> {
private final Map<Locale, String> map = new HashMap<>(); private final Map<Locale, String> map = new HashMap<>();
private static final String BBS_REGISTER_CN = CloudCenter.getInstance().acquireUrlByKind("bbs.register", "http://id.fanruan.com/register/register.php?clueSource=activityfr"); private static final String BBS_REGISTER_CN = CloudCenter.getInstance().acquireUrlByKind("bbs.register", "https://id.fanruan.com/register/register.php?clueSource=activityfr");
private static final String BBS_REGISTER_TW = CloudCenter.getInstance().acquireUrlByKind("bbs.register", "http://id.fanruan.com/register/register.php?clueSource=activityfr"); private static final String BBS_REGISTER_TW = CloudCenter.getInstance().acquireUrlByKind("bbs.register", "https://id.fanruan.com/register/register.php?clueSource=activityfr");
private static final String BBS_REGISTER_EN = CloudCenter.getInstance().acquireUrlByKind("bbs.register.en_US", "https://id.fanruan.com/en/register/register.php"); private static final String BBS_REGISTER_EN = CloudCenter.getInstance().acquireUrlByKind("bbs.register.en_US", "https://id.fanruan.com/en/register/register.php");
private static final String BBS_REGISTER_KR = CloudCenter.getInstance().acquireUrlByKind("bbs.register.en_US", "https://id.fanruan.com/en/register/register.php"); private static final String BBS_REGISTER_KR = CloudCenter.getInstance().acquireUrlByKind("bbs.register.en_US", "https://id.fanruan.com/en/register/register.php");
private static final String BBS_REGISTER_JP = CloudCenter.getInstance().acquireUrlByKind("bbs.register.en_US", "https://id.fanruan.com/en/register/register.php"); private static final String BBS_REGISTER_JP = CloudCenter.getInstance().acquireUrlByKind("bbs.register.en_US", "https://id.fanruan.com/en/register/register.php");

4
designer-base/src/main/java/com/fr/design/locale/impl/BbsResetMark.java

@ -16,8 +16,8 @@ import java.util.Map;
public class BbsResetMark implements LocaleMark<String> { public class BbsResetMark implements LocaleMark<String> {
private final Map<Locale, String> map = new HashMap<>(); private final Map<Locale, String> map = new HashMap<>();
private static final String BBS_RESET_CN = CloudCenter.getInstance().acquireUrlByKind("bbs.reset", "http://id.fanruan.com/forget/forget.php?clue=activityfr"); private static final String BBS_RESET_CN = CloudCenter.getInstance().acquireUrlByKind("bbs.reset", "https://id.fanruan.com/forget/forget.php?clue=activityfr");
private static final String BBS_RESET_TW = CloudCenter.getInstance().acquireUrlByKind("bbs.reset", "http://id.fanruan.com/forget/forget.php?clue=activityfr"); private static final String BBS_RESET_TW = CloudCenter.getInstance().acquireUrlByKind("bbs.reset", "https://id.fanruan.com/forget/forget.php?clue=activityfr");
private static final String BBS_RESET_EN = CloudCenter.getInstance().acquireUrlByKind("bbs.reset.en_US", "https://id.fanruan.com/en/forget/forget.php"); private static final String BBS_RESET_EN = CloudCenter.getInstance().acquireUrlByKind("bbs.reset.en_US", "https://id.fanruan.com/en/forget/forget.php");
private static final String BBS_RESET_KR = CloudCenter.getInstance().acquireUrlByKind("bbs.reset.en_US", "https://id.fanruan.com/en/forget/forget.php"); private static final String BBS_RESET_KR = CloudCenter.getInstance().acquireUrlByKind("bbs.reset.en_US", "https://id.fanruan.com/en/forget/forget.php");
private static final String BBS_RESET_JP = CloudCenter.getInstance().acquireUrlByKind("bbs.reset.en_US", "https://id.fanruan.com/en/forget/forget.php"); private static final String BBS_RESET_JP = CloudCenter.getInstance().acquireUrlByKind("bbs.reset.en_US", "https://id.fanruan.com/en/forget/forget.php");

4
designer-base/src/main/java/com/fr/design/login/AbstractDesignerSSO.java

@ -20,6 +20,10 @@ public abstract class AbstractDesignerSSO extends UpdateAction {
@Override @Override
public void actionPerformed(ActionEvent event) { public void actionPerformed(ActionEvent event) {
String url = getJumpUrl(); String url = getJumpUrl();
if (!DesignerLoginUtils.isOnline()) {
BrowseUtils.browser(url);
return;
}
DesignerEnvManager manager = DesignerEnvManager.getEnvManager(); DesignerEnvManager manager = DesignerEnvManager.getEnvManager();
int uid = manager.getDesignerLoginUid(); int uid = manager.getDesignerLoginUid();
if (uid > 0) { if (uid > 0) {

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

@ -4,9 +4,13 @@ import com.fr.base.FRContext;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.dialog.UIDialog; import com.fr.design.dialog.UIDialog;
import com.fr.design.event.DesignerOpenedListener; import com.fr.design.event.DesignerOpenedListener;
import com.fr.design.login.utils.DesignerLoginUtils;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.os.impl.SupportOSImpl; import com.fr.design.os.impl.SupportOSImpl;
import com.fr.design.update.push.DesignerPushUpdateManager; 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.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.WindowConstants; import javax.swing.WindowConstants;
@ -35,7 +39,7 @@ public class DesignerGuideHelper {
public static void prepareShowGuideDialog() { public static void prepareShowGuideDialog() {
// 如果存在更新升级的弹窗,则不显示引导页面 // 如果存在更新升级的弹窗,则不显示引导页面
if (!SupportOSImpl.DESIGNER_LOGIN.support() || !FRContext.isChineseEnv() || DesignerPushUpdateManager.getInstance().isShouldPopUp()) { if (!DesignerLoginUtils.isOnline() || !SupportOSImpl.DESIGNER_LOGIN.support() || !FRContext.isChineseEnv() || DesignerPushUpdateManager.getInstance().isShouldPopUp()) {
return; return;
} }
if (isActivatedForOneWeek()) { if (isActivatedForOneWeek()) {

3
designer-base/src/main/java/com/fr/design/login/message/DesignerMessageHelper.java

@ -51,6 +51,9 @@ public class DesignerMessageHelper {
} }
public void prepareShowMessage() { public void prepareShowMessage() {
if (!DesignerLoginUtils.isOnline()) {
return;
}
DesignerContext.getDesignerFrame().addDesignerOpenedListener(new DesignerOpenedListener() { DesignerContext.getDesignerFrame().addDesignerOpenedListener(new DesignerOpenedListener() {
@Override @Override
public void designerOpened() { public void designerOpened() {

19
designer-base/src/main/java/com/fr/design/login/utils/DesignerLoginUtils.java

@ -3,10 +3,13 @@ package com.fr.design.login.utils;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.mainframe.toast.DesignerToastMsgUtil; import com.fr.design.mainframe.toast.DesignerToastMsgUtil;
import com.fr.general.CloudCenter; import com.fr.general.CloudCenter;
import com.fr.general.CloudCenterConfig;
import com.fr.general.GeneralContext; import com.fr.general.GeneralContext;
import com.fr.general.http.HttpToolbox;
import com.fr.general.log.MessageFormatter; import com.fr.general.log.MessageFormatter;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
import com.fr.third.org.bouncycastle.util.encoders.Hex; import com.fr.third.org.bouncycastle.util.encoders.Hex;
import java.awt.Window; import java.awt.Window;
import java.security.SecureRandom; import java.security.SecureRandom;
@ -49,6 +52,9 @@ public class DesignerLoginUtils {
} }
public static String generateDesignerSSOUrl(String referrer) { public static String generateDesignerSSOUrl(String referrer) {
if (!DesignerLoginUtils.isOnline()) {
return referrer;
}
String ssoTemplate = CloudCenter.getInstance().acquireUrlByKind("designer.sso.api", "https://id.fanruan.com/api/app/?code={}&referrer={}"); String ssoTemplate = CloudCenter.getInstance().acquireUrlByKind("designer.sso.api", "https://id.fanruan.com/api/app/?code={}&referrer={}");
try { try {
String code = generateLoginCode(); String code = generateLoginCode();
@ -60,6 +66,19 @@ public class DesignerLoginUtils {
return referrer; return referrer;
} }
public static boolean isOnline() {
if (CloudCenterConfig.getInstance().isOnline()) {
String ping = CloudCenter.getInstance().acquireConf("ping", StringUtils.EMPTY);
if (StringUtils.isNotEmpty(ping)) {
try {
return StringUtils.isEmpty(HttpToolbox.get(ping));
} catch (Exception ignore) {
}
}
}
return false;
}
private static String generateLoginCode() throws Exception { private static String generateLoginCode() throws Exception {
DesignerEnvManager manager = DesignerEnvManager.getEnvManager(); DesignerEnvManager manager = DesignerEnvManager.getEnvManager();
JSONObject jo = JSONObject.create(); JSONObject jo = JSONObject.create();

19
designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java

@ -72,6 +72,8 @@ import com.fr.start.OemHandler;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import com.fr.workspace.Workspace; import com.fr.workspace.Workspace;
import com.fr.workspace.connect.WorkspaceConnectionInfo; import com.fr.workspace.connect.WorkspaceConnectionInfo;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.CopyOnWriteArrayList;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@ -179,6 +181,8 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
private int contentHeight = (int) (java.awt.Toolkit.getDefaultToolkit().getScreenSize().getHeight()); private int contentHeight = (int) (java.awt.Toolkit.getDefaultToolkit().getScreenSize().getHeight());
private Map<WindowListener, SafeWindowListener> map = new HashMap<>();
private WindowAdapter windowAdapter = new WindowAdapter() { private WindowAdapter windowAdapter = new WindowAdapter() {
@Override @Override
@ -535,6 +539,21 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
} }
} }
@Override
public synchronized void addWindowListener(WindowListener l) {
SafeWindowListener safeWindowListener = new SafeWindowListener(l);
map.put(l, safeWindowListener);
super.addWindowListener(safeWindowListener);
}
@Override
public synchronized void removeWindowListener(WindowListener l) {
SafeWindowListener safeWindowListener = map.remove(l);
if (safeWindowListener != null) {
super.removeWindowListener(safeWindowListener);
}
}
private void addMacOsListener() { private void addMacOsListener() {
OSSupportCenter.buildAction(new MacOsAddListenerAction(), SupportOSImpl.DOCK_QUIT); OSSupportCenter.buildAction(new MacOsAddListenerAction(), SupportOSImpl.DOCK_QUIT);
} }

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

@ -1,6 +1,7 @@
package com.fr.design.mainframe; package com.fr.design.mainframe;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import java.awt.Color; import java.awt.Color;
import java.awt.Component; import java.awt.Component;
@ -17,9 +18,13 @@ import javax.swing.JPanel;
*/ */
public class OpenLoadingPane extends JPanel { public class OpenLoadingPane extends JPanel {
private static final ImageIcon LOADING_ICON = new ImageIcon(IOUtils.readImage("/com/fr/design/images/mainframe/loading.gif")); private static final ImageIcon LOADING_ICON = new ImageIcon(IOUtils.readImage("/com/fr/design/images/mainframe/openloading.png"));
private static final Color TIP_COLOR = new Color(108, 174, 235);
private static final int Y_GAP = 50;
private static final int X_GAP = 10;
private UILabel loadingLabel; private UILabel loadingLabel;
private UILabel tipLabel;
public OpenLoadingPane() { public OpenLoadingPane() {
@ -47,7 +52,12 @@ public class OpenLoadingPane extends JPanel {
int loadingLabelHeight = loadingLabel.getPreferredSize().height; int loadingLabelHeight = loadingLabel.getPreferredSize().height;
int loadingLabelX = (width - loadingLabelWidth) / 2; int loadingLabelX = (width - loadingLabelWidth) / 2;
int loadingLabelY = (height - loadingLabelHeight) / 2; int loadingLabelY = (height - loadingLabelHeight) / 2;
int tipLabelWidth = tipLabel.getPreferredSize().width;
int tipLabelHeight = tipLabel.getPreferredSize().height;
int tipLabelX = (width - tipLabelWidth) / 2 + X_GAP;
int tipLabelY = loadingLabelY + loadingLabelHeight - Y_GAP;
loadingLabel.setBounds(loadingLabelX, loadingLabelY, loadingLabelWidth, loadingLabelHeight); loadingLabel.setBounds(loadingLabelX, loadingLabelY, loadingLabelWidth, loadingLabelHeight);
tipLabel.setBounds(tipLabelX, tipLabelY, tipLabelWidth, tipLabelHeight);
} }
@Override @Override
@ -56,7 +66,10 @@ public class OpenLoadingPane extends JPanel {
}); });
setBackground(Color.WHITE); setBackground(Color.WHITE);
loadingLabel = new UILabel(LOADING_ICON); loadingLabel = new UILabel(LOADING_ICON);
tipLabel = new UILabel(Toolkit.i18nText("Fine-Design_Open_Template_Loading"));
tipLabel.setForeground(TIP_COLOR);
add(loadingLabel); add(loadingLabel);
add(tipLabel);
} }
} }

84
designer-base/src/main/java/com/fr/design/mainframe/SafeWindowListener.java

@ -0,0 +1,84 @@
package com.fr.design.mainframe;
import com.fr.log.FineLoggerFactory;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
/**
* 保证监听运行出错也不影响其他功能正常使用
*
* @author hades
* @version 10.0
* Created by hades on 2021/6/30
*/
public class SafeWindowListener implements WindowListener {
private final WindowListener windowListener;
public SafeWindowListener(WindowListener windowListener) {
this.windowListener = windowListener;
}
@Override
public void windowOpened(WindowEvent e) {
try {
windowListener.windowOpened(e);
} catch (Throwable throwable) {
FineLoggerFactory.getLogger().debug(throwable.getMessage(), throwable);
}
}
@Override
public void windowClosing(WindowEvent e) {
try {
windowListener.windowClosing(e);
} catch (Throwable throwable) {
FineLoggerFactory.getLogger().debug(throwable.getMessage(), throwable);
}
}
@Override
public void windowClosed(WindowEvent e) {
try {
windowListener.windowClosed(e);
} catch (Throwable throwable) {
FineLoggerFactory.getLogger().debug(throwable.getMessage(), throwable);
}
}
@Override
public void windowIconified(WindowEvent e) {
try {
windowListener.windowIconified(e);
} catch (Throwable throwable) {
FineLoggerFactory.getLogger().debug(throwable.getMessage(), throwable);
}
}
@Override
public void windowDeiconified(WindowEvent e) {
try {
windowListener.windowDeiconified(e);
} catch (Throwable throwable) {
FineLoggerFactory.getLogger().debug(throwable.getMessage(), throwable);
}
}
@Override
public void windowActivated(WindowEvent e) {
try {
windowListener.windowActivated(e);
} catch (Throwable throwable) {
FineLoggerFactory.getLogger().debug(throwable.getMessage(), throwable);
}
}
@Override
public void windowDeactivated(WindowEvent e) {
try {
windowListener.windowDeactivated(e);
} catch (Throwable throwable) {
FineLoggerFactory.getLogger().debug(throwable.getMessage(), throwable);
}
}
}

23
designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/ImagePreviewPane.java

@ -52,8 +52,15 @@ public class ImagePreviewPane extends JComponent implements Scrollable, ImagePre
private boolean isLoading = false; private boolean isLoading = false;
public ImagePreviewPane() { public ImagePreviewPane() {
sizeLabel = new UILabel(); this(true);
this.add(sizeLabel); }
public ImagePreviewPane(boolean showSizeLabel) {
if (showSizeLabel) {
sizeLabel = new UILabel();
this.add(sizeLabel);
}
this.setBorder(BorderFactory.createEmptyBorder(10, 10, 20, 10)); this.setBorder(BorderFactory.createEmptyBorder(10, 10, 20, 10));
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
this.add(new JPanel() { this.add(new JPanel() {
@ -117,7 +124,9 @@ public class ImagePreviewPane extends JComponent implements Scrollable, ImagePre
((JViewport) this.getParent()).setMinimumSize(newDimension); ((JViewport) this.getParent()).setMinimumSize(newDimension);
((JViewport) this.getParent()).setMaximumSize(newDimension); ((JViewport) this.getParent()).setMaximumSize(newDimension);
} }
sizeLabel.setText(null); if (sizeLabel != null) {
sizeLabel.setText(null);
}
} else { } else {
isLoading = false; isLoading = false;
// wait for the size of image. // wait for the size of image.
@ -128,10 +137,14 @@ public class ImagePreviewPane extends JComponent implements Scrollable, ImagePre
int totalwidth = ImagePreviewPane.this.getWidth(); int totalwidth = ImagePreviewPane.this.getWidth();
int totalheight = ImagePreviewPane.this.getHeight(); int totalheight = ImagePreviewPane.this.getHeight();
String text = imageWidth + "x" + imageHeight; String text = imageWidth + "x" + imageHeight;
sizeLabel.setText(text); if (sizeLabel != null) {
sizeLabel.setText(text);
}
FontMetrics cellFM = this.getFontMetrics(getFont()); FontMetrics cellFM = this.getFontMetrics(getFont());
int width = cellFM.stringWidth(text); int width = cellFM.stringWidth(text);
sizeLabel.setBounds(totalwidth - width - LABEL_DELTA_X, totalheight - LABEL_DELTA_Y, width, LABEL_HEIGHT); if (sizeLabel != null) {
sizeLabel.setBounds(totalwidth - width - LABEL_DELTA_X, totalheight - LABEL_DELTA_Y, width, LABEL_HEIGHT);
}
} }
fireChangeListener(); fireChangeListener();
this.revalidate(); this.revalidate();

2
designer-base/src/main/java/com/fr/design/mainframe/form/FormECDesignerProvider.java

@ -90,4 +90,6 @@ public interface FormECDesignerProvider {
BufferedImage getElementCaseImage(Dimension elementCaseContainerSize); BufferedImage getElementCaseImage(Dimension elementCaseContainerSize);
void refreshPropertyPane(); void refreshPropertyPane();
void removeSelection();
} }

24
designer-base/src/main/java/com/fr/design/ui/ModernUIPane.java

@ -5,8 +5,10 @@ import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.itoolbar.UIToolbar; import com.fr.design.gui.itoolbar.UIToolbar;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.ui.compatible.BuilderDiff;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.web.struct.AssembleComponent; import com.fr.web.struct.AssembleComponent;
import com.teamdev.jxbrowser.browser.callback.InjectJsCallback;
import com.teamdev.jxbrowser.chromium.Browser; import com.teamdev.jxbrowser.chromium.Browser;
import com.teamdev.jxbrowser.chromium.BrowserType; import com.teamdev.jxbrowser.chromium.BrowserType;
import com.teamdev.jxbrowser.chromium.JSValue; import com.teamdev.jxbrowser.chromium.JSValue;
@ -42,6 +44,10 @@ public class ModernUIPane<T> extends BasicPane {
initialize(browserType); initialize(browserType);
} }
protected ModernUIPane() {
}
private void initialize(BrowserType browserType) { private void initialize(BrowserType browserType) {
if (browser == null) { if (browser == null) {
setLayout(new BorderLayout()); setLayout(new BorderLayout());
@ -151,7 +157,7 @@ public class ModernUIPane<T> extends BasicPane {
return null; return null;
} }
public static class Builder<T> { public static class Builder<T> implements BuilderDiff<T> {
private ModernUIPane<T> pane; private ModernUIPane<T> pane;
@ -271,6 +277,22 @@ public class ModernUIPane<T> extends BasicPane {
return this; return this;
} }
@Override
public Builder<T> prepareForV6(ScriptContextListener contextListener) {
return prepare(contextListener);
}
@Override
public Builder<T> prepareForV6(LoadListener loadListener) {
return prepare(loadListener);
}
@Override
public Builder<T> prepareForV7(InjectJsCallback callback) {
// do nothing
return this;
}
public ModernUIPane<T> build() { public ModernUIPane<T> build() {
return pane; return pane;
} }

24
designer-base/src/main/java/com/fr/design/ui/compatible/BuilderDiff.java

@ -0,0 +1,24 @@
package com.fr.design.ui.compatible;
import com.fr.design.ui.ModernUIPane;
import com.teamdev.jxbrowser.browser.callback.InjectJsCallback;
import com.teamdev.jxbrowser.chromium.events.LoadListener;
import com.teamdev.jxbrowser.chromium.events.ScriptContextListener;
/**
* 封装jxbrwoser v6/v7的构建方式的差异
*
* @author hades
* @version 10.0
* Created by hades on 2021/6/13
*/
public interface BuilderDiff<T> {
ModernUIPane.Builder<T> prepareForV6(ScriptContextListener contextListener);
ModernUIPane.Builder<T> prepareForV6(LoadListener loadListener);
ModernUIPane.Builder<T> prepareForV7(InjectJsCallback callback);
}

20
designer-base/src/main/java/com/fr/design/ui/compatible/ModernUIPaneFactory.java

@ -0,0 +1,20 @@
package com.fr.design.ui.compatible;
import com.fr.design.ui.ModernUIPane;
import com.fr.stable.os.OperatingSystem;
/**
* @author hades
* @version 10.0
* Created by hades on 2021/6/13
*/
public class ModernUIPaneFactory {
public static <T> ModernUIPane.Builder<T> modernUIPaneBuilder() {
if (OperatingSystem.isWindows()) {
return new NewModernUIPane.Builder<>();
} else {
return new ModernUIPane.Builder<>();
}
}
}

301
designer-base/src/main/java/com/fr/design/ui/compatible/NewModernUIPane.java

@ -0,0 +1,301 @@
package com.fr.design.ui.compatible;
import com.fr.design.DesignerEnvManager;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.itoolbar.UIToolbar;
import com.fr.design.i18n.Toolkit;
import com.fr.design.ui.ModernUIConstants;
import com.fr.design.ui.ModernUIPane;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.web.struct.AssembleComponent;
import com.teamdev.jxbrowser.browser.Browser;
import com.teamdev.jxbrowser.browser.callback.InjectJsCallback;
import com.teamdev.jxbrowser.chromium.events.LoadListener;
import com.teamdev.jxbrowser.chromium.events.ScriptContextListener;
import com.teamdev.jxbrowser.engine.Engine;
import com.teamdev.jxbrowser.engine.EngineOptions;
import com.teamdev.jxbrowser.engine.RenderingMode;
import com.teamdev.jxbrowser.js.JsObject;
import com.teamdev.jxbrowser.net.Network;
import com.teamdev.jxbrowser.net.callback.InterceptRequestCallback;
import com.teamdev.jxbrowser.view.swing.BrowserView;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.util.Map;
import java.util.Optional;
import javax.swing.JDialog;
import javax.swing.SwingUtilities;
import javax.swing.WindowConstants;
/**
* 基于v7 jxbrowser实现
*
* @author richie
* @version 10.0
* Created by richie on 2019-03-04
* 用于加载html5的Swing容器可以在设计选项设置中打开调试窗口示例可查看com.fr.design.ui.ModernUIPaneTest
*/
public class NewModernUIPane<T> extends ModernUIPane<T> {
private Browser browser;
private String namespace = "Pool";
private String variable = "data";
private String expression = "update()";
private NewModernUIPane() {
super();
initialize();
}
private void initialize() {
setLayout(new BorderLayout());
if (browser == null) {
if (DesignerEnvManager.getEnvManager().isOpenDebug()) {
UIToolbar toolbar = new UIToolbar();
add(toolbar, BorderLayout.NORTH);
UIButton openDebugButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Open_Debug_Window"));
toolbar.add(openDebugButton);
UIButton reloadButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Reload"));
toolbar.add(reloadButton);
UIButton closeButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Close_Window"));
toolbar.add(closeButton);
openDebugButton.addActionListener(e -> showDebuggerDialog());
reloadButton.addActionListener(e -> browser.navigation().reloadIgnoringCache());
closeButton.addActionListener(e -> SwingUtilities.getWindowAncestor(
NewModernUIPane.this).setVisible(false));
initializeBrowser();
add(BrowserView.newInstance(browser), BorderLayout.CENTER);
} else {
initializeBrowser();
add(BrowserView.newInstance(browser), BorderLayout.CENTER);
}
}
}
private void showDebuggerDialog() {
JDialog dialog = new JDialog(SwingUtilities.getWindowAncestor(this));
Engine engine = Engine.newInstance(
EngineOptions.newBuilder(RenderingMode.HARDWARE_ACCELERATED)
.addSwitch("--disable-google-traffic")
.remoteDebuggingPort(9222).build());
Browser debugger = engine.newBrowser();
BrowserView debuggerView = BrowserView.newInstance(debugger);
dialog.add(debuggerView, BorderLayout.CENTER);
dialog.setSize(new Dimension(800, 400));
GUICoreUtils.centerWindow(dialog);
dialog.setVisible(true);
dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
browser.devTools().remoteDebuggingUrl().ifPresent(url -> {
debugger.navigation().loadUrl(url);
});
}
private void initializeBrowser() {
Engine engine = Engine.newInstance(EngineOptions.newBuilder(RenderingMode.HARDWARE_ACCELERATED).addSwitch("--disable-google-traffic").build());
browser = engine.newBrowser();
// 初始化的时候,就把命名空间对象初始化好,确保window.a.b.c("a.b.c"为命名空间)对象都是初始化过的
browser.set(InjectJsCallback.class, params -> {
params.frame().executeJavaScript(String.format(ModernUIConstants.SCRIPT_INIT_NAME_SPACE, namespace));
return InjectJsCallback.Response.proceed();
});
}
/**
* 转向一个新的地址相当于重新加载
*
* @param url 新的地址
*/
@Override
public void redirect(String url) {
browser.navigation().loadUrl(url);
}
/**
* 转向一个新的地址相当于重新加载
*
* @param url 新的地址
* @param map 初始化参数
*/
@Override
public void redirect(String url, Map<String, String> map) {
Network network = browser.engine().network();
network.set(InterceptRequestCallback.class, new NxInterceptRequestCallback(network, map));
browser.navigation().loadUrl(url);
}
@Override
protected String title4PopupWindow() {
return "Modern";
}
@Override
public void populate(final T t) {
browser.set(InjectJsCallback.class, params -> {
JsObject ns = params.frame().executeJavaScript("window." + namespace);
if (ns != null) {
ns.putProperty(variable, t);
}
return InjectJsCallback.Response.proceed();
});
}
@Override
public T update() {
if (browser.mainFrame().isPresent()) {
return browser.mainFrame().get().executeJavaScript("window." + namespace + "." + expression);
}
return null;
}
public static class Builder<T> extends ModernUIPane.Builder<T> {
private NewModernUIPane<T> pane = new NewModernUIPane<>();
public NewModernUIPane.Builder<T> prepare(InjectJsCallback callback) {
pane.browser.set(InjectJsCallback.class, callback);
return this;
}
/**
* 加载jar包中的资源
*
* @param path 资源路径
*/
@Override
public NewModernUIPane.Builder<T> withEMB(final String path) {
Network network = pane.browser.engine().network();
network.set(InterceptRequestCallback.class, new NxComplexInterceptRequestCallback(network, null));
pane.browser.navigation().loadUrl("emb:" + path);
return this;
}
/**
* 加载url指向的资源
*
* @param url 文件的地址
*/
@Override
public NewModernUIPane.Builder<T> withURL(final String url) {
Network network = pane.browser.engine().network();
network.set(InterceptRequestCallback.class, new NxInterceptRequestCallback(network));
pane.browser.navigation().loadUrl(url);
return this;
}
/**
* 加载url指向的资源
*
* @param url 文件的地址
*/
@Override
public NewModernUIPane.Builder<T> withURL(final String url, Map<String, String> map) {
Network network = pane.browser.engine().network();
network.set(InterceptRequestCallback.class, new NxInterceptRequestCallback(network, map));
pane.browser.navigation().loadUrl(url);
return this;
}
/**
* 加载Atom组件
*
* @param component Atom组件
*/
@Override
public NewModernUIPane.Builder<T> withComponent(AssembleComponent component) {
Network network = pane.browser.engine().network();
network.set(InterceptRequestCallback.class, new NxComplexInterceptRequestCallback(network, component));
pane.browser.navigation().loadUrl("emb:dynamic");
return this;
}
/**
* 加载Atom组件
*
* @param component Atom组件
*/
@Override
public NewModernUIPane.Builder<T> withComponent(AssembleComponent component, Map<String, String> map) {
Network network = pane.browser.engine().network();
network.set(InterceptRequestCallback.class, new NxComplexInterceptRequestCallback(network, component, map));
pane.browser.navigation().loadUrl("emb:dynamic");
return this;
}
/**
* 加载html文本内容
*
* @param html 要加载html文本内容
*/
@Override
public NewModernUIPane.Builder<T> withHTML(String html) {
Network network = pane.browser.engine().network();
network.set(InterceptRequestCallback.class, new NxInterceptRequestCallback(network));
pane.browser.mainFrame().ifPresent(frame -> {
frame.loadHtml(html);
});
return this;
}
/**
* 设置该前端页面做数据交换所使用的对象
*
* @param namespace 对象名
*/
@Override
public NewModernUIPane.Builder<T> namespace(String namespace) {
pane.namespace = namespace;
return this;
}
/**
* java端往js端传数据时使用的变量名字
*
* @param name 变量的名字
*/
@Override
public NewModernUIPane.Builder<T> variable(String name) {
pane.variable = name;
return this;
}
/**
* js端往java端传数据时执行的函数表达式
*
* @param expression 函数表达式
*/
@Override
public NewModernUIPane.Builder<T> expression(String expression) {
pane.expression = expression;
return this;
}
@Override
public NewModernUIPane.Builder<T> prepareForV6(ScriptContextListener contextListener) {
// do nothing
return this;
}
@Override
public NewModernUIPane.Builder<T> prepareForV6(LoadListener loadListener) {
// do nothing
return this;
}
@Override
public NewModernUIPane.Builder<T> prepareForV7(InjectJsCallback callback) {
return prepare(callback);
}
@Override
public NewModernUIPane<T> build() {
return pane;
}
}
}

3
designer-base/src/main/java/com/fr/design/ui/compatible/NxComplexInterceptRequestCallback.java

@ -49,6 +49,9 @@ public class NxComplexInterceptRequestCallback extends NxInterceptRequestCallbac
path = path.substring(4); path = path.substring(4);
} }
InputStream inputStream = IOUtils.readResource(path); InputStream inputStream = IOUtils.readResource(path);
if (inputStream == null) {
return Response.proceed();
}
return InterceptRequestCallback.Response.intercept(generateBasicUrlRequestJob(urlRequest, getMimeType(path), IOUtils.inputStream2Bytes(inputStream))); return InterceptRequestCallback.Response.intercept(generateBasicUrlRequestJob(urlRequest, getMimeType(path), IOUtils.inputStream2Bytes(inputStream)));
} }
} }

14
designer-base/src/main/java/com/fr/design/ui/compatible/NxInterceptRequestCallback.java

@ -100,6 +100,11 @@ public class NxInterceptRequestCallback implements InterceptRequestCallback {
} }
String getMimeType(String path) { String getMimeType(String path) {
// 去除 xxx?xxx 后面部分
int index = path.indexOf("?");
if (index != -1) {
path = path.substring(0, path.indexOf("?"));
}
if (StringUtils.isBlank(path)) { if (StringUtils.isBlank(path)) {
return "text/html"; return "text/html";
} }
@ -124,6 +129,15 @@ public class NxInterceptRequestCallback implements InterceptRequestCallback {
if (path.endsWith(".gif")) { if (path.endsWith(".gif")) {
return "image/gif"; return "image/gif";
} }
if (path.endsWith(".woff")) {
return "font/woff";
}
if (path.endsWith(".ttf")) {
return "truetype";
}
if (path.endsWith(".eot")) {
return "embedded-opentype";
}
Path file = new File(path).toPath(); Path file = new File(path).toPath();
try { try {
return Files.probeContentType(file); return Files.probeContentType(file);

502
designer-base/src/main/java/com/fr/design/upm/NewUpmBridge.java

@ -0,0 +1,502 @@
package com.fr.design.upm;
import com.fr.decision.webservice.v10.plugin.helper.category.impl.UpmResourceLoader;
import com.fr.design.DesignerEnvManager;
import com.fr.design.bridge.exec.JSBridge;
import com.fr.design.bridge.exec.JSCallback;
import com.fr.design.extra.PluginOperateUtils;
import com.fr.design.extra.PluginUtils;
import com.fr.design.extra.exe.GetInstalledPluginsExecutor;
import com.fr.design.extra.exe.GetPluginCategoriesExecutor;
import com.fr.design.extra.exe.GetPluginFromStoreExecutor;
import com.fr.design.extra.exe.GetPluginPrefixExecutor;
import com.fr.design.extra.exe.PluginLoginExecutor;
import com.fr.design.extra.exe.ReadUpdateOnlineExecutor;
import com.fr.design.extra.exe.SearchOnlineExecutor;
import com.fr.design.i18n.Toolkit;
import com.fr.design.upm.event.CertificateEvent;
import com.fr.design.upm.event.DownloadEvent;
import com.fr.design.upm.exec.NewUpmBrowserExecutor;
import com.fr.design.upm.task.UpmTaskWorker;
import com.fr.event.EventDispatcher;
import com.fr.general.GeneralUtils;
import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.context.PluginMarker;
import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils;
import com.teamdev.jxbrowser.js.JsAccessible;
import com.teamdev.jxbrowser.js.JsFunction;
import com.teamdev.jxbrowser.js.JsObject;
import javax.swing.JFileChooser;
import javax.swing.SwingUtilities;
import javax.swing.SwingWorker;
import javax.swing.filechooser.FileNameExtensionFilter;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.FutureTask;
import java.util.concurrent.RunnableFuture;
/**
* @author richie
* @version 10.0
* Created by richie on 2019-04-12
* 桥接Java和JavaScript的类
*/
public class NewUpmBridge extends UpmBridge {
public static NewUpmBridge getBridge(JsObject jsObject) {
return new NewUpmBridge(jsObject);
}
private JsObject jsObject;
private NewUpmBridge(JsObject jsObject) {
this.jsObject = jsObject;
}
/**
* 更新插件管理中心资源文件这个方法仅仅是为了语义上的作用更新
*
* @param callback 安装完成后的回调函数
*/
@JSBridge
@JsAccessible
public void update(final JsFunction callback) {
callback.invoke(jsObject, "start", Toolkit.i18nText("Fine-Design_Basic_Update_Plugin_Manager_Download_Start"));
try {
UpmResourceLoader.INSTANCE.download();
UpmResourceLoader.INSTANCE.install();
callback.invoke(jsObject, "success", Toolkit.i18nText("Fine-Design_Basic_Update_Plugin_Manager_Download_Success"));
EventDispatcher.fire(DownloadEvent.UPDATE, "success");
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
callback.invoke(jsObject, "error", Toolkit.i18nText("Fine-Design_Basic_Update_Plugin_Manager_Download_Error"));
}
}
/**
* 下载并安装插件管理中心的资源文件
*
* @param callback 安装完成后的回调函数
*/
@JSBridge
@JsAccessible
public void startDownload(final JsFunction callback) {
callback.invoke(jsObject, "start", Toolkit.i18nText("Fine-Design_Basic_Update_Plugin_Manager_Download_Start"));
new SwingWorker<Void, Void>() {
@Override
protected Void doInBackground() throws Exception {
UpmResourceLoader.INSTANCE.download();
UpmResourceLoader.INSTANCE.install();
return null;
}
@Override
protected void done() {
try {
get();
callback.invoke(jsObject, "success", Toolkit.i18nText("Fine-Design_Basic_Update_Plugin_Manager_Download_Success"));
EventDispatcher.fire(DownloadEvent.SUCCESS, "success");
} catch (Exception e) {
callback.invoke(jsObject, "error", Toolkit.i18nText("Fine-Design_Basic_Update_Plugin_Manager_Download_Error"));
FineLoggerFactory.getLogger().error(e.getMessage(), e);
EventDispatcher.fire(DownloadEvent.ERROR, "error");
}
}
}.execute();
}
/**
* 获取upm的版本信息
*
* @return 版本信息
*/
@JSBridge
@JsAccessible
@Override
public String getVersion() {
return super.getVersion();
}
@JSBridge
@JsAccessible
@Override
public String i18nText(String key) {
return super.i18nText(key);
}
@JSBridge
@JsAccessible
@Override
public void closeWindow() {
super.closeWindow();
}
@JSBridge
@JsAccessible
@Override
public boolean isDesigner() {
return super.isDesigner();
}
@JSBridge
@JsAccessible
public void getPackInfo(final JsFunction callback) {
callback.invoke(jsObject, StringUtils.EMPTY);
}
@JSBridge
@JsAccessible
public void getPluginPrefix(final JsFunction callback) {
UpmTaskWorker<Void> task = new UpmTaskWorker<>(new JSCallback(NewUpmBrowserExecutor.create(jsObject, callback)), new GetPluginPrefixExecutor());
task.execute();
}
/**
* 在线获取插件分类
*
* @param callback 回调函数
*/
@JSBridge
@JsAccessible
public void getPluginCategories(final JsFunction callback) {
UpmTaskWorker<Void> task = new UpmTaskWorker<>(new JSCallback(NewUpmBrowserExecutor.create(jsObject, callback)), new GetPluginCategoriesExecutor());
task.execute();
}
/**
* 根据条件获取在线插件
*
* @param info 插件信息
* @param callback 回调函数
*/
@JSBridge
@JsAccessible
public void getPluginFromStoreNew(String info, final JsFunction callback) {
UpmTaskWorker<Void> task = new UpmTaskWorker<>(new JSCallback(NewUpmBrowserExecutor.create(jsObject, callback)), new GetPluginFromStoreExecutor(new JSONObject(info)));
task.execute();
}
/**
* 已安装插件检查更新
*/
@JSBridge
@JsAccessible
public void readUpdateOnline(final JsFunction callback) {
UpmTaskWorker<Void> task = new UpmTaskWorker<>(new JSCallback(NewUpmBrowserExecutor.create(jsObject, callback)), new ReadUpdateOnlineExecutor());
task.execute();
}
/**
* 获取已经安装的插件的数组
*/
@JSBridge
@JsAccessible
public void getInstalledPlugins(final JsFunction callback) {
UpmTaskWorker<Void> task = new UpmTaskWorker<>(new JSCallback(NewUpmBrowserExecutor.create(jsObject, callback)), new GetInstalledPluginsExecutor());
task.execute();
}
/**
* 从插件服务器上更新选中的插件
*
* @param pluginIDs 插件集合
*/
@JSBridge
@JsAccessible
public void updatePluginOnline(JsObject pluginIDs, final JsFunction callback) {
JSCallback jsCallback = new JSCallback(NewUpmBrowserExecutor.create(jsObject, callback));
List<PluginMarker> pluginMarkerList = new ArrayList<>();
for (String key : pluginIDs.propertyNames()) {
pluginIDs.property(key).ifPresent(v -> {
pluginMarkerList.add(PluginUtils.createPluginMarker(GeneralUtils.objectToString(v)));
});
}
PluginOperateUtils.updatePluginOnline(pluginMarkerList, jsCallback);
}
@JSBridge
@JsAccessible
public void updatePluginOnline(String pluginID, final JsFunction callback) {
JSCallback jsCallback = new JSCallback(NewUpmBrowserExecutor.create(jsObject, callback));
List<PluginMarker> pluginMarkerList = new ArrayList<>();
pluginMarkerList.add(PluginUtils.createPluginMarker(pluginID));
PluginOperateUtils.updatePluginOnline(pluginMarkerList, jsCallback);
}
/**
* 搜索在线插件
*
* @param keyword 关键字
*/
@JSBridge
@JsAccessible
public void searchPlugin(String keyword, final JsFunction callback) {
UpmTaskWorker<Void> worker = new UpmTaskWorker<>(new JSCallback(NewUpmBrowserExecutor.create(jsObject, callback)), new SearchOnlineExecutor(keyword));
worker.execute();
}
/**
* 从磁盘上选择插件安装包进行安装
*
* @param filePath 插件包的路径
*/
@JSBridge
@JsAccessible
public void installPluginFromDisk(final String filePath, final JsFunction callback) {
JSCallback jsCallback = new JSCallback(NewUpmBrowserExecutor.create(jsObject, callback));
File file = new File(filePath);
PluginOperateUtils.installPluginFromDisk(file, jsCallback);
}
/**
* 卸载当前选中的插件
*
* @param pluginInfo 插件信息
*/
@JSBridge
@JsAccessible
public void uninstallPlugin(final String pluginInfo, final boolean isForce, final JsFunction callback) {
JSCallback jsCallback = new JSCallback(NewUpmBrowserExecutor.create(jsObject, callback));
PluginOperateUtils.uninstallPlugin(pluginInfo, isForce, jsCallback);
}
/**
* 从插件服务器上安装插件
*
* @param pluginInfo 插件的ID
* @param callback 回调函数
*/
@JSBridge
@JsAccessible
public void installPluginOnline(final String pluginInfo, final JsFunction callback) {
JSCallback jsCallback = new JSCallback(NewUpmBrowserExecutor.create(jsObject, callback));
PluginMarker pluginMarker = PluginUtils.createPluginMarker(pluginInfo);
PluginOperateUtils.installPluginOnline(pluginMarker, jsCallback);
}
/**
* 从磁盘上选择插件安装包进行插件升级
*
* @param filePath 插件包的路径
*/
@JSBridge
@JsAccessible
public void updatePluginFromDisk(String filePath, final JsFunction callback) {
JSCallback jsCallback = new JSCallback(NewUpmBrowserExecutor.create(jsObject, callback));
File file = new File(filePath);
PluginOperateUtils.updatePluginFromDisk(file, jsCallback);
}
/**
* 修改选中的插件的活跃状态
*
* @param pluginID 插件ID
*/
@JSBridge
@JsAccessible
public void setPluginActive(String pluginID, final JsFunction callback) {
JSCallback jsCallback = new JSCallback(NewUpmBrowserExecutor.create(jsObject, callback));
PluginOperateUtils.setPluginActive(pluginID, jsCallback);
}
/**
* 选择文件对话框
*
* @return 选择的文件的路径
*/
@JSBridge
@JsAccessible
@Override
public String showFileChooser() {
return super.showFileChooser();
}
/**
* 选择文件对话框
*
* @param des 过滤文件描述
* @param filter 文件的后缀
* @return 选择的文件的路径
* 这里换用JFileChooser会卡死,不知道为什么
*/
@JSBridge
@JsAccessible
@Override
public String showFileChooserWithFilter(final String des, final String filter) {
return super.showFileChooserWithFilter(des, filter);
}
/**
* 选择文件对话框
*
* @param des 过滤文件描述
* @param args 文件的后缀
* @return 选择的文件的路径
*/
@JSBridge
@JsAccessible
public String showFileChooserWithFilters(final String des, final String args) {
RunnableFuture<String> future = new FutureTask<>(() -> {
JFileChooser fileChooser = new JFileChooser();
List<String> filterList = new ArrayList<>();
filterList.add(args);
String[] filters = filterList.toArray(new String[0]);
if (ArrayUtils.isNotEmpty(filters)) {
FileNameExtensionFilter filter = new FileNameExtensionFilter(des, UpmUtils.findMatchedExtension(filters));
fileChooser.setFileFilter(filter);
}
int result = fileChooser.showOpenDialog(UpmFinder.getDialog());
if (result == JFileChooser.APPROVE_OPTION) {
return fileChooser.getSelectedFile().getAbsolutePath();
}
return null;
});
SwingUtilities.invokeLater(future);
try {
return future.get();
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
return null;
}
/**
* 选择文件对话框
*
* @param des 过滤文件描述
* @param args 文件的后缀
* @return 选择的文件的路径
*/
@JSBridge
@JsAccessible
public String showFileChooserWithFilters(final String des, final JsObject args) {
RunnableFuture<String> future = new FutureTask<>(() -> {
JFileChooser fileChooser = new JFileChooser();
List<String> filterList = new ArrayList<>();
for (String key : args.propertyNames()) {
args.property(key).ifPresent(v -> {
filterList.add(GeneralUtils.objectToString(v));
});
}
String[] filters = filterList.toArray(new String[0]);
if (ArrayUtils.isNotEmpty(filters)) {
FileNameExtensionFilter filter = new FileNameExtensionFilter(des, UpmUtils.findMatchedExtension(filters));
fileChooser.setFileFilter(filter);
}
int result = fileChooser.showOpenDialog(UpmFinder.getDialog());
if (result == JFileChooser.APPROVE_OPTION) {
return fileChooser.getSelectedFile().getAbsolutePath();
}
return null;
});
SwingUtilities.invokeLater(future);
try {
return future.get();
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
return null;
}
////////登录相关///////
/**
* 获取系统登录的用户名
*/
@JSBridge
@JsAccessible
public String getLoginInfo(final JsFunction callback) {
registerLoginInfo(callback);
return DesignerEnvManager.getEnvManager().getDesignerLoginUsername();
}
/**
* 系统登录注册
*
* @param callback 回调函数
*/
@JSBridge
@JsAccessible
public void registerLoginInfo(final JsFunction callback) {
JSCallback jsCallback = new JSCallback(NewUpmBrowserExecutor.create(jsObject, callback));
String username = DesignerEnvManager.getEnvManager().getDesignerLoginUsername();
if (StringUtils.isEmpty(username)) {
jsCallback.execute(StringUtils.EMPTY);
EventDispatcher.fire(CertificateEvent.LOGOUT, StringUtils.EMPTY);
} else {
jsCallback.execute(username);
EventDispatcher.fire(CertificateEvent.LOGIN, username);
}
}
/**
* 设计器端的用户登录
*
* @param username 用户名
* @param password 密码
* @param callback 回调函数
*/
@JSBridge
@JsAccessible
public void defaultLogin(String username, String password, final JsFunction callback) {
UpmTaskWorker<Void> worker = new UpmTaskWorker<>(new JSCallback(NewUpmBrowserExecutor.create(jsObject, callback)), new PluginLoginExecutor(username, password));
worker.execute();
}
/**
* 清除用户信息
*/
@JsAccessible
@JSBridge
@Override
public void clearUserInfo() {
super.clearUserInfo();
}
/**
* 打开论坛消息界面
*/
@JSBridge
@JsAccessible
@Override
public void getPriviteMessage() {
super.getPriviteMessage();
}
/**
* 忘记密码
*/
@JSBridge
@JsAccessible
@Override
public void forgetHref() {
super.forgetHref();
}
/**
* 立即注册
*/
@JSBridge
@JsAccessible
@Override
public void registerHref() {
super.registerHref();
}
/**
* 使用系统浏览器打开网页
*
* @param url 要打开的网页
*/
@JSBridge
@JsAccessible
@Override
public void openShopUrlAtWebBrowser(String url) {
super.openShopUrlAtWebBrowser(url);
}
}

4
designer-base/src/main/java/com/fr/design/upm/UpmBridge.java

@ -66,6 +66,10 @@ public class UpmBridge {
this.window = browser.executeJavaScriptAndReturnValue("window").asObject(); this.window = browser.executeJavaScriptAndReturnValue("window").asObject();
} }
protected UpmBridge() {
}
/** /**
* 更新插件管理中心资源文件这个方法仅仅是为了语义上的作用更新 * 更新插件管理中心资源文件这个方法仅仅是为了语义上的作用更新
* @param callback 安装完成后的回调函数 * @param callback 安装完成后的回调函数

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

@ -15,6 +15,7 @@ import com.fr.event.Listener;
import com.fr.general.GeneralContext; import com.fr.general.GeneralContext;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.stable.os.OperatingSystem;
import com.fr.workspace.Workspace; import com.fr.workspace.Workspace;
import com.fr.workspace.WorkspaceEvent; import com.fr.workspace.WorkspaceEvent;
@ -31,7 +32,7 @@ public class UpmFinder {
private static final String UPM_DIR = "/upm"; private static final String UPM_DIR = "/upm";
private static final String MAIN_RESOURCE_PATH = UPM_DIR + "/plugin_design.html"; private static final String MAIN_RESOURCE_PATH = UPM_DIR + "/plugin_design.html";
private static final String JXBROWSER = "com.teamdev.jxbrowser.chromium.Browser"; private static final String JXBROWSER = OperatingSystem.isWindows() ? "com.teamdev.jxbrowser.browser.Browser" : "com.teamdev.jxbrowser.chromium.Browser";
public static String installHome = FRContext.getCommonOperator().getWebRootPath(); public static String installHome = FRContext.getCommonOperator().getWebRootPath();

35
designer-base/src/main/java/com/fr/design/upm/UpmShowPane.java

@ -2,14 +2,17 @@ package com.fr.design.upm;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.ui.ModernUIPane; import com.fr.design.ui.ModernUIPane;
import com.fr.design.ui.compatible.ModernUIPaneFactory;
import com.fr.design.upm.event.DownloadEvent; import com.fr.design.upm.event.DownloadEvent;
import com.fr.event.Event; import com.fr.event.Event;
import com.fr.event.EventDispatcher; import com.fr.event.EventDispatcher;
import com.fr.event.Listener; import com.fr.event.Listener;
import com.teamdev.jxbrowser.browser.callback.InjectJsCallback;
import com.teamdev.jxbrowser.chromium.JSValue; import com.teamdev.jxbrowser.chromium.JSValue;
import com.teamdev.jxbrowser.chromium.events.ScriptContextAdapter; import com.teamdev.jxbrowser.chromium.events.ScriptContextAdapter;
import com.teamdev.jxbrowser.chromium.events.ScriptContextEvent; import com.teamdev.jxbrowser.chromium.events.ScriptContextEvent;
import com.teamdev.jxbrowser.js.JsObject;
import java.awt.*; import java.awt.*;
/** /**
@ -29,16 +32,23 @@ public class UpmShowPane extends BasicPane {
UpmShowPane() { UpmShowPane() {
setLayout(new BorderLayout()); setLayout(new BorderLayout());
// 先屏蔽掉这个判断,后续可能修改交互 modernUIPane = ModernUIPaneFactory.modernUIPaneBuilder()
// if (UpmFinder.checkUPMResourcesExist()) { .prepareForV6(new ScriptContextAdapter() {
modernUIPane = new ModernUIPane.Builder<>()
.prepare(new ScriptContextAdapter() {
@Override @Override
public void onScriptContextCreated(ScriptContextEvent event) { public void onScriptContextCreated(ScriptContextEvent event) {
// 6.x
JSValue window = event.getBrowser().executeJavaScriptAndReturnValue("window"); JSValue window = event.getBrowser().executeJavaScriptAndReturnValue("window");
window.asObject().setProperty("PluginHelper", UpmBridge.getBridge(event.getBrowser())); window.asObject().setProperty("PluginHelper", UpmBridge.getBridge(event.getBrowser()));
} }
}) })
.prepareForV7(params -> {
// 7.x
JsObject window = params.frame().executeJavaScript("window");
if (window != null) {
window.putProperty("PluginHelper", NewUpmBridge.getBridge(window));
}
return InjectJsCallback.Response.proceed();
})
.withURL(UpmFinder.getMainResourcePath(), UpmUtils.renderMap()) .withURL(UpmFinder.getMainResourcePath(), UpmUtils.renderMap())
.build(); .build();
EventDispatcher.listen(DownloadEvent.UPDATE, new Listener<String>() { EventDispatcher.listen(DownloadEvent.UPDATE, new Listener<String>() {
@ -47,23 +57,6 @@ public class UpmShowPane extends BasicPane {
modernUIPane.redirect(UpmFinder.getMainResourcePath(), UpmUtils.renderMap()); modernUIPane.redirect(UpmFinder.getMainResourcePath(), UpmUtils.renderMap());
} }
}); });
// } else {
// modernUIPane = new ModernUIPane.Builder<>()
// .withComponent(WarnComponent.KEY)
// .prepare(new ScriptContextAdapter() {
// @Override
// public void onScriptContextCreated(ScriptContextEvent event) {
// JSValue window = event.getBrowser().executeJavaScriptAndReturnValue("window");
// window.asObject().setProperty("PluginHelper", UpmBridge.getBridge(event.getBrowser()));
// }
// }).build();
// EventDispatcher.listen(DownloadEvent.SUCCESS, new Listener<String>() {
// @Override
// public void on(Event event, String param) {
// modernUIPane.redirect(UpmFinder.getMainResourcePath(), UpmUtils.renderMap());
// }
// });
// }
add(modernUIPane, BorderLayout.CENTER); add(modernUIPane, BorderLayout.CENTER);
} }
} }

30
designer-base/src/main/java/com/fr/design/upm/exec/NewUpmBrowserExecutor.java

@ -0,0 +1,30 @@
package com.fr.design.upm.exec;
import com.fr.design.bridge.exec.JSExecutor;
import com.teamdev.jxbrowser.js.JsFunction;
import com.teamdev.jxbrowser.js.JsObject;
/**
* @author richie
* @version 10.0
* Created by richie on 2019-04-18
*/
public class NewUpmBrowserExecutor implements JSExecutor {
public static NewUpmBrowserExecutor create(JsObject window, JsFunction callback) {
return new NewUpmBrowserExecutor(window, callback);
}
private final JsFunction callback;
private final JsObject window;
private NewUpmBrowserExecutor(JsObject window, JsFunction callback) {
this.window = window;
this.callback = callback;
}
@Override
public void executor(String newValue) {
callback.invoke(window, newValue);
}
}

19
designer-base/src/main/java/com/fr/design/versioncheck/VersionCheckUtils.java

@ -39,6 +39,7 @@ import java.lang.reflect.Method;
import java.text.ParsePosition; import java.text.ParsePosition;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
@ -59,6 +60,21 @@ public class VersionCheckUtils {
private static final String ID = "id"; private static final String ID = "id";
private static final String VERSION = "version"; private static final String VERSION = "version";
private static final String NAME = "name"; private static final String NAME = "name";
private static final Set<String> pluginsNeedIgnore = new HashSet<>();
static {
pluginsNeedIgnore.addAll(Arrays.asList(
"com.fr.plugin.performance.newexecutetool",
"com.fr.plugin.performance.newline",
"com.fr.plugin.performance.pdfstream",
"com.fr.plugin.performance.dzstartemptyfile",
"com.fr.plugin.performance.treenode.button.optimization",
"com.fr.plugin.performance.druid",
"com.fr.plugin.performance.reducecalculation",
"com.fr.plugin.performance.fasttree",
"com.fr.plugin.performance.paralleldsloader",
"com.fr.plugin.cloud.analytics.v10"
));
}
public static boolean versionCheck(String envName) { public static boolean versionCheck(String envName) {
@ -236,6 +252,9 @@ public class VersionCheckUtils {
continue; continue;
} }
String remotePluginID = remotePlugin.getString(ID); String remotePluginID = remotePlugin.getString(ID);
if (pluginsNeedIgnore.contains(remotePluginID)) {
continue;
}
if (localPluginsMap.containsKey(remotePluginID)) { if (localPluginsMap.containsKey(remotePluginID)) {
if (ComparatorUtils.equals(localPluginsMap.get(remotePluginID).getVersion(), remotePlugin.getString(VERSION))) { if (ComparatorUtils.equals(localPluginsMap.get(remotePluginID).getVersion(), remotePlugin.getString(VERSION))) {
continue; continue;

48
designer-base/src/main/java/com/fr/design/widget/WidgetBoundsPaneFactory.java

@ -10,6 +10,7 @@ import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JComponent;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import java.awt.BorderLayout; import java.awt.BorderLayout;
@ -45,23 +46,28 @@ public class WidgetBoundsPaneFactory {
private static final int RIGHT_PANE_WIDTH = 145; private static final int RIGHT_PANE_WIDTH = 145;
public static UIExpandablePane createBoundsPane(UISpinner width, UISpinner height) { public static UIExpandablePane createBoundsPane(UISpinner width, UISpinner height, JComponent ratioLocked) {
JPanel boundsPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel boundsPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
double f = TableLayout.FILL; double f = TableLayout.FILL;
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Basic_Component_Size")), createRightPane(width, height)}, new Component[]{FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Basic_Component_Size")),
ratioLocked != null ? createRightPane(width, ratioLocked, height) : createRightPane(width, height)},
new Component[]{null, createRightPane(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Tree_Width"), SwingConstants.CENTER), new UILabel(Toolkit.i18nText("Fine-Design_Basic_Tree_Height"), SwingConstants.CENTER))}, new Component[]{null, createRightPane(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Tree_Width"), SwingConstants.CENTER), new UILabel(Toolkit.i18nText("Fine-Design_Basic_Tree_Height"), SwingConstants.CENTER))},
}; };
double[] rowSize = {p, p}; double[] rowSize = {p, p};
double[] columnSize = {f, RIGHT_PANE_WIDTH}; double[] columnSize = {f, RIGHT_PANE_WIDTH};
int[][] rowCount = {{1, 1}, {1, 1}}; int[][] rowCount = ratioLocked != null ? new int[][]{{1, 1}, {1, 1, 1}} : new int[][]{{1, 1}, {1, 1}};
final JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W5, IntervalConstants.INTERVAL_L6); final JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W5, IntervalConstants.INTERVAL_L6);
panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0)); panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0));
boundsPane.add(panel); boundsPane.add(panel);
return new UIExpandablePane(Toolkit.i18nText("Fine-Design_Form_Coords_And_Size"), 280, 24, boundsPane); return new UIExpandablePane(Toolkit.i18nText("Fine-Design_Form_Coords_And_Size"), 280, 24, boundsPane);
} }
public static UIExpandablePane createBoundsPane(UISpinner width, UISpinner height) {
return createBoundsPane(width, height, null);
}
public static JPanel createRightPane(Component com1, Component com2) { public static JPanel createRightPane(Component com1, Component com2) {
double f = TableLayout.FILL; double f = TableLayout.FILL;
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
@ -74,21 +80,41 @@ public class WidgetBoundsPaneFactory {
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_L6, IntervalConstants.INTERVAL_L1); return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_L6, IntervalConstants.INTERVAL_L1);
} }
public static UIExpandablePane createAbsoluteBoundsPane(UISpinner x, UISpinner y, UISpinner width, UISpinner height, NameAttribute nameAttribute) { public static JPanel createRightPane(Component com1, Component com2, Component com3) {
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
double[] rowSize = {p};
double[] columnSize = {f, 24, f};
int[][] rowCount = {{1, 1, 1}};
Component[][] components = new Component[][]{
new Component[]{com1, com2, com3}
};
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 0, IntervalConstants.INTERVAL_L1);
}
public static UIExpandablePane createAbsoluteBoundsPane(UISpinner x, UISpinner y, UISpinner width, UISpinner height, JComponent ratioLocked, NameAttribute nameAttribute) {
double f = TableLayout.FILL; double f = TableLayout.FILL;
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
UILabel positionLabel = FRWidgetFactory.createLineWrapLabel(nameAttribute.getPositionName());
UILabel xLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_X_Coordinate"), SwingConstants.CENTER);
UILabel yLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Y_Coordinate"), SwingConstants.CENTER);
UILabel sizeLabel = FRWidgetFactory.createLineWrapLabel(nameAttribute.getSizeName());
UILabel widthLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Tree_Width"), SwingConstants.CENTER);
UILabel heightLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Tree_Height"), SwingConstants.CENTER);
Component[][] northComponents = new Component[][]{ Component[][] northComponents = new Component[][]{
new Component[]{FRWidgetFactory.createLineWrapLabel(nameAttribute.getPositionName()), createRightPane(x, y)}, new Component[]{positionLabel, ratioLocked != null ? createRightPane(x, null, y) : createRightPane(x, y)},
new Component[]{null, createRightPane(new UILabel(Toolkit.i18nText("Fine-Design_Basic_X_Coordinate"), SwingConstants.CENTER), new UILabel(Toolkit.i18nText("Fine-Design_Basic_Y_Coordinate"), SwingConstants.CENTER))}, new Component[]{null, ratioLocked != null ? createRightPane(xLabel, null, yLabel) : createRightPane(xLabel, yLabel)},
}; };
Component[][] centerComponents = new Component[][]{ Component[][] centerComponents = new Component[][]{
new Component[]{FRWidgetFactory.createLineWrapLabel(nameAttribute.getSizeName()), createRightPane(width, height)}, new Component[]{sizeLabel, ratioLocked != null ? createRightPane(width, ratioLocked, height) : createRightPane(width, height)},
new Component[]{null, createRightPane(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Tree_Width"), SwingConstants.CENTER), new UILabel(Toolkit.i18nText("Fine-Design_Basic_Tree_Height"), SwingConstants.CENTER))}, new Component[]{null, ratioLocked != null ? createRightPane(widthLabel, null, heightLabel) : createRightPane(widthLabel, heightLabel)},
}; };
double[] rowSize = {p, p}; double[] rowSize = {p, p};
double[] columnSize = {f, RIGHT_PANE_WIDTH}; double[] columnSize = {f, RIGHT_PANE_WIDTH};
int[][] rowCount = {{1, 1}, {1, 1}}; int[][] rowCount = ratioLocked != null ? new int[][]{{1, 1, 1}, {1, 1, 1}} : new int[][]{{1, 1}, {1, 1}};
final JPanel northPanel = TableLayoutHelper.createGapTableLayoutPane(northComponents, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W5, IntervalConstants.INTERVAL_L6); final JPanel northPanel = TableLayoutHelper.createGapTableLayoutPane(northComponents, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W5, IntervalConstants.INTERVAL_L6);
final JPanel centerPanel = TableLayoutHelper.createGapTableLayoutPane(centerComponents, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W5, IntervalConstants.INTERVAL_L6); final JPanel centerPanel = TableLayoutHelper.createGapTableLayoutPane(centerComponents, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W5, IntervalConstants.INTERVAL_L6);
JPanel boundsPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel boundsPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
@ -99,6 +125,10 @@ public class WidgetBoundsPaneFactory {
return new UIExpandablePane(Toolkit.i18nText("Fine-Design_Form_Coords_And_Size"), 230, 24, boundsPane); return new UIExpandablePane(Toolkit.i18nText("Fine-Design_Form_Coords_And_Size"), 230, 24, boundsPane);
} }
public static UIExpandablePane createAbsoluteBoundsPane(UISpinner x, UISpinner y, UISpinner width, UISpinner height, NameAttribute nameAttribute) {
return createAbsoluteBoundsPane(x, y, width, height, null, nameAttribute);
}
public static UIExpandablePane createAbsoluteBoundsPane(UISpinner x, UISpinner y, UISpinner width, UISpinner height) { public static UIExpandablePane createAbsoluteBoundsPane(UISpinner x, UISpinner y, UISpinner width, UISpinner height) {
return createAbsoluteBoundsPane(x, y, width, height, NameAttribute.DEFAULT); return createAbsoluteBoundsPane(x, y, width, height, NameAttribute.DEFAULT);
} }

4
designer-base/src/main/java/com/fr/env/CheckServiceDialog.java vendored

@ -168,7 +168,7 @@ public class CheckServiceDialog extends JDialog implements ActionListener {
JPanel buttonPanel = FRGUIPaneFactory.createBorderLayout_M_Pane(); JPanel buttonPanel = FRGUIPaneFactory.createBorderLayout_M_Pane();
buttonPanel.setBorder(BorderFactory.createEmptyBorder(0, 10, 10, 10)); buttonPanel.setBorder(BorderFactory.createEmptyBorder(0, 10, 10, 10));
boolean Sync = false; boolean Sync = false;
if (Sync && isOnline()) { if (isOnline() && Sync) {
ignoreButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Sync_Ignore")); ignoreButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Sync_Ignore"));
ignoreButton.addActionListener(this); ignoreButton.addActionListener(this);
syncButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Sync_To_Local")); syncButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Sync_To_Local"));
@ -308,6 +308,7 @@ public class CheckServiceDialog extends JDialog implements ActionListener {
@Override @Override
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
ignoreButton.setEnabled(false); ignoreButton.setEnabled(false);
syncButton.setEnabled(false);
String[] option = {Toolkit.i18nText("Fine-Design_Report_Yes"), Toolkit.i18nText("Fine-Design_Report_No")}; String[] option = {Toolkit.i18nText("Fine-Design_Report_Yes"), Toolkit.i18nText("Fine-Design_Report_No")};
if (!jarConsistency) { if (!jarConsistency) {
int a = FineJOptionPane.showOptionDialog(getParent(), Toolkit.i18nText("Fine-Design_Basic_Sync_Info_Information"), int a = FineJOptionPane.showOptionDialog(getParent(), Toolkit.i18nText("Fine-Design_Basic_Sync_Info_Information"),
@ -349,6 +350,7 @@ public class CheckServiceDialog extends JDialog implements ActionListener {
@Override @Override
protected JSONArray doInBackground() { protected JSONArray doInBackground() {
progressBar.setVisible(true);
progressBar.setString(Toolkit.i18nText("Fine-Design_Basic_Sync_Plugins")); progressBar.setString(Toolkit.i18nText("Fine-Design_Basic_Sync_Plugins"));
progressBar.setValue(0); progressBar.setValue(0);
return VersionCheckUtils.syncPlugins(differentPlugins); return VersionCheckUtils.syncPlugins(differentPlugins);

3
designer-base/src/main/java/com/fr/env/RemoteEnvPane.java vendored

@ -15,6 +15,7 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ipasswordfield.UIPassWordField; import com.fr.design.gui.ipasswordfield.UIPassWordField;
import com.fr.design.gui.ipasswordfield.UIPasswordFieldWithFixedLength; import com.fr.design.gui.ipasswordfield.UIPasswordFieldWithFixedLength;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.DesignSizeI18nManager;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
@ -653,7 +654,7 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
dialog = new JDialog((Dialog) SwingUtilities.getWindowAncestor(RemoteEnvPane.this), Toolkit.i18nText("Fine-Design_Basic_Dialog_Message_Title"), true); dialog = new JDialog((Dialog) SwingUtilities.getWindowAncestor(RemoteEnvPane.this), Toolkit.i18nText("Fine-Design_Basic_Dialog_Message_Title"), true);
dialog.setSize(new Dimension(308, 132)); dialog.setSize(DesignSizeI18nManager.getInstance().i18nDimension("com.fr.env.RemoteEnvPane.dialog"));
okButton.setEnabled(false); okButton.setEnabled(false);
JPanel jp = new JPanel(); JPanel jp = new JPanel();
JPanel upPane = new JPanel(); JPanel upPane = new JPanel();

148
designer-base/src/main/java/com/fr/env/utils/DesignerInteractionHistory.java vendored

@ -0,0 +1,148 @@
package com.fr.env.utils;
import com.fr.common.annotations.Compatible;
import com.fr.general.IOUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.EncodeConstants;
import com.fr.stable.ProductConstants;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLReadable;
import com.fr.stable.xml.XMLTools;
import com.fr.stable.xml.XMLWriter;
import com.fr.stable.xml.XMLableReader;
import com.fr.third.javax.xml.stream.XMLStreamException;
import java.io.BufferedWriter;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets;
/**
* @author Starryi
* @version 10.0.18
* Created by Starryi on 2021/7/7
* 设计器访问和获取关键历史交互信息的持久化工具该关键历史交互信息
* 如用户是否点击过某按钮是否查看过某弹窗信息上次选择过的文件所在目录等
*/
@Compatible
public class DesignerInteractionHistory implements XMLReadable, XMLWriter {
private static final String FILE_NAME = "designer.ix.history.info";
private static final String ROOT_TAG = "History";
private static DesignerInteractionHistory history;
public static DesignerInteractionHistory getInstance() {
if (history == null) {
history = new DesignerInteractionHistory();
readXMLFile(history, history.getHistoryFile());
}
return history;
}
private File getHistoryFile() {
return new File(StableUtils.pathJoin(ProductConstants.getEnvHome(), FILE_NAME));
}
private static void readXMLFile(XMLReadable xmlReadable, File xmlFile) {
if (xmlFile == null || !xmlFile.exists()) {
return;
}
String charset = EncodeConstants.ENCODING_UTF_8;
try {
String decodeContent = getFileContent(xmlFile);
InputStream xmlInputStream = new ByteArrayInputStream(decodeContent.getBytes(charset));
InputStreamReader inputStreamReader = new InputStreamReader(xmlInputStream, charset);
XMLableReader xmlReader = XMLableReader.createXMLableReader(inputStreamReader);
if (xmlReader != null) {
xmlReader.readXMLObject(xmlReadable);
}
xmlInputStream.close();
} catch (IOException | XMLStreamException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
private static String getFileContent(File xmlFile) throws FileNotFoundException, UnsupportedEncodingException {
InputStream encodeInputStream = new FileInputStream(xmlFile);
return IOUtils.inputStream2String(encodeInputStream);
}
private static void writeContentToFile(String fileContent, File file) {
try (FileOutputStream fos = new FileOutputStream(file);
OutputStreamWriter osw = new OutputStreamWriter(fos, StandardCharsets.UTF_8);
BufferedWriter bw = new BufferedWriter(osw)) {
bw.write(fileContent);
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
public void saveXMLFile() {
File xmlFile = this.getHistoryFile();
try {
ByteArrayOutputStream out = new ByteArrayOutputStream();
XMLTools.writeOutputStreamXML(this, out);
out.flush();
out.close();
String fileContent = new String(out.toByteArray(), StandardCharsets.UTF_8);
writeContentToFile(fileContent, xmlFile);
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
private static final String HAS_SHOWN_SHIFT_DRAG_RESIZING_TOOLTIP = "hasShownShiftDragResizingTooltip";
private static final String LAST_SELECTED_BORDER_IMAGE_DIR = "lastSelectedBorderImageDir";
// 是否已展示过按下Shift键可锁定比例拖拽尺寸的Tooltip
private boolean hasShownShiftDragResizingTooltip = false;
// 用户上次通过文件选择器选择的边框图片所在目录
private String lastSelectedBorderImageDir = StringUtils.EMPTY;
public boolean isHasShownShiftDragResizingTooltip() {
return hasShownShiftDragResizingTooltip;
}
public void setHasShownShiftDragResizingTooltip(boolean shown) {
this.hasShownShiftDragResizingTooltip = shown;
}
public String getLastSelectedBorderImageDir() {
return lastSelectedBorderImageDir;
}
public void setLastSelectedBorderImageDir(String dirPath) {
this.lastSelectedBorderImageDir = dirPath;
}
@Override
public void writeXML(XMLPrintWriter writer) {
writer.startTAG(ROOT_TAG)
.attr(HAS_SHOWN_SHIFT_DRAG_RESIZING_TOOLTIP, isHasShownShiftDragResizingTooltip())
.attr(LAST_SELECTED_BORDER_IMAGE_DIR, getLastSelectedBorderImageDir())
.end();
}
@Override
public void readXML(XMLableReader reader) {
setHasShownShiftDragResizingTooltip(reader.getAttrAsBoolean(HAS_SHOWN_SHIFT_DRAG_RESIZING_TOOLTIP, false));
setLastSelectedBorderImageDir(reader.getAttrAsString(LAST_SELECTED_BORDER_IMAGE_DIR, StringUtils.EMPTY));
}
}

15
designer-base/src/main/java/com/fr/start/server/FineEmbedServerActivator.java

@ -6,6 +6,7 @@ import com.fr.module.Activator;
import com.fr.module.ModuleRole; import com.fr.module.ModuleRole;
import com.fr.stable.EncodeConstants; import com.fr.stable.EncodeConstants;
import com.fr.stable.ProductConstants; import com.fr.stable.ProductConstants;
import com.fr.stable.StringUtils;
import com.fr.startup.FineWebApplicationInitializer; import com.fr.startup.FineWebApplicationInitializer;
import com.fr.third.springframework.web.SpringServletContainerInitializer; import com.fr.third.springframework.web.SpringServletContainerInitializer;
import com.fr.third.springframework.web.context.support.AnnotationConfigWebApplicationContext; import com.fr.third.springframework.web.context.support.AnnotationConfigWebApplicationContext;
@ -26,6 +27,8 @@ import java.util.Set;
*/ */
public class FineEmbedServerActivator extends Activator { public class FineEmbedServerActivator extends Activator {
private static final String TOMCAT_MAX_HEADER_SIZE = "tomcat-maxHttpHeaderSize";
private Tomcat tomcat; private Tomcat tomcat;
@Override @Override
@ -68,6 +71,7 @@ public class FineEmbedServerActivator extends Activator {
// 8.5.x 请求参数带特殊字符被tomcat拒绝 []|{}^\`"<> // 8.5.x 请求参数带特殊字符被tomcat拒绝 []|{}^\`"<>
tomcat.getConnector().setProperty("relaxedQueryChars", "[]|{}^&#x5c;&#x60;&quot;&lt;&gt;"); tomcat.getConnector().setProperty("relaxedQueryChars", "[]|{}^&#x5c;&#x60;&quot;&lt;&gt;");
setMaxPostSize(); setMaxPostSize();
setMaxHttpHeaderSize();
String docBase = new File(WorkContext.getCurrent().getPath()).getParent(); String docBase = new File(WorkContext.getCurrent().getPath()).getParent();
//内置的上下文使用工程目录比如webroot //内置的上下文使用工程目录比如webroot
@ -102,6 +106,17 @@ public class FineEmbedServerActivator extends Activator {
} }
} }
private void setMaxHttpHeaderSize() {
String value = System.getProperty(TOMCAT_MAX_HEADER_SIZE);
if (StringUtils.isNotEmpty(value)) {
try {
tomcat.getConnector().setProperty("maxHttpHeaderSize", value);
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
}
private void stopServerActivator() { private void stopServerActivator() {

1
designer-base/src/main/resources/com/fr/design/i18n/dimension_en.properties

@ -3,3 +3,4 @@ com.fr.design.mainframe.check.CheckFontInfoDialog.collapse=630*185
com.fr.design.mainframe.check.CheckFontInfoDialog.messageWithLink=630*31 com.fr.design.mainframe.check.CheckFontInfoDialog.messageWithLink=630*31
com.fr.design.mainframe.check.CheckFontInfoDialog.unfold=630*280 com.fr.design.mainframe.check.CheckFontInfoDialog.unfold=630*280
com.fr.design.report.ReportColumnsPane=800*600 com.fr.design.report.ReportColumnsPane=800*600
com.fr.env.RemoteEnvPane.dialog=458*132

3
designer-base/src/main/resources/com/fr/design/i18n/dimension_ja_JP.properties

@ -1,4 +1,5 @@
com.fr.design.mainframe.check.CheckButton=280*118 com.fr.design.mainframe.check.CheckButton=280*118
com.fr.design.mainframe.check.CheckFontInfoDialog.collapse=610*185 com.fr.design.mainframe.check.CheckFontInfoDialog.collapse=610*185
com.fr.design.mainframe.check.CheckFontInfoDialog.messageWithLink=610*31 com.fr.design.mainframe.check.CheckFontInfoDialog.messageWithLink=610*31
com.fr.design.mainframe.check.CheckFontInfoDialog.unfold=610*280 com.fr.design.mainframe.check.CheckFontInfoDialog.unfold=610*280
com.fr.env.RemoteEnvPane.dialog=458*132

3
designer-base/src/main/resources/com/fr/design/i18n/dimension_ko_KR.properties

@ -1,4 +1,5 @@
com.fr.design.mainframe.check.CheckButton=230*118 com.fr.design.mainframe.check.CheckButton=230*118
com.fr.design.mainframe.check.CheckFontInfoDialog.collapse=490*185 com.fr.design.mainframe.check.CheckFontInfoDialog.collapse=490*185
com.fr.design.mainframe.check.CheckFontInfoDialog.messageWithLink=490*35 com.fr.design.mainframe.check.CheckFontInfoDialog.messageWithLink=490*35
com.fr.design.mainframe.check.CheckFontInfoDialog.unfold=490*280 com.fr.design.mainframe.check.CheckFontInfoDialog.unfold=490*280
com.fr.env.RemoteEnvPane.dialog=458*132

3
designer-base/src/main/resources/com/fr/design/i18n/dimension_zh.properties

@ -2,4 +2,5 @@
com.fr.design.mainframe.check.CheckButton=250*118 com.fr.design.mainframe.check.CheckButton=250*118
com.fr.design.mainframe.check.CheckFontInfoDialog.collapse=385*185 com.fr.design.mainframe.check.CheckFontInfoDialog.collapse=385*185
com.fr.design.mainframe.check.CheckFontInfoDialog.messageWithLink=385*31 com.fr.design.mainframe.check.CheckFontInfoDialog.messageWithLink=385*31
com.fr.design.mainframe.check.CheckFontInfoDialog.unfold=385*280 com.fr.design.mainframe.check.CheckFontInfoDialog.unfold=385*280
com.fr.env.RemoteEnvPane.dialog=308*132

3
designer-base/src/main/resources/com/fr/design/i18n/dimension_zh_TW.properties

@ -1,4 +1,5 @@
com.fr.design.mainframe.check.CheckButton=250*118 com.fr.design.mainframe.check.CheckButton=250*118
com.fr.design.mainframe.check.CheckFontInfoDialog.collapse=385*185 com.fr.design.mainframe.check.CheckFontInfoDialog.collapse=385*185
com.fr.design.mainframe.check.CheckFontInfoDialog.messageWithLink=385*31 com.fr.design.mainframe.check.CheckFontInfoDialog.messageWithLink=385*31
com.fr.design.mainframe.check.CheckFontInfoDialog.unfold=385*280 com.fr.design.mainframe.check.CheckFontInfoDialog.unfold=385*280
com.fr.env.RemoteEnvPane.dialog=308*132

BIN
designer-base/src/main/resources/com/fr/design/images/buttonicon/icon_border_image_help.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 468 B

BIN
designer-base/src/main/resources/com/fr/design/images/buttonicon/icon_choose_inset.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 280 B

BIN
designer-base/src/main/resources/com/fr/design/images/buttonicon/icon_delete_inset.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 B

BIN
designer-base/src/main/resources/com/fr/design/images/buttonicon/icon_inset_both_selected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 145 B

BIN
designer-base/src/main/resources/com/fr/design/images/buttonicon/icon_inset_both_unselected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 141 B

BIN
designer-base/src/main/resources/com/fr/design/images/buttonicon/icon_inset_left_selected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 155 B

BIN
designer-base/src/main/resources/com/fr/design/images/buttonicon/icon_inset_left_unselected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 141 B

BIN
designer-base/src/main/resources/com/fr/design/images/buttonicon/icon_inset_right_selected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 140 B

BIN
designer-base/src/main/resources/com/fr/design/images/buttonicon/icon_inset_right_unselected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 136 B

BIN
designer-base/src/main/resources/com/fr/design/images/buttonicon/icon_lock_disabled.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 225 B

BIN
designer-base/src/main/resources/com/fr/design/images/buttonicon/icon_lock_enabled.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 229 B

BIN
designer-base/src/main/resources/com/fr/design/images/buttonicon/icon_unlock_disabled.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 226 B

BIN
designer-base/src/main/resources/com/fr/design/images/buttonicon/icon_unlock_enabled.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 229 B

BIN
designer-base/src/main/resources/com/fr/design/images/control/edit_lock.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 255 B

BIN
designer-base/src/main/resources/com/fr/design/images/control/edit_unlock.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 220 B

BIN
designer-base/src/main/resources/com/fr/design/images/control/show_edit.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 304 B

BIN
designer-base/src/main/resources/com/fr/design/images/control/show_setting.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 281 B

BIN
designer-base/src/main/resources/com/fr/design/images/mainframe/openloading.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

BIN
designer-base/src/main/resources/com/fr/design/images/transparent_background.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

9
designer-chart/src/main/java/com/fr/design/chart/gui/ChartWidgetOption.java

@ -1,10 +1,12 @@
package com.fr.design.chart.gui; package com.fr.design.chart.gui;
import com.fr.base.chart.BaseChartGetter; import com.fr.base.chart.BaseChartGetter;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.design.gui.core.WidgetOption; import com.fr.design.gui.core.WidgetOption;
import com.fr.form.ui.ChartEditor; import com.fr.form.ui.ChartEditor;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.plugin.chart.vanchart.VanChart;
import javax.swing.Icon; import javax.swing.Icon;
@ -37,7 +39,12 @@ public class ChartWidgetOption extends WidgetOption {
Class<? extends ChartEditor> clz = widgetClass(); Class<? extends ChartEditor> clz = widgetClass();
try { try {
ChartEditor widget = clz.newInstance(); ChartEditor widget = clz.newInstance();
widget.resetChangeChartCollection(BaseChartGetter.createChartCollection(this.chartID)); ChartCollection chartCollection = (ChartCollection) BaseChartGetter.createChartCollection(this.chartID);
VanChart vanChart = chartCollection.getSelectedChartProvider(VanChart.class);
if (vanChart !=null) {
vanChart.resetAttrInForm();
}
widget.resetChangeChartCollection(chartCollection);
return widget; return widget;
} catch (InstantiationException e) { } catch (InstantiationException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);

12
designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartEditPane.java

@ -20,6 +20,7 @@ import com.fr.design.mainframe.chart.gui.ChartOtherPane;
import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.design.mainframe.chart.gui.ChartStylePane;
import com.fr.design.mainframe.chart.gui.ChartTypePane; import com.fr.design.mainframe.chart.gui.ChartTypePane;
import com.fr.design.mainframe.chart.info.ChartInfoCollector; import com.fr.design.mainframe.chart.info.ChartInfoCollector;
import com.fr.form.main.Form;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.plugin.chart.vanchart.VanChart; import com.fr.plugin.chart.vanchart.VanChart;
@ -168,6 +169,7 @@ public class ChartEditPane extends BasicPane implements AttributeChange, Prepare
AbstractChartAttrPane[] otherPaneList = ChartTypeInterfaceManager.getInstance().getAttrPaneArray(chartID, listener); AbstractChartAttrPane[] otherPaneList = ChartTypeInterfaceManager.getInstance().getAttrPaneArray(chartID, listener);
for (int i = 0; i < otherPaneList.length; i++) { for (int i = 0; i < otherPaneList.length; i++) {
otherPaneList[i].addAttributeChangeListener(listener); otherPaneList[i].addAttributeChangeListener(listener);
otherPaneList[i].registerChartEditPane(this);
paneList.add(otherPaneList[i]); paneList.add(otherPaneList[i]);
} }
this.isDefaultPane = false; this.isDefaultPane = false;
@ -366,4 +368,14 @@ public class ChartEditPane extends BasicPane implements AttributeChange, Prepare
} }
}); });
} }
public boolean isInForm() {
if (container != null && container.getEPane() != null) {
Object target = container.getEPane().getTarget();
if (target instanceof Form) {
return true;
}
}
return false;
}
} }

252
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java

@ -6,7 +6,6 @@ import com.fr.chart.chartattr.ChartCollection;
import com.fr.chart.charttypes.ChartTypeManager; import com.fr.chart.charttypes.ChartTypeManager;
import com.fr.chartx.attr.ChartProvider; import com.fr.chartx.attr.ChartProvider;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.mainframe.chart.info.ChartInfoCollector;
import com.fr.design.dialog.DialogActionListener; import com.fr.design.dialog.DialogActionListener;
import com.fr.design.dialog.UIDialog; import com.fr.design.dialog.UIDialog;
import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserver;
@ -16,7 +15,9 @@ import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UIToggleButton; import com.fr.design.gui.ibutton.UIToggleButton;
import com.fr.design.gui.imenutable.UIMenuNameableCreator; import com.fr.design.gui.imenutable.UIMenuNameableCreator;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.chart.gui.ChartTypePane.ComboBoxPane; import com.fr.design.mainframe.chart.gui.ChartTypePane.ComboBoxPane;
import com.fr.design.mainframe.chart.info.ChartInfoCollector;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.plugin.chart.vanchart.VanChart; import com.fr.plugin.chart.vanchart.VanChart;
@ -48,6 +49,7 @@ import java.awt.image.BufferedImage;
/** /**
* 图表 类型 增删 控制按钮界面. * 图表 类型 增删 控制按钮界面.
*
* @author kunsnat E-mail:kunsnat@gmail.com * @author kunsnat E-mail:kunsnat@gmail.com
* @version 创建时间2013-9-26 上午09:27:49 * @version 创建时间2013-9-26 上午09:27:49
*/ */
@ -55,7 +57,7 @@ public class ChartTypeButtonPane extends BasicBeanPane<ChartCollection> implemen
private static final long serialVersionUID = -8130803225718028933L; private static final long serialVersionUID = -8130803225718028933L;
private static final int B_W = 52; private static final int B_W = 52;
private static final int B_H = 20; private static final int B_H = 20;
private static final int COL_COUNT = 3; private static final int COL_COUNT = 4;
private static final int P_W = 300; private static final int P_W = 300;
private static final int P_H = 400; private static final int P_H = 400;
@ -65,9 +67,15 @@ public class ChartTypeButtonPane extends BasicBeanPane<ChartCollection> implemen
registerSupportChangeConfigChartClass(VanChart.class); registerSupportChangeConfigChartClass(VanChart.class);
} }
private boolean inForm;
private UIButton addButton; private UIButton addButton;
private UIButton configButton; private UIButton configButton;
private ArrayList<ChartChangeButton> indexList = new ArrayList<ChartChangeButton>(); private UIButton copyButton;
private UIButton moveForwardButton;
private UIButton moveBackButton;
private ArrayList<ChartChangeButton> indexList = new ArrayList<>();
private JPanel buttonPane; private JPanel buttonPane;
private ChartCollection editingCollection; private ChartCollection editingCollection;
@ -85,37 +93,52 @@ public class ChartTypeButtonPane extends BasicBeanPane<ChartCollection> implemen
//所以:stopEditing--选中其他button则响应click之后relayout;普通失焦则直接relayout. //所以:stopEditing--选中其他button则响应click之后relayout;普通失焦则直接relayout.
private boolean pressOtherButtonWhenEditing = false; private boolean pressOtherButtonWhenEditing = false;
public ChartTypeButtonPane(ChartTypePane chartTypePane){ public ChartTypeButtonPane(ChartTypePane chartTypePane) {
this(); this();
parent = chartTypePane; parent = chartTypePane;
} }
public ChartTypeButtonPane() { public ChartTypeButtonPane() {
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
addButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/add.png"));
configButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/config.png"));
initButton();
buttonPane = new JPanel(); buttonPane = new JPanel();
this.add(buttonPane, BorderLayout.CENTER); this.add(buttonPane, BorderLayout.CENTER);
JPanel eastPane = new JPanel(); JPanel northPane = new JPanel();
this.add(eastPane, BorderLayout.EAST); this.add(northPane, BorderLayout.NORTH);
eastPane.setLayout(new BorderLayout()); northPane.setLayout(new BorderLayout());
northPane.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5));
eastPane.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 5));
JPanel button = new JPanel(); JPanel button = new JPanel();
button.setPreferredSize(new Dimension(45, 20)); button.setPreferredSize(new Dimension(89, 20));
button.setLayout(new GridLayout(1, 2, 5, 0)); button.setLayout(new GridLayout(1, 4, 3, 0));
button.add(addButton); button.add(addButton);
button.add(configButton); button.add(copyButton);
eastPane.add(button, BorderLayout.NORTH); button.add(moveForwardButton);
button.add(moveBackButton);
northPane.add(button, BorderLayout.WEST);
northPane.add(configButton, BorderLayout.EAST);
initAddButton();
initConfigButton();
initConfigCreator(); initConfigCreator();
// Toolkit.getDefaultToolkit().addAWTEventListener(awt, AWTEvent.MOUSE_EVENT_MASK); // Toolkit.getDefaultToolkit().addAWTEventListener(awt, AWTEvent.MOUSE_EVENT_MASK);
}
private void initButton() {
addButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/add.png"));
configButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/config.png"));
copyButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/m_edit/copy.png"));
copyButton.setToolTipText(Toolkit.i18nText("Fine-Design_Basic_Action_Copy"));
moveForwardButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/control/left.png"));
moveForwardButton.setToolTipText(Toolkit.i18nText("Fine-Design_Report_HF_Move_Left"));
moveBackButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/control/right.png"));
moveBackButton.setToolTipText(Toolkit.i18nText("Fine-Design_Report_HF_Move_Right"));
initAddButton();
initConfigButton();
initMoveButton();
initCopyButton();
} }
public static void registerSupportChangeConfigChartClass(Class<? extends ChartProvider> cls) { public static void registerSupportChangeConfigChartClass(Class<? extends ChartProvider> cls) {
@ -123,53 +146,102 @@ public class ChartTypeButtonPane extends BasicBeanPane<ChartCollection> implemen
} }
private void initConfigCreator() { private void initConfigCreator() {
configCreator = new UIMenuNameableCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Change_Config_Attributes"), new AttrChangeConfig(), ChangeConfigPane.class); configCreator = new UIMenuNameableCreator(Toolkit.i18nText("Fine-Design_Chart_Change_Config_Attributes"), new AttrChangeConfig(), ChangeConfigPane.class);
} }
private void initAddButton() { private void initAddButton() {
addButton.setPreferredSize(new Dimension(20, 20)); addButton.setPreferredSize(new Dimension(20, 20));
addButton.addActionListener(addListener); addButton.addActionListener((e) -> {
String name = getNewChartName();
ChartProvider chart = getChangeStateNewChart();
checkInForm(chart);
addNewChart(chart, name, editingCollection.getChartCount());
});
}
private void checkInForm(ChartProvider chart) {
if (inForm) {
chart.resetAttrInForm();
}
} }
private void initConfigButton() { private void initConfigButton() {
configButton.setPreferredSize(new Dimension(20, 20)); configButton.setPreferredSize(new Dimension(20, 20));
configButton.addActionListener(configListener); configButton.addActionListener((e) -> showConfigDialog());
} }
ActionListener addListener = new ActionListener() { private void initCopyButton() {
@Override copyButton.setPreferredSize(new Dimension(20, 20));
public void actionPerformed(ActionEvent e) { copyButton.addActionListener((e) -> {
String name = getNewChartName(); String name = getCopyChartName();
ChartChangeButton button = new ChartChangeButton(name);// some set selected ChartProvider chart = getCopyChart();
addNewChart(chart, name, editingCollection.getSelectedIndex() + 1);
});
}
button.registerChangeListener(uiobListener); private void initMoveButton() {
moveForwardButton.setPreferredSize(new Dimension(20, 20));
moveBackButton.setPreferredSize(new Dimension(20, 20));
moveForwardButton.addActionListener((e) -> moveForwardChart());
moveBackButton.addActionListener((e) -> moveBackChart());
}
indexList.add(button); private void moveBackChart() {
editingCollection.moveBackChart();
populateBean(editingCollection);
}
if (editingCollection != null) { private void moveForwardChart() {
//点击添加按钮,则会触发切换状态 editingCollection.moveForwardChart();
ChartProvider chart = getChangeStateNewChart(); populateBean(editingCollection);
try { }
ChartProvider newChart = (ChartProvider) chart.clone();
editingCollection.addNamedChart(name, newChart); private void checkMoveButton() {
ChartInfoCollector.getInstance().collection(newChart, null); moveBackButton.setEnabled(editingCollection.getSelectedIndex() != editingCollection.getChartCount() - 1);
} catch (CloneNotSupportedException e1) { moveForwardButton.setEnabled(editingCollection.getSelectedIndex() != 0);
FineLoggerFactory.getLogger().error("Error in Clone"); }
}
checkoutChange(); private void addNewChart(ChartProvider chart, String name, int index) {
} if (chart == null) {
layoutPane(buttonPane); return;
} }
}; ChartChangeButton button = new ChartChangeButton(name);// some set selected
button.registerChangeListener(uiobListener);
indexList.add(index, button);
editingCollection.addNamedChart(index, name, chart);
ChartInfoCollector.getInstance().collection(chart, null);
checkoutChange();
layoutPane(buttonPane);
}
private void showConfigDialog() {
UIMenuNameableCreator ui = configCreator.clone();
final BasicBeanPane pane = ui.getPane();
pane.populateBean(editingCollection);
UIDialog dialog = pane.showUnsizedWindow(SwingUtilities.getWindowAncestor(new JPanel()), new DialogActionListener() {
@Override
public void doOk() {
pane.updateBean(editingCollection);
}
@Override
public void doCancel() {
}
});
dialog.setSize(P_W, P_H);
dialog.setVisible(true);
}
//获取图表收集器的状态 //获取图表收集器的状态
private void checkoutChange(){ private void checkoutChange() {
calculateMultiChartMode(); calculateMultiChartMode();
if (parent != null){ if (parent != null) {
parent.relayoutChartTypePane(editingCollection); parent.relayoutChartTypePane(editingCollection);
} }
//检查是否可以配置切换 //检查是否可以配置切换
configButton.setEnabled(changeEnable()); configButton.setEnabled(changeEnable());
checkMoveButton();
} }
/** /**
@ -181,7 +253,23 @@ public class ChartTypeButtonPane extends BasicBeanPane<ChartCollection> implemen
ChartProvider chart = editingCollection.getSelectedChartProvider(ChartProvider.class); ChartProvider chart = editingCollection.getSelectedChartProvider(ChartProvider.class);
String chartID = chart.getID(); String chartID = chart.getID();
String priority = ChartTypeManager.getInstanceWithCheck().getPriority(chartID); String priority = ChartTypeManager.getInstanceWithCheck().getPriority(chartID);
return ChartTypeManager.getInstanceWithCheck().getFirstChart(priority); ChartProvider firstChart = ChartTypeManager.getInstanceWithCheck().getFirstChart(priority);
try {
return (ChartProvider) firstChart.clone();
} catch (Exception ex) {
FineLoggerFactory.getLogger().error(ex.getMessage(), ex);
}
return null;
}
public ChartProvider getCopyChart() {
ChartProvider chart = editingCollection.getSelectedChartProvider(ChartProvider.class);
try {
return (ChartProvider) chart.clone();
} catch (Exception ex) {
FineLoggerFactory.getLogger().error(ex.getMessage(), ex);
return getChangeStateNewChart();
}
} }
//图表收集器模式状态改变 //图表收集器模式状态改变
@ -204,48 +292,42 @@ public class ChartTypeButtonPane extends BasicBeanPane<ChartCollection> implemen
return supportChangeConfigChartClassSet.contains(editingCollection.getSelectedChartProvider(ChartProvider.class).getClass()); return supportChangeConfigChartClassSet.contains(editingCollection.getSelectedChartProvider(ChartProvider.class).getClass());
} }
ActionListener configListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
UIMenuNameableCreator ui = configCreator.clone();
final BasicBeanPane pane = ui.getPane();
pane.populateBean(editingCollection);
UIDialog dialog = pane.showUnsizedWindow(SwingUtilities.getWindowAncestor(parent), new DialogActionListener() {
@Override
public void doOk() {
pane.updateBean(editingCollection);
}
@Override
public void doCancel() {
}
});
dialog.setSize(P_W, P_H);
dialog.setVisible(true);
}
};
private String getNewChartName() { private String getNewChartName() {
int count = indexList.size() + 1; int count = indexList.size() + 1;
while (true) { while (true) {
String name_test = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Module_Name") + count; String nameTest = Toolkit.i18nText("Fine-Design_Chart_Module_Name") + count;
boolean repeated = false; if (!nameRepeated(nameTest)) {
for (int i = 0, len = indexList.size(); i < len; i++) { return nameTest;
ChartChangeButton nameable = indexList.get(i);
if (ComparatorUtils.equals(nameable.getButtonName(), name_test)) {
repeated = true;
break;
}
} }
count++;
}
}
if (!repeated) { private String getCopyChartName() {
return name_test; String chartName = editingCollection.getChartName(editingCollection.getSelectedIndex()) + "_Copy";
if (!nameRepeated(chartName)) {
return chartName;
}
int count = 1;
while (true) {
String nameTest = chartName + count;
if (!nameRepeated(nameTest)) {
return nameTest;
} }
count++; count++;
} }
} }
private boolean nameRepeated(String name) {
for (int i = 0, len = indexList.size(); i < len; i++) {
ChartChangeButton nameable = indexList.get(i);
if (ComparatorUtils.equals(nameable.getButtonName(), name)) {
return true;
}
}
return false;
}
private void layoutPane(JPanel northPane) { private void layoutPane(JPanel northPane) {
if (northPane == null) { if (northPane == null) {
return; return;
@ -291,6 +373,7 @@ public class ChartTypeButtonPane extends BasicBeanPane<ChartCollection> implemen
/** /**
* 注册监听器 * 注册监听器
*
* @param listener 观察者监听事件 * @param listener 观察者监听事件
*/ */
public void registerChangeListener(UIObserverListener listener) { public void registerChangeListener(UIObserverListener listener) {
@ -299,6 +382,7 @@ public class ChartTypeButtonPane extends BasicBeanPane<ChartCollection> implemen
/** /**
* 是否应该响应事件监听器 * 是否应该响应事件监听器
*
* @return 是则返回true * @return 是则返回true
*/ */
public boolean shouldResponseChangeListener() { public boolean shouldResponseChangeListener() {
@ -383,7 +467,7 @@ public class ChartTypeButtonPane extends BasicBeanPane<ChartCollection> implemen
int selectedIndex = editingCollection.getSelectedIndex(); int selectedIndex = editingCollection.getSelectedIndex();
ChartChangeButton button = indexList.get(selectedIndex); ChartChangeButton button = indexList.get(selectedIndex);
button.isMoveOn = false; button.isMoveOn = false;
if (!ComparatorUtils.equals(editingCollection.getChartName(selectedIndex), newName)) { if (!nameRepeated(newName)) {
editingCollection.setChartName(selectedIndex, newName); editingCollection.setChartName(selectedIndex, newName);
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().fireTargetModified(); HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().fireTargetModified();
button.changeChartName(newName); button.changeChartName(newName);
@ -391,7 +475,7 @@ public class ChartTypeButtonPane extends BasicBeanPane<ChartCollection> implemen
buttonPane.remove(currentEditingEditor); buttonPane.remove(currentEditingEditor);
currentEditingEditor = null; currentEditingEditor = null;
if(!pressOtherButtonWhenEditing) { if (!pressOtherButtonWhenEditing) {
layoutPane(buttonPane); layoutPane(buttonPane);
} }
} }
@ -427,7 +511,7 @@ public class ChartTypeButtonPane extends BasicBeanPane<ChartCollection> implemen
@Override @Override
public void focusLost(FocusEvent e) {//编辑状态lost才走这边 public void focusLost(FocusEvent e) {//编辑状态lost才走这边
if (currentEditingEditor != null ) { if (currentEditingEditor != null) {
stopEditing(); stopEditing();
} }
} }
@ -519,7 +603,7 @@ public class ChartTypeButtonPane extends BasicBeanPane<ChartCollection> implemen
relayoutPane(); relayoutPane();
//重构面板 //重构面板
if (parent != null ){ if (parent != null) {
parent.reLayoutEditPane(lastPlotID, editingCollection); parent.reLayoutEditPane(lastPlotID, editingCollection);
} }
} }
@ -534,7 +618,7 @@ public class ChartTypeButtonPane extends BasicBeanPane<ChartCollection> implemen
@Override @Override
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
mouseClick(e); mouseClick(e);
if(pressOtherButtonWhenEditing){ if (pressOtherButtonWhenEditing) {
relayoutPane(); relayoutPane();
pressOtherButtonWhenEditing = false; pressOtherButtonWhenEditing = false;
} }
@ -581,7 +665,7 @@ public class ChartTypeButtonPane extends BasicBeanPane<ChartCollection> implemen
//需要先更新,最后重构面板 //需要先更新,最后重构面板
//重构面板 //重构面板
if (parent != null ){ if (parent != null) {
parent.reLayoutEditPane(lastPlotID, editingCollection); parent.reLayoutEditPane(lastPlotID, editingCollection);
} }
} }
@ -597,4 +681,8 @@ public class ChartTypeButtonPane extends BasicBeanPane<ChartCollection> implemen
currentEditingEditor.requestFocus(); currentEditingEditor.requestFocus();
} }
} }
public void refreshChartInForm(boolean inForm) {
this.inForm = inForm;
}
} }

9
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypePane.java

@ -47,6 +47,7 @@ public class ChartTypePane extends AbstractChartAttrPane {
private ChartEditPane editPane; private ChartEditPane editPane;
private ChartCollection editingCollection; private ChartCollection editingCollection;
private ActionListener autoButtonListener; private ActionListener autoButtonListener;
private boolean inForm;
@Override @Override
protected JPanel createContentPane() { protected JPanel createContentPane() {
@ -54,6 +55,7 @@ public class ChartTypePane extends AbstractChartAttrPane {
JPanel content = new JPanel(new BorderLayout()); JPanel content = new JPanel(new BorderLayout());
buttonPane = new ChartTypeButtonPane(this); buttonPane = new ChartTypeButtonPane(this);
buttonPane.refreshChartInForm(inForm);
content.add(buttonPane, BorderLayout.NORTH); content.add(buttonPane, BorderLayout.NORTH);
if (editingCollection != null) { if (editingCollection != null) {
@ -180,8 +182,10 @@ public class ChartTypePane extends AbstractChartAttrPane {
} }
//这一步会替换plot //这一步会替换plot
((AbstractChartTypePane) getSelectedPane()).updateBean(chart); ((AbstractChartTypePane) getSelectedPane()).updateBean(chart);
if (inForm) {
reLayoutEditPane(chart,lastPlotID); chart.resetAttrInForm();
}
reLayoutEditPane(chart, lastPlotID);
} }
protected UIComboBox createComboBox() { protected UIComboBox createComboBox() {
@ -405,5 +409,6 @@ public class ChartTypePane extends AbstractChartAttrPane {
*/ */
public void registerChartEditPane(ChartEditPane currentEditPane) { public void registerChartEditPane(ChartEditPane currentEditPane) {
this.editPane = currentEditPane; this.editPane = currentEditPane;
this.inForm = editPane.isInForm();
} }
} }

14
designer-chart/src/main/java/com/fr/van/chart/bubble/VanChartBubbleStylePane.java

@ -21,9 +21,9 @@ public class VanChartBubbleStylePane extends VanChartScatterStylePane {
super(listener); super(listener);
} }
protected void addVanChartTooltipPane(List<BasicPane> paneList){ protected void addVanChartTooltipPane(List<BasicPane> paneList) {
Plot plot = getChart().getPlot(); Plot plot = getChart().getPlot();
if(((VanChartBubblePlot) plot).isForceBubble()){ if (((VanChartBubblePlot) plot).isForceBubble()) {
paneList.add(new VanChartForceBubbleTooltipPane(VanChartBubbleStylePane.this)); paneList.add(new VanChartForceBubbleTooltipPane(VanChartBubbleStylePane.this));
} else { } else {
super.addVanChartTooltipPane(paneList); super.addVanChartTooltipPane(paneList);
@ -31,11 +31,11 @@ public class VanChartBubbleStylePane extends VanChartScatterStylePane {
} }
@Override @Override
protected void addVanChartAreaPane(List<BasicPane> paneList) { protected VanChartAreaPane createVanChartAreaPane() {
if (((VanChartBubblePlot)getChart().getPlot()).isForceBubble()){ if (((VanChartBubblePlot) getChart().getPlot()).isForceBubble()) {
paneList.add(new VanChartForceBubbleAreaPane(getChart().getPlot(), VanChartBubbleStylePane.this)); return new VanChartForceBubbleAreaPane(getChart().getPlot(), VanChartBubbleStylePane.this);
}else { } else {
paneList.add(new VanChartAreaPane(getChart().getPlot(), VanChartBubbleStylePane.this)); return new VanChartAreaPane(getChart().getPlot(), VanChartBubbleStylePane.this);
} }
} }

5
designer-chart/src/main/java/com/fr/van/chart/custom/style/VanChartCustomStylePane.java

@ -11,6 +11,7 @@ import com.fr.plugin.chart.custom.VanChartCustomPlot;
import com.fr.plugin.chart.custom.type.CustomPlotType; import com.fr.plugin.chart.custom.type.CustomPlotType;
import com.fr.van.chart.designer.component.richText.VanChartRichEditorPane; import com.fr.van.chart.designer.component.richText.VanChartRichEditorPane;
import com.fr.van.chart.designer.style.VanChartStylePane; import com.fr.van.chart.designer.style.VanChartStylePane;
import com.fr.van.chart.designer.style.background.VanChartAreaPane;
import java.util.List; import java.util.List;
@ -61,8 +62,8 @@ public class VanChartCustomStylePane extends VanChartStylePane {
@Override @Override
protected void addVanChartAreaPane(List<BasicPane> paneList) { protected VanChartAreaPane createVanChartAreaPane() {
paneList.add(new VanChartCustomAreaPane(getChart().getPlot(), VanChartCustomStylePane.this)); return new VanChartCustomAreaPane(getChart().getPlot(), VanChartCustomStylePane.this);
} }
@Override @Override

8
designer-chart/src/main/java/com/fr/van/chart/designer/PlotFactory.java

@ -34,7 +34,7 @@ import com.fr.van.chart.designer.style.MapRangeLegendPane;
import com.fr.van.chart.designer.style.VanChartPlotLegendPane; import com.fr.van.chart.designer.style.VanChartPlotLegendPane;
import com.fr.van.chart.designer.style.VanChartRangeLegendPane; import com.fr.van.chart.designer.style.VanChartRangeLegendPane;
import com.fr.van.chart.designer.style.VanChartStylePane; import com.fr.van.chart.designer.style.VanChartStylePane;
import com.fr.van.chart.designer.style.VanLegendPaneWidthOutHighlight; import com.fr.van.chart.designer.style.VanLegendPaneWidthOutFixedCheck;
import com.fr.van.chart.designer.style.label.VanChartGaugePlotLabelPane; import com.fr.van.chart.designer.style.label.VanChartGaugePlotLabelPane;
import com.fr.van.chart.designer.style.label.VanChartPiePlotLabelPane; import com.fr.van.chart.designer.style.label.VanChartPiePlotLabelPane;
import com.fr.van.chart.designer.style.label.VanChartPlotLabelDetailPane; import com.fr.van.chart.designer.style.label.VanChartPlotLabelDetailPane;
@ -128,8 +128,8 @@ public class PlotFactory {
private static Map<Class<? extends Plot>, Class<? extends VanChartPlotLegendPane>> legendMap = new HashMap<Class<? extends Plot>, Class<? extends VanChartPlotLegendPane>>(); private static Map<Class<? extends Plot>, Class<? extends VanChartPlotLegendPane>> legendMap = new HashMap<Class<? extends Plot>, Class<? extends VanChartPlotLegendPane>>();
static { static {
legendMap.put(VanChartGaugePlot.class, VanLegendPaneWidthOutHighlight.class); legendMap.put(VanChartGaugePlot.class, VanLegendPaneWidthOutFixedCheck.class);
legendMap.put(VanChartMultiPiePlot.class, VanLegendPaneWidthOutHighlight.class); legendMap.put(VanChartMultiPiePlot.class, VanLegendPaneWidthOutFixedCheck.class);
legendMap.put(VanChartScatterPlot.class, VanChartRangeLegendPane.class); legendMap.put(VanChartScatterPlot.class, VanChartRangeLegendPane.class);
legendMap.put(VanChartBubblePlot.class, VanChartRangeLegendPane.class); legendMap.put(VanChartBubblePlot.class, VanChartRangeLegendPane.class);
legendMap.put(VanChartMapPlot.class, MapRangeLegendPane.class); legendMap.put(VanChartMapPlot.class, MapRangeLegendPane.class);
@ -423,7 +423,7 @@ public class PlotFactory {
//大数据模式 恢复用注释。删除下面2个方法 largeDataModel lineMapLargeModel。 //大数据模式 恢复用注释。删除下面2个方法 largeDataModel lineMapLargeModel。
public static boolean largeDataModel(Plot plot) { public static boolean largeDataModel(Plot plot) {
return plot != null && plot.getDataProcessor().getMark() == LargeDataModel.MARK; return plot != null && plot.isLargeDataModel();
} }
public static boolean lineMapLargeModel(Plot plot) { public static boolean lineMapLargeModel(Plot plot) {

63
designer-chart/src/main/java/com/fr/van/chart/designer/TableLayout4VanChartHelper.java

@ -12,8 +12,8 @@ import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import javax.swing.border.Border; import javax.swing.border.Border;
import java.awt.Component;
import java.util.Arrays; import java.util.Arrays;
import java.awt.Component;
/** /**
* 布局 标题+组件 * 布局 标题+组件
@ -21,13 +21,13 @@ import java.util.Arrays;
public class TableLayout4VanChartHelper { public class TableLayout4VanChartHelper {
private static final int SMALL_GAP = 20; private static final int SMALL_GAP = 20;
public static final int EXPANDABLE_PANE_WIDTH =290; public static final int EXPANDABLE_PANE_WIDTH = 290;
public static final int EXPANDABLE_PANE_HIGHT =24; public static final int EXPANDABLE_PANE_HIGHT = 24;
public static final int DESCRIPTION_AREA_WIDTH = 60; public static final int DESCRIPTION_AREA_WIDTH = 60;
public static final int EDIT_AREA_WIDTH =155; public static final int EDIT_AREA_WIDTH = 155;
public static final int SECOND_EDIT_AREA_WIDTH = 143; public static final int SECOND_EDIT_AREA_WIDTH = 143;
public static final int COMPONENT_INTERVAL =12; public static final int COMPONENT_INTERVAL = 12;
public static final Border SECOND_EDIT_AREA_BORDER = BorderFactory.createEmptyBorder(0,12,0,0); public static final Border SECOND_EDIT_AREA_BORDER = BorderFactory.createEmptyBorder(0, 12, 0, 0);
public static JPanel createExpandablePaneWithTitleTopGap(String title, JPanel panel) { public static JPanel createExpandablePaneWithTitleTopGap(String title, JPanel panel) {
return new UIExpandablePane(title, EXPANDABLE_PANE_WIDTH, EXPANDABLE_PANE_HIGHT, panel) { return new UIExpandablePane(title, EXPANDABLE_PANE_WIDTH, EXPANDABLE_PANE_HIGHT, panel) {
@ -43,9 +43,9 @@ public class TableLayout4VanChartHelper {
} }
public static JPanel createExpandablePaneWithTitle(String title, JPanel panel) { public static JPanel createExpandablePaneWithTitle(String title, JPanel panel) {
return new UIExpandablePane(title, EXPANDABLE_PANE_WIDTH, EXPANDABLE_PANE_HIGHT, panel){ return new UIExpandablePane(title, EXPANDABLE_PANE_WIDTH, EXPANDABLE_PANE_HIGHT, panel) {
protected void setcontentPanelontentPanelBorder (){ protected void setcontentPanelontentPanelBorder() {
getContentPanel().setBorder(BorderFactory.createEmptyBorder(0 ,5, 0, 0)); getContentPanel().setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0));
} }
}; };
} }
@ -54,13 +54,23 @@ public class TableLayout4VanChartHelper {
return createGapTableLayoutPane(title, component, EDIT_AREA_WIDTH); return createGapTableLayoutPane(title, component, EDIT_AREA_WIDTH);
} }
public static JPanel createGapTableLayoutPaneWithoutTop(String title, Component component) {
return createGapTableLayoutPane(title, component, EDIT_AREA_WIDTH, false);
}
public static JPanel createGapTableLayoutPane(String title, Component component, double componentWidth) { public static JPanel createGapTableLayoutPane(String title, Component component, double componentWidth) {
return createGapTableLayoutPane(title, component, componentWidth, true);
}
public static JPanel createGapTableLayoutPane(String title, Component component, double componentWidth, boolean topLabel) {
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;
double[] columnSize = {f, componentWidth}; double[] columnSize = {f, componentWidth};
double[] rowSize = {p, p}; double[] rowSize = {p, p};
UILabel label = FRWidgetFactory.createLineWrapLabel(title); UILabel label = FRWidgetFactory.createLineWrapLabel(title);
label.setVerticalAlignment(SwingConstants.TOP); if (topLabel) {
label.setVerticalAlignment(SwingConstants.TOP);
}
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{null, null}, new Component[]{null, null},
new Component[]{label, UIComponentUtils.wrapWithBorderLayoutPane(component)}, new Component[]{label, UIComponentUtils.wrapWithBorderLayoutPane(component)},
@ -93,60 +103,65 @@ public class TableLayout4VanChartHelper {
/** /**
* 标题布局(二级菜单距左边框46) * 标题布局(二级菜单距左边框46)
* @param title 标题 *
* @param title 标题
* @param component 组件 * @param component 组件
* @return 布局好的组件 * @return 布局好的组件
*/ */
public static JPanel createTableLayoutPaneWithTitle(String title, Component component){ public static JPanel createTableLayoutPaneWithTitle(String title, Component component) {
return TableLayout4VanChartHelper.createTitlePane(title, component, LayoutConstants.CHART_ATTR_TOMARGIN); return TableLayout4VanChartHelper.createTitlePane(title, component, LayoutConstants.CHART_ATTR_TOMARGIN);
} }
/** /**
* 标题布局(二级菜单距左边框46) * 标题布局(二级菜单距左边框46)
* @param label 标题label *
* @param label 标题label
* @param component 组件 * @param component 组件
* @return 布局好的组件 * @return 布局好的组件
*/ */
public static JPanel createTableLayoutPaneWithUILabel(UILabel label, Component component){ public static JPanel createTableLayoutPaneWithUILabel(UILabel label, Component component) {
return TableLayout4VanChartHelper.createTitlePaneWithUILabel(label, component, LayoutConstants.CHART_ATTR_TOMARGIN); return TableLayout4VanChartHelper.createTitlePaneWithUILabel(label, component, LayoutConstants.CHART_ATTR_TOMARGIN);
} }
/** /**
* 标题布局(三级菜单距二级左侧20) * 标题布局(三级菜单距二级左侧20)
* @param title 标题 *
* @param title 标题
* @param component 组件 * @param component 组件
* @return 布局好的组件 * @return 布局好的组件
*/ */
public static JPanel createTableLayoutPaneWithSmallTitle(String title, Component component){ public static JPanel createTableLayoutPaneWithSmallTitle(String title, Component component) {
return TableLayout4VanChartHelper.createTitlePane(title, component, TableLayout4VanChartHelper.SMALL_GAP); return TableLayout4VanChartHelper.createTitlePane(title, component, TableLayout4VanChartHelper.SMALL_GAP);
} }
/** /**
* 标题布局指定gap * 标题布局指定gap
* @param title 标题 *
* @param title 标题
* @param component 组件 * @param component 组件
* @param gap 距左侧距离 * @param gap 距左侧距离
* @return 布局好的组件 * @return 布局好的组件
*/ */
public static JPanel createTitlePane(String title, Component component, int gap){ public static JPanel createTitlePane(String title, Component component, int gap) {
return createTitlePaneWithUILabel(new UILabel(title), component, gap); return createTitlePaneWithUILabel(new UILabel(title), component, gap);
} }
/** /**
* 标题布局指定gap * 标题布局指定gap
* @param label 标题label *
* @param label 标题label
* @param component 组件 * @param component 组件
* @param gap 距左侧距离 * @param gap 距左侧距离
* @return 布局好的组件 * @return 布局好的组件
*/ */
public static JPanel createTitlePaneWithUILabel(UILabel label, Component component, int gap){ public static JPanel createTitlePaneWithUILabel(UILabel label, Component component, int gap) {
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;
double[] columnSize = {gap, f}; double[] columnSize = {gap, f};
double[] rowSize = {p, p}; double[] rowSize = {p, p};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{label,null}, new Component[]{label, null},
new Component[]{null,component}, new Component[]{null, component},
}; };
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
} }

17
designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichEditorPane.java

@ -7,14 +7,13 @@ import com.fr.chart.chartattr.Plot;
import com.fr.chart.chartdata.MoreNameCDDefinition; import com.fr.chart.chartdata.MoreNameCDDefinition;
import com.fr.chart.chartdata.OneValueCDDefinition; import com.fr.chart.chartdata.OneValueCDDefinition;
import com.fr.data.TableDataSource; import com.fr.data.TableDataSource;
import com.fr.data.impl.EmbeddedTableData; import com.fr.data.impl.NameTableData;
import com.fr.design.DesignModelAdapter; import com.fr.design.DesignModelAdapter;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.DesignTableDataManager;
import com.fr.design.ui.ModernUIPane; import com.fr.design.ui.ModernUIPane;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.chart.base.AttrTooltipRichText; import com.fr.plugin.chart.base.AttrTooltipRichText;
import com.fr.plugin.chart.custom.CustomDefinition; import com.fr.plugin.chart.custom.CustomDefinition;
import com.fr.plugin.chart.custom.type.CustomPlotType; import com.fr.plugin.chart.custom.type.CustomPlotType;
@ -28,6 +27,8 @@ import com.teamdev.jxbrowser.chromium.JSValue;
import com.teamdev.jxbrowser.chromium.events.ScriptContextAdapter; import com.teamdev.jxbrowser.chromium.events.ScriptContextAdapter;
import com.teamdev.jxbrowser.chromium.events.ScriptContextEvent; import com.teamdev.jxbrowser.chromium.events.ScriptContextEvent;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
import java.util.Map; import java.util.Map;
@ -117,15 +118,9 @@ public class VanChartRichEditorPane {
return; return;
} }
try { String[] columnNames = DesignTableDataManager.getSelectedColumnNames(tableDataSource, ((NameTableData) tableData).getName());
EmbeddedTableData embeddedTableData = DesignTableDataManager.previewTableDataNotNeedInputParameters(tableDataSource, VanChartRichEditorPane.fieldNames = new ArrayList<>();
tableData, TableData.RESULT_NOT_NEED, false); fieldNames.addAll(Arrays.asList(columnNames));
List<String> fieldNames = DesignTableDataManager.getColumnNamesByTableData(embeddedTableData);
VanChartRichEditorPane.fieldNames = fieldNames;
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
} }
public static ModernUIPane<VanChartRichEditorModel> createRichEditorPane(AttrTooltipRichText richEditor) { public static ModernUIPane<VanChartRichEditorModel> createRichEditorPane(AttrTooltipRichText richEditor) {

252
designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePane.java

@ -8,15 +8,19 @@ import com.fr.chart.chartglyph.ConditionAttr;
import com.fr.chart.chartglyph.ConditionCollection; import com.fr.chart.chartglyph.ConditionCollection;
import com.fr.chartx.attr.LargeDataModeType; import com.fr.chartx.attr.LargeDataModeType;
import com.fr.design.formula.TinyFormulaPane; import com.fr.design.formula.TinyFormulaPane;
import com.fr.design.gui.frpane.UINumberDragPane;
import com.fr.design.gui.frpane.UINumberDragPaneWithPercent;
import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ibutton.UIToggleButton; import com.fr.design.gui.ibutton.UIToggleButton;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.gui.ispinner.UnsignedIntUISpinner;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.widget.FRWidgetFactory;
import com.fr.plugin.chart.attr.axis.VanChartAxis; import com.fr.plugin.chart.attr.axis.VanChartAxis;
import com.fr.plugin.chart.attr.plot.VanChartPlot; import com.fr.plugin.chart.attr.plot.VanChartPlot;
import com.fr.plugin.chart.attr.plot.VanChartRectanglePlot; import com.fr.plugin.chart.attr.plot.VanChartRectanglePlot;
@ -32,6 +36,8 @@ import com.fr.plugin.chart.base.VanChartZoom;
import com.fr.plugin.chart.gantt.attr.AttrGanttLabel; import com.fr.plugin.chart.gantt.attr.AttrGanttLabel;
import com.fr.plugin.chart.map.line.condition.AttrLineEffect; import com.fr.plugin.chart.map.line.condition.AttrLineEffect;
import com.fr.plugin.chart.scatter.attr.ScatterAttrLabel; import com.fr.plugin.chart.scatter.attr.ScatterAttrLabel;
import com.fr.plugin.chart.type.AxisType;
import com.fr.plugin.chart.type.ControlType;
import com.fr.plugin.chart.vanchart.VanChart; import com.fr.plugin.chart.vanchart.VanChart;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.van.chart.custom.component.VanChartHyperLinkPane; import com.fr.van.chart.custom.component.VanChartHyperLinkPane;
@ -45,14 +51,15 @@ import javax.swing.JPanel;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Component; import java.awt.Component;
import java.awt.event.ActionEvent; import java.awt.Dimension;
import java.awt.event.ActionListener;
public class VanChartInteractivePane extends AbstractVanChartScrollPane<Chart> { public class VanChartInteractivePane extends AbstractVanChartScrollPane<Chart> {
private static final long serialVersionUID = 8135452818502145597L; private static final long serialVersionUID = 8135452818502145597L;
private static final int AUTO_REFRESH_LEFT_GAP = 18; private static final int AUTO_REFRESH_LEFT_GAP = 18;
private static final double PERCENT = 100.0;
protected UICheckBox isSort; protected UICheckBox isSort;
protected UICheckBox exportImages; protected UICheckBox exportImages;
@ -72,15 +79,20 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane<Chart> {
private AutoRefreshPane autoRefreshPane; private AutoRefreshPane autoRefreshPane;
//图表缩放新设计 恢复用注释。删除下面八行代码。 //图表缩放新设计 恢复用注释。删除下面八行代码。
private UIButtonGroup zoomWidget; private UICheckBox zoomWidget;
protected UIButtonGroup zoomGesture;//地图手势缩放 protected UIButtonGroup zoomGesture;//地图手势缩放
private UIButtonGroup zoomResize;
private TinyFormulaPane from;
private TinyFormulaPane to;
private UIButtonGroup<String> zoomType; private UIButtonGroup<String> zoomType;
private JPanel changeEnablePane; private JPanel changeEnablePane;
private JPanel zoomTypePane; private JPanel zoomTypePane;
private UIButtonGroup<ControlType> controlType;
protected JPanel centerPane;
private UISpinner categoryNum;
private UINumberDragPane scaling;
private UIButtonGroup zoomResize;
private TinyFormulaPane from;
private TinyFormulaPane to;
//图表缩放新设计 恢复用注释。取消注释。 //图表缩放新设计 恢复用注释。取消注释。
//private ZoomPane zoomPane; //private ZoomPane zoomPane;
@ -126,7 +138,7 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane<Chart> {
//new Component[]{createLargeDataModePane(), null}, //new Component[]{createLargeDataModePane(), null},
new Component[]{createAnimationPane(), null}, new Component[]{createAnimationPane(), null},
new Component[]{createAxisRotationPane(new double[]{p, p}, columnSize, plot), null}, new Component[]{createAxisRotationPane(new double[]{p, p}, columnSize, plot), null},
new Component[]{createZoomPane(new double[]{p, p, p}, columnSize, plot), null}, new Component[]{createZoomPane(plot), null},
new Component[]{createAutoRefreshPane(plot), null}, new Component[]{createAutoRefreshPane(plot), null},
new Component[]{createHyperlinkPane(), null} new Component[]{createHyperlinkPane(), null}
}; };
@ -172,7 +184,7 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane<Chart> {
return false; return false;
} }
protected JPanel createZoomPane(double[] row, double[] col, VanChartPlot plot) { protected JPanel createZoomPane(VanChartPlot plot) {
//图表缩放新设计 恢复用注释。取消注释。 //图表缩放新设计 恢复用注释。取消注释。
// zoomPane = createZoomPane(); // zoomPane = createZoomPane();
// if (zoomPane == null) { // if (zoomPane == null) {
@ -184,47 +196,118 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane<Chart> {
if (!plot.isSupportZoomDirection()) { if (!plot.isSupportZoomDirection()) {
return null; return null;
} }
zoomWidget = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Open"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Close")}); zoomWidget = new UICheckBox(Toolkit.i18nText("Fine-Design_Chart_Open_Zoom_Control"));
zoomResize = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Change"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Non_Adjustment")}); zoomGesture = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Open"), Toolkit.i18nText("Fine-Design_Chart_Close")});
from = new TinyFormulaPane(); JPanel zoomWidgetPane = TableLayout4VanChartHelper.createGapTableLayoutPaneWithoutTop(Toolkit.i18nText("Fine-Design_Chart_Zoom_Widget"), zoomWidget);
to = new TinyFormulaPane(); JPanel zoomGesturePane = TableLayout4VanChartHelper.createGapTableLayoutPaneWithoutTop(Toolkit.i18nText("Fine-Design_Chart_ZoomGesture"), zoomGesture);
zoomType = new UIButtonGroup(getNameArray(), getValueArray()); zoomType = new UIButtonGroup(getNameArray(), getValueArray());
zoomGesture = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Open"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Close")}); zoomTypePane = getZoomTypePane(zoomType);
JPanel panel = createZoomPaneContent(zoomWidgetPane, zoomGesturePane, plot);
zoomWidget.addActionListener((event) -> checkZoomPane());
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Use_Zoom"), panel);
}
JPanel zoomWidgetPane = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Zoom_Widget"), zoomWidget); private void createChangeEnablePane(VanChartRectanglePlot plot) {
JPanel zoomGesturePane = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_ZoomGesture"), zoomGesture); String scaleAxis = Toolkit.i18nText("Fine-Design_Chart_Scale_Axis");
String scroll = Toolkit.i18nText("Fine-Design_Chart_Scroll");
controlType = new UIButtonGroup<>(new String[]{scaleAxis, scroll}, ControlType.values());
JPanel scaleAxisPane = createScaleAxisPane();
JPanel scrollPane = createScrollPane(plot);
Component[][] components = new Component[][]{ centerPane = new JPanel(new CardLayout()) {
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Widget_Boundary")), zoomResize}, @Override
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_From")), from}, public Dimension getPreferredSize() {
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_To")), to}, if (controlType.getSelectedItem() == ControlType.ZOOM) {
return scaleAxisPane.getPreferredSize();
} else {
return scrollPane.getPreferredSize();
}
}
}; };
centerPane.add(scaleAxisPane, scaleAxis);
centerPane.add(scrollPane, scroll);
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH; double e = TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH;
double[] columnSize = {f, e}; double[] columnSize = {f, e};
double[] row = {p, p};
Component[][] components = new Component[][]{
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Control_Type")), controlType},
new Component[]{centerPane, null}
};
changeEnablePane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, columnSize); changeEnablePane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, columnSize);
changeEnablePane.setBorder(BorderFactory.createEmptyBorder(10, 12, 0, 0)); changeEnablePane.setBorder(BorderFactory.createEmptyBorder(5, 12, 0, 0));
zoomTypePane = getzoomTypePane(zoomType);
JPanel panel = createZoomPaneContent(zoomWidgetPane, zoomGesturePane, changeEnablePane, zoomTypePane, plot); controlType.addActionListener((event) -> checkCardPane());
zoomWidget.addActionListener(new ActionListener() { }
@Override
public void actionPerformed(ActionEvent e) { private JPanel createScaleAxisPane() {
checkZoomPane(); zoomResize = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Change"), Toolkit.i18nText("Fine-Design_Chart_Non_Adjustment")});
from = new TinyFormulaPane();
to = new TinyFormulaPane();
Component[][] components = new Component[][]{
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Widget_Boundary")), zoomResize},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_From")), from},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_To")), to},
};
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH;
double[] columnSize = {f, e};
double[] row = {p, p, p};
JPanel resizePane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, columnSize);
return resizePane;
}
private JPanel createScrollPane(VanChartRectanglePlot plot) {
VanChartAxis vanChartAxis = plot.getCategoryAxisList().get(0);
AxisType axisType = vanChartAxis.getAxisType();
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH;
double[] columnSize = {f, e};
double[] row = {p};
Component[][] components;
if (axisType == AxisType.AXIS_CATEGORY) {
categoryNum = new UnsignedIntUISpinner(1, Double.MAX_VALUE, 1);
components = new Component[][]{
new Component[]{FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Chart_Initial_Cate_Num")), categoryNum},
};
} else {
scaling = new UINumberDragPaneWithPercent(1, 100, 1);
components = new Component[][]{
new Component[]{FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Chart_Scaling")), scaling},
};
}
return TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, columnSize);
}
protected void checkCardPane() {
if (centerPane != null && controlType != null) {
CardLayout cardLayout = (CardLayout) centerPane.getLayout();
if (controlType.getSelectedItem() == ControlType.ZOOM) {
cardLayout.show(centerPane, Toolkit.i18nText("Fine-Design_Chart_Scale_Axis"));
} else {
cardLayout.show(centerPane, Toolkit.i18nText("Fine-Design_Chart_Scroll"));
} }
}); }
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_Zoom"), panel);
} }
//图表缩放新设计 恢复用注释。删除下面八个方法getzoomTypePane createZoomPaneContent //图表缩放新设计 恢复用注释。删除下面八个方法getzoomTypePane createZoomPaneContent
// checkZoomEnabled getNameArray getValueArray checkZoomPane populateChartZoom updateChartZoom。 // checkZoomEnabled getNameArray getValueArray checkZoomPane populateChartZoom updateChartZoom。
protected JPanel getzoomTypePane(UIButtonGroup zoomType) { protected JPanel getZoomTypePane(UIButtonGroup zoomType) {
return TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Zoom_Direction"), zoomType); return TableLayout4VanChartHelper.createGapTableLayoutPaneWithoutTop(Toolkit.i18nText("Fine-Design_Chart_Zoom_Direction"), zoomType);
} }
protected JPanel createZoomPaneContent(JPanel zoomWidgetPane, JPanel zoomGesturePane, JPanel changeEnablePane, JPanel zoomTypePane, VanChartPlot plot) { protected JPanel createZoomPaneContent(JPanel zoomWidgetPane, JPanel zoomGesturePane, VanChartPlot plot) {
JPanel panel = new JPanel(new BorderLayout(0, 4)); JPanel panel = new JPanel(new BorderLayout(0, 4));
if (plot.isSupportZoomCategoryAxis()) {//支持缩放控件 if (plot.isSupportZoomCategoryAxis()) {//支持缩放控件
createChangeEnablePane((VanChartRectanglePlot) plot);
panel.add(zoomWidgetPane, BorderLayout.NORTH); panel.add(zoomWidgetPane, BorderLayout.NORTH);
panel.add(changeEnablePane, BorderLayout.CENTER); panel.add(changeEnablePane, BorderLayout.CENTER);
} }
@ -236,17 +319,18 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane<Chart> {
if (zoomWidget != null && axisRotation != null) { if (zoomWidget != null && axisRotation != null) {
if (axisRotation.getSelectedIndex() == 0) { if (axisRotation.getSelectedIndex() == 0) {
//只有开启坐标轴翻转,才需要将缩放控件强制关闭。 //只有开启坐标轴翻转,才需要将缩放控件强制关闭。
zoomWidget.setSelectedIndex(1); zoomWidget.setSelected(false);
} }
checkZoomPane(); checkZoomPane();
zoomWidget.setEnabled(axisRotation.getSelectedIndex() == 1); zoomWidget.setEnabled(axisRotation.getSelectedIndex() == 1);
} }
checkCardPane();
} }
protected String[] getNameArray() { protected String[] getNameArray() {
return new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_X_Axis"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Y_Axis") return new String[]{Toolkit.i18nText("Fine-Design_Chart_X_Axis"), Toolkit.i18nText("Fine-Design_Chart_Y_Axis")
, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_XY_Axis"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_None")}; , Toolkit.i18nText("Fine-Design_Chart_XY_Axis"), Toolkit.i18nText("Fine-Design_Chart_Use_None")};
} }
protected String[] getValueArray() { protected String[] getValueArray() {
@ -256,9 +340,11 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane<Chart> {
} }
private void checkZoomPane() { private void checkZoomPane() {
boolean zoomWidgetEnabled = zoomWidget.getSelectedIndex() == 0; boolean zoomWidgetEnabled = zoomWidget.isSelected();
changeEnablePane.setVisible(zoomWidgetEnabled); if (changeEnablePane != null) {
zoomType.setEnabled(!zoomWidgetEnabled); changeEnablePane.setVisible(zoomWidgetEnabled);
}
zoomTypePane.setVisible(!zoomWidgetEnabled);
} }
private void populateChartZoom(VanChart chart) { private void populateChartZoom(VanChart chart) {
@ -266,20 +352,31 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane<Chart> {
if (zoom == null) { if (zoom == null) {
zoom = new VanChartZoom(); zoom = new VanChartZoom();
} }
zoomWidget.setSelectedIndex(zoom.isZoomVisible() ? 0 : 1); zoomWidget.setSelected(zoom.isZoomVisible());
zoomGesture.setSelectedIndex(zoom.isZoomGesture() ? 0 : 1); zoomGesture.setSelectedIndex(zoom.isZoomGesture() ? 0 : 1);
zoomResize.setSelectedIndex(zoom.isZoomResize() ? 0 : 1);
if (zoom.getFrom() instanceof BaseFormula) {
from.populateBean(((BaseFormula) zoom.getFrom()).getContent());
} else {
from.populateBean(Utils.objectToString(zoom.getFrom()));
}
if (zoom.getTo() instanceof BaseFormula) {
to.populateBean(((BaseFormula) zoom.getTo()).getContent());
} else {
to.populateBean(Utils.objectToString(zoom.getTo()));
}
zoomType.setSelectedItem(zoom.getZoomType()); zoomType.setSelectedItem(zoom.getZoomType());
if (changeEnablePane != null) {
controlType.setSelectedItem(zoom.getControlType());
zoomResize.setSelectedIndex(zoom.isZoomResize() ? 0 : 1);
if (zoom.getFrom() instanceof BaseFormula) {
from.populateBean(((BaseFormula) zoom.getFrom()).getContent());
} else {
from.populateBean(Utils.objectToString(zoom.getFrom()));
}
if (zoom.getTo() instanceof BaseFormula) {
to.populateBean(((BaseFormula) zoom.getTo()).getContent());
} else {
to.populateBean(Utils.objectToString(zoom.getTo()));
}
if (categoryNum != null) {
categoryNum.setValue(zoom.getCategoryNum());
}
if (scaling != null) {
scaling.populateBean(zoom.getScaling() * PERCENT);
}
}
} }
private void updateChartZoom(VanChart chart) { private void updateChartZoom(VanChart chart) {
@ -288,26 +385,38 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane<Chart> {
zoom = new VanChartZoom(); zoom = new VanChartZoom();
chart.setVanChartZoom(zoom); chart.setVanChartZoom(zoom);
} }
zoom.setZoomVisible(zoomWidget.getSelectedIndex() == 0); zoom.setZoomVisible(zoomWidget.isSelected());
zoom.setZoomGesture(zoomGesture.getSelectedIndex() == 0); zoom.setZoomGesture(zoomGesture.getSelectedIndex() == 0);
zoom.setZoomResize(zoomResize.getSelectedIndex() == 0);
String fromString = from.updateBean();
Object fromObject;
if (StableUtils.maybeFormula(fromString)) {
fromObject = BaseFormula.createFormulaBuilder().build(fromString);
} else {
fromObject = fromString;
}
zoom.setFrom(fromObject);
String toString = to.updateBean();
Object toObject;
if (StableUtils.maybeFormula(toString)) {
toObject = BaseFormula.createFormulaBuilder().build(toString);
} else {
toObject = toString;
}
zoom.setTo(toObject);
zoom.setZoomType(zoomType.getSelectedItem()); zoom.setZoomType(zoomType.getSelectedItem());
if (changeEnablePane != null) {
zoom.setControlType(controlType.getSelectedItem());
if (zoom.getControlType() == ControlType.ZOOM) {
zoom.setZoomResize(zoomResize.getSelectedIndex() == 0);
String fromString = from.updateBean();
Object fromObject;
if (StableUtils.maybeFormula(fromString)) {
fromObject = BaseFormula.createFormulaBuilder().build(fromString);
} else {
fromObject = fromString;
}
zoom.setFrom(fromObject);
String toString = to.updateBean();
Object toObject;
if (StableUtils.maybeFormula(toString)) {
toObject = BaseFormula.createFormulaBuilder().build(toString);
} else {
toObject = toString;
}
zoom.setTo(toObject);
} else {
if (categoryNum != null) {
zoom.setCategoryNum((int) categoryNum.getValue());
}
if (scaling != null) {
zoom.setScaling(scaling.updateBean() / PERCENT);
}
}
}
} }
protected ZoomPane createZoomPane() { protected ZoomPane createZoomPane() {
@ -380,12 +489,12 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane<Chart> {
double f = TableLayout.FILL; double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
double[] columnSize = {f, e}; double[] columnSize = {f, e};
double[] rowSize = {p,p}; double[] rowSize = {p, p};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{null,null}, new Component[]{null, null},
new Component[]{chartAnimationLabel,isChartAnimation} new Component[]{chartAnimationLabel, isChartAnimation}
}; };
JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components,rowSize,columnSize); JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize);
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Animation"), panel); return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Animation"), panel);
} }
@ -467,7 +576,6 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane<Chart> {
//图表缩放新设计 恢复用注释。删除下面三行代码。 //图表缩放新设计 恢复用注释。删除下面三行代码。
if (plot.isSupportZoomDirection()) {//支持缩放方向=方向+控件 if (plot.isSupportZoomDirection()) {//支持缩放方向=方向+控件
populateChartZoom((VanChart) chart); populateChartZoom((VanChart) chart);
checkZoomPane();
} }
if (plot.getAxisPlotType() == AxisPlotType.RECTANGLE) { if (plot.getAxisPlotType() == AxisPlotType.RECTANGLE) {

2
designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePaneWithMapZoom.java

@ -12,7 +12,7 @@ public class VanChartInteractivePaneWithMapZoom extends VanChartInteractivePaneW
//图表缩放新设计 恢复用注释。删除下面方法 createZoomPaneContent。 //图表缩放新设计 恢复用注释。删除下面方法 createZoomPaneContent。
@Override @Override
protected JPanel createZoomPaneContent(JPanel zoomWidgetPane, JPanel zoomGesturePane, JPanel changeEnablePane, JPanel zoomTypePane, VanChartPlot plot) { protected JPanel createZoomPaneContent(JPanel zoomWidgetPane, JPanel zoomGesturePane, VanChartPlot plot) {
JPanel panel = new JPanel(new BorderLayout(0, 4)); JPanel panel = new JPanel(new BorderLayout(0, 4));
panel.add(zoomWidgetPane, BorderLayout.NORTH); panel.add(zoomWidgetPane, BorderLayout.NORTH);
panel.add(zoomGesturePane, BorderLayout.CENTER); panel.add(zoomGesturePane, BorderLayout.CENTER);

2
designer-chart/src/main/java/com/fr/van/chart/designer/style/HeatMapRangeLegendPane.java

@ -17,6 +17,6 @@ public class HeatMapRangeLegendPane extends MapRangeLegendPane {
} }
protected JPanel createCommonLegendPane(){ protected JPanel createCommonLegendPane(){
return this.createLegendPaneWithoutHighlight(); return this.createLegendPaneWithoutFixedCheck();
} }
} }

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

@ -72,9 +72,9 @@ public class VanChartPlotLegendPane extends BasicPane {
//private LimitPane limitPane; //private LimitPane limitPane;
//高亮显示的按钮 //高亮显示的按钮
private UILabel highlightLabel; private UILabel fixedCheckLabel;
private UIButtonGroup<Boolean> highlightButton; private UICheckBox fixedCheck;
private JPanel highlightPane; private JPanel fixedCheckPane;
private VanChartStylePane parent; private VanChartStylePane parent;
@ -91,8 +91,8 @@ public class VanChartPlotLegendPane extends BasicPane {
this.plot = plot; this.plot = plot;
} }
public JPanel getHighlightPane() { public JPanel getFixedCheckPane() {
return highlightPane; return fixedCheckPane;
} }
public VanChartStylePane getLegendPaneParent() { public VanChartStylePane getLegendPaneParent() {
@ -135,7 +135,7 @@ public class VanChartPlotLegendPane extends BasicPane {
}); });
} }
protected JPanel createLegendPaneWithoutHighlight() { protected JPanel createLegendPaneWithoutFixedCheck() {
borderPane = new VanChartBorderWithRadiusPane(); borderPane = new VanChartBorderWithRadiusPane();
backgroundPane = creatBackgroundPane(); backgroundPane = creatBackgroundPane();
@ -162,11 +162,11 @@ public class VanChartPlotLegendPane extends BasicPane {
protected JPanel createLegendPane() { protected JPanel createLegendPane() {
borderPane = new VanChartBorderWithRadiusPane(); borderPane = new VanChartBorderWithRadiusPane();
backgroundPane = creatBackgroundPane(); backgroundPane = creatBackgroundPane();
highlightPane = createHighlightPane(); fixedCheckPane = createFixedCheckPane();
JPanel panel = new JPanel(); JPanel panel = new JPanel();
panel.setLayout(new BorderLayout()); panel.setLayout(new BorderLayout());
panel.add(createDisplayStrategy(), BorderLayout.CENTER); panel.add(createDisplayStrategy(), BorderLayout.CENTER);
panel.add(highlightPane, BorderLayout.SOUTH); panel.add(fixedCheckPane, BorderLayout.SOUTH);
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;
@ -319,9 +319,9 @@ public class VanChartPlotLegendPane extends BasicPane {
// return limitPane; // return limitPane;
} }
private JPanel createHighlightPane() { private JPanel createFixedCheckPane() {
highlightButton = new UIButtonGroup<>(new String[]{Toolkit.i18nText("Fine-Design_Chart_On"), Toolkit.i18nText("Fine-Design_Chart_Off")}, new Boolean[]{true, false}); fixedCheck = new UICheckBox(Toolkit.i18nText("Fine-Engine_Chart_Open_Fixed_Display"));
highlightLabel = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Highlight")); fixedCheckLabel = new UILabel(Toolkit.i18nText("Fine-Engine_Chart_Fixed_Display"));
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
@ -329,7 +329,7 @@ public class VanChartPlotLegendPane extends BasicPane {
double[] rowSize = {p, p}; double[] rowSize = {p, p};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{null, null}, new Component[]{null, null},
new Component[]{highlightLabel, highlightButton} new Component[]{fixedCheckLabel, fixedCheck}
}; };
return TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize); return TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize);
} }
@ -408,8 +408,8 @@ public class VanChartPlotLegendPane extends BasicPane {
//legend.setLimitAttribute(limitPane.updateBean()); //legend.setLimitAttribute(limitPane.updateBean());
legend.setFloatPercentX(customFloatPositionPane.getFloatPosition_x()); legend.setFloatPercentX(customFloatPositionPane.getFloatPosition_x());
legend.setFloatPercentY(customFloatPositionPane.getFloatPosition_y()); legend.setFloatPercentY(customFloatPositionPane.getFloatPosition_y());
if (highlightButton != null && highlightButton.getSelectedItem() != null) { if (fixedCheck != null) {
legend.setHighlight(highlightButton.getSelectedItem()); legend.setHighlight(fixedCheck.isSelected());
} }
} }
@ -431,11 +431,11 @@ public class VanChartPlotLegendPane extends BasicPane {
maxProportion.populateBean(legend.getMaxHeight()); maxProportion.populateBean(legend.getMaxHeight());
//区域显示策略 恢复用注释。取消注释。 //区域显示策略 恢复用注释。取消注释。
//limitPane.populateBean(legend.getLimitAttribute()); //limitPane.populateBean(legend.getLimitAttribute());
if (highlightButton != null) { if (fixedCheck != null) {
highlightButton.setSelectedItem(legend.isHighlight()); fixedCheck.setSelected(legend.isHighlight());
boolean largeDataModel = PlotFactory.largeDataModel(plot); boolean largeDataModel = PlotFactory.largeDataModel(plot);
highlightButton.setEnabled(!largeDataModel); fixedCheck.setEnabled(!largeDataModel);
highlightLabel.setEnabled(!largeDataModel); fixedCheckLabel.setEnabled(!largeDataModel);
} }
} }

2
designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartRangeLegendPane.java

@ -114,7 +114,7 @@ public class VanChartRangeLegendPane extends VanChartPlotLegendPane {
} }
private void checkHighlightVisible() { private void checkHighlightVisible() {
JPanel highlightPane = this.getHighlightPane(); JPanel highlightPane = this.getFixedCheckPane();
if (highlightPane != null) { if (highlightPane != null) {
highlightPane.setVisible(legendType != LegendType.GRADUAL); highlightPane.setVisible(legendType != LegendType.GRADUAL);

26
designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartStylePane.java

@ -3,6 +3,7 @@ package com.fr.van.chart.designer.style;
import com.fr.chart.chartattr.Plot; import com.fr.chart.chartattr.Plot;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.mainframe.chart.ChartEditPane;
import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.design.mainframe.chart.gui.ChartStylePane;
import com.fr.plugin.chart.attr.plot.VanChartAxisPlot; import com.fr.plugin.chart.attr.plot.VanChartAxisPlot;
import com.fr.van.chart.designer.component.richText.VanChartRichEditorPane; import com.fr.van.chart.designer.component.richText.VanChartRichEditorPane;
@ -19,14 +20,20 @@ public class VanChartStylePane extends ChartStylePane {
private static final long serialVersionUID = 186776958263021761L; private static final long serialVersionUID = 186776958263021761L;
private ChartEditPane chartEditPane;
public VanChartStylePane(AttributeChangeListener listener) { public VanChartStylePane(AttributeChangeListener listener) {
super(listener); super(listener);
} }
protected java.util.List<BasicPane> getPaneList() { protected List<BasicPane> getPaneList() {
java.util.List<BasicPane> paneList = new ArrayList<BasicPane>(); List<BasicPane> paneList = new ArrayList<BasicPane>();
Plot plot = getChart().getPlot(); Plot plot = getChart().getPlot();
paneList.add(createVanChartTitlePane());
boolean inForm = chartEditPane != null ? chartEditPane.isInForm() : false;
VanChartTitlePane vanChartTitlePane = createVanChartTitlePane();
vanChartTitlePane.refreshTooltipLabel(inForm);
paneList.add(vanChartTitlePane);
if (plot.isSupportLegend()) { if (plot.isSupportLegend()) {
paneList.add(new VanChartLegendPane(VanChartStylePane.this)); paneList.add(new VanChartLegendPane(VanChartStylePane.this));
} }
@ -47,7 +54,9 @@ public class VanChartStylePane extends ChartStylePane {
} }
} }
addVanChartAreaPane(paneList); VanChartAreaPane vanChartAreaPane = createVanChartAreaPane();
vanChartAreaPane.refreshTooltipLabel(inForm);
paneList.add(vanChartAreaPane);
addVanChartTooltipPane(paneList); addVanChartTooltipPane(paneList);
@ -61,8 +70,8 @@ public class VanChartStylePane extends ChartStylePane {
protected void addOtherAxisPane(java.util.List<BasicPane> paneList, Plot plot) { protected void addOtherAxisPane(java.util.List<BasicPane> paneList, Plot plot) {
} }
protected void addVanChartAreaPane(List<BasicPane> paneList) { protected VanChartAreaPane createVanChartAreaPane() {
paneList.add(new VanChartAreaPane(getChart().getPlot(), VanChartStylePane.this)); return new VanChartAreaPane(getChart().getPlot(), VanChartStylePane.this);
} }
protected void createVanChartAxisPane(List<BasicPane> paneList, VanChartAxisPlot plot) { protected void createVanChartAxisPane(List<BasicPane> paneList, VanChartAxisPlot plot) {
@ -80,4 +89,9 @@ public class VanChartStylePane extends ChartStylePane {
public void refreshTableFieldNames() { public void refreshTableFieldNames() {
VanChartRichEditorPane.refreshCommonChartFieldNames(getChart()); VanChartRichEditorPane.refreshCommonChartFieldNames(getChart());
} }
public void registerChartEditPane(ChartEditPane currentEditPane) {
this.chartEditPane = currentEditPane;
}
} }

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

@ -13,6 +13,7 @@ import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ibutton.UIToggleButton; import com.fr.design.gui.ibutton.UIToggleButton;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.PaneTitleConstants; import com.fr.design.mainframe.chart.PaneTitleConstants;
@ -36,6 +37,7 @@ import javax.swing.SwingConstants;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component; import java.awt.Component;
import java.awt.Point; import java.awt.Point;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
@ -69,6 +71,7 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane<VanChart> {
private JPanel maxProportionPane; private JPanel maxProportionPane;
//区域显示策略 恢复用注释。取消注释。 //区域显示策略 恢复用注释。取消注释。
//private LimitPane limitPane; //private LimitPane limitPane;
private UILabel tooltipLabel;
protected VanChartStylePane parent; protected VanChartStylePane parent;
@ -88,21 +91,30 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane<VanChart> {
} }
private void initComponents() { private void initComponents() {
isTitleVisible = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Title_Visible")); isTitleVisible = new UICheckBox(Toolkit.i18nText("Fine-Design_Chart_Title_Visible"));
titlePane = createTitlePane(); tooltipLabel = new UILabel("<html>" + Toolkit.i18nText("Fine-Design_Chart_Title_Tooltip") + "</html>");
tooltipLabel.setForeground(Color.gray);
tooltipLabel.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 10));
tooltipLabel.setVisible(false);
JPanel panel = new JPanel();
panel.setLayout(new BorderLayout());
panel.add(isTitleVisible, BorderLayout.NORTH);
panel.add(tooltipLabel, BorderLayout.CENTER);
titlePane = createTitlePane();
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;
double[] columnSize = {f}; double[] columnSize = {f};
double[] rowSize = {p, p, p}; double[] rowSize = {p, p, p};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{isTitleVisible}, new Component[]{panel},
new Component[]{titlePane} new Component[]{titlePane}
}; };
JPanel panel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); JPanel panel1 = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
this.add(panel, BorderLayout.CENTER); this.add(panel1, BorderLayout.CENTER);
isTitleVisible.addActionListener(new ActionListener() { isTitleVisible.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
@ -370,4 +382,7 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane<VanChart> {
ChartInfoCollector.getInstance().updateChartConfig(chart, ConfigType.TITLE, chart.getBuryingPointTitleConfig()); ChartInfoCollector.getInstance().updateChartConfig(chart, ConfigType.TITLE, chart.getBuryingPointTitleConfig());
} }
public void refreshTooltipLabel(boolean inForm) {
tooltipLabel.setVisible(inForm);
}
} }

21
designer-chart/src/main/java/com/fr/van/chart/designer/style/VanLegendPaneWidthOutFixedCheck.java

@ -0,0 +1,21 @@
package com.fr.van.chart.designer.style;
import javax.swing.JPanel;
/**
* Created by eason on 2016/12/14.
*/
public class VanLegendPaneWidthOutFixedCheck extends VanChartPlotLegendPane{
public VanLegendPaneWidthOutFixedCheck(){
}
public VanLegendPaneWidthOutFixedCheck(VanChartStylePane parent){
super(parent);
}
protected JPanel createLegendPane(){
return this.createLegendPaneWithoutFixedCheck();
}
}

21
designer-chart/src/main/java/com/fr/van/chart/designer/style/VanLegendPaneWidthOutHighlight.java

@ -1,21 +0,0 @@
package com.fr.van.chart.designer.style;
import javax.swing.JPanel;
/**
* Created by eason on 2016/12/14.
*/
public class VanLegendPaneWidthOutHighlight extends VanChartPlotLegendPane{
public VanLegendPaneWidthOutHighlight(){
}
public VanLegendPaneWidthOutHighlight(VanChartStylePane parent){
super(parent);
}
protected JPanel createLegendPane(){
return this.createLegendPaneWithoutHighlight();
}
}

9
designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartTimeAxisPane.java

@ -293,7 +293,7 @@ public class VanChartTimeAxisPane extends VanChartBaseAxisPane {
DateEditor dateEditor = (DateEditor)minValueField.getCurrentEditor(); DateEditor dateEditor = (DateEditor)minValueField.getCurrentEditor();
String dateString = dateEditor.getUIDatePickerFormat().format(datetmp); String dateString = dateEditor.getUIDatePickerFormat().format(datetmp);
timeAxis.setCustomMinValue(StringUtils.isNotEmpty(dateString)); timeAxis.setCustomMinValue(StringUtils.isNotEmpty(dateString));
timeAxis.setMinValue(BaseFormula.createFormulaBuilder().build(dateString)); timeAxis.setMinValue(createDataFormula(dateString));
} }
} else { } else {
timeAxis.setCustomMinValue(false); timeAxis.setCustomMinValue(false);
@ -308,7 +308,7 @@ public class VanChartTimeAxisPane extends VanChartBaseAxisPane {
DateEditor dateEditor = (DateEditor)maxValueField.getCurrentEditor(); DateEditor dateEditor = (DateEditor)maxValueField.getCurrentEditor();
String dateString = dateEditor.getUIDatePickerFormat().format(datetmp); String dateString = dateEditor.getUIDatePickerFormat().format(datetmp);
timeAxis.setCustomMaxValue(StringUtils.isNotEmpty(dateString)); timeAxis.setCustomMaxValue(StringUtils.isNotEmpty(dateString));
timeAxis.setMaxValue(BaseFormula.createFormulaBuilder().build(dateString)); timeAxis.setMaxValue(createDataFormula(dateString));
} }
} else { } else {
timeAxis.setCustomMaxValue(false); timeAxis.setCustomMaxValue(false);
@ -332,6 +332,11 @@ public class VanChartTimeAxisPane extends VanChartBaseAxisPane {
checkBoxUse(); checkBoxUse();
} }
private BaseFormula createDataFormula(String dateString) {
String formulaString = "\"" + dateString + "\"";
return BaseFormula.createFormulaBuilder().build(formulaString);
}
public void populate(VanChartTimeAxis timeAxis){ public void populate(VanChartTimeAxis timeAxis){
// 最小值 // 最小值
if (timeAxis.isCustomMinValue() && timeAxis.getMinValue() != null) { if (timeAxis.isCustomMinValue() && timeAxis.getMinValue() != null) {

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

@ -3,6 +3,8 @@ package com.fr.van.chart.designer.style.background;
import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.Plot; import com.fr.chart.chartattr.Plot;
import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; import com.fr.design.gui.frpane.AbstractAttrNoScrollPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.PaneTitleConstants; import com.fr.design.mainframe.chart.PaneTitleConstants;
@ -12,8 +14,10 @@ import com.fr.van.chart.designer.component.background.VanChartBackgroundPane;
import com.fr.van.chart.designer.component.border.VanChartBorderWithRadiusPane; import com.fr.van.chart.designer.component.border.VanChartBorderWithRadiusPane;
import com.fr.van.chart.designer.style.background.radar.VanChartRadarAxisAreaPane; import com.fr.van.chart.designer.style.background.radar.VanChartRadarAxisAreaPane;
import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component; import java.awt.Component;
//图表区|绘图区 边框和背景 //图表区|绘图区 边框和背景
@ -25,12 +29,13 @@ public class VanChartAreaBackgroundPane extends AbstractVanChartScrollPane<Chart
private VanChartAxisAreaPane chartAxisAreaPane; private VanChartAxisAreaPane chartAxisAreaPane;
private JPanel contentPane; private JPanel contentPane;
private UILabel tooltipLabel;
private boolean isPlot;//绘图区 private boolean isPlot;//绘图区
private AbstractAttrNoScrollPane parent; private AbstractAttrNoScrollPane parent;
public VanChartAreaBackgroundPane(boolean isPlot, AbstractAttrNoScrollPane parent){ public VanChartAreaBackgroundPane(boolean isPlot, AbstractAttrNoScrollPane parent) {
super(); super();
this.isPlot = isPlot; this.isPlot = isPlot;
this.parent = parent; this.parent = parent;
@ -50,14 +55,22 @@ public class VanChartAreaBackgroundPane extends AbstractVanChartScrollPane<Chart
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;
double[] columnSize = { f }; double[] columnSize = {f};
double[] rowSize = {p,p,p}; double[] rowSize = {p, p, p};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Border"),chartBorderPane)}, new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Border"), chartBorderPane)},
new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Background"), chartBackgroundPane)}, new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Background"), chartBackgroundPane)},
}; };
JPanel panel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); JPanel panel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
contentPane.add(panel, BorderLayout.CENTER); contentPane.add(panel, BorderLayout.CENTER);
if (!isPlot) {
tooltipLabel = new UILabel("<html>" + Toolkit.i18nText("Fine-Design_Chart_Background_Tooltip") + "</html>");
tooltipLabel.setForeground(Color.gray);
tooltipLabel.setBorder(BorderFactory.createEmptyBorder(0, 10, 5, 10));
contentPane.add(tooltipLabel, BorderLayout.NORTH);
tooltipLabel.setVisible(false);
}
return contentPane; return contentPane;
} }
@ -68,11 +81,11 @@ public class VanChartAreaBackgroundPane extends AbstractVanChartScrollPane<Chart
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;
double[] columnSize = { f }; double[] columnSize = {f};
double[] rowSize = {p,p,p}; double[] rowSize = {p, p, p};
Component[][] components; Component[][] components;
if(plot.isSupportBorder()){//有边框和背景 if (plot.isSupportBorder()) {//有边框和背景
chartAxisAreaPane = initAxisAreaPane(); chartAxisAreaPane = initAxisAreaPane();
@ -85,7 +98,7 @@ public class VanChartAreaBackgroundPane extends AbstractVanChartScrollPane<Chart
} }
JPanel panel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); JPanel panel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
contentPane.add(panel,BorderLayout.CENTER); contentPane.add(panel, BorderLayout.CENTER);
parent.initAllListeners(); parent.initAllListeners();
} }
@ -96,18 +109,19 @@ public class VanChartAreaBackgroundPane extends AbstractVanChartScrollPane<Chart
protected Component[][] initComponents() { protected Component[][] initComponents() {
return new Component[][]{ return new Component[][]{
new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Border"),chartBorderPane)}, new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Border"), chartBorderPane)},
new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Background"), chartBackgroundPane)}, new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Background"), chartBackgroundPane)},
new Component[]{chartAxisAreaPane} new Component[]{chartAxisAreaPane}
}; };
} }
/** /**
* 标题 * 标题
* @return 标题 *
* @return 标题
*/ */
public String title4PopupWindow() { public String title4PopupWindow() {
if(isPlot){ if (isPlot) {
return PaneTitleConstants.CHART_STYLE_AREA_PLOT_TITLE; return PaneTitleConstants.CHART_STYLE_AREA_PLOT_TITLE;
} }
return PaneTitleConstants.CHART_STYLE_AREA_AREA_TITLE; return PaneTitleConstants.CHART_STYLE_AREA_AREA_TITLE;
@ -118,11 +132,11 @@ public class VanChartAreaBackgroundPane extends AbstractVanChartScrollPane<Chart
if (chart == null) { if (chart == null) {
chart = new Chart(); chart = new Chart();
} }
if(isPlot){ if (isPlot) {
Plot plot = chart.getPlot(); Plot plot = chart.getPlot();
chartBorderPane.update(plot); chartBorderPane.update(plot);
chartBackgroundPane.update(plot); chartBackgroundPane.update(plot);
if(plot.isSupportIntervalBackground() && chartAxisAreaPane != null){ if (plot.isSupportIntervalBackground() && chartAxisAreaPane != null) {
chartAxisAreaPane.updateBean(plot); chartAxisAreaPane.updateBean(plot);
} }
} else { } else {
@ -133,12 +147,12 @@ public class VanChartAreaBackgroundPane extends AbstractVanChartScrollPane<Chart
@Override @Override
public void populateBean(Chart chart) { public void populateBean(Chart chart) {
if(chart == null) { if (chart == null) {
return; return;
} }
if(isPlot){ if (isPlot) {
Plot plot = chart.getPlot(); Plot plot = chart.getPlot();
if(plot.isSupportIntervalBackground()){ if (plot.isSupportIntervalBackground()) {
//含有坐标轴相关设置,例如警戒线、网格线、间隔背景 //含有坐标轴相关设置,例如警戒线、网格线、间隔背景
if (chartAxisAreaPane == null) { if (chartAxisAreaPane == null) {
refreshContentPane(plot); refreshContentPane(plot);
@ -157,4 +171,8 @@ public class VanChartAreaBackgroundPane extends AbstractVanChartScrollPane<Chart
public Chart updateBean() { public Chart updateBean() {
return null; return null;
} }
public void refreshTooltipLabel(boolean inForm) {
tooltipLabel.setVisible(inForm);
}
} }

15
designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartAreaPane.java

@ -40,17 +40,18 @@ public class VanChartAreaPane extends ThirdTabPane<VanChart> implements AutoSele
JPanel pane = new JPanel(new FlowLayout(FlowLayout.LEADING, 0, 0)); JPanel pane = new JPanel(new FlowLayout(FlowLayout.LEADING, 0, 0));
if (nameArray.length > 1) { if (nameArray.length > 1) {
pane.add(tabPane); pane.add(tabPane);
tabPane.setBorder(BorderFactory.createEmptyBorder(0,5,0,0)); tabPane.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0));
this.add(pane, BorderLayout.NORTH); this.add(pane, BorderLayout.NORTH);
} }
} }
centerPane.setBorder(BorderFactory.createEmptyBorder(10,0,0,0)); centerPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
this.add(centerPane, BorderLayout.CENTER); this.add(centerPane, BorderLayout.CENTER);
} }
/** /**
* 界面 使用标题 * 界面 使用标题
* @return 标题 *
* @return 标题
*/ */
public String title4PopupWindow() { public String title4PopupWindow() {
return PaneTitleConstants.CHART_STYLE_AREA_TITLE; return PaneTitleConstants.CHART_STYLE_AREA_TITLE;
@ -66,7 +67,7 @@ public class VanChartAreaPane extends ThirdTabPane<VanChart> implements AutoSele
paneList.add(new NamePane(areaPane.title4PopupWindow(), areaPane)); paneList.add(new NamePane(areaPane.title4PopupWindow(), areaPane));
if(plot.isSupportPlotBackground()) { if (plot.isSupportPlotBackground()) {
paneList.add(new NamePane(plotPane.title4PopupWindow(), plotPane)); paneList.add(new NamePane(plotPane.title4PopupWindow(), plotPane));
} }
return paneList; return paneList;
@ -111,4 +112,10 @@ public class VanChartAreaPane extends ThirdTabPane<VanChart> implements AutoSele
} }
} }
} }
public void refreshTooltipLabel(boolean inForm) {
if (areaPane != null) {
areaPane.refreshTooltipLabel(inForm);
}
}
} }

2
designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/other/VanChartDrillMapInteractivePane.java

@ -42,7 +42,7 @@ public class VanChartDrillMapInteractivePane extends VanChartInteractivePaneWith
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{createToolBarPane(new double[]{p, p, p}, columnSize), null}, new Component[]{createToolBarPane(new double[]{p, p, p}, columnSize), null},
new Component[]{createAnimationPane(), null}, new Component[]{createAnimationPane(), null},
new Component[]{createZoomPane(new double[]{p, p, p}, columnSize, plot), null}, new Component[]{createZoomPane(plot), null},
new Component[]{createDrillToolsPane(), null}, new Component[]{createDrillToolsPane(), null},
new Component[]{createAutoRefreshPane(plot), null}, new Component[]{createAutoRefreshPane(plot), null},
new Component[]{createHyperlinkPane(), null} new Component[]{createHyperlinkPane(), null}

1
designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/SeriesTypeUseComboxPaneWithOutFilter.java

@ -26,6 +26,7 @@ public class SeriesTypeUseComboxPaneWithOutFilter extends SeriesTypeUseComboxPan
protected void initComponents() { protected void initComponents() {
super.initComponents(); super.initComponents();
this.setSelectedIndex(1); this.setSelectedIndex(1);
this.checkCardPane();
} }
@Override @Override

45
designer-chart/src/main/java/com/fr/van/chart/map/designer/style/label/VanChartMapLabelContentPane.java

@ -1,6 +1,9 @@
package com.fr.van.chart.map.designer.style.label; package com.fr.van.chart.map.designer.style.label;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
import com.fr.design.ui.ModernUIPane; import com.fr.design.ui.ModernUIPane;
import com.fr.plugin.chart.base.AttrTooltipContent; import com.fr.plugin.chart.base.AttrTooltipContent;
import com.fr.plugin.chart.base.format.AttrTooltipAreaNameFormat; import com.fr.plugin.chart.base.format.AttrTooltipAreaNameFormat;
@ -10,6 +13,7 @@ import com.fr.plugin.chart.base.format.AttrTooltipPercentFormat;
import com.fr.plugin.chart.base.format.AttrTooltipSeriesFormat; import com.fr.plugin.chart.base.format.AttrTooltipSeriesFormat;
import com.fr.plugin.chart.base.format.AttrTooltipValueFormat; import com.fr.plugin.chart.base.format.AttrTooltipValueFormat;
import com.fr.plugin.chart.type.TextAlign; import com.fr.plugin.chart.type.TextAlign;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.component.VanChartLabelContentPane; import com.fr.van.chart.designer.component.VanChartLabelContentPane;
import com.fr.van.chart.designer.component.format.MapAreaNameFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.MapAreaNameFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.PercentFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.PercentFormatPaneWithCheckBox;
@ -23,12 +27,17 @@ import com.fr.van.chart.designer.style.VanChartStylePane;
import com.fr.van.chart.map.designer.style.VanChartMapRichTextFieldListPane; import com.fr.van.chart.map.designer.style.VanChartMapRichTextFieldListPane;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Component;
/** /**
* Created by Mitisky on 16/5/20. * Created by Mitisky on 16/5/20.
*/ */
public class VanChartMapLabelContentPane extends VanChartLabelContentPane { public class VanChartMapLabelContentPane extends VanChartLabelContentPane {
private UICheckBox showAllSeries;
private JPanel checkPane;
public VanChartMapLabelContentPane(VanChartStylePane parent, JPanel showOnPane, boolean inCondition) { public VanChartMapLabelContentPane(VanChartStylePane parent, JPanel showOnPane, boolean inCondition) {
super(parent, showOnPane, inCondition); super(parent, showOnPane, inCondition);
} }
@ -55,6 +64,31 @@ public class VanChartMapLabelContentPane extends VanChartLabelContentPane {
}; };
} }
protected JPanel getLabelContentPane(JPanel contentPane) {
showAllSeries = new UICheckBox(Toolkit.i18nText("Fine-Design_Chart_Show_All_Series"));
double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
double[] columnSize = {f, e};
double p = TableLayout.PREFERRED;
double[] row = {p, p};
Component[][] components = {
new Component[]{null, null},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Display_Strategy")), showAllSeries}
};
checkPane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, columnSize);
JPanel panel = new JPanel(new BorderLayout());
panel.add(contentPane, BorderLayout.CENTER);
panel.add(checkPane, BorderLayout.SOUTH);
return createTableLayoutPaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Content"), panel);
}
protected void checkCardPane() {
super.checkCardPane();
checkPane.setVisible(getContent().getSelectedIndex() == COMMON_INDEX);
}
protected String[] getRichTextFieldNames() { protected String[] getRichTextFieldNames() {
return new String[]{ return new String[]{
Toolkit.i18nText("Fine-Design_Chart_Area_Name"), Toolkit.i18nText("Fine-Design_Chart_Area_Name"),
@ -82,4 +116,15 @@ public class VanChartMapLabelContentPane extends VanChartLabelContentPane {
content.setRichTextValueFormat(new AttrTooltipMapValueFormat()); content.setRichTextValueFormat(new AttrTooltipMapValueFormat());
return content; return content;
} }
public AttrTooltipContent updateBean() {
AttrTooltipContent attrTooltipContent = super.updateBean();
attrTooltipContent.setShowAllSeries(showAllSeries.isSelected());
return attrTooltipContent;
}
public void populateBean(AttrTooltipContent attrTooltipContent) {
super.populateBean(attrTooltipContent);
showAllSeries.setSelected(attrTooltipContent.isShowAllSeries());
}
} }

16
designer-chart/src/main/java/com/fr/van/chart/pie/RadiusCardLayoutPane.java

@ -42,7 +42,7 @@ public class RadiusCardLayoutPane extends BasicBeanPane<Plot> {
Map<String, Component> paneList = new HashMap<String, Component>(); Map<String, Component> paneList = new HashMap<String, Component>();
radiusType = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Auto"), Toolkit.i18nText("Fine-Design_Chart_Fixed")}); radiusType = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Auto"), Toolkit.i18nText("Fine-Design_Chart_Fixed")});
radius = new UISpinnerWithPx(100); radius = new UISpinnerWithPx(1, Double.MAX_VALUE, 1, 100);
radiusContent = new JPanel(new BorderLayout()); radiusContent = new JPanel(new BorderLayout());
radiusContent.add(radius, BorderLayout.CENTER); radiusContent.add(radius, BorderLayout.CENTER);
@ -55,12 +55,12 @@ public class RadiusCardLayoutPane extends BasicBeanPane<Plot> {
radiusType.setSelectedIndex(0); radiusType.setSelectedIndex(0);
cardPane = new VanChartCardLayoutPane(paneList, "auto"){ cardPane = new VanChartCardLayoutPane(paneList, "auto") {
@Override @Override
public Dimension getPreferredSize() { public Dimension getPreferredSize() {
if (radiusType.getSelectedIndex() == 1) { if (radiusType.getSelectedIndex() == 1) {
return radiusContent.getPreferredSize(); return radiusContent.getPreferredSize();
}else { } else {
return new Dimension(0, 0); return new Dimension(0, 0);
} }
} }
@ -69,15 +69,15 @@ public class RadiusCardLayoutPane extends BasicBeanPane<Plot> {
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;
double[] columnSize = {p, f}; double[] columnSize = {p, f};
double[] rowSize = {p,p}; double[] rowSize = {p, p};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{radiusType,null}, new Component[]{radiusType, null},
new Component[]{cardPane, null}, new Component[]{cardPane, null},
}; };
JPanel panel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); JPanel panel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
this.setLayout(new BorderLayout(0,0)); this.setLayout(new BorderLayout(0, 0));
this.add(panel, BorderLayout.CENTER); this.add(panel, BorderLayout.CENTER);
@ -90,7 +90,7 @@ public class RadiusCardLayoutPane extends BasicBeanPane<Plot> {
@Override @Override
public void populateBean(Plot plot) { public void populateBean(Plot plot) {
if (plot instanceof VanChartRadiusPlot){ if (plot instanceof VanChartRadiusPlot) {
VanChartRadiusPlot radiusPlot = (VanChartRadiusPlot) plot; VanChartRadiusPlot radiusPlot = (VanChartRadiusPlot) plot;
VanChartRadius vanChartRadius = radiusPlot.getRadius(); VanChartRadius vanChartRadius = radiusPlot.getRadius();
radiusType.setSelectedIndex(vanChartRadius.getRadiusType() == RadiusType.AUTO ? 0 : 1); radiusType.setSelectedIndex(vanChartRadius.getRadiusType() == RadiusType.AUTO ? 0 : 1);
@ -102,7 +102,7 @@ public class RadiusCardLayoutPane extends BasicBeanPane<Plot> {
public void updateBean(Plot plot) { public void updateBean(Plot plot) {
//更新半径 //更新半径
if (plot instanceof VanChartRadiusPlot){ if (plot instanceof VanChartRadiusPlot) {
VanChartRadiusPlot radiusPlot = (VanChartRadiusPlot) plot; VanChartRadiusPlot radiusPlot = (VanChartRadiusPlot) plot;
VanChartRadius vanChartRadius = radiusPlot.getRadius(); VanChartRadius vanChartRadius = radiusPlot.getRadius();
vanChartRadius.setRadiusType(radiusType.getSelectedIndex() == 0 ? RadiusType.AUTO : RadiusType.FIXED); vanChartRadius.setRadiusType(radiusType.getSelectedIndex() == 0 ? RadiusType.AUTO : RadiusType.FIXED);

2
designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapter.java

@ -72,7 +72,7 @@ public class FRAbsoluteLayoutAdapter extends FRBodyLayoutAdapter {
} }
XLayoutContainer topLayout = XCreatorUtils.getHotspotContainer((XCreator)comp).getTopLayout(); XLayoutContainer topLayout = XCreatorUtils.getHotspotContainer((XCreator)comp).getTopLayout();
if(topLayout != null){ if(topLayout != null){
if (topLayout.isEditable()){ if (topLayout.isDragInAble() || topLayout.isEditable()){
return topLayoutAccept(creator, x, y); return topLayoutAccept(creator, x, y);
} }
//绝对布局嵌套,处于内层,不可编辑,不添加,topLayout只能获取到最外层可编辑的布局 //绝对布局嵌套,处于内层,不可编辑,不添加,topLayout只能获取到最外层可编辑的布局

7
designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java

@ -19,12 +19,7 @@ import com.fr.design.designer.creator.cardlayout.XWCardTitleLayout;
import com.fr.design.designer.creator.cardlayout.XWTabFitLayout; import com.fr.design.designer.creator.cardlayout.XWTabFitLayout;
import com.fr.design.designer.properties.FRFitLayoutConstraints; import com.fr.design.designer.properties.FRFitLayoutConstraints;
import com.fr.design.designer.properties.FRFitLayoutPropertiesGroupModel; import com.fr.design.designer.properties.FRFitLayoutPropertiesGroupModel;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.fun.FormWidgetOptionProvider; import com.fr.design.fun.FormWidgetOptionProvider;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.JForm;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.design.utils.ComponentUtils; import com.fr.design.utils.ComponentUtils;
import com.fr.form.ui.LayoutBorderStyle; import com.fr.form.ui.LayoutBorderStyle;
import com.fr.form.ui.container.WAbsoluteLayout; import com.fr.form.ui.container.WAbsoluteLayout;
@ -169,7 +164,7 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter {
//布局控件要先判断是不是可编辑 //布局控件要先判断是不是可编辑
XLayoutContainer topLayout = XCreatorUtils.getHotspotContainer((XCreator) comp).getTopLayout(); XLayoutContainer topLayout = XCreatorUtils.getHotspotContainer((XCreator) comp).getTopLayout();
boolean access = topLayout != null && !isMatchEdge && !topLayout.isEditable() && !topLayout.acceptType(XWAbsoluteLayout.class) && !isExtraContainer(comp); boolean access = topLayout != null && !isMatchEdge && !topLayout.isEditable() && !topLayout.acceptType(XWAbsoluteLayout.class) && !isExtraContainer(comp) && !topLayout.isDragInAble();
if (access) { if (access) {
return false; return false;
} }

17
designer-form/src/main/java/com/fr/design/designer/beans/events/DesignerEditor.java

@ -1,5 +1,6 @@
package com.fr.design.designer.beans.events; package com.fr.design.designer.beans.events;
import com.fr.form.ui.PaddingMargin;
import com.fr.stable.core.PropertyChangeAdapter; import com.fr.stable.core.PropertyChangeAdapter;
import com.fr.stable.core.PropertyChangeListener; import com.fr.stable.core.PropertyChangeListener;
import com.fr.design.utils.gui.LayoutUtils; import com.fr.design.utils.gui.LayoutUtils;
@ -76,6 +77,22 @@ public class DesignerEditor<T extends JComponent> implements PropertyChangeListe
} }
} }
public void paintEditor(Graphics g, Dimension size, PaddingMargin margin) {
if (this.comp != null) {
int marginLeft = margin != null ? margin.getLeft() : 0;
int marginTop = margin != null ? margin.getTop() : 0;
int marginRight = margin != null ? margin.getRight() : 0;
int marginBottom = margin != null ? margin.getBottom() : 0;
int horizonMargin = marginLeft + marginRight;
int verticalMargin = marginTop + marginBottom;
comp.setSize(new Dimension(size.width - 2 - horizonMargin, size.height - 2 - verticalMargin));
LayoutUtils.layoutContainer(comp);
Graphics clipg = g.create(1 + marginLeft, 1 + marginTop, size.width, size.height);
this.comp.paint(clipg);
}
}
public T getEditorTarget() { public T getEditorTarget() {
return comp; return comp;
} }

29
designer-form/src/main/java/com/fr/design/designer/beans/location/AccessDirection.java

@ -5,13 +5,17 @@ package com.fr.design.designer.beans.location;
import com.fr.design.beans.location.Absorptionline; import com.fr.design.beans.location.Absorptionline;
import com.fr.design.beans.location.MoveUtils; import com.fr.design.beans.location.MoveUtils;
import com.fr.design.designer.creator.*; import com.fr.design.designer.creator.XCreatorUtils;
import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWAbsoluteLayout;
import com.fr.design.designer.creator.XWBorderLayout;
import com.fr.design.designer.creator.XWParameterLayout;
import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.FormSelection; import com.fr.design.mainframe.FormSelection;
import com.fr.design.utils.ComponentUtils; import com.fr.design.utils.ComponentUtils;
import com.fr.env.utils.DesignerInteractionHistory;
import com.fr.form.ui.container.WAbsoluteLayout; import com.fr.form.ui.container.WAbsoluteLayout;
import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget; import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget;
import com.fr.form.ui.container.WParameterLayout;
import java.awt.*; import java.awt.*;
@ -193,8 +197,29 @@ public abstract class AccessDirection implements Direction {
if (type != formEditor.getCursor().getType()) { if (type != formEditor.getCursor().getType()) {
// 设置当前形状 // 设置当前形状
formEditor.setCursor(Cursor.getPredefinedCursor(type)); formEditor.setCursor(Cursor.getPredefinedCursor(type));
// 显示/改变Tooltip
showTooltip(formEditor);
} }
} }
private void showTooltip(FormDesigner formEditor) {
// 显示拖拽改变组件尺寸相关的提示信息
int cursorType = formEditor.getCursor().getType();
if (Cursor.SW_RESIZE_CURSOR <= cursorType && cursorType <= Cursor.E_RESIZE_CURSOR) {
FormSelection selection = formEditor.getSelectionModel().getSelection();
boolean canLockAspectRatioOnlyByShift = !selection.isCreatorAspectRatioLockedInAbsLayout(formEditor) && selection.isCreatorInAbsLayout(formEditor);
DesignerInteractionHistory history = DesignerInteractionHistory.getInstance();
if (canLockAspectRatioOnlyByShift && !history.isHasShownShiftDragResizingTooltip()) {
formEditor.setToolTipText(getTooltip());
history.setHasShownShiftDragResizingTooltip(true);
}
}
}
public String getTooltip() {
return null;
}
/** /**
* 生成组件备用的bound * 生成组件备用的bound

11
designer-form/src/main/java/com/fr/design/designer/beans/location/Bottom.java

@ -15,6 +15,12 @@ public class Bottom extends AccessDirection {
Rectangle oldbounds) { Rectangle oldbounds) {
current_bounds.height = sorption(0, oldbounds.height + dy + oldbounds.y, current_bounds, designer)[1] current_bounds.height = sorption(0, oldbounds.height + dy + oldbounds.y, current_bounds, designer)[1]
- oldbounds.y; - oldbounds.y;
if (designer.getStateModel().isAspectRatioLocked()) {
Rectangle backupBounds = designer.getSelectionModel().getSelection().getBackupBounds();
current_bounds.width = (int) (backupBounds.width * current_bounds.height / backupBounds.height * 1.0);
}
return current_bounds; return current_bounds;
} }
@ -23,6 +29,11 @@ public class Bottom extends AccessDirection {
return Cursor.S_RESIZE_CURSOR; return Cursor.S_RESIZE_CURSOR;
} }
@Override
public String getTooltip() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Lock_Aspect_Ratio_Mouse_ToolTip");
}
@Override @Override
public int getActual() { public int getActual() {
return Direction.BOTTOM; return Direction.BOTTOM;

11
designer-form/src/main/java/com/fr/design/designer/beans/location/Left.java

@ -15,6 +15,12 @@ public class Left extends AccessDirection {
Rectangle oldbounds) { Rectangle oldbounds) {
current_bounds.x = sorption(oldbounds.x + dx, 0, current_bounds, designer)[0]; current_bounds.x = sorption(oldbounds.x + dx, 0, current_bounds, designer)[0];
current_bounds.width = oldbounds.width - current_bounds.x + oldbounds.x; current_bounds.width = oldbounds.width - current_bounds.x + oldbounds.x;
if (designer.getStateModel().isAspectRatioLocked()) {
Rectangle backupBounds = designer.getSelectionModel().getSelection().getBackupBounds();
current_bounds.height = (int) (backupBounds.height * current_bounds.width / backupBounds.width * 1.0);
}
return current_bounds; return current_bounds;
} }
@ -23,6 +29,11 @@ public class Left extends AccessDirection {
return Cursor.W_RESIZE_CURSOR; return Cursor.W_RESIZE_CURSOR;
} }
@Override
public String getTooltip() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Lock_Aspect_Ratio_Mouse_ToolTip");
}
@Override @Override
public int getActual() { public int getActual() {
return Direction.LEFT; return Direction.LEFT;

20
designer-form/src/main/java/com/fr/design/designer/beans/location/LeftBottom.java

@ -17,6 +17,21 @@ public class LeftBottom extends AccessDirection {
current_bounds.x = xy[0]; current_bounds.x = xy[0];
current_bounds.width = oldbounds.width - current_bounds.x + oldbounds.x; current_bounds.width = oldbounds.width - current_bounds.x + oldbounds.x;
current_bounds.height = xy[1] - oldbounds.y; current_bounds.height = xy[1] - oldbounds.y;
if (designer.getStateModel().isAspectRatioLocked()) {
Rectangle backupBounds = designer.getSelectionModel().getSelection().getBackupBounds();
double current_diagonal = Math.pow(current_bounds.width, 2) + Math.pow(current_bounds.height, 2);
double backup_diagonal = Math.pow(backupBounds.width, 2) + Math.pow(backupBounds.height, 2);
int width = (int) (Math.sqrt((current_diagonal / backup_diagonal) * (Math.pow(backupBounds.width, 2))));
int height = (int) (Math.sqrt((current_diagonal / backup_diagonal) * (Math.pow(backupBounds.height, 2))));
int currentRight = current_bounds.x + current_bounds.width;
current_bounds.width = width;
current_bounds.height = height;
current_bounds.x = currentRight - width;
}
return current_bounds; return current_bounds;
} }
@ -25,6 +40,11 @@ public class LeftBottom extends AccessDirection {
return Cursor.SW_RESIZE_CURSOR; return Cursor.SW_RESIZE_CURSOR;
} }
@Override
public String getTooltip() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Lock_Aspect_Ratio_Mouse_ToolTip");
}
@Override @Override
public int getActual() { public int getActual() {
return Direction.LEFT_BOTTOM; return Direction.LEFT_BOTTOM;

23
designer-form/src/main/java/com/fr/design/designer/beans/location/LeftTop.java

@ -6,6 +6,7 @@ import java.awt.Rectangle;
import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormDesigner;
public class LeftTop extends AccessDirection { public class LeftTop extends AccessDirection {
public LeftTop() { public LeftTop() {
} }
@ -17,6 +18,23 @@ public class LeftTop extends AccessDirection {
current_bounds.y = xy[1]; current_bounds.y = xy[1];
current_bounds.width = oldbounds.width - current_bounds.x + oldbounds.x; current_bounds.width = oldbounds.width - current_bounds.x + oldbounds.x;
current_bounds.height = oldbounds.height - current_bounds.y + oldbounds.y; current_bounds.height = oldbounds.height - current_bounds.y + oldbounds.y;
if (designer.getStateModel().isAspectRatioLocked()) {
Rectangle backupBounds = designer.getSelectionModel().getSelection().getBackupBounds();
double current_diagonal = Math.pow(current_bounds.width, 2) + Math.pow(current_bounds.height, 2);
double backup_diagonal = Math.pow(backupBounds.width, 2) + Math.pow(backupBounds.height, 2);
int width = (int) (Math.sqrt((current_diagonal / backup_diagonal) * (Math.pow(backupBounds.width, 2))));
int height = (int) (Math.sqrt((current_diagonal / backup_diagonal) * (Math.pow(backupBounds.height, 2))));
int currentRight = current_bounds.x + current_bounds.width;
int currentBottom = current_bounds.y + current_bounds.height;
current_bounds.width = width;
current_bounds.height = height;
current_bounds.x = currentRight - width;
current_bounds.y = currentBottom - height;
}
return current_bounds; return current_bounds;
} }
@ -25,6 +43,11 @@ public class LeftTop extends AccessDirection {
return Cursor.NW_RESIZE_CURSOR; return Cursor.NW_RESIZE_CURSOR;
} }
@Override
public String getTooltip() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Lock_Aspect_Ratio_Mouse_ToolTip");
}
@Override @Override
public int getActual() { public int getActual() {
return Direction.LEFT_TOP; return Direction.LEFT_TOP;

13
designer-form/src/main/java/com/fr/design/designer/beans/location/Right.java

@ -3,7 +3,9 @@ package com.fr.design.designer.beans.location;
import java.awt.Cursor; import java.awt.Cursor;
import java.awt.Rectangle; import java.awt.Rectangle;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormDesigner;
import com.fr.form.ui.Widget;
public class Right extends AccessDirection { public class Right extends AccessDirection {
@ -15,6 +17,12 @@ public class Right extends AccessDirection {
Rectangle oldbounds) { Rectangle oldbounds) {
current_bounds.width = sorption(oldbounds.x + dx + oldbounds.width, 0, current_bounds, designer)[0] current_bounds.width = sorption(oldbounds.x + dx + oldbounds.width, 0, current_bounds, designer)[0]
- oldbounds.x; - oldbounds.x;
if (designer.getStateModel().isAspectRatioLocked()) {
Rectangle backupBounds = designer.getSelectionModel().getSelection().getBackupBounds();
current_bounds.height = (int) (backupBounds.height * current_bounds.width / backupBounds.width * 1.0);
}
return current_bounds; return current_bounds;
} }
@ -23,6 +31,11 @@ public class Right extends AccessDirection {
return Cursor.E_RESIZE_CURSOR; return Cursor.E_RESIZE_CURSOR;
} }
@Override
public String getTooltip() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Lock_Aspect_Ratio_Mouse_ToolTip");
}
@Override @Override
public int getActual() { public int getActual() {
return Direction.RIGHT; return Direction.RIGHT;

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save