Browse Source

REPORT-55072 设计器内文件选择器替换为原生的

feature/10.0
Henry.Wang 3 years ago
parent
commit
623edcaf91
  1. 2
      designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java
  2. 16
      designer-base/src/main/java/com/fr/design/web/CustomIconPane.java

2
designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java

@ -262,7 +262,7 @@ public class PreferencePane extends BasicPane {
embedServerPanel.add(embedServerLazyStartupCheckBox);
advancePane.add(embedServerPanel);
JPanel imageCompressPanel = FRGUIPaneFactory.createVerticalTitledBorderPane(i18nText("Fine-Design_Template_Preview_Performance="));
JPanel imageCompressPanel = FRGUIPaneFactory.createVerticalTitledBorderPane(i18nText("Fine-Design_Template_Preview_Performance"));
imageCompressPanelCheckBox = new UICheckBox(i18nText("Fine-Design_Image_Compress"));
imageCompressPanel.add(imageCompressPanelCheckBox);
advancePane.add(imageCompressPanel);

16
designer-base/src/main/java/com/fr/design/web/CustomIconPane.java

@ -10,6 +10,8 @@ import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ifilechooser.FileChooserProvider;
import com.fr.design.gui.ifilechooser.JavaFxNativeFileChooser;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.iscrollbar.UIScrollBar;
import com.fr.design.gui.itextarea.DescriptionTextArea;
@ -28,6 +30,7 @@ import com.fr.stable.ListMap;
import com.fr.stable.StringUtils;
import com.fr.transaction.Configurations;
import com.fr.transaction.WorkerFacade;
import javafx.stage.FileChooser;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
@ -108,7 +111,7 @@ public class CustomIconPane extends BasicPane {
}
protected String createDescriptionText(){
protected String createDescriptionText() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Custom_Icon_Message1");
}
@ -447,13 +450,12 @@ public class CustomIconPane extends BasicPane {
}
private void onBrowseButtonClicked() {
JFileChooser jf = new JFileChooser();
// carl:不知道是否只要png格式,反正导出时全部都转成png了
FileNameExtensionFilter fileFilter = new FileNameExtensionFilter("Icon Image File", "jpg", "jpeg", "png", "gif");
jf.setFileFilter(fileFilter);
if (JFileChooser.APPROVE_OPTION == jf.showOpenDialog(DesignerContext.getDesignerFrame())) {
String path = jf.getSelectedFile().getAbsolutePath();
FileChooserProvider fileChooserProvider = new JavaFxNativeFileChooser.Builder().
filter("Icon Image File", "*.jpg", "*.jpeg", "*.png", "*.gif").
build();
if (JFileChooser.APPROVE_OPTION == fileChooserProvider.showDialog(DesignerContext.getDesignerFrame())) {
String path = fileChooserProvider.getSelectedFile().getAbsolutePath();
// 图片存储有最大值48*48限制,没有超过最大值时,按原图大小存储,超过最大值后,压缩至最大值存储
Image image = BaseUtils.readImage(path);
iconImage = ImageUtils.scale((BufferedImage) image, Math.min(image.getWidth(null), IconManager.MAXSTORAGE_ICONWIDTH), Math.min(image.getHeight(null), IconManager.MAXSTORAGE_ICONHEIGHT), true, Image.SCALE_SMOOTH);

Loading…
Cancel
Save