Browse Source

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

release/10.0
lucian 3 years ago
parent
commit
3e25450132
  1. 2
      build.gradle
  2. 8
      designer-base/src/main/java/com/fr/design/DesignerEnvManager.java
  3. 2
      designer-base/src/main/java/com/fr/design/actions/community/BugAction.java
  4. 2
      designer-base/src/main/java/com/fr/design/actions/community/NeedAction.java
  5. 17
      designer-base/src/main/java/com/fr/design/actions/community/StudyPlanAction.java
  6. 3
      designer-base/src/main/java/com/fr/design/actions/help/AboutPane.java
  7. 4
      designer-base/src/main/java/com/fr/design/actions/help/TutorialAction.java
  8. 5
      designer-base/src/main/java/com/fr/design/constants/TableDataConstants.java
  9. 7
      designer-base/src/main/java/com/fr/design/data/BasicTableDataUtils.java
  10. 18
      designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java
  11. 4
      designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java
  12. 51
      designer-base/src/main/java/com/fr/design/data/datapane/preview/CopyableJTable.java
  13. 2
      designer-base/src/main/java/com/fr/design/dialog/UIDetailErrorLinkDialog.java
  14. 47
      designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java
  15. 2
      designer-base/src/main/java/com/fr/design/fun/TextFieldAdapterProvider.java
  16. 4
      designer-base/src/main/java/com/fr/design/gui/controlpane/UIListGroupControlPane.java
  17. 5
      designer-base/src/main/java/com/fr/design/gui/ibutton/UIButtonGroup.java
  18. 2
      designer-base/src/main/java/com/fr/design/gui/ifilechooser/JavaFxNativeFileChooser.java
  19. 2
      designer-base/src/main/java/com/fr/design/login/DesignerLoginHelper.java
  20. 14
      designer-base/src/main/java/com/fr/design/login/config/DesignerLoginConfigManager.java
  21. 16
      designer-base/src/main/java/com/fr/design/login/guide/DesignerGuideHelper.java
  22. 18
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java
  23. 21
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  24. 5
      designer-base/src/main/java/com/fr/design/mainframe/JTemplateFactory.java
  25. 78
      designer-base/src/main/java/com/fr/design/mainframe/NorthRegionContainerPane.java
  26. 5
      designer-base/src/main/java/com/fr/design/mainframe/check/CheckFontInfoDialog.java
  27. 17
      designer-base/src/main/java/com/fr/design/mainframe/share/collect/ComponentCollector.java
  28. 2
      designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java
  29. 4
      designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/AbstractTemplateStylePane.java
  30. 5
      designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessibleTemplateStyleEditor.java
  31. 7
      designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/MobileTemplateStylePane.java
  32. 5
      designer-base/src/main/java/com/fr/design/notification/ui/NotificationCenterDialog.java
  33. 45
      designer-base/src/main/java/com/fr/design/report/fit/BaseFitAttrPane.java
  34. 28
      designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java
  35. 61
      designer-base/src/main/java/com/fr/design/style/AbstractSelectBox.java
  36. 14
      designer-base/src/main/java/com/fr/design/utils/gui/AdjustWorkBookDefaultStyleUtils.java
  37. 16
      designer-base/src/main/java/com/fr/design/versioncheck/VersionCheckUtils.java
  38. 6
      designer-base/src/main/java/com/fr/design/widget/WidgetBoundsPaneFactory.java
  39. 22
      designer-base/src/main/java/com/fr/design/widget/component/NumberEditorValidatePane.java
  40. 3
      designer-base/src/main/java/com/fr/design/worker/open/OpenWorker.java
  41. 7
      designer-base/src/main/java/com/fr/env/HelpLink.java
  42. 17
      designer-base/src/main/java/com/fr/file/StashedFILE.java
  43. 8
      designer-base/src/main/resources/com/fr/design/i18n/dimension_en.properties
  44. 8
      designer-base/src/main/resources/com/fr/design/i18n/dimension_ja_JP.properties
  45. 10
      designer-base/src/main/resources/com/fr/design/i18n/dimension_ko_KR.properties
  46. 8
      designer-base/src/main/resources/com/fr/design/i18n/dimension_zh.properties
  47. 8
      designer-base/src/main/resources/com/fr/design/i18n/dimension_zh_TW.properties
  48. BIN
      designer-base/src/main/resources/com/fr/design/images/bbs/studyPlan.png
  49. 1
      designer-base/src/main/resources/com/fr/design/images/bbs/studyPlan_normal.svg
  50. 15
      designer-chart/src/main/java/com/fr/design/mainframe/ChartPropertyPane.java
  51. 7
      designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartEditPane.java
  52. 8
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPane.java
  53. 13
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPaneWithAuto.java
  54. 12
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/UIColorPickerPane.java
  55. 85
      designer-chart/src/main/java/com/fr/van/chart/config/DefaultStyleConstants.java
  56. 207
      designer-chart/src/main/java/com/fr/van/chart/config/DefaultStyleHelper4Van.java
  57. 3
      designer-chart/src/main/java/com/fr/van/chart/custom/component/VanChartCustomPlotSelectPane.java
  58. 7
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartHtmlLabelPane.java
  59. 4
      designer-chart/src/main/java/com/fr/van/chart/designer/component/marker/VanChartImageMarkerPane.java
  60. 7
      designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartAxisPane.java
  61. 9
      designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartAxisScrollPaneWithTypeSelect.java
  62. 4
      designer-chart/src/main/java/com/fr/van/chart/designer/style/background/ChartNameObjectCreator.java
  63. 43
      designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRCardMainBorderLayoutAdapter.java
  64. 9
      designer-form/src/main/java/com/fr/design/designer/beans/models/AddingModel.java
  65. 5
      designer-form/src/main/java/com/fr/design/designer/creator/XChartEditor.java
  66. 11
      designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java
  67. 45
      designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java
  68. 5
      designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java
  69. 5
      designer-form/src/main/java/com/fr/design/designer/creator/XLayoutContainer.java
  70. 18
      designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardLayout.java
  71. 47
      designer-form/src/main/java/com/fr/design/designer/ui/PopupDialogContext.java
  72. 17
      designer-form/src/main/java/com/fr/design/designer/ui/SelectedPopupDialog.java
  73. 27
      designer-form/src/main/java/com/fr/design/gui/xpane/BorderLineAndImagePane.java
  74. 18
      designer-form/src/main/java/com/fr/design/gui/xpane/CardTagLayoutStylePane.java
  75. 33
      designer-form/src/main/java/com/fr/design/mainframe/ArrangementType.java
  76. 38
      designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java
  77. 11
      designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java
  78. 3
      designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java
  79. 5
      designer-form/src/main/java/com/fr/design/mainframe/JForm.java
  80. 81
      designer-form/src/main/java/com/fr/design/mainframe/MultiSelectionArrangement.java
  81. 15
      designer-form/src/main/java/com/fr/design/mainframe/share/action/CreateComponentAction.java
  82. 73
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/LocalWidgetBlock.java
  83. 14
      designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/AbstractMultiSelectionArrangementButton.java
  84. 15
      designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/BottomAlignButton.java
  85. 15
      designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/HorizontalCenterButton.java
  86. 15
      designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/HorizontalDistributionButton.java
  87. 15
      designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/LeftAlignButton.java
  88. 4
      designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/MultiSelectionArrangementButton.java
  89. 15
      designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/RightAlignButton.java
  90. 15
      designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/TopAlignButton.java
  91. 13
      designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/VerticalCenterButton.java
  92. 13
      designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/VerticalDistributionButton.java
  93. 5
      designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormMultiWidgetCardPane.java
  94. 18
      designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormSingleWidgetCardPane.java
  95. 2
      designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetAbsoluteBoundPane.java
  96. 25
      designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java
  97. 3
      designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ParaMobileDefinePane.java
  98. 3
      designer-realize/src/main/java/com/fr/design/actions/server/ServerConfigManagerAction.java
  99. 3
      designer-realize/src/main/java/com/fr/design/mainframe/app/CptApp.java
  100. 16
      designer-realize/src/main/java/com/fr/design/mainframe/app/FormApp.java
  101. Some files were not shown because too many files have changed in this diff Show More

2
build.gradle

@ -68,7 +68,7 @@ allprojects {
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'
implementation 'net.java.dev.jna:jna:5.4.0' implementation 'net.java.dev.jna:jna:5.4.0'
implementation 'org.apache.tomcat:tomcat-catalina:8.5.69' implementation 'org.apache.tomcat:tomcat-catalina:8.5.72'
implementation 'io.socket:socket.io-client:0.7.0' implementation 'io.socket:socket.io-client:0.7.0'
implementation 'com.fr.third:fine-third:' + frVersion implementation 'com.fr.third:fine-third:' + frVersion
implementation 'com.fr.core:fine-core:' + frDevVersion implementation 'com.fr.core:fine-core:' + frDevVersion

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

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

2
designer-base/src/main/java/com/fr/design/actions/community/BugAction.java

@ -17,7 +17,7 @@ public class BugAction extends AbstractDesignerSSO {
@Override @Override
public String getJumpUrl() { public String getJumpUrl() {
return CloudCenter.getInstance().acquireUrlByKind("bbs.bugs", "http://bbs.fanruan.com/forum-156-1.html"); return CloudCenter.getInstance().acquireUrlByKind("bbs.bugs", "https://service.fanruan.com/PF/FR/feedback?type=2");
} }
public static final MenuKeySet BUG = new MenuKeySet() { public static final MenuKeySet BUG = new MenuKeySet() {

2
designer-base/src/main/java/com/fr/design/actions/community/NeedAction.java

@ -18,7 +18,7 @@ public class NeedAction extends AbstractDesignerSSO {
@Override @Override
public String getJumpUrl() { public String getJumpUrl() {
return CloudCenter.getInstance().acquireUrlByKind("bbs.needs", "http://bbs.fanruan.com/forum-56-1.html"); return CloudCenter.getInstance().acquireUrlByKind("bbs.needs", "https://service.fanruan.com/PF/FR/feedback?type=1");
} }
public static final MenuKeySet NEED = new MenuKeySet() { public static final MenuKeySet NEED = new MenuKeySet() {

17
designer-base/src/main/java/com/fr/design/actions/community/StudyPlanAction.java

@ -0,0 +1,17 @@
package com.fr.design.actions.community;
import com.fr.design.i18n.Toolkit;
import com.fr.design.login.AbstractDesignerSSO;
import com.fr.general.CloudCenter;
public class StudyPlanAction extends AbstractDesignerSSO {
public StudyPlanAction() {
this.setName(Toolkit.i18nText("Fine-Design_Study_Plan"));
this.setSmallIcon("/com/fr/design/images/bbs/studyPlan");
}
@Override
public String getJumpUrl() {
return CloudCenter.getInstance().acquireUrlByKind("bbs.studyPlan", "https://edu.fanruan.com/studypath/finereport");
}
}

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

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

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

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

5
designer-base/src/main/java/com/fr/design/constants/TableDataConstants.java

@ -0,0 +1,5 @@
package com.fr.design.constants;
public class TableDataConstants {
public static final String SEPARATOR = "_";
}

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

@ -1,6 +1,7 @@
package com.fr.design.data; package com.fr.design.data;
import com.fr.data.TableDataSource; import com.fr.data.TableDataSource;
import com.fr.design.constants.TableDataConstants;
import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -11,8 +12,6 @@ import com.fr.stable.StringUtils;
* Created by hades on 2020/4/27 * Created by hades on 2020/4/27
*/ */
public abstract class BasicTableDataUtils { public abstract class BasicTableDataUtils {
private static final String SEPARATOR = "-";
private static final int LEN = 2; private static final int LEN = 2;
@ -38,10 +37,10 @@ public abstract class BasicTableDataUtils {
public static String getTableDataName(boolean isCover, TableDataSource tds, String tdName, String srcName, boolean isDsNameRepeaded) { public static String getTableDataName(boolean isCover, TableDataSource tds, String tdName, String srcName, boolean isDsNameRepeaded) {
if (isCover) { if (isCover) {
return srcName + SEPARATOR + tdName; return srcName + TableDataConstants.SEPARATOR + tdName;
} }
if (tds.getTableData(tdName) != null || isDsNameRepeaded) {//如果有同名的就拼上来源名称 if (tds.getTableData(tdName) != null || isDsNameRepeaded) {//如果有同名的就拼上来源名称
tdName = srcName + SEPARATOR + tdName; tdName = srcName + TableDataConstants.SEPARATOR + tdName;
} }
int i = 0; int i = 0;
while (tds.getTableData(tdName) != null) { while (tds.getTableData(tdName) != null) {

18
designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java

@ -9,6 +9,7 @@ import com.fr.design.fun.ConnectionProvider;
import com.fr.design.gui.controlpane.JListControlPane; import com.fr.design.gui.controlpane.JListControlPane;
import com.fr.design.gui.controlpane.NameObjectCreator; import com.fr.design.gui.controlpane.NameObjectCreator;
import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.gui.ilist.ListModelElement;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.file.ConnectionConfig; import com.fr.file.ConnectionConfig;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
@ -18,13 +19,14 @@ import com.fr.stable.Nameable;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.core.PropertyChangeAdapter; import com.fr.stable.core.PropertyChangeAdapter;
import javax.swing.*; import javax.swing.SwingUtilities;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.UUID;
/** /**
* Connection List Pane. * Connection List Pane.
@ -159,4 +161,18 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh
connectionConfig.addConnection(nameObject.getName(), (Connection) nameObject.getObject()); connectionConfig.addConnection(nameObject.getName(), (Connection) nameObject.getObject());
} }
} }
@Override
public void onCopyItem() {
super.onCopyItem();
ListModelElement selectedValue = getSelectedValue();
// identity 需要重置
if (selectedValue != null && selectedValue.wrapper != null) {
Object temp = ((NameObject) selectedValue.wrapper).getObject();
if (temp instanceof JDBCDatabaseConnection) {
JDBCDatabaseConnection object = (JDBCDatabaseConnection) temp;
object.setIdentity(UUID.randomUUID().toString());
}
}
}
} }

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

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

51
designer-base/src/main/java/com/fr/design/data/datapane/preview/CopyableJTable.java

@ -106,6 +106,7 @@ public class CopyableJTable extends SortableJTable {
self.updateEndPoint(-1, column); self.updateEndPoint(-1, column);
self.refreshTable(); self.refreshTable();
} }
self.requestFocusInWindow();
} }
private int getColumn(MouseEvent e) { private int getColumn(MouseEvent e) {
@ -249,26 +250,9 @@ public class CopyableJTable extends SortableJTable {
FineLoggerFactory.getLogger().info("copy cell value"); FineLoggerFactory.getLogger().info("copy cell value");
java.util.List<java.util.List<Object>> table = new ArrayList<>(); java.util.List<java.util.List<Object>> table = new ArrayList<>();
if ((startRow != endRow || startCol != endCol) && Math.min(startCol, endCol) > -1) { if ((startRow != endRow || startCol != endCol) && Math.min(startCol, endCol) > -1) {
for (int i = Math.min(startRow, endRow); i <= Math.max(startRow, endRow); i++) { copyAreaData(table);
table.add(new ArrayList<>());
for (int j = Math.min(startCol, endCol); j <= Math.max(startCol, endCol); j++) {
Object text = this.getTableValue(i, j);
table.get(table.size() - 1).add(text);
}
}
} else if (pointList.size() > 0) { } else if (pointList.size() > 0) {
Collections.sort(pointList, Comparator.comparing(Point::getX).thenComparing(Point::getY)); copyPointsData(table);
int startRow = pointList.get(0).x;
int currentRow = startRow;
table.add(new ArrayList<>());
for (Point point : pointList) {
while (currentRow < point.x) {
table.add(new ArrayList<>());
currentRow++;
}
Object text = this.getTableValue(point.x, point.y);
table.get(table.size() - 1).add(text);
}
} }
Clipboard clip = Toolkit.getDefaultToolkit().getSystemClipboard(); Clipboard clip = Toolkit.getDefaultToolkit().getSystemClipboard();
@ -276,6 +260,35 @@ public class CopyableJTable extends SortableJTable {
clip.setContents(tText, null); clip.setContents(tText, null);
} }
private void copyAreaData(java.util.List<java.util.List<Object>> table) {
for (int i = Math.min(startRow, endRow); i <= Math.max(startRow, endRow); i++) {
table.add(new ArrayList<>());
for (int j = Math.min(startCol, endCol); j <= Math.max(startCol, endCol); j++) {
Object text = this.getTableValue(i, j);
if (text != null) {
table.get(table.size() - 1).add(text);
}
}
}
}
private void copyPointsData(java.util.List<java.util.List<Object>> table) {
Collections.sort(pointList, Comparator.comparing(Point::getX).thenComparing(Point::getY));
int startRow = pointList.get(0).x;
int currentRow = startRow;
table.add(new ArrayList<>());
for (Point point : pointList) {
while (currentRow < point.x) {
table.add(new ArrayList<>());
currentRow++;
}
Object text = this.getTableValue(point.x, point.y);
if (text != null) {
table.get(table.size() - 1).add(text);
}
}
}
private Object getTableValue(int row, int col) { private Object getTableValue(int row, int col) {
Object value = null; Object value = null;
if (col > -1) { if (col > -1) {

2
designer-base/src/main/java/com/fr/design/dialog/UIDetailErrorLinkDialog.java

@ -92,7 +92,7 @@ public class UIDetailErrorLinkDialog extends UIDialog {
contentPane.add(link, BorderLayout.SOUTH); contentPane.add(link, BorderLayout.SOUTH);
// 确定 + 取消 // 确定 + 取消
JPanel actionPane = new JPanel(new FlowLayout(FlowLayout.RIGHT, GAP_10, GAP_10)); JPanel actionPane = new JPanel(new FlowLayout(FlowLayout.RIGHT, GAP_10, GAP_5));
actionPane.add(createButton(Toolkit.i18nText("Fine-Design_Report_OK"))); actionPane.add(createButton(Toolkit.i18nText("Fine-Design_Report_OK")));
actionPane.add(createButton(Toolkit.i18nText("Fine-Design_Basic_Cancel"))); actionPane.add(createButton(Toolkit.i18nText("Fine-Design_Basic_Cancel")));
this.getContentPane().add(topPane, BorderLayout.NORTH); this.getContentPane().add(topPane, BorderLayout.NORTH);

47
designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java

@ -12,7 +12,6 @@ import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrameFileDealerPane; import com.fr.design.mainframe.DesignerFrameFileDealerPane;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.JVirtualTemplate; import com.fr.design.mainframe.JVirtualTemplate;
import com.fr.design.module.DesignModuleFactory;
import com.fr.design.ui.util.UIUtil; import com.fr.design.ui.util.UIUtil;
import com.fr.file.FILE; import com.fr.file.FILE;
import com.fr.file.FileNodeFILE; import com.fr.file.FileNodeFILE;
@ -361,22 +360,30 @@ public class HistoryTemplateListCache implements CallbackEvent {
int size = historyList.size(); int size = historyList.size();
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
JTemplate<?, ?> template = historyList.get(i); JTemplate<?, ?> template = historyList.get(i);
FILE file = template.getEditingFILE(); FILE file = templateToStashFile(template);
try { if (file != null) {
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); stashFILEMap.put(i, file);
BaseBook target = template.getTarget();
if (target != null) {
target.export(outputStream);
stashFILEMap.put(i, new StashedFILE(file, outputStream.toByteArray()));
}
// 如果 target == null 那么这个模板是被模板内存优化功能处理过的,不用处理
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
} }
FineLoggerFactory.getLogger().info("Env Change Template Stashed."); FineLoggerFactory.getLogger().info("Env Change Template Stashed.");
} }
private FILE templateToStashFile(JTemplate<?, ?> template) {
FILE file = template.getEditingFILE();
try {
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
BaseBook target = template.getTarget();
if (target != null) {
target.export(outputStream);
return new StashedFILE(file, outputStream.toByteArray(), template.suffix());
}
// 如果 target == null 那么这个模板是被模板内存优化功能处理过的,不用处理
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
return null;
}
private boolean checkStash() { private boolean checkStash() {
try { try {
return stashWorker.get(); return stashWorker.get();
@ -458,18 +465,10 @@ public class HistoryTemplateListCache implements CallbackEvent {
FILE file = template.getEditingFILE(); FILE file = template.getEditingFILE();
boolean needReload = context == null || needReloadTemplate(context, template); boolean needReload = context == null || needReloadTemplate(context, template);
if (needReload) { if (needReload) {
try { FILE stashFile = templateToStashFile(template);
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); if (stashFile != null) {
BaseBook target = template.getTarget(); FineLoggerFactory.getLogger().info("{} is being reloaded", file.getName());
if (target != null) { template.refreshResource(stashFile);
FineLoggerFactory.getLogger().info("{} is being reloaded", file.getName());
target.export(outputStream);
FILE stashedFile = new StashedFILE(file, outputStream.toByteArray());
template.refreshResource(stashedFile);
}
// 如果 target == null 那么这个模板是被模板内存优化功能处理过的,不用处理
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
} }
} }

2
designer-base/src/main/java/com/fr/design/fun/TextFieldAdapterProvider.java

@ -4,7 +4,7 @@ import com.fr.design.beans.ErrorMsgTextFieldAdapter;
import com.fr.stable.fun.mark.Immutable; import com.fr.stable.fun.mark.Immutable;
public interface TextFieldAdapterProvider extends Immutable { public interface TextFieldAdapterProvider extends Immutable {
String XML_TAG = "ErrorMesPaneWrapperProvider"; String XML_TAG = "TextFieldAdapterProvider";
int CURRENT_LEVEL = 1; int CURRENT_LEVEL = 1;
ErrorMsgTextFieldAdapter createTextFieldAdapter(); ErrorMsgTextFieldAdapter createTextFieldAdapter();

4
designer-base/src/main/java/com/fr/design/gui/controlpane/UIListGroupControlPane.java

@ -125,7 +125,9 @@ public abstract class UIListGroupControlPane extends UIControlPane implements Li
for (int i = 0, size = widget.getListenerSize(); i < size; i++) { for (int i = 0, size = widget.getListenerSize(); i < size; i++) {
Listener listener = widget.getListener(i); Listener listener = widget.getListener(i);
if (!listener.isDefault()) { if (!listener.isDefault()) {
nameObjectList.add(i, new NameObject(switchLang(listener.getEventName()) + (i + 1), listener)); String eventName = switchLang(listener.getEventName()) + (nameObjectList.size() + 1);
NameObject nameObject = new NameObject(eventName, listener);
nameObjectList.add(nameObject);
} }
} }
populate(getHelper().processCatalog(nameObjectList)); populate(getHelper().processCatalog(nameObjectList));

5
designer-base/src/main/java/com/fr/design/gui/ibutton/UIButtonGroup.java

@ -379,7 +379,10 @@ public class UIButtonGroup<T> extends JPanel implements GlobalNameObserver {
* @param l * @param l
*/ */
public void removeChangeListener(ChangeListener l) { public void removeChangeListener(ChangeListener l) {
this.listenerList.remove(ChangeListener.class, l); for (int i = 0; i < labelButtonList.size(); i++) {
labelButtonList.get(i).removeChangeListener(l);
listenerList.remove(ChangeListener.class, l);
}
} }

2
designer-base/src/main/java/com/fr/design/gui/ifilechooser/JavaFxNativeFileChooser.java

@ -163,6 +163,8 @@ public class JavaFxNativeFileChooser implements FileChooserProvider {
try { try {
latch.await(); latch.await();
} catch (InterruptedException ignore) { } catch (InterruptedException ignore) {
} finally {
setShowDialogState(false);
} }
return selectedFiles.length > 0 ? JFileChooser.APPROVE_OPTION : JFileChooser.CANCEL_OPTION; return selectedFiles.length > 0 ? JFileChooser.APPROVE_OPTION : JFileChooser.CANCEL_OPTION;
} }

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

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

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

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

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

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

18
designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java

@ -34,6 +34,7 @@ import com.fr.design.menu.KeySetUtils;
import com.fr.design.menu.ShortCut; import com.fr.design.menu.ShortCut;
import com.fr.design.menu.ToolBarDef; import com.fr.design.menu.ToolBarDef;
import com.fr.design.roleAuthority.RolesAlreadyEditedPane; import com.fr.design.roleAuthority.RolesAlreadyEditedPane;
import com.fr.design.ui.util.UIUtil;
import com.fr.design.utils.DesignUtils; import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.event.Event; import com.fr.event.Event;
@ -101,6 +102,23 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
return context.contain(PluginModule.ExtraDesign, ShortCut.TEMPLATE_TREE); return context.contain(PluginModule.ExtraDesign, ShortCut.TEMPLATE_TREE);
} }
}); });
GeneralContext.listenPluginRunningChanged(new PluginEventListener() {
@Override
public void on(PluginEvent event) {
UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override
public void run() {
DesignerFrameFileDealerPane.getInstance().refresh();
DesignerFrameFileDealerPane.getInstance().stateChange();
}
});
}
}, new PluginFilter() {
@Override
public boolean accept(PluginContext context) {
return context.contain(PluginModule.ExtraDesign, App.MARK_STRING);
}
});
} }
private List<FileToolbarStateChangeListener> otherToolbarStateChangeListeners = new ArrayList<>(); private List<FileToolbarStateChangeListener> otherToolbarStateChangeListeners = new ArrayList<>();

21
designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java

@ -381,7 +381,9 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
*/ */
@Deprecated @Deprecated
public void refreshResource() { public void refreshResource() {
refreshResource(this.editingFILE); if (JTemplateFactory.isAvailable()) {
refreshResource(this.editingFILE);
}
} }
public void refreshResource(FILE file) { public void refreshResource(FILE file) {
@ -404,8 +406,11 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
} }
private void setTargetByFile(FILE file) { private void setTargetByFile(FILE file) {
this.template = JTemplateFactory.asIOFile(file, this.suffix()); T newTemplate = JTemplateFactory.asIOFile(file, this.suffix());
setTarget(this.template); if (newTemplate != null) {
this.template = newTemplate;
setTarget(this.template);
}
} }
private void addCenterPane() { private void addCenterPane() {
@ -576,6 +581,16 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
fireSuperTargetModified(); fireSuperTargetModified();
} }
public void undoToCurrent() {
UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override
public void run() {
BaseUndoState current = JTemplate.this.getUndoState();
current.applyState();
}
});
}
/** /**
* 模板更新 * 模板更新
*/ */

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

