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 1f39f024d2..b57ad6c7af 100644
--- a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java
+++ b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java
@@ -23,6 +23,7 @@ import com.fr.design.mainframe.ComponentReuseNotifyUtil;
import com.fr.design.mainframe.reuse.ComponentReuseNotificationInfo;
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;
@@ -211,6 +212,8 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
private int layoutTemplateStyle = LAYOUT_TEMPLATE_SIMPLE_STYLE;
+ private boolean useOptimizedUPM4Adapter;
+
/**
* DesignerEnvManager.
*/
@@ -665,6 +668,14 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
this.showTemplateMissingPlugin = showTemplateMissingPlugin;
}
+ public boolean isUseOptimizedUPM4Adapter() {
+ return useOptimizedUPM4Adapter;
+ }
+
+ public void setUseOptimizedUPM4Adapter(boolean useOptimizedUPM4Adapter) {
+ this.useOptimizedUPM4Adapter = useOptimizedUPM4Adapter;
+ }
+
/**
* 知否自动备份
*
@@ -1888,6 +1899,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()));
this.setShowServerDatasetAuthTip(reader.getAttrAsBoolean("showServerDatasetAuthTip", true));
this.setLayoutTemplateStyle(reader.getAttrAsInt("layoutTemplateStyle", LAYOUT_TEMPLATE_SIMPLE_STYLE));
}
@@ -2165,6 +2177,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
}
writer.attr("layoutTemplateStyle", this.getLayoutTemplateStyle());
writer.attr("showServerDatasetAuthTip", this.isShowServerDatasetAuthTip());
+ 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 c0797e9462..80f217a31a 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
@@ -16,9 +16,10 @@ import com.fr.design.gui.ibutton.UINoThemeColorButton;
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;
@@ -513,9 +514,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();
@@ -728,7 +728,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());
}
if (useNewVersionLoginCheckbox != null) {
@@ -808,6 +809,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/cell/CellStylePreviewPane.java b/designer-base/src/main/java/com/fr/design/cell/CellStylePreviewPane.java
index 899c04cb17..b4b382af5b 100644
--- a/designer-base/src/main/java/com/fr/design/cell/CellStylePreviewPane.java
+++ b/designer-base/src/main/java/com/fr/design/cell/CellStylePreviewPane.java
@@ -7,6 +7,7 @@ import com.fr.base.ScreenResolution;
import com.fr.base.Style;
import com.fr.general.FRFont;
import com.fr.general.IOUtils;
+import com.fr.stable.Constants;
import com.fr.stable.unit.PT;
import javax.swing.JPanel;
@@ -153,16 +154,16 @@ public class CellStylePreviewPane extends JPanel {
float adjustRight = 0;
float adjustBottom = 0;
if (column == 0) {
- adjustLeft = GraphHelper.getLineStyleSize(style.getBorderLeft()) / 2.0F;
+ adjustLeft = GraphHelper.getLineStyleSize(style.getBorderLeft()) / 2.0F + computeOffset4DoubleStyleBorder(style);
}
if (row == 0) {
- adjustTop = GraphHelper.getLineStyleSize(style.getBorderTop()) / 2.0F;
+ adjustTop = GraphHelper.getLineStyleSize(style.getBorderTop()) / 2.0F + computeOffset4DoubleStyleBorder(style);
}
if (column == columnSpan - 1) {
- adjustRight = -GraphHelper.getLineStyleSize(style.getBorderRight()) / 2.0F;
+ adjustRight = -GraphHelper.getLineStyleSize(style.getBorderRight()) / 2.0F - computeOffset4DoubleStyleBorder(style);
}
if (row == rowSpan - 1) {
- adjustBottom = -GraphHelper.getLineStyleSize(style.getBorderBottom()) / 2.0F;
+ adjustBottom = -GraphHelper.getLineStyleSize(style.getBorderBottom()) / 2.0F - computeOffset4DoubleStyleBorder(style);
}
g2d.translate(adjustLeft, adjustTop);
@@ -170,6 +171,17 @@ public class CellStylePreviewPane extends JPanel {
g2d.translate(-adjustLeft, -adjustTop);
}
+ private float computeOffset4DoubleStyleBorder(Style style) {
+ float offset = 0F;
+ if (style.getBorderLeft() == Constants.LINE_DOUBLE) {
+ offset += GraphHelper.getLineStyleSize(Constants.LINE_THIN) / 2.0F;
+ } else if (style.getBorderLeft() == Constants.LINE_DOUBLE_DOT) {
+ offset += GraphHelper.getLineStyleSize(Constants.LINE_DOT) / 2.0F;
+ }
+
+ return offset;
+ }
+
@Override
public Dimension getPreferredSize() {
Dimension size = super.getPreferredSize();
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 74bf3fe76f..904cdf00b0 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
@@ -867,8 +867,12 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
if (checkResult.isValid()) {
showMessageDialog(checkResult.getTips(), checkResult.isValid());
} else {
- String position = Toolkit.i18nText("Fine-Design_Basic_Formula_The") + (checkResult.getFormulaCoordinates().getColumns())
- + Toolkit.i18nText("Fine-Design_Basic_Formula_Error_Position") + " ";
+ int columns = checkResult.getFormulaCoordinates().getColumns();
+ String position = StringUtils.EMPTY;
+ if (columns >= 0) {
+ position = Toolkit.i18nText("Fine-Design_Basic_Formula_The") + columns
+ + Toolkit.i18nText("Fine-Design_Basic_Formula_Error_Position") + " ";
+ }
int confirmDialog = FineJOptionPane.showConfirmDialog(
FormulaPane.this,
position + messageTips,
@@ -879,7 +883,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
new String[]{Toolkit.i18nText("Fine-Design_Basic_Formula_Check_Result"), Toolkit.i18nText("Fine-Design_Basic_Formula_Continue")},
Toolkit.i18nText("Fine-Design_Basic_Formula_Check_Result"));
if (confirmDialog == 0) {
- formulaTextArea.setCaretPosition(checkResult.getFormulaCoordinates().getColumns());
+ formulaTextArea.setCaretPosition(Math.max(columns, 0));
formulaTextArea.requestFocus();
return false;
}
diff --git a/designer-base/src/main/java/com/fr/design/formula/exception/function/FormulaCheckWrongFunction.java b/designer-base/src/main/java/com/fr/design/formula/exception/function/FormulaCheckWrongFunction.java
index 5328ca56ef..417e9b37a6 100644
--- a/designer-base/src/main/java/com/fr/design/formula/exception/function/FormulaCheckWrongFunction.java
+++ b/designer-base/src/main/java/com/fr/design/formula/exception/function/FormulaCheckWrongFunction.java
@@ -74,7 +74,7 @@ public class FormulaCheckWrongFunction implements Function
+ * 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 990e73ee9c..16944da068 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 e8871154e6..5751c3ecb9 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 @@ -8,13 +8,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 @@ -143,6 +148,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