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. 25
      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. 289
      designer-base/src/main/java/com/fr/design/style/background/image/ImageFileChooser.java
  11. 27
      designer-base/src/main/java/com/fr/design/upm/UpmBridge.java
  12. 9
      designer-base/src/main/java/com/fr/design/utils/DesignUtils.java
  13. 16
      designer-base/src/main/java/com/fr/design/web/CustomIconPane.java
  14. 31
      designer-base/src/main/java/com/fr/env/RemoteEnvPane.java
  15. 3
      designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java
  16. 5
      designer-chart/src/main/java/com/fr/design/chart/fun/ChartTypeUIProvider.java
  17. 352
      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. 41
      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. 10
      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 static List<SwingWorker> mapWorkerList = new ArrayList<SwingWorker>();
private boolean imageCompress = false;//图片压缩 private boolean imageCompress = false;//图片压缩
private boolean showImageCompressMoveTip = true;
// 开启内嵌web页面的调试窗口 // 开启内嵌web页面的调试窗口
private boolean openDebug = false; private boolean openDebug = false;
@ -1637,6 +1638,15 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
this.imageCompress = imageCompress; this.imageCompress = imageCompress;
} }
public boolean isShowImageCompressMoveTip() {
return showImageCompressMoveTip;
}
public void setShowImageCompressMoveTip(boolean showImageCompressMoveTip) {
this.showImageCompressMoveTip = showImageCompressMoveTip;
}
public boolean isOpenDebug() { public boolean isOpenDebug() {
return openDebug; return openDebug;
} }
@ -1792,6 +1802,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
this.setCachingTemplateLimit(reader.getAttrAsInt("cachingTemplateLimit", CACHINGTEMPLATE_LIMIT)); this.setCachingTemplateLimit(reader.getAttrAsInt("cachingTemplateLimit", CACHINGTEMPLATE_LIMIT));
this.setJoinProductImprove(reader.getAttrAsBoolean("joinProductImprove", true)); this.setJoinProductImprove(reader.getAttrAsBoolean("joinProductImprove", true));
this.setImageCompress(reader.getAttrAsBoolean("imageCompress", true)); this.setImageCompress(reader.getAttrAsBoolean("imageCompress", true));
this.setShowImageCompressMoveTip(reader.getAttrAsBoolean("showImageCompressMoveTip", true));
this.setAutoBackUp(reader.getAttrAsBoolean("autoBackUp", true)); this.setAutoBackUp(reader.getAttrAsBoolean("autoBackUp", true));
this.setTemplateTreePaneExpanded(reader.getAttrAsBoolean("templateTreePaneExpanded", false)); this.setTemplateTreePaneExpanded(reader.getAttrAsBoolean("templateTreePaneExpanded", false));
// peter:读取webinfLocation // peter:读取webinfLocation
@ -2072,6 +2083,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
if (!this.isImageCompress()) { if (!this.isImageCompress()) {
writer.attr("imageCompress", this.isImageCompress()); writer.attr("imageCompress", this.isImageCompress());
} }
writer.attr("showImageCompressMoveTip", this.isShowImageCompressMoveTip());
if (!this.isAutoBackUp()) { if (!this.isAutoBackUp()) {
writer.attr("autoBackUp", this.isAutoBackUp()); writer.attr("autoBackUp", this.isAutoBackUp());
} }

25
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.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.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.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;
@ -47,6 +50,8 @@ 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;
@ -165,6 +170,7 @@ public class PreferencePane extends BasicPane {
private UICheckBox joinProductImproveCheckBox; private UICheckBox joinProductImproveCheckBox;
private UICheckBox autoPushUpdateCheckBox; private UICheckBox autoPushUpdateCheckBox;
private UICheckBox embedServerLazyStartupCheckBox; private UICheckBox embedServerLazyStartupCheckBox;
private UICheckBox imageCompressPanelCheckBox;
private UICheckBox vcsEnableCheckBox; private UICheckBox vcsEnableCheckBox;
private UICheckBox saveCommitCheckBox; private UICheckBox saveCommitCheckBox;
@ -256,6 +262,10 @@ public class PreferencePane extends BasicPane {
embedServerPanel.add(embedServerLazyStartupCheckBox); embedServerPanel.add(embedServerLazyStartupCheckBox);
advancePane.add(embedServerPanel); 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) { private void createVcsSettingPane(JPanel generalPane) {
@ -489,11 +499,13 @@ public class PreferencePane extends BasicPane {
chooseDirBtn.addActionListener(new ActionListener() { chooseDirBtn.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
JFileChooser fileChooser = new JFileChooser(); FileChooserProvider fileChooserProvider =
fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); new JavaFxNativeFileChooser.Builder().
int saveValue = fileChooser.showOpenDialog(DesignerContext.getDesignerFrame()); fileSelectionMode(FileSelectionMode.DIR).
build();
int saveValue = fileChooserProvider.showDialog(null);
if (saveValue == JFileChooser.APPROVE_OPTION) { if (saveValue == JFileChooser.APPROVE_OPTION) {
File selectedFile = fileChooser.getSelectedFile(); File selectedFile = fileChooserProvider.getSelectedFile();
logExportDirectoryField.setText(selectedFile.getAbsolutePath()); logExportDirectoryField.setText(selectedFile.getAbsolutePath());
} }
} }
@ -665,7 +677,7 @@ public class PreferencePane extends BasicPane {
defaultStringToFormulaBox.setSelected(false); defaultStringToFormulaBox.setSelected(false);
} }
VcsConfigManager vcsConfigManager = designerEnvManager.getVcsConfigManager(); VcsConfigManager vcsConfigManager = designerEnvManager.getVcsConfigManager();
if (WorkContext.getCurrent().isCluster()){ if (WorkContext.getCurrent().isCluster()) {
vcsEnableCheckBox.setEnabled(false); vcsEnableCheckBox.setEnabled(false);
gcEnableCheckBox.setEnabled(false); gcEnableCheckBox.setEnabled(false);
} }
@ -717,6 +729,8 @@ public class PreferencePane extends BasicPane {
} }
this.embedServerLazyStartupCheckBox.setSelected(designerEnvManager.isEmbedServerLazyStartup()); this.embedServerLazyStartupCheckBox.setSelected(designerEnvManager.isEmbedServerLazyStartup());
this.imageCompressPanelCheckBox.setSelected(designerEnvManager.isImageCompress());
} }
private int chooseCase(int sign) { private int chooseCase(int sign) {
@ -775,6 +789,7 @@ public class PreferencePane extends BasicPane {
designerEnvManager.setCachingTemplateLimit((int) this.cachingTemplateSpinner.getValue()); designerEnvManager.setCachingTemplateLimit((int) this.cachingTemplateSpinner.getValue());
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());
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());

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.dbtypeComboBox.setSelectedItem(OTHER_DB);
} }
} }
this.jdbcDatabase.setIdentity(jdbcDatabase.getIdentity());
this.driverComboBox.setSelectedItem(jdbcDatabase.getDriver()); this.driverComboBox.setSelectedItem(jdbcDatabase.getDriver());
this.urlTextField.setText(jdbcDatabase.getURL()); this.urlTextField.setText(jdbcDatabase.getURL());
this.userNameTextField.setText(jdbcDatabase.getUser()); 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;
}
}
}

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