@ -93,4 +93,7 @@ public final class JTemplateFactory {
ALL_APP.remove(app); ALL_APP.remove(app);
} }
} }
}
public static boolean isAvailable() {
return !ALL_APP.isEmpty();
}}

78
designer-base/src/main/java/com/fr/design/mainframe/NorthRegionContainerPane.java

@ -17,6 +17,7 @@ import com.fr.plugin.injectable.PluginModule;
import com.fr.plugin.manage.PluginFilter; import com.fr.plugin.manage.PluginFilter;
import com.fr.plugin.observer.PluginEvent; import com.fr.plugin.observer.PluginEvent;
import com.fr.plugin.observer.PluginEventListener; import com.fr.plugin.observer.PluginEventListener;
import com.fr.plugin.observer.PluginEventType;
import com.fr.stable.os.support.OSBasedAction; import com.fr.stable.os.support.OSBasedAction;
import com.fr.stable.os.support.OSSupportCenter; import com.fr.stable.os.support.OSSupportCenter;
@ -38,6 +39,17 @@ public class NorthRegionContainerPane extends JPanel {
private JMenuBar menuBar; private JMenuBar menuBar;
private PluginFilter pluginFilter = new PluginFilter() {
@Override
public boolean accept(PluginContext context) {
return context.contain(PluginModule.ExtraDesign);
}
};
private volatile boolean existDesignExtraPlugin;
public static NorthRegionContainerPane getInstance() { public static NorthRegionContainerPane getInstance() {
if (THIS == null) { if (THIS == null) {
synchronized (NorthRegionContainerPane.class) { synchronized (NorthRegionContainerPane.class) {
@ -66,34 +78,64 @@ public class NorthRegionContainerPane extends JPanel {
//hugh: private修改为protected方便oem的时候修改右上的组件构成 //hugh: private修改为protected方便oem的时候修改右上的组件构成
//顶部日志+登陆按钮 //顶部日志+登陆按钮
final JPanel northEastPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); final JPanel northEastPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
initPluginListener(northEastPane, ad);
refreshNorthEastPane(northEastPane, ad);
return northEastPane;
}
private void initPluginListener(JPanel northEastPane, ToolBarMenuDock ad) {
//优先级为-1,保证最后全面刷新一次 //优先级为-1,保证最后全面刷新一次
GeneralContext.listenPluginRunningChanged(new PluginEventListener(-1) { PluginEventListener pluginOnRunOrStopListener = new PluginEventListener(-1) {
@Override @Override
public void on(PluginEvent event) { public void on(PluginEvent event) {
refreshAll(northEastPane, ad);
refreshNorthEastPane(northEastPane, ad);
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
if (DesignerContext.getDesignerFrame() == null) {
return;
}
DesignerContext.getDesignerFrame().refresh();
DesignerContext.getDesignerFrame().repaint();
}
});
} }
}, new PluginFilter() { };
// 在设计器启动时仅在最后一个插件启用时候进行刷新一次 如果插件启用过程中存在实现了设计器接口的插件
PluginEventListener afterAllPluginsActiveListener = new PluginEventListener() {
@Override
public void on(PluginEvent event) {
//优先级为-1,保证最后全面刷新一次
GeneralContext.listenPluginRunningChanged(pluginOnRunOrStopListener, pluginFilter);
// 在设计器启动时仅在最后一个插件启用时候进行刷新一次 如果插件启用过程中存在实现了设计器接口的插件
boolean needRefresh = DesignerContext.getDesignerFrame() != null && DesignerContext.getDesignerFrame().isVisible() && existDesignExtraPlugin;
if (needRefresh) {
refreshAll(northEastPane, ad);
}
}
};
PluginEventListener beforeAllPluginStopListener = new PluginEventListener() {
@Override
public void on(PluginEvent event) {
GeneralContext.stopListenPlugin(pluginOnRunOrStopListener);
}
};
PluginEventListener pluginEventListener = new PluginEventListener() {
@Override @Override
public boolean accept(PluginContext context) { public void on(PluginEvent event) {
existDesignExtraPlugin = true;
}
};
GeneralContext.listenPluginRunningChanged(pluginEventListener, pluginFilter);
GeneralContext.listenPlugin(PluginEventType.AfterAllActive, afterAllPluginsActiveListener);
GeneralContext.listenPlugin(PluginEventType.BeforeAllStop, beforeAllPluginStopListener);
return context.contain(PluginModule.ExtraDesign); }
private void refreshAll(JPanel northEastPane, ToolBarMenuDock ad) {
refreshNorthEastPane(northEastPane, ad);
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
if (DesignerContext.getDesignerFrame() == null) {
return;
}
DesignerContext.getDesignerFrame().refresh();
DesignerContext.getDesignerFrame().repaint();
} }
}); });
refreshNorthEastPane(northEastPane, ad);
return northEastPane;
} }
private void refreshNorthEastPane(final JPanel northEastPane, final ToolBarMenuDock ad) { private void refreshNorthEastPane(final JPanel northEastPane, final ToolBarMenuDock ad) {

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

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

17
designer-base/src/main/java/com/fr/design/mainframe/share/collect/ComponentCollector.java

@ -288,12 +288,17 @@ public class ComponentCollector implements XMLable {
private JSONArray getGroupingDetail() { private JSONArray getGroupingDetail() {
JSONArray ja = JSONFactory.createJSON(JSON.ARRAY); JSONArray ja = JSONFactory.createJSON(JSON.ARRAY);
Group[] groups = DefaultShareGroupManager.getInstance().getAllGroup(); try {
for(Group group : groups) { DefaultShareGroupManager.getInstance().refresh();
JSONObject jo = JSONFactory.createJSON(JSON.OBJECT); Group[] groups = DefaultShareGroupManager.getInstance().getAllGroup();
jo.put(GROUP_NAME, group.getGroupName()); for(Group group : groups) {
jo.put(CONTAIN_AMOUNT, group.getAllBindInfoList().length); JSONObject jo = JSONFactory.createJSON(JSON.OBJECT);
ja.add(jo); jo.put(GROUP_NAME, group.getGroupName());
jo.put(CONTAIN_AMOUNT, group.getAllBindInfoList().length);
ja.add(jo);
}
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage());
} }
return ja; return ja;
} }

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

@ -17,6 +17,7 @@ import com.fr.design.actions.community.FacebookFansAction;
import com.fr.design.actions.community.NeedAction; import com.fr.design.actions.community.NeedAction;
import com.fr.design.actions.community.QuestionAction; import com.fr.design.actions.community.QuestionAction;
import com.fr.design.actions.community.SignAction; import com.fr.design.actions.community.SignAction;
import com.fr.design.actions.community.StudyPlanAction;
import com.fr.design.actions.community.TechSolutionAction; import com.fr.design.actions.community.TechSolutionAction;
import com.fr.design.actions.community.TechSupportAction; import com.fr.design.actions.community.TechSupportAction;
import com.fr.design.actions.community.TemplateStoreAction; import com.fr.design.actions.community.TemplateStoreAction;
@ -597,6 +598,7 @@ public abstract class ToolBarMenuDock {
shortCuts.add(new TutorialAction()); shortCuts.add(new TutorialAction());
} }
}, SupportLocaleImpl.TUTORIAL_COMMUNITY); }, SupportLocaleImpl.TUTORIAL_COMMUNITY);
shortCuts.add(new StudyPlanAction());
shortCuts.add(new QuestionAction()); shortCuts.add(new QuestionAction());
shortCuts.add(new TechSolutionAction()); shortCuts.add(new TechSolutionAction());

4
designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/AbstractTemplateStylePane.java

@ -7,4 +7,8 @@ public abstract class AbstractTemplateStylePane<T> extends BasicPane {
public abstract void populate(T ob); public abstract void populate(T ob);
public abstract T update(); public abstract T update();
public AbstractTemplateStylePane<T> generateCleanPane() {
return this;
}
} }

5
designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessibleTemplateStyleEditor.java

@ -32,6 +32,11 @@ public class AccessibleTemplateStyleEditor extends UneditableAccessibleEditor {
setValue(stylePane.update()); setValue(stylePane.update());
fireStateChanged(); fireStateChanged();
} }
@Override
public void doCancel() {
stylePane = stylePane.generateCleanPane();
}
}); });
stylePane.populate(getValue()); stylePane.populate(getValue());
dlg.setVisible(true); dlg.setVisible(true);

7
designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/MobileTemplateStylePane.java

@ -44,12 +44,14 @@ public class MobileTemplateStylePane extends AbstractTemplateStylePane<MobileTem
private JPanel right; private JPanel right;
private CardLayout card; private CardLayout card;
private Set<Class<? extends MobileTemplateStyle>> extraStyle = new HashSet<>(); private Set<Class<? extends MobileTemplateStyle>> extraStyle = new HashSet<>();
private WCardTagLayout tagLayout;
public MobileTemplateStylePane(WCardTagLayout tagLayout){ public MobileTemplateStylePane(WCardTagLayout tagLayout){
init(tagLayout); init(tagLayout);
} }
public void init(WCardTagLayout tagLayout){ public void init(WCardTagLayout tagLayout){
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.tagLayout = tagLayout;
listModel = new DefaultListModel(); listModel = new DefaultListModel();
card = new CardLayout(); card = new CardLayout();
right = FRGUIPaneFactory.createCardLayout_S_Pane(); right = FRGUIPaneFactory.createCardLayout_S_Pane();
@ -147,4 +149,9 @@ public class MobileTemplateStylePane extends AbstractTemplateStylePane<MobileTem
list.addAll(sets); list.addAll(sets);
return Collections.unmodifiableList(list); return Collections.unmodifiableList(list);
} }
@Override
public AbstractTemplateStylePane<MobileTemplateStyle> generateCleanPane() {
return new MobileTemplateStylePane(this.tagLayout);
}
} }

5
designer-base/src/main/java/com/fr/design/notification/ui/NotificationCenterDialog.java

@ -2,6 +2,7 @@ package com.fr.design.notification.ui;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.notification.Notification; import com.fr.design.notification.Notification;
import com.fr.design.notification.NotificationCenter; import com.fr.design.notification.NotificationCenter;
import java.awt.BorderLayout; import java.awt.BorderLayout;
@ -119,7 +120,7 @@ public class NotificationCenterDialog extends JDialog {
if (winSize.width > screenSize.width) { if (winSize.width > screenSize.width) {
winSize.width = screenSize.width; winSize.width = screenSize.width;
} }
//这里设置位置:水平居中,竖直偏上 win.setLocation((DesignerContext.getDesignerFrame().getWidth() - winSize.width - 100 + DesignerContext.getDesignerFrame().getX()),
win.setLocation(screenSize.width - winSize.width - 90, 50); DesignerContext.getDesignerFrame().getY() + winSize.height);
} }
} }

45
designer-base/src/main/java/com/fr/design/report/fit/BaseFitAttrPane.java

