From 87e10003489d0097a2c1ba1af609a4dc0c80984e Mon Sep 17 00:00:00 2001 From: hades Date: Mon, 27 Dec 2021 12:01:51 +0800 Subject: [PATCH 01/17] =?UTF-8?q?REPORT-64609=20=E7=A3=81=E7=9B=98?= =?UTF-8?q?=E7=A9=BA=E9=97=B4=E6=BB=A1=E6=97=B6=20=E4=BF=9D=E5=AD=98?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E9=80=A0=E6=88=90=E6=A8=A1=E6=9D=BF=E4=B8=A2?= =?UTF-8?q?=E5=A4=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/common/exception/ThrowableHandler.java | 12 ++++ .../com/fr/design/mainframe/JTemplate.java | 3 +- .../worker/save/SaveFailureHandler.java | 70 +++++++++++++++++++ .../com/fr/design/worker/save/SaveWorker.java | 7 +- 4 files changed, 85 insertions(+), 7 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/common/exception/ThrowableHandler.java create mode 100644 designer-base/src/main/java/com/fr/design/worker/save/SaveFailureHandler.java diff --git a/designer-base/src/main/java/com/fr/common/exception/ThrowableHandler.java b/designer-base/src/main/java/com/fr/common/exception/ThrowableHandler.java new file mode 100644 index 000000000..225d90e79 --- /dev/null +++ b/designer-base/src/main/java/com/fr/common/exception/ThrowableHandler.java @@ -0,0 +1,12 @@ +package com.fr.common.exception; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2021/12/27 + */ +public interface ThrowableHandler { + + boolean process(Throwable e); + +} 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 f1f72b48c..3e6ec0819 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 @@ -50,6 +50,7 @@ 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.worker.save.SaveFailureHandler; import com.fr.design.write.submit.DBManipulationInWidgetEventPane; import com.fr.design.write.submit.DBManipulationPane; import com.fr.event.EventDispatcher; @@ -882,7 +883,7 @@ public abstract class JTemplate> export(); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); - JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), e.getMessage(), "Save Error", JOptionPane.ERROR_MESSAGE); + SaveFailureHandler.getInstance().process(e); return false; } this.editingFILE = editingFILE; diff --git a/designer-base/src/main/java/com/fr/design/worker/save/SaveFailureHandler.java b/designer-base/src/main/java/com/fr/design/worker/save/SaveFailureHandler.java new file mode 100644 index 000000000..31c622ab3 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/worker/save/SaveFailureHandler.java @@ -0,0 +1,70 @@ +package com.fr.design.worker.save; + +import com.fr.common.exception.ThrowableHandler; +import com.fr.design.dialog.FineJOptionPane; +import com.fr.design.i18n.Toolkit; +import com.fr.design.mainframe.DesignerContext; +import com.fr.general.IOUtils; +import com.fr.workspace.exception.DiskSpaceFullException; +import java.awt.Frame; +import javax.swing.JOptionPane; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2021/12/7 + */ +public class SaveFailureHandler implements ThrowableHandler { + + private static final SaveFailureHandler INSTANCE = new SaveFailureHandler(); + + public static SaveFailureHandler getInstance() { + return INSTANCE; + } + + @Override + public boolean process(Throwable e) { + for (Handler handler : Handler.values()) { + if (handler.process(e)) { + break; + } + } + return true; + } + + public enum Handler implements ThrowableHandler { + + FullDisk { + @Override + public boolean process(Throwable e) { + if (e.getCause() instanceof DiskSpaceFullException + || e instanceof DiskSpaceFullException + || e.getCause().getCause() instanceof DiskSpaceFullException) { + FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), + Toolkit.i18nText("Fine_Design_Template_Save_Failed_By_Full_Disk"), + Toolkit.i18nText("Fine-Design_Basic_Alert"), + JOptionPane.WARNING_MESSAGE, + IOUtils.readIcon("/com/fr/design/images/warnings/warning32.png")); + return true; + } + return false; + } + }, + + Other { + @Override + public boolean process(Throwable e) { + boolean minimized = (DesignerContext.getDesignerFrame().getExtendedState() & Frame.ICONIFIED ) != 0; + FineJOptionPane.showMessageDialog( + minimized ? null : DesignerContext.getDesignerFrame(), + Toolkit.i18nText("Fine-Design-Basic_Save_Failure"), + Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), + JOptionPane.ERROR_MESSAGE); + return true; + } + }; + + + + } +} \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/worker/save/SaveWorker.java b/designer-base/src/main/java/com/fr/design/worker/save/SaveWorker.java index f47a4f88e..c7a962c25 100644 --- a/designer-base/src/main/java/com/fr/design/worker/save/SaveWorker.java +++ b/designer-base/src/main/java/com/fr/design/worker/save/SaveWorker.java @@ -55,12 +55,7 @@ public class SaveWorker extends SwingWorker { } catch (Exception e) { processResult(); FineLoggerFactory.getLogger().error(e.getMessage(), e); - boolean minimized = (DesignerContext.getDesignerFrame().getExtendedState() & Frame.ICONIFIED ) != 0; - FineJOptionPane.showMessageDialog( - minimized ? null : DesignerContext.getDesignerFrame(), - Toolkit.i18nText("Fine-Design-Basic_Save_Failure"), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), - JOptionPane.ERROR_MESSAGE); + SaveFailureHandler.getInstance().process(e); return; } processResult(); From 5cdbe2ac25a8274ef19062c92f6e012196ee27a9 Mon Sep 17 00:00:00 2001 From: hades Date: Thu, 30 Dec 2021 16:01:52 +0800 Subject: [PATCH 02/17] =?UTF-8?q?REPORT-64009=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E5=86=85=E5=AF=B9macOS12=E7=9A=84=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/DesignerEnvManager.java | 13 + .../design/actions/file/PreferencePane.java | 15 +- .../gui/ifilechooser/ExtensionFilter.java | 25 ++ .../gui/ifilechooser/FileChooserArgs.java | 109 +++++++ .../gui/ifilechooser/FileChooserFactory.java | 44 +++ .../gui/ifilechooser/FileChooserProvider.java | 13 + .../ifilechooser/JavaFxNativeFileChooser.java | 23 +- .../gui/ifilechooser/SwingFileChooser.java | 130 +++++++++ .../ifilechooser/SwingImageFileChooser.java | 276 ++++++++++++++++++ .../com/fr/design/os/impl/PMDialogAction.java | 5 +- .../com/fr/design/os/impl/SupportOSImpl.java | 44 +++ .../background/image/ImageFileChooser.java | 39 +-- .../java/com/fr/design/upm/UpmBridge.java | 18 +- .../main/java/com/fr/env/RemoteEnvPane.java | 6 +- .../series/PlotSeries/MapCustomPane.java | 13 +- .../share/action/InstallComponentAction.java | 28 +- 16 files changed, 733 insertions(+), 68 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/gui/ifilechooser/ExtensionFilter.java create mode 100644 designer-base/src/main/java/com/fr/design/gui/ifilechooser/FileChooserArgs.java create mode 100644 designer-base/src/main/java/com/fr/design/gui/ifilechooser/FileChooserFactory.java create mode 100644 designer-base/src/main/java/com/fr/design/gui/ifilechooser/SwingFileChooser.java create mode 100644 designer-base/src/main/java/com/fr/design/gui/ifilechooser/SwingImageFileChooser.java diff --git a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java index b8d63ca7a..85b4e4e78 100644 --- a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java +++ b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java @@ -22,6 +22,7 @@ import com.fr.design.login.DesignerLoginType; import com.fr.design.login.config.DesignerLoginConfigManager; import com.fr.design.mainframe.vcs.VcsConfigManager; import com.fr.design.notification.SnapChatConfig; +import com.fr.design.os.impl.SupportOSImpl; import com.fr.design.port.DesignerPortContext; import com.fr.design.style.color.ColorSelectConfigManager; import com.fr.design.update.push.DesignerPushUpdateConfigManager; @@ -202,6 +203,8 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { private boolean showTemplateMissingPlugin = true; + private boolean useOptimizedUPM4Adapter; + /** * DesignerEnvManager. */ @@ -639,6 +642,14 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { this.showTemplateMissingPlugin = showTemplateMissingPlugin; } + public boolean isUseOptimizedUPM4Adapter() { + return useOptimizedUPM4Adapter; + } + + public void setUseOptimizedUPM4Adapter(boolean useOptimizedUPM4Adapter) { + this.useOptimizedUPM4Adapter = useOptimizedUPM4Adapter; + } + /** * 知否自动备份 * @@ -1829,6 +1840,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { } this.setEmbedServerLazyStartup(reader.getAttrAsBoolean("embedServerLazyStartup", false)); this.setShowTemplateMissingPlugin(reader.getAttrAsBoolean("showTemplateMissingPlugin", true)); + this.setUseOptimizedUPM4Adapter(reader.getAttrAsBoolean("useOptimizedUPM4Adapter", SupportOSImpl.MACOS_12_VERSION_ADAPTER.support())); } private void readReportPaneAttributions(XMLableReader reader) { @@ -2101,6 +2113,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { if (!this.isShowTemplateMissingPlugin()) { writer.attr("showTemplateMissingPlugin", this.isShowTemplateMissingPlugin()); } + writer.attr("useOptimizedUPM4Adapter", this.isUseOptimizedUPM4Adapter()); writer.end(); } diff --git a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java b/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java index 24e359d6f..e3dd02e95 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java @@ -15,9 +15,10 @@ import com.fr.design.gui.ibutton.UIColorButton; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIDictionaryComboBox; +import com.fr.design.gui.ifilechooser.FileChooserArgs; +import com.fr.design.gui.ifilechooser.FileChooserFactory; import com.fr.design.gui.ifilechooser.FileChooserProvider; import com.fr.design.gui.ifilechooser.FileSelectionMode; -import com.fr.design.gui.ifilechooser.JavaFxNativeFileChooser; import com.fr.design.gui.ilable.ActionLabel; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.iprogressbar.UIProgressBarUI; @@ -28,7 +29,6 @@ import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.VerticalFlowLayout; -import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.vcs.VcsConfigManager; import com.fr.design.mainframe.vcs.common.VcsHelper; import com.fr.design.os.impl.SupportOSImpl; @@ -50,8 +50,6 @@ import com.fr.transaction.Worker; import com.fr.workspace.WorkContext; import com.fr.workspace.server.vcs.VcsOperator; import com.fr.workspace.server.vcs.git.config.GcConfig; -import com.sun.javafx.tk.FileChooserType; -import javafx.stage.FileChooser; import javax.swing.BorderFactory; import javax.swing.BoxLayout; @@ -500,9 +498,8 @@ public class PreferencePane extends BasicPane { @Override public void actionPerformed(ActionEvent evt) { FileChooserProvider fileChooserProvider = - new JavaFxNativeFileChooser.Builder(). - fileSelectionMode(FileSelectionMode.DIR). - build(); + FileChooserFactory.createFileChooser(FileChooserArgs.newBuilder(). + setFileSelectionMode(FileSelectionMode.DIR).build()); int saveValue = fileChooserProvider.showDialog(chooseDirBtn); if (saveValue == JFileChooser.APPROVE_OPTION) { File selectedFile = fileChooserProvider.getSelectedFile(); @@ -715,7 +712,8 @@ public class PreferencePane extends BasicPane { this.portEditor.setValue(new Integer(designerEnvManager.getEmbedServerPort())); if (useOptimizedUPMCheckbox != null) { - useOptimizedUPMCheckbox.setSelected(ServerPreferenceConfig.getInstance().isUseOptimizedUPM()); + useOptimizedUPMCheckbox.setSelected(ServerPreferenceConfig.getInstance().isUseOptimizedUPM() + || DesignerEnvManager.getEnvManager().isUseOptimizedUPM4Adapter()); } useUniverseDBMCheckbox.setSelected(ServerPreferenceConfig.getInstance().isUseUniverseDBM()); @@ -790,6 +788,7 @@ public class PreferencePane extends BasicPane { designerEnvManager.setJoinProductImprove(this.joinProductImproveCheckBox.isSelected()); designerEnvManager.setEmbedServerLazyStartup(this.embedServerLazyStartupCheckBox.isSelected()); designerEnvManager.setImageCompress(this.imageCompressPanelCheckBox.isSelected()); + designerEnvManager.setUseOptimizedUPM4Adapter(this.useOptimizedUPMCheckbox.isSelected()); VcsConfigManager vcsConfigManager = designerEnvManager.getVcsConfigManager(); vcsConfigManager.setSaveInterval(this.saveIntervalEditor.getValue()); vcsConfigManager.setVcsEnable(this.vcsEnableCheckBox.isSelected()); diff --git a/designer-base/src/main/java/com/fr/design/gui/ifilechooser/ExtensionFilter.java b/designer-base/src/main/java/com/fr/design/gui/ifilechooser/ExtensionFilter.java new file mode 100644 index 000000000..9ec582f69 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/gui/ifilechooser/ExtensionFilter.java @@ -0,0 +1,25 @@ +package com.fr.design.gui.ifilechooser; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2021/12/29 + */ +public class ExtensionFilter { + + private final String des; + private final String[] extensions; + + public ExtensionFilter(String des, String... extensions) { + this.des = des; + this.extensions = extensions; + } + + public String getDes() { + return des; + } + + public String[] getExtensions() { + return extensions; + } +} diff --git a/designer-base/src/main/java/com/fr/design/gui/ifilechooser/FileChooserArgs.java b/designer-base/src/main/java/com/fr/design/gui/ifilechooser/FileChooserArgs.java new file mode 100644 index 000000000..b011e5b35 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/gui/ifilechooser/FileChooserArgs.java @@ -0,0 +1,109 @@ +package com.fr.design.gui.ifilechooser; + +/** + * 文件选择器可设置的参数集合 + * + * @author hades + * @version 10.0 + * Created by hades on 2021/12/21 + */ +public class FileChooserArgs { + + private final FileSelectionMode fileSelectionMode; + private final String filterDes; + private final String[] extensions; + private final String selectedPath; + private final ExtensionFilter[] filters; + private final String tipText; + private final boolean multiSelectionEnabled; + + public static Builder newBuilder() { + return new Builder(); + } + + private FileChooserArgs(Builder builder) { + this.fileSelectionMode = builder.fileSelectionMode; + this.filterDes = builder.filterDes; + this.extensions = builder.extensions; + this.selectedPath = builder.selectedPath; + this.filters = builder.filters; + this.tipText = builder.tipText; + this.multiSelectionEnabled = builder.multiSelectionEnabled; + } + + public FileSelectionMode getFileSelectionMode() { + return fileSelectionMode; + } + + public String getFilterDes() { + return filterDes; + } + + public String[] getExtensions() { + return extensions; + } + + public String getSelectedPath() { + return selectedPath; + } + + public ExtensionFilter[] getFilters() { + return filters; + } + + public String getTipText() { + return tipText; + } + + public boolean isMultiSelectionEnabled() { + return multiSelectionEnabled; + } + + public static class Builder { + + private FileSelectionMode fileSelectionMode; + private String filterDes; + private String[] extensions; + private String selectedPath; + private ExtensionFilter[] filters = new ExtensionFilter[0]; + private String tipText; + private boolean multiSelectionEnabled; + + public Builder setFileSelectionMode(FileSelectionMode fileSelectionMode) { + this.fileSelectionMode = fileSelectionMode; + return this; + } + + public Builder setFilter(String filterDes, String... extensions) { + this.filterDes = filterDes; + this.extensions = extensions; + return this; + } + + public Builder setSelectedPath(String selectedPath) { + this.selectedPath = selectedPath; + return this; + } + + public Builder setFilters(ExtensionFilter[] filters) { + this.filters = filters; + return this; + } + + public Builder setTipText(String tipText) { + this.tipText = tipText; + return this; + } + + public Builder setMultiSelectionEnabled(boolean multiSelectionEnabled) { + this.multiSelectionEnabled = multiSelectionEnabled; + return this; + } + + public FileChooserArgs build() { + return new FileChooserArgs(this); + } + } + + +} diff --git a/designer-base/src/main/java/com/fr/design/gui/ifilechooser/FileChooserFactory.java b/designer-base/src/main/java/com/fr/design/gui/ifilechooser/FileChooserFactory.java new file mode 100644 index 000000000..36a53c8dc --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/gui/ifilechooser/FileChooserFactory.java @@ -0,0 +1,44 @@ +package com.fr.design.gui.ifilechooser; + +import com.fr.design.i18n.Toolkit; +import com.fr.design.os.impl.SupportOSImpl; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2021/12/21 + */ +public class FileChooserFactory { + + public static FileChooserProvider createFileChooser(FileChooserArgs fileChooserArgs) { + if (SupportOSImpl.OLD_STYLE_CHOOSER.support()) { + return new SwingFileChooser.Builder(). + setFileSelectionMode(fileChooserArgs.getFileSelectionMode()). + setFileFilter(fileChooserArgs.getFilterDes(), fileChooserArgs.getExtensions()). + setSelectedFile(fileChooserArgs.getSelectedPath()). + setMultiSelectionEnabled(fileChooserArgs.isMultiSelectionEnabled()). + setTipText(fileChooserArgs.getTipText()). + setFileFilter(fileChooserArgs.getFilters()).build(); + } else { + return new JavaFxNativeFileChooser.Builder(). + fileSelectionMode(fileChooserArgs.getFileSelectionMode()). + filter(fileChooserArgs.getFilterDes(), fileChooserArgs.getExtensions()). + currentDirectory(fileChooserArgs.getSelectedPath()). + title(fileChooserArgs.getTipText()). + filters(fileChooserArgs.getFilters()).build(); + } + } + + public static FileChooserProvider createImageFileChooser() { + if (SupportOSImpl.OLD_STYLE_CHOOSER.support()) { + return new SwingImageFileChooser(); + } else { + return new JavaFxNativeFileChooser.Builder(). + fileSelectionMode(FileSelectionMode.FILE). + title(Toolkit.i18nText("Fine-Design_Basic_Open")). + filter(Toolkit.i18nText("Fine-Design_Basic_Image_Image_Files"), "*.jpg", "*.gif", "*.png", "*.bmp"). + build(); + } + } + +} diff --git a/designer-base/src/main/java/com/fr/design/gui/ifilechooser/FileChooserProvider.java b/designer-base/src/main/java/com/fr/design/gui/ifilechooser/FileChooserProvider.java index aa95fe27b..a5d7e9730 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ifilechooser/FileChooserProvider.java +++ b/designer-base/src/main/java/com/fr/design/gui/ifilechooser/FileChooserProvider.java @@ -9,4 +9,17 @@ public interface FileChooserProvider { File getSelectedFile(); int showDialog(Component parent); + + + default int showOpenDialog(Component parent, String approveButtonText) { + return -1; + } + + default void setMultiSelectionEnabled(boolean multiple) { + + } + + default void setCurrentDirectory(File file) { + + } } diff --git a/designer-base/src/main/java/com/fr/design/gui/ifilechooser/JavaFxNativeFileChooser.java b/designer-base/src/main/java/com/fr/design/gui/ifilechooser/JavaFxNativeFileChooser.java index fc4b8e368..4d3688324 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ifilechooser/JavaFxNativeFileChooser.java +++ b/designer-base/src/main/java/com/fr/design/gui/ifilechooser/JavaFxNativeFileChooser.java @@ -4,6 +4,8 @@ package com.fr.design.gui.ifilechooser; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.DesignerContext; import com.fr.log.FineLoggerFactory; +import com.fr.stable.ArrayUtils; +import com.fr.stable.StringUtils; import com.sun.javafx.application.PlatformImpl; import javafx.application.Platform; import javafx.scene.Scene; @@ -173,10 +175,20 @@ public class JavaFxNativeFileChooser implements FileChooserProvider { this.fileSelectionMode = fileSelectionMode; } + @Override public void setCurrentDirectory(File currentDirectory) { this.currentDirectory = currentDirectory; } + @Override + public void setMultiSelectionEnabled(boolean multiple) { + this.setSelectionMode(multiple ? FileSelectionMode.MULTIPLE_FILE : FileSelectionMode.FILE); + } + + @Override + public int showOpenDialog(Component parent, String approveButtonText) { + return this.showDialog(parent); + } public static class Builder { private FileSelectionMode fileSelectionMode = FileSelectionMode.FILE; @@ -190,7 +202,9 @@ public class JavaFxNativeFileChooser implements FileChooserProvider { } public Builder title(String title) { - this.title = title; + if (StringUtils.isNotEmpty(title)) { + this.title = title; + } return this; } @@ -199,6 +213,13 @@ public class JavaFxNativeFileChooser implements FileChooserProvider { return this; } + public Builder filters(ExtensionFilter[] filters) { + for (ExtensionFilter filter : filters) { + this.filters = ArrayUtils.add(this.filters, new FileChooser.ExtensionFilter(filter.getDes(), filter.getExtensions())); + } + return this; + } + public Builder filter(String des, String... extensions) { if (extensions != null) { this.filters = new FileChooser.ExtensionFilter[]{new FileChooser.ExtensionFilter(des, extensions)}; diff --git a/designer-base/src/main/java/com/fr/design/gui/ifilechooser/SwingFileChooser.java b/designer-base/src/main/java/com/fr/design/gui/ifilechooser/SwingFileChooser.java new file mode 100644 index 000000000..942c3430c --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/gui/ifilechooser/SwingFileChooser.java @@ -0,0 +1,130 @@ +package com.fr.design.gui.ifilechooser; + +import com.fr.common.annotations.Negative; +import com.fr.design.upm.UpmUtils; +import com.fr.stable.ArrayUtils; +import com.fr.stable.StringUtils; +import java.awt.Component; +import java.io.File; +import javax.swing.JFileChooser; +import javax.swing.filechooser.FileFilter; +import javax.swing.filechooser.FileNameExtensionFilter; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2021/12/21 + */ +@Negative(until = "2022-6-1") +class SwingFileChooser implements FileChooserProvider { + + private final JFileChooser fileChooser; + private final Builder builder; + + private SwingFileChooser(Builder builder) { + fileChooser = new JFileChooser(); + fileChooser.setFileSelectionMode(builder.fileSelectionMode); + fileChooser.setFileFilter(builder.fileFilter); + fileChooser.setSelectedFile(builder.selectedFile); + fileChooser.setMultiSelectionEnabled(builder.multiSelectionEnabled); + this.builder = builder; + } + + @Override + public File[] getSelectedFiles() { + return fileChooser.getSelectedFiles(); + } + + @Override + public File getSelectedFile() { + return fileChooser.getSelectedFile(); + } + + @Override + public int showDialog(Component parent) { + if (StringUtils.isEmpty(builder.tipText)) { + return fileChooser.showOpenDialog(parent); + } else { + return fileChooser.showDialog(parent, builder.tipText); + } + } + + @Override + public int showOpenDialog(Component parent, String approveButtonText) { + return fileChooser.showDialog(parent, approveButtonText); + } + + @Override + public void setCurrentDirectory(File file) { + fileChooser.setCurrentDirectory(file); + } + + @Override + public void setMultiSelectionEnabled(boolean multiple) { + fileChooser.setMultiSelectionEnabled(multiple); + } + + /** + * 和一般builder不同的是 setXXX还做参数转换逻辑 + */ + public static class Builder { + + private int fileSelectionMode = JFileChooser.FILES_ONLY; + private FileFilter fileFilter; + private File selectedFile; + private boolean multiSelectionEnabled; + private String tipText; + + public Builder setFileSelectionMode(FileSelectionMode fileSelectionMode) { + if (FileSelectionMode.DIR.equals(fileSelectionMode)) { + this.fileSelectionMode = JFileChooser.DIRECTORIES_ONLY; + } else if (FileSelectionMode.FILE.equals(fileSelectionMode)) { + this.fileSelectionMode = JFileChooser.FILES_ONLY; + } else if (FileSelectionMode.MULTIPLE_FILE.equals(fileSelectionMode)) { + this.fileSelectionMode = JFileChooser.FILES_AND_DIRECTORIES; + } + return this; + } + + public Builder setFileFilter(String des, String... extension) { + if (StringUtils.isNotEmpty(des) && ArrayUtils.isNotEmpty(extension)) { + this.fileFilter = new FileNameExtensionFilter(des, UpmUtils.findMatchedExtension(extension)); + } + return this; + } + + public Builder setFileFilter(ExtensionFilter[] extensionFilters) { + StringBuilder desBuilder = new StringBuilder(); + String[] extensions = new String[0]; + for (ExtensionFilter extensionFilter : extensionFilters) { + desBuilder.append(extensionFilter.getDes()).append(" "); + extensions = ArrayUtils.addAll(extensions, UpmUtils.findMatchedExtension(extensionFilter.getExtensions())); + } + if (ArrayUtils.isNotEmpty(extensionFilters)) { + this.fileFilter = new FileNameExtensionFilter(desBuilder.toString().trim(), extensions); + } + return this; + } + + public Builder setSelectedFile(String selectedPath) { + if (StringUtils.isNotEmpty(selectedPath)) { + this.selectedFile = new File(selectedPath); + } + return this; + } + + public Builder setMultiSelectionEnabled(boolean multiSelectionEnabled) { + this.multiSelectionEnabled = multiSelectionEnabled; + return this; + } + + public Builder setTipText(String tipText) { + this.tipText = tipText; + return this; + } + + public SwingFileChooser build() { + return new SwingFileChooser(this); + } + } +} diff --git a/designer-base/src/main/java/com/fr/design/gui/ifilechooser/SwingImageFileChooser.java b/designer-base/src/main/java/com/fr/design/gui/ifilechooser/SwingImageFileChooser.java new file mode 100644 index 000000000..3c0c6c1af --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/gui/ifilechooser/SwingImageFileChooser.java @@ -0,0 +1,276 @@ +package com.fr.design.gui.ifilechooser; + +import com.fr.base.BaseUtils; +import com.fr.common.annotations.Negative; +import com.fr.design.DesignerEnvManager; +import com.fr.design.style.ChooseFileView; +import com.fr.design.style.background.image.ExpandFileChooser; +import java.awt.Component; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.io.File; +import java.util.Enumeration; +import java.util.Hashtable; +import javax.swing.filechooser.FileFilter; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2021/12/30 + */ +@Negative(until = "2022-6-1") +class SwingImageFileChooser extends ExpandFileChooser implements FileChooserProvider { + + public SwingImageFileChooser() { + super(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Image_Compress"),com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Open")); + ExampleFileFilter bothFilter = new ExampleFileFilter( + new String[]{"jpg", "gif", "png", "bmp"}, + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Image_Image_Files")); + bothFilter.setExtensionListInDescription(true); + this.addChoosableFileFilter(bothFilter); + this.setAcceptAllFileFilterUsed(false); + + // Create Custom FileView + ChooseFileView fileView = new ChooseFileView(); + fileView.putIcon("jpg", BaseUtils.readIcon("/com/fr/base/images/dialog/file/jpgFile.gif")); + fileView.putIcon("gif", BaseUtils.readIcon("/com/fr/base/images/dialog/file/gifFile.gif")); + fileView.putIcon("png", BaseUtils.readIcon("/com/fr/base/images/dialog/file/pngFile.png")); + fileView.putIcon("bmp", BaseUtils.readIcon("/com/fr/base/images/dialog/file/bmpFile.gif")); + + this.setFileView(fileView); + } + + @Override + public int showDialog(Component parent, String approveButtonText) { + return super.showDialog(parent, approveButtonText); + } + + @Override + public ActionListener checkAction() { + return new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + DesignerEnvManager.getEnvManager().setImageCompress(isCheckSelected()); + DesignerEnvManager.getEnvManager().saveXMLFile(); + } + }; + + } + + @Override + public int showDialog(Component parent) { + return showOpenDialog(parent); + } + + /** + * A convenience implementation of FileFilter that filters out + * all files except for those type extensions that it knows about. + *

D:\finereport\develop\code\test\TestCase\WEB-INF\reportlets\TestCase\01903.cpt + *

+ * Extensions are of the type ".foo", which is typically found on + * Windows and Unix boxes, but not on Macinthosh. Case is ignored. + *

+ * Example - create a new filter that filerts out all files + * but gif and jpg image files: + *

+ * JFileChooser chooser = new JFileChooser(); + * ExampleFileFilter filter = new ExampleFileFilter( + * new String{"gif", "jpg"}, "JPEG & GIF Images") + * chooser.addChoosableFileFilter(filter); + * chooser.showOpenDialog(this); + * + * @author Jeff Dinkins + * @version 1.12 12/03/01 + */ + class ExampleFileFilter extends FileFilter { + private Hashtable filters = null; + private String description = null; + private String fullDescription = null; + private boolean useExtensionsInDescription = true; + + /** + * Creates a file filter. If no filters are added, then all + * files are accepted. + * + * @see #addExtension + */ + public ExampleFileFilter() { + this.filters = new Hashtable(); + } + + /** + * Creates a file filter that accepts files with the given extension. + * Example: new ExampleFileFilter("jpg"); + * + * @see #addExtension + */ + public ExampleFileFilter(String extension) { + this(extension, null); + } + + /** + * Creates a file filter that accepts the given file type. + * Example: new ExampleFileFilter("jpg", "JPEG Image Images"); + *

+ * Note that the "." before the extension is not needed. If + * provided, it will be ignored. + * + * @see #addExtension + */ + public ExampleFileFilter(String extension, String description) { + this(); + if (extension != null) addExtension(extension); + if (description != null) setDescription(description); + } + + /** + * Creates a file filter from the given string array. + * Example: new ExampleFileFilter(String {"gif", "jpg"}); + *

+ * Note that the "." before the extension is not needed adn + * will be ignored. + * + * @see #addExtension + */ + public ExampleFileFilter(String[] filters) { + this(filters, null); + } + + /** + * Creates a file filter from the given string array and description. + * Example: new ExampleFileFilter(String {"gif", "jpg"}, "Gif and JPG Images"); + *

+ * Note that the "." before the extension is not needed and will be ignored. + * + * @see #addExtension + */ + public ExampleFileFilter(String[] filters, String description) { + this(); + for (int i = 0; i < filters.length; i++) { + // add filters one by one + addExtension(filters[i]); + } + if (description != null) setDescription(description); + } + + /** + * Return true if this file should be shown in the directory pane, + * false if it shouldn't. + *

+ * Files that begin with "." are ignored. + * + * @see #getExtension + */ + @Override + public boolean accept(File f) { + if (f != null) { + if (f.isDirectory()) { + return true; + } + String extension = getExtension(f); + if (extension != null && filters.get(getExtension(f)) != null) { + return true; + } + } + return false; + } + + /** + * Return the extension portion of the file's name . + * + * @see #getExtension + * @see FileFilter#accept + */ + public String getExtension(File f) { + if (f != null) { + String filename = f.getName(); + int i = filename.lastIndexOf('.'); + if (i > 0 && i < filename.length() - 1) { + return filename.substring(i + 1).toLowerCase(); + } + } + return null; + } + + /** + * Adds a filetype "dot" extension to filter against. + *

+ * For example: the following code will create a filter that filters + * out all files except those that end in ".jpg" and ".tif": + *

+ * ExampleFileFilter filter = new ExampleFileFilter(); + * filter.addExtension("jpg"); + * filter.addExtension("tif"); + *

+ * Note that the "." before the extension is not needed and will be ignored. + */ + public void addExtension(String extension) { + if (filters == null) { + filters = new Hashtable(5); + } + filters.put(extension.toLowerCase(), this); + fullDescription = null; + } + + + /** + * Returns the human readable description of this filter. For + * example: "JPEG and GIF Image Files (*.jpg, *.gif)" + * + * @see FileFilter#getDescription + */ + @Override + public String getDescription() { + if (fullDescription == null) { + if (description == null || isExtensionListInDescription()) { + fullDescription = description == null ? "(" : description + " ("; + // build the description from the extension list + Enumeration extensions = filters.keys(); + if (extensions != null) { + fullDescription += "." + extensions.nextElement(); + while (extensions.hasMoreElements()) { + fullDescription += ", ." + extensions.nextElement(); + } + } + fullDescription += ")"; + } else { + fullDescription = description; + } + } + return fullDescription; + } + + /** + * Sets the human readable description of this filter. For + * example: filter.setDescription("Gif and JPG Images"); + */ + public void setDescription(String description) { + this.description = description; + fullDescription = null; + } + + /** + * Determines whether the extension list (.jpg, .gif, etc) should + * show up in the human readable description. + *

+ * Only relevent if a description was provided in the constructor + * or using setDescription(); + */ + public void setExtensionListInDescription(boolean b) { + useExtensionsInDescription = b; + fullDescription = null; + } + + /** + * Returns whether the extension list (.jpg, .gif, etc) should + * show up in the human readable description. + *

+ * Only relevent if a description was provided in the constructor + * or using setDescription(); + */ + public boolean isExtensionListInDescription() { + return useExtensionsInDescription; + } + } + +} diff --git a/designer-base/src/main/java/com/fr/design/os/impl/PMDialogAction.java b/designer-base/src/main/java/com/fr/design/os/impl/PMDialogAction.java index 990e73ee9..16944da06 100644 --- a/designer-base/src/main/java/com/fr/design/os/impl/PMDialogAction.java +++ b/designer-base/src/main/java/com/fr/design/os/impl/PMDialogAction.java @@ -1,6 +1,7 @@ package com.fr.design.os.impl; import com.fr.config.ServerPreferenceConfig; +import com.fr.design.DesignerEnvManager; import com.fr.design.extra.WebViewDlgHelper; import com.fr.design.jdk.JdkVersion; import com.fr.design.upm.UpmFinder; @@ -23,7 +24,9 @@ public class PMDialogAction implements OSBasedAction { DesignUtils.visitEnvServerByParameters( PLUGIN_MANAGER_ROUTE,null,null); return; } - if (ServerPreferenceConfig.getInstance().isUseOptimizedUPM() || SupportOSImpl.MACOS_NEW_PLUGIN_MANAGEMENT.support()) { + if (ServerPreferenceConfig.getInstance().isUseOptimizedUPM() + || SupportOSImpl.MACOS_NEW_PLUGIN_MANAGEMENT.support() + || DesignerEnvManager.getEnvManager().isUseOptimizedUPM4Adapter()) { UpmFinder.showUPMDialog(); } else { WebViewDlgHelper.createPluginDialog(); diff --git a/designer-base/src/main/java/com/fr/design/os/impl/SupportOSImpl.java b/designer-base/src/main/java/com/fr/design/os/impl/SupportOSImpl.java index 949d77045..3ec67200d 100644 --- a/designer-base/src/main/java/com/fr/design/os/impl/SupportOSImpl.java +++ b/designer-base/src/main/java/com/fr/design/os/impl/SupportOSImpl.java @@ -7,13 +7,18 @@ import com.fr.general.GeneralContext; import com.fr.json.JSON; import com.fr.json.JSONFactory; import com.fr.json.JSONObject; +import com.fr.log.FineLoggerFactory; import com.fr.stable.StringUtils; import com.fr.stable.os.Arch; import com.fr.stable.os.OperatingSystem; import com.fr.stable.os.support.SupportOS; import com.fr.workspace.WorkContext; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.List; import java.util.Locale; +import java.util.Scanner; /** * @author pengda @@ -142,6 +147,45 @@ public enum SupportOSImpl implements SupportOS { } }, + OLD_STYLE_CHOOSER { + + @Override + public boolean support() { + return (OperatingSystem.isLinux() && Arch.getArch() == Arch.ARM) || MACOS_12_VERSION_ADAPTER.support(); + } + }, + + MACOS_12_VERSION_ADAPTER { + @Override + public boolean support() { + return (OperatingSystem.isMacos() && getMacOsVersionNumber() >= macosMontereyVersionNum); + } + + private final int macosMontereyVersionNum = 12; + + /** + * System.getProperty("os.version") 在最新macos版本存在bug + * https://bugs.openjdk.java.net/browse/JDK-8253702 + * + * @return + */ + private int getMacOsVersionNumber() { + String result; + List command = new ArrayList<>(); + command.add("/usr/bin/sw_vers"); + command.add("-productVersion"); + try (InputStream inputStream = new ProcessBuilder(command).start().getInputStream(); + Scanner s = new Scanner(inputStream).useDelimiter("\\A")) { + result = s.hasNext() ? s.next() : StringUtils.EMPTY; + String[] versionSlice = result.split("\\."); + return Integer.parseInt(versionSlice[0]); + } catch (Exception e) { + FineLoggerFactory.getLogger().warn(e.getMessage(), e); + return 0; + } + } + }, + DESIGNER_LOGIN { @Override public boolean support() { diff --git a/designer-base/src/main/java/com/fr/design/style/background/image/ImageFileChooser.java b/designer-base/src/main/java/com/fr/design/style/background/image/ImageFileChooser.java index 9c5b1af4d..739dc81d5 100644 --- a/designer-base/src/main/java/com/fr/design/style/background/image/ImageFileChooser.java +++ b/designer-base/src/main/java/com/fr/design/style/background/image/ImageFileChooser.java @@ -4,62 +4,47 @@ package com.fr.design.style.background.image; import com.fr.design.DesignerEnvManager; -import com.fr.design.gui.ifilechooser.FileSelectionMode; -import com.fr.design.gui.ifilechooser.JavaFxNativeFileChooser; -import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.ifilechooser.FileChooserFactory; +import com.fr.design.gui.ifilechooser.FileChooserProvider; import com.fr.design.i18n.Toolkit; -import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.mainframe.share.collect.ComponentCollector; import com.fr.design.mainframe.toast.DesignerToastMsgUtil; -import javafx.stage.FileChooser; -import javax.swing.*; -import java.awt.*; -import java.awt.event.MouseEvent; -import java.awt.event.MouseListener; + +import java.awt.Component; import java.io.File; +import javax.swing.SwingUtilities; /** * This class used to choose image files. */ public class ImageFileChooser { - - JavaFxNativeFileChooser javaFxNativeFileChooser; + private final FileChooserProvider fileChooserProvider; public ImageFileChooser() { - javaFxNativeFileChooser = - new JavaFxNativeFileChooser.Builder(). - fileSelectionMode(FileSelectionMode.FILE). - title(Toolkit.i18nText("Fine-Design_Basic_Open")). - filter(Toolkit.i18nText("Fine-Design_Basic_Image_Image_Files"), "*.jpg", "*.gif", "*.png", "*.bmp"). - build(); + fileChooserProvider = FileChooserFactory.createImageFileChooser(); } public int showOpenDialog(Component parent, String approveButtonText) { - return showOpenDialog(parent); + return fileChooserProvider.showOpenDialog(parent, approveButtonText); } public int showOpenDialog(Component parent) { showImageCompressMoveTip(); - return javaFxNativeFileChooser.showDialog(parent); + return fileChooserProvider.showDialog(parent); } public void setCurrentDirectory(File file) { - javaFxNativeFileChooser.setCurrentDirectory(file); + fileChooserProvider.setCurrentDirectory(file); } public void setMultiSelectionEnabled(boolean multiple) { - if (multiple) { - javaFxNativeFileChooser.setSelectionMode(FileSelectionMode.MULTIPLE_FILE); - } else { - javaFxNativeFileChooser.setSelectionMode(FileSelectionMode.FILE); - } + fileChooserProvider.setMultiSelectionEnabled(multiple); } public File getSelectedFile() { - return javaFxNativeFileChooser.getSelectedFile(); + return fileChooserProvider.getSelectedFile(); } public boolean isCheckSelected() { diff --git a/designer-base/src/main/java/com/fr/design/upm/UpmBridge.java b/designer-base/src/main/java/com/fr/design/upm/UpmBridge.java index fee07ac46..01369116d 100644 --- a/designer-base/src/main/java/com/fr/design/upm/UpmBridge.java +++ b/designer-base/src/main/java/com/fr/design/upm/UpmBridge.java @@ -14,9 +14,10 @@ import com.fr.design.extra.exe.GetPluginPrefixExecutor; import com.fr.design.extra.exe.PluginLoginExecutor; import com.fr.design.extra.exe.ReadUpdateOnlineExecutor; import com.fr.design.extra.exe.SearchOnlineExecutor; +import com.fr.design.gui.ifilechooser.FileChooserArgs; +import com.fr.design.gui.ifilechooser.FileChooserFactory; import com.fr.design.gui.ifilechooser.FileChooserProvider; import com.fr.design.gui.ifilechooser.FileSelectionMode; -import com.fr.design.gui.ifilechooser.JavaFxNativeFileChooser; import com.fr.design.i18n.Toolkit; import com.fr.design.locale.impl.BbsRegisterMark; import com.fr.design.locale.impl.BbsResetMark; @@ -39,11 +40,12 @@ import com.teamdev.jxbrowser.chromium.Browser; import com.teamdev.jxbrowser.chromium.JSArray; import com.teamdev.jxbrowser.chromium.JSFunction; import com.teamdev.jxbrowser.chromium.JSObject; -import javafx.stage.FileChooser; -import javax.swing.*; +import java.awt.Desktop; +import javax.swing.JFileChooser; +import javax.swing.SwingUtilities; +import javax.swing.SwingWorker; import javax.swing.filechooser.FileNameExtensionFilter; -import java.awt.*; import java.io.File; import java.net.URI; import java.util.ArrayList; @@ -312,10 +314,10 @@ public class UpmBridge { RunnableFuture future = new FutureTask<>(new Callable() { @Override public String call() { - FileChooserProvider fileChooserProvider = new JavaFxNativeFileChooser.Builder(). - fileSelectionMode(FileSelectionMode.FILE). - filter(des, filter). - build(); + FileChooserProvider fileChooserProvider = FileChooserFactory.createFileChooser( + FileChooserArgs.newBuilder(). + setFileSelectionMode(FileSelectionMode.FILE). + setFilter(des, filter).build()); int result = fileChooserProvider.showDialog(UpmFinder.getDialog()); if (result == JFileChooser.APPROVE_OPTION) { return fileChooserProvider.getSelectedFile().getAbsolutePath(); diff --git a/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java b/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java index 56f90e804..31bdaa979 100644 --- a/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java +++ b/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java @@ -9,9 +9,10 @@ import com.fr.design.fun.DesignerEnvProcessor; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icontainer.UIScrollPane; +import com.fr.design.gui.ifilechooser.FileChooserArgs; +import com.fr.design.gui.ifilechooser.FileChooserFactory; import com.fr.design.gui.ifilechooser.FileChooserProvider; import com.fr.design.gui.ifilechooser.FileSelectionMode; -import com.fr.design.gui.ifilechooser.JavaFxNativeFileChooser; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ipasswordfield.UIPassWordField; import com.fr.design.gui.ipasswordfield.UIPasswordFieldWithFixedLength; @@ -564,7 +565,8 @@ public class RemoteEnvPane extends BasicBeanPane { fileChooserButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { - FileChooserProvider fileChooserProvider = new JavaFxNativeFileChooser.Builder().fileSelectionMode(FileSelectionMode.FILE).build(); + FileChooserProvider fileChooserProvider = FileChooserFactory.createFileChooser(FileChooserArgs.newBuilder(). + setFileSelectionMode(FileSelectionMode.FILE).build()); int saveValue = fileChooserProvider.showDialog(SwingUtilities.getWindowAncestor(RemoteEnvPane.this)); if (saveValue == JFileChooser.APPROVE_OPTION) { File selectedFile = fileChooserProvider.getSelectedFile(); diff --git a/designer-chart/src/main/java/com/fr/design/chart/series/PlotSeries/MapCustomPane.java b/designer-chart/src/main/java/com/fr/design/chart/series/PlotSeries/MapCustomPane.java index 133e2fef7..a5351c74b 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/series/PlotSeries/MapCustomPane.java +++ b/designer-chart/src/main/java/com/fr/design/chart/series/PlotSeries/MapCustomPane.java @@ -9,8 +9,9 @@ import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.tabledata.wrapper.TableDataWrapper; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icombobox.FilterComboBox; +import com.fr.design.gui.ifilechooser.FileChooserArgs; +import com.fr.design.gui.ifilechooser.FileChooserFactory; import com.fr.design.gui.ifilechooser.FileChooserProvider; -import com.fr.design.gui.ifilechooser.JavaFxNativeFileChooser; import com.fr.design.gui.ilable.BoldFontTextLabel; import com.fr.design.gui.ilable.UILabel; import com.fr.design.mainframe.DesignerContext; @@ -19,8 +20,6 @@ import com.fr.general.ComparatorUtils; import com.fr.general.GeneralUtils; import com.fr.general.data.DataModel; import com.fr.log.FineLoggerFactory; -import com.fr.stable.StringUtils; -import org.apache.batik.swing.svg.SVGFileFilter; import javax.swing.JFileChooser; import javax.swing.JPanel; @@ -110,10 +109,12 @@ public class MapCustomPane extends BasicBeanPane implements AbstrctMapAt private ActionListener selectPictureActionListener = new ActionListener() { + @Override public void actionPerformed(ActionEvent evt) { - FileChooserProvider fileChooserProvider = new JavaFxNativeFileChooser.Builder(). - filter(".svg, .svgz", "*.svg", "*.svgz"). - currentDirectory(lastSelectPath).build(); + FileChooserProvider fileChooserProvider = FileChooserFactory.createFileChooser( + FileChooserArgs.newBuilder(). + setFilter(".svg, .svgz", "*.svg", "*.svgz"). + setSelectedPath(lastSelectPath).build()); int returnVal = fileChooserProvider.showDialog(DesignerContext.getDesignerFrame()); if (returnVal != JFileChooser.CANCEL_OPTION) { File selectedFile = fileChooserProvider.getSelectedFile(); diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/action/InstallComponentAction.java b/designer-form/src/main/java/com/fr/design/mainframe/share/action/InstallComponentAction.java index a845759f7..e777e2b41 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/action/InstallComponentAction.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/action/InstallComponentAction.java @@ -4,10 +4,11 @@ import com.fr.design.actions.UpdateAction; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.FineJOptionPane; +import com.fr.design.gui.ifilechooser.ExtensionFilter; +import com.fr.design.gui.ifilechooser.FileChooserArgs; +import com.fr.design.gui.ifilechooser.FileChooserFactory; import com.fr.design.gui.ifilechooser.FileChooserProvider; import com.fr.design.gui.ifilechooser.FileSelectionMode; -import com.fr.design.gui.ifilechooser.JavaFxNativeFileChooser; -import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.share.ui.base.FailureMessagePane; @@ -15,17 +16,13 @@ import com.fr.design.mainframe.share.ui.local.LocalWidgetRepoPane; import com.fr.design.mainframe.share.util.InstallUtils; import com.fr.design.mainframe.share.util.ShareComponentUtils; import com.fr.design.mainframe.share.util.ShareUIUtils; -import com.fr.design.os.impl.SupportOSImpl; import com.fr.form.share.record.ShareWidgetInfoManager; import com.fr.form.share.utils.ReuxUtils; import com.fr.log.FineLoggerFactory; -import com.sun.javafx.tk.FileChooserType; -import javafx.stage.FileChooser; import javax.swing.Action; import javax.swing.JFileChooser; import javax.swing.SwingWorker; -import javax.swing.filechooser.FileNameExtensionFilter; import java.awt.event.ActionEvent; import java.io.File; import java.util.ArrayList; @@ -46,15 +43,16 @@ public class InstallComponentAction extends UpdateAction { @Override public void actionPerformed(ActionEvent e) { - FileChooserProvider fileChooserProvider = - new JavaFxNativeFileChooser.Builder(). - fileSelectionMode(FileSelectionMode.MULTIPLE_FILE). - title(Toolkit.i18nText("Fine-Design_Basic_Select")). - filters(new FileChooser.ExtensionFilter[]{ - new FileChooser.ExtensionFilter("reu", "*.reu"), - new FileChooser.ExtensionFilter("reus", "*.reus"), - new FileChooser.ExtensionFilter("zip", "*.zip")}). - build(); + FileChooserProvider fileChooserProvider = FileChooserFactory.createFileChooser( + FileChooserArgs.newBuilder(). + setFileSelectionMode(FileSelectionMode.MULTIPLE_FILE). + setMultiSelectionEnabled(true). + setTipText(Toolkit.i18nText("Fine-Design_Basic_Select")). + setFilters(new ExtensionFilter[] { + new ExtensionFilter("reu", "*.reu"), + new ExtensionFilter("reus", "*.reus"), + new ExtensionFilter("zip", "*.zip"), + }).build()); int returnValue = fileChooserProvider.showDialog(null); installComponent(returnValue, fileChooserProvider.getSelectedFiles()); } From d357ff42c747d5b7a651ad7c46f33708c90598f2 Mon Sep 17 00:00:00 2001 From: hades Date: Fri, 31 Dec 2021 15:12:13 +0800 Subject: [PATCH 03/17] =?UTF-8?q?REPORT-64009=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E5=86=85=E5=AF=B9macOS12=E7=9A=84=E5=A4=84=E7=90=86?= =?UTF-8?q?=20fix=E9=97=A8=E6=A7=9B=E7=94=A8=E4=BE=8B=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/web/CustomIconPane.java | 9 ++++----- .../main/java/com/fr/start/module/DesignerActivator.java | 4 ++++ 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/web/CustomIconPane.java b/designer-base/src/main/java/com/fr/design/web/CustomIconPane.java index 9e03dcc9d..93e65a7ea 100644 --- a/designer-base/src/main/java/com/fr/design/web/CustomIconPane.java +++ b/designer-base/src/main/java/com/fr/design/web/CustomIconPane.java @@ -4,14 +4,14 @@ import com.fr.base.BaseUtils; import com.fr.base.GraphHelper; import com.fr.base.Icon; import com.fr.base.IconManager; -import com.fr.design.designer.IntervalConstants; import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.FineJOptionPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icontainer.UIScrollPane; +import com.fr.design.gui.ifilechooser.FileChooserArgs; +import com.fr.design.gui.ifilechooser.FileChooserFactory; import com.fr.design.gui.ifilechooser.FileChooserProvider; -import com.fr.design.gui.ifilechooser.JavaFxNativeFileChooser; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.iscrollbar.UIScrollBar; import com.fr.design.gui.itextarea.DescriptionTextArea; @@ -451,9 +451,8 @@ public class CustomIconPane extends BasicPane { private void onBrowseButtonClicked() { // carl:不知道是否只要png格式,反正导出时全部都转成png了 - FileChooserProvider fileChooserProvider = new JavaFxNativeFileChooser.Builder(). - filter("Icon Image File", "*.jpg", "*.jpeg", "*.png", "*.gif"). - build(); + FileChooserProvider fileChooserProvider = FileChooserFactory.createFileChooser(FileChooserArgs.newBuilder(). + setFilter("Icon Image File", "*.jpg", "*.jpeg", "*.png", "*.gif").build()); if (JFileChooser.APPROVE_OPTION == fileChooserProvider.showDialog(DesignerContext.getDesignerFrame())) { String path = fileChooserProvider.getSelectedFile().getAbsolutePath(); // 图片存储有最大值48*48限制,没有超过最大值时,按原图大小存储,超过最大值后,压缩至最大值存储 diff --git a/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java b/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java index 3c9b4dc9d..8ea078cd4 100644 --- a/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java +++ b/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java @@ -8,6 +8,7 @@ import com.fr.base.passport.FinePassportManager; import com.fr.base.process.ProcessOperator; import com.fr.chart.chartattr.ChartCollection; import com.fr.config.MarketConfig; +import com.fr.config.ServerPreferenceConfig; import com.fr.decision.update.backup.RecoverManager; import com.fr.design.DesignerEnvManager; import com.fr.design.ExtraDesignClassManager; @@ -177,6 +178,9 @@ public class DesignerActivator extends Activator implements Prepare { //生成BasicChartQuickEditor对象,需要用到ChartDesignerActivator的注册信息(DesignModuleFactory.registerChartPropertyPaneClass(ChartPropertyPane.class);) //所以不能在registerCellEditor函数中进行注册 ActionFactory.registerCellEditor(ChartCollection.class, new BasicChartQuickEditor()); + if (DesignerEnvManager.getEnvManager().isUseOptimizedUPM4Adapter() && WorkContext.getCurrent().isLocal()) { + ServerPreferenceConfig.getInstance().setUseOptimizedUPM(DesignerEnvManager.getEnvManager().isUseOptimizedUPM4Adapter()); + } } private void loadLogAppender() { From 40e5ba10a1e43a649d189dfcfbe69a34e217b7ab Mon Sep 17 00:00:00 2001 From: hades Date: Fri, 31 Dec 2021 15:18:53 +0800 Subject: [PATCH 04/17] =?UTF-8?q?REPORT-64009=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E5=86=85=E5=AF=B9macOS12=E7=9A=84=E5=A4=84=E7=90=86?= =?UTF-8?q?=20fix=20import?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/web/CustomIconPane.java | 25 +++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/web/CustomIconPane.java b/designer-base/src/main/java/com/fr/design/web/CustomIconPane.java index 93e65a7ea..96b584020 100644 --- a/designer-base/src/main/java/com/fr/design/web/CustomIconPane.java +++ b/designer-base/src/main/java/com/fr/design/web/CustomIconPane.java @@ -30,23 +30,34 @@ import com.fr.stable.ListMap; import com.fr.stable.StringUtils; import com.fr.transaction.Configurations; import com.fr.transaction.WorkerFacade; -import javafx.stage.FileChooser; -import javax.swing.*; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Component; +import java.awt.Cursor; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Image; +import javax.swing.ButtonGroup; +import javax.swing.ImageIcon; +import javax.swing.JComponent; +import javax.swing.JFileChooser; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JToggleButton; +import javax.swing.ScrollPaneConstants; +import javax.swing.SwingUtilities; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; -import javax.swing.filechooser.FileNameExtensionFilter; import javax.swing.plaf.basic.BasicButtonUI; -import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.FocusEvent; import java.awt.event.FocusListener; import java.awt.geom.Rectangle2D; import java.awt.image.BufferedImage; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; /** * carl:自定义Icon编辑 From 5132d43d76d4912e9ade46a730359dbef59542e4 Mon Sep 17 00:00:00 2001 From: hades Date: Tue, 4 Jan 2022 15:56:06 +0800 Subject: [PATCH 05/17] =?UTF-8?q?REPORT-65381=20linux=5Farm=E8=AE=BE?= =?UTF-8?q?=E8=AE=A1=E5=99=A8-=E7=82=B9=E5=87=BB=E8=8F=9C=E5=8D=95?= =?UTF-8?q?=E6=A0=8F=E6=96=87=E4=BB=B6-=E9=80=89=E9=A1=B9=EF=BC=8C?= =?UTF-8?q?=E5=87=BA=E7=8E=B0=E5=BC=B9=E7=AA=97=E5=90=8E=E5=86=8D=E7=82=B9?= =?UTF-8?q?=E5=87=BB=20=E7=A1=AE=E5=AE=9A=E6=8C=89=E9=92=AE=EF=BC=8C?= =?UTF-8?q?=E5=BC=B9=E7=AA=97=E4=B8=8D=E6=B6=88=E5=A4=B1=EF=BC=8C=E6=97=A0?= =?UTF-8?q?=E4=BB=BB=E4=BD=95=E5=8F=8D=E5=BA=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/actions/file/PreferencePane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java b/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java index e3dd02e95..db94ace66 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java @@ -788,7 +788,7 @@ public class PreferencePane extends BasicPane { designerEnvManager.setJoinProductImprove(this.joinProductImproveCheckBox.isSelected()); designerEnvManager.setEmbedServerLazyStartup(this.embedServerLazyStartupCheckBox.isSelected()); designerEnvManager.setImageCompress(this.imageCompressPanelCheckBox.isSelected()); - designerEnvManager.setUseOptimizedUPM4Adapter(this.useOptimizedUPMCheckbox.isSelected()); + designerEnvManager.setUseOptimizedUPM4Adapter(this.useOptimizedUPMCheckbox != null && this.useOptimizedUPMCheckbox.isSelected()); VcsConfigManager vcsConfigManager = designerEnvManager.getVcsConfigManager(); vcsConfigManager.setSaveInterval(this.saveIntervalEditor.getValue()); vcsConfigManager.setVcsEnable(this.vcsEnableCheckBox.isSelected()); From d1321ea0815c4b4a4c4b672b38ac363728852cf6 Mon Sep 17 00:00:00 2001 From: hades Date: Tue, 4 Jan 2022 15:56:57 +0800 Subject: [PATCH 06/17] =?UTF-8?q?REPORT-65369=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E5=86=85=E5=AF=B9macOS12=E7=9A=84=E5=A4=84=E7=90=86-?= =?UTF-8?q?=E6=8C=89=E9=92=AE=E5=9B=BE=E6=A0=87=E8=AE=BE=E7=BD=AE-?= =?UTF-8?q?=E5=9C=A8=E7=82=B9=E5=87=BB=20=E9=80=89=E6=8B=A9=E5=9B=BE?= =?UTF-8?q?=E7=89=87=E6=97=B6=E5=9B=9E=E5=88=B0=E4=BA=86=E7=88=B6=E5=BC=B9?= =?UTF-8?q?=E7=AA=97=E7=95=8C=E9=9D=A2=EF=BC=8C=E6=B2=A1=E6=9C=89=E5=AE=9E?= =?UTF-8?q?=E6=97=B6=E6=98=BE=E7=A4=BA=E5=87=BA=E6=9D=A5=EF=BC=8C=E8=80=8C?= =?UTF-8?q?=E9=9C=80=E8=A6=81=E5=86=8D=E6=AC=A1=E5=8D=95=E6=9C=BA=E8=AE=BE?= =?UTF-8?q?=E8=AE=A1=E5=99=A8=E7=95=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/web/CustomIconPane.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/web/CustomIconPane.java b/designer-base/src/main/java/com/fr/design/web/CustomIconPane.java index 96b584020..564b09d46 100644 --- a/designer-base/src/main/java/com/fr/design/web/CustomIconPane.java +++ b/designer-base/src/main/java/com/fr/design/web/CustomIconPane.java @@ -40,6 +40,7 @@ import java.awt.FlowLayout; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Image; +import java.awt.Window; import javax.swing.ButtonGroup; import javax.swing.ImageIcon; import javax.swing.JComponent; @@ -425,7 +426,7 @@ public class CustomIconPane extends BasicPane { browseButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - onBrowseButtonClicked(); + onBrowseButtonClicked(SwingUtilities.getWindowAncestor(EditIconDialog.this)); } }); @@ -460,11 +461,11 @@ public class CustomIconPane extends BasicPane { this.add(centerPane, BorderLayout.CENTER); } - private void onBrowseButtonClicked() { + private void onBrowseButtonClicked(Window parent) { // carl:不知道是否只要png格式,反正导出时全部都转成png了 FileChooserProvider fileChooserProvider = FileChooserFactory.createFileChooser(FileChooserArgs.newBuilder(). setFilter("Icon Image File", "*.jpg", "*.jpeg", "*.png", "*.gif").build()); - if (JFileChooser.APPROVE_OPTION == fileChooserProvider.showDialog(DesignerContext.getDesignerFrame())) { + if (JFileChooser.APPROVE_OPTION == fileChooserProvider.showDialog(parent)) { String path = fileChooserProvider.getSelectedFile().getAbsolutePath(); // 图片存储有最大值48*48限制,没有超过最大值时,按原图大小存储,超过最大值后,压缩至最大值存储 Image image = BaseUtils.readImage(path); From b74f5d3bd323a8a78d7ada1bd022e41ba53d7e44 Mon Sep 17 00:00:00 2001 From: Hoky <303455184@qq.com> Date: Tue, 4 Jan 2022 16:25:24 +0800 Subject: [PATCH 07/17] =?UTF-8?q?REPORT-65290=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8-=E6=B0=B4=E5=8D=B0=EF=BC=8C=E5=B9=B3=E5=8F=B0?= =?UTF-8?q?=E6=94=B9=E5=8F=98=E6=B0=B4=E5=8D=B0=E5=BC=80=E5=85=B3=EF=BC=8C?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E6=B0=B4=E5=8D=B0=E5=8F=98=E6=88=90=E4=BA=86?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E5=8D=95=E7=8B=AC=E8=AE=BE=E7=BD=AE=201.?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=B0=B4=E5=8D=B0=E7=9A=84isvalid?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/report/WatermarkSettingPane.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/report/WatermarkSettingPane.java b/designer-base/src/main/java/com/fr/design/report/WatermarkSettingPane.java index 0cc211c5f..e79bfcf6b 100644 --- a/designer-base/src/main/java/com/fr/design/report/WatermarkSettingPane.java +++ b/designer-base/src/main/java/com/fr/design/report/WatermarkSettingPane.java @@ -1,5 +1,6 @@ package com.fr.design.report; +import com.fr.base.iofile.attr.WaterMarkProvideConstant; import com.fr.base.iofile.attr.WatermarkAttr; import com.fr.design.dialog.AbstractTemplateServerSettingPane; import com.fr.report.core.ReportUtils; @@ -42,13 +43,13 @@ public class WatermarkSettingPane extends AbstractTemplateServerSettingPane { } public void populate(WatermarkAttr watermark) { - if (!watermark.isValid()) { + if (watermark.getWaterMarkProvider().equals(WaterMarkProvideConstant.TEMPLATE)) { + chooseComboBox.setSelectedIndex(SINGLE_SET); + watermarkPane.populate(watermark); + } else { chooseComboBox.setSelectedIndex(SERVER_SET); populateServerSettings(); - return; } - chooseComboBox.setSelectedIndex(SINGLE_SET); - watermarkPane.populate(watermark); } From 354400bec3cc6a452d291af16e8097d393115dd7 Mon Sep 17 00:00:00 2001 From: Starryi Date: Wed, 5 Jan 2022 11:36:54 +0800 Subject: [PATCH 08/17] =?UTF-8?q?REPORT-64811=2010.0=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E4=B8=8B=E8=BD=BD=E7=9A=84=E7=BB=84=E4=BB=B6=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E6=97=A0=E6=B3=95=E8=A7=A3=E5=8E=8B=E7=BC=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 10.0设计器无法通过配置文件使用测试服务器的下载接口,导致文件 下载失败. 【改动思路】 和11.0一样优先使用配置文件中的地址 --- .../com/fr/design/mainframe/share/util/DownloadUtils.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/util/DownloadUtils.java b/designer-form/src/main/java/com/fr/design/mainframe/share/util/DownloadUtils.java index b6375b1d6..6c6e156b0 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/util/DownloadUtils.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/util/DownloadUtils.java @@ -38,8 +38,8 @@ import java.util.Set; * created by Harrison on 2020/05/27 **/ public class DownloadUtils { - private static final String REUSES_URL = CloudCenter.getInstance().acquireUrlByKind("af.reuseInfo") + "file/download"; - private static final String PACKAGE_REUSES_URL = CloudCenter.getInstance().acquireUrlByKind("af.reuseInfo") + "package/download/"; + private static final String REUSES_URL = ShareComponentConstants.REU_INFO_PATH + "file/download"; + private static final String PACKAGE_REUSES_URL = ShareComponentConstants.REU_INFO_PATH + "package/download/"; private static final String CERTIFICATE_PUBLIC_KEY = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCtsz62CPSWXZE/IYZRiAuTSZkw\n" + "1WOwer8+JFktK0uKLAUuQoBr+UjAMFtRA8W7JgKMDwZy/2liEAiXEOSPU/hrdV8D\n" + "tT541LnGi1X/hXiRwuttPWYN3L2GYm/d5blU+FBNwghBIrdAxXTzYBc6P4KL/oYX\n" + From da9398eead40e011cfabfd388fe1d157e92c626e Mon Sep 17 00:00:00 2001 From: Starryi Date: Wed, 5 Jan 2022 17:04:09 +0800 Subject: [PATCH 09/17] =?UTF-8?q?REPORT-65449=20=E5=9C=A8=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=8C=85=E8=AF=A6=E6=83=85=E9=A1=B5=E6=8B=96=E6=8B=BD?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E5=B9=B6=E4=BF=AE=E6=94=B9=E5=90=8E=EF=BC=8C?= =?UTF-8?q?=E5=86=8D=E7=82=B9=E5=88=B0=E5=9C=A8=E7=BA=BF=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=EF=BC=8C=E6=A0=87=E7=AD=BE=E5=92=8C=E5=86=85=E5=AE=B9=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E4=B8=8D=E4=B8=80=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 在线组件库页面刷新为所有在线组件列表时,Tab标题没有作出对应改变,出现了Tab投显示组件包,而列表页 显示所有在线组件的情况 【改动思路】 刷新时修改标题头"组件" --- .../mainframe/share/ui/online/OnlineWidgetTabPane.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineWidgetTabPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineWidgetTabPane.java index b48b74e67..52ea26bc2 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineWidgetTabPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineWidgetTabPane.java @@ -24,6 +24,7 @@ public class OnlineWidgetTabPane extends JPanel { private static final String COMPONENT = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Share"); private static final String COMPONENT_PACKAGE = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Share_Package"); private static final String COMPONENT_EMBED = "COMPONENT_EMBED"; + private UITabGroup headGroup; private CardLayout cardLayout; private JPanel centerPane; private boolean packagePaneCreated = false; @@ -43,7 +44,7 @@ public class OnlineWidgetTabPane extends JPanel { this.centerPane.add(new OnlineWidgetShowPane(sharableWidgets), COMPONENT); this.centerPane.add( embedFilterShowPane = new OnlineEmbedFilterShowPane(new OnlineWidgetShowPane(sharableWidgets, OnlineWidgetSortType.SALES)), COMPONENT_EMBED); //延迟组件包面板的初始化,防止组件面板里组件的缩略图和组件包面板里组件的缩略图一起加载 - UITabGroup headGroup = new UITabGroup(new String[]{COMPONENT, COMPONENT_PACKAGE}) { + this.headGroup = new UITabGroup(new String[]{COMPONENT, COMPONENT_PACKAGE}) { public void tabChanged(int newSelectedIndex) { for (TabChangeListener changeListener : tabChangeListeners) { changeListener.tabChange(newSelectedIndex); @@ -63,7 +64,7 @@ public class OnlineWidgetTabPane extends JPanel { } }; - headGroup.setSelectedIndex(0); + this.headGroup.setSelectedIndex(0); this.centerPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); jPanel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 10)); @@ -84,6 +85,7 @@ public class OnlineWidgetTabPane extends JPanel { } } public void refreshPane() { + this.headGroup.setSelectedIndex(0); this.cardLayout.show(centerPane, ComponentShareUtil.needShowEmbedFilterPane() ? COMPONENT_EMBED : COMPONENT); } From 914aa241de62f41ef830b013e1b7726ef089f7cf Mon Sep 17 00:00:00 2001 From: Hoky <303455184@qq.com> Date: Wed, 5 Jan 2022 20:07:14 +0800 Subject: [PATCH 10/17] =?UTF-8?q?REPORT-65474=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8-=E6=B0=B4=E5=8D=B0=EF=BC=8C=E5=B9=B3=E5=8F=B0?= =?UTF-8?q?=E6=94=B9=E5=8F=98=E6=B0=B4=E5=8D=B0=E5=BC=80=E5=85=B3=EF=BC=8C?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E6=B0=B4=E5=8D=B0=E5=8F=98=E6=88=90=E4=BA=86?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E5=8D=95=E7=8B=AC=E8=AE=BE=E7=BD=AE=201.?= =?UTF-8?q?=E6=96=B0=E5=BB=BA=E6=B0=B4=E5=8D=B0=E9=BB=98=E8=AE=A4=E4=B8=8D?= =?UTF-8?q?=E6=98=AF=E6=A8=A1=E6=9D=BF=E6=B0=B4=E5=8D=B0=EF=BC=8C=E5=BD=93?= =?UTF-8?q?=E6=96=B0=E5=BB=BA=E6=A8=A1=E6=9D=BF=E6=B0=B4=E5=8D=B0=E7=9A=84?= =?UTF-8?q?=E6=97=B6=E5=80=99=EF=BC=8C=E8=BF=9B=E8=A1=8C=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E5=8D=B3=E5=8F=AF=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/report/WatermarkSettingPane.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/report/WatermarkSettingPane.java b/designer-base/src/main/java/com/fr/design/report/WatermarkSettingPane.java index e79bfcf6b..f3de6eef9 100644 --- a/designer-base/src/main/java/com/fr/design/report/WatermarkSettingPane.java +++ b/designer-base/src/main/java/com/fr/design/report/WatermarkSettingPane.java @@ -34,6 +34,7 @@ public class WatermarkSettingPane extends AbstractTemplateServerSettingPane { @Override protected void populateServerSettings() { WatermarkAttr watermarkAttr = ReportUtils.getWatermarkAttrFromServerConfig(); + watermarkAttr.setValid(true); watermarkPane.populate(watermarkAttr); } @@ -55,8 +56,9 @@ public class WatermarkSettingPane extends AbstractTemplateServerSettingPane { public WatermarkAttr update() { WatermarkAttr watermark = watermarkPane.update(); - if (isUsingServerSettings()) { - watermark.setValid(false); + if (!isUsingServerSettings()) { + watermark.setValid(true); + watermark.setWaterMarkProvider(WaterMarkProvideConstant.TEMPLATE); } return watermark; } From 113fac5ff8588a6f4f1d42d665edd15f981e61ba Mon Sep 17 00:00:00 2001 From: shine Date: Thu, 6 Jan 2022 18:04:16 +0800 Subject: [PATCH 11/17] =?UTF-8?q?CHART-22259=20feat:=E6=8F=92=E4=BB=B6?= =?UTF-8?q?=E9=87=8D=E6=96=B0=E5=8A=A0=E8=BD=BD=E6=88=96=E8=80=85=E5=88=87?= =?UTF-8?q?=E6=8D=A2env=20fvs=E6=A8=A1=E6=9D=BF=E9=87=8D=E6=96=B0=E5=8A=A0?= =?UTF-8?q?=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/file/HistoryTemplateListCache.java | 23 +++---------------- .../com/fr/design/mainframe/JTemplate.java | 18 +++++++++++++++ 2 files changed, 21 insertions(+), 20 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java index 667592552..c00f8bb44 100644 --- a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java +++ b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java @@ -15,7 +15,6 @@ import com.fr.design.mainframe.JVirtualTemplate; import com.fr.design.ui.util.UIUtil; import com.fr.file.FILE; import com.fr.file.FileNodeFILE; -import com.fr.file.StashedFILE; import com.fr.general.ComparatorUtils; import com.fr.invoke.ClassHelper; import com.fr.log.FineLoggerFactory; @@ -25,7 +24,7 @@ import com.fr.stable.CoreConstants; import com.fr.stable.StringUtils; import com.fr.third.org.apache.commons.io.FilenameUtils; -import java.io.ByteArrayOutputStream; +import javax.swing.SwingWorker; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; @@ -33,7 +32,6 @@ import java.util.List; import java.util.ListIterator; import java.util.Map; import java.util.Set; -import javax.swing.SwingWorker; /** * 历史模板缓存 @@ -360,7 +358,7 @@ public class HistoryTemplateListCache implements CallbackEvent { int size = historyList.size(); for (int i = 0; i < size; i++) { JTemplate template = historyList.get(i); - FILE file = templateToStashFile(template); + FILE file = template.templateToStashFile(); if (file != null) { stashFILEMap.put(i, file); } @@ -368,21 +366,6 @@ public class HistoryTemplateListCache implements CallbackEvent { 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() { try { @@ -465,7 +448,7 @@ public class HistoryTemplateListCache implements CallbackEvent { FILE file = template.getEditingFILE(); boolean needReload = context == null || needReloadTemplate(context, template); if (needReload) { - FILE stashFile = templateToStashFile(template); + FILE stashFile = template.templateToStashFile(); if (stashFile != null) { FineLoggerFactory.getLogger().info("{} is being reloaded", file.getName()); template.refreshResource(stashFile); 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 f1f72b48c..e990012f8 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 @@ -56,6 +56,7 @@ import com.fr.event.EventDispatcher; import com.fr.file.FILE; import com.fr.file.FILEChooserPane; import com.fr.file.MemFILE; +import com.fr.file.StashedFILE; import com.fr.form.ui.NoneWidget; import com.fr.form.ui.Widget; import com.fr.general.ComparatorUtils; @@ -84,6 +85,7 @@ import javax.swing.JComponent; import javax.swing.JOptionPane; import javax.swing.undo.UndoManager; import java.awt.BorderLayout; +import java.io.ByteArrayOutputStream; import java.util.Set; import java.util.concurrent.Callable; @@ -371,6 +373,22 @@ public abstract class JTemplate> PluginListenerRegistration.getInstance().stopListen(this.pluginListener); } + public FILE templateToStashFile() { + FILE file = this.getEditingFILE(); + try { + ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); + BaseBook target = this.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; + } + /** * 刷新内部资源 From c480db219a7c4495040c9e4c1c23b9a18cbf9409 Mon Sep 17 00:00:00 2001 From: Hoky <303455184@qq.com> Date: Fri, 7 Jan 2022 09:49:13 +0800 Subject: [PATCH 12/17] =?UTF-8?q?REPORT-65515=E3=80=90=E7=A8=B3=E5=AE=9A?= =?UTF-8?q?=E5=85=B1=E5=88=9B=E3=80=91=E5=85=AC=E5=BC=8F=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E5=99=A8-=E5=AD=98=E5=9C=A8=E6=8F=92=E4=BB=B6=E5=87=BD?= =?UTF-8?q?=E6=95=B0=E6=97=B6=EF=BC=8C=E9=80=89=E6=8B=A9=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E9=9B=86=E5=8F=82=E6=95=B0=E5=87=BD=E6=95=B0=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E8=B7=B3=E8=BD=AC=E6=98=BE=E7=A4=BA=E6=9C=89=E9=97=AE=E9=A2=98?= =?UTF-8?q?=201.=E9=80=89=E4=B8=AD=E5=8F=82=E6=95=B0=E6=97=B6=EF=BC=8C?= =?UTF-8?q?=E8=BF=94=E5=9B=9E=E9=BB=98=E8=AE=A4=E7=9A=84=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/formula/FormulaPane.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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 904cdf00b..a4354ee9d 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 @@ -555,6 +555,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { private void fixFunctionNameList(String functionName) { int signOfContinue = 1; int indexOfFunction = 0; + boolean found = false; for (int i = 0; i < functionTypeListModel.size(); i++) { int signOfType = 0; FunctionGroup functionType = (FunctionGroup) functionTypeListModel.getElementAt(i); @@ -568,6 +569,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { signOfType = 1; signOfContinue = 0; indexOfFunction = k; + found = true; } } @@ -577,8 +579,12 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { } } } - functionNameList.setSelectedIndex(indexOfFunction); - functionNameList.ensureIndexIsVisible(indexOfFunction); + if (found) { + functionNameList.setSelectedIndex(indexOfFunction); + functionNameList.ensureIndexIsVisible(indexOfFunction); + } else { + functionTypeList.setSelectedIndex(0); + } } private int getBeginPosition() { From 95dadd063a69dfbd3b5cabdf5b59cf8deefc124b Mon Sep 17 00:00:00 2001 From: hades Date: Mon, 10 Jan 2022 15:26:22 +0800 Subject: [PATCH 13/17] =?UTF-8?q?REPORT-65475=20AlphaFine=E6=90=9C?= =?UTF-8?q?=E7=B4=A2=E6=85=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../search/manager/impl/FileSearchManager.java | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/FileSearchManager.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/FileSearchManager.java index 0497828c7..327d0555c 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/FileSearchManager.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/FileSearchManager.java @@ -11,10 +11,14 @@ import com.fr.design.mainframe.alphafine.cell.model.MoreModel; import com.fr.design.mainframe.alphafine.model.SearchResult; import com.fr.design.mainframe.alphafine.search.manager.fun.AlphaFineSearchProvider; import com.fr.file.filetree.FileNode; +import com.fr.file.filetree.FileNodes; import com.fr.general.ComparatorUtils; import com.fr.json.JSONObject; +import com.fr.rpc.ExceptionHandler; +import com.fr.rpc.RPCInvokerExceptionInfo; import com.fr.stable.StringUtils; import com.fr.stable.project.ProjectConstants; +import com.fr.workspace.WorkContext; /** @@ -74,7 +78,12 @@ public class FileSearchManager implements AlphaFineSearchProvider { return lessModelList; } AlphaFineHelper.checkCancel(); - fileNodes = FRContext.getFileNodes().list(ProjectConstants.REPORTLETS_NAME, AlphaFineConstants.FILE_EXTENSIONS, true); + fileNodes = WorkContext.getCurrent().get(FileNodes.class, new ExceptionHandler() { + @Override + public Object callHandler(RPCInvokerExceptionInfo exceptionInfo) { + return FRContext.getFileNodes().list(ProjectConstants.REPORTLETS_NAME, AlphaFineConstants.FILE_EXTENSIONS, true); + } + }).list(ProjectConstants.REPORTLETS_NAME, AlphaFineConstants.FILE_EXTENSIONS, true, false); isContainCpt = true; isContainFrm = true; doSearch(this.searchText); @@ -128,7 +137,12 @@ public class FileSearchManager implements AlphaFineSearchProvider { */ private void doFileContentSearch(String searchText) { if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isContainFileContent()) { - FileNode[] fileNodes = FRContext.getFileNodes().filterFiles(searchText, ProjectConstants.REPORTLETS_NAME, new FileExtension[]{FileExtension.CPT, FileExtension.FRM}, true); + FileNode[] fileNodes = WorkContext.getCurrent().get(FileNodes.class, new ExceptionHandler() { + @Override + public Object callHandler(RPCInvokerExceptionInfo exceptionInfo) { + return FRContext.getFileNodes().filterFiles(searchText, ProjectConstants.REPORTLETS_NAME, new FileExtension[]{FileExtension.CPT, FileExtension.FRM}, true); + } + }).filterFiles(searchText, ProjectConstants.REPORTLETS_NAME, new FileExtension[]{FileExtension.CPT, FileExtension.FRM}, true, false); for (FileNode node : fileNodes) { FileModel model = new FileModel(node.getName(), node.getEnvPath()); if (!AlphaFineHelper.getFilterResult().contains(model) && !filterModelList.contains(model)) { From f7ee5493b14b35af3a9a39466f3d372cc7bdadf8 Mon Sep 17 00:00:00 2001 From: Hoky <303455184@qq.com> Date: Fri, 14 Jan 2022 10:18:41 +0800 Subject: [PATCH 14/17] =?UTF-8?q?REPORT-65194=20=E5=85=AC=E5=BC=8F?= =?UTF-8?q?=E6=A8=A1=E6=8B=9F=E8=AE=A1=E7=AE=97=E8=AE=A1=E7=AE=97=E5=BC=82?= =?UTF-8?q?=E5=B8=B8=E7=9A=84=E6=8F=90=E7=A4=BA=E6=A1=86=E5=86=85=E7=9A=84?= =?UTF-8?q?=E5=9B=BE=E6=A0=87=E4=B8=8D=E6=AD=A3=E7=A1=AE=201.=E8=AE=A1?= =?UTF-8?q?=E7=AE=97=E5=BC=82=E5=B8=B8=E7=9A=84=E6=97=B6=E5=80=99=E7=BB=99?= =?UTF-8?q?warn=E5=9B=BE=E6=A0=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/formula/FormulaPane.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) 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 a4354ee9d..795ff721f 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 @@ -814,10 +814,11 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { String formulaText = formulaTextArea.getText().trim(); String unSupportFormula = containsUnsupportedSimulationFormulas(formulaText); if (unSupportFormula != null) { - showMessageDialog(Toolkit.i18nText("Fine-Design_Basic_Formula_Unsupported_Formulas") + ":" + unSupportFormula, false); + showMessageDialog(Toolkit.i18nText("Fine-Design_Basic_Formula_Unsupported_Formulas") + ":" + unSupportFormula, false, true); return; } + boolean calException = false; String messageTips; FormulaCheckResult checkResult = FormulaChecker.check(formulaText); if (checkResult.grammarValid()) { @@ -846,6 +847,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { } catch (Exception ce) { //模拟计算如果出现错误,则抛出错误 calResult = ce.getMessage(); + calException = true; FineLoggerFactory.getLogger().error(ce.getMessage(), ce); messageTips = messageTips + Toolkit.i18nText("Fine-Design_Basic_Formula_Cal_Error") + ":" + calResult; } @@ -854,7 +856,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { messageTips = checkResult.getTips(); } if (checkResult.isValid()) { - showMessageDialog(messageTips, checkResult.isValid()); + showMessageDialog(messageTips, checkResult.isValid(), calException); } else { confirmCheckResult(checkResult, messageTips); } @@ -871,7 +873,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { private boolean confirmCheckResult(FormulaCheckResult checkResult, String messageTips) { if (checkResult.isValid()) { - showMessageDialog(checkResult.getTips(), checkResult.isValid()); + showMessageDialog(checkResult.getTips(), checkResult.isValid(), false); } else { int columns = checkResult.getFormulaCoordinates().getColumns(); String position = StringUtils.EMPTY; @@ -897,8 +899,8 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { return true; } - private void showMessageDialog(String message, boolean formulaValid) { - if (formulaValid) { + private void showMessageDialog(String message, boolean formulaValid, boolean calException) { + if (formulaValid && !calException) { FineJOptionPane.showMessageDialog( FormulaPane.this, message); From c65515aace725cfe9277e88c2a4d8522d7221d7d Mon Sep 17 00:00:00 2001 From: "Yuan.Wang" <1536296691@qq.com> Date: Fri, 14 Jan 2022 15:42:09 +0800 Subject: [PATCH 15/17] =?UTF-8?q?REPORT-65513=20=E5=A1=AB=E6=8A=A5-?= =?UTF-8?q?=E5=A1=AB=E6=8A=A5=E5=B1=9E=E6=80=A7=E8=AE=BE=E7=BD=AE-?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E5=8D=95=E5=85=83=E6=A0=BC=E7=BB=84=EF=BC=8C?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E2=80=9C=E5=8D=95=E5=85=83=E6=A0=BC=E4=B8=AA?= =?UTF-8?q?=E6=95=B0=E5=BF=85=E9=A1=BB=E7=9B=B8=E5=90=8C=E2=80=9D=E7=9A=84?= =?UTF-8?q?=E4=BA=A4=E4=BA=92=E9=80=BB=E8=BE=91=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/write/submit/SmartInsertDBManipulationPane.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/designer-realize/src/main/java/com/fr/design/write/submit/SmartInsertDBManipulationPane.java b/designer-realize/src/main/java/com/fr/design/write/submit/SmartInsertDBManipulationPane.java index 3818f1ac8..193fd4de9 100644 --- a/designer-realize/src/main/java/com/fr/design/write/submit/SmartInsertDBManipulationPane.java +++ b/designer-realize/src/main/java/com/fr/design/write/submit/SmartInsertDBManipulationPane.java @@ -291,6 +291,10 @@ public class SmartInsertDBManipulationPane extends DBManipulationPane { @Override public void checkValid() throws Exception { KeyColumnTableModel model = (KeyColumnTableModel) keyColumnValuesTable.getModel(); + checkModelValid(model); + } + + private void checkModelValid(KeyColumnTableModel model) throws Exception { int cnt = model.getRowCount(); int groupLength = -1; for (int i = 0; i < cnt; i++) { @@ -374,7 +378,8 @@ public class SmartInsertDBManipulationPane extends DBManipulationPane { */ @Override public void checkValid() throws Exception { - SmartInsertDBManipulationPane.this.checkValid(); + KeyColumnTableModel model = (KeyColumnTableModel) table.getModel(); + SmartInsertDBManipulationPane.this.checkModelValid(model); } private SelectionListener listener = new SelectionListener() { From 822a1b2a6f8903c662ed3df3a7275af3674b9181 Mon Sep 17 00:00:00 2001 From: hades Date: Mon, 17 Jan 2022 09:50:13 +0800 Subject: [PATCH 16/17] =?UTF-8?q?REPORT-65722=20=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E7=82=B9=E5=87=BB=E9=80=89=E6=8B=A9=E6=8C=89=E9=92=AE?= =?UTF-8?q?=E6=8E=A7=E4=BB=B6=E5=9B=BE=E6=A0=87=E6=97=B6=E6=97=A0=E5=8F=8D?= =?UTF-8?q?=E5=BA=94=EF=BC=8C=E6=B2=A1=E6=9C=89=E5=87=BA=E7=8E=B0=E5=8E=9F?= =?UTF-8?q?=E7=94=9F=E6=96=87=E4=BB=B6=E9=80=89=E6=8B=A9=E5=99=A8=E5=BC=B9?= =?UTF-8?q?=E7=AA=97=20=E5=90=8C=E6=AD=A5=E5=88=B011.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gui/ifilechooser/JavaFxNativeFileChooser.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/ifilechooser/JavaFxNativeFileChooser.java b/designer-base/src/main/java/com/fr/design/gui/ifilechooser/JavaFxNativeFileChooser.java index 4d3688324..fb6a7e88b 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ifilechooser/JavaFxNativeFileChooser.java +++ b/designer-base/src/main/java/com/fr/design/gui/ifilechooser/JavaFxNativeFileChooser.java @@ -197,7 +197,9 @@ public class JavaFxNativeFileChooser implements FileChooserProvider { private File currentDirectory; public Builder fileSelectionMode(FileSelectionMode fileSelectionMode) { - this.fileSelectionMode = fileSelectionMode; + if (fileSelectionMode != null) { + this.fileSelectionMode = fileSelectionMode; + } return this; } @@ -209,13 +211,17 @@ public class JavaFxNativeFileChooser implements FileChooserProvider { } public Builder filters(FileChooser.ExtensionFilter[] filters) { - this.filters = filters; + if (filters != null) { + this.filters = filters; + } return this; } public Builder filters(ExtensionFilter[] filters) { - for (ExtensionFilter filter : filters) { - this.filters = ArrayUtils.add(this.filters, new FileChooser.ExtensionFilter(filter.getDes(), filter.getExtensions())); + if (filters != null) { + for (ExtensionFilter filter : filters) { + this.filters = ArrayUtils.add(this.filters, new FileChooser.ExtensionFilter(filter.getDes(), filter.getExtensions())); + } } return this; } From 9752d1b92be43f54768cb5c2a731679b36d72ebb Mon Sep 17 00:00:00 2001 From: lucian Date: Wed, 19 Jan 2022 10:07:03 +0800 Subject: [PATCH 17/17] =?UTF-8?q?REPORT-65975=20=E5=A1=AB=E6=8A=A5-?= =?UTF-8?q?=E6=8E=A7=E4=BB=B6-=E6=8E=A7=E4=BB=B6=E4=BA=8B=E4=BB=B6?= =?UTF-8?q?=E4=B8=AD=E6=B7=BB=E5=8A=A0=E6=8F=90=E4=BA=A4=E4=BA=8B=E4=BB=B6?= =?UTF-8?q?=EF=BC=8C=E7=82=B9=E5=87=BB=E8=A1=A8=E5=90=8D=E5=90=8E=E4=BC=9A?= =?UTF-8?q?=E9=80=80=E5=87=BA=E5=BD=93=E5=89=8D=E9=80=89=E6=8B=A9=E7=95=8C?= =?UTF-8?q?=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../icombobox/TableSearchTreeComboBox.java | 43 ++++++++++++------- 1 file changed, 27 insertions(+), 16 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/icombobox/TableSearchTreeComboBox.java b/designer-base/src/main/java/com/fr/design/gui/icombobox/TableSearchTreeComboBox.java index 6b4198693..7198eeef0 100644 --- a/designer-base/src/main/java/com/fr/design/gui/icombobox/TableSearchTreeComboBox.java +++ b/designer-base/src/main/java/com/fr/design/gui/icombobox/TableSearchTreeComboBox.java @@ -16,12 +16,13 @@ import com.fr.stable.StringUtils; import javax.swing.JOptionPane; import javax.swing.JTree; import javax.swing.SwingWorker; +import javax.swing.event.PopupMenuEvent; +import javax.swing.event.PopupMenuListener; import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.DefaultTreeModel; import javax.swing.tree.TreeCellRenderer; import javax.swing.tree.TreeNode; import javax.swing.tree.TreePath; -import java.awt.event.MouseEvent; import java.util.Enumeration; /** @@ -40,7 +41,7 @@ public class TableSearchTreeComboBox extends FRTreeComboBox { public TableSearchTreeComboBox(ChoosePane parent, JTree tree, TreeCellRenderer renderer) { super(tree, renderer); this.parent = parent; - setUI(new TableSearchTreeComboBoxUI()); + initPopupListener(); } protected UIComboBoxEditor createEditor() { @@ -158,12 +159,6 @@ public class TableSearchTreeComboBox extends FRTreeComboBox { } } - private static final TableNameFilter EMPTY_FILTER = new TableNameFilter() { - public boolean accept(TableProcedure procedure) { - return true; - } - }; - /** * 表名模糊搜索实现 */ @@ -184,15 +179,31 @@ public class TableSearchTreeComboBox extends FRTreeComboBox { } } - /** - * 重写FRTreeComboBoxUI,实现点击下拉时触发模糊搜索 - */ - private class TableSearchTreeComboBoxUI extends FRTreeComboBoxUI { - - @Override - public void mouseClicked(MouseEvent e) { - searchExecute(); + private static final TableNameFilter EMPTY_FILTER = new TableNameFilter() { + public boolean accept(TableProcedure procedure) { + return true; } + }; + + private void initPopupListener() { + // 点击下拉时触发模糊搜索 + this.addPopupMenuListener(new PopupMenuListener() { + + @Override + public void popupMenuWillBecomeVisible(PopupMenuEvent e) { + searchExecute(); + } + + @Override + public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { + + } + + @Override + public void popupMenuCanceled(PopupMenuEvent e) { + + } + }); } /**