@ -3,266 +3,77 @@
*/ */
package com.fr.design.style.background.image; package com.fr.design.style.background.image;
import com.fr.base.BaseUtils;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.style.ChooseFileView; import com.fr.design.gui.ifilechooser.FileSelectionMode;
import com.fr.design.gui.ifilechooser.JavaFxNativeFileChooser;
import com.fr.design.gui.ilable.UILabel;
import javax.swing.filechooser.FileFilter; import com.fr.design.i18n.Toolkit;
import java.awt.Component; import com.fr.design.layout.FRGUIPaneFactory;
import java.awt.event.ActionEvent; import com.fr.design.mainframe.share.collect.ComponentCollector;
import java.awt.event.ActionListener; 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.io.File;
import java.util.Enumeration;
import java.util.Hashtable;
/** /**
* This class used to choose image files. * This class used to choose image files.
*/ */
public class ImageFileChooser extends ExpandFileChooser { public class ImageFileChooser {
JavaFxNativeFileChooser javaFxNativeFileChooser;
public ImageFileChooser() { public ImageFileChooser() {
super(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Image_Compress"),com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Open")); javaFxNativeFileChooser =
ExampleFileFilter bothFilter = new ExampleFileFilter( new JavaFxNativeFileChooser.Builder().
new String[]{"jpg", "gif", "png", "bmp"}, fileSelectionMode(FileSelectionMode.FILE).
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Image_Image_Files")); title(Toolkit.i18nText("Fine-Design_Basic_Open")).
bothFilter.setExtensionListInDescription(true); filters(new FileChooser.ExtensionFilter[]{
this.addChoosableFileFilter(bothFilter); new FileChooser.ExtensionFilter("jpg", "*.jpg"),
this.setAcceptAllFileFilterUsed(false); new FileChooser.ExtensionFilter("gif", "*.gif"),
new FileChooser.ExtensionFilter("png", "*.png"),
new FileChooser.ExtensionFilter("bmp", "*.bmp")}).
build();
}
// 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 showOpenDialog(Component parent, String approveButtonText) {
return showOpenDialog(parent);
} }
public int showDialog(Component parent, String approveButtonText) { public int showOpenDialog(Component parent) {
return super.showDialog(parent, approveButtonText); showImageCompressMoveTip();
return javaFxNativeFileChooser.showDialog(parent);
} }
@Override public void setCurrentDirectory(File file) {
public ActionListener checkAction() { javaFxNativeFileChooser.setCurrentDirectory(file);
return new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
DesignerEnvManager.getEnvManager().setImageCompress(isCheckSelected());
DesignerEnvManager.getEnvManager().saveXMLFile();
}
};
} }
/** public void setMultiSelectionEnabled(boolean multiple) {
* A convenience implementation of FileFilter that filters out if (multiple) {
* all files except for those type extensions that it knows about. javaFxNativeFileChooser.setSelectionMode(FileSelectionMode.MULTIPLE_FILE);
* <p/>D:\finereport\develop\code\test\TestCase\WEB-INF\reportlets\TestCase\01903.cpt } else {
* <p> javaFxNativeFileChooser.setSelectionMode(FileSelectionMode.FILE);
* 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
*/
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 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;
}
/**
* 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 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 += ")";
} else {
fullDescription = description;
}
}
return fullDescription;
} }
}
/** public File getSelectedFile() {
* Sets the human readable description of this filter. For return javaFxNativeFileChooser.getSelectedFile();
* example: filter.setDescription("Gif and JPG Images"); }
*/
public void setDescription(String description) {
this.description = description;
fullDescription = null;
}
/** public boolean isCheckSelected() {
* Determines whether the extension list (.jpg, .gif, etc) should return DesignerEnvManager.getEnvManager().isImageCompress();
* 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;
}
/** private void showImageCompressMoveTip() {
* Returns whether the extension list (.jpg, .gif, etc) should if (DesignerEnvManager.getEnvManager().isShowImageCompressMoveTip()) {
* show up in the human readable description. DesignerToastMsgUtil.toastWarning(Toolkit.i18nText("Fine-Design_Image_Compress_Move_Tip"));
* <p/> DesignerEnvManager.getEnvManager().setShowImageCompressMoveTip(false);
* Only relevent if a description was provided in the constructor
* or using setDescription();
*/
public boolean isExtensionListInDescription() {
return useExtensionsInDescription;
} }
} }
} }

