Browse Source

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

security/10.0
lucian 3 years ago
parent
commit
363d3bfc93
  1. 13
      designer-base/src/main/java/com/fr/design/DesignerEnvManager.java
  2. 15
      designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java
  3. 33
      designer-base/src/main/java/com/fr/design/base/clipboard/ClipboardFilter.java
  4. 25
      designer-base/src/main/java/com/fr/design/gui/ifilechooser/ExtensionFilter.java
  5. 109
      designer-base/src/main/java/com/fr/design/gui/ifilechooser/FileChooserArgs.java
  6. 44
      designer-base/src/main/java/com/fr/design/gui/ifilechooser/FileChooserFactory.java
  7. 13
      designer-base/src/main/java/com/fr/design/gui/ifilechooser/FileChooserProvider.java
  8. 21
      designer-base/src/main/java/com/fr/design/gui/ifilechooser/JavaFxNativeFileChooser.java
  9. 130
      designer-base/src/main/java/com/fr/design/gui/ifilechooser/SwingFileChooser.java
  10. 276
      designer-base/src/main/java/com/fr/design/gui/ifilechooser/SwingImageFileChooser.java
  11. 13
      designer-base/src/main/java/com/fr/design/gui/style/BorderPane.java
  12. 5
      designer-base/src/main/java/com/fr/design/os/impl/PMDialogAction.java
  13. 44
      designer-base/src/main/java/com/fr/design/os/impl/SupportOSImpl.java
  14. 15
      designer-base/src/main/java/com/fr/design/report/WatermarkSettingPane.java
  15. 39
      designer-base/src/main/java/com/fr/design/style/background/image/ImageFileChooser.java
  16. 18
      designer-base/src/main/java/com/fr/design/upm/UpmBridge.java
  17. 16
      designer-base/src/main/java/com/fr/design/utils/gui/AdjustWorkBookDefaultStyleUtils.java
  18. 41
      designer-base/src/main/java/com/fr/design/web/CustomIconPane.java
  19. 6
      designer-base/src/main/java/com/fr/env/RemoteEnvPane.java
  20. 13
      designer-chart/src/main/java/com/fr/design/chart/series/PlotSeries/MapCustomPane.java
  21. 11
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartUIListControlPane.java
  22. 12
      designer-chart/src/main/java/com/fr/van/chart/gantt/designer/data/data/component/GanttTableDataContentPane.java
  23. 28
      designer-form/src/main/java/com/fr/design/mainframe/share/action/InstallComponentAction.java
  24. 13
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/OnlineWidgetBlock.java
  25. 45
      designer-form/src/main/java/com/fr/design/mainframe/share/util/DownloadUtils.java
  26. 2
      designer-form/src/main/java/com/fr/design/mainframe/share/util/InstallUtils.java
  27. 5
      designer-realize/src/main/java/com/fr/design/actions/utils/ReportActionUtils.java
  28. 3
      designer-realize/src/main/java/com/fr/design/mainframe/HyperlinkGroupPaneActionImpl.java
  29. 2
      designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/AbstractCellAttrPane.java
  30. 12
      designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellStylePane.java
  31. 4
      designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java

13
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.login.config.DesignerLoginConfigManager;
import com.fr.design.mainframe.vcs.VcsConfigManager; import com.fr.design.mainframe.vcs.VcsConfigManager;
import com.fr.design.notification.SnapChatConfig; import com.fr.design.notification.SnapChatConfig;
import com.fr.design.os.impl.SupportOSImpl;
import com.fr.design.port.DesignerPortContext; import com.fr.design.port.DesignerPortContext;
import com.fr.design.style.color.ColorSelectConfigManager; import com.fr.design.style.color.ColorSelectConfigManager;
import com.fr.design.update.push.DesignerPushUpdateConfigManager; import com.fr.design.update.push.DesignerPushUpdateConfigManager;
@ -202,6 +203,8 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
private boolean showTemplateMissingPlugin = true; private boolean showTemplateMissingPlugin = true;
private boolean useOptimizedUPM4Adapter;
/** /**
* DesignerEnvManager. * DesignerEnvManager.
*/ */
@ -639,6 +642,14 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
this.showTemplateMissingPlugin = showTemplateMissingPlugin; 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.setEmbedServerLazyStartup(reader.getAttrAsBoolean("embedServerLazyStartup", false));
this.setShowTemplateMissingPlugin(reader.getAttrAsBoolean("showTemplateMissingPlugin", true)); this.setShowTemplateMissingPlugin(reader.getAttrAsBoolean("showTemplateMissingPlugin", true));
this.setUseOptimizedUPM4Adapter(reader.getAttrAsBoolean("useOptimizedUPM4Adapter", SupportOSImpl.MACOS_12_VERSION_ADAPTER.support()));
} }
private void readReportPaneAttributions(XMLableReader reader) { private void readReportPaneAttributions(XMLableReader reader) {
@ -2101,6 +2113,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
if (!this.isShowTemplateMissingPlugin()) { if (!this.isShowTemplateMissingPlugin()) {
writer.attr("showTemplateMissingPlugin", this.isShowTemplateMissingPlugin()); writer.attr("showTemplateMissingPlugin", this.isShowTemplateMissingPlugin());
} }
writer.attr("useOptimizedUPM4Adapter", this.isUseOptimizedUPM4Adapter());
writer.end(); writer.end();
} }

