Browse Source

Merge branch 'release/10.0' of https://code.fineres.com/scm/~lucian.chen/design into release/10.0

security/10.0
lucian 3 years ago
parent
commit
0b42a1d989
  1. 12
      designer-base/src/main/java/com/fr/common/exception/ThrowableHandler.java
  2. 11
      designer-base/src/main/java/com/fr/design/dialog/InformationWarnPane.java
  3. 23
      designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java
  4. 7
      designer-base/src/main/java/com/fr/design/gui/ifilechooser/JavaFxNativeFileChooser.java
  5. 26
      designer-base/src/main/java/com/fr/design/locale/impl/ShowOnlineWidgetMark.java
  6. 4
      designer-base/src/main/java/com/fr/design/mainframe/DesktopCardPane.java
  7. 25
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  8. 40
      designer-base/src/main/java/com/fr/design/utils/LoadingUtils.java
  9. 70
      designer-base/src/main/java/com/fr/design/worker/save/SaveFailureHandler.java
  10. 7
      designer-base/src/main/java/com/fr/design/worker/save/SaveWorker.java
  11. 0
      designer-base/src/main/resources/com/fr/design/images/mainframe/loading.png
  12. 4
      designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java
  13. 10
      designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java
  14. 6
      designer-form/src/main/java/com/fr/design/mainframe/share/sort/OnlineWidgetSortType.java
  15. 7
      designer-form/src/main/java/com/fr/design/mainframe/share/util/ShareComponentUtils.java
  16. 6
      designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRAbsoluteBodyLayoutDefinePane.java
  17. 13
      designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java
  18. 18
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/FileSearchManager.java
  19. 4
      designer-realize/src/main/java/com/fr/design/mainframe/app/DesignerAppUtils.java
  20. 7
      designer-realize/src/main/java/com/fr/design/write/submit/SmartInsertDBManipulationPane.java
  21. 4
      designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java

12
designer-base/src/main/java/com/fr/common/exception/ThrowableHandler.java

@ -0,0 +1,12 @@
package com.fr.common.exception;
/**
* @author hades
* @version 10.0
* Created by hades on 2021/12/27
*/
public interface ThrowableHandler {
boolean process(Throwable e);
}

11
designer-base/src/main/java/com/fr/design/dialog/InformationWarnPane.java