@ -5,6 +5,7 @@ import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.ibutton.UIRadioButton; import com.fr.design.gui.ibutton.UIRadioButton;
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.i18n.DesignSizeI18nManager;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.report.fit.menupane.FitPreviewPane; import com.fr.design.report.fit.menupane.FitPreviewPane;
@ -17,7 +18,6 @@ import com.fr.report.fit.ReportFitAttr;
import javax.swing.*; import javax.swing.*;
import javax.swing.border.EmptyBorder;
import java.awt.*; import java.awt.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
@ -33,6 +33,7 @@ import static com.fr.design.i18n.Toolkit.i18nText;
public abstract class BaseFitAttrPane extends BasicBeanPane<ReportFitAttr> { public abstract class BaseFitAttrPane extends BasicBeanPane<ReportFitAttr> {
protected JPanel contentJPanel; protected JPanel contentJPanel;
protected UILabel belowSetLabel;
protected UIComboBox itemChoose; protected UIComboBox itemChoose;
protected java.util.List<FitAttrModel> fitAttrModelList = new ArrayList<>(); protected java.util.List<FitAttrModel> fitAttrModelList = new ArrayList<>();
@ -41,6 +42,7 @@ public abstract class BaseFitAttrPane extends BasicBeanPane<ReportFitAttr> {
public JPanel attrJPanel; public JPanel attrJPanel;
public FitPreviewPane previewJPanel; public FitPreviewPane previewJPanel;
public FitAttrModel fitAttrModel; public FitAttrModel fitAttrModel;
private static final int BELOW_SET_COMPONENT_HSPACE = 8;
protected BaseFitAttrPane() { protected BaseFitAttrPane() {
@ -89,14 +91,14 @@ public abstract class BaseFitAttrPane extends BasicBeanPane<ReportFitAttr> {
} }
for (int i = 0; i < columnSize.length; i++) { for (int i = 0; i < columnSize.length; i++) {
if (i == 0) { if (i == 0) {
columnSize[i] = 80; columnSize[i] = DesignSizeI18nManager.getInstance().i18nDimension("com.fr.design.report.fit.firstColumn").getWidth();
} else { } else {
columnSize[i] = 100; columnSize[i] = DesignSizeI18nManager.getInstance().i18nDimension("com.fr.design.report.fit.column").getWidth();
} }
} }
attrJPanel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); attrJPanel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
attrJPanel.setBorder(new EmptyBorder(0, 100, 10, 100)); attrJPanel.setBorder(BorderFactory.createEmptyBorder(5, 0, 10, 0));
contentJPanel.add(attrJPanel); contentJPanel.add(attrJPanel);
} }
@ -135,9 +137,18 @@ public abstract class BaseFitAttrPane extends BasicBeanPane<ReportFitAttr> {
protected void initPreviewJPanel() { protected void initPreviewJPanel() {
previewJPanel = new FitPreviewPane(); previewJPanel = new FitPreviewPane();
previewJPanel.setBorder(BorderFactory.createEmptyBorder(0, getPreviewJPanelLeft(), 0, 0));
contentJPanel.add(previewJPanel); contentJPanel.add(previewJPanel);
} }
private int getPreviewJPanelLeft() {
int left = 0;
if (belowSetLabel.getPreferredSize() != null) {
left = belowSetLabel.getPreferredSize().width + BELOW_SET_COMPONENT_HSPACE;
}
return left;
}
protected int getStateInPC(int index) { protected int getStateInPC(int index) {
FitType[] fitTypes = fitAttrModel.getFitTypes(); FitType[] fitTypes = fitAttrModel.getFitTypes();
return fitTypes[index].getState(); return fitTypes[index].getState();
@ -179,7 +190,7 @@ public abstract class BaseFitAttrPane extends BasicBeanPane<ReportFitAttr> {
@Override @Override
protected String title4PopupWindow() { protected String title4PopupWindow() {
return i18nText("Fine-Designer_PC_Element_Case_Fit_Attr"); return i18nText("Fine-Designer_PC_Fit_Attr");
} }
protected abstract String[] getItemNames(); protected abstract String[] getItemNames();
@ -187,29 +198,26 @@ public abstract class BaseFitAttrPane extends BasicBeanPane<ReportFitAttr> {
protected void initComponents() { protected void initComponents() {
this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
contentJPanel = new JPanel(); contentJPanel = FRGUIPaneFactory.createVerticalFlowLayout_Pane(false, FlowLayout.LEFT, 0, 0);
contentJPanel.setLayout(FRGUIPaneFactory.createCenterFlowLayout());
this.add(contentJPanel); this.add(contentJPanel);
initItemChoose(); initItemChoose();
initPrompt();
} }
private void initItemChoose() { private void initItemChoose() {
JPanel chooseJPanel = new JPanel(); JPanel chooseJPanel = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane();
chooseJPanel.setLayout(FRGUIPaneFactory.createLabelFlowLayout());
ItemListener itemListener = getItemListener(); ItemListener itemListener = getItemListener();
itemChoose = new UIComboBox(getItemNames()); itemChoose = new UIComboBox(getItemNames());
itemChoose.addItemListener(itemListener); itemChoose.addItemListener(itemListener);
UILabel belowSetLabel = new UILabel(i18nText("Fine-Design_Report_Blow_Set")); belowSetLabel = new UILabel(i18nText("Fine-Design_Report_Blow_Set"));
JPanel hSpaceLabel = new JPanel();
hSpaceLabel.setSize(BELOW_SET_COMPONENT_HSPACE, 0);
JPanel buttonPane = GUICoreUtils.createFlowPane(new Component[]{ JPanel buttonPane = GUICoreUtils.createFlowPane(new Component[]{
belowSetLabel, itemChoose}, FlowLayout.LEFT, 0, 0); belowSetLabel, hSpaceLabel, itemChoose}, FlowLayout.LEFT);
chooseJPanel.add(buttonPane); chooseJPanel.add(buttonPane);
chooseJPanel.setPreferredSize(new Dimension(500, 50)); chooseJPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0));
JPanel jPanel = new JPanel(); contentJPanel.add(chooseJPanel);
jPanel.setLayout(FRGUIPaneFactory.createBorderLayout());
jPanel.add(chooseJPanel, BorderLayout.WEST);
contentJPanel.add(jPanel);
} }
@ -220,6 +228,9 @@ public abstract class BaseFitAttrPane extends BasicBeanPane<ReportFitAttr> {
} }
protected void initPrompt() {
}
protected void refresh() { protected void refresh() {
validate(); validate();
repaint(); repaint();

28
designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java

@ -4,6 +4,7 @@ import com.fr.design.actions.JTemplateAction;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.dialog.UIDialog; import com.fr.design.dialog.UIDialog;
import com.fr.design.i18n.DesignSizeI18nManager;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
@ -34,22 +35,6 @@ public class ReportFitAttrAction extends JTemplateAction {
return null; return null;
} }
}; };
private static final MenuKeySet REPORT_FIT_ATTR_ELEMENTCASE = new MenuKeySet() {
@Override
public char getMnemonic() {
return 'T';
}
@Override
public String getMenuName() {
return Toolkit.i18nText("Fine-Designer_PC_Element_Case_Fit_Attr");
}
@Override
public KeyStroke getKeyStroke() {
return null;
}
};
public ReportFitAttrAction(JTemplate jTemplate) { public ReportFitAttrAction(JTemplate jTemplate) {
super(jTemplate); super(jTemplate);
@ -57,12 +42,7 @@ public class ReportFitAttrAction extends JTemplateAction {
} }
private void initMenuStyle() { private void initMenuStyle() {
JTemplate jTemplate = getEditingComponent(); this.setMenuKeySet(REPORT_FIT_ATTR);
if (jTemplate.isJWorkBook()) {
this.setMenuKeySet(REPORT_FIT_ATTR);
} else {
this.setMenuKeySet(REPORT_FIT_ATTR_ELEMENTCASE);
}
this.setName(getMenuKeySet().getMenuKeySetName() + "..."); this.setName(getMenuKeySet().getMenuKeySetName() + "...");
this.setMnemonic(getMenuKeySet().getMnemonic()); this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon("/com/fr/design/images/reportfit/fit"); this.setSmallIcon("/com/fr/design/images/reportfit/fit");
@ -87,13 +67,13 @@ public class ReportFitAttrAction extends JTemplateAction {
private void showReportFitDialog(ReportFitAttr fitAttr, final JTemplate jwb, final FitProvider wbTpl, final BasicBeanPane<ReportFitAttr> attrPane) { private void showReportFitDialog(ReportFitAttr fitAttr, final JTemplate jwb, final FitProvider wbTpl, final BasicBeanPane<ReportFitAttr> attrPane) {
attrPane.populateBean(fitAttr); attrPane.populateBean(fitAttr);
UIDialog dialog = attrPane.showMediumWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { UIDialog dialog = attrPane.showWindowWithCustomSize(DesignerContext.getDesignerFrame(), new DialogActionAdapter() {
@Override @Override
public void doOk() { public void doOk() {
wbTpl.setReportFitAttr(attrPane.updateBean()); wbTpl.setReportFitAttr(attrPane.updateBean());
jwb.fireTargetModified(); jwb.fireTargetModified();
} }
}); }, DesignSizeI18nManager.getInstance().i18nDimension("com.fr.design.report.fit.templatePane.dialog"));
dialog.setVisible(true); dialog.setVisible(true);
} }

61
designer-base/src/main/java/com/fr/design/style/AbstractSelectBox.java

@ -1,30 +1,33 @@
package com.fr.design.style; package com.fr.design.style;
import com.fr.design.constants.UIConstants;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UIButtonUI;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.style.background.BackgroundJComponent;
import com.fr.design.utils.gui.GUIPaintUtils;
import com.fr.stable.Constants;
import javax.swing.AbstractButton;
import javax.swing.JPanel;
import javax.swing.JWindow;
import javax.swing.border.AbstractBorder;
import javax.swing.event.AncestorEvent;
import javax.swing.event.AncestorListener;
import javax.swing.plaf.ButtonUI;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Component; import java.awt.Component;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import java.awt.Insets; import java.awt.Insets;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.RenderingHints; import java.awt.RenderingHints;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.event.MouseListener; import java.awt.event.MouseListener;
import javax.swing.AbstractButton;
import javax.swing.JPanel;
import javax.swing.border.AbstractBorder;
import javax.swing.event.AncestorEvent;
import javax.swing.event.AncestorListener;
import javax.swing.plaf.ButtonUI;
import com.fr.design.constants.UIConstants;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UIButtonUI;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.gui.GUIPaintUtils;
import com.fr.design.style.background.BackgroundJComponent;
import com.fr.stable.Constants;
/** /**
* @author kunsnat E-mail:kunsnat@gmail.com * @author kunsnat E-mail:kunsnat@gmail.com
* @version 创建时间2011-10-31 下午03:28:31 类说明: 抽象出来的弹出box. 可以弹出颜色选择, 图案选择, 纹理选择. * @version 创建时间2011-10-31 下午03:28:31 类说明: 抽象出来的弹出box. 可以弹出颜色选择, 图案选择, 纹理选择.
@ -94,6 +97,34 @@ public abstract class AbstractSelectBox<T> extends AbstractPopBox implements Mou
hidePopupMenu(); hidePopupMenu();
} }
}); });
displayComponent.addMouseListener(new MouseAdapter() {
@Override
public void mouseExited(MouseEvent e) {
if (!isPopupVisible()) {
//如果弹出框==null 或者 弹出框不可见 直接return
return;
}
Point popMenuP = getControlWindow().getLocation();
Point displayComponentP = displayComponent.getLocationOnScreen();
if (popMenuP.getX() < displayComponentP.getX() - 1) {
//如果 弹出框横向超出屏幕 往左调整了 和displayComponent横向错开 就不处理了
return;
}
Rectangle rectangle = displayComponent.getBounds();
boolean bottomPopAndExitTop = displayComponentP.getY() < popMenuP.getY() && e.getY() <= rectangle.y;
boolean topPopAndExitBottom = displayComponentP.getY() > popMenuP.getY() && e.getY() >= rectangle.y + rectangle.getHeight();
boolean exitLeftOrRight = rectangle.x > e.getX() || rectangle.x + rectangle.getWidth() < e.getX();
if (bottomPopAndExitTop || topPopAndExitBottom || exitLeftOrRight) {
//弹出框在displayComponent下面 且 鼠标是从displayComponent上面离开的,隐藏弹出界面。
//弹出框在displayComponent上面 且 鼠标是从displayComponent下面离开的,隐藏弹出界面。
//鼠标从displayComponent左边 或者 右边 离开,隐藏弹出界面。
hidePopupMenu();
}
}
});
} }
public void setEnabled(boolean enabled) { public void setEnabled(boolean enabled) {

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

@ -18,6 +18,16 @@ public class AdjustWorkBookDefaultStyleUtils {
private static final Color TEMPLATE_BACKGROUND = new Color(16, 11, 43); private static final Color TEMPLATE_BACKGROUND = new Color(16, 11, 43);
private static final Color CELL_ELEMENT_BORDER = new Color(110, 110, 110); private static final Color CELL_ELEMENT_BORDER = new Color(110, 110, 110);
private static Color currentStoryBack = null;
public static void setCurrentStoryBack(Color color) {
currentStoryBack = color;
}
private static Color getCurrentStoryBack() {
return currentStoryBack == null ? TEMPLATE_BACKGROUND : currentStoryBack;
}
public static void adjustCellElement(CellElement cellElement) { public static void adjustCellElement(CellElement cellElement) {
if (DesignModeContext.isDuchampMode()) { if (DesignModeContext.isDuchampMode()) {
Style style = cellElement.getStyle(); Style style = cellElement.getStyle();
@ -33,14 +43,14 @@ public class AdjustWorkBookDefaultStyleUtils {
public static void adjustFloatElement(FloatElement floatElement) { public static void adjustFloatElement(FloatElement floatElement) {
if (DesignModeContext.isDuchampMode()) { if (DesignModeContext.isDuchampMode()) {
Style style = floatElement.getStyle(); Style style = floatElement.getStyle();
style = style.deriveBackground(ColorBackground.getInstance(TEMPLATE_BACKGROUND)); style = style.deriveBackground(ColorBackground.getInstance(getCurrentStoryBack()));
style = style.deriveFRFont(style.getFRFont().applyForeground(Color.WHITE)); style = style.deriveFRFont(style.getFRFont().applyForeground(Color.WHITE));
floatElement.setStyle(style); floatElement.setStyle(style);
} }
} }
public static Color adjustBack(Color color) { public static Color adjustBack(Color color) {
return DesignModeContext.isDuchampMode() ? TEMPLATE_BACKGROUND : color; return DesignModeContext.isDuchampMode() ? getCurrentStoryBack() : color;
} }
} }

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

@ -64,6 +64,11 @@ 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 String RUNNING = "running";
private static final String SYNC = "sync";
private static final String GROUP = "group";
private static final String BI = "bi";
private static final String BIPREFIX = "com.finebi";
private static final Set<String> pluginsNeedIgnore = new HashSet<>(); private static final Set<String> pluginsNeedIgnore = new HashSet<>();
static { static {
pluginsNeedIgnore.addAll(Arrays.asList( pluginsNeedIgnore.addAll(Arrays.asList(
@ -263,13 +268,10 @@ public class VersionCheckUtils {
Map<String, String> pluginsNameMap = ReportHelper.getPluginNameMap(); Map<String, String> pluginsNameMap = ReportHelper.getPluginNameMap();
for (int i = 0; i < remotePlugins.size(); i++) { for (int i = 0; i < remotePlugins.size(); i++) {
remotePlugin = remotePlugins.getJSONObject(i); remotePlugin = remotePlugins.getJSONObject(i);
if (ComparatorUtils.equals(remotePlugin.getString("running"), "false") || (remotePlugin.containsKey("sync") && !remotePlugin.getBoolean("sync"))) { if (isPluginNeedIgnore(remotePlugin)) {
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;
@ -290,6 +292,12 @@ public class VersionCheckUtils {
return differentPlugins; return differentPlugins;
} }
private static boolean isPluginNeedIgnore(JSONObject remotePlugin) {
return ComparatorUtils.equals(remotePlugin.getString(RUNNING), "false") || (remotePlugin.containsKey(SYNC) && !remotePlugin.getBoolean(SYNC))
|| (remotePlugin.containsKey(GROUP) && ComparatorUtils.equals(remotePlugin.containsKey(GROUP), BI) || remotePlugin.getString(ID).startsWith(BIPREFIX)
|| pluginsNeedIgnore.contains(remotePlugin.getString(ID)));
}
public static JSONArray syncPlugins(JSONArray differentPlugins) { public static JSONArray syncPlugins(JSONArray differentPlugins) {
Set<String> uninstallFailed = uninstallPlugins(differentPlugins); Set<String> uninstallFailed = uninstallPlugins(differentPlugins);
List<PluginMarker> plugins = getSyncPlugins(differentPlugins, uninstallFailed); List<PluginMarker> plugins = getSyncPlugins(differentPlugins, uninstallFailed);

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

@ -46,12 +46,12 @@ 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, JComponent ratioLocked) { public static UIExpandablePane createBoundsPane(UISpinner width, UISpinner height, JComponent ratioLocked, NameAttribute nameAttribute) {
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")), new Component[]{FRWidgetFactory.createLineWrapLabel(nameAttribute.getSizeName()),
ratioLocked != null ? createRightPane(width, ratioLocked, height) : createRightPane(width, height)}, 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))},
}; };
@ -65,7 +65,7 @@ public class WidgetBoundsPaneFactory {
} }
public static UIExpandablePane createBoundsPane(UISpinner width, UISpinner height) { public static UIExpandablePane createBoundsPane(UISpinner width, UISpinner height) {
return createBoundsPane(width, height, null); return createBoundsPane(width, height, null, NameAttribute.DEFAULT);
} }
public static JPanel createRightPane(Component com1, Component com2) { public static JPanel createRightPane(Component com1, Component com2) {

22
designer-base/src/main/java/com/fr/design/widget/component/NumberEditorValidatePane.java

@ -1,6 +1,10 @@
package com.fr.design.widget.component; package com.fr.design.widget.component;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.beans.ErrorMsgTextFieldAdapter;
import com.fr.design.beans.UITextFieldAdapter;
import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.IntervalConstants;
import com.fr.design.fun.TextFieldAdapterProvider;
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.gui.ispinner.UISpinner; import com.fr.design.gui.ispinner.UISpinner;
@ -9,6 +13,7 @@ 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.form.ui.NumberEditor; import com.fr.form.ui.NumberEditor;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.AssistUtils; import com.fr.stable.AssistUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -35,7 +40,7 @@ public class NumberEditorValidatePane extends JPanel {
private UISpinner minValueSpinner; private UISpinner minValueSpinner;
private UISpinner decimalLength; private UISpinner decimalLength;
private JPanel limitNumberPane; private JPanel limitNumberPane;
private UITextField errorMsgTextField; private ErrorMsgTextFieldAdapter errorMsgTextField;
private JPanel errorMsgTextFieldPane; private JPanel errorMsgTextFieldPane;
private ActionListener allowDecimalsListener; private ActionListener allowDecimalsListener;
@ -100,9 +105,20 @@ public class NumberEditorValidatePane extends JPanel {
} }
private void initErrorMsgPane() { private void initErrorMsgPane() {
errorMsgTextField = new UITextField(); TextFieldAdapterProvider provider = ExtraDesignClassManager.getInstance().getSingle(TextFieldAdapterProvider.XML_TAG);
if (provider != null) {
try {
errorMsgTextField = provider.createTextFieldAdapter();
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
errorMsgTextField = new UITextFieldAdapter();
}
} else {
errorMsgTextField = new UITextFieldAdapter();
}
errorMsgTextFieldPane = TableLayoutHelper.createGapTableLayoutPane( errorMsgTextFieldPane = TableLayoutHelper.createGapTableLayoutPane(
new Component[][]{new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Error_Tip")), errorMsgTextField}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L2, IntervalConstants.INTERVAL_L1); new Component[][]{new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Error_Tip")), errorMsgTextField.getErrorMsgTextField()}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L2, IntervalConstants.INTERVAL_L1);
} }

3
designer-base/src/main/java/com/fr/design/worker/open/OpenWorker.java

@ -53,7 +53,6 @@ public class OpenWorker<T> extends SwingWorker<T, Void> {
@Override @Override
protected T doInBackground() throws Exception { protected T doInBackground() throws Exception {
TimeUnit.SECONDS.sleep(5);
return this.callable.call(); return this.callable.call();
} }
@ -134,7 +133,7 @@ public class OpenWorker<T> extends SwingWorker<T, Void> {
this.template.setOpening(false); this.template.setOpening(false);
JTemplate<?, ?> currentTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); JTemplate<?, ?> currentTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
// 需要判断当前打开的模板是不是异步执行后失败的模板 是的话立即展示失败后的提示内容 否则只设置下失败的提示内容 // 需要判断当前打开的模板是不是异步执行后失败的模板 是的话立即展示失败后的提示内容 否则只设置下失败的提示内容
if (ComparatorUtils.equals(currentTemplate.getEditingFILE().getName(), this.template.getName())) { if (ComparatorUtils.equals(currentTemplate.getEditingFILE().getName(), this.template.getEditingFILE().getName())) {
DesignerContext.getDesignerFrame().getCenterTemplateCardPane().showOpenFailedCover(text); DesignerContext.getDesignerFrame().getCenterTemplateCardPane().showOpenFailedCover(text);
DesignerFrameFileDealerPane.getInstance().stateChange(); DesignerFrameFileDealerPane.getInstance().stateChange();
} else { } else {

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

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

17
designer-base/src/main/java/com/fr/file/StashedFILE.java

@ -1,5 +1,9 @@
package com.fr.file; package com.fr.file;
import com.fr.base.io.XMLEncryptUtils;
import com.fr.io.EncryptUtils;
import com.fr.io.FineEncryptUtils;
import com.fr.stable.StringUtils;
import javax.swing.Icon; import javax.swing.Icon;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.InputStream; import java.io.InputStream;
@ -11,10 +15,16 @@ public class StashedFILE extends AbstractFILE {
private FILE file; private FILE file;
private byte[] content; private byte[] content;
private String suffix;
public StashedFILE(FILE file, byte[] content) { public StashedFILE(FILE file, byte[] content) {
this(file, content, null);
}
public StashedFILE(FILE file, byte[] content, String suffix) {
this.file = file; this.file = file;
this.content = content; this.content = content;
this.suffix = suffix;
} }
@Override @Override
@ -54,7 +64,12 @@ public class StashedFILE extends AbstractFILE {
@Override @Override
public InputStream asInputStream() throws Exception { public InputStream asInputStream() throws Exception {
return new ByteArrayInputStream(content); ByteArrayInputStream in = new ByteArrayInputStream(content);
return needDecode() ? XMLEncryptUtils.decodeInputStream(EncryptUtils.decodeInputStream(FineEncryptUtils.decode(in))) : in;
}
private boolean needDecode() {
return StringUtils.isNotEmpty(suffix) && (suffix.endsWith(".cpt") || suffix.endsWith(".frm"));
} }
@Override @Override

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

@ -1,6 +1,6 @@
com.fr.design.mainframe.check.CheckButton=305*118 com.fr.design.mainframe.check.CheckButton=305*118
com.fr.design.mainframe.check.CheckFontInfoDialog.collapse=630*185 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=570*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 com.fr.env.RemoteEnvPane.dialog=458*132
@ -8,4 +8,8 @@ com.fr.design.version.check.dialog=490*95
com.fr.design.version.detail.label=750*30 com.fr.design.version.detail.label=750*30
com.fr.design.version.detail.dialog=900*500 com.fr.design.version.detail.dialog=900*500
com.fr.env.SyncFailedPluginsDialog.messageWithLink=316*36 com.fr.env.SyncFailedPluginsDialog.messageWithLink=316*36
com.fr.design.web.pane.text.field=450*20 com.fr.design.web.pane.text.field=450*20
com.fr.design.actions.server.dialog=800*630
com.fr.design.report.fit.templatePane.dialog=800*400
com.fr.design.report.fit.firstColumn=120*20
com.fr.design.report.fit.column=160*20

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

@ -1,10 +1,14 @@
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=550*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 com.fr.env.RemoteEnvPane.dialog=458*132
com.fr.design.version.check.dialog=430*95 com.fr.design.version.check.dialog=430*95
com.fr.design.version.detail.label=650*30 com.fr.design.version.detail.label=650*30
com.fr.design.version.detail.dialog=800*500 com.fr.design.version.detail.dialog=800*500
com.fr.env.SyncFailedPluginsDialog.messageWithLink=316*36 com.fr.env.SyncFailedPluginsDialog.messageWithLink=316*36
com.fr.design.web.pane.text.field=400*20 com.fr.design.web.pane.text.field=400*20
com.fr.design.actions.server.dialog=700*630
com.fr.design.report.fit.templatePane.dialog=600*400
com.fr.design.report.fit.firstColumn=170*20
com.fr.design.report.fit.column=100*20

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

@ -1,10 +1,14 @@
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=550*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=550*280
com.fr.env.RemoteEnvPane.dialog=458*132 com.fr.env.RemoteEnvPane.dialog=458*132
com.fr.design.version.check.dialog=450*95 com.fr.design.version.check.dialog=450*95
com.fr.design.version.detail.label=700*30 com.fr.design.version.detail.label=700*30
com.fr.design.version.detail.dialog=850*500 com.fr.design.version.detail.dialog=850*500
com.fr.env.SyncFailedPluginsDialog.messageWithLink=316*36 com.fr.env.SyncFailedPluginsDialog.messageWithLink=316*36
com.fr.design.web.pane.text.field=450*20 com.fr.design.web.pane.text.field=450*20
com.fr.design.actions.server.dialog=700*630
com.fr.design.report.fit.templatePane.dialog=600*400
com.fr.design.report.fit.firstColumn=130*20
com.fr.design.report.fit.column=100*20

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

@ -1,11 +1,15 @@
# \u9ED8\u8BA4\u4E3A\u7C7B\u7684\u5168\u9650\u5B9A\u540D\uFF08\u53EF\u81EA\u5B9A\u4E49key\uFF09= width * height # \u9ED8\u8BA4\u4E3A\u7C7B\u7684\u5168\u9650\u5B9A\u540D\uFF08\u53EF\u81EA\u5B9A\u4E49key\uFF09= width * height
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=325*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 com.fr.env.RemoteEnvPane.dialog=308*132
com.fr.design.version.check.dialog=230*95 com.fr.design.version.check.dialog=230*95
com.fr.design.version.detail.label=450*30 com.fr.design.version.detail.label=450*30
com.fr.design.version.detail.dialog=600*500 com.fr.design.version.detail.dialog=600*500
com.fr.env.SyncFailedPluginsDialog.messageWithLink=316*20 com.fr.env.SyncFailedPluginsDialog.messageWithLink=316*20
com.fr.design.web.pane.text.field=450*20 com.fr.design.web.pane.text.field=450*20
com.fr.design.actions.server.dialog=700*630
com.fr.design.report.fit.templatePane.dialog=600*400
com.fr.design.report.fit.firstColumn=80*20
com.fr.design.report.fit.column=100*20

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

@ -1,10 +1,14 @@
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=325*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 com.fr.env.RemoteEnvPane.dialog=308*132
com.fr.design.version.check.dialog=230*95 com.fr.design.version.check.dialog=230*95
com.fr.design.version.detail.label=450*30 com.fr.design.version.detail.label=450*30
com.fr.design.version.detail.dialog=600*500 com.fr.design.version.detail.dialog=600*500
com.fr.env.SyncFailedPluginsDialog.messageWithLink=316*20 com.fr.env.SyncFailedPluginsDialog.messageWithLink=316*20
com.fr.design.web.pane.text.field=450*20 com.fr.design.web.pane.text.field=450*20
com.fr.design.actions.server.dialog=700*630
com.fr.design.report.fit.templatePane.dialog=600*400
com.fr.design.report.fit.firstColumn=80*20
com.fr.design.report.fit.column=100*20

BIN
designer-base/src/main/resources/com/fr/design/images/bbs/studyPlan.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

1
designer-base/src/main/resources/com/fr/design/images/bbs/studyPlan_normal.svg

@ -0,0 +1 @@
<svg id="图层_1" data-name="图层 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><title>l</title><path d="M8.77.94A7.13,7.13,0,0,0,3.27,2.8,7.2,7.2,0,0,0,8.14,15.3a7.11,7.11,0,0,0,3.23-.77l-.54-1a6,6,0,1,1,2.34-2.08.59.59,0,0,0,1,.65A7.2,7.2,0,0,0,8.77.94Z"/><path d="M6.35,8.54h3.73a1.66,1.66,0,0,0,0-3.31H6.79a1.08,1.08,0,0,0-2.06.47A1.08,1.08,0,0,0,5.81,6.78a1.1,1.1,0,0,0,1-.61h3.29a.72.72,0,0,1,0,1.43H6.35a1.82,1.82,0,0,0,0,3.63H9.73a.87.87,0,0,0,.69.35.86.86,0,1,0-.73-1.29H6.35a.88.88,0,0,1,0-1.75ZM6.19,5.71a.38.38,0,1,1-.38-.38A.38.38,0,0,1,6.19,5.71ZM10.42,11a.28.28,0,0,1-.27-.28.27.27,0,0,1,.54,0A.28.28,0,0,1,10.42,11Z"/></svg>

After

Width:  |  Height:  |  Size: 655 B

15
designer-chart/src/main/java/com/fr/design/mainframe/ChartPropertyPane.java

@ -16,7 +16,6 @@ import com.fr.design.gui.chart.ChartEditPaneProvider;
import com.fr.design.gui.frpane.UITitlePanel; import com.fr.design.gui.frpane.UITitlePanel;
import com.fr.design.mainframe.chart.ChartEditPane; import com.fr.design.mainframe.chart.ChartEditPane;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.stable.AssistUtils;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.Icon; import javax.swing.Icon;
@ -36,9 +35,6 @@ public class ChartPropertyPane extends BaseChartPropertyPane {
protected ChartEditPane chartEditPane; protected ChartEditPane chartEditPane;
//ID一样的话 不用新建chartEditPane
private String currentID;
private ChartPropertyPane() { private ChartPropertyPane() {
initComponent(); initComponent();
} }
@ -50,14 +46,9 @@ public class ChartPropertyPane extends BaseChartPropertyPane {
@Override @Override
public void updateChartEditPane(String plotID) { public void updateChartEditPane(String plotID) {
if (!AssistUtils.equals(currentID, plotID)) { chartEditPane = ChartTypeInterfaceManager.getInstance().getChartEditPane(plotID);
chartEditPane = ChartTypeInterfaceManager.getInstance().getChartEditPane(plotID); chartEditPane.setContainer(container);
chartEditPane.setContainer(container); resetChartEditPane();
currentID = plotID;
resetChartEditPane();
} else {
chartEditPane.resetLastChartCollection();
}
} }
@Override @Override

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

@ -22,9 +22,11 @@ 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.gui.type.AbstractChartTypePane; import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane;
import com.fr.design.mainframe.chart.info.ChartInfoCollector; import com.fr.design.mainframe.chart.info.ChartInfoCollector;
import com.fr.design.mainframe.chart.mode.ChartEditContext;
import com.fr.form.main.Form; 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.custom.VanChartCustomPlot;
import com.fr.plugin.chart.vanchart.VanChart; import com.fr.plugin.chart.vanchart.VanChart;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -334,7 +336,10 @@ public class ChartEditPane extends BasicPane implements AttributeChange, Prepare
String chartID = chart.getID(); String chartID = chart.getID();
boolean currentPane = ChartTypeInterfaceManager.getInstance().isUseDefaultPane(chartID); boolean currentPane = ChartTypeInterfaceManager.getInstance().isUseDefaultPane(chartID);
return (currentPane != isDefaultPane) || (!currentPane && lastIndex != currentIndex); boolean duchampCustomChart = ChartEditContext.duchampMode()
&& VanChartCustomPlot.VAN_CHART_CUSTOM_PLOT_ID.equals(chartID);
return (currentPane != isDefaultPane) || (!currentPane && lastIndex != currentIndex) || duchampCustomChart;
} }
return false; return false;
} }

8
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPane.java

@ -13,6 +13,7 @@ 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.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.mainframe.chart.mode.ChartEditContext;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.FRFont; import com.fr.general.FRFont;
import com.fr.general.GeneralUtils; import com.fr.general.GeneralUtils;
@ -29,16 +30,21 @@ public class ChartTextAttrPane extends BasicPane {
private static final long serialVersionUID = 6731679928019436869L; private static final long serialVersionUID = 6731679928019436869L;
public static final int FONT_START = 6; public static final int FONT_START = 6;
public static final int FONT_END = 72; public static final int FONT_END = 72;
public static final int FONT_END_4_DUCHAMP = 200;
private UIComboBox fontNameComboBox; private UIComboBox fontNameComboBox;
private UIComboBox fontSizeComboBox; private UIComboBox fontSizeComboBox;
private UIToggleButton bold; private UIToggleButton bold;
private UIToggleButton italic; private UIToggleButton italic;
private UIColorButton fontColor; private UIColorButton fontColor;
public static Integer[] FONT_SIZES = new Integer[FONT_END - FONT_START + 1]; public static Integer[] FONT_SIZES = new Integer[FONT_END - FONT_START + 1];
private static Integer[] FONT_SIZES_4_DUCHAMP = new Integer[FONT_END_4_DUCHAMP - FONT_START + 1];
static { static {
for (int i = FONT_START; i <= FONT_END; i++) { for (int i = FONT_START; i <= FONT_END; i++) {
FONT_SIZES[i - FONT_START] = i; FONT_SIZES[i - FONT_START] = i;
} }
for (int i = FONT_START; i <= FONT_END_4_DUCHAMP; i++) {
FONT_SIZES_4_DUCHAMP[i - FONT_START] = i;
}
} }
public ChartTextAttrPane() { public ChartTextAttrPane() {
@ -176,7 +182,7 @@ public class ChartTextAttrPane extends BasicPane {
} }
protected Object[] getFontSizeComboBoxModel() { protected Object[] getFontSizeComboBoxModel() {
return FONT_SIZES; return ChartEditContext.duchampMode() ? FONT_SIZES_4_DUCHAMP : FONT_SIZES;
} }
protected void initState() { protected void initState() {

13
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPaneWithAuto.java

@ -4,23 +4,30 @@ import com.fr.chart.base.ChartConstants;
import com.fr.design.gui.ibutton.UIColorButton; import com.fr.design.gui.ibutton.UIColorButton;
import com.fr.design.gui.ibutton.UIColorButtonWithAuto; import com.fr.design.gui.ibutton.UIColorButtonWithAuto;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.plugin.chart.type.FontAutoType; import com.fr.design.mainframe.chart.mode.ChartEditContext;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.FRFont; import com.fr.general.FRFont;
import com.fr.general.GeneralUtils; import com.fr.general.GeneralUtils;
import com.fr.plugin.chart.type.FontAutoType;
public class ChartTextAttrPaneWithAuto extends ChartTextAttrPane { public class ChartTextAttrPaneWithAuto extends ChartTextAttrPane {
private static final String AUTO = Toolkit.i18nText("Fine-Design_Basic_ChartF_Auto"); private static final String AUTO = Toolkit.i18nText("Fine-Design_Basic_ChartF_Auto");
private FontAutoType type; private FontAutoType type;
public static String[] FONT_SIZES_WITH_AUTO = new String[FONT_END - FONT_START + 2]; public static String[] FONT_SIZES_WITH_AUTO = new String[FONT_END - FONT_START + 2];
private static String[] FONT_SIZES_WITH_AUTO_4_DUCHAMP = new String[FONT_END_4_DUCHAMP - FONT_START + 2];
static { static {
FONT_SIZES_WITH_AUTO[0] = AUTO; FONT_SIZES_WITH_AUTO[0] = AUTO;
FONT_SIZES_WITH_AUTO_4_DUCHAMP[0] = AUTO;
for (int i = 1; i < FONT_SIZES_WITH_AUTO.length; i++) { for (int i = 1; i < FONT_SIZES_WITH_AUTO.length; i++) {
FONT_SIZES_WITH_AUTO[i] = FONT_START + i - 1 + ""; FONT_SIZES_WITH_AUTO[i] = FONT_START + i - 1 + "";
} }
for (int i = 1; i < FONT_SIZES_WITH_AUTO_4_DUCHAMP.length; i++) {
FONT_SIZES_WITH_AUTO_4_DUCHAMP[i] = FONT_START + i - 1 + "";
}
} }
public ChartTextAttrPaneWithAuto(FontAutoType type) { public ChartTextAttrPaneWithAuto(FontAutoType type) {
@ -42,7 +49,9 @@ public class ChartTextAttrPaneWithAuto extends ChartTextAttrPane {
} }
protected Object[] getFontSizeComboBoxModel() { protected Object[] getFontSizeComboBoxModel() {
return isFontSizeAuto() ? FONT_SIZES_WITH_AUTO : FONT_SIZES; return isFontSizeAuto()
? (ChartEditContext.duchampMode() ? FONT_SIZES_WITH_AUTO_4_DUCHAMP : FONT_SIZES_WITH_AUTO)
: super.getFontSizeComboBoxModel();
} }
protected float updateFontSize() { protected float updateFontSize() {

12
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/UIColorPickerPane.java

@ -29,8 +29,6 @@ import javax.swing.JPanel;
import javax.swing.SwingConstants; 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.util.ArrayList;
import java.util.List;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
import java.awt.Component; import java.awt.Component;
@ -42,6 +40,8 @@ import java.awt.LayoutManager;
import java.awt.Point; import java.awt.Point;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.List;
public class UIColorPickerPane extends BasicPane implements UIObserver { public class UIColorPickerPane extends BasicPane implements UIObserver {
private static final int MARGIN_TOP = 7; private static final int MARGIN_TOP = 7;
@ -691,14 +691,18 @@ public class UIColorPickerPane extends BasicPane implements UIObserver {
fillStyleCombox.setSelectObject(mainColor); fillStyleCombox.setSelectObject(mainColor);
designTypeButtonGroup.setSelectedIndex(hotAreaColor.getUseType()); designTypeButtonGroup.setSelectedIndex(hotAreaColor.getUseType());
double value = (double) hotAreaColor.getAreaNumber(); int value = hotAreaColor.getAreaNumber();
UIColorPickerPane.this.add(textGroup); UIColorPickerPane.this.add(textGroup);
UIColorPickerPane.this.add(colorGroup); UIColorPickerPane.this.add(colorGroup);
Color[] colors = hotAreaColor.initColor(); Color[] colors = hotAreaColor.initColor();
BaseFormula[] values = hotAreaColor.initValues(); BaseFormula[] values = hotAreaColor.initValues();
if (value != colors.length && hotAreaColor.getUseType() == MapHotAreaColor.CUSTOM) {
colors = getColorArray(mainColor, value);
values = getValueArray(value);
}
refreshGroupPane(colors, values); refreshGroupPane(colors, values);
this.initContainerLister(); this.initContainerLister();
regionNumPane.populateBean(value); regionNumPane.populateBean((double) value);
refreshPane(); refreshPane();
} }

85
designer-chart/src/main/java/com/fr/van/chart/config/DefaultStyleConstants.java

@ -0,0 +1,85 @@
package com.fr.van.chart.config;
import com.fr.base.ChartPreStyleConfig;
import com.fr.chart.base.ChartBaseUtils;
import com.fr.chart.base.ChartConstants;
import com.fr.general.Background;
import com.fr.general.FRFont;
import com.fr.general.GeneralUtils;
import com.fr.stable.CodeUtils;
import com.fr.stable.Constants;
import java.awt.Color;
import java.awt.Font;
/**
* @author shine
* @version 10.0
* Created by shine on 2021/6/25
*/
public class DefaultStyleConstants {
static final FRFont TITLE = FRFont.getInstance(ChartBaseUtils.getLocalDefaultFont("Microsoft YaHei"), Font.BOLD, 19, new Color(241, 246, 255));
static final FRFont LEGEND = FRFont.getInstance(ChartBaseUtils.getLocalDefaultFont("Microsoft YaHei"), Font.PLAIN, 12, new Color(159, 173, 191));
static final FRFont AXIS_LABEL = FRFont.getInstance(ChartBaseUtils.getLocalDefaultFont("Microsoft YaHei"), Font.PLAIN, 12, new Color(159, 173, 191));
static final FRFont AXIS_TITLE = FRFont.getInstance(ChartBaseUtils.getLocalDefaultFont("Microsoft YaHei"), Font.PLAIN, 12, new Color(200, 211, 228));
static final Color AXIS_LINE = new Color(46, 75, 102);
static final Color GRID_LINE = new Color(30, 55, 78);
static final FRFont ALERT_FONT = FRFont.getInstance(ChartBaseUtils.getLocalDefaultFont("Microsoft YaHei"), Font.PLAIN, 12, new Color(255, 0, 0));
static final FRFont DATA_SHEET = FRFont.getInstance(ChartBaseUtils.getLocalDefaultFont("Microsoft YaHei"), Font.PLAIN, 12, new Color(159, 173, 191));
static final Color DATA_SHEET_BORDER = new Color(46, 75, 102);
static final Color BORDER = Color.BLACK;
static final int BORDER_WIDTH = Constants.LINE_NONE;
static final int SPECIAL_BORDER_WIDTH = Constants.LINE_THIN;
static final FRFont PIE_CATEGORY_LABEL = FRFont.getInstance(ChartBaseUtils.getLocalDefaultFont("Microsoft YaHei"), Font.PLAIN, 13, new Color(232, 232, 232));
static final Color GAUGE_PANE_BACK_COLOR = null;
static final Color GAUGE_HINGE = null;
static final Color GAUGE_PANE_BACK_COLOR_4_RING = new Color(72, 73, 79);
static final Color GAUGE_SLOT_BACKGROUND_COLOR = new Color(72, 73, 79);
private static final String FONT_NAME = ChartBaseUtils.getLocalDefaultFont("verdana");
static final FRFont THERMOMETER_LABEL_FONT = FRFont.getInstance(FONT_NAME, Font.BOLD, 12, new Color(232, 232, 232));//试管仪表盘标签的默认样式
static final FRFont THERMOMETER_AXIS_LABEL = FRFont.getInstance(FONT_NAME, Font.PLAIN, 11, new Color(159, 173, 191));
static final FRFont RING_VALUE_LABEL_FONT = FRFont.getInstance(FONT_NAME, Font.PLAIN, ChartConstants.AUTO_FONT_SIZE, new Color(232, 232, 232));//百分比圆环仪表盘值标签的默认样式
static final FRFont POINTER_VALUE_LABEL_FONT = FRFont.getInstance(FONT_NAME, Font.PLAIN, ChartConstants.AUTO_FONT_SIZE, new Color(232, 232, 232));//多指针仪表盘值标签的默认样式
static final FRFont POINTER_CATE_LABEL_FONT = FRFont.getInstance(FONT_NAME, Font.PLAIN, 13, new Color(232, 232, 232));//多指针仪表盘分类标签的默认样式
static final Color MAP_NULL_VALUE_COLOR = new Color(168, 168, 168);
static final Color MAP_BORDER = Color.BLACK;
static final Color MAP_LEGEND_BACK = Color.BLACK;
static final Color MAP_TITLE_BACK = Color.BLACK;
static final Color DRILL_MAP_DRILL_TOOLS_BACK = Color.BLACK;
static final float DRILL_MAP_DRILL_TOOLS_BACK_OPACITY = 0.8f;
static final Background BACK = null;
static String COLORS = null;
static {
ChartPreStyleConfig config = ChartPreStyleConfig.getInstance();
try {
DefaultStyleConstants.COLORS = CodeUtils.cjkDecode("\u7ecf\u5178\u9ad8\u4eae");
// 没有经典高亮, 用新特性
if (config.getPreStyle(DefaultStyleConstants.COLORS) == null) {
DefaultStyleConstants.COLORS = CodeUtils.cjkDecode("\u65b0\u7279\u6027");
}
// 没有新特性, 用第一个配色
if (config.getPreStyle(DefaultStyleConstants.COLORS) == null) {
if (config.names().hasNext()) {
String name = GeneralUtils.objectToString(config.names().next());
if (config.getPreStyle(name) != null) {
DefaultStyleConstants.COLORS = name;
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}

207
designer-chart/src/main/java/com/fr/van/chart/config/DefaultStyleHelper4Van.java

@ -0,0 +1,207 @@
package com.fr.van.chart.config;
import com.fr.base.ChartColorMatching;
import com.fr.base.ChartPreStyleConfig;
import com.fr.chart.base.AttrBorder;
import com.fr.chart.base.AttrFillStyle;
import com.fr.chart.base.ChartConstants;
import com.fr.chart.chartattr.Plot;
import com.fr.chart.chartglyph.ConditionAttr;
import com.fr.chart.chartglyph.DataSheet;
import com.fr.config.predefined.ColorFillStyle;
import com.fr.design.mainframe.chart.mode.ChartEditContext;
import com.fr.plugin.chart.PiePlot4VanChart;
import com.fr.plugin.chart.attr.axis.VanChartAlertValue;
import com.fr.plugin.chart.attr.axis.VanChartAxis;
import com.fr.plugin.chart.attr.plot.VanChartPlot;
import com.fr.plugin.chart.attr.plot.VanChartRectanglePlot;
import com.fr.plugin.chart.base.AttrLabel;
import com.fr.plugin.chart.base.AttrLabelDetail;
import com.fr.plugin.chart.custom.type.CustomPlotType;
import com.fr.plugin.chart.gauge.VanChartGaugePlot;
import com.fr.plugin.chart.map.VanChartMapPlot;
import com.fr.plugin.chart.type.GaugeStyle;
/**
* @author shine
* @version 10.0
* Created by shine on 2021/10/22
* vanchart的抽出来因为主体代码 新增y轴 组合图新增图表都要用
*/
public class DefaultStyleHelper4Van {
private static boolean duchampMode() {
try {
return ChartEditContext.duchampMode();
} catch (Throwable e) {
//tomcat预览 默认数据的图表
return true;
}
}
public static void dealVanPlot4Custom(VanChartPlot plot, CustomPlotType customPlotType) {
if (!duchampMode()) {
return;
}
dealVanPlotCommonAttr(plot);
switch (customPlotType) {
case PIE:
case DIFFERENT_PIE:
case SAME_PIE:
dealPie(plot);
break;
case SLOT:
case POINTER_360:
case POINTER_180:
case CUVETTE:
case RING:
dealGauge(plot);
break;
case COLUMN:
case LINE:
case AREA:
case BUBBLE:
case RADAR:
case STACK_RADAR:
case SCATTER:
default:
break;
}
}
public static VanChartAxis dealAxisDefault(VanChartAxis axis) {
if (!duchampMode()) {
return axis;
}
axis.getTitle().getTextAttr().setFRFont(DefaultStyleConstants.AXIS_TITLE);
axis.getTextAttr().setFRFont(DefaultStyleConstants.AXIS_LABEL);
axis.setAxisColor(DefaultStyleConstants.AXIS_LINE);
axis.setMainGridColor(DefaultStyleConstants.GRID_LINE);
return axis;
}
public static void dealAxisAlert(VanChartAlertValue vanChartAlertValue) {
if (!duchampMode()) {
return;
}
vanChartAlertValue.setAlertFont(DefaultStyleConstants.ALERT_FONT);
}
static void dealVanPlotCommonAttr(Plot plot) {
if (!duchampMode()) {
return;
}
if (plot instanceof VanChartPlot) {
VanChartPlot vanChartPlot = (VanChartPlot) plot;
ChartPreStyleConfig manager = ChartPreStyleConfig.getInstance();
Object preStyle = manager.getPreStyle(DefaultStyleConstants.COLORS);
if (preStyle instanceof ChartColorMatching) {
ColorFillStyle colorFillStyle = new ColorFillStyle();
//default是默认的意思,为服务器默认配色方案
//acc为多个颜色组合
//gradient为渐变颜色
colorFillStyle.setColorStyle(ChartConstants.COLOR_ACC);
colorFillStyle.setFillStyleName(DefaultStyleConstants.COLORS);
colorFillStyle.setColorList(((ChartColorMatching) preStyle).getColorList());
AttrFillStyle plotFillStyle = vanChartPlot.getPlotFillStyle();
if (plotFillStyle == null) {
plotFillStyle = new AttrFillStyle();
vanChartPlot.setPlotFillStyle(plotFillStyle);
}
plotFillStyle.setColorFillStyle(colorFillStyle);
}
if (vanChartPlot.getLegend() != null) {
vanChartPlot.getLegend().setFRFont(DefaultStyleConstants.LEGEND);
}
if (vanChartPlot instanceof VanChartRectanglePlot) {
VanChartRectanglePlot vanChartRectanglePlot = (VanChartRectanglePlot) vanChartPlot;
for (VanChartAxis axis : vanChartRectanglePlot.getXAxisList()) {
dealAxisDefault(axis);
}
for (VanChartAxis axis : vanChartRectanglePlot.getYAxisList()) {
dealAxisDefault(axis);
}
}
dealBorder(vanChartPlot);
DataSheet dataSheet = vanChartPlot.getDataSheet();
dataSheet.getTextAttr().setFRFont(DefaultStyleConstants.DATA_SHEET);
dataSheet.setBorderColor(DefaultStyleConstants.DATA_SHEET_BORDER);
}
}
private static void dealBorder(VanChartPlot vanChartPlot) {
ConditionAttr defaultAttr = vanChartPlot.getConditionCollection().getDefaultAttr();
AttrBorder attrBorder = defaultAttr.getExisted(AttrBorder.class);
if (attrBorder != null) {
attrBorder.setBorderColor(DefaultStyleConstants.BORDER);
attrBorder.setBorderStyle(defaultBorderWidth(vanChartPlot));
}
}
private static int defaultBorderWidth(VanChartPlot vanChartPlot) {
//pie multipie treemap map drillmap heatmap
if (vanChartPlot instanceof PiePlot4VanChart
|| vanChartPlot instanceof VanChartMapPlot) {
return DefaultStyleConstants.SPECIAL_BORDER_WIDTH;
}
return DefaultStyleConstants.BORDER_WIDTH;
}
static void dealPie(Plot plot) {
if (plot instanceof PiePlot4VanChart) {
ConditionAttr defaultAttr = plot.getConditionCollection().getDefaultAttr();
AttrLabel attrLabel = defaultAttr.getExisted(AttrLabel.class);
if (attrLabel == null) {
attrLabel = ((PiePlot4VanChart) plot).getDefaultAttrLabel();
defaultAttr.addDataSeriesCondition(attrLabel);
}
attrLabel.getSecondLabelDetail().getTextAttr().setFRFont(DefaultStyleConstants.PIE_CATEGORY_LABEL);
}
}
static void dealGauge(Plot param) {
if (!(param instanceof VanChartGaugePlot)) {
return;
}
VanChartGaugePlot plot = (VanChartGaugePlot) param;
plot.getGaugeDetailStyle().setPaneBackgroundColor(plot.getGaugeStyle() == GaugeStyle.RING ? DefaultStyleConstants.GAUGE_PANE_BACK_COLOR_4_RING : DefaultStyleConstants.GAUGE_PANE_BACK_COLOR);
plot.getGaugeDetailStyle().setSlotBackgroundColor(DefaultStyleConstants.GAUGE_SLOT_BACKGROUND_COLOR);
plot.getGaugeDetailStyle().setHingeColor(DefaultStyleConstants.GAUGE_HINGE);
ConditionAttr defaultAttr = plot.getConditionCollection().getDefaultAttr();
AttrLabel attrLabel = defaultAttr.getExisted(AttrLabel.class);
if (attrLabel != null) {
AttrLabelDetail detail = attrLabel.getAttrLabelDetail();
AttrLabelDetail valueDetail = attrLabel.getGaugeValueLabelDetail();
switch (plot.getGaugeStyle()) {
case POINTER:
case POINTER_SEMI:
detail.getContent().getCategoryFormat().setEnable(false);
detail.getTextAttr().setFRFont(DefaultStyleConstants.POINTER_CATE_LABEL_FONT);
valueDetail.getTextAttr().setFRFont(DefaultStyleConstants.POINTER_VALUE_LABEL_FONT);
break;
case RING:
case SLOT:
valueDetail.getTextAttr().setFRFont(DefaultStyleConstants.RING_VALUE_LABEL_FONT);
break;
case THERMOMETER:
detail.getTextAttr().setFRFont(DefaultStyleConstants.THERMOMETER_LABEL_FONT);
valueDetail.getTextAttr().setFRFont(DefaultStyleConstants.THERMOMETER_LABEL_FONT);
plot.getGaugeAxis().getTextAttr().setFRFont(DefaultStyleConstants.THERMOMETER_AXIS_LABEL);
break;
}
}
}
}

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

@ -6,13 +6,13 @@ import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
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.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;
import com.fr.plugin.chart.custom.CustomPlotFactory; import com.fr.plugin.chart.custom.CustomPlotFactory;
import com.fr.plugin.chart.custom.VanChartCustomPlot; 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.plugin.chart.custom.type.CustomStyle; import com.fr.plugin.chart.custom.type.CustomStyle;
import com.fr.van.chart.config.DefaultStyleHelper4Van;
import com.fr.van.chart.custom.CustomPlotDesignerPaneFactory; import com.fr.van.chart.custom.CustomPlotDesignerPaneFactory;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
@ -260,6 +260,7 @@ public class VanChartCustomPlotSelectPane extends BasicBeanPane<Chart> {
CustomPlotType customPlotType = selectedPlotTypeList.get(i); CustomPlotType customPlotType = selectedPlotTypeList.get(i);
if (!CustomPlotFactory.customPlotContains(newCustomPlotList, customPlotType)){ if (!CustomPlotFactory.customPlotContains(newCustomPlotList, customPlotType)){
VanChartPlot vanChartPlot = CustomPlotFactory.getCustomPlot(customPlotType); VanChartPlot vanChartPlot = CustomPlotFactory.getCustomPlot(customPlotType);
DefaultStyleHelper4Van.dealVanPlot4Custom(vanChartPlot, customPlotType);
vanChartPlot.setCustomType(CustomStyle.CUSTOM.toString()); vanChartPlot.setCustomType(CustomStyle.CUSTOM.toString());
//设置公共属性 //设置公共属性
setCommonAttr(vanChartPlot, customPlot); setCommonAttr(vanChartPlot, customPlot);

7
designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartHtmlLabelPane.java

@ -5,6 +5,7 @@ import com.fr.design.constants.KeyWords;
import com.fr.design.gui.autocomplete.AutoCompletion; import com.fr.design.gui.autocomplete.AutoCompletion;
import com.fr.design.gui.autocomplete.BasicCompletion; import com.fr.design.gui.autocomplete.BasicCompletion;
import com.fr.design.gui.autocomplete.DefaultCompletionProvider; import com.fr.design.gui.autocomplete.DefaultCompletionProvider;
import com.fr.design.gui.frpane.AbstractAttrNoScrollPane;
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.icontainer.UIScrollPane; import com.fr.design.gui.icontainer.UIScrollPane;
@ -45,7 +46,7 @@ public class VanChartHtmlLabelPane extends JPanel {
private UICheckBox isCustomHeight; private UICheckBox isCustomHeight;
private UITextField customHeight; private UITextField customHeight;
private VanChartStylePane parent; private AbstractAttrNoScrollPane parent;
private JPanel widthAndHeightPane; private JPanel widthAndHeightPane;
@ -53,7 +54,7 @@ public class VanChartHtmlLabelPane extends JPanel {
contentTextArea.setText(text); contentTextArea.setText(text);
} }
public void setParent(VanChartStylePane parent) { public void setParent(AbstractAttrNoScrollPane parent) {
this.parent = parent; this.parent = parent;
} }
@ -126,7 +127,7 @@ public class VanChartHtmlLabelPane extends JPanel {
}; };
} }
private void fireJSChange() { protected void fireJSChange() {
if (parent != null) { if (parent != null) {
parent.attributeChanged(); parent.attributeChanged();
} }

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

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

7
designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartAxisPane.java

@ -14,16 +14,17 @@ import com.fr.plugin.chart.attr.plot.VanChartRectanglePlot;
import com.fr.plugin.chart.base.AttrSeriesStackAndAxis; import com.fr.plugin.chart.base.AttrSeriesStackAndAxis;
import com.fr.plugin.chart.base.VanChartConstants; import com.fr.plugin.chart.base.VanChartConstants;
import com.fr.plugin.chart.vanchart.VanChart; import com.fr.plugin.chart.vanchart.VanChart;
import com.fr.van.chart.config.DefaultStyleHelper4Van;
import com.fr.van.chart.designer.style.VanChartStylePane; import com.fr.van.chart.designer.style.VanChartStylePane;
import com.fr.van.chart.designer.style.axis.component.VanChartAxisButtonPane; import com.fr.van.chart.designer.style.axis.component.VanChartAxisButtonPane;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.awt.BorderLayout;
import java.awt.CardLayout;
/** /**
* 样式-坐标轴界面 * 样式-坐标轴界面
@ -104,6 +105,7 @@ public class VanChartAxisPane extends BasicBeanPane<VanChart> {
List<VanChartAxis> xAxisList = editingPlot.getXAxisList(); List<VanChartAxis> xAxisList = editingPlot.getXAxisList();
VanChartAxis axis = editingPlot.createXAxis(name, VanChartConstants.AXIS_BOTTOM); VanChartAxis axis = editingPlot.createXAxis(name, VanChartConstants.AXIS_BOTTOM);
xAxisList.add(axis); xAxisList.add(axis);
DefaultStyleHelper4Van.dealAxisDefault(axis);
VanChartXYAxisPaneInterface axisPane = initXAxisPane(axis); VanChartXYAxisPaneInterface axisPane = initXAxisPane(axis);
axisPane.populate(axis); axisPane.populate(axis);
@ -119,6 +121,7 @@ public class VanChartAxisPane extends BasicBeanPane<VanChart> {
List<VanChartAxis> yAxisList = editingPlot.getYAxisList(); List<VanChartAxis> yAxisList = editingPlot.getYAxisList();
VanChartAxis axis = editingPlot.createYAxis(name, VanChartConstants.AXIS_LEFT); VanChartAxis axis = editingPlot.createYAxis(name, VanChartConstants.AXIS_LEFT);
yAxisList.add(axis); yAxisList.add(axis);
DefaultStyleHelper4Van.dealAxisDefault(axis);
VanChartXYAxisPaneInterface axisPane = initYAxisPane(axis); VanChartXYAxisPaneInterface axisPane = initYAxisPane(axis);
axisPane.populate(axis); axisPane.populate(axis);

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

@ -1,15 +1,16 @@
package com.fr.van.chart.designer.style.axis; package com.fr.van.chart.designer.style.axis;
import com.fr.chart.chartattr.Axis; import com.fr.chart.chartattr.Axis;
import com.fr.design.i18n.Toolkit;
import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.gui.frpane.UIComboBoxPane; import com.fr.design.gui.frpane.UIComboBoxPane;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.chart.PaneTitleConstants; import com.fr.design.mainframe.chart.PaneTitleConstants;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.plugin.chart.attr.axis.VanChartAxis; import com.fr.plugin.chart.attr.axis.VanChartAxis;
import com.fr.plugin.chart.attr.axis.VanChartTimeAxis; import com.fr.plugin.chart.attr.axis.VanChartTimeAxis;
import com.fr.plugin.chart.attr.axis.VanChartValueAxis; import com.fr.plugin.chart.attr.axis.VanChartValueAxis;
import com.fr.plugin.chart.type.AxisType; import com.fr.plugin.chart.type.AxisType;
import com.fr.van.chart.config.DefaultStyleHelper4Van;
import com.fr.van.chart.designer.AbstractVanChartScrollPane; import com.fr.van.chart.designer.AbstractVanChartScrollPane;
import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.style.VanChartStylePane; import com.fr.van.chart.designer.style.VanChartStylePane;
@ -83,9 +84,9 @@ public class VanChartAxisScrollPaneWithTypeSelect extends AbstractVanChartScroll
public void populate(VanChartAxis axis){ public void populate(VanChartAxis axis){
AxisType axisType = axis.getAxisType(); AxisType axisType = axis.getAxisType();
textAxisPane.populateBean(new VanChartAxis(axis.getAxisName(), axis.getPosition())); textAxisPane.populateBean(DefaultStyleHelper4Van.dealAxisDefault(new VanChartAxis(axis.getAxisName(), axis.getPosition())));
timeAxisPane.populateBean(new VanChartTimeAxis(axis.getAxisName(), axis.getPosition())); timeAxisPane.populateBean(DefaultStyleHelper4Van.dealAxisDefault(new VanChartTimeAxis(axis.getAxisName(), axis.getPosition())));
valueAxisPane.populateBean(new VanChartValueAxis(axis.getAxisName(), axis.getPosition())); valueAxisPane.populateBean(DefaultStyleHelper4Van.dealAxisDefault(new VanChartValueAxis(axis.getAxisName(), axis.getPosition())));
if(ComparatorUtils.equals(axisType, AxisType.AXIS_CATEGORY)){ if(ComparatorUtils.equals(axisType, AxisType.AXIS_CATEGORY)){
textAxisPane.populateBean(axis); textAxisPane.populateBean(axis);
} else if(ComparatorUtils.equals(axisType, AxisType.AXIS_TIME)){ } else if(ComparatorUtils.equals(axisType, AxisType.AXIS_TIME)){

4
designer-chart/src/main/java/com/fr/van/chart/designer/style/background/ChartNameObjectCreator.java

@ -3,10 +3,11 @@ package com.fr.van.chart.designer.style.background;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.controlpane.NameObjectCreator; import com.fr.design.gui.controlpane.NameObjectCreator;
import com.fr.design.gui.controlpane.UnrepeatedNameHelper; import com.fr.design.gui.controlpane.UnrepeatedNameHelper;
import com.fr.log.FineLoggerFactory;
import com.fr.general.NameObject; import com.fr.general.NameObject;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.chart.attr.axis.VanChartAlertValue; import com.fr.plugin.chart.attr.axis.VanChartAlertValue;
import com.fr.stable.Nameable; import com.fr.stable.Nameable;
import com.fr.van.chart.config.DefaultStyleHelper4Van;
import java.lang.reflect.Constructor; import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
@ -37,6 +38,7 @@ public class ChartNameObjectCreator extends NameObjectCreator {
VanChartAlertValue vanChartAlertValue = constructor.newInstance(); VanChartAlertValue vanChartAlertValue = constructor.newInstance();
vanChartAlertValue.setAxisNamesArray((String[]) object); vanChartAlertValue.setAxisNamesArray((String[]) object);
vanChartAlertValue.setAxisName(((String[]) object)[0]); vanChartAlertValue.setAxisName(((String[]) object)[0]);
DefaultStyleHelper4Van.dealAxisAlert(vanChartAlertValue);
return new NameObject(helper.createUnrepeatedName(this.menuName()), vanChartAlertValue); return new NameObject(helper.createUnrepeatedName(this.menuName()), vanChartAlertValue);
} catch (NoSuchMethodException e) { } catch (NoSuchMethodException e) {

43
designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRCardMainBorderLayoutAdapter.java

@ -1,14 +1,17 @@
package com.fr.design.designer.beans.adapters.layout; package com.fr.design.designer.beans.adapters.layout;
import com.fr.design.designer.beans.models.AddingModel;
import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.cardlayout.XWCardTagLayout; import com.fr.design.designer.creator.cardlayout.XWCardTagLayout;
import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.form.layout.FRBorderLayout; import com.fr.design.form.layout.FRBorderLayout;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import javax.swing.JOptionPane;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Rectangle; import java.awt.Rectangle;
@ -46,18 +49,34 @@ public class FRCardMainBorderLayoutAdapter extends FRBorderLayoutAdapter {
Rectangle rectangle = creator.getBounds(); Rectangle rectangle = creator.getBounds();
//不能超出控件边界 //不能超出控件边界
if (ComparatorUtils.equals(constraints, BorderLayout.NORTH) || ComparatorUtils.equals(constraints, BorderLayout.SOUTH)) { if (ComparatorUtils.equals(constraints, BorderLayout.NORTH) || ComparatorUtils.equals(constraints, BorderLayout.SOUTH)) {
int containerHeight = container.getHeight(); return isBeyondMinConstraint(rectangle.height, container.getHeight());
if (rectangle.height > containerHeight) {
FineJOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Beyond_Tablayout_Bounds"));
return true;
}
} else if (ComparatorUtils.equals(constraints, BorderLayout.EAST) || ComparatorUtils.equals(constraints, BorderLayout.WEST)) { } else if (ComparatorUtils.equals(constraints, BorderLayout.EAST) || ComparatorUtils.equals(constraints, BorderLayout.WEST)) {
int containerWidth = container.getWidth(); return isBeyondMinConstraint(rectangle.width, container.getWidth());
if (rectangle.width > containerWidth) {
FineJOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Beyond_Tablayout_Bounds"));
return true;
}
} }
return false; return false;
} }
/**
* 是否超出最小限制
*
* @param minConstraint 最小限制
* @param value 数值
* @return 是否超出最小限制
*/
private boolean isBeyondMinConstraint(int minConstraint, int value) {
if (minConstraint > value) {
FineJOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Beyond_Tablayout_Bounds"));
JTemplate<?, ?> jt = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
if (jt != null) {
jt.undoToCurrent();
}
FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner();
AddingModel model = formDesigner.getAddingModel();
model.setAddedIllegal(true);
return true;
} else {
return false;
}
}
} }

9
designer-form/src/main/java/com/fr/design/designer/beans/models/AddingModel.java

@ -24,6 +24,7 @@ public class AddingModel {
private int currentX; private int currentX;
private int currentY; private int currentY;
private boolean added; private boolean added;
private boolean addedIllegal = false; // 有时候是添加完成了,但是添加会造成某些控件size不合法,例如tab
public AddingModel(FormDesigner designer, XCreator xCreator) { public AddingModel(FormDesigner designer, XCreator xCreator) {
this.creator = xCreator; this.creator = xCreator;
@ -142,4 +143,12 @@ public class AddingModel {
y + designer.getVerticalScaleValue() - rect.y); y + designer.getVerticalScaleValue() - rect.y);
return added; return added;
} }
public boolean isAddedIllegal() {
return addedIllegal;
}
public void setAddedIllegal(boolean addedIllegal) {
this.addedIllegal = addedIllegal;
}
} }

5
designer-form/src/main/java/com/fr/design/designer/creator/XChartEditor.java

@ -363,4 +363,9 @@ public class XChartEditor extends XBorderStyleWidgetCreator {
return false; return false;
} }
@Override
public boolean isComponent() {
return true;
}
} }

11
designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java

@ -11,6 +11,7 @@ import com.fr.design.designer.beans.AdapterBus;
import com.fr.design.designer.beans.ComponentAdapter; import com.fr.design.designer.beans.ComponentAdapter;
import com.fr.design.designer.beans.events.DesignerEditor; import com.fr.design.designer.beans.events.DesignerEditor;
import com.fr.design.designer.beans.models.SelectionModel; import com.fr.design.designer.beans.models.SelectionModel;
import com.fr.design.designer.ui.PopupDialogContext;
import com.fr.design.designer.ui.SelectedPopupDialog; import com.fr.design.designer.ui.SelectedPopupDialog;
import com.fr.design.fun.ShareWidgetUIProcessor; import com.fr.design.fun.ShareWidgetUIProcessor;
import com.fr.design.fun.WidgetPropertyUIProvider; import com.fr.design.fun.WidgetPropertyUIProvider;
@ -778,6 +779,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
if (popup == null) { if (popup == null) {
popup = new SelectedPopupDialog(this, designer); popup = new SelectedPopupDialog(this, designer);
} }
PopupDialogContext.checkSelectedPop(this);
JFrame frame = LogMessageBar.getInstance().getLogFrame(); JFrame frame = LogMessageBar.getInstance().getLogFrame();
if (frame!= null && frame.isActive()) { if (frame!= null && frame.isActive()) {
return; return;
@ -876,6 +878,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
if (popup != null) { if (popup != null) {
popup.setVisible(false); popup.setVisible(false);
} }
PopupDialogContext.checkSelectedPop(this);
} }
public void processPopup(boolean canVisible) { public void processPopup(boolean canVisible) {
@ -894,4 +897,12 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
} }
return ((XCreator) this.getParent()).getLevel() + 1; return ((XCreator) this.getParent()).getLevel() + 1;
} }
/**
* 是否是组件控件还是组件
* @return 是否是组件
*/
public boolean isComponent() {
return false;
}
} }

45
designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java

@ -57,6 +57,7 @@ import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout;
import com.fr.form.ui.container.cardlayout.WCardTagLayout; import com.fr.form.ui.container.cardlayout.WCardTagLayout;
import com.fr.form.ui.container.cardlayout.WCardTitleLayout; import com.fr.form.ui.container.cardlayout.WCardTitleLayout;
import com.fr.form.ui.container.cardlayout.WTabFitLayout; import com.fr.form.ui.container.cardlayout.WTabFitLayout;
import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralContext; import com.fr.general.GeneralContext;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.invoke.Reflect; import com.fr.invoke.Reflect;
@ -68,6 +69,7 @@ import com.fr.plugin.observer.PluginEvent;
import com.fr.plugin.observer.PluginEventListener; import com.fr.plugin.observer.PluginEventListener;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.third.javax.annotation.Nonnull; import com.fr.third.javax.annotation.Nonnull;
import java.util.Set;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import javax.swing.Icon; import javax.swing.Icon;
@ -356,4 +358,47 @@ public class XCreatorUtils {
} }
return null; return null;
} }
/**
* 把控件例如textEditor外层的容器剥掉
* @param xCreator 控件
* @return 内层控件
*/
public static XCreator getXCreatorInnerWidget(XCreator xCreator) {
if (xCreator.acceptType(XWScaleLayout.class)) {
if (xCreator.getComponentCount() > 0 && ((XCreator) xCreator.getComponent(0)).shouldScaleCreator()) {
return (XCreator) xCreator.getComponent(0);
}
}
if (xCreator.acceptType(XWTitleLayout.class)) {
return (XCreator) xCreator.getComponent(0);
}
return xCreator;
}
public static boolean isExtraContainer(XCreator creator) {
Set<FormWidgetOptionProvider> set = ExtraDesignClassManager.getInstance().getArray(FormWidgetOptionProvider.XML_TAG);
for (FormWidgetOptionProvider provider : set) {
if (provider.isContainer()
&& ComparatorUtils.equals(provider.appearanceForWidget(), provider.appearanceForWidget())
&& ComparatorUtils.equals(provider.classForWidget(), creator.toData().getClass())) {
return true;
}
}
return false;
}
public static XLayoutContainer getParent(XCreator source) {
if (source.acceptType(XWCardTagLayout.class) ) {
return (XLayoutContainer)source.getParent();
}
XLayoutContainer container = XCreatorUtils.getParentXLayoutContainer(source);
boolean accept = (source.acceptType(XWFitLayout.class) || source.acceptType(XWParameterLayout.class)) && !isExtraContainer(source);
if (accept) {
container = null;
}
return container;
}
} }