15
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.icheckbox.UICheckBox;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.icombobox.UIDictionaryComboBox; 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.FileChooserProvider;
import com.fr.design.gui.ifilechooser.FileSelectionMode; 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.ActionLabel;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.iprogressbar.UIProgressBarUI; 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.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.layout.VerticalFlowLayout; 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.VcsConfigManager;
import com.fr.design.mainframe.vcs.common.VcsHelper; import com.fr.design.mainframe.vcs.common.VcsHelper;
import com.fr.design.os.impl.SupportOSImpl; 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.WorkContext;
import com.fr.workspace.server.vcs.VcsOperator; import com.fr.workspace.server.vcs.VcsOperator;
import com.fr.workspace.server.vcs.git.config.GcConfig; 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.BorderFactory;
import javax.swing.BoxLayout; import javax.swing.BoxLayout;
@ -500,9 +498,8 @@ public class PreferencePane extends BasicPane {
@Override @Override
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
FileChooserProvider fileChooserProvider = FileChooserProvider fileChooserProvider =
new JavaFxNativeFileChooser.Builder(). FileChooserFactory.createFileChooser(FileChooserArgs.newBuilder().
fileSelectionMode(FileSelectionMode.DIR). setFileSelectionMode(FileSelectionMode.DIR).build());
build();
int saveValue = fileChooserProvider.showDialog(chooseDirBtn); int saveValue = fileChooserProvider.showDialog(chooseDirBtn);
if (saveValue == JFileChooser.APPROVE_OPTION) { if (saveValue == JFileChooser.APPROVE_OPTION) {
File selectedFile = fileChooserProvider.getSelectedFile(); File selectedFile = fileChooserProvider.getSelectedFile();
@ -715,7 +712,8 @@ public class PreferencePane extends BasicPane {
this.portEditor.setValue(new Integer(designerEnvManager.getEmbedServerPort())); this.portEditor.setValue(new Integer(designerEnvManager.getEmbedServerPort()));
if (useOptimizedUPMCheckbox != null) { if (useOptimizedUPMCheckbox != null) {
useOptimizedUPMCheckbox.setSelected(ServerPreferenceConfig.getInstance().isUseOptimizedUPM()); useOptimizedUPMCheckbox.setSelected(ServerPreferenceConfig.getInstance().isUseOptimizedUPM()
|| DesignerEnvManager.getEnvManager().isUseOptimizedUPM4Adapter());
} }
useUniverseDBMCheckbox.setSelected(ServerPreferenceConfig.getInstance().isUseUniverseDBM()); useUniverseDBMCheckbox.setSelected(ServerPreferenceConfig.getInstance().isUseUniverseDBM());
@ -790,6 +788,7 @@ public class PreferencePane extends BasicPane {
designerEnvManager.setJoinProductImprove(this.joinProductImproveCheckBox.isSelected()); designerEnvManager.setJoinProductImprove(this.joinProductImproveCheckBox.isSelected());
designerEnvManager.setEmbedServerLazyStartup(this.embedServerLazyStartupCheckBox.isSelected()); designerEnvManager.setEmbedServerLazyStartup(this.embedServerLazyStartupCheckBox.isSelected());
designerEnvManager.setImageCompress(this.imageCompressPanelCheckBox.isSelected()); designerEnvManager.setImageCompress(this.imageCompressPanelCheckBox.isSelected());
designerEnvManager.setUseOptimizedUPM4Adapter(this.useOptimizedUPMCheckbox != null && this.useOptimizedUPMCheckbox.isSelected());
VcsConfigManager vcsConfigManager = designerEnvManager.getVcsConfigManager(); VcsConfigManager vcsConfigManager = designerEnvManager.getVcsConfigManager();
vcsConfigManager.setSaveInterval(this.saveIntervalEditor.getValue()); vcsConfigManager.setSaveInterval(this.saveIntervalEditor.getValue());
vcsConfigManager.setVcsEnable(this.vcsEnableCheckBox.isSelected()); vcsConfigManager.setVcsEnable(this.vcsEnableCheckBox.isSelected());

33
designer-base/src/main/java/com/fr/design/base/clipboard/ClipboardFilter.java

@ -27,11 +27,7 @@ public abstract class ClipboardFilter {
} }
public static <T> T cut(T selection) { public static <T> T cut(T selection) {
for (ClipboardHandlerProvider provider : getClipboardHandlerProviders()) {
ExtraDesignClassManager manager = PluginModule.getAgent(PluginModule.ExtraDesign);
Set<ClipboardHandlerProvider> providers = manager.getArray(ClipboardHandlerProvider.XML_TAG);
providers.addAll(clipboardHandlerProviders);
for (ClipboardHandlerProvider provider : providers) {
if (provider.support(selection)) { if (provider.support(selection)) {
selection = ((ClipboardHandlerProvider<T>) provider).cut(selection); selection = ((ClipboardHandlerProvider<T>) provider).cut(selection);
} }
@ -40,10 +36,7 @@ public abstract class ClipboardFilter {
} }
public static <T> T copy(T selection) { public static <T> T copy(T selection) {
ExtraDesignClassManager manager = PluginModule.getAgent(PluginModule.ExtraDesign); for (ClipboardHandlerProvider provider : getClipboardHandlerProviders()) {
Set<ClipboardHandlerProvider> providers = manager.getArray(ClipboardHandlerProvider.XML_TAG);
providers.addAll(clipboardHandlerProviders);
for (ClipboardHandlerProvider provider : providers) {
if (provider.support(selection)) { if (provider.support(selection)) {
selection = ((ClipboardHandlerProvider<T>) provider).copy(selection); selection = ((ClipboardHandlerProvider<T>) provider).copy(selection);
} }
@ -52,15 +45,27 @@ public abstract class ClipboardFilter {
} }
public static <T> T paste(T selection) { public static <T> T paste(T selection) {
ExtraDesignClassManager manager = PluginModule.getAgent(PluginModule.ExtraDesign); for (ClipboardHandlerProvider provider : getClipboardHandlerProviders()) {
Set<ClipboardHandlerProvider> providers = manager.getArray(ClipboardHandlerProvider.XML_TAG);
providers.addAll(clipboardHandlerProviders);
for (ClipboardHandlerProvider provider : providers) {
if (provider.support(selection)) { if (provider.support(selection)) {
selection = ((ClipboardHandlerProvider<T>) provider).paste(selection); selection = ((ClipboardHandlerProvider<T>) provider).paste(selection);
} }
} }
return selection; return selection;
} }
private static Set<ClipboardHandlerProvider> getClipboardHandlerProviders() {
Set<ClipboardHandlerProvider> providers = new HashSet<>();
for (ClipboardHandlerProvider clipboardHandlerProvider : clipboardHandlerProviders) {
providers.add(clipboardHandlerProvider);
}
ExtraDesignClassManager manager = PluginModule.getAgent(PluginModule.ExtraDesign);
Set<ClipboardHandlerProvider> pluginProviders = manager.getArray(ClipboardHandlerProvider.XML_TAG);
for (ClipboardHandlerProvider clipboardHandlerProvider : pluginProviders) {
providers.add(clipboardHandlerProvider);
}
return providers;
}
} }

25
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;
}
}

109
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);
}
}
}

44
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();
}
}
}

13
designer-base/src/main/java/com/fr/design/gui/ifilechooser/FileChooserProvider.java

@ -9,4 +9,17 @@ public interface FileChooserProvider {
File getSelectedFile(); File getSelectedFile();
int showDialog(Component parent); int showDialog(Component parent);
default int showOpenDialog(Component parent, String approveButtonText) {
return -1;
}
default void setMultiSelectionEnabled(boolean multiple) {
}
default void setCurrentDirectory(File file) {
}
} }