27
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.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.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.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;
@ -36,6 +39,7 @@ 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 javax.swing.*;
import javax.swing.filechooser.FileNameExtensionFilter; import javax.swing.filechooser.FileNameExtensionFilter;
@ -95,7 +99,7 @@ public class UpmBridge {
@JSBridge @JSBridge
public void startDownload(final JSFunction callback) { public void startDownload(final JSFunction callback) {
callback.invoke(window, "start", Toolkit.i18nText("Fine-Design_Basic_Update_Plugin_Manager_Download_Start")); callback.invoke(window, "start", Toolkit.i18nText("Fine-Design_Basic_Update_Plugin_Manager_Download_Start"));
new SwingWorker<Void, Void>(){ new SwingWorker<Void, Void>() {
@Override @Override
protected Void doInBackground() throws Exception { protected Void doInBackground() throws Exception {
UpmResourceLoader.INSTANCE.download(); UpmResourceLoader.INSTANCE.download();
@ -308,16 +312,13 @@ 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() {
JFileChooser fileChooser = new JFileChooser(); FileChooserProvider fileChooserProvider = new JavaFxNativeFileChooser.Builder().
fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); fileSelectionMode(FileSelectionMode.FILE).
filter(des, filter).
if (StringUtils.isNotEmpty(filter)) { build();
fileChooser.setFileFilter(new FileNameExtensionFilter(des, UpmUtils.findMatchedExtension(filter))); int result = fileChooserProvider.showDialog(UpmFinder.getDialog());
}
int result = fileChooser.showOpenDialog(UpmFinder.getDialog());
if (result == JFileChooser.APPROVE_OPTION) { if (result == JFileChooser.APPROVE_OPTION) {
return fileChooser.getSelectedFile().getAbsolutePath(); return fileChooserProvider.getSelectedFile().getAbsolutePath();
} }
return null; return null;
} }
@ -345,11 +346,11 @@ public class UpmBridge {
public String call() { public String call() {
JFileChooser fileChooser = new JFileChooser(); JFileChooser fileChooser = new JFileChooser();
List<String> filterList = new ArrayList<>(); List<String> filterList = new ArrayList<>();
if (args instanceof String) { if (args instanceof String) {
filterList.add(GeneralUtils.objectToString(args)); filterList.add(GeneralUtils.objectToString(args));
} else if (args instanceof JSArray) { } else if (args instanceof JSArray) {
JSArray array = (JSArray)args; JSArray array = (JSArray) args;
for (int i = 0, len = array.length(); i < len; i ++) { for (int i = 0, len = array.length(); i < len; i++) {
filterList.add(array.get(i).getStringValue()); filterList.add(array.get(i).getStringValue());
} }
} }

9
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.gui.UILookAndFeel;
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.ui.util.UIUtil;
import com.fr.exit.DesignerExiter; import com.fr.exit.DesignerExiter;
import com.fr.file.FileFILE; import com.fr.file.FileFILE;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
@ -205,7 +206,13 @@ public class DesignUtils {
isMatch = isMatch || path.endsWith(suffix); isMatch = isMatch || path.endsWith(suffix);
} }
if (isMatch) { if (isMatch) {
DesignerContext.getDesignerFrame().openTemplate(new FileFILE(f)); // ui线程作为打开入口
UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override
public void run() {
DesignerContext.getDesignerFrame().openTemplate(new FileFILE(f));
}
});
} }
} }
} }

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.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.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;
@ -28,6 +30,7 @@ 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 javax.swing.*;
import javax.swing.event.ChangeEvent; 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"); 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() { private void onBrowseButtonClicked() {
JFileChooser jf = new JFileChooser();
// carl:不知道是否只要png格式,反正导出时全部都转成png了 // carl:不知道是否只要png格式,反正导出时全部都转成png了
FileNameExtensionFilter fileFilter = new FileNameExtensionFilter("Icon Image File", "jpg", "jpeg", "png", "gif"); FileChooserProvider fileChooserProvider = new JavaFxNativeFileChooser.Builder().
jf.setFileFilter(fileFilter); filter("Icon Image File", "*.jpg", "*.jpeg", "*.png", "*.gif").
build();
if (JFileChooser.APPROVE_OPTION == jf.showOpenDialog(DesignerContext.getDesignerFrame())) { if (JFileChooser.APPROVE_OPTION == fileChooserProvider.showDialog(DesignerContext.getDesignerFrame())) {
String path = jf.getSelectedFile().getAbsolutePath(); String path = fileChooserProvider.getSelectedFile().getAbsolutePath();
// 图片存储有最大值48*48限制,没有超过最大值时,按原图大小存储,超过最大值后,压缩至最大值存储 // 图片存储有最大值48*48限制,没有超过最大值时,按原图大小存储,超过最大值后,压缩至最大值存储
Image image = BaseUtils.readImage(path); 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); 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);

31
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.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.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.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;
@ -30,6 +33,7 @@ import com.fr.workspace.connect.WorkspaceConnectionInfo;
import com.fr.workspace.engine.exception.WorkspaceAuthException; import com.fr.workspace.engine.exception.WorkspaceAuthException;
import com.fr.workspace.engine.exception.WorkspaceCheckException; import com.fr.workspace.engine.exception.WorkspaceCheckException;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.BoxLayout; import javax.swing.BoxLayout;
import javax.swing.JDialog; import javax.swing.JDialog;
@ -363,8 +367,8 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
@Override @Override
public RemoteDesignerWorkspaceInfo updateBean() { public RemoteDesignerWorkspaceInfo updateBean() {
String url = this.remoteWorkspaceURL.getURL(); String url = removeSpaces(this.remoteWorkspaceURL.getURL());
String username = this.usernameInput.getText(); String username = removeSpaces(this.usernameInput.getText());
String password = new String(this.passwordInput.getPassword()); String password = new String(this.passwordInput.getPassword());
boolean rememberPwd = this.rememberPwdCheckbox.isSelected(); boolean rememberPwd = this.rememberPwdCheckbox.isSelected();
DesignerEnvProcessor envProcessor = ExtraDesignClassManager.getInstance().getSingle(DesignerEnvProcessor.XML_TAG); DesignerEnvProcessor envProcessor = ExtraDesignClassManager.getInstance().getSingle(DesignerEnvProcessor.XML_TAG);
@ -384,6 +388,13 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
return info; return info;
} }
private String removeSpaces(String str) {
if (StringUtils.isNotEmpty(str)) {
return str.trim();
}
return str;
}
@Override @Override
protected String title4PopupWindow() { protected String title4PopupWindow() {
return "Remote"; return "Remote";
@ -562,11 +573,11 @@ 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) {
JFileChooser fileChooser = new JFileChooser(); FileChooserProvider fileChooserProvider = new JavaFxNativeFileChooser.Builder().
fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); fileSelectionMode(FileSelectionMode.FILE).build();
int saveValue = fileChooser.showOpenDialog(SwingUtilities.getWindowAncestor(RemoteEnvPane.this)); int saveValue = fileChooserProvider.showDialog(SwingUtilities.getWindowAncestor(RemoteEnvPane.this));
if (saveValue == JFileChooser.APPROVE_OPTION) { if (saveValue == JFileChooser.APPROVE_OPTION) {
File selectedFile = fileChooser.getSelectedFile(); File selectedFile = fileChooserProvider.getSelectedFile();
certPathInput.setText(selectedFile.getAbsolutePath()); certPathInput.setText(selectedFile.getAbsolutePath());
} }
} }
@ -603,10 +614,10 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
dialog.dispose(); dialog.dispose();
FineLoggerFactory.getLogger().error(result.getText().replaceAll(TestConnectionResult.WRAP, StringUtils.EMPTY) + Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Modify_PassWord")); FineLoggerFactory.getLogger().error(result.getText().replaceAll(TestConnectionResult.WRAP, StringUtils.EMPTY) + Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Modify_PassWord"));
FineJOptionPane.showMessageDialog(RemoteEnvPane.this, FineJOptionPane.showMessageDialog(RemoteEnvPane.this,
new MessageWithLink(result.getText(), Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Modify_PassWord"), connection.getUrl() + RemoteWorkspaceURL.SYSTEM_LOGIN_PATH), new MessageWithLink(result.getText(), Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Modify_PassWord"), connection.getUrl() + RemoteWorkspaceURL.SYSTEM_LOGIN_PATH),
Toolkit.i18nText("Fine-Design_Basic_Dialog_Message_Title"), Toolkit.i18nText("Fine-Design_Basic_Dialog_Message_Title"),
ERROR_MESSAGE, ERROR_MESSAGE,
UIManager.getIcon("OptionPane.errorIcon")); UIManager.getIcon("OptionPane.errorIcon"));
} }
message.setText(result.getText()); message.setText(result.getText());
uiLabel.setIcon(result.getIcon()); uiLabel.setIcon(result.getIcon());

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

