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-55756 设计器界面移动时,工具栏保持停留原位置,没有随着移动,这个看下要不要优化下。鼠标再回到设计画布就好了
  REPORT-56532 文件选择器弹窗 && REPORT-56683 文件选择器弹窗-图片压缩功能入口迁移的初次提示问题
feature/10.0
方磊 3 years ago
parent
commit
ff116685b1
  1. 18
      designer-base/src/main/java/com/fr/design/PluginClassRefreshManager.java
  2. 2
      designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java
  3. 87
      designer-base/src/main/java/com/fr/design/gui/ifilechooser/JavaFxNativeFileChooser.java
  4. 8
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java
  5. 4
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  6. 15
      designer-base/src/main/java/com/fr/design/style/background/image/ImageFileChooser.java
  7. 7
      designer-form/src/main/java/com/fr/design/mainframe/JForm.java
  8. 8
      designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java

18
designer-base/src/main/java/com/fr/design/PluginClassRefreshManager.java

@ -4,6 +4,8 @@ import com.fr.design.constants.DesignerLaunchStatus;
import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.fun.HyperlinkProvider; import com.fr.design.fun.HyperlinkProvider;
import com.fr.design.fun.TableDataDefineProvider; import com.fr.design.fun.TableDataDefineProvider;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.ui.util.UIUtil;
import com.fr.plugin.observer.PluginEvent; import com.fr.plugin.observer.PluginEvent;
import com.fr.plugin.observer.PluginEventListener; import com.fr.plugin.observer.PluginEventListener;
import com.fr.plugin.observer.PluginEventType; import com.fr.plugin.observer.PluginEventType;
@ -28,7 +30,7 @@ public class PluginClassRefreshManager {
@Override @Override
public void on(PluginEvent event) { public void on(PluginEvent event) {
// 重载模版之前 触发下hide // 重载模版之前 触发下hide
HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().fireTabChange(); fireTabChange();
// 兼容之前版本特性 // 兼容之前版本特性
for (String tag : context) { for (String tag : context) {
if (event.getContext().contain(tag)) { if (event.getContext().contain(tag)) {
@ -53,12 +55,24 @@ public class PluginClassRefreshManager {
public void on(PluginEvent event) { public void on(PluginEvent event) {
PluginListenerRegistration.getInstance().listen(PluginEventType.AfterRun, pluginAfterRunEventListener); PluginListenerRegistration.getInstance().listen(PluginEventType.AfterRun, pluginAfterRunEventListener);
if (DesignerLaunchStatus.getStatus() != DesignerLaunchStatus.WORKSPACE_INIT_COMPLETE) { if (DesignerLaunchStatus.getStatus() != DesignerLaunchStatus.WORKSPACE_INIT_COMPLETE) {
HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().fireTabChange(); fireTabChange();
HistoryTemplateListCache.getInstance().reloadAllEditingTemplate(); HistoryTemplateListCache.getInstance().reloadAllEditingTemplate();
} }
} }
}; };
public void fireTabChange() {
JTemplate<?, ?> template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (template != null) {
UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override
public void run() {
template.fireTabChange();
}
});
}
}
public static PluginClassRefreshManager getInstance() { public static PluginClassRefreshManager getInstance() {
return INSTANCE; return INSTANCE;

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

@ -503,7 +503,7 @@ public class PreferencePane extends BasicPane {
new JavaFxNativeFileChooser.Builder(). new JavaFxNativeFileChooser.Builder().
fileSelectionMode(FileSelectionMode.DIR). fileSelectionMode(FileSelectionMode.DIR).
build(); build();
int saveValue = fileChooserProvider.showDialog(null); int saveValue = fileChooserProvider.showDialog(chooseDirBtn);
if (saveValue == JFileChooser.APPROVE_OPTION) { if (saveValue == JFileChooser.APPROVE_OPTION) {
File selectedFile = fileChooserProvider.getSelectedFile(); File selectedFile = fileChooserProvider.getSelectedFile();
logExportDirectoryField.setText(selectedFile.getAbsolutePath()); logExportDirectoryField.setText(selectedFile.getAbsolutePath());

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

@ -2,16 +2,22 @@ package com.fr.design.gui.ifilechooser;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.upm.UpmUtils; import com.fr.design.mainframe.DesignerContext;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
import com.sun.javafx.application.PlatformImpl; import com.sun.javafx.application.PlatformImpl;
import javafx.application.Platform;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.layout.Background;
import javafx.scene.layout.BackgroundFill;
import javafx.scene.paint.Color;
import javafx.stage.DirectoryChooser; import javafx.stage.DirectoryChooser;
import javafx.stage.FileChooser; import javafx.stage.FileChooser;
import javafx.stage.Window; import javafx.stage.Modality;
import javafx.stage.Stage;
import javafx.stage.StageStyle;
import javax.swing.*; import javax.swing.*;
import javax.swing.filechooser.FileNameExtensionFilter;
import java.awt.*; import java.awt.*;
import java.io.File; import java.io.File;
import java.util.List; import java.util.List;
@ -40,9 +46,17 @@ public class JavaFxNativeFileChooser implements FileChooserProvider {
@Override @Override
public int showDialog(Component parent) { public int showDialog(Component parent) {
final CountDownLatch latch = new CountDownLatch(1); final CountDownLatch latch = new CountDownLatch(1);
PlatformImpl.startup(new Runnable() { PlatformImpl.startup(() -> {
});
Platform.setImplicitExit(false);
Platform.runLater(new Runnable() {
@Override @Override
public void run() { public void run() {
Component fileChooserParent = parent;
if (fileChooserParent == null) {
fileChooserParent = DesignerContext.getDesignerFrame();
}
Stage stage = showCoverStage(fileChooserParent);
try { try {
if (fileSelectionMode == FileSelectionMode.FILE || fileSelectionMode == FileSelectionMode.MULTIPLE_FILE) { if (fileSelectionMode == FileSelectionMode.FILE || fileSelectionMode == FileSelectionMode.MULTIPLE_FILE) {
FileChooser fileChooser = new FileChooser(); FileChooser fileChooser = new FileChooser();
@ -50,12 +64,12 @@ public class JavaFxNativeFileChooser implements FileChooserProvider {
fileChooser.getExtensionFilters().addAll(filters); fileChooser.getExtensionFilters().addAll(filters);
fileChooser.setInitialDirectory(currentDirectory); fileChooser.setInitialDirectory(currentDirectory);
if (fileSelectionMode == FileSelectionMode.FILE) { if (fileSelectionMode == FileSelectionMode.FILE) {
File file = fileChooser.showOpenDialog(null); File file = fileChooser.showOpenDialog(stage);
if (file != null) { if (file != null) {
selectedFiles = new File[]{file}; selectedFiles = new File[]{file};
} }
} else if (fileSelectionMode == FileSelectionMode.MULTIPLE_FILE) { } else if (fileSelectionMode == FileSelectionMode.MULTIPLE_FILE) {
List<File> fileList = fileChooser.showOpenMultipleDialog(null); List<File> fileList = fileChooser.showOpenMultipleDialog(stage);
if (fileList != null) { if (fileList != null) {
selectedFiles = new File[fileList.size()]; selectedFiles = new File[fileList.size()];
fileList.toArray(selectedFiles); fileList.toArray(selectedFiles);
@ -65,17 +79,70 @@ public class JavaFxNativeFileChooser implements FileChooserProvider {
DirectoryChooser directoryChooser = new DirectoryChooser(); DirectoryChooser directoryChooser = new DirectoryChooser();
directoryChooser.setTitle(title); directoryChooser.setTitle(title);
directoryChooser.setInitialDirectory(currentDirectory); directoryChooser.setInitialDirectory(currentDirectory);
File folder = directoryChooser.showDialog(null); File folder = directoryChooser.showDialog(stage);
if (folder != null) { if (folder != null) {
selectedFiles = new File[]{folder}; selectedFiles = new File[]{folder};
} }
System.out.println(folder);
} }
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e, e.getMessage()); FineLoggerFactory.getLogger().error(e, e.getMessage());
} finally { } finally {
latch.countDown(); latch.countDown();
closeCoverStage(stage);
}
}
private void closeCoverStage(Stage stage) {
if (stage != null) {
stage.close();
closeCoverStage((Stage) stage.getOwner());
}
}
private Stage showCoverStage(Component component) {
try {
if (component == null)
return null;
Stage parentStage = showCoverStage(component.getParent());
if (component instanceof JDialog || component instanceof JFrame) {
return createStage(component.getX(), component.getY(), component.getWidth(), component.getHeight(), parentStage);
} else {
return parentStage;
}
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e, e.getMessage());
return null;
}
}
private Stage createStage(double x, double y, double w, double h, Stage parentStage) {
try {
Stage stage = new Stage();
stage.setX(x);
stage.setY(y);
stage.setWidth(w);
stage.setHeight(h);
stage.setOpacity(0.2);
stage.setResizable(false);
stage.initStyle(StageStyle.UNDECORATED);
Label label = new Label();
label.setBackground(
new Background(new BackgroundFill(Color.color(0.78, 0.78, 0.80, 0.5), null, null)));
stage.setScene(new Scene(label));
if (parentStage != null) {
stage.initOwner(parentStage);
stage.initModality(Modality.WINDOW_MODAL);
}
stage.show();
return stage;
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e, e.getMessage());
return null;
} }
} }
}); });

8
designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java

@ -275,6 +275,14 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
//刷新FixedPopupPane的位置 //刷新FixedPopupPane的位置
EastRegionContainerPane.getInstance().freshCurrentPopupPane(); EastRegionContainerPane.getInstance().freshCurrentPopupPane();
} }
@Override
public void componentMoved(ComponentEvent e) {
JTemplate<?, ?> template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (template != null) {
template.refreshFormDesigner();
}
}
}); });
this.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); this.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
this.setVisible(false); this.setVisible(false);

4
designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java

@ -221,6 +221,10 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
// do nothing // do nothing
} }
public void refreshFormDesigner() {
// do nothing
}
/** /**
* @deprecated move to cloud ops pluginleft only for compatible * @deprecated move to cloud ops pluginleft only for compatible

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

@ -32,11 +32,7 @@ public class ImageFileChooser {
new JavaFxNativeFileChooser.Builder(). new JavaFxNativeFileChooser.Builder().
fileSelectionMode(FileSelectionMode.FILE). fileSelectionMode(FileSelectionMode.FILE).
title(Toolkit.i18nText("Fine-Design_Basic_Open")). title(Toolkit.i18nText("Fine-Design_Basic_Open")).
filters(new FileChooser.ExtensionFilter[]{ filter(Toolkit.i18nText("Fine-Design_Basic_Image_Image_Files"), "*.jpg", "*.gif", "*.png", "*.bmp").
new FileChooser.ExtensionFilter("jpg", "*.jpg"),
new FileChooser.ExtensionFilter("gif", "*.gif"),
new FileChooser.ExtensionFilter("png", "*.png"),
new FileChooser.ExtensionFilter("bmp", "*.bmp")}).
build(); build();
} }
@ -72,8 +68,13 @@ public class ImageFileChooser {
private void showImageCompressMoveTip() { private void showImageCompressMoveTip() {
if (DesignerEnvManager.getEnvManager().isShowImageCompressMoveTip()) { if (DesignerEnvManager.getEnvManager().isShowImageCompressMoveTip()) {
DesignerToastMsgUtil.toastWarning(Toolkit.i18nText("Fine-Design_Image_Compress_Move_Tip")); SwingUtilities.invokeLater(new Runnable() {
DesignerEnvManager.getEnvManager().setShowImageCompressMoveTip(false); @Override
public void run() {
DesignerToastMsgUtil.toastWarning(Toolkit.i18nText("Fine-Design_Image_Compress_Move_Tip"));
DesignerEnvManager.getEnvManager().setShowImageCompressMoveTip(false);
}
});
} }
} }
} }

7
designer-form/src/main/java/com/fr/design/mainframe/JForm.java

@ -1135,4 +1135,11 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
formDesign.hidePopup(); formDesign.hidePopup();
} }
} }
@Override
public void refreshFormDesigner() {
if (formDesign != null) {
formDesign.repaint();
}
}
} }

8
designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java

@ -1238,4 +1238,12 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
designer.hidePopup(); designer.hidePopup();
} }
} }
@Override
public void refreshFormDesigner() {
FormDesigner designer = (FormDesigner) parameterPane.getParaDesigner();
if (designer != null) {
designer.repaint();
}
}
} }

Loading…
Cancel
Save