Browse Source

Merge branch 'feature/x' of https://code.fineres.com/scm/~fly.li/design into feature/x

research/11.0
fly.li 3 years ago
parent
commit
4121008b3d
  1. 4
      designer-base/src/main/java/com/fr/design/formula/FormulaPane.java
  2. 33
      designer-base/src/main/java/com/fr/design/locale/impl/DoubleSplashMark.java
  3. 4
      designer-base/src/main/java/com/fr/design/locale/impl/SplashMark.java
  4. 1
      designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java
  5. 11
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  6. 17
      designer-base/src/main/java/com/fr/design/mainframe/theme/FormThemeProfilePane.java
  7. 11
      designer-base/src/main/java/com/fr/design/mainframe/theme/ReportThemeProfilePane.java
  8. 85
      designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeProfilePane.java
  9. 9
      designer-base/src/main/java/com/fr/design/mainframe/theme/edit/CellStyleListEditPane.java
  10. 13
      designer-base/src/main/java/com/fr/design/utils/DesignUtils.java
  11. 7
      designer-base/src/test/java/com/fr/design/utils/DesignUtilsTest.java
  12. 58
      designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java
  13. 42
      designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java
  14. 2
      designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/ThemedCellStyleListPane.java
  15. 9
      designer-realize/src/main/java/com/fr/start/common/SplashPane4WinAndJDK11.java
  16. BIN
      designer-realize/src/main/resources/com/fr/design/images/splash.png
  17. BIN
      designer-realize/src/main/resources/com/fr/design/images/splash@2x.png
  18. BIN
      designer-realize/src/main/resources/com/fr/design/images/splash_10.png
  19. BIN
      designer-realize/src/main/resources/com/fr/design/images/splash_10@2x.png
  20. BIN
      designer-realize/src/main/resources/com/fr/design/images/splash_10_en.png
  21. BIN
      designer-realize/src/main/resources/com/fr/design/images/splash_en.png
  22. BIN
      designer-realize/src/main/resources/com/fr/design/images/splash_en@2x.png

4
designer-base/src/main/java/com/fr/design/formula/FormulaPane.java