@ -157,7 +157,8 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
@Override @Override
public boolean accept(PluginContext context) { 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);
} }
}); });
} }

5
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.chart.chartattr.Plot;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.condition.ConditionAttributesPane; import com.fr.design.condition.ConditionAttributesPane;
import com.fr.design.gui.chart.ChartXMLTag;
import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.mainframe.chart.AbstractChartAttrPane; import com.fr.design.mainframe.chart.AbstractChartAttrPane;
import com.fr.design.mainframe.chart.ChartEditPane; import com.fr.design.mainframe.chart.ChartEditPane;
@ -22,8 +23,8 @@ import com.fr.stable.fun.Level;
* 自定义 图表类型 界面接口 * 自定义 图表类型 界面接口
*/ */
public interface ChartTypeUIProvider extends Level { public interface ChartTypeUIProvider extends Level {
String XML_TAG = "ChartTypeUIProvider"; String XML_TAG = ChartXMLTag.CHART_TYPE_UI_PROVIDER;
String OLD_TAG = SpecialLevel.IndependentChartUIProvider.getTagName(); String OLD_TAG = SpecialLevel.IndependentChartUIProvider.getTagName();

352
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.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.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;
@ -40,56 +42,56 @@ import java.awt.event.ItemListener;
* @author kunsnat E-mail:kunsnat@gmail.com * @author kunsnat E-mail:kunsnat@gmail.com
* @version 创建时间2012-10-15 下午03:38:15 * @version 创建时间2012-10-15 下午03:38:15
*/ */
public class MapCustomPane extends BasicBeanPane<String> implements AbstrctMapAttrEditPane{ // 储存地图对应的字段. 名称, 类型. shape (点 用圆形代替) public class MapCustomPane extends BasicBeanPane<String> implements AbstrctMapAttrEditPane { // 储存地图对应的字段. 名称, 类型. shape (点 用圆形代替)
private FilterComboBox<String> areaString;// 区域字段 private FilterComboBox<String> areaString;// 区域字段
private DatabaseTableDataPane tableDataNameBox;// 数据集名称 + 后面跟随预览按钮 private DatabaseTableDataPane tableDataNameBox;// 数据集名称 + 后面跟随预览按钮
private MapImageEditPane imageShowPane; // 图片展示编辑的界面 private MapImageEditPane imageShowPane; // 图片展示编辑的界面
private String lastSelectPath; private String lastSelectPath;
private boolean isNeedDataSource = true; private boolean isNeedDataSource = true;
public MapCustomPane() { public MapCustomPane() {
initComp(); initComp();
} }
public MapCustomPane(boolean isNeedDataSource){ public MapCustomPane(boolean isNeedDataSource) {
this.isNeedDataSource = isNeedDataSource; this.isNeedDataSource = isNeedDataSource;
initComp(); initComp();
} }
private void initComp() { private void initComp() {
this.setLayout(new BorderLayout(0, 0)); this.setLayout(new BorderLayout(0, 0));
JPanel pane = new JPanel(); JPanel pane = new JPanel();
this.add(pane, BorderLayout.NORTH); this.add(pane, BorderLayout.NORTH);
pane.setLayout(new BorderLayout()); pane.setLayout(new BorderLayout());
pane.add(northPaneCreate(), BorderLayout.NORTH); pane.add(northPaneCreate(), BorderLayout.NORTH);
imageShowPane = new MapImageEditPane(); imageShowPane = new MapImageEditPane();
pane.add(imageShowPane, BorderLayout.CENTER); pane.add(imageShowPane, BorderLayout.CENTER);
} }
private JPanel northPaneCreate() { private JPanel northPaneCreate() {
JPanel northPane = new JPanel(); JPanel northPane = new JPanel();
northPane.setLayout(new FlowLayout(FlowLayout.LEFT)); northPane.setLayout(new FlowLayout(FlowLayout.LEFT));
UIButton loadMap = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Import_Map")); UIButton loadMap = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Import_Map"));
loadMap.setPreferredSize(new Dimension(160, 20)); loadMap.setPreferredSize(new Dimension(160, 20));
northPane.add(loadMap); northPane.add(loadMap);
loadMap.addActionListener(selectPictureActionListener); loadMap.addActionListener(selectPictureActionListener);
if(isNeedDataSource){ if (isNeedDataSource) {
UILabel label =new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Table_Data") + ":", SwingConstants.RIGHT) ; UILabel label = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Table_Data") + ":", SwingConstants.RIGHT);
tableDataNameBox = new DatabaseTableDataPane(label) { tableDataNameBox = new DatabaseTableDataPane(label) {
protected void userEvent() { protected void userEvent() {
refreshAreaNameBox(); refreshAreaNameBox();
} }
}; };
tableDataNameBox.setPreferredSize(new Dimension(200, 20)); tableDataNameBox.setPreferredSize(new Dimension(200, 20));
northPane.add(tableDataNameBox); northPane.add(tableDataNameBox);
@ -100,158 +102,156 @@ refreshAreaNameBox();
areaString.setPreferredSize(new Dimension(120, 20)); areaString.setPreferredSize(new Dimension(120, 20));
areaString.addItemListener(areaChange); areaString.addItemListener(areaChange);
northPane.add(areaString); northPane.add(areaString);
} }
return northPane; return northPane;
} }
private ActionListener selectPictureActionListener = new ActionListener() { private ActionListener selectPictureActionListener = new ActionListener() {
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
JFileChooser svgFileChooser = new JFileChooser(); FileChooserProvider fileChooserProvider = new JavaFxNativeFileChooser.Builder().
svgFileChooser.addChoosableFileFilter(new SVGFileFilter()); filter(".svg, .svgz", "*.svg", "*.svgz").
if (StringUtils.isNotBlank(lastSelectPath)) { currentDirectory(lastSelectPath).build();
svgFileChooser.setSelectedFile(new File(lastSelectPath)); int returnVal = fileChooserProvider.showDialog(DesignerContext.getDesignerFrame());
} if (returnVal != JFileChooser.CANCEL_OPTION) {
int returnVal = svgFileChooser.showOpenDialog(DesignerContext.getDesignerFrame()); File selectedFile = fileChooserProvider.getSelectedFile();
if (returnVal != JFileChooser.CANCEL_OPTION) { try {
File selectedFile = svgFileChooser.getSelectedFile(); lastSelectPath = selectedFile.getCanonicalPath();
try { } catch (Exception ex) {
lastSelectPath = selectedFile.getCanonicalPath(); FineLoggerFactory.getLogger().error(ex.getMessage(), ex);
} catch (Exception ex) { }
FineLoggerFactory.getLogger().error(ex.getMessage(), ex); if (selectedFile != null && selectedFile.isFile()) {
}
if (selectedFile != null && selectedFile.isFile()) {
imageShowPane.setSvgMap(selectedFile.getPath()); imageShowPane.setSvgMap(selectedFile.getPath());
imageShowPane.repaint(); imageShowPane.repaint();
} }
} }
} }
}; };
private ItemListener areaChange = new ItemListener() { private ItemListener areaChange = new ItemListener() {
public void itemStateChanged(ItemEvent e) { public void itemStateChanged(ItemEvent e) {
Object select = areaString.getSelectedItem(); Object select = areaString.getSelectedItem();
if (select != null) { if (select != null) {
String colName = Utils.objectToString(areaString.getSelectedItem()); String colName = Utils.objectToString(areaString.getSelectedItem());
TableDataWrapper tableDataWrappe = tableDataNameBox.getTableDataWrapper(); TableDataWrapper tableDataWrappe = tableDataNameBox.getTableDataWrapper();
imageShowPane.refreshFromDataList(getColValuesInData(tableDataWrappe, colName)); imageShowPane.refreshFromDataList(getColValuesInData(tableDataWrappe, colName));
} }
} }
}; };
public static List<String> getColValuesInData(TableDataWrapper tableDataWrappe, String colName) { public static List<String> getColValuesInData(TableDataWrapper tableDataWrappe, String colName) {
List<String> colValues = new ArrayList<>(); List<String> colValues = new ArrayList<>();
EmbeddedTableData embeddedTableData = null; EmbeddedTableData embeddedTableData = null;
try { try {
embeddedTableData = DesignTableDataManager.previewTableDataNotNeedInputParameters(tableDataWrappe.getTableData(), TableData.RESULT_ALL, false); embeddedTableData = DesignTableDataManager.previewTableDataNotNeedInputParameters(tableDataWrappe.getTableData(), TableData.RESULT_ALL, false);
} catch (Exception ee) { } catch (Exception ee) {
FineLoggerFactory.getLogger().error(ee.getMessage(), ee); FineLoggerFactory.getLogger().error(ee.getMessage(), ee);
} }
if(embeddedTableData == null){ if (embeddedTableData == null) {
return colValues; return colValues;
} }
int columnIndex = getColumnIndex(embeddedTableData, colName); int columnIndex = getColumnIndex(embeddedTableData, colName);
if(columnIndex == DataModel.COLUMN_NAME_NOT_FOUND){ if (columnIndex == DataModel.COLUMN_NAME_NOT_FOUND) {
return colValues; return colValues;
} }
for (int rowIndex = 0, rowCount = embeddedTableData.getRowCount(); rowIndex < rowCount; rowIndex++) { for (int rowIndex = 0, rowCount = embeddedTableData.getRowCount(); rowIndex < rowCount; rowIndex++) {
String colValueName = GeneralUtils.objectToString(embeddedTableData.getValueAt(rowIndex, columnIndex)); String colValueName = GeneralUtils.objectToString(embeddedTableData.getValueAt(rowIndex, columnIndex));
if (!colValues.contains(colValueName)) { if (!colValues.contains(colValueName)) {
colValues.add(colValueName); colValues.add(colValueName);
} }
} }
return colValues; return colValues;
} }
private static int getColumnIndex(EmbeddedTableData tableData, String colName) { private static int getColumnIndex(EmbeddedTableData tableData, String colName) {
for (int columnIndex = 0, columnCount = tableData.getColumnCount(); columnIndex < columnCount; columnIndex++) { for (int columnIndex = 0, columnCount = tableData.getColumnCount(); columnIndex < columnCount; columnIndex++) {
if (ComparatorUtils.tableDataColumnNameEquals(tableData.getColumnName(columnIndex), colName)) { if (ComparatorUtils.tableDataColumnNameEquals(tableData.getColumnName(columnIndex), colName)) {
return columnIndex; return columnIndex;
} }
} }
return DataModel.COLUMN_NAME_NOT_FOUND; return DataModel.COLUMN_NAME_NOT_FOUND;
} }
/** /**
* 选中方式: 区域或者点 * 选中方式: 区域或者点
*/ */
public void setImageSelectType(int selectType) { public void setImageSelectType(int selectType) {
if (imageShowPane != null) { if (imageShowPane != null) {
imageShowPane.setEditType(selectType); imageShowPane.setEditType(selectType);
} }
} }
private void refreshAreaNameBox() {// 刷新区域名称列表 private void refreshAreaNameBox() {// 刷新区域名称列表
if(!isNeedDataSource){ if (!isNeedDataSource) {
return; return;
} }
TableDataWrapper tableDataWrappe = tableDataNameBox.getTableDataWrapper(); TableDataWrapper tableDataWrappe = tableDataNameBox.getTableDataWrapper();
if (tableDataWrappe == null) { if (tableDataWrappe == null) {
return; return;
} }
List<String> columnNameList = tableDataWrappe.calculateColumnNameList(); List<String> columnNameList = tableDataWrappe.calculateColumnNameList();
Object oldSelected = areaString.getSelectedItem(); Object oldSelected = areaString.getSelectedItem();
areaString.removeAllItems(); areaString.removeAllItems();
for(String item : columnNameList) { for (String item : columnNameList) {
areaString.addItem(item); areaString.addItem(item);
} }
areaString.getModel().setSelectedItem(oldSelected); areaString.getModel().setSelectedItem(oldSelected);
} }
/** /**
* 当前正在编辑的条目的类别(国家省市)名和地图名 * 当前正在编辑的条目的类别(国家省市)名和地图名
* @param typeName 类别名 * @param typeName 类别名
* @param mapName 地图名 * @param mapName 地图名
*/ */
public void setTypeNameAndMapName(String typeName, String mapName){ public void setTypeNameAndMapName(String typeName, String mapName) {
imageShowPane.setTypeNameAndMapName(typeName, mapName); imageShowPane.setTypeNameAndMapName(typeName, mapName);
} }
/** /**
* 根据地图名称 加载信息 * 根据地图名称 加载信息
*/ */
public void populateBean(String list) { public void populateBean(String list) {
imageShowPane.populateBean(list); imageShowPane.populateBean(list);
} }
/** /**
* 根据地图名称 保存信息 * 根据地图名称 保存信息
*/ */
public String updateBean() { public String updateBean() {
// 地图类型等 加入Helper // 地图类型等 加入Helper
return imageShowPane.updateBean(); return imageShowPane.updateBean();
} }
@Override @Override
protected String title4PopupWindow() { protected String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom_Map"); return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom_Map");
} }
/** /**
* 更新界面 * 更新界面
* @param attr 地图属性 * @param attr 地图属性
*/ */
public void populateMapAttr(MapSvgAttr attr) { public void populateMapAttr(MapSvgAttr attr) {
imageShowPane.populateMapSvgAttr(attr); imageShowPane.populateMapSvgAttr(attr);
} }
/** /**
* 更新MapSvgAttr * 更新MapSvgAttr
* @return 返回属性 * @return 返回属性
*/ */
public MapSvgAttr updateCurrentAttr() { public MapSvgAttr updateCurrentAttr() {
return imageShowPane.updateWithOutSave(); return imageShowPane.updateWithOutSave();
} }
} }

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); reshuffleBorderPaintingEffectIfTitleExists(titleParent, titleCreator, bodyXCreator);
reshuffleBackgroundPaintingEffectIfTitleExists(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; this.bodyBackgroundOpacity4Painting = opacity;
} }
@Override
protected void initBorderAndBackgroundStyle() {
setBorder(null);
setBorderImage4Painting(null, 0.0);
setBackground4Painting(null, 0.0);
}
@Override @Override
protected void initXCreatorProperties() { protected void initXCreatorProperties() {
super.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 @Override
public void firePropertyChange(){ public void firePropertyChange(){
return; XWCardLayout cardLayout = this.getCardPart();
if (cardLayout != null && cardLayout.toData() != null) {
cardLayout.initStyle();
}
} }

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

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

@ -3,9 +3,7 @@
*/ */
package com.fr.design.gui.xpane; package com.fr.design.gui.xpane;
import com.fr.form.ui.LayoutBorderStyle; import javax.swing.JPanel;
import javax.swing.*;
/** /**
* CardTagLayoutBorderPane Pane. * CardTagLayoutBorderPane Pane.
@ -14,14 +12,13 @@ public class CardTagLayoutStylePane extends LayoutStylePane {
@Override @Override
protected JPanel createTitleStylePane(){ protected JPanel createTitleStylePane(){
return null; JPanel panel = super.createTitleStylePane();
panel.setVisible(false);
return panel;
} }
@Override @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; protected UIPercentDragPane titleBackgroundOpacityPane;
private boolean supportBorderImage = false;
public LayoutStylePane() { public LayoutStylePane() {
this(false);
}
public LayoutStylePane(boolean supportBorderImage) {
this.supportBorderImage = supportBorderImage;
this.initLayout(); this.initLayout();
} }
@ -103,7 +110,7 @@ public class LayoutStylePane extends BasicBeanPane<LayoutBorderStyle> {
JPanel titlePane = createTitleStylePane(); JPanel titlePane = createTitleStylePane();
JPanel bodyContentPane = currentIsRootLayout ? createBodyContentPane4RootLayout() : createBodyContentPane(); JPanel bodyContentPane = currentIsRootLayout ? createBodyContentPane4RootLayout() : createBodyContentPane();
JPanel backgroundPane = createBackgroundStylePane(); JPanel backgroundPane = createBackgroundStylePane(true);
if (titlePane != null) { if (titlePane != null) {
container.add(titlePane, BorderLayout.NORTH); container.add(titlePane, BorderLayout.NORTH);
@ -128,14 +135,14 @@ public class LayoutStylePane extends BasicBeanPane<LayoutBorderStyle> {
this.add(container, BorderLayout.CENTER); this.add(container, BorderLayout.CENTER);
} }
protected JPanel createBackgroundStylePane() { protected JPanel createBackgroundStylePane(boolean supportCornerRadius) {
borderStyleCombo = new UIComboBox(BORDER_STYLE); borderStyleCombo = new UIComboBox(BORDER_STYLE);
borderLineAndImagePane = new BorderLineAndImagePane(); borderLineAndImagePane = new BorderLineAndImagePane(this.supportBorderImage);
cornerSpinner = new UISpinner(0,1000,1,0); cornerSpinner = new UISpinner(0,1000,1,0);
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double f = TableLayout.FILL; 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}; double[] columnSize = {SETTING_LABEL_WIDTH, f};
UILabel uiLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget-Style_Background_Style")); 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.ActionListener;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.geom.RoundRectangle2D; 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); imagePreviewPane.setBounds(0, 0, IMAGE_PREVIEW_SIZE, IMAGE_PREVIEW_SIZE);
imagePreviewOverlayPane.setBounds(1, 1, IMAGE_PREVIEW_SIZE - 2, IMAGE_PREVIEW_SIZE - 2); 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); imageDeleteButton.setBounds(IMAGE_PREVIEW_SIZE - DELETE_BUTTON_SIZE, 0, DELETE_BUTTON_SIZE, DELETE_BUTTON_SIZE);
deletableImagePreviewPane.add(imageDeleteButton, 0);
deletableImagePreviewPane.add(imagePreviewOverlayPane, 1); JPanel mousePane = new JPanel();
deletableImagePreviewPane.add(imagePreviewPane, 2); 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); imagePreviewOverlayPane.setVisible(false);
imageDeleteButton.setVisible(false); imageDeleteButton.setVisible(false);
imageDeleteButton.setEnabled(false); imageDeleteButton.setEnabled(false);
deletableImagePreviewPane.addMouseListener(new MouseAdapter() { mousePane.addMouseListener(new MouseAdapter() {
@Override @Override
public void mouseEntered(MouseEvent e) { public void mouseEntered(MouseEvent e) {
super.mouseEntered(e); super.mouseEntered(e);
@ -119,6 +125,25 @@ public class TitleInsetImagePane extends JPanel implements UIObserver {
imageDeleteButton.setVisible(false); imageDeleteButton.setVisible(false);
imageDeleteButton.setEnabled(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( return TableLayoutHelper.createCommonTableLayoutPane(
@ -207,20 +232,6 @@ public class TitleInsetImagePane extends JPanel implements UIObserver {
}).dealWithImageFile(returnVal); }).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) { public void populateBean(TitlePacker packer) {

10
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.beans.events.DesignerEvent;
import com.fr.design.designer.creator.XCreatorUtils; import com.fr.design.designer.creator.XCreatorUtils;
import com.fr.design.fun.FormWidgetOptionProvider; 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.FormWidgetOption;
import com.fr.design.gui.core.UserDefinedWidgetOption; import com.fr.design.gui.core.UserDefinedWidgetOption;
import com.fr.design.gui.core.WidgetOption; import com.fr.design.gui.core.WidgetOption;
@ -38,20 +39,20 @@ import javax.swing.JComponent;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JSeparator; import javax.swing.JSeparator;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import java.awt.Cursor;
import java.awt.event.MouseListener;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
import java.awt.Cursor;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.FlowLayout; import java.awt.FlowLayout;
import java.awt.event.ComponentAdapter; import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent; import java.awt.event.ComponentEvent;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
/** /**
* @author null * @author null
@ -105,7 +106,8 @@ public class FormParaWidgetPane extends JPanel {
public boolean accept(PluginContext context) { public boolean accept(PluginContext context) {
return context.contain(PluginModule.ExtraDesign, FormWidgetOptionProvider.XML_TAG) 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);
} }
}); });
} }
@ -246,7 +248,7 @@ public class FormParaWidgetPane extends JPanel {
private JPanel createComponentReuseToolPane() { private JPanel createComponentReuseToolPane() {
JPanel jPanel = new JPanel(new BorderLayout(17, 10)); JPanel jPanel = new JPanel(new BorderLayout(17, 10));
UILabel uiLabel = new UILabel(BaseUtils.readIcon("/com/fr/design/images/form/designer/widget_apply_icon.png")); UILabel uiLabel = new UILabel(BaseUtils.readIcon("/com/fr/design/images/form/designer/widget_apply_icon.png"));
uiLabel.setBorder(BorderFactory.createEmptyBorder(5, 0 ,5, 0)); uiLabel.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0));
jPanel.addMouseListener(new MouseListener() { jPanel.addMouseListener(new MouseListener() {
@Override @Override
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {

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.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.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.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;
@ -17,6 +19,8 @@ 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;
@ -42,23 +46,16 @@ public class InstallComponentAction extends UpdateAction {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
FileChooserProvider fileChooserProvider =
if (SupportOSImpl.NATIVE_CHOOSER.support()) { new JavaFxNativeFileChooser.Builder().
UINativeFileChooser nativeFileChooser = new UINativeFileChooser(); fileSelectionMode(FileSelectionMode.MULTIPLE_FILE).
nativeFileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); title(Toolkit.i18nText("Fine-Design_Basic_Select")).
nativeFileChooser.setMultiSelectionEnabled(true); filters(new FileChooser.ExtensionFilter[]{
nativeFileChooser.setFileFilter(new FileNameExtensionFilter("reu reus", "reu", "reus")); new FileChooser.ExtensionFilter("reu", "*.reu"),
nativeFileChooser.setDialogTitle(Toolkit.i18nText("Fine-Design_Basic_Select")); new FileChooser.ExtensionFilter("reus", "*.reus")}).
int returnValue = nativeFileChooser.showOpenDialog(new UILabel()); build();
installComponent(returnValue, nativeFileChooser.getSelectedFiles()); int returnValue = fileChooserProvider.showDialog(null);
} else { installComponent(returnValue, fileChooserProvider.getSelectedFiles());
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());
}
} }
private void installComponent(int returnValue, File[] selectedFiles) { 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) { protected DefaultSharableEditor createSharableEditor(Form form, Map<String, Object> paraMap, Widget widget, DefaultSharableWidget info) {
String uuid = info.getId(); String uuid = info.getId();
((AbstractBorderStyleWidget) widget).addWidgetAttrMark(new SharableAttrMark()); AbstractBorderStyleWidget abstractBorderStyleWidget = (AbstractBorderStyleWidget) widget;
((AbstractBorderStyleWidget) widget).addWidgetAttrMark(new ExtendSharableAttrMark(uuid)); 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); 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() { public void initComponent() {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel advancePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel advancePane = FRGUIPaneFactory.createBorderLayout_S_Pane();
stylePane = new LayoutStylePane(); stylePane = new LayoutStylePane(true);
advancePane.add(stylePane, BorderLayout.NORTH); advancePane.add(stylePane, BorderLayout.NORTH);
JPanel centerPane = createCenterPane(); JPanel centerPane = createCenterPane();
if(centerPane!=null){ if(centerPane!=null){

Loading…
Cancel
Save