@ -38,6 +38,17 @@ public class InformationWarnPane extends JPanel{
showWindow(SwingUtilities.getWindowAncestor(this)).setVisible(true); showWindow(SwingUtilities.getWindowAncestor(this)).setVisible(true);
} }
public void showOnFront() {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
AlertDialog dialog = showWindow(SwingUtilities.getWindowAncestor(InformationWarnPane.this));
dialog.setVisible(true);
dialog.toFront();
}
});
}
public InformationWarnPane(String infor, String moreInfo, String title) { public InformationWarnPane(String infor, String moreInfo, String title) {
this.title = title; this.title = title;
this.setLayout(null); this.setLayout(null);

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

@ -15,7 +15,6 @@ import com.fr.design.mainframe.JVirtualTemplate;
import com.fr.design.ui.util.UIUtil; import com.fr.design.ui.util.UIUtil;
import com.fr.file.FILE; import com.fr.file.FILE;
import com.fr.file.FileNodeFILE; import com.fr.file.FileNodeFILE;
import com.fr.file.StashedFILE;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.invoke.ClassHelper; import com.fr.invoke.ClassHelper;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
@ -25,7 +24,7 @@ import com.fr.stable.CoreConstants;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.third.org.apache.commons.io.FilenameUtils; import com.fr.third.org.apache.commons.io.FilenameUtils;
import java.io.ByteArrayOutputStream; import javax.swing.SwingWorker;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
@ -33,7 +32,6 @@ import java.util.List;
import java.util.ListIterator; import java.util.ListIterator;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import javax.swing.SwingWorker;
/** /**
* 历史模板缓存 * 历史模板缓存
@ -360,7 +358,7 @@ public class HistoryTemplateListCache implements CallbackEvent {
int size = historyList.size(); int size = historyList.size();
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
JTemplate<?, ?> template = historyList.get(i); JTemplate<?, ?> template = historyList.get(i);
FILE file = templateToStashFile(template); FILE file = template.templateToStashFile();
if (file != null) { if (file != null) {
stashFILEMap.put(i, file); stashFILEMap.put(i, file);
} }
@ -368,21 +366,6 @@ public class HistoryTemplateListCache implements CallbackEvent {
FineLoggerFactory.getLogger().info("Env Change Template Stashed."); FineLoggerFactory.getLogger().info("Env Change Template Stashed.");
} }
private FILE templateToStashFile(JTemplate<?, ?> template) {
FILE file = template.getEditingFILE();
try {
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
BaseBook target = template.getTarget();
if (target != null) {
target.export(outputStream);
return new StashedFILE(file, outputStream.toByteArray(), template.suffix());
}
// 如果 target == null 那么这个模板是被模板内存优化功能处理过的,不用处理
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
return null;
}
private boolean checkStash() { private boolean checkStash() {
try { try {
@ -465,7 +448,7 @@ public class HistoryTemplateListCache implements CallbackEvent {
FILE file = template.getEditingFILE(); FILE file = template.getEditingFILE();
boolean needReload = context == null || needReloadTemplate(context, template); boolean needReload = context == null || needReloadTemplate(context, template);
if (needReload) { if (needReload) {
FILE stashFile = templateToStashFile(template); FILE stashFile = template.templateToStashFile();
if (stashFile != null) { if (stashFile != null) {
FineLoggerFactory.getLogger().info("{} is being reloaded", file.getName()); FineLoggerFactory.getLogger().info("{} is being reloaded", file.getName());
template.refreshResource(stashFile); template.refreshResource(stashFile);

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

@ -197,7 +197,9 @@ public class JavaFxNativeFileChooser implements FileChooserProvider {
private File currentDirectory; private File currentDirectory;
public Builder fileSelectionMode(FileSelectionMode fileSelectionMode) { public Builder fileSelectionMode(FileSelectionMode fileSelectionMode) {
if (fileSelectionMode != null) {
this.fileSelectionMode = fileSelectionMode; this.fileSelectionMode = fileSelectionMode;
}
return this; return this;
} }
@ -209,14 +211,18 @@ public class JavaFxNativeFileChooser implements FileChooserProvider {
} }
public Builder filters(FileChooser.ExtensionFilter[] filters) { public Builder filters(FileChooser.ExtensionFilter[] filters) {
if (filters != null) {
this.filters = filters; this.filters = filters;
}
return this; return this;
} }
public Builder filters(ExtensionFilter[] filters) { public Builder filters(ExtensionFilter[] filters) {
if (filters != null) {
for (ExtensionFilter filter : filters) { for (ExtensionFilter filter : filters) {
this.filters = ArrayUtils.add(this.filters, new FileChooser.ExtensionFilter(filter.getDes(), filter.getExtensions())); this.filters = ArrayUtils.add(this.filters, new FileChooser.ExtensionFilter(filter.getDes(), filter.getExtensions()));
} }
}
return this; return this;
} }
@ -227,7 +233,6 @@ public class JavaFxNativeFileChooser implements FileChooserProvider {
return this; return this;
} }
public Builder currentDirectory(File currentDirectory) { public Builder currentDirectory(File currentDirectory) {
if (currentDirectory != null) { if (currentDirectory != null) {
if (!currentDirectory.isDirectory()) { if (!currentDirectory.isDirectory()) {

26
designer-base/src/main/java/com/fr/design/locale/impl/ShowOnlineWidgetMark.java

@ -0,0 +1,26 @@
package com.fr.design.locale.impl;
import com.fr.general.GeneralContext;
import com.fr.general.locale.LocaleMark;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
public class ShowOnlineWidgetMark implements LocaleMark<Boolean> {
private Map<Locale, Boolean> map = new HashMap<>();
public ShowOnlineWidgetMark() {
map.put(Locale.CHINA, true);
map.put(Locale.TAIWAN, true);
map.put(Locale.US, false);
map.put(Locale.KOREA, false);
map.put(Locale.JAPAN, false);
}
@Override
public Boolean getValue() {
Boolean result = map.get(GeneralContext.getLocale());
return result == null ? false : result;
}
}

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

@ -10,9 +10,11 @@ import com.fr.design.data.BasicTableDataTreePane;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.event.TargetModifiedEvent; import com.fr.design.event.TargetModifiedEvent;
import com.fr.design.event.TargetModifiedListener; import com.fr.design.event.TargetModifiedListener;
import com.fr.design.utils.LoadingUtils;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.JLayeredPane; import javax.swing.JLayeredPane;
import javax.swing.JPanel;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Component; import java.awt.Component;
@ -31,7 +33,7 @@ public class DesktopCardPane extends BasicPane implements TargetModifiedListener
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private JTemplate<?, ?> component; private JTemplate<?, ?> component;
private TransparentPane transparentPane = new TransparentPane(); private TransparentPane transparentPane = new TransparentPane();
private OpenLoadingPane loadingPane = new OpenLoadingPane(); private JPanel loadingPane = LoadingUtils.createLoadingPane();
private OpenFailedPane failedPane = new OpenFailedPane(); private OpenFailedPane failedPane = new OpenFailedPane();
private JLayeredPane layeredPane = new JLayeredPane() { private JLayeredPane layeredPane = new JLayeredPane() {
@Override @Override

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

@ -50,12 +50,14 @@ import com.fr.design.ui.util.UIUtil;
import com.fr.design.utils.DesignUtils; import com.fr.design.utils.DesignUtils;
import com.fr.design.worker.save.CallbackSaveWorker; import com.fr.design.worker.save.CallbackSaveWorker;
import com.fr.design.worker.save.EmptyCallBackSaveWorker; import com.fr.design.worker.save.EmptyCallBackSaveWorker;
import com.fr.design.worker.save.SaveFailureHandler;
import com.fr.design.write.submit.DBManipulationInWidgetEventPane; import com.fr.design.write.submit.DBManipulationInWidgetEventPane;
import com.fr.design.write.submit.DBManipulationPane; import com.fr.design.write.submit.DBManipulationPane;
import com.fr.event.EventDispatcher; import com.fr.event.EventDispatcher;
import com.fr.file.FILE; import com.fr.file.FILE;
import com.fr.file.FILEChooserPane; import com.fr.file.FILEChooserPane;
import com.fr.file.MemFILE; import com.fr.file.MemFILE;
import com.fr.file.StashedFILE;
import com.fr.form.ui.NoneWidget; import com.fr.form.ui.NoneWidget;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
@ -84,6 +86,7 @@ import javax.swing.JComponent;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
import javax.swing.undo.UndoManager; import javax.swing.undo.UndoManager;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.io.ByteArrayOutputStream;
import java.util.Set; import java.util.Set;
import java.util.concurrent.Callable; import java.util.concurrent.Callable;
@ -371,6 +374,22 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
PluginListenerRegistration.getInstance().stopListen(this.pluginListener); PluginListenerRegistration.getInstance().stopListen(this.pluginListener);
} }
public FILE templateToStashFile() {
FILE file = this.getEditingFILE();
try {
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
BaseBook target = this.getTarget();
if (target != null) {
target.export(outputStream);
return new StashedFILE(file, outputStream.toByteArray(), template.suffix());
}
// 如果 target == null 那么这个模板是被模板内存优化功能处理过的,不用处理
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
return null;
}
/** /**
* 刷新内部资源 * 刷新内部资源
@ -882,7 +901,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
export(); export();
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), e.getMessage(), "Save Error", JOptionPane.ERROR_MESSAGE); SaveFailureHandler.getInstance().process(e);
return false; return false;
} }
this.editingFILE = editingFILE; this.editingFILE = editingFILE;
@ -1077,7 +1096,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
String info = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Open-New_Form_Tip"); String info = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Open-New_Form_Tip");
String moreInfo = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Server_Version_Tip_More_Info"); String moreInfo = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Server_Version_Tip_More_Info");
if (showTipPane) { if (showTipPane) {
new InformationWarnPane(info, moreInfo, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips")).show(); new InformationWarnPane(info, moreInfo, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips")).showOnFront();
} }
return true; return true;
} }
@ -1100,7 +1119,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
String infor = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Template_Version_Not_Match", DesignUtils.parseVersion(xmlDesignerVersion)); String infor = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Template_Version_Not_Match", DesignUtils.parseVersion(xmlDesignerVersion));
String moreInfo = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Server_Version_Tip_More_Info"); String moreInfo = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Server_Version_Tip_More_Info");
if (showTipPane) { if (showTipPane) {
new InformationWarnPane(infor, moreInfo, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips")).show(); new InformationWarnPane(infor, moreInfo, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips")).showOnFront();
} }
return true; return true;
} }

40
designer-base/src/main/java/com/fr/design/mainframe/OpenLoadingPane.java → designer-base/src/main/java/com/fr/design/utils/LoadingUtils.java

@ -1,35 +1,29 @@
package com.fr.design.mainframe; package com.fr.design.utils;
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.general.IOUtils; import com.fr.general.IOUtils;
import javax.swing.ImageIcon;
import javax.swing.JPanel;
import java.awt.Color; import java.awt.Color;
import java.awt.Component; import java.awt.Component;
import java.awt.Container; import java.awt.Container;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.LayoutManager; import java.awt.LayoutManager;
import javax.swing.ImageIcon;
import javax.swing.JPanel;
/**
* @author hades
* @version 10.0
* Created by hades on 2021/4/9
*/
public class OpenLoadingPane extends JPanel {
private static final ImageIcon LOADING_ICON = new ImageIcon(IOUtils.readImage("/com/fr/design/images/mainframe/openloading.png")); public class LoadingUtils {
private static final ImageIcon LOADING_ICON = new ImageIcon(IOUtils.readImage("/com/fr/design/images/mainframe/loading.png"));
private static final Color TIP_COLOR = new Color(108, 174, 235); private static final Color TIP_COLOR = new Color(108, 174, 235);
private static final int Y_GAP = 50; private static final int Y_GAP = 50;
private static final int X_GAP = 10; private static final int X_GAP = 10;
private UILabel loadingLabel; public static JPanel createLoadingPane() {
private UILabel tipLabel; JPanel jPanel = new JPanel();
UILabel loadingLabel = new UILabel(LOADING_ICON);
public OpenLoadingPane() { UILabel tipLabel = new UILabel(Toolkit.i18nText("Fine-Design_Loading"));
tipLabel.setForeground(TIP_COLOR);
setLayout(new LayoutManager() { jPanel.setLayout(new LayoutManager() {
@Override @Override
public void removeLayoutComponent(Component comp) { public void removeLayoutComponent(Component comp) {
} }
@ -64,12 +58,10 @@ public class OpenLoadingPane extends JPanel {
public void addLayoutComponent(String name, Component comp) { public void addLayoutComponent(String name, Component comp) {
} }
}); });
setBackground(Color.WHITE);
loadingLabel = new UILabel(LOADING_ICON);
tipLabel = new UILabel(Toolkit.i18nText("Fine-Design_Open_Template_Loading"));
tipLabel.setForeground(TIP_COLOR);
add(loadingLabel);
add(tipLabel);
jPanel.setBackground(Color.WHITE);
jPanel.add(loadingLabel);
jPanel.add(tipLabel);
return jPanel;
} }
} }

70
designer-base/src/main/java/com/fr/design/worker/save/SaveFailureHandler.java

@ -0,0 +1,70 @@
package com.fr.design.worker.save;
import com.fr.common.exception.ThrowableHandler;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext;
import com.fr.general.IOUtils;
import com.fr.workspace.exception.DiskSpaceFullException;
import java.awt.Frame;
import javax.swing.JOptionPane;
/**
* @author hades
* @version 10.0
* Created by hades on 2021/12/7
*/
public class SaveFailureHandler implements ThrowableHandler {
private static final SaveFailureHandler INSTANCE = new SaveFailureHandler();
public static SaveFailureHandler getInstance() {
return INSTANCE;
}
@Override
public boolean process(Throwable e) {
for (Handler handler : Handler.values()) {
if (handler.process(e)) {
break;
}
}
return true;
}
public enum Handler implements ThrowableHandler {
FullDisk {
@Override
public boolean process(Throwable e) {
if (e.getCause() instanceof DiskSpaceFullException
|| e instanceof DiskSpaceFullException
|| e.getCause().getCause() instanceof DiskSpaceFullException) {
FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(),
Toolkit.i18nText("Fine_Design_Template_Save_Failed_By_Full_Disk"),
Toolkit.i18nText("Fine-Design_Basic_Alert"),
JOptionPane.WARNING_MESSAGE,
IOUtils.readIcon("/com/fr/design/images/warnings/warning32.png"));
return true;
}
return false;
}
},
Other {
@Override
public boolean process(Throwable e) {
boolean minimized = (DesignerContext.getDesignerFrame().getExtendedState() & Frame.ICONIFIED ) != 0;
FineJOptionPane.showMessageDialog(
minimized ? null : DesignerContext.getDesignerFrame(),
Toolkit.i18nText("Fine-Design-Basic_Save_Failure"),
Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"),
JOptionPane.ERROR_MESSAGE);
return true;
}
};
}
}

7
designer-base/src/main/java/com/fr/design/worker/save/SaveWorker.java

@ -55,12 +55,7 @@ public class SaveWorker extends SwingWorker<Boolean, Void> {
} catch (Exception e) { } catch (Exception e) {
processResult(); processResult();
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
boolean minimized = (DesignerContext.getDesignerFrame().getExtendedState() & Frame.ICONIFIED ) != 0; SaveFailureHandler.getInstance().process(e);
FineJOptionPane.showMessageDialog(
minimized ? null : DesignerContext.getDesignerFrame(),
Toolkit.i18nText("Fine-Design-Basic_Save_Failure"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"),
JOptionPane.ERROR_MESSAGE);
return; return;
} }
processResult(); processResult();

0
designer-base/src/main/resources/com/fr/design/images/mainframe/openloading.png → designer-base/src/main/resources/com/fr/design/images/mainframe/loading.png

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

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

@ -196,7 +196,9 @@ public class FormParaWidgetPane extends JPanel {
JPanel componentsPara = new JPanel(new FlowLayout(FlowLayout.LEFT)); JPanel componentsPara = new JPanel(new FlowLayout(FlowLayout.LEFT));
WidgetOption[] chartOptions = loadChartOptions(); WidgetOption[] chartOptions = loadChartOptions();
for (WidgetOption chartOption : chartOptions) { for (WidgetOption chartOption : chartOptions) {
componentsPara.add(new ToolBarButton(chartOption)); ToolBarButton button = new ToolBarButton(chartOption);
button.setPreferredSize(new Dimension(widgetButtonWidth, widgetButtonHeight));
componentsPara.add(button);
} }
int x = COMMON_CHAR_NUM * (widgetButtonWidth + smallGAP); int x = COMMON_CHAR_NUM * (widgetButtonWidth + smallGAP);
int y = (int) Math.ceil(chartOptions.length / ((double) COMMON_CHAR_NUM)) * (widgetButtonHeight + smallGAP); int y = (int) Math.ceil(chartOptions.length / ((double) COMMON_CHAR_NUM)) * (widgetButtonHeight + smallGAP);

10
designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java

@ -6,10 +6,13 @@ import com.fr.design.gui.ibutton.UIHeadGroup;
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.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.locale.impl.ShowOnlineWidgetMark;
import com.fr.design.mainframe.reuse.ComponentReuseNotificationInfo; import com.fr.design.mainframe.reuse.ComponentReuseNotificationInfo;
import com.fr.design.mainframe.share.collect.ComponentCollector; import com.fr.design.mainframe.share.collect.ComponentCollector;
import com.fr.design.mainframe.share.ui.local.LocalWidgetRepoPane; import com.fr.design.mainframe.share.ui.local.LocalWidgetRepoPane;
import com.fr.design.mainframe.share.ui.online.OnlineWidgetRepoPane; import com.fr.design.mainframe.share.ui.online.OnlineWidgetRepoPane;
import com.fr.general.locale.LocaleCenter;
import com.fr.general.locale.LocaleMark;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.Icon; import javax.swing.Icon;
@ -166,6 +169,13 @@ public class FormWidgetDetailPane extends FormDockView{
paneList = new ArrayList<>(); paneList = new ArrayList<>();
paneList.add(LocalWidgetRepoPane.getInstance()); paneList.add(LocalWidgetRepoPane.getInstance());
paneList.add(OnlineWidgetRepoPane.getInstance()); paneList.add(OnlineWidgetRepoPane.getInstance());
if (isShowOnlineWidgetRepoPane()) {
paneList.add(OnlineWidgetRepoPane.getInstance());
}
} }
private boolean isShowOnlineWidgetRepoPane() {
LocaleMark<Boolean> localeMark = LocaleCenter.getMark(ShowOnlineWidgetMark.class);
return localeMark.getValue();
}
} }