21
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.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils;
import com.sun.javafx.application.PlatformImpl; import com.sun.javafx.application.PlatformImpl;
import javafx.application.Platform; import javafx.application.Platform;
import javafx.scene.Scene; import javafx.scene.Scene;
@ -173,10 +175,20 @@ public class JavaFxNativeFileChooser implements FileChooserProvider {
this.fileSelectionMode = fileSelectionMode; this.fileSelectionMode = fileSelectionMode;
} }
@Override
public void setCurrentDirectory(File currentDirectory) { public void setCurrentDirectory(File currentDirectory) {
this.currentDirectory = 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 { public static class Builder {
private FileSelectionMode fileSelectionMode = FileSelectionMode.FILE; private FileSelectionMode fileSelectionMode = FileSelectionMode.FILE;
@ -190,7 +202,9 @@ public class JavaFxNativeFileChooser implements FileChooserProvider {
} }
public Builder title(String title) { public Builder title(String title) {
if (StringUtils.isNotEmpty(title)) {
this.title = title; this.title = title;
}
return this; return this;
} }
@ -199,6 +213,13 @@ public class JavaFxNativeFileChooser implements FileChooserProvider {
return this; 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) { public Builder filter(String des, String... extensions) {
if (extensions != null) { if (extensions != null) {
this.filters = new FileChooser.ExtensionFilter[]{new FileChooser.ExtensionFilter(des, extensions)}; this.filters = new FileChooser.ExtensionFilter[]{new FileChooser.ExtensionFilter(des, extensions)};

130
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);
}
}
}

276
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.
* <p/>D:\finereport\develop\code\test\TestCase\WEB-INF\reportlets\TestCase\01903.cpt
* <p>
* Extensions are of the type ".foo", which is typically found on
* Windows and Unix boxes, but not on Macinthosh. Case is ignored.
* <p/>
* Example - create a new filter that filerts out all files
* but gif and jpg image files:
* <p/>
* 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");
* <p/>
* 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"});
* <p/>
* 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");
* <p/>
* 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.
* <p/>
* 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.
* <p/>
* For example: the following code will create a filter that filters
* out all files except those that end in ".jpg" and ".tif":
* <p/>
* ExampleFileFilter filter = new ExampleFileFilter();
* filter.addExtension("jpg");
* filter.addExtension("tif");
* <p/>
* 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.
* <p/>
* 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.
* <p/>
* Only relevent if a description was provided in the constructor
* or using setDescription();
*/
public boolean isExtensionListInDescription() {
return useExtensionsInDescription;
}
}
}

13
designer-base/src/main/java/com/fr/design/gui/style/BorderPane.java

@ -17,14 +17,19 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.style.color.NewColorSelectBox; import com.fr.design.style.color.NewColorSelectBox;
import com.fr.design.utils.gui.AdjustWorkBookDefaultStyleUtils;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.stable.CoreConstants; import com.fr.stable.CoreConstants;
import javax.swing.*; import javax.swing.Icon;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import java.awt.*; import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.GridLayout;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
@ -198,7 +203,7 @@ public class BorderPane extends AbstractBasicStylePane implements GlobalNameObse
public Style update(Style style) { public Style update(Style style) {
if (style == null) { if (style == null) {
style = Style.DEFAULT_STYLE; style = AdjustWorkBookDefaultStyleUtils.adjustCellElement(Style.DEFAULT_STYLE);
} }
if (backgroundPane.currentPane.isBackgroundChange()) { if (backgroundPane.currentPane.isBackgroundChange()) {

5
designer-base/src/main/java/com/fr/design/os/impl/PMDialogAction.java

@ -1,6 +1,7 @@
package com.fr.design.os.impl; package com.fr.design.os.impl;
import com.fr.config.ServerPreferenceConfig; import com.fr.config.ServerPreferenceConfig;
import com.fr.design.DesignerEnvManager;
import com.fr.design.extra.WebViewDlgHelper; import com.fr.design.extra.WebViewDlgHelper;
import com.fr.design.jdk.JdkVersion; import com.fr.design.jdk.JdkVersion;
import com.fr.design.upm.UpmFinder; import com.fr.design.upm.UpmFinder;
@ -23,7 +24,9 @@ public class PMDialogAction implements OSBasedAction {
DesignUtils.visitEnvServerByParameters( PLUGIN_MANAGER_ROUTE,null,null); DesignUtils.visitEnvServerByParameters( PLUGIN_MANAGER_ROUTE,null,null);
return; 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(); UpmFinder.showUPMDialog();
} else { } else {
WebViewDlgHelper.createPluginDialog(); WebViewDlgHelper.createPluginDialog();

44
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.JSON;
import com.fr.json.JSONFactory; import com.fr.json.JSONFactory;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.os.Arch; import com.fr.stable.os.Arch;
import com.fr.stable.os.OperatingSystem; import com.fr.stable.os.OperatingSystem;
import com.fr.stable.os.support.SupportOS; import com.fr.stable.os.support.SupportOS;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale; import java.util.Locale;
import java.util.Scanner;
/** /**
* @author pengda * @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<String> 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 { DESIGNER_LOGIN {
@Override @Override
public boolean support() { public boolean support() {

15
designer-base/src/main/java/com/fr/design/report/WatermarkSettingPane.java

@ -1,5 +1,6 @@
package com.fr.design.report; package com.fr.design.report;
import com.fr.base.iofile.attr.WaterMarkProvideConstant;
import com.fr.base.iofile.attr.WatermarkAttr; import com.fr.base.iofile.attr.WatermarkAttr;
import com.fr.design.dialog.AbstractTemplateServerSettingPane; import com.fr.design.dialog.AbstractTemplateServerSettingPane;
import com.fr.report.core.ReportUtils; import com.fr.report.core.ReportUtils;
@ -33,6 +34,7 @@ public class WatermarkSettingPane extends AbstractTemplateServerSettingPane {
@Override @Override
protected void populateServerSettings() { protected void populateServerSettings() {
WatermarkAttr watermarkAttr = ReportUtils.getWatermarkAttrFromServerConfig(); WatermarkAttr watermarkAttr = ReportUtils.getWatermarkAttrFromServerConfig();
watermarkAttr.setValid(true);
watermarkPane.populate(watermarkAttr); watermarkPane.populate(watermarkAttr);
} }
@ -42,20 +44,21 @@ public class WatermarkSettingPane extends AbstractTemplateServerSettingPane {
} }
public void populate(WatermarkAttr watermark) { 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); chooseComboBox.setSelectedIndex(SERVER_SET);
populateServerSettings(); populateServerSettings();
return;
} }
chooseComboBox.setSelectedIndex(SINGLE_SET);
watermarkPane.populate(watermark);
} }
public WatermarkAttr update() { public WatermarkAttr update() {
WatermarkAttr watermark = watermarkPane.update(); WatermarkAttr watermark = watermarkPane.update();
if (isUsingServerSettings()) { if (!isUsingServerSettings()) {
watermark.setValid(false); watermark.setValid(true);
watermark.setWaterMarkProvider(WaterMarkProvideConstant.TEMPLATE);
} }
return watermark; return watermark;
} }

39
designer-base/src/main/java/com/fr/design/style/background/image/ImageFileChooser.java

@ -4,62 +4,47 @@
package com.fr.design.style.background.image; package com.fr.design.style.background.image;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.gui.ifilechooser.FileSelectionMode; import com.fr.design.gui.ifilechooser.FileChooserFactory;
import com.fr.design.gui.ifilechooser.JavaFxNativeFileChooser; import com.fr.design.gui.ifilechooser.FileChooserProvider;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit; 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 com.fr.design.mainframe.toast.DesignerToastMsgUtil;
import javafx.stage.FileChooser;
import javax.swing.*;
import java.awt.*; import java.awt.Component;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.io.File; import java.io.File;
import javax.swing.SwingUtilities;
/** /**
* This class used to choose image files. * This class used to choose image files.
*/ */
public class ImageFileChooser { public class ImageFileChooser {
private final FileChooserProvider fileChooserProvider;
JavaFxNativeFileChooser javaFxNativeFileChooser;
public ImageFileChooser() { public ImageFileChooser() {
javaFxNativeFileChooser = fileChooserProvider = FileChooserFactory.createImageFileChooser();
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();
} }
public int showOpenDialog(Component parent, String approveButtonText) { public int showOpenDialog(Component parent, String approveButtonText) {
return showOpenDialog(parent); return fileChooserProvider.showOpenDialog(parent, approveButtonText);
} }
public int showOpenDialog(Component parent) { public int showOpenDialog(Component parent) {
showImageCompressMoveTip(); showImageCompressMoveTip();
return javaFxNativeFileChooser.showDialog(parent); return fileChooserProvider.showDialog(parent);
} }
public void setCurrentDirectory(File file) { public void setCurrentDirectory(File file) {
javaFxNativeFileChooser.setCurrentDirectory(file); fileChooserProvider.setCurrentDirectory(file);
} }
public void setMultiSelectionEnabled(boolean multiple) { public void setMultiSelectionEnabled(boolean multiple) {
if (multiple) { fileChooserProvider.setMultiSelectionEnabled(multiple);
javaFxNativeFileChooser.setSelectionMode(FileSelectionMode.MULTIPLE_FILE);
} else {
javaFxNativeFileChooser.setSelectionMode(FileSelectionMode.FILE);
}
} }
public File getSelectedFile() { public File getSelectedFile() {
return javaFxNativeFileChooser.getSelectedFile(); return fileChooserProvider.getSelectedFile();
} }
public boolean isCheckSelected() { public boolean isCheckSelected() {

18
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.PluginLoginExecutor;
import com.fr.design.extra.exe.ReadUpdateOnlineExecutor; import com.fr.design.extra.exe.ReadUpdateOnlineExecutor;
import com.fr.design.extra.exe.SearchOnlineExecutor; 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.FileChooserProvider;
import com.fr.design.gui.ifilechooser.FileSelectionMode; import com.fr.design.gui.ifilechooser.FileSelectionMode;
import com.fr.design.gui.ifilechooser.JavaFxNativeFileChooser;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.locale.impl.BbsRegisterMark; import com.fr.design.locale.impl.BbsRegisterMark;
import com.fr.design.locale.impl.BbsResetMark; 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.JSArray;
import com.teamdev.jxbrowser.chromium.JSFunction; import com.teamdev.jxbrowser.chromium.JSFunction;
import com.teamdev.jxbrowser.chromium.JSObject; 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 javax.swing.filechooser.FileNameExtensionFilter;
import java.awt.*;
import java.io.File; import java.io.File;
import java.net.URI; import java.net.URI;
import java.util.ArrayList; import java.util.ArrayList;
@ -312,10 +314,10 @@ public class UpmBridge {
RunnableFuture<String> future = new FutureTask<>(new Callable<String>() { RunnableFuture<String> future = new FutureTask<>(new Callable<String>() {
@Override @Override
public String call() { public String call() {
FileChooserProvider fileChooserProvider = new JavaFxNativeFileChooser.Builder(). FileChooserProvider fileChooserProvider = FileChooserFactory.createFileChooser(
fileSelectionMode(FileSelectionMode.FILE). FileChooserArgs.newBuilder().
filter(des, filter). setFileSelectionMode(FileSelectionMode.FILE).
build(); setFilter(des, filter).build());
int result = fileChooserProvider.showDialog(UpmFinder.getDialog()); int result = fileChooserProvider.showDialog(UpmFinder.getDialog());
if (result == JFileChooser.APPROVE_OPTION) { if (result == JFileChooser.APPROVE_OPTION) {
return fileChooserProvider.getSelectedFile().getAbsolutePath(); return fileChooserProvider.getSelectedFile().getAbsolutePath();

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

@ -17,6 +17,7 @@ public class AdjustWorkBookDefaultStyleUtils {
private static final Color TEMPLATE_BACKGROUND = new Color(16, 11, 43); private static final Color TEMPLATE_BACKGROUND = new Color(16, 11, 43);
private static final Color CELL_ELEMENT_BORDER = new Color(110, 110, 110); private static final Color CELL_ELEMENT_BORDER = new Color(110, 110, 110);
private static final Color CELL_ELEMENT_FONT_FOREGROUND = Color.WHITE;
private static Color currentStoryBack = null; private static Color currentStoryBack = null;
@ -31,13 +32,24 @@ public class AdjustWorkBookDefaultStyleUtils {
public static void adjustCellElement(CellElement cellElement) { public static void adjustCellElement(CellElement cellElement) {
if (DesignModeContext.isDuchampMode()) { if (DesignModeContext.isDuchampMode()) {
Style style = cellElement.getStyle(); Style style = cellElement.getStyle();
style = style.deriveFRFont(style.getFRFont().applyForeground(Color.WHITE)); style = adjustCellElement(style);
cellElement.setStyle(style);
}
}
public static Style adjustCellElement(Style style) {
if (DesignModeContext.isDuchampMode()) {
style = style.deriveFRFont(style.getFRFont().applyForeground(CELL_ELEMENT_FONT_FOREGROUND));
style = style.deriveBorder(0, CELL_ELEMENT_BORDER, style = style.deriveBorder(0, CELL_ELEMENT_BORDER,
0, CELL_ELEMENT_BORDER, 0, CELL_ELEMENT_BORDER,
0, CELL_ELEMENT_BORDER, 0, CELL_ELEMENT_BORDER,
0, CELL_ELEMENT_BORDER); 0, CELL_ELEMENT_BORDER);
cellElement.setStyle(style);
} }
return style;
}
public static Color adjustCellElementFontForeground(Color color) {
return DesignModeContext.isDuchampMode() ? CELL_ELEMENT_FONT_FOREGROUND : color;
} }
public static void adjustFloatElement(FloatElement floatElement) { public static void adjustFloatElement(FloatElement floatElement) {

41
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.GraphHelper;
import com.fr.base.Icon; import com.fr.base.Icon;
import com.fr.base.IconManager; import com.fr.base.IconManager;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icontainer.UIScrollPane; 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.FileChooserProvider;
import com.fr.design.gui.ifilechooser.JavaFxNativeFileChooser;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.iscrollbar.UIScrollBar; import com.fr.design.gui.iscrollbar.UIScrollBar;
import com.fr.design.gui.itextarea.DescriptionTextArea; import com.fr.design.gui.itextarea.DescriptionTextArea;
@ -30,23 +30,35 @@ import com.fr.stable.ListMap;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.transaction.Configurations; import com.fr.transaction.Configurations;
import com.fr.transaction.WorkerFacade; 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 java.awt.Window;
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.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import javax.swing.filechooser.FileNameExtensionFilter;
import javax.swing.plaf.basic.BasicButtonUI; import javax.swing.plaf.basic.BasicButtonUI;
import java.awt.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.FocusEvent; import java.awt.event.FocusEvent;
import java.awt.event.FocusListener; import java.awt.event.FocusListener;
import java.awt.geom.Rectangle2D; import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
/** /**
* carl自定义Icon编辑 * carl自定义Icon编辑
@ -414,7 +426,7 @@ public class CustomIconPane extends BasicPane {
browseButton.addActionListener(new ActionListener() { browseButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
onBrowseButtonClicked(); onBrowseButtonClicked(SwingUtilities.getWindowAncestor(EditIconDialog.this));
} }
}); });
@ -449,12 +461,11 @@ public class CustomIconPane extends BasicPane {
this.add(centerPane, BorderLayout.CENTER); this.add(centerPane, BorderLayout.CENTER);
} }
private void onBrowseButtonClicked() { private void onBrowseButtonClicked(Window parent) {
// carl:不知道是否只要png格式,反正导出时全部都转成png了 // carl:不知道是否只要png格式,反正导出时全部都转成png了
FileChooserProvider fileChooserProvider = new JavaFxNativeFileChooser.Builder(). FileChooserProvider fileChooserProvider = FileChooserFactory.createFileChooser(FileChooserArgs.newBuilder().
filter("Icon Image File", "*.jpg", "*.jpeg", "*.png", "*.gif"). setFilter("Icon Image File", "*.jpg", "*.jpeg", "*.png", "*.gif").build());
build(); if (JFileChooser.APPROVE_OPTION == fileChooserProvider.showDialog(parent)) {
if (JFileChooser.APPROVE_OPTION == fileChooserProvider.showDialog(DesignerContext.getDesignerFrame())) {
String path = fileChooserProvider.getSelectedFile().getAbsolutePath(); String path = fileChooserProvider.getSelectedFile().getAbsolutePath();
// 图片存储有最大值48*48限制,没有超过最大值时,按原图大小存储,超过最大值后,压缩至最大值存储 // 图片存储有最大值48*48限制,没有超过最大值时,按原图大小存储,超过最大值后,压缩至最大值存储
Image image = BaseUtils.readImage(path); Image image = BaseUtils.readImage(path);

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

@ -9,9 +9,10 @@ import com.fr.design.fun.DesignerEnvProcessor;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.icontainer.UIScrollPane;
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.FileChooserProvider;
import com.fr.design.gui.ifilechooser.FileSelectionMode; 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.ilable.UILabel;
import com.fr.design.gui.ipasswordfield.UIPassWordField; import com.fr.design.gui.ipasswordfield.UIPassWordField;
import com.fr.design.gui.ipasswordfield.UIPasswordFieldWithFixedLength; import com.fr.design.gui.ipasswordfield.UIPasswordFieldWithFixedLength;
@ -564,7 +565,8 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
fileChooserButton.addActionListener(new ActionListener() { fileChooserButton.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent evt) { 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)); int saveValue = fileChooserProvider.showDialog(SwingUtilities.getWindowAncestor(RemoteEnvPane.this));
if (saveValue == JFileChooser.APPROVE_OPTION) { if (saveValue == JFileChooser.APPROVE_OPTION) {
File selectedFile = fileChooserProvider.getSelectedFile(); File selectedFile = fileChooserProvider.getSelectedFile();

13
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.data.tabledata.wrapper.TableDataWrapper;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icombobox.FilterComboBox; 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.FileChooserProvider;
import com.fr.design.gui.ifilechooser.JavaFxNativeFileChooser;
import com.fr.design.gui.ilable.BoldFontTextLabel; import com.fr.design.gui.ilable.BoldFontTextLabel;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
@ -19,8 +20,6 @@ import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralUtils; import com.fr.general.GeneralUtils;
import com.fr.general.data.DataModel; import com.fr.general.data.DataModel;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
import org.apache.batik.swing.svg.SVGFileFilter;
import javax.swing.JFileChooser; import javax.swing.JFileChooser;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -110,10 +109,12 @@ public class MapCustomPane extends BasicBeanPane<String> implements AbstrctMapAt
private ActionListener selectPictureActionListener = new ActionListener() { private ActionListener selectPictureActionListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
FileChooserProvider fileChooserProvider = new JavaFxNativeFileChooser.Builder(). FileChooserProvider fileChooserProvider = FileChooserFactory.createFileChooser(
filter(".svg, .svgz", "*.svg", "*.svgz"). FileChooserArgs.newBuilder().
currentDirectory(lastSelectPath).build(); setFilter(".svg, .svgz", "*.svg", "*.svgz").
setSelectedPath(lastSelectPath).build());
int returnVal = fileChooserProvider.showDialog(DesignerContext.getDesignerFrame()); int returnVal = fileChooserProvider.showDialog(DesignerContext.getDesignerFrame());
if (returnVal != JFileChooser.CANCEL_OPTION) { if (returnVal != JFileChooser.CANCEL_OPTION) {
File selectedFile = fileChooserProvider.getSelectedFile(); File selectedFile = fileChooserProvider.getSelectedFile();

11
designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartUIListControlPane.java

@ -25,6 +25,7 @@ import java.awt.BorderLayout;
import java.awt.Component; import java.awt.Component;
import java.awt.FlowLayout; import java.awt.FlowLayout;
import java.awt.Point; import java.awt.Point;
import java.awt.Window;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
@ -210,6 +211,16 @@ public abstract class VanChartUIListControlPane extends UIListControlPane implem
public void doCancel() { public void doCancel() {
setVisible(false); setVisible(false);
} }
@Override
public void setVisible(boolean b) {
super.setVisible(b);
//把一些可能没隐藏的子弹框隐藏 比如 边框-颜色弹框
for (Window window : getOwnedWindows()) {
window.setVisible(false);
}
}
} }
} }

12
designer-chart/src/main/java/com/fr/van/chart/gantt/designer/data/data/component/GanttTableDataContentPane.java

@ -93,13 +93,13 @@ public class GanttTableDataContentPane extends AbstractTableDataContentPane{
ganttDefinition.setEndTime(endTime == null ? StringUtils.EMPTY : String.valueOf(endTime)); ganttDefinition.setEndTime(endTime == null ? StringUtils.EMPTY : String.valueOf(endTime));
Object markTime = markerTimeComboBox.getSelectedItem(); Object markTime = markerTimeComboBox.getSelectedItem();
ganttDefinition.setMarkTime(isNoneObject(markTime) ? StringUtils.EMPTY : String.valueOf(markTime)); ganttDefinition.setMarkTime(isNoneObject(markTime) ? null : String.valueOf(markTime));
Object process = processComboBox.getSelectedItem(); Object process = processComboBox.getSelectedItem();
ganttDefinition.setProgress(isNoneObject(process) ? StringUtils.EMPTY : String.valueOf(process)); ganttDefinition.setProgress(isNoneObject(process) ? null : String.valueOf(process));
Object taskID = taskIDComboBox.getSelectedItem(); Object taskID = taskIDComboBox.getSelectedItem();
ganttDefinition.setLinkID(isNoneObject(taskID) ? StringUtils.EMPTY : String.valueOf(taskID)); ganttDefinition.setLinkID(isNoneObject(taskID) ? null : String.valueOf(taskID));
} }
private boolean isNoneObject(Object markTime) { private boolean isNoneObject(Object markTime) {
@ -117,9 +117,9 @@ public class GanttTableDataContentPane extends AbstractTableDataContentPane{
seriesComboBox.setSelectedItem(ganttDefinition.getSeriesName()); seriesComboBox.setSelectedItem(ganttDefinition.getSeriesName());
startTimeComboBox.setSelectedItem(ganttDefinition.getStartTime()); startTimeComboBox.setSelectedItem(ganttDefinition.getStartTime());
endTimeComboBox.setSelectedItem(ganttDefinition.getEndTime()); endTimeComboBox.setSelectedItem(ganttDefinition.getEndTime());
markerTimeComboBox.setSelectedItem(StringUtils.isEmpty(ganttDefinition.getMarkTime()) ? NONE : ganttDefinition.getMarkTime()); markerTimeComboBox.setSelectedItem(ganttDefinition.getMarkTime() == null ? NONE : ganttDefinition.getMarkTime());
processComboBox.setSelectedItem(StringUtils.isEmpty(ganttDefinition.getProgress()) ? NONE : ganttDefinition.getProgress()); processComboBox.setSelectedItem(ganttDefinition.getProgress() == null ? NONE : ganttDefinition.getProgress());
taskIDComboBox.setSelectedItem(StringUtils.isEmpty(ganttDefinition.getLinkID()) ? NONE : ganttDefinition.getLinkID()); taskIDComboBox.setSelectedItem(ganttDefinition.getLinkID() == null ? NONE : ganttDefinition.getLinkID());
} }
} }

28
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.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.dialog.FineJOptionPane; 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.FileChooserProvider;
import com.fr.design.gui.ifilechooser.FileSelectionMode; 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.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.share.ui.base.FailureMessagePane; 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.InstallUtils;
import com.fr.design.mainframe.share.util.ShareComponentUtils; import com.fr.design.mainframe.share.util.ShareComponentUtils;
import com.fr.design.mainframe.share.util.ShareUIUtils; 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.record.ShareWidgetInfoManager;
import com.fr.form.share.utils.ReuxUtils; import com.fr.form.share.utils.ReuxUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.sun.javafx.tk.FileChooserType;
import javafx.stage.FileChooser;
import javax.swing.Action; import javax.swing.Action;
import javax.swing.JFileChooser; import javax.swing.JFileChooser;
import javax.swing.SwingWorker; import javax.swing.SwingWorker;
import javax.swing.filechooser.FileNameExtensionFilter;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
@ -46,15 +43,16 @@ public class InstallComponentAction extends UpdateAction {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
FileChooserProvider fileChooserProvider = FileChooserProvider fileChooserProvider = FileChooserFactory.createFileChooser(
new JavaFxNativeFileChooser.Builder(). FileChooserArgs.newBuilder().
fileSelectionMode(FileSelectionMode.MULTIPLE_FILE). setFileSelectionMode(FileSelectionMode.MULTIPLE_FILE).
title(Toolkit.i18nText("Fine-Design_Basic_Select")). setMultiSelectionEnabled(true).
filters(new FileChooser.ExtensionFilter[]{ setTipText(Toolkit.i18nText("Fine-Design_Basic_Select")).
new FileChooser.ExtensionFilter("reu", "*.reu"), setFilters(new ExtensionFilter[] {
new FileChooser.ExtensionFilter("reus", "*.reus"), new ExtensionFilter("reu", "*.reu"),
new FileChooser.ExtensionFilter("zip", "*.zip")}). new ExtensionFilter("reus", "*.reus"),
build(); new ExtensionFilter("zip", "*.zip"),
}).build());
int returnValue = fileChooserProvider.showDialog(null); int returnValue = fileChooserProvider.showDialog(null);
installComponent(returnValue, fileChooserProvider.getSelectedFiles()); installComponent(returnValue, fileChooserProvider.getSelectedFiles());
} }

13
designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/OnlineWidgetBlock.java

@ -150,6 +150,14 @@ public class OnlineWidgetBlock extends AbstractOnlineWidgetBlock {
} }
} }
private String createLocalReuFilename() {
String filename = widget.getFileLoca();
if (StringUtils.isEmpty(filename) || !filename.endsWith(".reu")) {
filename = widget.getName() + "." + widget.getUuid() + ".reu";
}
return filename;
}
private void downLoadWidget() { private void downLoadWidget() {
if (OnlineWidgetRepoPane.getInstance().isShowPackagePanel()) { if (OnlineWidgetRepoPane.getInstance().isShowPackagePanel()) {
ComponentCollector.getInstance().collectDownloadPktNum(); ComponentCollector.getInstance().collectDownloadPktNum();
@ -170,7 +178,8 @@ public class OnlineWidgetBlock extends AbstractOnlineWidgetBlock {
protected Boolean doInBackground() { protected Boolean doInBackground() {
String filePath; String filePath;
try { try {
filePath = DownloadUtils.download(widget.getId(), widget.getName() + "." + widget.getUuid(), process); String filename = createLocalReuFilename();
filePath = DownloadUtils.download(widget.getId(), filename, process);
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
return false; return false;
@ -179,7 +188,7 @@ public class OnlineWidgetBlock extends AbstractOnlineWidgetBlock {
//安装 //安装
File file = new File(filePath); File file = new File(filePath);
try { try {
if (file.exists() && getDefaultGroup().installModule(file)) { if (file.exists() && getDefaultGroup().installUniqueIdModule(file)) {
ShareUtils.recordInstallTime(file.getName(), System.currentTimeMillis()); ShareUtils.recordInstallTime(file.getName(), System.currentTimeMillis());
ComponentCollector.getInstance().collectCmpDownLoad(widget.getUuid()); ComponentCollector.getInstance().collectCmpDownLoad(widget.getUuid());
} }

45
designer-form/src/main/java/com/fr/design/mainframe/share/util/DownloadUtils.java

@ -30,13 +30,16 @@ import java.nio.charset.StandardCharsets;
import java.security.KeyFactory; import java.security.KeyFactory;
import java.security.interfaces.RSAPublicKey; import java.security.interfaces.RSAPublicKey;
import java.security.spec.X509EncodedKeySpec; import java.security.spec.X509EncodedKeySpec;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
/** /**
* created by Harrison on 2020/05/27 * created by Harrison on 2020/05/27
**/ **/
public class DownloadUtils { public class DownloadUtils {
private static final String REUSES_URL = CloudCenter.getInstance().acquireUrlByKind("af.reuseInfo") + "file/download"; private static final String REUSES_URL = ShareComponentConstants.REU_INFO_PATH + "file/download";
private static final String PACKAGE_REUSES_URL = CloudCenter.getInstance().acquireUrlByKind("af.reuseInfo") + "package/download/"; private static final String PACKAGE_REUSES_URL = ShareComponentConstants.REU_INFO_PATH + "package/download/";
private static final String CERTIFICATE_PUBLIC_KEY = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCtsz62CPSWXZE/IYZRiAuTSZkw\n" + private static final String CERTIFICATE_PUBLIC_KEY = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCtsz62CPSWXZE/IYZRiAuTSZkw\n" +
"1WOwer8+JFktK0uKLAUuQoBr+UjAMFtRA8W7JgKMDwZy/2liEAiXEOSPU/hrdV8D\n" + "1WOwer8+JFktK0uKLAUuQoBr+UjAMFtRA8W7JgKMDwZy/2liEAiXEOSPU/hrdV8D\n" +
"tT541LnGi1X/hXiRwuttPWYN3L2GYm/d5blU+FBNwghBIrdAxXTzYBc6P4KL/oYX\n" + "tT541LnGi1X/hXiRwuttPWYN3L2GYm/d5blU+FBNwghBIrdAxXTzYBc6P4KL/oYX\n" +
@ -55,9 +58,9 @@ public class DownloadUtils {
@NotNull @NotNull
public static String download(String id, String fileName, com.fr.design.extra.Process<Double> process) throws Exception { public static String download(String id, String fileName, com.fr.design.extra.Process<Double> process) throws Exception {
CloseableHttpResponse fileRes = getHttpResponse(REUSES_URL, id); CloseableHttpResponse fileRes = postDownloadHttpResponse(REUSES_URL, id);
if (fileRes.getStatusLine().getStatusCode() == HttpStatus.SC_MOVED_TEMPORARILY) { if (fileRes.getStatusLine().getStatusCode() == HttpStatus.SC_MOVED_TEMPORARILY) {
fileRes = getHttpResponse(fileRes.getHeaders("Location")[0].getValue()); fileRes = getDownloadHttpResponse(fileRes.getHeaders("Location")[0].getValue());
} }
if (fileRes.getStatusLine().getStatusCode() == HttpStatus.SC_OK) { if (fileRes.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
String realPath = StableUtils.pathJoin(ProductConstants.getEnvHome(), ShareComponentConstants.PLUGIN_CACHE, ShareComponentConstants.DOWNLOAD_SHARE); String realPath = StableUtils.pathJoin(ProductConstants.getEnvHome(), ShareComponentConstants.PLUGIN_CACHE, ShareComponentConstants.DOWNLOAD_SHARE);
@ -67,7 +70,7 @@ public class DownloadUtils {
long totalSize = entity.getContentLength(); long totalSize = entity.getContentLength();
InputStream content = entity.getContent(); InputStream content = entity.getContent();
filePath = StableUtils.pathJoin(realPath, fileName + ".reu"); filePath = StableUtils.pathJoin(realPath, fileName);
StableUtils.makesureFileExist(new File(filePath)); StableUtils.makesureFileExist(new File(filePath));
FileOutputStream writer = new FileOutputStream(filePath); FileOutputStream writer = new FileOutputStream(filePath);
byte[] data = new byte[PluginConstants.BYTES_NUM]; byte[] data = new byte[PluginConstants.BYTES_NUM];
@ -93,9 +96,11 @@ public class DownloadUtils {
public static String downloadPackage(String id, String fileName, CancelCheck cancelCheck) throws Exception { public static String downloadPackage(String id, String fileName, CancelCheck cancelCheck) throws Exception {
CloseableHttpResponse fileRes = getHttpResponse(PACKAGE_REUSES_URL, id); Map<String, String> params = new HashMap<>();
params.put("designerVersion", ProductConstants.RELEASE_VERSION);
CloseableHttpResponse fileRes = postDownloadHttpResponse(PACKAGE_REUSES_URL, id, params);
if (fileRes.getStatusLine().getStatusCode() == HttpStatus.SC_MOVED_TEMPORARILY) { if (fileRes.getStatusLine().getStatusCode() == HttpStatus.SC_MOVED_TEMPORARILY) {
fileRes = getHttpResponse(fileRes.getHeaders("Location")[0].getValue()); fileRes = getDownloadHttpResponse(fileRes.getHeaders("Location")[0].getValue());
} }
String realPath = StableUtils.pathJoin(ProductConstants.getEnvHome(), ShareComponentConstants.PLUGIN_CACHE, ShareComponentConstants.DOWNLOAD_PACKAGE_SHARE); String realPath = StableUtils.pathJoin(ProductConstants.getEnvHome(), ShareComponentConstants.PLUGIN_CACHE, ShareComponentConstants.DOWNLOAD_PACKAGE_SHARE);
String filePath; String filePath;
@ -130,21 +135,33 @@ public class DownloadUtils {
} }
} }
private static CloseableHttpResponse getHttpResponse(String url, String id) throws Exception { private static CloseableHttpResponse postDownloadHttpResponse(String url, String id) throws Exception {
return postDownloadHttpResponse(url, id, new HashMap<>());
}
private static CloseableHttpResponse postDownloadHttpResponse(String url, String id, Map<String, String> params) throws Exception {
//先登录一下。不然可能失败 //先登录一下。不然可能失败
CloseableHttpClient client = createClient(); CloseableHttpClient client = createClient();
FineLoggerFactory.getLogger().info("login fr-market"); FineLoggerFactory.getLogger().info("login fr-market");
FineLoggerFactory.getLogger().info("start download widget {}", id); FineLoggerFactory.getLogger().info("start download widget {}", id);
HttpUriRequest file = RequestBuilder.post() RequestBuilder builder = RequestBuilder.post()
.setHeader("User-Agent", "Mozilla/5.0") .setHeader("User-Agent", "Mozilla/5.0")
.setUri(url).addParameter("id", encrypt(id)).addParameter("userId", .setUri(url)
String.valueOf(DesignerEnvManager.getEnvManager().getDesignerLoginUid())) .addParameter("id", encrypt(id))
.build(); .addParameter("userId", String.valueOf(DesignerEnvManager.getEnvManager().getDesignerLoginUid()));
return client.execute(file);
if (params != null) {
Set<String> keys = params.keySet();
for (String key: keys) {
builder.addParameter(key, params.get(key));
}
}
return client.execute(builder.build());
} }
private static CloseableHttpResponse getHttpResponse(String url) throws Exception { private static CloseableHttpResponse getDownloadHttpResponse(String url) throws Exception {
//先登录一下。不然可能失败 //先登录一下。不然可能失败
CloseableHttpClient client = createClient(); CloseableHttpClient client = createClient();
HttpUriRequest file = RequestBuilder.get() HttpUriRequest file = RequestBuilder.get()

2
designer-form/src/main/java/com/fr/design/mainframe/share/util/InstallUtils.java

@ -112,7 +112,7 @@ public class InstallUtils {
private static boolean installReuFile(Group group, File chosenFile, long installTime) { private static boolean installReuFile(Group group, File chosenFile, long installTime) {
try { try {
if (!group.installModule(chosenFile)) { if (!group.installUniqueIdModule(chosenFile)) {
return false; return false;
} }
ShareUtils.recordInstallTime(chosenFile.getName(), installTime); ShareUtils.recordInstallTime(chosenFile.getName(), installTime);

5
designer-realize/src/main/java/com/fr/design/actions/utils/ReportActionUtils.java

@ -4,6 +4,7 @@ import com.fr.base.Style;
import com.fr.design.actions.cell.style.StyleActionInterface; import com.fr.design.actions.cell.style.StyleActionInterface;
import com.fr.design.mainframe.DesignOperationEvent; import com.fr.design.mainframe.DesignOperationEvent;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.utils.gui.AdjustWorkBookDefaultStyleUtils;
import com.fr.event.EventDispatcher; import com.fr.event.EventDispatcher;
import com.fr.grid.selection.CellSelection; import com.fr.grid.selection.CellSelection;
import com.fr.grid.selection.FloatSelection; import com.fr.grid.selection.FloatSelection;
@ -15,7 +16,7 @@ import com.fr.report.cell.TemplateCellElement;
import com.fr.report.elementcase.ElementCase; import com.fr.report.elementcase.ElementCase;
import com.fr.report.elementcase.TemplateElementCase; import com.fr.report.elementcase.TemplateElementCase;
import java.awt.*; import java.awt.Rectangle;
public class ReportActionUtils { public class ReportActionUtils {
private ReportActionUtils() { private ReportActionUtils() {
@ -113,7 +114,7 @@ public class ReportActionUtils {
CellElement editCellElement = report.getCellElement(((CellSelection) sel).getColumn(), ((CellSelection) sel).getRow()); CellElement editCellElement = report.getCellElement(((CellSelection) sel).getColumn(), ((CellSelection) sel).getRow());
if (editCellElement == null) { if (editCellElement == null) {
return Style.DEFAULT_STYLE; return AdjustWorkBookDefaultStyleUtils.adjustCellElement(Style.DEFAULT_STYLE);
} }
//peter:直接返回当前编辑元素的Style //peter:直接返回当前编辑元素的Style

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

@ -6,6 +6,7 @@ import com.fr.design.designer.TargetComponent;
import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.gui.frpane.HyperlinkGroupPane; import com.fr.design.gui.frpane.HyperlinkGroupPane;
import com.fr.design.gui.frpane.HyperlinkGroupPaneActionProvider; import com.fr.design.gui.frpane.HyperlinkGroupPaneActionProvider;
import com.fr.design.utils.gui.AdjustWorkBookDefaultStyleUtils;
import com.fr.general.FRFont; import com.fr.general.FRFont;
import com.fr.grid.selection.CellSelection; import com.fr.grid.selection.CellSelection;
import com.fr.grid.selection.FloatSelection; import com.fr.grid.selection.FloatSelection;
@ -82,7 +83,7 @@ public class HyperlinkGroupPaneActionImpl implements HyperlinkGroupPaneActionPro
frFont = frFont.applyForeground(Color.blue); frFont = frFont.applyForeground(Color.blue);
frFont = frFont.applyUnderline(Constants.LINE_THIN); frFont = frFont.applyUnderline(Constants.LINE_THIN);
} else { } else {
frFont = frFont.applyForeground(Color.black); frFont = frFont.applyForeground(AdjustWorkBookDefaultStyleUtils.adjustCellElementFontForeground(Color.black));
frFont = frFont.applyUnderline(Constants.LINE_NONE); frFont = frFont.applyUnderline(Constants.LINE_NONE);
} }
editCellElement.setStyle(elementStyle.deriveFRFont(frFont)); editCellElement.setStyle(elementStyle.deriveFRFont(frFont));

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

@ -2,6 +2,7 @@ package com.fr.design.mainframe.cell.settingpane;
import com.fr.design.mainframe.AbstractAttrPane; import com.fr.design.mainframe.AbstractAttrPane;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.utils.gui.AdjustWorkBookDefaultStyleUtils;
import com.fr.grid.selection.CellSelection; import com.fr.grid.selection.CellSelection;
import com.fr.grid.selection.FloatSelection; import com.fr.grid.selection.FloatSelection;
import com.fr.report.cell.DefaultTemplateCellElement; import com.fr.report.cell.DefaultTemplateCellElement;
@ -53,6 +54,7 @@ public abstract class AbstractCellAttrPane extends AbstractAttrPane {
TemplateCellElement cellElement = elementCase.getTemplateCellElement(cs.getColumn(), cs.getRow()); TemplateCellElement cellElement = elementCase.getTemplateCellElement(cs.getColumn(), cs.getRow());
if (cellElement == null) { if (cellElement == null) {
cellElement = new DefaultTemplateCellElement(cs.getColumn(), cs.getRow()); cellElement = new DefaultTemplateCellElement(cs.getColumn(), cs.getRow());
AdjustWorkBookDefaultStyleUtils.adjustCellElement(cellElement);
} }
this.cellElement = cellElement; this.cellElement = cellElement;
elementCase.addCellElement(this.cellElement); elementCase.addCellElement(this.cellElement);

12
designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellStylePane.java

@ -5,16 +5,18 @@ import com.fr.design.actions.utils.ReportActionUtils;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.mainframe.cell.settingpane.style.StylePane; import com.fr.design.mainframe.cell.settingpane.style.StylePane;
import com.fr.design.style.BorderUtils; import com.fr.design.style.BorderUtils;
import com.fr.design.utils.gui.AdjustWorkBookDefaultStyleUtils;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.report.cell.DefaultTemplateCellElement; import com.fr.report.cell.DefaultTemplateCellElement;
import com.fr.report.cell.TemplateCellElement; import com.fr.report.cell.TemplateCellElement;
import com.fr.report.elementcase.TemplateElementCase; import com.fr.report.elementcase.TemplateElementCase;
import javax.swing.*; import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import java.awt.*; import java.awt.BorderLayout;
import java.awt.Rectangle;
/** /**
* @author zhou * @author zhou
@ -101,12 +103,12 @@ public class CellStylePane extends AbstractCellAttrPane {
TemplateCellElement cellElement = elementCase.getTemplateCellElement(column, row); TemplateCellElement cellElement = elementCase.getTemplateCellElement(column, row);
if (cellElement == null) { if (cellElement == null) {
cellElement = new DefaultTemplateCellElement(column, row); cellElement = new DefaultTemplateCellElement(column, row);
AdjustWorkBookDefaultStyleUtils.adjustCellElement(cellElement);
elementCase.addCellElement(cellElement); elementCase.addCellElement(cellElement);
} }
Style style = cellElement.getStyle(); Style style = cellElement.getStyle();
if (style == null) { if (style == null) {
style = Style.DEFAULT_STYLE; style = AdjustWorkBookDefaultStyleUtils.adjustCellElement(Style.DEFAULT_STYLE);
} }
style = stylePane.updateStyle(style); style = stylePane.updateStyle(style);
cellElement.setStyle(style); cellElement.setStyle(style);

4
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.base.process.ProcessOperator;
import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.chartattr.ChartCollection;
import com.fr.config.MarketConfig; import com.fr.config.MarketConfig;
import com.fr.config.ServerPreferenceConfig;
import com.fr.decision.update.backup.RecoverManager; import com.fr.decision.update.backup.RecoverManager;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
@ -177,6 +178,9 @@ public class DesignerActivator extends Activator implements Prepare {
//生成BasicChartQuickEditor对象,需要用到ChartDesignerActivator的注册信息(DesignModuleFactory.registerChartPropertyPaneClass(ChartPropertyPane.class);) //生成BasicChartQuickEditor对象,需要用到ChartDesignerActivator的注册信息(DesignModuleFactory.registerChartPropertyPaneClass(ChartPropertyPane.class);)
//所以不能在registerCellEditor函数中进行注册 //所以不能在registerCellEditor函数中进行注册
ActionFactory.registerCellEditor(ChartCollection.class, new BasicChartQuickEditor()); ActionFactory.registerCellEditor(ChartCollection.class, new BasicChartQuickEditor());
if (DesignerEnvManager.getEnvManager().isUseOptimizedUPM4Adapter() && WorkContext.getCurrent().isLocal()) {
ServerPreferenceConfig.getInstance().setUseOptimizedUPM(DesignerEnvManager.getEnvManager().isUseOptimizedUPM4Adapter());
}
} }
private void loadLogAppender() { private void loadLogAppender() {

Loading…
Cancel
Save