Browse Source

Merge branch 'feature/10.0' of ssh://code.fineres.com:7999/~fanglei/design10.0 into feature/10.0

* 'feature/10.0' of ssh://code.fineres.com:7999/~fanglei/design10.0:
  REPORT-55072 设计器内文件选择器替换为原生的
  REPORT-55072 设计器内文件选择器替换为原生的
  REPORT-55072 设计器内文件选择器替换为原生的
  CHART-20134 图表接口判断增加对新接口的判断
  KERNEL-8304  连接池逻辑重构
  KERNEL-8608 解决控件组件在创建组件过程中丢失配置的问题
  REPORT-56010 【组件背景分离】组件复用-组件不显示 标题,设置边框后设计期内边框不显示
  REPORT-55850 【组件背景分离】组件复用-Tab组件背景和边框预览不生效
  设计器外双击模板打开,设计器内会额外打开一个空白的cpt
  REPORT-55839 组件复用-禁用tab块的自定义图片边框入口,预期是只面向图表块与报表块
  REPORT-55757 【组件背景分离】组件复用-标题图案预览图,悬浮时出现的遮罩和删除图标,鼠标如果从左边/上边滑出,则删除图标消失;但从右边/下边滑出,删除图标还在
  REPORT-55757 【组件背景分离】组件复用-标题图案预览图,悬浮时出现的遮罩和删除图标,鼠标如果从左边/上边滑出,则删除图标消失;但从右边/下边滑出,删除图标还在
  REPORT-55757 【组件背景分离】组件复用-标题图案预览图,悬浮时出现的遮罩和删除图标,鼠标如果从左边/上边滑出,则删除图标消失;但从右边/下边滑出,删除图标还在
  REPORT-55091 只有一个非超管用户的目录文件无法另存或新建
feature/10.0
方磊 3 years ago
parent
commit
ab3a2b7f77
  1. 12
      designer-base/src/main/java/com/fr/design/DesignerEnvManager.java
  2. 23
      designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java
  3. 1
      designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java
  4. 11
      designer-base/src/main/java/com/fr/design/gui/chart/ChartXMLTag.java
  5. 103
      designer-base/src/main/java/com/fr/design/gui/ifilechooser/AbstractFileChooser.java
  6. 12
      designer-base/src/main/java/com/fr/design/gui/ifilechooser/FileChooserProvider.java
  7. 5
      designer-base/src/main/java/com/fr/design/gui/ifilechooser/FileSelectionMode.java
  8. 158
      designer-base/src/main/java/com/fr/design/gui/ifilechooser/JavaFxNativeFileChooser.java
  9. 154
      designer-base/src/main/java/com/fr/design/gui/ifilechooser/UINativeFileChooser.java
  10. 279
      designer-base/src/main/java/com/fr/design/style/background/image/ImageFileChooser.java
  11. 19
      designer-base/src/main/java/com/fr/design/upm/UpmBridge.java
  12. 7
      designer-base/src/main/java/com/fr/design/utils/DesignUtils.java
  13. 14
      designer-base/src/main/java/com/fr/design/web/CustomIconPane.java
  14. 23
      designer-base/src/main/java/com/fr/env/RemoteEnvPane.java
  15. 3
      designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java
  16. 3
      designer-chart/src/main/java/com/fr/design/chart/fun/ChartTypeUIProvider.java
  17. 14
      designer-chart/src/main/java/com/fr/design/chart/series/PlotSeries/MapCustomPane.java
  18. 4
      designer-form/src/main/java/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java
  19. 7
      designer-form/src/main/java/com/fr/design/designer/creator/XWTitleLayout.java
  20. 5
      designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java
  21. 39
      designer-form/src/main/java/com/fr/design/gui/xpane/BorderLineAndImagePane.java
  22. 15
      designer-form/src/main/java/com/fr/design/gui/xpane/CardTagLayoutStylePane.java
  23. 15
      designer-form/src/main/java/com/fr/design/gui/xpane/LayoutStylePane.java
  24. 49
      designer-form/src/main/java/com/fr/design/gui/xpane/TitleInsetImagePane.java
  25. 8
      designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java
  26. 33
      designer-form/src/main/java/com/fr/design/mainframe/share/action/InstallComponentAction.java
  27. 10
      designer-form/src/main/java/com/fr/design/mainframe/share/generate/task/ComponentCreator.java
  28. 2
      designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/WTitleLayoutDefinePane.java

12
designer-base/src/main/java/com/fr/design/DesignerEnvManager.java

@ -192,6 +192,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
private static List<SwingWorker> mapWorkerList = new ArrayList<SwingWorker>();
private boolean imageCompress = false;//图片压缩
private boolean showImageCompressMoveTip = true;
// 开启内嵌web页面的调试窗口
private boolean openDebug = false;
@ -1637,6 +1638,15 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
this.imageCompress = imageCompress;
}
public boolean isShowImageCompressMoveTip() {
return showImageCompressMoveTip;
}
public void setShowImageCompressMoveTip(boolean showImageCompressMoveTip) {
this.showImageCompressMoveTip = showImageCompressMoveTip;
}
public boolean isOpenDebug() {
return openDebug;
}
@ -1792,6 +1802,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
this.setCachingTemplateLimit(reader.getAttrAsInt("cachingTemplateLimit", CACHINGTEMPLATE_LIMIT));
this.setJoinProductImprove(reader.getAttrAsBoolean("joinProductImprove", true));
this.setImageCompress(reader.getAttrAsBoolean("imageCompress", true));
this.setShowImageCompressMoveTip(reader.getAttrAsBoolean("showImageCompressMoveTip", true));
this.setAutoBackUp(reader.getAttrAsBoolean("autoBackUp", true));
this.setTemplateTreePaneExpanded(reader.getAttrAsBoolean("templateTreePaneExpanded", false));
// peter:读取webinfLocation
@ -2072,6 +2083,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
if (!this.isImageCompress()) {
writer.attr("imageCompress", this.isImageCompress());
}
writer.attr("showImageCompressMoveTip", this.isShowImageCompressMoveTip());
if (!this.isAutoBackUp()) {
writer.attr("autoBackUp", this.isAutoBackUp());
}

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