6
designer-form/src/main/java/com/fr/design/mainframe/share/sort/OnlineWidgetSortType.java

@ -27,7 +27,11 @@ public enum OnlineWidgetSortType implements SortType<OnlineShareWidget> {
public int compare(OnlineShareWidget o1, OnlineShareWidget o2) { public int compare(OnlineShareWidget o1, OnlineShareWidget o2) {
double t1 = getSortValue(o1, parameterMap); double t1 = getSortValue(o1, parameterMap);
double t2 = getSortValue(o2, parameterMap); double t2 = getSortValue(o2, parameterMap);
return ComparatorUtils.compareCommonType(t2, t1); // Comparator中比较double/float相等时,不允许误差. 否则会违背 "若x = y , y = z, 则x = z"的约定。
// 因为允许误差的情况下,x和y间的误差在允许范围内,被判定相等,y和间的误差在允许范围内,被判定相等,
// 但x和z间的误差可能超出允许范围,从而不相等,因此会违背上述约定。
// 产生IllegalArgumentException: Comparison method violates its general contract!
return Double.compare(t2, t1);
} }
}); });
} }

7
designer-form/src/main/java/com/fr/design/mainframe/share/util/ShareComponentUtils.java

@ -8,14 +8,11 @@ import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWTitleLayout; import com.fr.design.designer.creator.XWTitleLayout;
import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.FormSelection;
import com.fr.design.mainframe.JForm;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.form.share.SharableWidgetProvider; import com.fr.form.share.SharableWidgetProvider;
import com.fr.form.share.bean.ShareLayoutWidget; import com.fr.form.share.bean.ShareLayoutWidget;
import com.fr.form.share.constants.ComponentPath; import com.fr.form.share.constants.ComponentPath;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
@ -38,9 +35,7 @@ public class ShareComponentUtils {
public static XCreator createXCreator(Widget creatorSource, String shareId, SharableWidgetProvider provider) { public static XCreator createXCreator(Widget creatorSource, String shareId, SharableWidgetProvider provider) {
XCreator xCreator; XCreator xCreator;
if (creatorSource instanceof WCardMainBorderLayout) { if (creatorSource instanceof ShareLayoutWidget) {
xCreator = XCreatorUtils.createXCreator(creatorSource, new Dimension(500, 300));
} else if (creatorSource instanceof ShareLayoutWidget) {
xCreator = XCreatorUtils.createXCreator(((ShareLayoutWidget) creatorSource).getWidget(), new Dimension(provider.getWidth(), provider.getHeight())); xCreator = XCreatorUtils.createXCreator(((ShareLayoutWidget) creatorSource).getWidget(), new Dimension(provider.getWidth(), provider.getHeight()));
} else { } else {
xCreator = XCreatorUtils.createXCreator(creatorSource, new Dimension(provider.getWidth(), provider.getHeight())); xCreator = XCreatorUtils.createXCreator(creatorSource, new Dimension(provider.getWidth(), provider.getHeight()));

6
designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRAbsoluteBodyLayoutDefinePane.java

@ -13,11 +13,9 @@ import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.xpane.LayoutStylePane; import com.fr.design.gui.xpane.LayoutStylePane;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.WidgetPropertyPane; import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.design.mainframe.widget.accessibles.AccessibleBodyWatermarkEditor; import com.fr.design.mainframe.widget.accessibles.AccessibleBodyWatermarkEditor;
import com.fr.design.utils.gui.UIComponentUtils;
import com.fr.design.widget.FRWidgetFactory; import com.fr.design.widget.FRWidgetFactory;
import com.fr.design.widget.ui.designer.component.WidgetBoundPane; import com.fr.design.widget.ui.designer.component.WidgetBoundPane;
import com.fr.form.ui.LayoutBorderStyle; import com.fr.form.ui.LayoutBorderStyle;
@ -25,7 +23,6 @@ import com.fr.form.ui.container.WAbsoluteBodyLayout;
import com.fr.form.ui.container.WAbsoluteLayout; import com.fr.form.ui.container.WAbsoluteLayout;
import com.fr.form.ui.container.WBodyLayoutType; import com.fr.form.ui.container.WBodyLayoutType;
import com.fr.form.ui.container.WFitLayout; import com.fr.form.ui.container.WFitLayout;
import com.fr.general.act.BorderPacker;
import com.fr.report.core.ReportUtils; import com.fr.report.core.ReportUtils;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
@ -134,7 +131,8 @@ public class FRAbsoluteBodyLayoutDefinePane extends FRAbsoluteLayoutDefinePane {
layoutCombox.setSelectedIndex(1); layoutCombox.setSelectedIndex(1);
stylePane.populateBean((LayoutBorderStyle) ob.getBorderStyle()); stylePane.populateBean((LayoutBorderStyle) ob.getBorderStyle());
boundPane.populate(); boundPane.populate();
watermarkEditor.setValue(ReportUtils.getWatermarkAttrFromTemplate(getCurrentIOFile())); //从全局读取水印
watermarkEditor.setValue(ReportUtils.getWatermarkAttrFromTemplateAndGlobal(getCurrentIOFile()));
} }
public WAbsoluteBodyLayout updateSubPane() { public WAbsoluteBodyLayout updateSubPane() {

13
designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java

@ -18,7 +18,6 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.gui.xpane.LayoutStylePane; import com.fr.design.gui.xpane.LayoutStylePane;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.FormSelectionUtils; import com.fr.design.mainframe.FormSelectionUtils;
@ -38,9 +37,12 @@ import com.fr.general.act.BorderPacker;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.report.core.ReportUtils; import com.fr.report.core.ReportUtils;
import javax.swing.*; import javax.swing.BorderFactory;
import javax.swing.border.Border; import javax.swing.DefaultComboBoxModel;
import java.awt.*; import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
/** /**
* Created by ibm on 2017/8/2. * Created by ibm on 2017/8/2.
@ -160,7 +162,8 @@ public class FRFitLayoutDefinePane extends AbstractFRLayoutDefinePane<WFitLayout
adaptComboBox.setSelectedIndex(ob.getCompState()); adaptComboBox.setSelectedIndex(ob.getCompState());
componentIntervel.setValue(ob.getCompInterval()); componentIntervel.setValue(ob.getCompInterval());
stylePane.populateBean((LayoutBorderStyle) ob.getBorderStyle()); stylePane.populateBean((LayoutBorderStyle) ob.getBorderStyle());
watermarkEditor.setValue(ReportUtils.getWatermarkAttrFromTemplate(getCurrentIOFile())); //从全局读取水印
watermarkEditor.setValue(ReportUtils.getWatermarkAttrFromTemplateAndGlobal(getCurrentIOFile()));
} }
private XLayoutContainer selectedBodyLayout(FormDesigner formDesigner) { private XLayoutContainer selectedBodyLayout(FormDesigner formDesigner) {

18
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/FileSearchManager.java

@ -11,10 +11,14 @@ import com.fr.design.mainframe.alphafine.cell.model.MoreModel;
import com.fr.design.mainframe.alphafine.model.SearchResult; import com.fr.design.mainframe.alphafine.model.SearchResult;
import com.fr.design.mainframe.alphafine.search.manager.fun.AlphaFineSearchProvider; import com.fr.design.mainframe.alphafine.search.manager.fun.AlphaFineSearchProvider;
import com.fr.file.filetree.FileNode; import com.fr.file.filetree.FileNode;
import com.fr.file.filetree.FileNodes;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
import com.fr.rpc.ExceptionHandler;
import com.fr.rpc.RPCInvokerExceptionInfo;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.project.ProjectConstants; import com.fr.stable.project.ProjectConstants;
import com.fr.workspace.WorkContext;
/** /**
@ -74,7 +78,12 @@ public class FileSearchManager implements AlphaFineSearchProvider {
return lessModelList; return lessModelList;
} }
AlphaFineHelper.checkCancel(); AlphaFineHelper.checkCancel();
fileNodes = FRContext.getFileNodes().list(ProjectConstants.REPORTLETS_NAME, AlphaFineConstants.FILE_EXTENSIONS, true); fileNodes = WorkContext.getCurrent().get(FileNodes.class, new ExceptionHandler() {
@Override
public Object callHandler(RPCInvokerExceptionInfo exceptionInfo) {
return FRContext.getFileNodes().list(ProjectConstants.REPORTLETS_NAME, AlphaFineConstants.FILE_EXTENSIONS, true);
}
}).list(ProjectConstants.REPORTLETS_NAME, AlphaFineConstants.FILE_EXTENSIONS, true, false);
isContainCpt = true; isContainCpt = true;
isContainFrm = true; isContainFrm = true;
doSearch(this.searchText); doSearch(this.searchText);
@ -128,7 +137,12 @@ public class FileSearchManager implements AlphaFineSearchProvider {
*/ */
private void doFileContentSearch(String searchText) { private void doFileContentSearch(String searchText) {
if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isContainFileContent()) { if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isContainFileContent()) {
FileNode[] fileNodes = FRContext.getFileNodes().filterFiles(searchText, ProjectConstants.REPORTLETS_NAME, new FileExtension[]{FileExtension.CPT, FileExtension.FRM}, true); FileNode[] fileNodes = WorkContext.getCurrent().get(FileNodes.class, new ExceptionHandler() {
@Override
public Object callHandler(RPCInvokerExceptionInfo exceptionInfo) {
return FRContext.getFileNodes().filterFiles(searchText, ProjectConstants.REPORTLETS_NAME, new FileExtension[]{FileExtension.CPT, FileExtension.FRM}, true);
}
}).filterFiles(searchText, ProjectConstants.REPORTLETS_NAME, new FileExtension[]{FileExtension.CPT, FileExtension.FRM}, true, false);
for (FileNode node : fileNodes) { for (FileNode node : fileNodes) {
FileModel model = new FileModel(node.getName(), node.getEnvPath()); FileModel model = new FileModel(node.getName(), node.getEnvPath());
if (!AlphaFineHelper.getFilterResult().contains(model) && !filterModelList.contains(model)) { if (!AlphaFineHelper.getFilterResult().contains(model) && !filterModelList.contains(model)) {

4
designer-realize/src/main/java/com/fr/design/mainframe/app/DesignerAppUtils.java

@ -8,7 +8,6 @@ import com.fr.design.extra.exe.callback.ModifyStatusCallback;
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.mainframe.app.PluginRemote.PluginStatus; import com.fr.design.mainframe.app.PluginRemote.PluginStatus;
import com.fr.design.ui.util.UIUtil;
import com.fr.locale.InterProviderFactory; import com.fr.locale.InterProviderFactory;
import com.fr.plugin.context.PluginMarker; import com.fr.plugin.context.PluginMarker;
import com.fr.plugin.context.PluginMarkerAdapter; import com.fr.plugin.context.PluginMarkerAdapter;
@ -27,6 +26,7 @@ import com.fr.third.guava.cache.CacheBuilder;
import com.fr.third.guava.collect.Multimap; import com.fr.third.guava.collect.Multimap;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import javax.swing.SwingUtilities;
import java.time.Duration; import java.time.Duration;
import java.util.Collection; import java.util.Collection;
import java.util.Map; import java.util.Map;
@ -183,7 +183,7 @@ public class DesignerAppUtils {
// 试图获取多行读取错误提示并缓存待处理列表 // 试图获取多行读取错误提示并缓存待处理列表
String detail = dealWithErrorDetailMultiLineAndCache(path); String detail = dealWithErrorDetailMultiLineAndCache(path);
if (detail.length() > 0) { if (detail.length() > 0) {
UIUtil.invokeLaterIfNeeded(() -> { SwingUtilities.invokeLater(() -> {
if (WorkContext.getCurrent().isLocal()) { if (WorkContext.getCurrent().isLocal()) {
UIExpandDialog.Builder() UIExpandDialog.Builder()
.owner(DesignerContext.getDesignerFrame()) .owner(DesignerContext.getDesignerFrame())

7
designer-realize/src/main/java/com/fr/design/write/submit/SmartInsertDBManipulationPane.java

@ -291,6 +291,10 @@ public class SmartInsertDBManipulationPane extends DBManipulationPane {
@Override @Override
public void checkValid() throws Exception { public void checkValid() throws Exception {
KeyColumnTableModel model = (KeyColumnTableModel) keyColumnValuesTable.getModel(); KeyColumnTableModel model = (KeyColumnTableModel) keyColumnValuesTable.getModel();
checkModelValid(model);
}
private void checkModelValid(KeyColumnTableModel model) throws Exception {
int cnt = model.getRowCount(); int cnt = model.getRowCount();
int groupLength = -1; int groupLength = -1;
for (int i = 0; i < cnt; i++) { for (int i = 0; i < cnt; i++) {
@ -374,7 +378,8 @@ public class SmartInsertDBManipulationPane extends DBManipulationPane {
*/ */
@Override @Override
public void checkValid() throws Exception { public void checkValid() throws Exception {
SmartInsertDBManipulationPane.this.checkValid(); KeyColumnTableModel model = (KeyColumnTableModel) table.getModel();
SmartInsertDBManipulationPane.this.checkModelValid(model);
} }
private SelectionListener listener = new SelectionListener() { private SelectionListener listener = new SelectionListener() {

4
designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java

@ -834,7 +834,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
//显示set和tip //显示set和tip
setCardPane.setPreferredSize(new Dimension(156, 20)); setCardPane.setPreferredSize(new Dimension(156, 20));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, VGAP); TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, VGAP);
tipCardPane.setPreferredSize(new Dimension(224, 40)); tipCardPane.setPreferredSize(new Dimension(224, 50));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 4, VGAP_INNER); TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 4, VGAP_INNER);
} else { } else {
//未定义 //未定义
@ -958,7 +958,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
//显示set和tip //显示set和tip
setCardPane.setPreferredSize(new Dimension(156, 20)); setCardPane.setPreferredSize(new Dimension(156, 20));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, VGAP); TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, VGAP);
tipCardPane.setPreferredSize(new Dimension(224, 40)); tipCardPane.setPreferredSize(new Dimension(224, 50));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 4, VGAP_INNER); TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 4, VGAP_INNER);
break; break;
case EVEN: case EVEN:

Loading…
Cancel
Save