5
designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java

@ -365,4 +365,9 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
public void releaseResources() { public void releaseResources() {
imageLable.setIcon(null); imageLable.setIcon(null);
} }
@Override
public boolean isComponent() {
return true;
}
} }

5
designer-form/src/main/java/com/fr/design/designer/creator/XLayoutContainer.java

@ -586,4 +586,9 @@ public abstract class XLayoutContainer extends XBorderStyleWidgetCreator impleme
public void setDragInAble(boolean dragInAble) { public void setDragInAble(boolean dragInAble) {
this.dragInAble = dragInAble; this.dragInAble = dragInAble;
} }
@Override
public boolean isComponent() {
return true;
}
} }

18
designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardLayout.java

@ -62,10 +62,6 @@ public class XWCardLayout extends XLayoutContainer {
public static final String DEFAULT_NAME = "cardlayout"; public static final String DEFAULT_NAME = "cardlayout";
//默认蓝色标题背景
private static final Color TITLE_COLOR = new Color(51, 132, 240);
public XWCardLayout(WCardLayout widget, Dimension initSize) { public XWCardLayout(WCardLayout widget, Dimension initSize) {
super(widget, initSize); super(widget, initSize);
} }
@ -399,24 +395,10 @@ public class XWCardLayout extends XLayoutContainer {
@Override @Override
public void refreshStylePreviewEffect() { public void refreshStylePreviewEffect() {
BorderPacker style = toData().getBorderStyle(); BorderPacker style = toData().getBorderStyle();
initBorderTitleStyle(style);
refreshBorderAndBackgroundStylePreviewEffect(); refreshBorderAndBackgroundStylePreviewEffect();
clearOrShowTitleLayout(ComparatorUtils.equals(style.getType(), LayoutBorderStyle.TITLE)); clearOrShowTitleLayout(ComparatorUtils.equals(style.getType(), LayoutBorderStyle.TITLE));
} }
private void initBorderTitleStyle(BorderPacker style) {
//初始化默认标题样式
if (!initFlag) {
return;
}
style.setType(LayoutBorderStyle.TITLE);
style.setBorder(Constants.LINE_THIN);
TitlePacker widgetTitle = style.getTitle();
widgetTitle.setBackground(ColorBackground.getInstance(TITLE_COLOR));
initFlag = false;
}
//隐藏或显示标题部分 //隐藏或显示标题部分
protected void clearOrShowTitleLayout(boolean isTitleStyle) { protected void clearOrShowTitleLayout(boolean isTitleStyle) {
XWCardMainBorderLayout mainLayout = (XWCardMainBorderLayout) this.getBackupParent(); XWCardMainBorderLayout mainLayout = (XWCardMainBorderLayout) this.getBackupParent();

47
designer-form/src/main/java/com/fr/design/designer/ui/PopupDialogContext.java

@ -0,0 +1,47 @@
package com.fr.design.designer.ui;
import com.fr.design.designer.creator.XCreator;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
/**
* 把弹窗统一管理起来 防止出现异常情况下游离的弹窗
*
* @author hades
* @version 10.0
* Created by hades on 2021/11/02
*/
public class PopupDialogContext {
private static List<SelectedPopupDialog> dialogs = new ArrayList<>();
public static void add(SelectedPopupDialog selectedPopupDialog) {
if (dialogs.contains(selectedPopupDialog)) {
return;
}
dialogs.add(selectedPopupDialog);
}
public static void remove(SelectedPopupDialog selectedPopupDialog) {
dialogs.remove(selectedPopupDialog);
}
public static void checkSelectedPop(XCreator creator) {
Iterator<SelectedPopupDialog> iterator = dialogs.iterator();
List<SelectedPopupDialog> removedDialog = new ArrayList<>();
while (iterator.hasNext()) {
SelectedPopupDialog dialog = iterator.next();
if (dialog.isVisible() && creator != dialog.getCreator()) {
iterator.remove();
removedDialog.add(dialog);
}
}
for (SelectedPopupDialog dialog : removedDialog) {
dialog.setVisible(false);
}
}
}

17
designer-form/src/main/java/com/fr/design/designer/ui/SelectedPopupDialog.java

@ -25,11 +25,14 @@ public class SelectedPopupDialog extends JDialog {
private boolean canVisible = true; private boolean canVisible = true;
private final XCreator creator;
public SelectedPopupDialog(XCreator creator, FormDesigner designer) { public SelectedPopupDialog(XCreator creator, FormDesigner designer) {
super(OperatingSystem.isMacos() ? new JFrame() : DesignerContext.getDesignerFrame()); super(OperatingSystem.isMacos() ? new JFrame() : DesignerContext.getDesignerFrame());
this.setUndecorated(true); this.setUndecorated(true);
this.setModal(false); this.setModal(false);
this.setFocusableWindowState(false); this.setFocusableWindowState(false);
this.creator = creator;
controlPanel = new PopupControlPanel(creator, designer); controlPanel = new PopupControlPanel(creator, designer);
this.getContentPane().add(controlPanel); this.getContentPane().add(controlPanel);
this.setSize(controlPanel.getDefaultDimension()); this.setSize(controlPanel.getDefaultDimension());
@ -44,6 +47,16 @@ public class SelectedPopupDialog extends JDialog {
return controlPanel.hasVisibleButtons(); return controlPanel.hasVisibleButtons();
} }
@Override
public void setVisible(boolean visible) {
super.setVisible(visible);
if (visible) {
PopupDialogContext.add(this);
} else {
PopupDialogContext.remove(this);
}
}
public void setRelativeBounds(Rectangle rectangle) { public void setRelativeBounds(Rectangle rectangle) {
this.controlPanel.setRelativeBounds(rectangle); this.controlPanel.setRelativeBounds(rectangle);
} }
@ -55,4 +68,8 @@ public class SelectedPopupDialog extends JDialog {
public void setCanVisible(boolean canVisible) { public void setCanVisible(boolean canVisible) {
this.canVisible = canVisible; this.canVisible = canVisible;
} }
public XCreator getCreator() {
return this.creator;
}
} }

27
designer-form/src/main/java/com/fr/design/gui/xpane/BorderLineAndImagePane.java

@ -31,6 +31,7 @@ import com.fr.env.utils.DesignerInteractionHistory;
import com.fr.form.ui.LayoutBorderStyle; import com.fr.form.ui.LayoutBorderStyle;
import com.fr.general.Background; import com.fr.general.Background;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.i18n.UrlI18nManager;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.stable.GraphDrawHelper; import com.fr.stable.GraphDrawHelper;
import com.fr.stable.ProjectLibrary; import com.fr.stable.ProjectLibrary;
@ -121,7 +122,7 @@ public class BorderLineAndImagePane extends JPanel implements UIObserver {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
Desktop desktop = Desktop.getDesktop(); Desktop desktop = Desktop.getDesktop();
try { try {
desktop.browse(new URI(TWEAK_NINE_POINT_HELP_URL)); desktop.browse(new URI(UrlI18nManager.getInstance().getI18nUrl("nine.point.help")));
} catch (IOException | URISyntaxException ioException) { } catch (IOException | URISyntaxException ioException) {
ioException.printStackTrace(); ioException.printStackTrace();
} }
@ -297,15 +298,16 @@ public class BorderLineAndImagePane extends JPanel implements UIObserver {
Background borderImage = style.getBorderImage(); Background borderImage = style.getBorderImage();
if (borderImage instanceof ImageBackground) { if (borderImage instanceof ImageBackground) {
// 图片类型边框 // 图片类型边框
Image image = ((ImageBackground) borderImage).getImage(); ImageBackground imageBackground = (ImageBackground) borderImage;
int[] ninePoint = ((ImageBackground) borderImage).getNinePoint(); Image image = imageBackground.getImage();
if (image != null) { if (image != null) {
this.borderLineCombo.selectBorderImage(); this.borderLineCombo.selectBorderImage();
this.imagePreviewPane.setImageWithSuffix(((ImageBackground) borderImage).getImageWithSuffix()); this.imagePreviewPane.setImageWithSuffix(((ImageBackground) borderImage).getImageWithSuffix());
this.tweakNinePointButton.setEnabled(true); this.tweakNinePointButton.setEnabled(true);
this.borderImageOpacityPane.populateBean(style.getBorderImageOpacity()); this.borderImageOpacityPane.populateBean(style.getBorderImageOpacity());
if (ninePoint != null && ninePoint.length == 4 && ninePoint[0] > 0 && ninePoint[1] > 0 && ninePoint[2] > 0 && ninePoint[3] > 0) { int[] ninePoint = ((ImageBackground) borderImage).getNinePoint();
if (ninePoint != null && ninePoint.length == 4 && ninePoint[0] >= 0 && ninePoint[1] >= 0 && ninePoint[2] >= 0 && ninePoint[3] >= 0) {
this.ninePoint = Arrays.copyOf(ninePoint, 4); this.ninePoint = Arrays.copyOf(ninePoint, 4);
} else { } else {
this.ninePoint = new int[4]; this.ninePoint = new int[4];
@ -502,6 +504,7 @@ public class BorderLineAndImagePane extends JPanel implements UIObserver {
private int ninePointBottom = -1; private int ninePointBottom = -1;
private static final int MIN_NINE_POINT = 0; private static final int MIN_NINE_POINT = 0;
private static final int MIN_GAP_PARALLEL_LINES = 1;
private int imgWidth; private int imgWidth;
private int imgHeight; private int imgHeight;
@ -772,8 +775,8 @@ public class BorderLineAndImagePane extends JPanel implements UIObserver {
private void onNinePointTopChanged(int value) { private void onNinePointTopChanged(int value) {
if (value < MIN_NINE_POINT) { if (value < MIN_NINE_POINT) {
value = MIN_NINE_POINT; value = MIN_NINE_POINT;
} else if (value >= imgHeight - ninePointBottom) { } else if (value >= imgHeight - ninePointBottom - MIN_GAP_PARALLEL_LINES) {
value = imgHeight - ninePointBottom - MIN_NINE_POINT; value = imgHeight - ninePointBottom - MIN_GAP_PARALLEL_LINES;
} }
this.ninePointTop = value; this.ninePointTop = value;
repaint(); repaint();
@ -782,8 +785,8 @@ public class BorderLineAndImagePane extends JPanel implements UIObserver {
private void onNinePointBottomChanged(int value) { private void onNinePointBottomChanged(int value) {
if (value < MIN_NINE_POINT) { if (value < MIN_NINE_POINT) {
value = MIN_NINE_POINT; value = MIN_NINE_POINT;
} else if (value >= imgHeight - ninePointTop) { } else if (value >= imgHeight - ninePointTop - MIN_GAP_PARALLEL_LINES) {
value = imgHeight - ninePointTop - MIN_NINE_POINT; value = imgHeight - ninePointTop - MIN_GAP_PARALLEL_LINES;
} }
this.ninePointBottom = value; this.ninePointBottom = value;
repaint(); repaint();
@ -792,8 +795,8 @@ public class BorderLineAndImagePane extends JPanel implements UIObserver {
private void onNinePointLeftChanged(int value) { private void onNinePointLeftChanged(int value) {
if (value < MIN_NINE_POINT) { if (value < MIN_NINE_POINT) {
value = MIN_NINE_POINT; value = MIN_NINE_POINT;
} else if (value >= imgWidth - ninePointRight) { } else if (value >= imgWidth - ninePointRight - MIN_GAP_PARALLEL_LINES) {
value = imgWidth - ninePointRight - MIN_NINE_POINT; value = imgWidth - ninePointRight - MIN_GAP_PARALLEL_LINES;
} }
this.ninePointLeft = value; this.ninePointLeft = value;
repaint(); repaint();
@ -802,8 +805,8 @@ public class BorderLineAndImagePane extends JPanel implements UIObserver {
private void onNinePointRightChanged(int value) { private void onNinePointRightChanged(int value) {
if (value < MIN_NINE_POINT) { if (value < MIN_NINE_POINT) {
value = MIN_NINE_POINT; value = MIN_NINE_POINT;
} else if (value >= imgWidth - ninePointLeft) { } else if (value >= imgWidth - ninePointLeft - MIN_GAP_PARALLEL_LINES) {
value = imgWidth - ninePointLeft - MIN_NINE_POINT; value = imgWidth - ninePointLeft - MIN_GAP_PARALLEL_LINES;
} }
this.ninePointRight = value; this.ninePointRight = value;
repaint(); repaint();

18
designer-form/src/main/java/com/fr/design/gui/xpane/CardTagLayoutStylePane.java

@ -3,6 +3,8 @@
*/ */
package com.fr.design.gui.xpane; package com.fr.design.gui.xpane;
import com.fr.form.ui.LayoutBorderStyle;
import javax.swing.JPanel; import javax.swing.JPanel;
/** /**
@ -10,6 +12,8 @@ import javax.swing.JPanel;
*/ */
public class CardTagLayoutStylePane extends LayoutStylePane { public class CardTagLayoutStylePane extends LayoutStylePane {
private LayoutBorderStyle backupStyleFromPopulating = new LayoutBorderStyle();
@Override @Override
protected JPanel createTitleStylePane(){ protected JPanel createTitleStylePane(){
JPanel panel = super.createTitleStylePane(); JPanel panel = super.createTitleStylePane();
@ -21,4 +25,18 @@ public class CardTagLayoutStylePane extends LayoutStylePane {
protected JPanel createBackgroundStylePane(boolean supportCornerRadius) { protected JPanel createBackgroundStylePane(boolean supportCornerRadius) {
return super.createBackgroundStylePane(false); return super.createBackgroundStylePane(false);
} }
@Override
public void populateBean(LayoutBorderStyle style) {
this.backupStyleFromPopulating = style;
super.populateBean(style);
}
@Override
public LayoutBorderStyle updateBean() {
LayoutBorderStyle style = super.updateBean();
style.setTitle(backupStyleFromPopulating.getTitle());
style.setType(backupStyleFromPopulating.getType());
return style;
}
} }

33
designer-form/src/main/java/com/fr/design/mainframe/ArrangementType.java

@ -0,0 +1,33 @@
package com.fr.design.mainframe;
public enum ArrangementType {
LEFT_ALIGN(0),
RIGHT_ALIGN(1),
TOP_ALIGN(2),
BOTTOM_ALIGN(3),
HORIZONTAL_CENTER_ALIGN(4),
VERTICAL_CENTER_ALIGN(5),
HORIZONTAL_AUTO_DISTRIBUTION(6),
HORIZONTAL_MANUAL_DISTRIBUTION(7),
VERTICAL_AUTO_DISTRIBUTION(8),
VERTICAL_MANUAL_DISTRIBUTION(9);
private int type;
ArrangementType(int type) {
this.type = type;
}
public int getType() {
return this.type;
}
public static ArrangementType parse(int type) {
for (ArrangementType arrangementType : ArrangementType.values()) {
if (arrangementType.getType() == type) {
return arrangementType;
}
}
return LEFT_ALIGN;
}
}

38
designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java

@ -18,6 +18,7 @@ import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWAbsoluteLayout; import com.fr.design.designer.creator.XWAbsoluteLayout;
import com.fr.design.designer.creator.XWFitLayout; import com.fr.design.designer.creator.XWFitLayout;
import com.fr.design.designer.creator.XWParameterLayout; import com.fr.design.designer.creator.XWParameterLayout;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.form.util.XCreatorConstants; import com.fr.design.form.util.XCreatorConstants;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.icon.IconPathConstants; import com.fr.design.icon.IconPathConstants;
@ -27,19 +28,19 @@ import com.fr.design.mod.bean.ContentChangeItem;
import com.fr.design.mod.event.TableDataModifyEvent; import com.fr.design.mod.event.TableDataModifyEvent;
import com.fr.design.utils.ComponentUtils; import com.fr.design.utils.ComponentUtils;
import com.fr.event.EventDispatcher; import com.fr.event.EventDispatcher;
import com.fr.form.share.editor.SharableEditorProvider;
import com.fr.form.share.SharableWidgetProvider; import com.fr.form.share.SharableWidgetProvider;
import com.fr.form.share.ShareLoader; import com.fr.form.share.ShareLoader;
import com.fr.form.share.editor.SharableEditorProvider;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import java.util.Collections;
import java.util.HashMap;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JOptionPane;
import javax.swing.JWindow; import javax.swing.JWindow;
import java.util.List; import javax.swing.SwingUtilities;
import java.util.Map; import javax.swing.UIManager;
import java.awt.Color; import java.awt.Color;
import java.awt.Component; import java.awt.Component;
import java.awt.Point; import java.awt.Point;
@ -49,7 +50,10 @@ import java.awt.dnd.DropTarget;
import java.awt.dnd.DropTargetDragEvent; import java.awt.dnd.DropTargetDragEvent;
import java.awt.dnd.DropTargetDropEvent; import java.awt.dnd.DropTargetDropEvent;
import java.awt.dnd.DropTargetEvent; import java.awt.dnd.DropTargetEvent;
import javax.swing.SwingUtilities; import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/** /**
* 添加模式下鼠标事件处理器 * 添加模式下鼠标事件处理器
@ -141,7 +145,9 @@ public class FormCreatorDropTarget extends DropTarget {
} }
designer.getSelectionModel().setSelectedCreators( designer.getSelectionModel().setSelectedCreators(
FormSelectionUtils.rebuildSelection(xCreator, new Widget[]{widget})); FormSelectionUtils.rebuildSelection(xCreator, new Widget[]{widget}));
designer.getEditListenerTable().fireCreatorModified(addingModel.getXCreator(), DesignerEvent.CREATOR_ADDED); if (!addingModel.isAddedIllegal()) {
designer.getEditListenerTable().fireCreatorModified(addingModel.getXCreator(), DesignerEvent.CREATOR_ADDED);
}
tabDragInner.tryDragIn(); tabDragInner.tryDragIn();
} else { } else {
Toolkit.getDefaultToolkit().beep(); Toolkit.getDefaultToolkit().beep();
@ -316,6 +322,24 @@ public class FormCreatorDropTarget extends DropTarget {
*/ */
@Override @Override
public synchronized void drop(DropTargetDropEvent dtde) { public synchronized void drop(DropTargetDropEvent dtde) {
try {
dropXCreator(dtde);
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
if (addingModel.getXCreator().isShared()) {
FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Share_Drag_Component_Error_Info"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Error"),
JOptionPane.ERROR_MESSAGE,
UIManager.getIcon("OptionPane.errorIcon")
);
}
dtde.rejectDrop();
}
}
private void dropXCreator(DropTargetDropEvent dtde) {
Point loc = dtde.getLocation(); Point loc = dtde.getLocation();
this.adding(designer.getRelativeX(loc.x), designer.getRelativeY(loc.y)); this.adding(designer.getRelativeX(loc.x), designer.getRelativeY(loc.y));
// 放到事件末尾执行 // 放到事件末尾执行

11
designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java

@ -7,6 +7,7 @@ import com.fr.design.constants.UIConstants;
import com.fr.design.designer.beans.events.DesignerEditListener; import com.fr.design.designer.beans.events.DesignerEditListener;
import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.beans.events.DesignerEvent;
import com.fr.design.designer.creator.XCreatorUtils; import com.fr.design.designer.creator.XCreatorUtils;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.fun.FormWidgetOptionProvider; import com.fr.design.fun.FormWidgetOptionProvider;
import com.fr.design.gui.chart.ChartXMLTag; import com.fr.design.gui.chart.ChartXMLTag;
import com.fr.design.gui.core.FormWidgetOption; import com.fr.design.gui.core.FormWidgetOption;
@ -19,6 +20,7 @@ import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.share.collect.ComponentCollector; import com.fr.design.mainframe.share.collect.ComponentCollector;
import com.fr.design.module.DesignModuleFactory; import com.fr.design.module.DesignModuleFactory;
import com.fr.design.ui.util.UIUtil;
import com.fr.design.utils.gui.LayoutUtils; import com.fr.design.utils.gui.LayoutUtils;
import com.fr.form.ui.UserDefinedWidgetConfig; import com.fr.form.ui.UserDefinedWidgetConfig;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
@ -99,6 +101,15 @@ public class FormParaWidgetPane extends JPanel {
synchronized (FormParaWidgetPane.class) { synchronized (FormParaWidgetPane.class) {
THIS = null; THIS = null;
} }
UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override
public void run() {
JTemplate<?, ?> template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (template != null && !template.isJWorkBook()) {
DesignerContext.getDesignerFrame().resetToolkitByPlus(template);
}
}
});
} }
}, new PluginFilter() { }, new PluginFilter() {

3
designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java

@ -96,7 +96,8 @@ public class FormWidgetDetailPane extends FormDockView{
} }
headGroup = new UIHeadGroup(paneNames) { headGroup = new UIHeadGroup(paneNames) {
protected void tabChanged(int newSelectedIndex) { protected void tabChanged(int newSelectedIndex) {
if (newSelectedIndex == 1) { //初始化还未展示的时候不需要收集其 marketClick
if (this.isShowing() && newSelectedIndex == 1) {
ComponentCollector.getInstance().collectMarkerClick(); ComponentCollector.getInstance().collectMarkerClick();
} }
cardLayout.show(centerPane, paneList.get(newSelectedIndex).getTitle()); cardLayout.show(centerPane, paneList.get(newSelectedIndex).getTitle());

5
designer-form/src/main/java/com/fr/design/mainframe/JForm.java

@ -16,6 +16,7 @@ import com.fr.design.actions.core.WorkBookSupportable;
import com.fr.design.actions.file.export.EmbeddedFormExportExportAction; import com.fr.design.actions.file.export.EmbeddedFormExportExportAction;
import com.fr.design.base.mode.DesignModeContext; import com.fr.design.base.mode.DesignModeContext;
import com.fr.design.cell.FloatElementsProvider; import com.fr.design.cell.FloatElementsProvider;
import com.fr.design.constants.TableDataConstants;
import com.fr.design.data.datapane.TableDataTreePane; import com.fr.design.data.datapane.TableDataTreePane;
import com.fr.design.designer.TargetComponent; import com.fr.design.designer.TargetComponent;
import com.fr.design.designer.beans.actions.CopyAction; import com.fr.design.designer.beans.actions.CopyAction;
@ -576,7 +577,7 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
} }
private ShortCut getReportFitAttrAction() { protected ShortCut getReportFitAttrAction() {
FormAdaptiveConfigUIProcessor adaptiveConfigUI = ExtraDesignClassManager.getInstance().getSingle(FormAdaptiveConfigUIProcessor.MARK_STRING); FormAdaptiveConfigUIProcessor adaptiveConfigUI = ExtraDesignClassManager.getInstance().getSingle(FormAdaptiveConfigUIProcessor.MARK_STRING);
if (adaptiveConfigUI != null) { if (adaptiveConfigUI != null) {
return adaptiveConfigUI.getConfigShortCut(this); return adaptiveConfigUI.getConfigShortCut(this);
@ -1085,7 +1086,7 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
} }
Iterator tdIterator = sharableEditor.getTableDataSource().getTableDataNameIterator(); Iterator tdIterator = sharableEditor.getTableDataSource().getTableDataNameIterator();
while (tdIterator.hasNext()) { while (tdIterator.hasNext()) {
String tdName = bindInfo.getName() + "-" + tdIterator.next(); String tdName = bindInfo.getName() + TableDataConstants.SEPARATOR + tdIterator.next();
TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()).removeTableData(tdName); TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()).removeTableData(tdName);
} }
} }

81
designer-form/src/main/java/com/fr/design/mainframe/MultiSelectionArrangement.java

@ -15,67 +15,103 @@ import java.util.Comparator;
import java.util.List; import java.util.List;
public class MultiSelectionArrangement { public class MultiSelectionArrangement {
private static final int DEFAULT_GAP = 10;
private FormDesigner designer; private FormDesigner designer;
private XLayoutContainer parent; // 当前选中的那些组件所在父容器
private List<XCreator> selectedCreators; private List<XCreator> selectedCreators;
private Rectangle rec; private Rectangle rec;
public MultiSelectionArrangement(FormDesigner designer) { public MultiSelectionArrangement(FormDesigner designer) {
this.designer = designer; this.designer = designer;
update();
} }
public void leftAlign() { public void doArrangement(ArrangementType type) {
doArrangement(type, DEFAULT_GAP);
}
public void doArrangement(ArrangementType type, int gap) {
updatePosition();
switch (type) {
case RIGHT_ALIGN:
rightAlign();
break;
case TOP_ALIGN:
topAlign();
break;
case BOTTOM_ALIGN:
bottomAlign();
break;
case HORIZONTAL_CENTER_ALIGN:
horizontalCenterAlign();
break;
case VERTICAL_CENTER_ALIGN:
verticalCenterAlign();
break;
case HORIZONTAL_AUTO_DISTRIBUTION:
horizontalAutoDistribution();
break;
case HORIZONTAL_MANUAL_DISTRIBUTION:
horizontalManualDistribution(gap);
break;
case VERTICAL_AUTO_DISTRIBUTION:
verticalAutoDistribution();
break;
case VERTICAL_MANUAL_DISTRIBUTION:
verticalManualDistribution(gap);
break;
case LEFT_ALIGN:
default:
leftAlign();
break;
}
updateModel();
}
private void leftAlign() {
for (XCreator creator : selectedCreators) { for (XCreator creator : selectedCreators) {
creator.setLocation(rec.x, creator.getY()); creator.setLocation(rec.x, creator.getY());
} }
update();
} }
public void rightAlign() { private void rightAlign() {
for (XCreator creator : selectedCreators) { for (XCreator creator : selectedCreators) {
creator.setLocation(rec.x + rec.width - creator.getWidth(), creator.getY()); creator.setLocation(rec.x + rec.width - creator.getWidth(), creator.getY());
} }
update();
} }
public void topAlign() { private void topAlign() {
for (XCreator creator : selectedCreators) { for (XCreator creator : selectedCreators) {
creator.setLocation(creator.getX(), rec.y); creator.setLocation(creator.getX(), rec.y);
} }
update();
} }
public void bottomAlign() { private void bottomAlign() {
for (XCreator creator : selectedCreators) { for (XCreator creator : selectedCreators) {
creator.setLocation(creator.getX(), rec.y + rec.height - creator.getHeight()); creator.setLocation(creator.getX(), rec.y + rec.height - creator.getHeight());
} }
update();
} }
public void horizontalCenterAlign() { private void horizontalCenterAlign() {
for (XCreator creator : selectedCreators) { for (XCreator creator : selectedCreators) {
creator.setLocation(rec.x + rec.width / 2 - creator.getWidth() / 2, creator.getY()); creator.setLocation(rec.x + rec.width / 2 - creator.getWidth() / 2, creator.getY());
} }
update();
} }
public void verticalCenterAlign() { private void verticalCenterAlign() {
for (XCreator creator : selectedCreators) { for (XCreator creator : selectedCreators) {
creator.setLocation(creator.getX(), rec.y + rec.height / 2 - creator.getHeight() / 2); creator.setLocation(creator.getX(), rec.y + rec.height / 2 - creator.getHeight() / 2);
} }
update();
} }
// 水平分布,自动,间距由selectedCreators和border共同计算而来 // 水平分布,自动,间距由selectedCreators和border共同计算而来
public void horizontalAutoDistribution() { private void horizontalAutoDistribution() {
sortHorizontal(); sortHorizontal();
int[] gaps = calculateHorizontalGaps(); int[] gaps = calculateHorizontalGaps();
horizontalDistribution(gaps); horizontalDistribution(gaps);
} }
// 水平分布,手动,传入一个间距,排列selectedCreators // 水平分布,手动,传入一个间距,排列selectedCreators
public void horizontalManualDistribution(int gap) { private void horizontalManualDistribution(int gap) {
sortHorizontal(); sortHorizontal();
reSizeRecByHorizontal(gap); reSizeRecByHorizontal(gap);
horizontalDistribution(fillGaps(gap, selectedCreators.size() - 1)); horizontalDistribution(fillGaps(gap, selectedCreators.size() - 1));
@ -87,7 +123,6 @@ public class MultiSelectionArrangement {
XCreator preCreator = selectedCreators.get(i - 1); XCreator preCreator = selectedCreators.get(i - 1);
creator.setLocation(preCreator.getX() + preCreator.getWidth() + gaps[i - 1], creator.getY()); creator.setLocation(preCreator.getX() + preCreator.getWidth() + gaps[i - 1], creator.getY());
} }
update();
} }
private void reSizeRecByHorizontal(int gap) { private void reSizeRecByHorizontal(int gap) {
@ -145,13 +180,13 @@ public class MultiSelectionArrangement {
return calculateIntegerGaps(distanceBetweenHeadAndTailCreators - sum, gapCount); return calculateIntegerGaps(distanceBetweenHeadAndTailCreators - sum, gapCount);
} }
public void verticalAutoDistribution() { private void verticalAutoDistribution() {
sortVertical(); sortVertical();
int[] gaps = calculateVerticalGaps(); int[] gaps = calculateVerticalGaps();
verticalDistribution(gaps); verticalDistribution(gaps);
} }
public void verticalManualDistribution(int gap) { private void verticalManualDistribution(int gap) {
sortVertical(); sortVertical();
reSizeRecByVertical(gap); reSizeRecByVertical(gap);
verticalDistribution(fillGaps(gap, selectedCreators.size() - 1)); verticalDistribution(fillGaps(gap, selectedCreators.size() - 1));
@ -163,7 +198,6 @@ public class MultiSelectionArrangement {
XCreator preCreator = selectedCreators.get(i - 1); XCreator preCreator = selectedCreators.get(i - 1);
creator.setLocation(creator.getX(), preCreator.getY() + preCreator.getHeight() + gaps[i - 1]); creator.setLocation(creator.getX(), preCreator.getY() + preCreator.getHeight() + gaps[i - 1]);
} }
update();
} }
private void reSizeRecByVertical(int gap) { private void reSizeRecByVertical(int gap) {
@ -252,12 +286,15 @@ public class MultiSelectionArrangement {
return gaps; return gaps;
} }
private void update() { private void updatePosition() {
FormSelection selection = designer.getSelectionModel().getSelection(); FormSelection selection = designer.getSelectionModel().getSelection();
this.selectedCreators = Arrays.asList(selection.getSelectedCreators()); this.selectedCreators = Arrays.asList(selection.getSelectedCreators());
this.rec = selection.getSelctionBounds(); this.rec = selection.getSelctionBounds();
this.parent = getParent(selection.getSelectedCreator()); }
private void updateModel() {
FormSelection selection = designer.getSelectionModel().getSelection();
XLayoutContainer parent = getParent(selection.getSelectedCreator());
if (parent != null) { if (parent != null) {
// 这里要修改修改engine里面的对象才能成功保存,光修改设计器对象没用 // 这里要修改修改engine里面的对象才能成功保存,光修改设计器对象没用
WLayout wabs = parent.toData(); WLayout wabs = parent.toData();

15
designer-form/src/main/java/com/fr/design/mainframe/share/action/CreateComponentAction.java

@ -10,7 +10,9 @@ import com.fr.data.impl.NameTableData;
import com.fr.data.impl.TableDataDictionary; import com.fr.data.impl.TableDataDictionary;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.DesignTableDataManager;
import com.fr.design.designer.creator.XChartEditor;
import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XWTitleLayout;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dialog.FineJOptionPane;
@ -33,6 +35,7 @@ import com.fr.form.ui.ChartEditor;
import com.fr.form.ui.DataControl; import com.fr.form.ui.DataControl;
import com.fr.form.ui.DictionaryContainer; import com.fr.form.ui.DictionaryContainer;
import com.fr.form.ui.ElementCaseEditor; import com.fr.form.ui.ElementCaseEditor;
import com.fr.form.ui.PaddingMargin;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
@ -56,6 +59,7 @@ import javax.swing.Action;
import javax.swing.UIManager; import javax.swing.UIManager;
import java.awt.Color; import java.awt.Color;
import java.awt.Component; import java.awt.Component;
import java.awt.Dimension;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import java.awt.Image; import java.awt.Image;
import java.awt.Rectangle; import java.awt.Rectangle;
@ -253,6 +257,17 @@ public class CreateComponentAction extends UpdateAction {
BufferedImage im = new BufferedImage((int) rect.getWidth(), (int) rect.getHeight(), BufferedImage.TYPE_INT_ARGB); BufferedImage im = new BufferedImage((int) rect.getWidth(), (int) rect.getHeight(), BufferedImage.TYPE_INT_ARGB);
comp.paint(im.getGraphics()); comp.paint(im.getGraphics());
if (comp instanceof XWTitleLayout) {
XCreator body = ((XWTitleLayout) comp).getBodyCreator();
if (body instanceof XChartEditor) {
XChartEditor chartEditor = (XChartEditor) body;
Dimension size = chartEditor.getSize();
BufferedImage chartImage = new BufferedImage(size.width, size.height, BufferedImage.TYPE_INT_ARGB);
PaddingMargin margin = chartEditor.toData().getMargin();
chartEditor.getDesignerEditor().paintEditor(chartImage.getGraphics(), size, margin);
im.getGraphics().drawImage(chartImage, 0, chartEditor.getY(), null);
}
}
return im; return im;
} }

73
designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/LocalWidgetBlock.java

@ -1,5 +1,6 @@
package com.fr.design.mainframe.share.ui.block; package com.fr.design.mainframe.share.ui.block;
import com.fr.base.FRContext;
import com.fr.base.GraphHelper; import com.fr.base.GraphHelper;
import com.fr.base.iofile.attr.SharableAttrMark; import com.fr.base.iofile.attr.SharableAttrMark;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
@ -37,17 +38,24 @@ import org.jetbrains.annotations.Nullable;
import javax.swing.Action; import javax.swing.Action;
import javax.swing.Icon; import javax.swing.Icon;
import javax.swing.JOptionPane;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.UIManager;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
import java.awt.Cursor; import java.awt.Cursor;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.Font;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image; import java.awt.Image;
import java.awt.Rectangle; import java.awt.Rectangle;
import java.awt.RenderingHints;
import java.awt.dnd.DnDConstants; import java.awt.dnd.DnDConstants;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.font.FontRenderContext;
import java.awt.font.LineMetrics;
import java.util.UUID; import java.util.UUID;
/** /**
@ -67,6 +75,7 @@ public class LocalWidgetBlock extends PreviewWidgetBlock<DefaultSharableWidget>
private boolean hover; private boolean hover;
private final Icon markedMode = IOUtils.readIcon("/com/fr/base/images/share/marked.png"); private final Icon markedMode = IOUtils.readIcon("/com/fr/base/images/share/marked.png");
private final Icon unMarkedMode = IOUtils.readIcon("/com/fr/base/images/share/unmarked.png"); private final Icon unMarkedMode = IOUtils.readIcon("/com/fr/base/images/share/unmarked.png");
private final Icon incompatibleMarker = IOUtils.readIcon("/com/fr/base/images/share/marker_incompatible.png");
public LocalWidgetBlock(DefaultSharableWidget provider, LocalWidgetSelectPane parentPane) { public LocalWidgetBlock(DefaultSharableWidget provider, LocalWidgetSelectPane parentPane) {
super(provider); super(provider);
@ -198,11 +207,24 @@ public class LocalWidgetBlock extends PreviewWidgetBlock<DefaultSharableWidget>
Widget creatorSource; Widget creatorSource;
String shareId; String shareId;
if (source instanceof LocalWidgetBlock) { if (source instanceof LocalWidgetBlock) {
LocalWidgetBlock no = (LocalWidgetBlock) e.getSource(); LocalWidgetBlock widgetBlock = (LocalWidgetBlock) e.getSource();
if (no == null) { if (widgetBlock == null) {
return; return;
} }
shareId = no.getBindInfo().getId(); SharableWidgetProvider widget = widgetBlock.getWidget();
if (widget == null) {
return;
}
if (!widget.isCompatibleWithCurrentEnv()) {
FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(),
Toolkit.i18nText("Fine-Design_Share_Drag_And_Make_Incompatible_Component_Tip"),
Toolkit.i18nText("Fine-Design_Basic_Error"),
JOptionPane.ERROR_MESSAGE,
UIManager.getIcon("OptionPane.errorIcon")
);
return;
}
shareId = widgetBlock.getBindInfo().getId();
creatorSource = getGroup().getElCaseEditorById(shareId); creatorSource = getGroup().getElCaseEditorById(shareId);
if (creatorSource == null) { if (creatorSource == null) {
ShareUIUtils.showErrorMessageDialog(Toolkit.i18nText("Fine-Design_Share_Drag_Error_Info")); ShareUIUtils.showErrorMessageDialog(Toolkit.i18nText("Fine-Design_Share_Drag_Error_Info"));
@ -211,7 +233,7 @@ public class LocalWidgetBlock extends PreviewWidgetBlock<DefaultSharableWidget>
creatorSource.setWidgetID(UUID.randomUUID().toString()); creatorSource.setWidgetID(UUID.randomUUID().toString());
((AbstractBorderStyleWidget) creatorSource).addWidgetAttrMark(new SharableAttrMark(true)); ((AbstractBorderStyleWidget) creatorSource).addWidgetAttrMark(new SharableAttrMark(true));
//tab布局WCardMainBorderLayout通过反射出来的大小是960*480 //tab布局WCardMainBorderLayout通过反射出来的大小是960*480
XCreator xCreator = ShareComponentUtils.createXCreator(creatorSource, shareId, no.getBindInfo()); XCreator xCreator = ShareComponentUtils.createXCreator(creatorSource, shareId, widgetBlock.getBindInfo());
WidgetToolBarPane.getTarget().startDraggingBean(xCreator); WidgetToolBarPane.getTarget().startDraggingBean(xCreator);
lastPressEvent = null; lastPressEvent = null;
this.setBorder(null); this.setBorder(null);
@ -221,6 +243,13 @@ public class LocalWidgetBlock extends PreviewWidgetBlock<DefaultSharableWidget>
@Override @Override
public void paint(Graphics g) { public void paint(Graphics g) {
super.paint(g); super.paint(g);
Graphics2D g2d = (Graphics2D) g;
boolean isUnusable = !getWidget().isCompatibleWithCurrentEnv();
if (isUnusable) {
paintUnusableMask(g2d);
}
//绘制删除标志 //绘制删除标志
if (isEdit) { if (isEdit) {
Icon icon = isMarked ? markedMode : unMarkedMode; Icon icon = isMarked ? markedMode : unMarkedMode;
@ -235,6 +264,42 @@ public class LocalWidgetBlock extends PreviewWidgetBlock<DefaultSharableWidget>
} }
} }
protected void paintUnusableMask(Graphics2D g2d) {
Color oldColor = g2d.getColor();
Font oldFont = g2d.getFont();
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
Dimension coverDim = getCoverDimension();
double canvasX = 0;
double canvasY = 0;
double canvasW = coverDim.getWidth();
double canvasH = coverDim.getHeight();
g2d.setColor(new Color(0.0F, 0.0F, 0.0F, 0.4F));
GraphHelper.fillRect(g2d, canvasX, canvasY, canvasW, canvasH);
g2d.setColor(new Color(0.0F, 0.0F, 0.0F, 0.5F));
GraphHelper.fillRect(g2d, canvasX, canvasH - 16, canvasW, 16);
String tipText = Toolkit.i18nText("Fine-Design_Share_Incompatible_Version_Tip");
Font tipFont = FRContext.getDefaultValues().getFRFont().deriveFont(8.0F);
FontRenderContext frc = g2d.getFontRenderContext();
double tipTextWidth = GraphHelper.stringWidth(tipText, tipFont, frc);
LineMetrics metrics = tipFont.getLineMetrics(tipText, frc);
double tipTextHeight = metrics.getHeight();
g2d.setColor(Color.WHITE);
g2d.setFont(tipFont);
GraphHelper.drawString(g2d, tipText, canvasX + (canvasW - tipTextWidth) / 2.0F, canvasY + canvasH - (16 - tipTextHeight) / 2.0F);
int markerX = (int) (canvasX + (canvasW - incompatibleMarker.getIconWidth()) / 2);
int markerY = (int) (canvasY + (canvasH - incompatibleMarker.getIconHeight()) / 2);
incompatibleMarker.paintIcon(this, g2d, markerX, markerY);
g2d.setColor(oldColor);
g2d.setFont(oldFont);
}
/** /**
* 由鼠标释放时调用该方法来触发左键点击事件 * 由鼠标释放时调用该方法来触发左键点击事件
*/ */

14
designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/AbstractMultiSelectionArrangementButton.java

@ -5,6 +5,9 @@ import com.fr.design.event.UIObserverListener;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.mainframe.MultiSelectionArrangement; import com.fr.design.mainframe.MultiSelectionArrangement;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public abstract class AbstractMultiSelectionArrangementButton extends UIButton implements MultiSelectionArrangementButton, UIObserver { public abstract class AbstractMultiSelectionArrangementButton extends UIButton implements MultiSelectionArrangementButton, UIObserver {
private static final long serialVersionUID = -2114423583742242771L; private static final long serialVersionUID = -2114423583742242771L;
protected MultiSelectionArrangement arrangement; protected MultiSelectionArrangement arrangement;
@ -29,4 +32,15 @@ public abstract class AbstractMultiSelectionArrangementButton extends UIButton i
public boolean shouldResponseChangeListener() { public boolean shouldResponseChangeListener() {
return true; return true;
} }
@Override
public ActionListener getActionListener() {
return new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
arrangement.doArrangement(getArrangementType());
uiObserverListener.doChange();
}
};
}
} }

15
designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/BottomAlignButton.java

@ -1,14 +1,15 @@
package com.fr.design.mainframe.widget.arrangement.buttons; package com.fr.design.mainframe.widget.arrangement.buttons;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.ArrangementType;
import com.fr.design.mainframe.MultiSelectionArrangement; import com.fr.design.mainframe.MultiSelectionArrangement;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import javax.swing.Icon; import javax.swing.Icon;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class BottomAlignButton extends AbstractMultiSelectionArrangementButton { public class BottomAlignButton extends AbstractMultiSelectionArrangementButton {
private static final long serialVersionUID = 2397455240682353024L;
public BottomAlignButton(MultiSelectionArrangement arrangement) { public BottomAlignButton(MultiSelectionArrangement arrangement) {
super(arrangement); super(arrangement);
} }
@ -24,13 +25,7 @@ public class BottomAlignButton extends AbstractMultiSelectionArrangementButton {
} }
@Override @Override
public ActionListener getActionListener() { public ArrangementType getArrangementType() {
return new ActionListener() { return ArrangementType.BOTTOM_ALIGN;
@Override
public void actionPerformed(ActionEvent e) {
arrangement.bottomAlign();
uiObserverListener.doChange();
}
};
} }
} }

15
designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/HorizontalCenterButton.java

@ -1,14 +1,15 @@
package com.fr.design.mainframe.widget.arrangement.buttons; package com.fr.design.mainframe.widget.arrangement.buttons;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.ArrangementType;
import com.fr.design.mainframe.MultiSelectionArrangement; import com.fr.design.mainframe.MultiSelectionArrangement;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import javax.swing.Icon; import javax.swing.Icon;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class HorizontalCenterButton extends AbstractMultiSelectionArrangementButton { public class HorizontalCenterButton extends AbstractMultiSelectionArrangementButton {
private static final long serialVersionUID = 6290178236460051049L;
public HorizontalCenterButton(MultiSelectionArrangement arrangement) { public HorizontalCenterButton(MultiSelectionArrangement arrangement) {
super(arrangement); super(arrangement);
} }
@ -24,13 +25,7 @@ public class HorizontalCenterButton extends AbstractMultiSelectionArrangementBut
} }
@Override @Override
public ActionListener getActionListener() { public ArrangementType getArrangementType() {
return new ActionListener() { return ArrangementType.HORIZONTAL_CENTER_ALIGN;
@Override
public void actionPerformed(ActionEvent e) {
arrangement.horizontalCenterAlign();
uiObserverListener.doChange();
}
};
} }
} }

15
designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/HorizontalDistributionButton.java

@ -1,14 +1,15 @@
package com.fr.design.mainframe.widget.arrangement.buttons; package com.fr.design.mainframe.widget.arrangement.buttons;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.ArrangementType;
import com.fr.design.mainframe.MultiSelectionArrangement; import com.fr.design.mainframe.MultiSelectionArrangement;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import javax.swing.Icon; import javax.swing.Icon;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class HorizontalDistributionButton extends AbstractMultiSelectionArrangementButton { public class HorizontalDistributionButton extends AbstractMultiSelectionArrangementButton {
private static final long serialVersionUID = 5052092252720664954L;
public HorizontalDistributionButton(MultiSelectionArrangement arrangement) { public HorizontalDistributionButton(MultiSelectionArrangement arrangement) {
super(arrangement); super(arrangement);
} }
@ -24,13 +25,7 @@ public class HorizontalDistributionButton extends AbstractMultiSelectionArrangem
} }
@Override @Override
public ActionListener getActionListener() { public ArrangementType getArrangementType() {
return new ActionListener() { return ArrangementType.HORIZONTAL_AUTO_DISTRIBUTION;
@Override
public void actionPerformed(ActionEvent e) {
arrangement.horizontalAutoDistribution();
uiObserverListener.doChange();
}
};
} }
} }

15
designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/LeftAlignButton.java

@ -1,14 +1,15 @@
package com.fr.design.mainframe.widget.arrangement.buttons; package com.fr.design.mainframe.widget.arrangement.buttons;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.ArrangementType;
import com.fr.design.mainframe.MultiSelectionArrangement; import com.fr.design.mainframe.MultiSelectionArrangement;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import javax.swing.Icon; import javax.swing.Icon;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class LeftAlignButton extends AbstractMultiSelectionArrangementButton { public class LeftAlignButton extends AbstractMultiSelectionArrangementButton {
private static final long serialVersionUID = -8177637788632733710L;
public LeftAlignButton(MultiSelectionArrangement arrangement) { public LeftAlignButton(MultiSelectionArrangement arrangement) {
super(arrangement); super(arrangement);
} }
@ -24,13 +25,7 @@ public class LeftAlignButton extends AbstractMultiSelectionArrangementButton {
} }
@Override @Override
public ActionListener getActionListener() { public ArrangementType getArrangementType() {
return new ActionListener() { return ArrangementType.LEFT_ALIGN;
@Override
public void actionPerformed(ActionEvent e) {
arrangement.leftAlign();
uiObserverListener.doChange();
}
};
} }
} }

4
designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/MultiSelectionArrangementButton.java

@ -1,5 +1,7 @@
package com.fr.design.mainframe.widget.arrangement.buttons; package com.fr.design.mainframe.widget.arrangement.buttons;
import com.fr.design.mainframe.ArrangementType;
import javax.swing.Icon; import javax.swing.Icon;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
@ -9,4 +11,6 @@ public interface MultiSelectionArrangementButton {
String getTipText(); String getTipText();
ActionListener getActionListener(); ActionListener getActionListener();
ArrangementType getArrangementType();
} }

15
designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/RightAlignButton.java

@ -1,14 +1,15 @@
package com.fr.design.mainframe.widget.arrangement.buttons; package com.fr.design.mainframe.widget.arrangement.buttons;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.ArrangementType;
import com.fr.design.mainframe.MultiSelectionArrangement; import com.fr.design.mainframe.MultiSelectionArrangement;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import javax.swing.Icon; import javax.swing.Icon;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class RightAlignButton extends AbstractMultiSelectionArrangementButton { public class RightAlignButton extends AbstractMultiSelectionArrangementButton {
private static final long serialVersionUID = -8698936349956288409L;
public RightAlignButton(MultiSelectionArrangement arrangement) { public RightAlignButton(MultiSelectionArrangement arrangement) {
super(arrangement); super(arrangement);
} }
@ -24,13 +25,7 @@ public class RightAlignButton extends AbstractMultiSelectionArrangementButton {
} }
@Override @Override
public ActionListener getActionListener() { public ArrangementType getArrangementType() {
return new ActionListener() { return ArrangementType.RIGHT_ALIGN;
@Override
public void actionPerformed(ActionEvent e) {
arrangement.rightAlign();
uiObserverListener.doChange();
}
};
} }
} }

15
designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/TopAlignButton.java

@ -1,14 +1,15 @@
package com.fr.design.mainframe.widget.arrangement.buttons; package com.fr.design.mainframe.widget.arrangement.buttons;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.ArrangementType;
import com.fr.design.mainframe.MultiSelectionArrangement; import com.fr.design.mainframe.MultiSelectionArrangement;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import javax.swing.Icon; import javax.swing.Icon;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class TopAlignButton extends AbstractMultiSelectionArrangementButton { public class TopAlignButton extends AbstractMultiSelectionArrangementButton {
private static final long serialVersionUID = 2896267783075870924L;
public TopAlignButton(MultiSelectionArrangement arrangement) { public TopAlignButton(MultiSelectionArrangement arrangement) {
super(arrangement); super(arrangement);
} }
@ -24,13 +25,7 @@ public class TopAlignButton extends AbstractMultiSelectionArrangementButton {
} }
@Override @Override
public ActionListener getActionListener() { public ArrangementType getArrangementType() {
return new ActionListener() { return ArrangementType.TOP_ALIGN;
@Override
public void actionPerformed(ActionEvent e) {
arrangement.topAlign();
uiObserverListener.doChange();
}
};
} }
} }

13
designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/VerticalCenterButton.java

@ -1,12 +1,11 @@
package com.fr.design.mainframe.widget.arrangement.buttons; package com.fr.design.mainframe.widget.arrangement.buttons;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.ArrangementType;
import com.fr.design.mainframe.MultiSelectionArrangement; import com.fr.design.mainframe.MultiSelectionArrangement;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import javax.swing.Icon; import javax.swing.Icon;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class VerticalCenterButton extends AbstractMultiSelectionArrangementButton { public class VerticalCenterButton extends AbstractMultiSelectionArrangementButton {
public VerticalCenterButton(MultiSelectionArrangement arrangement) { public VerticalCenterButton(MultiSelectionArrangement arrangement) {
@ -24,13 +23,7 @@ public class VerticalCenterButton extends AbstractMultiSelectionArrangementButto
} }
@Override @Override
public ActionListener getActionListener() { public ArrangementType getArrangementType() {
return new ActionListener() { return ArrangementType.VERTICAL_CENTER_ALIGN;
@Override
public void actionPerformed(ActionEvent e) {
arrangement.verticalCenterAlign();
uiObserverListener.doChange();
}
};
} }
} }

13
designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/VerticalDistributionButton.java

@ -1,12 +1,11 @@
package com.fr.design.mainframe.widget.arrangement.buttons; package com.fr.design.mainframe.widget.arrangement.buttons;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.ArrangementType;
import com.fr.design.mainframe.MultiSelectionArrangement; import com.fr.design.mainframe.MultiSelectionArrangement;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import javax.swing.Icon; import javax.swing.Icon;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class VerticalDistributionButton extends AbstractMultiSelectionArrangementButton { public class VerticalDistributionButton extends AbstractMultiSelectionArrangementButton {
public VerticalDistributionButton(MultiSelectionArrangement arrangement) { public VerticalDistributionButton(MultiSelectionArrangement arrangement) {
@ -24,13 +23,7 @@ public class VerticalDistributionButton extends AbstractMultiSelectionArrangemen
} }
@Override @Override
public ActionListener getActionListener() { public ArrangementType getArrangementType() {
return new ActionListener() { return ArrangementType.VERTICAL_AUTO_DISTRIBUTION;
@Override
public void actionPerformed(ActionEvent e) {
arrangement.verticalAutoDistribution();
uiObserverListener.doChange();
}
};
} }
} }

5
designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormMultiWidgetCardPane.java

@ -9,6 +9,7 @@ import com.fr.design.gui.itextfield.UITextField;
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.mainframe.ArrangementType;
import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.MultiSelectionArrangement; import com.fr.design.mainframe.MultiSelectionArrangement;
import com.fr.design.mainframe.widget.arrangement.buttons.BottomAlignButton; import com.fr.design.mainframe.widget.arrangement.buttons.BottomAlignButton;
@ -186,9 +187,9 @@ public class FormMultiWidgetCardPane extends FormWidgetCardPane {
int gap = (int) Math.floor(Float.parseFloat(text)); int gap = (int) Math.floor(Float.parseFloat(text));
numberField.setValue(gap); numberField.setValue(gap);
if (isVertical) { if (isVertical) {
arrangement.verticalManualDistribution(gap); arrangement.doArrangement(ArrangementType.VERTICAL_MANUAL_DISTRIBUTION, gap);
} else { } else {
arrangement.horizontalManualDistribution(gap); arrangement.doArrangement(ArrangementType.HORIZONTAL_MANUAL_DISTRIBUTION, gap);
} }
attributeChanged(); attributeChanged();
} }

18
designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormSingleWidgetCardPane.java

@ -67,12 +67,9 @@ public class FormSingleWidgetCardPane extends FormWidgetCardPane {
initDefinePane(); initDefinePane();
} }
@Deprecated
public XLayoutContainer getParent(XCreator source) { public XLayoutContainer getParent(XCreator source) {
XLayoutContainer container = XCreatorUtils.getParentXLayoutContainer(source); return XCreatorUtils.getParent(source);
if (source.acceptType(XWFitLayout.class) || source.acceptType(XWParameterLayout.class)) {
container = null;
}
return container;
} }
public WidgetBoundPane createWidgetBoundPane(XCreator xCreator) { public WidgetBoundPane createWidgetBoundPane(XCreator xCreator) {
@ -113,7 +110,7 @@ public class FormSingleWidgetCardPane extends FormWidgetCardPane {
} }
private void initComponents() { private void initComponents() {
XCreator innerCreator = getXCreatorDedicated(); XCreator innerCreator = XCreatorUtils.getXCreatorInnerWidget(this.xCreator);
attriCardPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); attriCardPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
content.add(attriCardPane, BorderLayout.CENTER); content.add(attriCardPane, BorderLayout.CENTER);
@ -166,7 +163,7 @@ public class FormSingleWidgetCardPane extends FormWidgetCardPane {
private void initDefinePane() { private void initDefinePane() {
currentEditorDefinePane = null; currentEditorDefinePane = null;
XCreator creator = getXCreatorDedicated(); XCreator creator = XCreatorUtils.getXCreatorInnerWidget(this.xCreator);
FormWidgetDefinePaneFactoryBase.RN rn = FormWidgetDefinePaneFactoryBase.createWidgetDefinePane(creator, designer, creator.toData(), new Operator() { FormWidgetDefinePaneFactoryBase.RN rn = FormWidgetDefinePaneFactoryBase.createWidgetDefinePane(creator, designer, creator.toData(), new Operator() {
@Override @Override
public void did(DataCreatorUI ui, String cardName) { public void did(DataCreatorUI ui, String cardName) {
@ -190,11 +187,6 @@ public class FormSingleWidgetCardPane extends FormWidgetCardPane {
currentEditorDefinePane = definePane; currentEditorDefinePane = definePane;
} }
private XCreator getXCreatorDedicated() {
boolean dedicateLayout = xCreator.acceptType(XWScaleLayout.class) && xCreator.getComponentCount() > 0 && ((XCreator) xCreator.getComponent(0)).shouldScaleCreator() || xCreator.acceptType(XWTitleLayout.class);
return dedicateLayout ? (XCreator) xCreator.getComponent(0) : xCreator;
}
@Override @Override
public String title4PopupWindow() { public String title4PopupWindow() {
return "Widget"; return "Widget";
@ -283,7 +275,7 @@ public class FormSingleWidgetCardPane extends FormWidgetCardPane {
} }
public void fireValueChanged() { public void fireValueChanged() {
XCreator creator = getXCreatorDedicated(); XCreator creator = XCreatorUtils.getXCreatorInnerWidget(this.xCreator);
creator.firePropertyChange(); creator.firePropertyChange();
} }

2
designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetAbsoluteBoundPane.java

@ -35,7 +35,7 @@ public class WidgetAbsoluteBoundPane extends WidgetBoundPane {
width.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Coords_And_Size")); width.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Coords_And_Size"));
height.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Coords_And_Size")); height.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Coords_And_Size"));
ratioLockedButton.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Coords_And_Size")); ratioLockedButton.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Coords_And_Size"));
this.add(WidgetBoundsPaneFactory.createAbsoluteBoundsPane(x, y, width, height, ratioLockedButton, WidgetBoundsPaneFactory.NameAttribute.WIDGET)); this.add(WidgetBoundsPaneFactory.createAbsoluteBoundsPane(x, y, width, height, ratioLockedButton, getNameAttribute()));
} }
@Override @Override

25
designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java

@ -61,15 +61,9 @@ public class WidgetBoundPane extends BasicPane {
initBoundPane(); initBoundPane();
} }
@Deprecated
public XLayoutContainer getParent(XCreator source) { public XLayoutContainer getParent(XCreator source) {
if(source.acceptType(XWCardTagLayout.class)){ return XCreatorUtils.getParent(source);
return (XLayoutContainer)source.getParent();
}
XLayoutContainer container = XCreatorUtils.getParentXLayoutContainer(source);
if (source.acceptType(XWFitLayout.class) || source.acceptType(XWParameterLayout.class)) {
container = null;
}
return container;
} }
public void initBoundPane() { public void initBoundPane() {
@ -89,7 +83,20 @@ public class WidgetBoundPane extends BasicPane {
ratioLockedButton.setLockEnabled(false); ratioLockedButton.setLockEnabled(false);
} }
this.add(WidgetBoundsPaneFactory.createBoundsPane(width, height, ratioLockedButton)); this.add(WidgetBoundsPaneFactory.createBoundsPane(width, height, ratioLockedButton, getNameAttribute()));
}
protected WidgetBoundsPaneFactory.NameAttribute getNameAttribute() {
WidgetBoundsPaneFactory.NameAttribute nameAttribute = WidgetBoundsPaneFactory.NameAttribute.DEFAULT;
if (!isComponent()) {
nameAttribute = WidgetBoundsPaneFactory.NameAttribute.WIDGET;
}
return nameAttribute;
}
protected boolean isComponent() {
XCreator creator = XCreatorUtils.getXCreatorInnerWidget(this.creator);
return creator.isComponent();
} }

3
designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ParaMobileDefinePane.java

@ -21,6 +21,7 @@ import com.fr.form.ui.container.WParameterLayout;
import com.fr.form.ui.container.WSortLayout; import com.fr.form.ui.container.WSortLayout;
import com.fr.form.ui.mobile.MobileParamStyle; import com.fr.form.ui.mobile.MobileParamStyle;
import com.fr.general.CloudCenter; import com.fr.general.CloudCenter;
import com.fr.i18n.UrlI18nManager;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.report.mobile.EmptyMobileParamStyle; import com.fr.report.mobile.EmptyMobileParamStyle;
@ -104,7 +105,7 @@ public class ParaMobileDefinePane extends MobileWidgetDefinePane {
@Override @Override
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
try { try {
Desktop.getDesktop().browse(new URI(CloudCenter.getInstance().acquireUrlByKind("plugin.mobile.style"))); Desktop.getDesktop().browse(new URI(UrlI18nManager.getInstance().getI18nUrl("plugin.mobile.style")));
} catch (Exception exp) { } catch (Exception exp) {
FineLoggerFactory.getLogger().error(exp.getMessage(), exp); FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
} }

3
designer-realize/src/main/java/com/fr/design/actions/server/ServerConfigManagerAction.java

@ -9,6 +9,7 @@ import com.fr.config.ServerPreferenceConfig;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
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.i18n.DesignSizeI18nManager;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.design.webattr.EditReportServerParameterPane; import com.fr.design.webattr.EditReportServerParameterPane;
@ -25,7 +26,7 @@ import java.awt.event.ActionEvent;
* Server Config Manager * Server Config Manager
*/ */
public class ServerConfigManagerAction extends UpdateAction { public class ServerConfigManagerAction extends UpdateAction {
public static final Dimension DEFAULT = new Dimension(700, 630); public static final Dimension DEFAULT = DesignSizeI18nManager.getInstance().i18nDimension("com.fr.design.actions.server.dialog");
public ServerConfigManagerAction() { public ServerConfigManagerAction() {
this.setMenuKeySet(SERVER_CONFIG_MANAGER); this.setMenuKeySet(SERVER_CONFIG_MANAGER);

3
designer-realize/src/main/java/com/fr/design/mainframe/app/CptApp.java

@ -100,8 +100,7 @@ class CptApp extends AbstractWorkBookApp {
final JDialog jd = new JDialog(); final JDialog jd = new JDialog();
// 模态一下,因为可能会多个样式丢失 // 模态一下,因为可能会多个样式丢失
// jd.setModal(true); jd.setModal(true);
jd.setAlwaysOnTop(true);
jd.setSize(450, 150); jd.setSize(450, 150);
jd.setResizable(false); jd.setResizable(false);
jd.setIconImage(BaseUtils.readImage("/com/fr/base/images/oem/logo.png")); jd.setIconImage(BaseUtils.readImage("/com/fr/base/images/oem/logo.png"));

16
designer-realize/src/main/java/com/fr/design/mainframe/app/FormApp.java

@ -73,15 +73,13 @@ class FormApp extends AbstractAppProvider {
@Override @Override
public JTemplate<?, ?> call() throws Exception { public JTemplate<?, ?> call() throws Exception {
OpenResult<Form, Parameter[]> result = worker.getResult(); OpenResult<Form, Parameter[]> result = worker.getResult();
return (JTemplate<Form, ?>) StableFactory.getMarkedInstanceObjectFromClass(BaseJForm.XML_TAG, return getJForm(result.getBaseBook(), tplFile, result.getRef());
new Object[]{result.getBaseBook(), tplFile, result.getRef()}, classType, BaseJForm.class);
} }
}); });
worker.start(tplFile.getPath()); worker.start(tplFile.getPath());
OpenResult<Form, Parameter[]> result = worker.getResult(); OpenResult<Form, Parameter[]> result = worker.getResult();
if (result != null) { if (result != null) {
return (JTemplate<Form, ?>) StableFactory.getMarkedInstanceObjectFromClass(BaseJForm.XML_TAG, return getJForm(result.getBaseBook(), tplFile, result.getRef());
new Object[]{result.getBaseBook(), tplFile, new Parameter[0]}, classType, BaseJForm.class);
} }
return emptyForm; return emptyForm;
} else { } else {
@ -90,6 +88,16 @@ class FormApp extends AbstractAppProvider {
} }
} }
@Nullable
private JForm getJForm(Form form, FILE file, Parameter[] parameters) {
try {
return new JForm(form, file, parameters);
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e, e.getMessage());
return null;
}
}
@Nullable @Nullable
private Form getForm(FILE tplFile) { private Form getForm(FILE tplFile) {
ReadXmlTypeLocalManager.setReadXmlType(ReadXmlType.DESIGN); ReadXmlTypeLocalManager.setReadXmlType(ReadXmlType.DESIGN);

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

Loading…
Cancel
Save