@ -15,6 +15,9 @@ import com.fr.design.gui.ibutton.UIColorButton;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.icombobox.UIDictionaryComboBox;
import com.fr.design.gui.ifilechooser.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;
@ -47,6 +50,8 @@ import com.fr.transaction.Worker;
import com.fr.workspace.WorkContext;
import com.fr.workspace.server.vcs.VcsOperator;
import com.fr.workspace.server.vcs.git.config.GcConfig;
import com.sun.javafx.tk.FileChooserType;
import javafx.stage.FileChooser;
import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
@ -165,6 +170,7 @@ public class PreferencePane extends BasicPane {
private UICheckBox joinProductImproveCheckBox;
private UICheckBox autoPushUpdateCheckBox;
private UICheckBox embedServerLazyStartupCheckBox;
private UICheckBox imageCompressPanelCheckBox;
private UICheckBox vcsEnableCheckBox;
private UICheckBox saveCommitCheckBox;
@ -256,6 +262,10 @@ public class PreferencePane extends BasicPane {
embedServerPanel.add(embedServerLazyStartupCheckBox);
advancePane.add(embedServerPanel);
JPanel imageCompressPanel = FRGUIPaneFactory.createVerticalTitledBorderPane(i18nText("Fine-Design_Template_Preview_Performance"));
imageCompressPanelCheckBox = new UICheckBox(i18nText("Fine-Design_Image_Compress"));
imageCompressPanel.add(imageCompressPanelCheckBox);
advancePane.add(imageCompressPanel);
}
private void createVcsSettingPane(JPanel generalPane) {
@ -489,11 +499,13 @@ public class PreferencePane extends BasicPane {
chooseDirBtn.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
JFileChooser fileChooser = new JFileChooser();
fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
int saveValue = fileChooser.showOpenDialog(DesignerContext.getDesignerFrame());
FileChooserProvider fileChooserProvider =
new JavaFxNativeFileChooser.Builder().
fileSelectionMode(FileSelectionMode.DIR).
build();
int saveValue = fileChooserProvider.showDialog(null);
if (saveValue == JFileChooser.APPROVE_OPTION) {
File selectedFile = fileChooser.getSelectedFile();
File selectedFile = fileChooserProvider.getSelectedFile();
logExportDirectoryField.setText(selectedFile.getAbsolutePath());
}
}
@ -717,6 +729,8 @@ public class PreferencePane extends BasicPane {
}
this.embedServerLazyStartupCheckBox.setSelected(designerEnvManager.isEmbedServerLazyStartup());
this.imageCompressPanelCheckBox.setSelected(designerEnvManager.isImageCompress());
}
private int chooseCase(int sign) {
@ -775,6 +789,7 @@ public class PreferencePane extends BasicPane {
designerEnvManager.setCachingTemplateLimit((int) this.cachingTemplateSpinner.getValue());
designerEnvManager.setJoinProductImprove(this.joinProductImproveCheckBox.isSelected());
designerEnvManager.setEmbedServerLazyStartup(this.embedServerLazyStartupCheckBox.isSelected());
designerEnvManager.setImageCompress(this.imageCompressPanelCheckBox.isSelected());
VcsConfigManager vcsConfigManager = designerEnvManager.getVcsConfigManager();
vcsConfigManager.setSaveInterval(this.saveIntervalEditor.getValue());
vcsConfigManager.setVcsEnable(this.vcsEnableCheckBox.isSelected());

1
designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java

@ -255,6 +255,7 @@ public class JDBCDefPane extends JPanel {
this.dbtypeComboBox.setSelectedItem(OTHER_DB);
}
}
this.jdbcDatabase.setIdentity(jdbcDatabase.getIdentity());
this.driverComboBox.setSelectedItem(jdbcDatabase.getDriver());
this.urlTextField.setText(jdbcDatabase.getURL());
this.userNameTextField.setText(jdbcDatabase.getUser());

11
designer-base/src/main/java/com/fr/design/gui/chart/ChartXMLTag.java

@ -0,0 +1,11 @@
package com.fr.design.gui.chart;
/**
* @author Bjorn
* @version 10.0
* Created by Bjorn on 2021-08-02
*/
public class ChartXMLTag {
public static final String CHART_TYPE_UI_PROVIDER = "ChartTypeUIProvider";
}

103
designer-base/src/main/java/com/fr/design/gui/ifilechooser/AbstractFileChooser.java

@ -1,103 +0,0 @@
package com.fr.design.gui.ifilechooser;
import javax.swing.filechooser.FileFilter;
import java.awt.*;
import java.io.File;
/**
* @author hades
* @version 10.0
* Created by hades on 2020/3/31
*/
public abstract class AbstractFileChooser {
/**
* 返回当前目录
*
*/
public abstract File getCurrentDirectory();
/**
* 返回当前的文件选择过滤器
*
*/
public abstract FileFilter getFileFilter();
/**
* 返回选择的文件
*
*/
public abstract File getSelectedFile();
/**
* 多文件选择模式下 返回选择的多个文件
*
*/
public abstract File[] getSelectedFiles();
/**
* 是否可以选择多个文件
*
*/
public abstract boolean isMultiSelectionEnabled();
/**
* 设置当前选择的目录
*
*/
public abstract void setCurrentDirectory(File dir);
/**
* 设置左上角标题
*
*/
public abstract void setDialogTitle(String title);
/**
* 设置当前的文件过滤器
*
*/
public abstract void setFileFilter(final FileFilter filter);
/**
* 设置文件选择器模式
*
* JFileChooser.FILES_ONLY
* JFileChooser.DIRECTORIES_ONLY
* JFileChooser.FILES_AND_DIRECTORIES
*/
public abstract void setFileSelectionMode(int selectionMode);
/**
* 设置是否允许选择多个文件
*
*/
public abstract void setMultiSelectionEnabled(boolean multiple);
/**
* 设置选择的文件 用于showSaveDialog
*
*/
public abstract void setSelectedFile(File file);
/**
* 弹出文件选择器 打开文件
*
*/
public abstract int showOpenDialog(Component parent);
/**
* 弹出文件选择器 保存文件
*
*/
public abstract int showSaveDialog(Component parent);
/**
* https://bugs.java.com/bugdatabase/view_bug.do?bug_id=4031440
*
* 设置文件名后缀 起到文件过滤的作用 形如 "*.jpg;*.jpeg"
*
*/
public abstract void setExtensionFilter(String file);
}

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

@ -0,0 +1,12 @@
package com.fr.design.gui.ifilechooser;
import java.awt.*;
import java.io.File;
public interface FileChooserProvider {
File[] getSelectedFiles();
File getSelectedFile();
int showDialog(Component parent);
}

5
designer-base/src/main/java/com/fr/design/gui/ifilechooser/FileSelectionMode.java

@ -0,0 +1,5 @@
package com.fr.design.gui.ifilechooser;
public enum FileSelectionMode {
FILE, MULTIPLE_FILE, DIR
}

158
designer-base/src/main/java/com/fr/design/gui/ifilechooser/JavaFxNativeFileChooser.java

@ -0,0 +1,158 @@
package com.fr.design.gui.ifilechooser;
import com.fr.design.i18n.Toolkit;
import com.fr.design.upm.UpmUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
import com.sun.javafx.application.PlatformImpl;
import javafx.stage.DirectoryChooser;
import javafx.stage.FileChooser;
import javafx.stage.Window;
import javax.swing.*;
import javax.swing.filechooser.FileNameExtensionFilter;
import java.awt.*;
import java.io.File;
import java.util.List;
import java.util.concurrent.CountDownLatch;
public class JavaFxNativeFileChooser implements FileChooserProvider {
private File[] selectedFiles = new File[0];
private FileSelectionMode fileSelectionMode = FileSelectionMode.FILE;
private String title = Toolkit.i18nText("Fine-Design_Basic_Open");
private FileChooser.ExtensionFilter[] filters;
private File currentDirectory;
@Override
public File[] getSelectedFiles() {
return selectedFiles;
}
@Override
public File getSelectedFile() {
if (selectedFiles.length > 0) {
return selectedFiles[0];
}
return null;
}
@Override
public int showDialog(Component parent) {
final CountDownLatch latch = new CountDownLatch(1);
PlatformImpl.startup(new Runnable() {
@Override
public void run() {
try {
if (fileSelectionMode == FileSelectionMode.FILE || fileSelectionMode == FileSelectionMode.MULTIPLE_FILE) {
FileChooser fileChooser = new FileChooser();
fileChooser.setTitle(title);
fileChooser.getExtensionFilters().addAll(filters);
fileChooser.setInitialDirectory(currentDirectory);
if (fileSelectionMode == FileSelectionMode.FILE) {
File file = fileChooser.showOpenDialog(null);
if (file != null) {
selectedFiles = new File[]{file};
}
} else if (fileSelectionMode == FileSelectionMode.MULTIPLE_FILE) {
List<File> fileList = fileChooser.showOpenMultipleDialog(null);
if (fileList != null) {
selectedFiles = new File[fileList.size()];
fileList.toArray(selectedFiles);
}
}
} else if (fileSelectionMode == FileSelectionMode.DIR) {
DirectoryChooser directoryChooser = new DirectoryChooser();
directoryChooser.setTitle(title);
directoryChooser.setInitialDirectory(currentDirectory);
File folder = directoryChooser.showDialog(null);
if (folder != null) {
selectedFiles = new File[]{folder};
}
System.out.println(folder);
}
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e, e.getMessage());
} finally {
latch.countDown();
}
}
});
try {
latch.await();
} catch (InterruptedException ignore) {
}
return selectedFiles.length > 0 ? JFileChooser.APPROVE_OPTION : JFileChooser.CANCEL_OPTION;
}
public void setSelectionMode(FileSelectionMode fileSelectionMode) {
this.fileSelectionMode = fileSelectionMode;
}
public void setCurrentDirectory(File currentDirectory) {
this.currentDirectory = currentDirectory;
}
public static class Builder {
private FileSelectionMode fileSelectionMode = FileSelectionMode.FILE;
private String title = Toolkit.i18nText("Fine-Design_Basic_Open");
private FileChooser.ExtensionFilter[] filters = new FileChooser.ExtensionFilter[0];
private File currentDirectory;
public Builder fileSelectionMode(FileSelectionMode fileSelectionMode) {
this.fileSelectionMode = fileSelectionMode;
return this;
}
public Builder title(String title) {
this.title = title;
return this;
}
public Builder filters(FileChooser.ExtensionFilter[] filters) {
this.filters = filters;
return this;
}
public Builder filter(String des, String... extensions) {
if (extensions != null) {
this.filters = new FileChooser.ExtensionFilter[]{new FileChooser.ExtensionFilter(des, extensions)};
}
return this;
}
public Builder currentDirectory(File currentDirectory) {
if (currentDirectory != null) {
if (!currentDirectory.isDirectory()) {
currentDirectory = currentDirectory.getParentFile();
}
if (currentDirectory != null && currentDirectory.isDirectory()) {
this.currentDirectory = currentDirectory;
}
}
return this;
}
public Builder currentDirectory(String path) {
if (path != null) {
return currentDirectory(new File(path));
}
return this;
}
public JavaFxNativeFileChooser build() {
return new JavaFxNativeFileChooser(this);
}
}
private JavaFxNativeFileChooser(Builder builder) {
this.fileSelectionMode = builder.fileSelectionMode;
this.title = builder.title;
this.filters = builder.filters;
this.currentDirectory = builder.currentDirectory;
}
}

154
designer-base/src/main/java/com/fr/design/gui/ifilechooser/UINativeFileChooser.java

@ -1,154 +0,0 @@
package com.fr.design.gui.ifilechooser;
import com.fr.design.gui.ifilechooser.AbstractFileChooser;
import com.fr.design.mainframe.DesignerContext;
import com.fr.stable.os.OperatingSystem;
import javax.swing.*;
import javax.swing.filechooser.FileFilter;
import java.awt.*;
import java.io.File;
import java.io.FilenameFilter;
/**
* 系统原生风格的文件选择器
*
* jdk问题
* https://bugs.openjdk.java.net/browse/JDK-4811090 不支持文件扩展选择
* https://stackoverflow.com/questions/40713398/filter-not-working-in-filedialog windows下 setFilenameFilter不work
*
* @author hades
* @version 10.0
* Created by hades on 2020/3/31
*/
public class UINativeFileChooser extends AbstractFileChooser {
private final FileDialog fileDialog;
private FileFilter fileFilter;
private int selectionMode;
public UINativeFileChooser(File file) {
fileDialog = new FileDialog(DesignerContext.getDesignerFrame());
if (file != null) {
fileDialog.setDirectory(file.getAbsolutePath());
fileDialog.setFile(file.toString());
}
}
public UINativeFileChooser() {
this(null);
}
@Override
public File getCurrentDirectory() {
return new File(fileDialog.getDirectory());
}
@Override
public FileFilter getFileFilter() {
return fileFilter;
}
@Override
public File getSelectedFile() {
return new File(fileDialog.getDirectory() + fileDialog.getFile());
}
@Override
public File[] getSelectedFiles() {
return fileDialog.getFiles();
}
@Override
public boolean isMultiSelectionEnabled() {
return fileDialog.isMultipleMode();
}
@Override
public void setCurrentDirectory(File f) {
fileDialog.setDirectory(f.toString());
}
@Override
public void setDialogTitle(String title) {
fileDialog.setTitle(title);
}
@Override
public void setFileFilter(final FileFilter cff) {
FilenameFilter filter = new FilenameFilter() {
@Override
public boolean accept(File Directory, String fileName) {
return cff.accept(new File(Directory.getAbsolutePath() + fileName));
}
};
fileDialog.setFilenameFilter(filter);
fileFilter = cff;
}
@Override
public void setFileSelectionMode(int selectionMode) {
this.selectionMode = selectionMode;
}
@Override
public void setMultiSelectionEnabled(boolean multiple) {
fileDialog.setMultipleMode(multiple);
}
@Override
public void setSelectedFile(File file) {
fileDialog.setDirectory(file.getAbsolutePath());
fileDialog.setFile(file.getName());
}
@Override
public int showOpenDialog(Component parent) {
boolean appleProperty = OperatingSystem.isMacos() && selectionMode == JFileChooser.DIRECTORIES_ONLY;
if (appleProperty) {
System.setProperty("apple.awt.fileDialogForDirectories", "true");
}
try {
fileDialog.setLocale(JComponent.getDefaultLocale());
fileDialog.setMode(FileDialog.LOAD);
fileDialog.setVisible(true);
return fileDialog.getFile() == null ? JFileChooser.CANCEL_OPTION : JFileChooser.APPROVE_OPTION;
} finally {
if (appleProperty) {
System.setProperty("apple.awt.fileDialogForDirectories", "false");
}
}
}
@Override
public int showSaveDialog(Component parent) {
fileDialog.setLocale(JComponent.getDefaultLocale());
fileDialog.setMode(FileDialog.SAVE);
fileDialog.setVisible(true);
return fileDialog.getFile() == null ? JFileChooser.CANCEL_OPTION : JFileChooser.APPROVE_OPTION;
}
@Override
public void setExtensionFilter(String file) {
fileDialog.setFile(file);
}
/**
* 确认本地文件选择器是否支持选择模式
* @param selectionMode 选择模式
* @return 是否支持选择模式
*/
public static boolean supportsSelectionMode(int selectionMode) {
switch (selectionMode) {
case JFileChooser.FILES_AND_DIRECTORIES:
return false;
case JFileChooser.DIRECTORIES_ONLY:
return OperatingSystem.isMacos();
case JFileChooser.FILES_ONLY:
default:
return true;
}
}
}

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

@ -3,266 +3,77 @@
*/
package com.fr.design.style.background.image;
import com.fr.base.BaseUtils;
import com.fr.design.DesignerEnvManager;
import com.fr.design.style.ChooseFileView;
import javax.swing.filechooser.FileFilter;
import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
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.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.share.collect.ComponentCollector;
import com.fr.design.mainframe.toast.DesignerToastMsgUtil;
import javafx.stage.FileChooser;
import javax.swing.*;
import java.awt.*;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.io.File;
import java.util.Enumeration;
import java.util.Hashtable;
/**
* This class used to choose image files.
*/
public class ImageFileChooser extends ExpandFileChooser {
public ImageFileChooser() {
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);
public class ImageFileChooser {
// 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);
}
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();
}
};
}
/**
* 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;
JavaFxNativeFileChooser javaFxNativeFileChooser;
/**
* 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);
public ImageFileChooser() {
javaFxNativeFileChooser =
new JavaFxNativeFileChooser.Builder().
fileSelectionMode(FileSelectionMode.FILE).
title(Toolkit.i18nText("Fine-Design_Basic_Open")).
filters(new FileChooser.ExtensionFilter[]{
new FileChooser.ExtensionFilter("jpg", "*.jpg"),
new FileChooser.ExtensionFilter("gif", "*.gif"),
new FileChooser.ExtensionFilter("png", "*.png"),
new FileChooser.ExtensionFilter("bmp", "*.bmp")}).
build();
}
/**
* 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
*/
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;
public int showOpenDialog(Component parent, String approveButtonText) {
return showOpenDialog(parent);
}
/**
* Return the extension portion of the file's name .
*
* @see #getExtension
* @see javax.swing.filechooser.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;
public int showOpenDialog(Component parent) {
showImageCompressMoveTip();
return javaFxNativeFileChooser.showDialog(parent);
}
/**
* 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;
public void setCurrentDirectory(File file) {
javaFxNativeFileChooser.setCurrentDirectory(file);
}
/**
* Returns the human readable description of this filter. For
* example: "JPEG and GIF Image Files (*.jpg, *.gif)"
*
* @see javax.swing.filechooser.FileFilter#getDescription
*/
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 += ")";
public void setMultiSelectionEnabled(boolean multiple) {
if (multiple) {
javaFxNativeFileChooser.setSelectionMode(FileSelectionMode.MULTIPLE_FILE);
} else {
fullDescription = description;
javaFxNativeFileChooser.setSelectionMode(FileSelectionMode.FILE);
}
}
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;
public File getSelectedFile() {
return javaFxNativeFileChooser.getSelectedFile();
}
/**
* 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;
public boolean isCheckSelected() {
return DesignerEnvManager.getEnvManager().isImageCompress();
}
/**
* 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;
private void showImageCompressMoveTip() {
if (DesignerEnvManager.getEnvManager().isShowImageCompressMoveTip()) {
DesignerToastMsgUtil.toastWarning(Toolkit.i18nText("Fine-Design_Image_Compress_Move_Tip"));
DesignerEnvManager.getEnvManager().setShowImageCompressMoveTip(false);
}
}
}

19
designer-base/src/main/java/com/fr/design/upm/UpmBridge.java

@ -14,6 +14,9 @@ import com.fr.design.extra.exe.GetPluginPrefixExecutor;
import com.fr.design.extra.exe.PluginLoginExecutor;
import com.fr.design.extra.exe.ReadUpdateOnlineExecutor;
import com.fr.design.extra.exe.SearchOnlineExecutor;
import com.fr.design.gui.ifilechooser.FileChooserProvider;
import com.fr.design.gui.ifilechooser.FileSelectionMode;
import com.fr.design.gui.ifilechooser.JavaFxNativeFileChooser;
import com.fr.design.i18n.Toolkit;
import com.fr.design.locale.impl.BbsRegisterMark;
import com.fr.design.locale.impl.BbsResetMark;
@ -36,6 +39,7 @@ import com.teamdev.jxbrowser.chromium.Browser;
import com.teamdev.jxbrowser.chromium.JSArray;
import com.teamdev.jxbrowser.chromium.JSFunction;
import com.teamdev.jxbrowser.chromium.JSObject;
import javafx.stage.FileChooser;
import javax.swing.*;
import javax.swing.filechooser.FileNameExtensionFilter;
@ -308,16 +312,13 @@ public class UpmBridge {
RunnableFuture<String> future = new FutureTask<>(new Callable<String>() {
@Override
public String call() {
JFileChooser fileChooser = new JFileChooser();
fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
if (StringUtils.isNotEmpty(filter)) {
fileChooser.setFileFilter(new FileNameExtensionFilter(des, UpmUtils.findMatchedExtension(filter)));
}
int result = fileChooser.showOpenDialog(UpmFinder.getDialog());
FileChooserProvider fileChooserProvider = new JavaFxNativeFileChooser.Builder().
fileSelectionMode(FileSelectionMode.FILE).
filter(des, filter).
build();
int result = fileChooserProvider.showDialog(UpmFinder.getDialog());
if (result == JFileChooser.APPROVE_OPTION) {
return fileChooser.getSelectedFile().getAbsolutePath();
return fileChooserProvider.getSelectedFile().getAbsolutePath();
}
return null;
}

7
designer-base/src/main/java/com/fr/design/utils/DesignUtils.java

@ -10,6 +10,7 @@ import com.fr.design.fun.DesignerEnvProcessor;
import com.fr.design.gui.UILookAndFeel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.ui.util.UIUtil;
import com.fr.exit.DesignerExiter;
import com.fr.file.FileFILE;
import com.fr.general.ComparatorUtils;
@ -205,8 +206,14 @@ public class DesignUtils {
isMatch = isMatch || path.endsWith(suffix);
}
if (isMatch) {
// ui线程作为打开入口
UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override
public void run() {
DesignerContext.getDesignerFrame().openTemplate(new FileFILE(f));
}
});
}
}
}
reader.close();

14
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;
@ -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);

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

@ -11,6 +11,9 @@ import com.fr.design.fun.DesignerEnvProcessor;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ifilechooser.FileChooserProvider;
import com.fr.design.gui.ifilechooser.FileSelectionMode;
import com.fr.design.gui.ifilechooser.JavaFxNativeFileChooser;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ipasswordfield.UIPassWordField;
import com.fr.design.gui.ipasswordfield.UIPasswordFieldWithFixedLength;
@ -30,6 +33,7 @@ import com.fr.workspace.connect.WorkspaceConnectionInfo;
import com.fr.workspace.engine.exception.WorkspaceAuthException;
import com.fr.workspace.engine.exception.WorkspaceCheckException;
import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
import javax.swing.JDialog;
@ -363,8 +367,8 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
@Override
public RemoteDesignerWorkspaceInfo updateBean() {
String url = this.remoteWorkspaceURL.getURL();
String username = this.usernameInput.getText();
String url = removeSpaces(this.remoteWorkspaceURL.getURL());
String username = removeSpaces(this.usernameInput.getText());
String password = new String(this.passwordInput.getPassword());
boolean rememberPwd = this.rememberPwdCheckbox.isSelected();
DesignerEnvProcessor envProcessor = ExtraDesignClassManager.getInstance().getSingle(DesignerEnvProcessor.XML_TAG);
@ -384,6 +388,13 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
return info;
}
private String removeSpaces(String str) {
if (StringUtils.isNotEmpty(str)) {
return str.trim();
}
return str;
}
@Override
protected String title4PopupWindow() {
return "Remote";
@ -562,11 +573,11 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
fileChooserButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
JFileChooser fileChooser = new JFileChooser();
fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
int saveValue = fileChooser.showOpenDialog(SwingUtilities.getWindowAncestor(RemoteEnvPane.this));
FileChooserProvider fileChooserProvider = new JavaFxNativeFileChooser.Builder().
fileSelectionMode(FileSelectionMode.FILE).build();
int saveValue = fileChooserProvider.showDialog(SwingUtilities.getWindowAncestor(RemoteEnvPane.this));
if (saveValue == JFileChooser.APPROVE_OPTION) {
File selectedFile = fileChooser.getSelectedFile();
File selectedFile = fileChooserProvider.getSelectedFile();
certPathInput.setText(selectedFile.getAbsolutePath());
}
}

3
designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java

@ -157,7 +157,8 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
@Override
public boolean accept(PluginContext context) {
return context.contain(PluginModule.ExtraChartDesign, SpecialLevel.IndependentChartUIProvider.getTagName());
return context.contain(PluginModule.ExtraChartDesign, SpecialLevel.IndependentChartUIProvider.getTagName())
|| context.contain(PluginModule.ExtraChartDesign, ChartTypeUIProvider.XML_TAG);
}
});
}

3
designer-chart/src/main/java/com/fr/design/chart/fun/ChartTypeUIProvider.java

@ -3,6 +3,7 @@ package com.fr.design.chart.fun;
import com.fr.chart.chartattr.Plot;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.condition.ConditionAttributesPane;
import com.fr.design.gui.chart.ChartXMLTag;
import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.mainframe.chart.AbstractChartAttrPane;
import com.fr.design.mainframe.chart.ChartEditPane;
@ -23,7 +24,7 @@ import com.fr.stable.fun.Level;
*/
public interface ChartTypeUIProvider extends Level {
String XML_TAG = "ChartTypeUIProvider";
String XML_TAG = ChartXMLTag.CHART_TYPE_UI_PROVIDER;
String OLD_TAG = SpecialLevel.IndependentChartUIProvider.getTagName();

14
designer-chart/src/main/java/com/fr/design/chart/series/PlotSeries/MapCustomPane.java

@ -9,6 +9,8 @@ import com.fr.design.data.DesignTableDataManager;
import com.fr.design.data.tabledata.wrapper.TableDataWrapper;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icombobox.FilterComboBox;
import com.fr.design.gui.ifilechooser.FileChooserProvider;
import com.fr.design.gui.ifilechooser.JavaFxNativeFileChooser;
import com.fr.design.gui.ilable.BoldFontTextLabel;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.mainframe.DesignerContext;
@ -109,14 +111,12 @@ refreshAreaNameBox();
private ActionListener selectPictureActionListener = new ActionListener() {
public void actionPerformed(ActionEvent evt) {
JFileChooser svgFileChooser = new JFileChooser();
svgFileChooser.addChoosableFileFilter(new SVGFileFilter());
if (StringUtils.isNotBlank(lastSelectPath)) {
svgFileChooser.setSelectedFile(new File(lastSelectPath));
}
int returnVal = svgFileChooser.showOpenDialog(DesignerContext.getDesignerFrame());
FileChooserProvider fileChooserProvider = new JavaFxNativeFileChooser.Builder().
filter(".svg, .svgz", "*.svg", "*.svgz").
currentDirectory(lastSelectPath).build();
int returnVal = fileChooserProvider.showDialog(DesignerContext.getDesignerFrame());
if (returnVal != JFileChooser.CANCEL_OPTION) {
File selectedFile = svgFileChooser.getSelectedFile();
File selectedFile = fileChooserProvider.getSelectedFile();
try {
lastSelectPath = selectedFile.getCanonicalPath();
} catch (Exception ex) {

4
designer-form/src/main/java/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java

@ -210,6 +210,10 @@ public class XBorderStyleWidgetCreator extends XWidgetCreator{
reshuffleBorderPaintingEffectIfTitleExists(titleParent, titleCreator, bodyXCreator);
reshuffleBackgroundPaintingEffectIfTitleExists(titleParent, titleCreator, bodyXCreator);
} else {
titleParent.setBorder(null);
titleParent.setBorderImage4Painting(null, 0.0);
titleParent.setBackground4Painting(null, 0.0);
}
}
}

7
designer-form/src/main/java/com/fr/design/designer/creator/XWTitleLayout.java

@ -62,6 +62,13 @@ public class XWTitleLayout extends DedicateLayoutContainer {
this.bodyBackgroundOpacity4Painting = opacity;
}
@Override
protected void initBorderAndBackgroundStyle() {
setBorder(null);
setBorderImage4Painting(null, 0.0);
setBackground4Painting(null, 0.0);
}
@Override
protected void initXCreatorProperties() {
super.initXCreatorProperties();

5
designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java

@ -415,7 +415,10 @@ public class XWCardMainBorderLayout extends XWBorderLayout {
*/
@Override
public void firePropertyChange(){
return;
XWCardLayout cardLayout = this.getCardPart();
if (cardLayout != null && cardLayout.toData() != null) {
cardLayout.initStyle();
}
}

39
designer-form/src/main/java/com/fr/design/gui/xpane/BorderLineAndImagePane.java

@ -98,13 +98,13 @@ public class BorderLineAndImagePane extends JPanel implements UIObserver {
private int[] ninePoint = new int[] {-1, -1, -1, -1};
public BorderLineAndImagePane() {
this.initComponents();
public BorderLineAndImagePane(boolean supportBorderImage) {
this.initComponents(supportBorderImage);
this.initLayout();
}
private void initComponents() {
borderLineCombo = new BorderLineAndImageComboBox();
private void initComponents(boolean supportBorderImage) {
borderLineCombo = new BorderLineAndImageComboBox(supportBorderImage);
borderColorPane = new NewColorSelectBox(145);
imagePreviewPane = new ImagePreviewPane() {{
setImageStyle(Style.DEFAULT_STYLE);
@ -386,16 +386,25 @@ public class BorderLineAndImagePane extends JPanel implements UIObserver {
protected static class BorderLineAndImageComboBox extends LineComboBox {
public static final int LINE_PICTURE = -1;
public final static int[] BORDER_LINE_STYLE_ARRAY = new int[] {
public final static int[] BORDER_LINE_AND_IMAGE_STYLE_ARRAY = new int[] {
Constants.LINE_NONE,
LINE_PICTURE,
Constants.LINE_THIN, //1px
Constants.LINE_MEDIUM, //2px
Constants.LINE_THICK, //3px
};
public final static int[] BORDER_LINE_STYLE_ARRAY = new int[] {
Constants.LINE_NONE,
Constants.LINE_THIN, //1px
Constants.LINE_MEDIUM, //2px
Constants.LINE_THICK, //3px
};
private boolean supportBorderImage = false;
public BorderLineAndImageComboBox() {
super(BORDER_LINE_STYLE_ARRAY);
public BorderLineAndImageComboBox(boolean supportBorderImage) {
super(supportBorderImage ? BORDER_LINE_AND_IMAGE_STYLE_ARRAY : BORDER_LINE_STYLE_ARRAY);
this.supportBorderImage = supportBorderImage;
}
@Override
@ -407,17 +416,29 @@ public class BorderLineAndImagePane extends JPanel implements UIObserver {
}
public boolean isSelectedBorderLine() {
return getSelectedIndex() > 1;
Object object = getSelectedItem();
if (object != null) {
int value = (int) object;
return value > 0;
}
return false;
}
public boolean isSelectedBorderImage() {
return getSelectedIndex() == 1;
Object object = getSelectedItem();
if (object != null) {
int value = (int) object;
return value == LINE_PICTURE;
}
return false;
}
public void selectBorderImage() {
if (supportBorderImage) {
this.setSelectedIndex(1);
}
}
}
private class NinePointImageTweakDialogPane extends BasicPane {
public final NinePointLinePreviewPane previewPane = new NinePointLinePreviewPane();

15
designer-form/src/main/java/com/fr/design/gui/xpane/CardTagLayoutStylePane.java

@ -3,9 +3,7 @@
*/
package com.fr.design.gui.xpane;
import com.fr.form.ui.LayoutBorderStyle;
import javax.swing.*;
import javax.swing.JPanel;
/**
* CardTagLayoutBorderPane Pane.
@ -14,14 +12,13 @@ public class CardTagLayoutStylePane extends LayoutStylePane {
@Override
protected JPanel createTitleStylePane(){
return null;
JPanel panel = super.createTitleStylePane();
panel.setVisible(false);
return panel;
}
@Override
public void updateTitle(LayoutBorderStyle style) {
protected JPanel createBackgroundStylePane(boolean supportCornerRadius) {
return super.createBackgroundStylePane(false);
}
@Override
protected void populateTitle() { }
}

15
designer-form/src/main/java/com/fr/design/gui/xpane/LayoutStylePane.java

@ -88,7 +88,14 @@ public class LayoutStylePane extends BasicBeanPane<LayoutBorderStyle> {
//标题背景透明度
protected UIPercentDragPane titleBackgroundOpacityPane;
private boolean supportBorderImage = false;
public LayoutStylePane() {
this(false);
}
public LayoutStylePane(boolean supportBorderImage) {
this.supportBorderImage = supportBorderImage;
this.initLayout();
}
@ -103,7 +110,7 @@ public class LayoutStylePane extends BasicBeanPane<LayoutBorderStyle> {
JPanel titlePane = createTitleStylePane();
JPanel bodyContentPane = currentIsRootLayout ? createBodyContentPane4RootLayout() : createBodyContentPane();
JPanel backgroundPane = createBackgroundStylePane();
JPanel backgroundPane = createBackgroundStylePane(true);
if (titlePane != null) {
container.add(titlePane, BorderLayout.NORTH);
@ -128,14 +135,14 @@ public class LayoutStylePane extends BasicBeanPane<LayoutBorderStyle> {
this.add(container, BorderLayout.CENTER);
}
protected JPanel createBackgroundStylePane() {
protected JPanel createBackgroundStylePane(boolean supportCornerRadius) {
borderStyleCombo = new UIComboBox(BORDER_STYLE);
borderLineAndImagePane = new BorderLineAndImagePane();
borderLineAndImagePane = new BorderLineAndImagePane(this.supportBorderImage);
cornerSpinner = new UISpinner(0,1000,1,0);
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] rowSize = {p, p, p, p};
double[] rowSize = supportCornerRadius ? new double[] {p, p, p, p} : new double[]{p, p, p};
double[] columnSize = {SETTING_LABEL_WIDTH, f};
UILabel uiLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget-Style_Background_Style"));

49
designer-form/src/main/java/com/fr/design/gui/xpane/TitleInsetImagePane.java

@ -35,7 +35,6 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.geom.RoundRectangle2D;
/**
@ -96,14 +95,21 @@ public class TitleInsetImagePane extends JPanel implements UIObserver {
imagePreviewPane.setBounds(0, 0, IMAGE_PREVIEW_SIZE, IMAGE_PREVIEW_SIZE);
imagePreviewOverlayPane.setBounds(1, 1, IMAGE_PREVIEW_SIZE - 2, IMAGE_PREVIEW_SIZE - 2);
imageDeleteButton.setBounds(IMAGE_PREVIEW_SIZE - DELETE_BUTTON_SIZE, 0, DELETE_BUTTON_SIZE, DELETE_BUTTON_SIZE);
deletableImagePreviewPane.add(imageDeleteButton, 0);
deletableImagePreviewPane.add(imagePreviewOverlayPane, 1);
deletableImagePreviewPane.add(imagePreviewPane, 2);
JPanel mousePane = new JPanel();
mousePane.setBounds(0, 0, IMAGE_PREVIEW_SIZE, IMAGE_PREVIEW_SIZE);
mousePane.setOpaque(false);
mousePane.setBackground(null);
deletableImagePreviewPane.add(mousePane, 0);
deletableImagePreviewPane.add(imageDeleteButton, 1);
deletableImagePreviewPane.add(imagePreviewOverlayPane, 2);
deletableImagePreviewPane.add(imagePreviewPane, 3);
imagePreviewOverlayPane.setVisible(false);
imageDeleteButton.setVisible(false);
imageDeleteButton.setEnabled(false);
deletableImagePreviewPane.addMouseListener(new MouseAdapter() {
mousePane.addMouseListener(new MouseAdapter() {
@Override
public void mouseEntered(MouseEvent e) {
super.mouseEntered(e);
@ -119,6 +125,25 @@ public class TitleInsetImagePane extends JPanel implements UIObserver {
imageDeleteButton.setVisible(false);
imageDeleteButton.setEnabled(false);
}
@Override
public void mouseClicked(MouseEvent e) {
super.mouseClicked(e);
int x = e.getX();
int y = e.getY();
Rectangle bounds = imageDeleteButton.getBounds();
if (bounds.x < x && x < bounds.x + bounds.width && bounds.y < y && y < bounds.y + bounds.height) {
imagePreviewPane.setImageWithSuffix(null);
imageLocationPane.setSelectedIndex(DEFAULT_INSET_LOCATION_INDEX);
imagePaddingPane.setValue(DEFAULT_INSET_PADDING);
imagePreviewOverlayPane.setVisible(false);
imageDeleteButton.setVisible(false);
imageDeleteButton.setEnabled(false);
getComponent(1).setVisible(false);
fireStateChanged();
}
}
});
return TableLayoutHelper.createCommonTableLayoutPane(
@ -207,20 +232,6 @@ public class TitleInsetImagePane extends JPanel implements UIObserver {
}).dealWithImageFile(returnVal);
}
});
this.imageDeleteButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
imagePreviewPane.setImageWithSuffix(null);
imageLocationPane.setSelectedIndex(DEFAULT_INSET_LOCATION_INDEX);
imagePaddingPane.setValue(DEFAULT_INSET_PADDING);
imagePreviewOverlayPane.setVisible(false);
imageDeleteButton.setVisible(false);
imageDeleteButton.setEnabled(false);
getComponent(1).setVisible(false);
fireStateChanged();
}
});
}
public void populateBean(TitlePacker packer) {

8
designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java

@ -8,6 +8,7 @@ import com.fr.design.designer.beans.events.DesignerEditListener;
import com.fr.design.designer.beans.events.DesignerEvent;
import com.fr.design.designer.creator.XCreatorUtils;
import com.fr.design.fun.FormWidgetOptionProvider;
import com.fr.design.gui.chart.ChartXMLTag;
import com.fr.design.gui.core.FormWidgetOption;
import com.fr.design.gui.core.UserDefinedWidgetOption;
import com.fr.design.gui.core.WidgetOption;
@ -38,20 +39,20 @@ import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.JSeparator;
import javax.swing.SwingConstants;
import java.awt.Cursor;
import java.awt.event.MouseListener;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
/**
* @author null
@ -105,7 +106,8 @@ public class FormParaWidgetPane extends JPanel {
public boolean accept(PluginContext context) {
return context.contain(PluginModule.ExtraDesign, FormWidgetOptionProvider.XML_TAG)
|| context.contain(PluginModule.ExtraChartDesign, SpecialLevel.IndependentChartUIProvider.getTagName());
|| context.contain(PluginModule.ExtraChartDesign, SpecialLevel.IndependentChartUIProvider.getTagName())
|| context.contain(PluginModule.ExtraChartDesign, ChartXMLTag.CHART_TYPE_UI_PROVIDER);
}
});
}

33
designer-form/src/main/java/com/fr/design/mainframe/share/action/InstallComponentAction.java

@ -4,7 +4,9 @@ import com.fr.design.actions.UpdateAction;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.gui.ifilechooser.UINativeFileChooser;
import com.fr.design.gui.ifilechooser.FileChooserProvider;
import com.fr.design.gui.ifilechooser.FileSelectionMode;
import com.fr.design.gui.ifilechooser.JavaFxNativeFileChooser;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext;
@ -17,6 +19,8 @@ import com.fr.design.os.impl.SupportOSImpl;
import com.fr.form.share.record.ShareWidgetInfoManager;
import com.fr.form.share.utils.ReuxUtils;
import com.fr.log.FineLoggerFactory;
import com.sun.javafx.tk.FileChooserType;
import javafx.stage.FileChooser;
import javax.swing.Action;
import javax.swing.JFileChooser;
@ -42,23 +46,16 @@ public class InstallComponentAction extends UpdateAction {
@Override
public void actionPerformed(ActionEvent e) {
if (SupportOSImpl.NATIVE_CHOOSER.support()) {
UINativeFileChooser nativeFileChooser = new UINativeFileChooser();
nativeFileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
nativeFileChooser.setMultiSelectionEnabled(true);
nativeFileChooser.setFileFilter(new FileNameExtensionFilter("reu reus", "reu", "reus"));
nativeFileChooser.setDialogTitle(Toolkit.i18nText("Fine-Design_Basic_Select"));
int returnValue = nativeFileChooser.showOpenDialog(new UILabel());
installComponent(returnValue, nativeFileChooser.getSelectedFiles());
} else {
JFileChooser fileChooser = new JFileChooser();
fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
fileChooser.setMultiSelectionEnabled(true);
fileChooser.setFileFilter(new FileNameExtensionFilter("reu reus", "reu", "reus"));
int returnValue = fileChooser.showDialog(new UILabel(), Toolkit.i18nText("Fine-Design_Basic_Select"));
installComponent(returnValue, fileChooser.getSelectedFiles());
}
FileChooserProvider fileChooserProvider =
new JavaFxNativeFileChooser.Builder().
fileSelectionMode(FileSelectionMode.MULTIPLE_FILE).
title(Toolkit.i18nText("Fine-Design_Basic_Select")).
filters(new FileChooser.ExtensionFilter[]{
new FileChooser.ExtensionFilter("reu", "*.reu"),
new FileChooser.ExtensionFilter("reus", "*.reus")}).
build();
int returnValue = fileChooserProvider.showDialog(null);
installComponent(returnValue, fileChooserProvider.getSelectedFiles());
}
private void installComponent(int returnValue, File[] selectedFiles) {

10
designer-form/src/main/java/com/fr/design/mainframe/share/generate/task/ComponentCreator.java

@ -110,8 +110,14 @@ public class ComponentCreator extends AbstractComponentCreatorProcessor {
protected DefaultSharableEditor createSharableEditor(Form form, Map<String, Object> paraMap, Widget widget, DefaultSharableWidget info) {
String uuid = info.getId();
((AbstractBorderStyleWidget) widget).addWidgetAttrMark(new SharableAttrMark());
((AbstractBorderStyleWidget) widget).addWidgetAttrMark(new ExtendSharableAttrMark(uuid));
AbstractBorderStyleWidget abstractBorderStyleWidget = (AbstractBorderStyleWidget) widget;
abstractBorderStyleWidget.addWidgetAttrMark(new SharableAttrMark());
ExtendSharableAttrMark extendSharableAttrMark = abstractBorderStyleWidget.getWidgetAttrMark(ExtendSharableAttrMark.XML_TAG);
if (extendSharableAttrMark != null) {
extendSharableAttrMark.setShareId(uuid);
} else {
abstractBorderStyleWidget.addWidgetAttrMark(new ExtendSharableAttrMark(uuid));
}
return new PlainSharableEditor(uuid, widget, form, (HashMap<String, Object>) paraMap);
}

2
designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/WTitleLayoutDefinePane.java

@ -27,7 +27,7 @@ public abstract class WTitleLayoutDefinePane<T extends AbstractBorderStyleWidget
public void initComponent() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel advancePane = FRGUIPaneFactory.createBorderLayout_S_Pane();
stylePane = new LayoutStylePane();
stylePane = new LayoutStylePane(true);
advancePane.add(stylePane, BorderLayout.NORTH);
JPanel centerPane = createCenterPane();
if(centerPane!=null){

Loading…
Cancel
Save