diff --git a/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java b/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java index 77074ab96f..52807a6cb4 100644 --- a/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java +++ b/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.StringUtils; import com.fr.stable.UtilEvalError; +import com.fr.stable.script.CRAddress; import com.fr.stable.script.ColumnRowRange; import com.fr.stable.script.Expression; import com.fr.stable.script.Node; @@ -891,7 +892,8 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { } 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; unSupportedNode = tiny.toString(); } diff --git a/designer-base/src/main/java/com/fr/design/locale/impl/DoubleSplashMark.java b/designer-base/src/main/java/com/fr/design/locale/impl/DoubleSplashMark.java new file mode 100644 index 0000000000..78ee72b508 --- /dev/null +++ b/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 { + + private final Map map = new HashMap(); + 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; + } +} \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/locale/impl/SplashMark.java b/designer-base/src/main/java/com/fr/design/locale/impl/SplashMark.java index 8cf75c0587..93995eeddc 100644 --- a/designer-base/src/main/java/com/fr/design/locale/impl/SplashMark.java +++ b/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 { private Map map = new HashMap(); - private static final String SPLASH_PATH = "/com/fr/design/images/splash_10.png"; - private static final String SPLASH_EN_PATH = "/com/fr/design/images/splash_10_en.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_en.png"; public SplashMark() { map.put(Locale.CHINA, SPLASH_PATH); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java index 84993411e5..588b4e2563 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java +++ b/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()) { item.onResize(); } + super.onResize(); } public EastRegionContainerPane(JPanel leftPane, JPanel rightPane) { @@ -1006,7 +1007,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { button.setToolTipText(title); } - public void processSnapChat(){ + public void processSnapChat() { if (snapChat != null && !snapChat.hasRead()) { snapChat.markRead(); if (promptWindow != null) { diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java index 79762f212a..71372b7270 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java +++ b/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.preview.PagePreview; 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.EmptyCallBackSaveWorker; import com.fr.design.write.submit.DBManipulationInWidgetEventPane; @@ -194,13 +195,13 @@ public abstract class JTemplate> designModel = createDesignModel(parameters); } addCenterPane(); - this.undoState = createUndoState(); - - initAndStartPlugin(); - if (isNewFile) { + // REPORT-58486: 必须在初始的UndoState创建前设置主题,使得初始的UndoState就包含了主题效果 setUpTheme4NewTemplate(); } + this.undoState = createUndoState(); + + initAndStartPlugin(); startListenThemeConfig(); } @@ -1150,7 +1151,7 @@ public abstract class JTemplate> public boolean isOldDesigner() { String xmlDesignerVersion = getTarget().getXMLDesignerVersion(); 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"); new InformationWarnPane(infor, moreInfo, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips")).show(); return true; diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/FormThemeProfilePane.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/FormThemeProfilePane.java index 83179eddaf..ef99423bed 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/FormThemeProfilePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/FormThemeProfilePane.java @@ -1,6 +1,5 @@ package com.fr.design.mainframe.theme; -import com.fr.base.theme.FineColorManager; import com.fr.base.theme.FormTheme; import com.fr.base.theme.TemplateThemeConfig; 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 javax.swing.JPanel; -import java.util.List; -import java.awt.Color; import static com.fr.design.i18n.Toolkit.i18nText; @@ -61,20 +58,6 @@ public class FormThemeProfilePane extends TemplateThemeProfilePane { return container; } - @Override - public void onColorSchemeChanged(List 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 public void populateBean(FormTheme theme) { super.populateBean(theme); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/ReportThemeProfilePane.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/ReportThemeProfilePane.java index 091262b589..59f3ace8c1 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/ReportThemeProfilePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/ReportThemeProfilePane.java @@ -39,17 +39,6 @@ public class ReportThemeProfilePane extends TemplateThemeProfilePane colors) { - super.onColorSchemeChanged(colors); - - FineColorManager.FineColorReplaceByColorScheme replaceByColorScheme = new FineColorManager.FineColorReplaceByColorScheme(colors); - - ThemedReportBodyStyle bodyStyle = reportBodyStyleSettingPane.updateBean(); - FineColorManager.traverse(bodyStyle, replaceByColorScheme); - reportBodyStyleSettingPane.populateBean(bodyStyle); - } - @Override public void populateBean(ReportTheme theme) { super.populateBean(theme); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeProfilePane.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeProfilePane.java index 0abd6a7bc9..b7a8db48ae 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeProfilePane.java +++ b/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.ThemedChartStyle; import com.fr.base.theme.settings.ThemedColorScheme; +import com.fr.design.designer.IntervalConstants; import com.fr.design.dialog.FineJOptionPane; import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; 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.ui.BorderUtils; import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.general.Inter; import com.fr.log.FineLoggerFactory; import com.fr.stable.StringUtils; import com.fr.transaction.CallBackAdaptor; @@ -44,6 +46,7 @@ import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; import java.awt.BorderLayout; import java.awt.Color; +import java.awt.Component; import java.awt.Dimension; import java.awt.Image; import java.awt.event.ActionEvent; @@ -90,6 +93,8 @@ public abstract class TemplateThemeProfilePane extends private UIButton saveButton = new UIButton(); private UIButton saveAsButton = new UIButton(); + private boolean refreshingThemedColor = false; + private boolean currentIsNewTheme; private T theme; @@ -149,12 +154,12 @@ public abstract class TemplateThemeProfilePane extends return titleContainer; } 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)); JPanel nameEditPane = createNameEditPane(); 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); settingPane.add(createColorSchemeEditPane(), BorderLayout.NORTH); settingPane.add(createCustomEditorsPane(), BorderLayout.CENTER); @@ -170,13 +175,6 @@ public abstract class TemplateThemeProfilePane extends } 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.setVisible(false); @@ -187,14 +185,14 @@ public abstract class TemplateThemeProfilePane extends @Override public void insertUpdate(DocumentEvent e) { if (isEnabled()) { - checkThemeCanBeSavedAndUpdateUI(currentIsNewTheme, nameTextField, nameErrorLabel, saveButton); + checkThemeCanBeSavedAndUpdateUI(currentIsNewTheme, false, currentIsNewTheme, true, nameTextField, nameErrorLabel, saveButton); } } @Override public void removeUpdate(DocumentEvent e) { if (isEnabled()) { - checkThemeCanBeSavedAndUpdateUI(currentIsNewTheme, nameTextField, nameErrorLabel, saveButton); + checkThemeCanBeSavedAndUpdateUI(currentIsNewTheme, false, currentIsNewTheme, true, nameTextField, nameErrorLabel, saveButton); } } @@ -207,22 +205,26 @@ public abstract class TemplateThemeProfilePane extends @Override public void focusGained(FocusEvent e) { if (isEnabled()) { - checkThemeCanBeSavedAndUpdateUI(currentIsNewTheme, nameTextField, nameErrorLabel, saveButton); + checkThemeCanBeSavedAndUpdateUI(currentIsNewTheme, false, currentIsNewTheme, true, nameTextField, nameErrorLabel, saveButton); } } @Override public void focusLost(FocusEvent e) { 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; } private JPanel createColorSchemeEditPane() { @@ -265,8 +267,13 @@ public abstract class TemplateThemeProfilePane extends colorListPane.addColorChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { + if (refreshingThemedColor) { + return; + } List colors = colorListPane.update(); + refreshingThemedColor = true; onColorSchemeChanged(colors); + refreshingThemedColor = false; } }); @@ -310,13 +317,10 @@ public abstract class TemplateThemeProfilePane extends public void onColorSchemeChanged(List colors) { colorListExtendedPane.populate(colors); FineColorManager.FineColorReplaceByColorScheme replaceByColorScheme = new FineColorManager.FineColorReplaceByColorScheme(colors); - ThemedCellStyleList cellStyle = cellStyleSettingPane.updateBean(); - FineColorManager.traverse(cellStyle, replaceByColorScheme); + T theme = updateBean(); - ThemedChartStyle themedChartStyle = chartStyleSettingPane.updateBean(); - FineColorManager.traverse(themedChartStyle, replaceByColorScheme); - chartStyleSettingPane.populateBean(themedChartStyle); - chartStyleSettingPane.populateGradientBar(colors); + FineColorManager.traverse(theme, replaceByColorScheme); + populateBean(theme); } public void populateBean(T theme) { @@ -389,7 +393,7 @@ public abstract class TemplateThemeProfilePane extends @Override public void actionPerformed(ActionEvent e) { T theme = updateBean(); - boolean canBeSaved = checkThemeCanBeSavedAndUpdateUI(currentIsNewTheme, nameTextField, nameErrorLabel, saveButton); + boolean canBeSaved = checkThemeCanBeSavedAndUpdateUI(currentIsNewTheme, true, currentIsNewTheme, true, nameTextField, nameErrorLabel, saveButton); if (canBeSaved && theme != null) { theme.setName(nameTextField.getText()); config.addTheme(theme, true, new CallBackAdaptor() { @@ -474,14 +478,14 @@ public abstract class TemplateThemeProfilePane extends @Override public void insertUpdate(DocumentEvent e) { if (isEnabled()) { - checkThemeCanBeSavedAndUpdateUI(true, nameTextField, nameErrorLabel, confirmButton); + checkThemeCanBeSavedAndUpdateUI(true, false, true, true, nameTextField, nameErrorLabel, confirmButton); } } @Override public void removeUpdate(DocumentEvent e) { if (isEnabled()) { - checkThemeCanBeSavedAndUpdateUI(true, nameTextField, nameErrorLabel, confirmButton); + checkThemeCanBeSavedAndUpdateUI(true, false, true, true, nameTextField, nameErrorLabel, confirmButton); } } @@ -494,14 +498,14 @@ public abstract class TemplateThemeProfilePane extends @Override public void focusGained(FocusEvent e) { if (isEnabled()) { - checkThemeCanBeSavedAndUpdateUI(true, nameTextField, nameErrorLabel, confirmButton); + checkThemeCanBeSavedAndUpdateUI(true, false, true, true, nameTextField, nameErrorLabel, confirmButton); } } @Override public void focusLost(FocusEvent e) { if (isEnabled()) { - checkThemeCanBeSavedAndUpdateUI(true, nameTextField, nameErrorLabel, confirmButton); + checkThemeCanBeSavedAndUpdateUI(true, true, true, true, nameTextField, nameErrorLabel, confirmButton); } } }); @@ -547,7 +551,7 @@ public abstract class TemplateThemeProfilePane extends FineLoggerFactory.getLogger().error(ex.getMessage(), ex); return; } - boolean canBeSaved = checkThemeCanBeSavedAndUpdateUI(true, nameTextField, nameErrorLabel, confirmButton); + boolean canBeSaved = checkThemeCanBeSavedAndUpdateUI(true, true, true, true, nameTextField, nameErrorLabel, confirmButton); if (canBeSaved && newThemeObject != null) { newThemeObject.setName(name); newThemeObject.setRemovable(true); @@ -583,17 +587,28 @@ public abstract class TemplateThemeProfilePane extends private boolean isThemeNameDuplicated(String name) { return config.cachedFetch(name) != null; } - private boolean checkThemeCanBeSavedAndUpdateUI(boolean checkDuplicated, UITextField textField, UILabel errorLabel, UIButton... actionButtons) { - String error = StringUtils.EMPTY; + private boolean checkThemeCanBeSavedAndUpdateUI( + boolean checkEmpty, + boolean displayEmptyTip, + boolean checkDuplicated, + boolean displayDuplicatedTip, + UITextField textField, + UILabel errorLabel, UIButton... actionButtons) { 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)) { - 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); if (actionButtons != null && actionButtons.length > 0) { diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/edit/CellStyleListEditPane.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/edit/CellStyleListEditPane.java index e0e42b8b48..b8fc31b6d5 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/edit/CellStyleListEditPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/edit/CellStyleListEditPane.java @@ -173,6 +173,8 @@ public class CellStyleListEditPane extends JListControlPane { return; } + int oldSelectedIndex = getSelectedIndex(); + List nameObjectList = new ArrayList<>(); List cellStyleList = ob.getCellStyleList(); @@ -185,9 +187,16 @@ public class CellStyleListEditPane extends JListControlPane { populate(nameObjectArray); + int newSelectedIndex = oldSelectedIndex; + if (newSelectedIndex >= nameObjectArray.length) { + newSelectedIndex = 0; + } + setSelectedIndex(newSelectedIndex); } public ThemedCellStyleList updateBean() { + nameableList.stopEditing(); + Nameable[] nameables = this.update(); ThemedCellStyleList styleConfig = new ThemedCellStyleList(); for (Nameable nameable : nameables) { diff --git a/designer-base/src/main/java/com/fr/design/utils/DesignUtils.java b/designer-base/src/main/java/com/fr/design/utils/DesignUtils.java index 8bd4e880d9..f066d648a2 100644 --- a/designer-base/src/main/java/com/fr/design/utils/DesignUtils.java +++ b/designer-base/src/main/java/com/fr/design/utils/DesignUtils.java @@ -425,4 +425,17 @@ public class DesignUtils { 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; + } + } diff --git a/designer-base/src/test/java/com/fr/design/utils/DesignUtilsTest.java b/designer-base/src/test/java/com/fr/design/utils/DesignUtilsTest.java index 9db729a978..52c93dea50 100644 --- a/designer-base/src/test/java/com/fr/design/utils/DesignUtilsTest.java +++ b/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 junit.framework.TestCase; +import org.junit.Assert; import org.junit.Test; import java.net.ServerSocket; @@ -29,4 +30,10 @@ public class DesignUtilsTest extends TestCase { assertTrue(DesignUtils.isPortOccupied()); } + @Test + public void testParseVersion() { + Assert.assertEquals("10", DesignUtils.parseVersion("KAA")); + Assert.assertEquals("11", DesignUtils.parseVersion("LAA")); + } + } \ No newline at end of file diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java b/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java index 9731dd5081..7db972e9be 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java +++ b/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.chart.BaseChartCollection; -import com.fr.base.theme.TemplateThemeAware; -import com.fr.base.theme.TemplateThemeCompatible; import com.fr.chart.chartattr.ChartCollection; 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.data.DesignTableDataManager; 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.XWFitLayout; import com.fr.design.designer.creator.XWParameterLayout; -import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.form.util.XCreatorConstants; import com.fr.design.gui.ibutton.UIButton; 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.utils.ComponentUtils; 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.ShareLoader; -import com.fr.form.ui.AbstractBorderStyleWidget; -import com.fr.form.ui.ChartEditor; -import com.fr.form.ui.ElementCaseEditor; +import com.fr.form.share.editor.SharableEditorProvider; import com.fr.form.ui.Widget; import com.fr.stable.Constants; import com.fr.stable.StringUtils; -import java.util.Collections; -import java.util.HashMap; import javax.swing.BorderFactory; import javax.swing.JWindow; -import java.util.List; -import java.util.Map; +import javax.swing.SwingUtilities; import java.awt.Color; import java.awt.Component; import java.awt.Point; @@ -59,7 +46,10 @@ import java.awt.dnd.DropTarget; import java.awt.dnd.DropTargetDragEvent; import java.awt.dnd.DropTargetDropEvent; 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)); } - // 新疆的图表块和报表块默认主题化 - addThemeToNewWidget(addingXCreator); - designer.getSelectionModel().setSelectedCreators( FormSelectionUtils.rebuildSelection(xCreator, new Widget[]{widget})); designer.getEditListenerTable().fireCreatorModified(addingModel.getXCreator(), DesignerEvent.CREATOR_ADDED); @@ -363,37 +350,4 @@ public class FormCreatorDropTarget extends DropTarget { public TabDragInner getTabDragInner() { 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(); - } } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java b/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java index 92127c5a86..636f1f5489 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java +++ b/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.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.design.DesignModelAdapter; 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.dialog.FineJOptionPane; import com.fr.design.event.DesignerOpenedListener; +import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.fit.DesignerUIModeConfig; 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.FormElementCaseProvider; import com.fr.form.main.Form; +import com.fr.form.main.WidgetGather; import com.fr.form.parameter.FormSubmitButton; +import com.fr.form.ui.AbstractBorderStyleWidget; import com.fr.form.ui.EditorHolder; import com.fr.form.ui.PaddingMargin; import com.fr.form.ui.Widget; @@ -1189,6 +1195,9 @@ public class FormDesigner extends TargetComponent
implements TreeSelection * @param xCreator 组件 */ public void startDraggingBean(XCreator xCreator) { + + // 新疆的图表块和报表块默认主题化 + addThemeToDroppedNewWidget(xCreator); // 根据所选择的组件的BeanInfo生成相应的AddingModel // AddingModel和StateModel不一样,适合当前选择的组件相关的 addingModel = new AddingModel(this, xCreator); @@ -1853,4 +1862,37 @@ public class FormDesigner extends TargetComponent implements TreeSelection public FormSpacingLineDrawer getSpacingLineDrawer() { 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(); + } } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/ThemedCellStyleListPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/ThemedCellStyleListPane.java index 65da02e989..570d0d88d2 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/ThemedCellStyleListPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/ThemedCellStyleListPane.java @@ -181,8 +181,6 @@ public class ThemedCellStyleListPane extends FurtherBasicBeanPane imp Graphics2D g2d = (Graphics2D) g; int resolution = ScreenResolution.getScreenResolution(); - g.clipRect(0, 0, getWidth() - 3, getHeight() - 3); - if (style == Style.DEFAULT_STYLE) { // 如果是默认的style,就只写"Report"上去 Style.paintContent(g2d, paintText, style, getWidth() - 3, getHeight() - 3, resolution); diff --git a/designer-realize/src/main/java/com/fr/start/common/SplashPane4WinAndJDK11.java b/designer-realize/src/main/java/com/fr/start/common/SplashPane4WinAndJDK11.java index fea7deb3cc..458020b587 100644 --- a/designer-realize/src/main/java/com/fr/start/common/SplashPane4WinAndJDK11.java +++ b/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.fr.base.BaseUtils; +import com.fr.design.locale.impl.DoubleSplashMark; import com.fr.design.locale.impl.SplashMark; import com.fr.general.IOUtils; import com.fr.general.locale.LocaleCenter; @@ -28,24 +29,18 @@ public class SplashPane4WinAndJDK11 extends SplashPane{ */ 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() { this.imagePath = getSplashPath4WinAndJdk11(); } private String getSplashPath4WinAndJdk11() { String path = (String) LocaleCenter.getMark(SplashMark.class).getValue(); - if (path.contains(IMAGE_SPLASH)) { - // 为图片加上"@2x" - String pathOfDouble = path.replace(IMAGE_SPLASH, IMAGE_SPLASH_DOUBLE); - // 某些定制jar里面没有两倍图,判断一下,如果文件不存在,就返回一倍图的path - if (IOUtils.readResource(pathOfDouble) != null) { - this.isDouble = true; - return pathOfDouble; - } + String pathOfDouble = (String) LocaleCenter.getMark(DoubleSplashMark.class).getValue(); + // 为图片加上"@2x" + // 某些定制jar里面没有两倍图,判断一下,如果文件不存在,就返回一倍图的path + if (IOUtils.readResource(pathOfDouble) != null) { + this.isDouble = true; + return pathOfDouble; } return path; } diff --git a/designer-realize/src/main/resources/com/fr/design/images/splash.png b/designer-realize/src/main/resources/com/fr/design/images/splash.png new file mode 100644 index 0000000000..395d1d2a61 Binary files /dev/null and b/designer-realize/src/main/resources/com/fr/design/images/splash.png differ diff --git a/designer-realize/src/main/resources/com/fr/design/images/splash@2x.png b/designer-realize/src/main/resources/com/fr/design/images/splash@2x.png new file mode 100644 index 0000000000..1ef35c2b01 Binary files /dev/null and b/designer-realize/src/main/resources/com/fr/design/images/splash@2x.png differ diff --git a/designer-realize/src/main/resources/com/fr/design/images/splash_10.png b/designer-realize/src/main/resources/com/fr/design/images/splash_10.png deleted file mode 100644 index 088d124b9b..0000000000 Binary files a/designer-realize/src/main/resources/com/fr/design/images/splash_10.png and /dev/null differ diff --git a/designer-realize/src/main/resources/com/fr/design/images/splash_10@2x.png b/designer-realize/src/main/resources/com/fr/design/images/splash_10@2x.png deleted file mode 100644 index 0ce87ae6f9..0000000000 Binary files a/designer-realize/src/main/resources/com/fr/design/images/splash_10@2x.png and /dev/null differ diff --git a/designer-realize/src/main/resources/com/fr/design/images/splash_10_en.png b/designer-realize/src/main/resources/com/fr/design/images/splash_10_en.png deleted file mode 100644 index db254316f1..0000000000 Binary files a/designer-realize/src/main/resources/com/fr/design/images/splash_10_en.png and /dev/null differ diff --git a/designer-realize/src/main/resources/com/fr/design/images/splash_en.png b/designer-realize/src/main/resources/com/fr/design/images/splash_en.png new file mode 100644 index 0000000000..42538c0054 Binary files /dev/null and b/designer-realize/src/main/resources/com/fr/design/images/splash_en.png differ diff --git a/designer-realize/src/main/resources/com/fr/design/images/splash_en@2x.png b/designer-realize/src/main/resources/com/fr/design/images/splash_en@2x.png new file mode 100644 index 0000000000..eaed5f1af7 Binary files /dev/null and b/designer-realize/src/main/resources/com/fr/design/images/splash_en@2x.png differ