@ -55,6 +55,7 @@ import com.fr.stable.EssentialUtils;
import com.fr.stable.ParameterProvider; import com.fr.stable.ParameterProvider;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.UtilEvalError; import com.fr.stable.UtilEvalError;
import com.fr.stable.script.CRAddress;
import com.fr.stable.script.ColumnRowRange; import com.fr.stable.script.ColumnRowRange;
import com.fr.stable.script.Expression; import com.fr.stable.script.Expression;
import com.fr.stable.script.Node; import com.fr.stable.script.Node;
@ -891,7 +892,8 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
} }
public void hunter4Tiny(Tiny tiny) { public void hunter4Tiny(Tiny tiny) {
if (tiny.getClass() == ColumnRowRangeInPage.class || Arrays.asList(curReportVariables).contains(tiny.toString())) { if (tiny.getClass() == ColumnRowRangeInPage.class || tiny.getClass() == CRAddress.class
|| Arrays.asList(curReportVariables).contains(tiny.toString())) {
supported = false; supported = false;
unSupportedNode = tiny.toString(); unSupportedNode = tiny.toString();
} }

33
designer-base/src/main/java/com/fr/design/locale/impl/DoubleSplashMark.java

@ -0,0 +1,33 @@
package com.fr.design.locale.impl;
import com.fr.design.DesignerEnvManager;
import com.fr.general.locale.LocaleMark;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
/**
* @author hades
* @version 10.0
* Created by hades on 2021/9/2
*/
public class DoubleSplashMark implements LocaleMark<String> {
private final Map<Locale, String> map = new HashMap<Locale, String>();
private static final String SPLASH_PATH_X2 = "/com/fr/design/images/splash@2x.png";
private static final String SPLASH_PATH_EN_X2 = "/com/fr/design/images/splash_en@2x.png";
public DoubleSplashMark() {
map.put(Locale.CHINA, SPLASH_PATH_X2);
map.put(Locale.KOREA, SPLASH_PATH_EN_X2);
map.put(Locale.JAPAN, SPLASH_PATH_EN_X2);
map.put(Locale.US, SPLASH_PATH_EN_X2);
map.put(Locale.TAIWAN, SPLASH_PATH_EN_X2);
}
@Override
public String getValue() {
String result = map.get(DesignerEnvManager.getEnvManager().getLanguage());
return result == null ? SPLASH_PATH_EN_X2 : result;
}
}

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

@ -15,8 +15,8 @@ import java.util.Map;
public class SplashMark implements LocaleMark<String> { public class SplashMark implements LocaleMark<String> {
private Map<Locale, String> map = new HashMap<Locale, String>(); private Map<Locale, String> map = new HashMap<Locale, String>();
private static final String SPLASH_PATH = "/com/fr/design/images/splash_10.png"; private static final String SPLASH_PATH = "/com/fr/design/images/splash.png";
private static final String SPLASH_EN_PATH = "/com/fr/design/images/splash_10_en.png"; private static final String SPLASH_EN_PATH = "/com/fr/design/images/splash_en.png";
public SplashMark() { public SplashMark() {
map.put(Locale.CHINA, SPLASH_PATH); map.put(Locale.CHINA, SPLASH_PATH);

1
designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java

@ -458,6 +458,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
for (PropertyItem item : propertyItemMap.values()) { for (PropertyItem item : propertyItemMap.values()) {
item.onResize(); item.onResize();
} }
super.onResize();
} }
public EastRegionContainerPane(JPanel leftPane, JPanel rightPane) { public EastRegionContainerPane(JPanel leftPane, JPanel rightPane) {

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

@ -54,6 +54,7 @@ import com.fr.design.menu.NameSeparator;
import com.fr.design.menu.ShortCut; import com.fr.design.menu.ShortCut;
import com.fr.design.preview.PagePreview; import com.fr.design.preview.PagePreview;
import com.fr.design.ui.util.UIUtil; import com.fr.design.ui.util.UIUtil;
import com.fr.design.utils.DesignUtils;
import com.fr.design.worker.save.CallbackSaveWorker; import com.fr.design.worker.save.CallbackSaveWorker;
import com.fr.design.worker.save.EmptyCallBackSaveWorker; import com.fr.design.worker.save.EmptyCallBackSaveWorker;
import com.fr.design.write.submit.DBManipulationInWidgetEventPane; import com.fr.design.write.submit.DBManipulationInWidgetEventPane;
@ -194,13 +195,13 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
designModel = createDesignModel(parameters); designModel = createDesignModel(parameters);
} }
addCenterPane(); addCenterPane();
this.undoState = createUndoState();
initAndStartPlugin();
if (isNewFile) { if (isNewFile) {
// REPORT-58486: 必须在初始的UndoState创建前设置主题,使得初始的UndoState就包含了主题效果
setUpTheme4NewTemplate(); setUpTheme4NewTemplate();
} }
this.undoState = createUndoState();
initAndStartPlugin();
startListenThemeConfig(); startListenThemeConfig();
} }
@ -1150,7 +1151,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
public boolean isOldDesigner() { public boolean isOldDesigner() {
String xmlDesignerVersion = getTarget().getXMLDesignerVersion(); String xmlDesignerVersion = getTarget().getXMLDesignerVersion();
if (isHigherThanCurrent(xmlDesignerVersion)) { if (isHigherThanCurrent(xmlDesignerVersion)) {
String infor = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Template_Version_Not_Match", StringUtils.parseVersion(xmlDesignerVersion)); String infor = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Template_Version_Not_Match", DesignUtils.parseVersion(xmlDesignerVersion));
String moreInfo = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Server_Version_Tip_More_Info"); String moreInfo = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Server_Version_Tip_More_Info");
new InformationWarnPane(infor, moreInfo, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips")).show(); new InformationWarnPane(infor, moreInfo, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips")).show();
return true; return true;

17
designer-base/src/main/java/com/fr/design/mainframe/theme/FormThemeProfilePane.java

@ -1,6 +1,5 @@
package com.fr.design.mainframe.theme; package com.fr.design.mainframe.theme;
import com.fr.base.theme.FineColorManager;
import com.fr.base.theme.FormTheme; import com.fr.base.theme.FormTheme;
import com.fr.base.theme.TemplateThemeConfig; import com.fr.base.theme.TemplateThemeConfig;
import com.fr.base.theme.settings.ThemedComponentStyle; import com.fr.base.theme.settings.ThemedComponentStyle;
@ -13,8 +12,6 @@ import com.fr.design.mainframe.theme.edit.FormBodyStyleEditPane;
import com.fr.design.mainframe.theme.preview.FormThemePreviewPane; import com.fr.design.mainframe.theme.preview.FormThemePreviewPane;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.util.List;
import java.awt.Color;
import static com.fr.design.i18n.Toolkit.i18nText; import static com.fr.design.i18n.Toolkit.i18nText;
@ -61,20 +58,6 @@ public class FormThemeProfilePane extends TemplateThemeProfilePane<FormTheme> {
return container; return container;
} }
@Override
public void onColorSchemeChanged(List<Color> colors) {
super.onColorSchemeChanged(colors);
FineColorManager.FineColorReplaceByColorScheme replaceByColorScheme = new FineColorManager.FineColorReplaceByColorScheme(colors);
ThemedFormBodyStyle formBodyStyle = formBodyStyleSettingPane.updateBean();
FineColorManager.traverse(formBodyStyle, replaceByColorScheme);
formBodyStyleSettingPane.populateBean(formBodyStyle);
ThemedComponentStyle componentStyle = componentStyleSettingPane.updateBean();
FineColorManager.traverse(componentStyle, replaceByColorScheme);
componentStyleSettingPane.populateBean(componentStyle);
}
@Override @Override
public void populateBean(FormTheme theme) { public void populateBean(FormTheme theme) {
super.populateBean(theme); super.populateBean(theme);

11
designer-base/src/main/java/com/fr/design/mainframe/theme/ReportThemeProfilePane.java

@ -39,17 +39,6 @@ public class ReportThemeProfilePane extends TemplateThemeProfilePane<ReportTheme
return container; return container;
} }
@Override
public void onColorSchemeChanged(List<Color> colors) {
super.onColorSchemeChanged(colors);
FineColorManager.FineColorReplaceByColorScheme replaceByColorScheme = new FineColorManager.FineColorReplaceByColorScheme(colors);
ThemedReportBodyStyle bodyStyle = reportBodyStyleSettingPane.updateBean();
FineColorManager.traverse(bodyStyle, replaceByColorScheme);
reportBodyStyleSettingPane.populateBean(bodyStyle);
}
@Override @Override
public void populateBean(ReportTheme theme) { public void populateBean(ReportTheme theme) {
super.populateBean(theme); super.populateBean(theme);

85
designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeProfilePane.java

@ -7,6 +7,7 @@ import com.fr.base.theme.settings.ThemeThumbnail;
import com.fr.base.theme.settings.ThemedCellStyleList; import com.fr.base.theme.settings.ThemedCellStyleList;
import com.fr.base.theme.settings.ThemedChartStyle; import com.fr.base.theme.settings.ThemedChartStyle;
import com.fr.base.theme.settings.ThemedColorScheme; import com.fr.base.theme.settings.ThemedColorScheme;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; import com.fr.design.gui.frpane.AbstractAttrNoScrollPane;
import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.gui.frpane.AttributeChangeListener;
@ -26,6 +27,7 @@ import com.fr.design.mainframe.theme.edit.ui.ColorListPane;
import com.fr.design.mainframe.theme.edit.ui.LabelUtils; import com.fr.design.mainframe.theme.edit.ui.LabelUtils;
import com.fr.design.mainframe.theme.ui.BorderUtils; import com.fr.design.mainframe.theme.ui.BorderUtils;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.Inter;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.transaction.CallBackAdaptor; import com.fr.transaction.CallBackAdaptor;
@ -44,6 +46,7 @@ import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener; import javax.swing.event.DocumentListener;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.Image; import java.awt.Image;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
@ -90,6 +93,8 @@ public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends
private UIButton saveButton = new UIButton(); private UIButton saveButton = new UIButton();
private UIButton saveAsButton = new UIButton(); private UIButton saveAsButton = new UIButton();
private boolean refreshingThemedColor = false;
private boolean currentIsNewTheme; private boolean currentIsNewTheme;
private T theme; private T theme;
@ -149,12 +154,12 @@ public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends
return titleContainer; return titleContainer;
} }
private JPanel createRightPane() { private JPanel createRightPane() {
JPanel container = new JPanel(new BorderLayout(0, 12)); JPanel container = new JPanel(new BorderLayout(0, 0));
container.setPreferredSize(new Dimension(RIGHT_PANE_WIDTH, RIGHT_PANE_HEIGHT)); container.setPreferredSize(new Dimension(RIGHT_PANE_WIDTH, RIGHT_PANE_HEIGHT));
JPanel nameEditPane = createNameEditPane(); JPanel nameEditPane = createNameEditPane();
container.add(nameEditPane, BorderLayout.NORTH); container.add(nameEditPane, BorderLayout.NORTH);
JPanel settingPane = new JPanel(new BorderLayout(0, 10)); JPanel settingPane = new JPanel(new BorderLayout(0, IntervalConstants.INTERVAL_L1));
container.add(settingPane, BorderLayout.CENTER); container.add(settingPane, BorderLayout.CENTER);
settingPane.add(createColorSchemeEditPane(), BorderLayout.NORTH); settingPane.add(createColorSchemeEditPane(), BorderLayout.NORTH);
settingPane.add(createCustomEditorsPane(), BorderLayout.CENTER); settingPane.add(createCustomEditorsPane(), BorderLayout.CENTER);
@ -170,13 +175,6 @@ public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends
} }
private JPanel createNameEditPane() { private JPanel createNameEditPane() {
JPanel container = new JPanel(new BorderLayout(30, 0));
container.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0));
container.add(LabelUtils.createLabel(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Edit_Pane_Name")), BorderLayout.WEST);
JPanel settingContainer = new JPanel(new BorderLayout(10, 0));
container.add(settingContainer, BorderLayout.CENTER);
nameErrorLabel = LabelUtils.createLabel(StringUtils.EMPTY, Color.RED); nameErrorLabel = LabelUtils.createLabel(StringUtils.EMPTY, Color.RED);
nameErrorLabel.setVisible(false); nameErrorLabel.setVisible(false);
@ -187,14 +185,14 @@ public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends
@Override @Override
public void insertUpdate(DocumentEvent e) { public void insertUpdate(DocumentEvent e) {
if (isEnabled()) { if (isEnabled()) {
checkThemeCanBeSavedAndUpdateUI(currentIsNewTheme, nameTextField, nameErrorLabel, saveButton); checkThemeCanBeSavedAndUpdateUI(currentIsNewTheme, false, currentIsNewTheme, true, nameTextField, nameErrorLabel, saveButton);
} }
} }
@Override @Override
public void removeUpdate(DocumentEvent e) { public void removeUpdate(DocumentEvent e) {
if (isEnabled()) { if (isEnabled()) {
checkThemeCanBeSavedAndUpdateUI(currentIsNewTheme, nameTextField, nameErrorLabel, saveButton); checkThemeCanBeSavedAndUpdateUI(currentIsNewTheme, false, currentIsNewTheme, true, nameTextField, nameErrorLabel, saveButton);
} }
} }
@ -207,22 +205,26 @@ public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends
@Override @Override
public void focusGained(FocusEvent e) { public void focusGained(FocusEvent e) {
if (isEnabled()) { if (isEnabled()) {
checkThemeCanBeSavedAndUpdateUI(currentIsNewTheme, nameTextField, nameErrorLabel, saveButton); checkThemeCanBeSavedAndUpdateUI(currentIsNewTheme, false, currentIsNewTheme, true, nameTextField, nameErrorLabel, saveButton);
} }
} }
@Override @Override
public void focusLost(FocusEvent e) { public void focusLost(FocusEvent e) {
if (isEnabled()) { if (isEnabled()) {
checkThemeCanBeSavedAndUpdateUI(currentIsNewTheme, nameTextField, nameErrorLabel, saveButton); checkThemeCanBeSavedAndUpdateUI(currentIsNewTheme, true, currentIsNewTheme, true, nameTextField, nameErrorLabel, saveButton);
} }
} }
}); });
settingContainer.add(nameTextField, BorderLayout.WEST); double p = TableLayout.PREFERRED;
settingContainer.add(nameErrorLabel, BorderLayout.CENTER); JPanel container = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{
new Component[] { LabelUtils.createLabel(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Edit_Pane_Name")), nameTextField },
new Component[] { null, nameErrorLabel },
}, new double[] { 20, 20}, new double[] { p, 165}, IntervalConstants.INTERVAL_L1, IntervalConstants.INTERVAL_W0);
container.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0));
return container; return container;
} }
private JPanel createColorSchemeEditPane() { private JPanel createColorSchemeEditPane() {
@ -265,8 +267,13 @@ public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends
colorListPane.addColorChangeListener(new ChangeListener() { colorListPane.addColorChangeListener(new ChangeListener() {
@Override @Override
public void stateChanged(ChangeEvent e) { public void stateChanged(ChangeEvent e) {
if (refreshingThemedColor) {
return;
}
List<Color> colors = colorListPane.update(); List<Color> colors = colorListPane.update();
refreshingThemedColor = true;
onColorSchemeChanged(colors); onColorSchemeChanged(colors);
refreshingThemedColor = false;
} }
}); });
@ -310,13 +317,10 @@ public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends
public void onColorSchemeChanged(List<Color> colors) { public void onColorSchemeChanged(List<Color> colors) {
colorListExtendedPane.populate(colors); colorListExtendedPane.populate(colors);
FineColorManager.FineColorReplaceByColorScheme replaceByColorScheme = new FineColorManager.FineColorReplaceByColorScheme(colors); FineColorManager.FineColorReplaceByColorScheme replaceByColorScheme = new FineColorManager.FineColorReplaceByColorScheme(colors);
ThemedCellStyleList cellStyle = cellStyleSettingPane.updateBean(); T theme = updateBean();
FineColorManager.traverse(cellStyle, replaceByColorScheme);
ThemedChartStyle themedChartStyle = chartStyleSettingPane.updateBean(); FineColorManager.traverse(theme, replaceByColorScheme);
FineColorManager.traverse(themedChartStyle, replaceByColorScheme); populateBean(theme);
chartStyleSettingPane.populateBean(themedChartStyle);
chartStyleSettingPane.populateGradientBar(colors);
} }
public void populateBean(T theme) { public void populateBean(T theme) {
@ -389,7 +393,7 @@ public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
T theme = updateBean(); T theme = updateBean();
boolean canBeSaved = checkThemeCanBeSavedAndUpdateUI(currentIsNewTheme, nameTextField, nameErrorLabel, saveButton); boolean canBeSaved = checkThemeCanBeSavedAndUpdateUI(currentIsNewTheme, true, currentIsNewTheme, true, nameTextField, nameErrorLabel, saveButton);
if (canBeSaved && theme != null) { if (canBeSaved && theme != null) {
theme.setName(nameTextField.getText()); theme.setName(nameTextField.getText());
config.addTheme(theme, true, new CallBackAdaptor() { config.addTheme(theme, true, new CallBackAdaptor() {
@ -474,14 +478,14 @@ public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends
@Override @Override
public void insertUpdate(DocumentEvent e) { public void insertUpdate(DocumentEvent e) {
if (isEnabled()) { if (isEnabled()) {
checkThemeCanBeSavedAndUpdateUI(true, nameTextField, nameErrorLabel, confirmButton); checkThemeCanBeSavedAndUpdateUI(true, false, true, true, nameTextField, nameErrorLabel, confirmButton);
} }
} }
@Override @Override
public void removeUpdate(DocumentEvent e) { public void removeUpdate(DocumentEvent e) {
if (isEnabled()) { if (isEnabled()) {
checkThemeCanBeSavedAndUpdateUI(true, nameTextField, nameErrorLabel, confirmButton); checkThemeCanBeSavedAndUpdateUI(true, false, true, true, nameTextField, nameErrorLabel, confirmButton);
} }
} }
@ -494,14 +498,14 @@ public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends
@Override @Override
public void focusGained(FocusEvent e) { public void focusGained(FocusEvent e) {
if (isEnabled()) { if (isEnabled()) {
checkThemeCanBeSavedAndUpdateUI(true, nameTextField, nameErrorLabel, confirmButton); checkThemeCanBeSavedAndUpdateUI(true, false, true, true, nameTextField, nameErrorLabel, confirmButton);
} }
} }
@Override @Override
public void focusLost(FocusEvent e) { public void focusLost(FocusEvent e) {
if (isEnabled()) { if (isEnabled()) {
checkThemeCanBeSavedAndUpdateUI(true, nameTextField, nameErrorLabel, confirmButton); checkThemeCanBeSavedAndUpdateUI(true, true, true, true, nameTextField, nameErrorLabel, confirmButton);
} }
} }
}); });
@ -547,7 +551,7 @@ public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends
FineLoggerFactory.getLogger().error(ex.getMessage(), ex); FineLoggerFactory.getLogger().error(ex.getMessage(), ex);
return; return;
} }
boolean canBeSaved = checkThemeCanBeSavedAndUpdateUI(true, nameTextField, nameErrorLabel, confirmButton); boolean canBeSaved = checkThemeCanBeSavedAndUpdateUI(true, true, true, true, nameTextField, nameErrorLabel, confirmButton);
if (canBeSaved && newThemeObject != null) { if (canBeSaved && newThemeObject != null) {
newThemeObject.setName(name); newThemeObject.setName(name);
newThemeObject.setRemovable(true); newThemeObject.setRemovable(true);
@ -583,17 +587,28 @@ public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends
private boolean isThemeNameDuplicated(String name) { private boolean isThemeNameDuplicated(String name) {
return config.cachedFetch(name) != null; return config.cachedFetch(name) != null;
} }
private boolean checkThemeCanBeSavedAndUpdateUI(boolean checkDuplicated, UITextField textField, UILabel errorLabel, UIButton... actionButtons) { private boolean checkThemeCanBeSavedAndUpdateUI(
String error = StringUtils.EMPTY; boolean checkEmpty,
boolean displayEmptyTip,
boolean checkDuplicated,
boolean displayDuplicatedTip,
UITextField textField,
UILabel errorLabel, UIButton... actionButtons) {
String name = textField.getText(); String name = textField.getText();
if (isThemeNameEmpty(name)) {
error = Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Edit_Pane_Empty_Name_Error_Tip"); boolean valid = true;
errorLabel.setText(StringUtils.EMPTY);
if (checkEmpty && isThemeNameEmpty(name)) {
valid = false;
if (displayEmptyTip) {
errorLabel.setText(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Edit_Pane_Empty_Name_Error_Tip"));
}
} else if (checkDuplicated && isThemeNameDuplicated(name)) { } else if (checkDuplicated && isThemeNameDuplicated(name)) {
error = Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Edit_Pane_Duplicated_Name_Error_Tip"); valid = false;
if (displayDuplicatedTip) {
errorLabel.setText(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Edit_Pane_Duplicated_Name_Error_Tip"));
}
} }
errorLabel.setText(error);
boolean valid = StringUtils.isEmpty(error);
errorLabel.setVisible(!valid); errorLabel.setVisible(!valid);
if (actionButtons != null && actionButtons.length > 0) { if (actionButtons != null && actionButtons.length > 0) {

9
designer-base/src/main/java/com/fr/design/mainframe/theme/edit/CellStyleListEditPane.java

@ -173,6 +173,8 @@ public class CellStyleListEditPane extends JListControlPane {
return; return;
} }
int oldSelectedIndex = getSelectedIndex();
List<NameObject> nameObjectList = new ArrayList<>(); List<NameObject> nameObjectList = new ArrayList<>();
List<ThemedCellStyle> cellStyleList = ob.getCellStyleList(); List<ThemedCellStyle> cellStyleList = ob.getCellStyleList();
@ -185,9 +187,16 @@ public class CellStyleListEditPane extends JListControlPane {
populate(nameObjectArray); populate(nameObjectArray);
int newSelectedIndex = oldSelectedIndex;
if (newSelectedIndex >= nameObjectArray.length) {
newSelectedIndex = 0;
}
setSelectedIndex(newSelectedIndex);
} }
public ThemedCellStyleList updateBean() { public ThemedCellStyleList updateBean() {
nameableList.stopEditing();
Nameable[] nameables = this.update(); Nameable[] nameables = this.update();
ThemedCellStyleList styleConfig = new ThemedCellStyleList(); ThemedCellStyleList styleConfig = new ThemedCellStyleList();
for (Nameable nameable : nameables) { for (Nameable nameable : nameables) {

13
designer-base/src/main/java/com/fr/design/utils/DesignUtils.java

@ -425,4 +425,17 @@ public class DesignUtils {
return true; return true;
} }
/**
* FR25.0版本出来需要进行适配下
*
* @param xmlDesignerVersion
* @return
*/
public static String parseVersion(String xmlDesignerVersion) {
if (StringUtils.isNotEmpty(xmlDesignerVersion)) {
return String.valueOf(xmlDesignerVersion.charAt(0) - 'A');
}
return xmlDesignerVersion;
}
} }

7
designer-base/src/test/java/com/fr/design/utils/DesignUtilsTest.java

@ -3,6 +3,7 @@ package com.fr.design.utils;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import junit.framework.TestCase; import junit.framework.TestCase;
import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import java.net.ServerSocket; import java.net.ServerSocket;
@ -29,4 +30,10 @@ public class DesignUtilsTest extends TestCase {
assertTrue(DesignUtils.isPortOccupied()); assertTrue(DesignUtils.isPortOccupied());
} }
@Test
public void testParseVersion() {
Assert.assertEquals("10", DesignUtils.parseVersion("KAA"));
Assert.assertEquals("11", DesignUtils.parseVersion("LAA"));
}
} }

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

@ -2,12 +2,8 @@ package com.fr.design.mainframe;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.chart.BaseChartCollection; import com.fr.base.chart.BaseChartCollection;
import com.fr.base.theme.TemplateThemeAware;
import com.fr.base.theme.TemplateThemeCompatible;
import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.chartattr.ChartCollection;
import com.fr.chartx.attr.ChartProvider; import com.fr.chartx.attr.ChartProvider;
import com.fr.base.theme.FormTheme;
import com.fr.base.theme.TemplateTheme;
import com.fr.design.DesignModelAdapter; import com.fr.design.DesignModelAdapter;
import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.DesignTableDataManager;
import com.fr.design.data.datapane.TableDataTreePane; import com.fr.design.data.datapane.TableDataTreePane;
@ -22,7 +18,6 @@ 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.file.HistoryTemplateListCache;
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;
@ -32,24 +27,16 @@ 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.main.Form;
import com.fr.form.main.WidgetGather;
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.ui.AbstractBorderStyleWidget; import com.fr.form.share.editor.SharableEditorProvider;
import com.fr.form.ui.ChartEditor;
import com.fr.form.ui.ElementCaseEditor;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
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.JWindow; import javax.swing.JWindow;
import java.util.List; import javax.swing.SwingUtilities;
import java.util.Map;
import java.awt.Color; import java.awt.Color;
import java.awt.Component; import java.awt.Component;
import java.awt.Point; import java.awt.Point;
@ -59,7 +46,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;
/** /**
* 添加模式下鼠标事件处理器 * 添加模式下鼠标事件处理器
@ -150,9 +140,6 @@ public class FormCreatorDropTarget extends DropTarget {
EventDispatcher.fire(TableDataModifyEvent.INSTANCE, new ContentChangeItem(tdNameMap, widget, ChangeItem.TABLE_DATA_NAME)); EventDispatcher.fire(TableDataModifyEvent.INSTANCE, new ContentChangeItem(tdNameMap, widget, ChangeItem.TABLE_DATA_NAME));
} }
// 新疆的图表块和报表块默认主题化
addThemeToNewWidget(addingXCreator);
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); designer.getEditListenerTable().fireCreatorModified(addingModel.getXCreator(), DesignerEvent.CREATOR_ADDED);
@ -363,37 +350,4 @@ public class FormCreatorDropTarget extends DropTarget {
public TabDragInner getTabDragInner() { public TabDragInner getTabDragInner() {
return this.tabDragInner; return this.tabDragInner;
} }
private void addThemeToNewWidget(XCreator addingXCreator) {
JTemplate<?,?> template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (template == null) {
return;
}
TemplateTheme theme = template.getTemplateTheme();
if (!(theme instanceof FormTheme)) {
return;
}
FormTheme formTheme = (FormTheme) theme;
Form.traversalWidget(addingXCreator.toData(), new WidgetGather() {
@Override
public void dealWith(Widget widget) {
if (widget instanceof AbstractBorderStyleWidget) {
AbstractBorderStyleWidget styleWidget = (AbstractBorderStyleWidget) widget;
if (!styleWidget.supportThemed()) {
return;
}
boolean followingTheme = (!addingXCreator.isShared()) || styleWidget.isBorderStyleFollowingTheme();
styleWidget.setBorderStyleFollowingTheme(followingTheme);
if (followingTheme) {
styleWidget.onTemplateUsingThemeChange(formTheme, TemplateThemeCompatible.NONE);
}
}
}
@Override
public boolean dealWithAllCards() { return true; }
}, AbstractBorderStyleWidget.class);
addingXCreator.rebuid();
}
} }

42
designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java

@ -2,6 +2,9 @@ package com.fr.design.mainframe;
import com.fr.base.Parameter; import com.fr.base.Parameter;
import com.fr.base.ScreenResolution; import com.fr.base.ScreenResolution;
import com.fr.base.theme.FormTheme;
import com.fr.base.theme.TemplateTheme;
import com.fr.base.theme.TemplateThemeCompatible;
import com.fr.base.vcs.DesignerMode; import com.fr.base.vcs.DesignerMode;
import com.fr.design.DesignModelAdapter; import com.fr.design.DesignModelAdapter;
import com.fr.design.DesignState; import com.fr.design.DesignState;
@ -41,6 +44,7 @@ import com.fr.design.designer.creator.cardlayout.XWCardMainBorderLayout;
import com.fr.design.designer.properties.FormWidgetAuthorityEditPane; import com.fr.design.designer.properties.FormWidgetAuthorityEditPane;
import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.event.DesignerOpenedListener; import com.fr.design.event.DesignerOpenedListener;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.fit.DesignerUIModeConfig; import com.fr.design.fit.DesignerUIModeConfig;
import com.fr.design.form.util.XCreatorConstants; import com.fr.design.form.util.XCreatorConstants;
@ -57,7 +61,9 @@ import com.fr.design.utils.gui.LayoutUtils;
import com.fr.form.FormElementCaseContainerProvider; import com.fr.form.FormElementCaseContainerProvider;
import com.fr.form.FormElementCaseProvider; import com.fr.form.FormElementCaseProvider;
import com.fr.form.main.Form; import com.fr.form.main.Form;
import com.fr.form.main.WidgetGather;
import com.fr.form.parameter.FormSubmitButton; import com.fr.form.parameter.FormSubmitButton;
import com.fr.form.ui.AbstractBorderStyleWidget;
import com.fr.form.ui.EditorHolder; import com.fr.form.ui.EditorHolder;
import com.fr.form.ui.PaddingMargin; import com.fr.form.ui.PaddingMargin;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
@ -1189,6 +1195,9 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
* @param xCreator 组件 * @param xCreator 组件
*/ */
public void startDraggingBean(XCreator xCreator) { public void startDraggingBean(XCreator xCreator) {
// 新疆的图表块和报表块默认主题化
addThemeToDroppedNewWidget(xCreator);
// 根据所选择的组件的BeanInfo生成相应的AddingModel // 根据所选择的组件的BeanInfo生成相应的AddingModel
// AddingModel和StateModel不一样,适合当前选择的组件相关的 // AddingModel和StateModel不一样,适合当前选择的组件相关的
addingModel = new AddingModel(this, xCreator); addingModel = new AddingModel(this, xCreator);
@ -1853,4 +1862,37 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
public FormSpacingLineDrawer getSpacingLineDrawer() { public FormSpacingLineDrawer getSpacingLineDrawer() {
return spacingLineDrawer; return spacingLineDrawer;
} }
private void addThemeToDroppedNewWidget(XCreator addingXCreator) {
JTemplate<?,?> template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (template == null) {
return;
}
TemplateTheme theme = template.getTemplateTheme();
if (!(theme instanceof FormTheme)) {
return;
}
FormTheme formTheme = (FormTheme) theme;
Form.traversalWidget(addingXCreator.toData(), new WidgetGather() {
@Override
public void dealWith(Widget widget) {
if (widget instanceof AbstractBorderStyleWidget) {
AbstractBorderStyleWidget styleWidget = (AbstractBorderStyleWidget) widget;
if (!styleWidget.supportThemed()) {
return;
}
boolean followingTheme = (!addingXCreator.isShared()) || styleWidget.isBorderStyleFollowingTheme();
styleWidget.setBorderStyleFollowingTheme(followingTheme);
if (followingTheme) {
styleWidget.onTemplateUsingThemeChange(formTheme, TemplateThemeCompatible.NONE);
}
}
}
@Override
public boolean dealWithAllCards() { return true; }
}, AbstractBorderStyleWidget.class);
addingXCreator.rebuid();
}
} }

2
designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/ThemedCellStyleListPane.java

@ -181,8 +181,6 @@ public class ThemedCellStyleListPane extends FurtherBasicBeanPane<NameStyle> imp
Graphics2D g2d = (Graphics2D) g; Graphics2D g2d = (Graphics2D) g;
int resolution = ScreenResolution.getScreenResolution(); int resolution = ScreenResolution.getScreenResolution();
g.clipRect(0, 0, getWidth() - 3, getHeight() - 3);
if (style == Style.DEFAULT_STYLE) { if (style == Style.DEFAULT_STYLE) {
// 如果是默认的style,就只写"Report"上去 // 如果是默认的style,就只写"Report"上去
Style.paintContent(g2d, paintText, style, getWidth() - 3, getHeight() - 3, resolution); Style.paintContent(g2d, paintText, style, getWidth() - 3, getHeight() - 3, resolution);

9
designer-realize/src/main/java/com/fr/start/common/SplashPane4WinAndJDK11.java

@ -2,6 +2,7 @@ package com.fr.start.common;
import com.bulenkov.iconloader.IconLoader; import com.bulenkov.iconloader.IconLoader;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.design.locale.impl.DoubleSplashMark;
import com.fr.design.locale.impl.SplashMark; import com.fr.design.locale.impl.SplashMark;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.general.locale.LocaleCenter; import com.fr.general.locale.LocaleCenter;
@ -28,25 +29,19 @@ public class SplashPane4WinAndJDK11 extends SplashPane{
*/ */
private boolean isDouble = false; private boolean isDouble = false;
private static final String IMAGE_SPLASH = "splash_10.png";
private static final String IMAGE_SPLASH_DOUBLE = "splash_10@2x.png";
public SplashPane4WinAndJDK11() { public SplashPane4WinAndJDK11() {
this.imagePath = getSplashPath4WinAndJdk11(); this.imagePath = getSplashPath4WinAndJdk11();
} }
private String getSplashPath4WinAndJdk11() { private String getSplashPath4WinAndJdk11() {
String path = (String) LocaleCenter.getMark(SplashMark.class).getValue(); String path = (String) LocaleCenter.getMark(SplashMark.class).getValue();
if (path.contains(IMAGE_SPLASH)) { String pathOfDouble = (String) LocaleCenter.getMark(DoubleSplashMark.class).getValue();
// 为图片加上"@2x" // 为图片加上"@2x"
String pathOfDouble = path.replace(IMAGE_SPLASH, IMAGE_SPLASH_DOUBLE);
// 某些定制jar里面没有两倍图,判断一下,如果文件不存在,就返回一倍图的path // 某些定制jar里面没有两倍图,判断一下,如果文件不存在,就返回一倍图的path
if (IOUtils.readResource(pathOfDouble) != null) { if (IOUtils.readResource(pathOfDouble) != null) {
this.isDouble = true; this.isDouble = true;
return pathOfDouble; return pathOfDouble;
} }
}
return path; return path;
} }

BIN
designer-realize/src/main/resources/com/fr/design/images/splash.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 286 KiB

BIN
designer-realize/src/main/resources/com/fr/design/images/splash@2x.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 914 KiB

BIN
designer-realize/src/main/resources/com/fr/design/images/splash_10.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 264 KiB

BIN
designer-realize/src/main/resources/com/fr/design/images/splash_10@2x.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 814 KiB

BIN
designer-realize/src/main/resources/com/fr/design/images/splash_10_en.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 257 KiB

BIN
designer-realize/src/main/resources/com/fr/design/images/splash_en.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 285 KiB

BIN
designer-realize/src/main/resources/com/fr/design/images/splash_en@2x.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 911 KiB

Loading…
Cancel
Save