Browse Source

Merge branch 'feature/x' of ssh://code.fineres.com:7999/~roger.chen/design into feature/x

feature/x
roger 2 years ago
parent
commit
8e5781ae76
  1. 18
      designer-base/src/main/java/com/fr/design/DesignerEnvManager.java
  2. 2
      designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java
  3. 42
      designer-base/src/main/java/com/fr/design/data/MapCompareUtils.java
  4. 26
      designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java
  5. 3
      designer-base/src/main/java/com/fr/design/extra/exe/callback/InstallFromDiskCallback.java
  6. 3
      designer-base/src/main/java/com/fr/design/extra/exe/callback/InstallOnlineCallback.java
  7. 3
      designer-base/src/main/java/com/fr/design/extra/exe/callback/UpdateFromDiskCallback.java
  8. 3
      designer-base/src/main/java/com/fr/design/extra/exe/callback/UpdateOnlineCallback.java
  9. 70
      designer-base/src/main/java/com/fr/design/extra/exe/callback/handle/PluginCallBackHelper.java
  10. 86
      designer-base/src/main/java/com/fr/design/extra/exe/callback/handle/PluginTaskResultErrorDialog.java
  11. 8
      designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java
  12. 9
      designer-base/src/main/java/com/fr/design/layout/FRGUIPaneFactory.java
  13. 11
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java
  14. 207
      designer-base/src/main/java/com/fr/design/mainframe/JNullTemplate.java
  15. 9
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  16. 83
      designer-base/src/main/java/com/fr/design/mainframe/simple/SimpleDesignerConfig.java
  17. 93
      designer-base/src/main/java/com/fr/start/BaseDesigner.java
  18. 2
      designer-base/src/main/java/com/fr/start/common/DesignerOpenEmptyPanel.java
  19. 10
      designer-base/src/main/java/com/fr/start/common/DesignerStartupExecutor.java
  20. 19
      designer-base/src/main/java/com/fr/startup/ui/StartupPageModel.java
  21. 32
      designer-base/src/main/java/com/fr/startup/ui/StartupPageWindow.java
  22. 45
      designer-base/src/main/java/com/fr/startup/ui/StartupPageWorkspacePanel.java
  23. 14
      designer-base/src/main/resources/com/fr/design/standard/system/error_tips.svg
  24. 8
      designer-base/src/test/java/com/fr/startup/ui/StartupPageWindowTest.java
  25. 27
      designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/ColSelectedWithSummaryMethodEditor.java
  26. 5
      designer-chart/src/main/java/com/fr/van/chart/custom/other/VanChartCustomPlotConditionAttrTabPane.java
  27. 5
      designer-realize/src/main/java/com/fr/start/DesignerSubListener.java
  28. 25
      designer-realize/src/main/java/com/fr/start/module/optimized/DesignUpdateActivator.java
  29. 12
      designer-realize/src/main/java/com/fr/start/module/optimized/DesignerStartupPageActivator.java

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

@ -20,6 +20,7 @@ import com.fr.design.locale.impl.ProductImproveMark;
import com.fr.design.login.DesignerLoginType;
import com.fr.design.login.config.DesignerLoginConfigManager;
import com.fr.design.mainframe.ComponentReuseNotifyUtil;
import com.fr.design.mainframe.simple.SimpleDesignerConfig;
import com.fr.design.mainframe.reuse.ComponentReuseNotificationInfo;
import com.fr.design.mainframe.vcs.VcsConfigManager;
import com.fr.design.notification.SnapChatConfig;
@ -226,6 +227,8 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
private boolean propertiesUsable;
private SimpleDesignerConfig fvsDesignerConfig = SimpleDesignerConfig.getInstance("FvsDesignerConfig");
/**
* DesignerEnvManager.
*/
@ -1012,6 +1015,10 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
this.designerStartupConfig.setEnabled(enabled);
}
public SimpleDesignerConfig getFvsDesignerConfig() {
return fvsDesignerConfig;
}
/**
* 返回环境名称迭代器
*/
@ -1863,6 +1870,8 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
readSnapChatConfig(reader);
} else if (name.equals(DesignerLoginConfigManager.XML_TAG)) {
readDesignerLoginAttr(reader);
} else if (name.equals(fvsDesignerConfig.getName())) {
readFvsDesignerConfig(reader);
} else {
readLayout(reader, name);
}
@ -2113,6 +2122,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
writeSnapChatConfig(writer);
writeComponentReuseNotificationInfo(writer);
writeDesignerLoginAttr(writer);
writeFvsDesignerConfig(writer);
writer.end();
}
@ -2419,6 +2429,14 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
this.designerLoginConfigManager.writeXML(writer);
}
private void readFvsDesignerConfig(XMLableReader reader) {
reader.readXMLObject(fvsDesignerConfig);
}
private void writeFvsDesignerConfig(XMLPrintWriter writer) {
this.fvsDesignerConfig.writeXML(writer);
}
enum XmlHandler {
Self;

2
designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java

@ -188,7 +188,7 @@ public abstract class DesignTableDataManager {
public static void addDsChangeListener(ChangeListener l) {
JTemplate<?, ?> template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
String key = StringUtils.EMPTY;
if (template != null) {
if (JTemplate.isValid(template)) {
key = template.getPath();
}
List<ChangeListener> dsListeners = dsListenersMap.get(key);

42
designer-base/src/main/java/com/fr/design/data/MapCompareUtils.java

@ -16,6 +16,8 @@ public final class MapCompareUtils {
/**
* 对比两个map 查找出相比origother中有哪些是新增的删除的或者被修改的并分别进行处理
*
* 对比时默认用equals方法来判断是否为 EntryEventKind#UPDATED
*
* @param orig 原始map
* @param other 参考的新map
* @param eventHandler 有区别时的事件处理器
@ -24,12 +26,29 @@ public final class MapCompareUtils {
*/
public static <K, V> void contrastMapEntries(@NotNull Map<K, V> orig, @NotNull Map<K, V> other, @NotNull EventHandler<K, V> eventHandler) {
contrastMapEntries(orig, other, eventHandler, UpdateRule.DEFAULT);
}
/**
* 对比两个map 查找出相比origother中有哪些是新增的删除的或者被修改的并分别进行处理
*
* 对比时用自定义的规则来判断是否为 EntryEventKind#UPDATED
*
* @param orig 原始map
* @param other 参考的新map
* @param eventHandler 有区别时的事件处理器
* @param updateRule 自定义的Update事件判定规则
* @param <K>
* @param <V>
*/
public static <K, V> void contrastMapEntries(@NotNull Map<K, V> orig, @NotNull Map<K, V> other, @NotNull EventHandler<K, V> eventHandler, @NotNull UpdateRule<K, V> updateRule) {
Map<K, V> copiedOrig = new LinkedHashMap<>(orig);
other.forEach((k, v) -> {
V existedV = copiedOrig.remove(k);
if (existedV != null) {
if (!v.equals(existedV)) {
if (updateRule.needUpdate(existedV, v)) {
eventHandler.on(EntryEventKind.UPDATED, k, v);
}
} else {
@ -41,10 +60,31 @@ public final class MapCompareUtils {
}
/**
* 事件处理器对应比较后的三种结果的事件处理
* @param <K>
* @param <V>
*/
public interface EventHandler<K, V> {
void on(EntryEventKind entryEventKind, K k, V v);
}
/**
* 数据被修改(EntryEventKind.UPDATED) 的判定规则
* @param <K>
* @param <V>
*/
public interface UpdateRule<K, V> {
EntryEventKind eventKind = EntryEventKind.UPDATED;
UpdateRule DEFAULT = new UpdateRule() {};
default boolean needUpdate(V origin, V v) {
return !v.equals(origin);
}
}
public enum EntryEventKind {
ADDED,
REMOVED,

26
designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java

@ -192,6 +192,32 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh
default:
break;
}
}, new MapCompareUtils.UpdateRule<String, Connection>() {
@Override
public boolean needUpdate(Connection origin, Connection connection) {
return needUpdate0(origin, connection);
}
/**
* 是否需要更新处理
* 1. Connection本身equals为false代表字段修改
* 2. 非内置的Connection即插件提供的Connection
* todo 原本一个equals方法就可以搞定但是插件里面没有实现equals结果导致不能正确判断只能主代码里做兼容很恶心先记个todo以后看有没有办法改掉
* @param origin
* @param connection
* @return
*/
private boolean needUpdate0(Connection origin, Connection connection) {
return !connection.equals(origin) || !isEmbedConnection(connection);
}
/**
* 是否是主工程里内置的Connection
* @return
*/
private boolean isEmbedConnection(Connection connection) {
return connection instanceof JDBCDatabaseConnection || connection instanceof JNDIDatabaseConnection;
}
});
this.validateConnections(addedOrUpdatedConnections);

3
designer-base/src/main/java/com/fr/design/extra/exe/callback/InstallFromDiskCallback.java

@ -3,6 +3,7 @@ package com.fr.design.extra.exe.callback;
import com.fr.design.bridge.exec.JSCallback;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.extra.PluginOperateUtils;
import com.fr.design.extra.exe.callback.handle.PluginCallBackHelper;
import com.fr.design.i18n.Toolkit;
import com.fr.log.FineLoggerFactory;
@ -73,7 +74,7 @@ public class InstallFromDiskCallback extends AbstractPluginTaskCallback {
}else {
jsCallback.execute("failed");
FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_Failed"));
FineJOptionPane.showMessageDialog(null, pluginInfo, Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), FineJOptionPane.ERROR_MESSAGE);
PluginCallBackHelper.showErrorMessage(result, pluginInfo);
}
}
}

3
designer-base/src/main/java/com/fr/design/extra/exe/callback/InstallOnlineCallback.java

@ -4,6 +4,7 @@ import com.fr.design.bridge.exec.JSCallback;
import com.fr.design.bridge.exec.JSExecutor;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.extra.PluginOperateUtils;
import com.fr.design.extra.exe.callback.handle.PluginCallBackHelper;
import com.fr.design.i18n.Toolkit;
import com.fr.log.FineLoggerFactory;
@ -63,7 +64,7 @@ public class InstallOnlineCallback extends AbstractDealPreTaskCallback {
} else {
jsCallback.execute("failed");
FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_Failed"));
FineJOptionPane.showMessageDialog(null, pluginInfo, Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), FineJOptionPane.ERROR_MESSAGE);
PluginCallBackHelper.showErrorMessage(result, pluginInfo);
}
}

3
designer-base/src/main/java/com/fr/design/extra/exe/callback/UpdateFromDiskCallback.java

@ -3,6 +3,7 @@ package com.fr.design.extra.exe.callback;
import com.fr.design.bridge.exec.JSCallback;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.extra.PluginOperateUtils;
import com.fr.design.extra.exe.callback.handle.PluginCallBackHelper;
import com.fr.design.i18n.Toolkit;
import com.fr.log.FineLoggerFactory;
@ -72,7 +73,7 @@ public class UpdateFromDiskCallback extends AbstractPluginTaskCallback {
}else {
jsCallback.execute("failed");
FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Basic_Plugin_Update_Failed"));
FineJOptionPane.showMessageDialog(null, pluginInfo, Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), FineJOptionPane.ERROR_MESSAGE);
PluginCallBackHelper.showErrorMessage(result, pluginInfo);
}
}
}

3
designer-base/src/main/java/com/fr/design/extra/exe/callback/UpdateOnlineCallback.java

@ -3,6 +3,7 @@ package com.fr.design.extra.exe.callback;
import com.fr.design.bridge.exec.JSCallback;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.extra.PluginOperateUtils;
import com.fr.design.extra.exe.callback.handle.PluginCallBackHelper;
import com.fr.design.i18n.Toolkit;
import com.fr.log.FineLoggerFactory;
@ -38,7 +39,7 @@ public class UpdateOnlineCallback extends AbstractDealPreTaskCallback {
} else {
jsCallback.execute("failed");
FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Basic_Plugin_Update_Failed"));
FineJOptionPane.showMessageDialog(null, pluginInfo, Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), FineJOptionPane.ERROR_MESSAGE);
PluginCallBackHelper.showErrorMessage(result, pluginInfo);
}
}
}

70
designer-base/src/main/java/com/fr/design/extra/exe/callback/handle/PluginCallBackHelper.java

@ -0,0 +1,70 @@
package com.fr.design.extra.exe.callback.handle;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.dialog.link.MessageWithLink;
import com.fr.design.i18n.Toolkit;
import com.fr.plugin.error.PluginErrorCode;
import com.fr.plugin.manage.control.PluginTaskResult;
/**
* 帮助处理插件操作安装更新等的弹窗
* @author Yvan
*/
public class PluginCallBackHelper {
private static final String NEW_LINE_TAG = "<br/>";
private static final String REFERENCE = Toolkit.i18nText("Fine-Design_Basic_Plugin_File_Validate_Reference");
private static final String HELP_DOCUMENT_NAME = Toolkit.i18nText("Fine-Design_Basic_Plugin_File_Validate_HELP_DOCUMENT_NAME");
private static final String CONNECTOR = "-";
private static final String HELP_DOCUMENT_LINK = Toolkit.i18nText("Fine-Design_Basic_Plugin_File_Validate_HELP_DOCUMENT_LINK");
/**
* 展示插件操作失败后的提示弹窗
* @param result
* @param pluginInfo
*/
public static void showErrorMessage(PluginTaskResult result, String pluginInfo) {
// 单独处理下插件完整性校验失败的提示
if (PluginCallBackHelper.needHandleInvalidatePackage(result)) {
MessageWithLink messageWithLink = PluginCallBackHelper.generate4InvalidatePackage(pluginInfo);
PluginTaskResultErrorDialog resultDialog = new PluginTaskResultErrorDialog(null, messageWithLink);
resultDialog.showResult();
} else {
FineJOptionPane.showMessageDialog(null, pluginInfo, Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), FineJOptionPane.ERROR_MESSAGE);
}
}
/**
* 判断是否需要处理 插件安装包校验失败 导致的安装失败任务
* @param result
* @return
*/
private static boolean needHandleInvalidatePackage(PluginTaskResult result) {
return !result.isSuccess() && result.getCode() == PluginErrorCode.InstallPackageValidateFailed;
}
/**
* 根据插件原始报错信息构建MessageWithLink
* @param originInfo
* @return
*/
private static MessageWithLink generate4InvalidatePackage(String originInfo) {
return new MessageWithLink(getSupplementaryMessage(originInfo), HELP_DOCUMENT_NAME, HELP_DOCUMENT_LINK);
}
/**
* 根据插件原始报错信息获取增加了补充说明后的信息
* @param originInfo
* @return
*/
private static String getSupplementaryMessage(String originInfo) {
return new StringBuilder()
.append(originInfo)
.append(NEW_LINE_TAG)
.append(REFERENCE)
.append(CONNECTOR)
.toString();
}
}

86
designer-base/src/main/java/com/fr/design/extra/exe/callback/handle/PluginTaskResultErrorDialog.java

@ -0,0 +1,86 @@
package com.fr.design.extra.exe.callback.handle;
import com.fr.base.svg.IconUtils;
import com.fr.design.dialog.link.MessageWithLink;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.VerticalFlowLayout;
import com.fr.design.utils.gui.GUICoreUtils;
import javax.swing.BorderFactory;
import javax.swing.JDialog;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Frame;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* 当前仅处理Error提示之后有需要再扩展
* @author Yvan
*/
public class PluginTaskResultErrorDialog extends JDialog {
private static final Dimension LABEL = new Dimension(60, 90);
private JPanel contentPane;
private UILabel errorLabel;
private UIButton confirmButton;
private MessageWithLink messageWithLink;
public PluginTaskResultErrorDialog(Frame parent, MessageWithLink messageWithLink) {
super(parent, true);
this.setTitle(Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"));
this.messageWithLink = messageWithLink;
initContentPane();
this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.setResizable(false);
this.add(contentPane, BorderLayout.CENTER);
this.setSize(new Dimension( 380, 160));
GUICoreUtils.centerWindow(this);
}
/**
* 初始化内容面板
*/
private void initContentPane() {
this.contentPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
// error图标
errorLabel = new UILabel(IconUtils.readIcon("/com/fr/design/standard/system/error_tips.svg"));
errorLabel.setPreferredSize(LABEL);
errorLabel.setBorder(BorderFactory.createEmptyBorder(10, 20, 40, 20));
// 提示内容
JPanel messagePane = FRGUIPaneFactory.createBorderLayout_S_Pane();
messagePane.add(errorLabel, BorderLayout.WEST);
messagePane.add(messageWithLink, BorderLayout.CENTER);
messagePane.setBorder(BorderFactory.createEmptyBorder(20, 10, 0, 10));
this.contentPane.add(messagePane, BorderLayout.CENTER);
// 确定按钮
confirmButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Button_OK"));
confirmButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
hideResult();
}
});
JPanel confirmPane = new JPanel(new VerticalFlowLayout());
confirmPane.add(confirmButton);
confirmPane.setBorder(BorderFactory.createEmptyBorder(0, 160, 10, 0));
this.contentPane.add(confirmPane, BorderLayout.SOUTH);
}
public void showResult() {
this.setVisible(true);
}
public void hideResult() {
this.setVisible(false);
}
}

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

@ -19,6 +19,7 @@ import com.fr.plugin.context.PluginContext;
import com.fr.stable.CoreConstants;
import com.fr.stable.StringUtils;
import com.fr.third.org.apache.commons.io.FilenameUtils;
import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
import java.util.Collections;
@ -26,7 +27,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
import java.util.Set;
/**
* 历史模板缓存
@ -99,6 +99,7 @@ public class HistoryTemplateListCache implements CallbackEvent {
}
@Nullable
public JTemplate<?, ?> getCurrentEditingTemplate() {
return this.editingTemplate;
}
@ -109,8 +110,11 @@ public class HistoryTemplateListCache implements CallbackEvent {
*/
public void setCurrentEditingTemplate(JTemplate<?, ?> jt) {
this.editingTemplate = jt;
//如果当前历史面板中没有
if (!JTemplate.isValid(jt)) {
return;
}
//如果当前历史面板中没有
if (contains(jt) == -1) {
addHistory();
}

9
designer-base/src/main/java/com/fr/design/layout/FRGUIPaneFactory.java

@ -152,15 +152,18 @@ public class FRGUIPaneFactory {
return new FRGridLayout(nColumn);
}
public static LayoutManager createCenterLayout(JComponent centerBody) {
return createCenterLayout(centerBody, 0.3d);
}
/**
* centerBody 为中心创建一个布局
* 只有当且仅当有一个组件且希望组件 上下左右 居中时使用
* @param centerBody 中心组件
* @return 布局方式
*/
public static LayoutManager createCenterLayout(JComponent centerBody) {
public static LayoutManager createCenterLayout(JComponent centerBody, double factor) {
final double yFactor = 0.30;
return new LayoutManager() {
@Override
@ -186,7 +189,7 @@ public class FRGUIPaneFactory {
int bodyWidth = centerBody.getPreferredSize().width;
int bodyHeight = centerBody.getPreferredSize().height;
int labelX = (width - bodyWidth) / 2;
int labelY = (int) ((height - bodyHeight) * yFactor);
int labelY = (int) ((height - bodyHeight) * factor);
centerBody.setBounds(labelX, labelY, bodyWidth, bodyHeight);
}

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

@ -696,7 +696,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
username = connection == null ? StringUtils.EMPTY : connection.getUserName();
}
defaultTitleSB.append(username).append("@").append(envName).append("[").append(workspace.getDescription()).append("]");
if (editingTemplate != null) {
if (JTemplate.isValid(editingTemplate)) {
String path = editingTemplate.getPath();
if (!editingTemplate.getEditingFILE().exists()) {
path = FILEFactory.MEM_PREFIX + path;
@ -815,6 +815,13 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
basePane.remove(layout.getLayoutComponent(BorderLayout.EAST));
basePane.add(designerOpenEmptyPanel, BorderLayout.CENTER);
resetToolkitByPlus(ToolBarMenuDock.NULLAVOID);
// 这里挺恶心的,是为了保证对插件的兼容性适配
// 不然的话,插件就会 npe
// 见 https://work.fineres.com/browse/REPORT-76091
HistoryTemplateListCache.getInstance().setCurrentEditingTemplate(JNullTemplate.NULL);
layeredPane.repaint();
}
@ -1081,7 +1088,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
}
JTemplate jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (jt != null) {
if (JTemplate.isValid(jt)) {
DesignerEnvManager.getEnvManager().setLastOpenFile(jt.getEditingFILE().getPath());
}

207
designer-base/src/main/java/com/fr/design/mainframe/JNullTemplate.java

@ -0,0 +1,207 @@
package com.fr.design.mainframe;
import com.fr.design.DesignModelAdapter;
import com.fr.design.designer.TargetComponent;
import com.fr.design.gui.frpane.HyperlinkGroupPane;
import com.fr.design.gui.frpane.HyperlinkGroupPaneActionProvider;
import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.mainframe.template.info.TemplateProcessInfo;
import com.fr.design.menu.ShortCut;
import com.fr.design.menu.ToolBarDef;
import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.JPanel;
/**
* created by Harrison on 2022/08/09
**/
public class JNullTemplate extends JTemplate {
public static final JTemplate NULL = new JNullTemplate();
@Override
public void copy() {
}
@Override
public boolean paste() {
return false;
}
@Override
public boolean cut() {
return false;
}
@Override
public AuthorityEditPane createAuthorityEditPane() {
return null;
}
@Override
public JPanel getEastUpPane() {
return null;
}
@Override
public JPanel getEastDownPane() {
return null;
}
@Override
public ToolBarDef[] toolbars4Target() {
return new ToolBarDef[0];
}
@Override
public JComponent[] toolBarButton4Form() {
return new JComponent[0];
}
@Override
public void refreshEastPropertiesPane() {
}
@Override
public TargetComponent getCurrentElementCasePane() {
return null;
}
@Override
public JComponent getCurrentReportComponentPane() {
return null;
}
@Override
public TemplateProcessInfo getProcessInfo() {
return null;
}
@Override
public void setJTemplateResolution(int resolution) {
}
@Override
public int getJTemplateResolution() {
return 0;
}
@Override
protected JComponent createCenterPane() {
return null;
}
@Override
public void removeTemplateSelection() {
}
@Override
public void refreshContainer() {
}
@Override
public void removeParameterPaneSelection() {
}
@Override
public void setScale(int resolution) {
}
@Override
public int getScale() {
return 0;
}
@Override
public int selfAdaptUpdate() {
return 0;
}
@Override
protected DesignModelAdapter createDesignModel() {
return null;
}
@Override
public UIMenuItem[] createMenuItem4Preview() {
return new UIMenuItem[0];
}
@Override
protected BaseUndoState<?> createUndoState() {
return null;
}
@Override
protected void applyUndoState(BaseUndoState baseUndoState) {
}
@Override
public String suffix() {
return null;
}
@Override
public ShortCut[] shortcut4TemplateMenu() {
return new ShortCut[0];
}
@Override
public ShortCut[] shortCuts4Authority() {
return new ShortCut[0];
}
@Override
public boolean isJWorkBook() {
return false;
}
@Override
public HyperlinkGroupPane getHyperLinkPane(HyperlinkGroupPaneActionProvider hyperlinkGroupPaneActionProvider) {
return null;
}
@Override
public HyperlinkGroupPane getHyperLinkPaneNoPop(HyperlinkGroupPaneActionProvider hyperlinkGroupPaneActionProvider) {
return null;
}
@Override
public void setAuthorityMode(boolean isUpMode) {
}
@Override
public Icon getIcon() {
return null;
}
@Override
public String route() {
return null;
}
@Override
public JPanel[] toolbarPanes4Form() {
return new JPanel[0];
}
@Override
public JComponent toolBar4Authority() {
return null;
}
@Override
public int getToolBarHeight() {
return 0;
}
}

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

@ -1974,4 +1974,13 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
DesignerUIModeConfig.getInstance().setAbsoluteMeasureUIMode();
}
/**
* 判断当前的模板是否是有效的模板
*
* @param jt 模板
* @return /
*/
public static boolean isValid(JTemplate jt) {
return jt != null && jt != JNullTemplate.NULL;
}
}

83
designer-base/src/main/java/com/fr/design/mainframe/simple/SimpleDesignerConfig.java

@ -0,0 +1,83 @@
package com.fr.design.mainframe.simple;
import com.fr.json.JSONObject;
import com.fr.stable.StringUtils;
import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLable;
import com.fr.stable.xml.XMLableReader;
import java.util.HashMap;
import java.util.Map;
/**
* @author Wei
* 一个简单属性字符串存储类用于自定义简单属性的存储
* getInstance("FVSDesignerConfig")可在FineReportEnv.xml中定义一个<FVSDesignerConfig></>存储FVS相关配置
*/
public class SimpleDesignerConfig implements XMLable {
private static final Map<String, SimpleDesignerConfig> configs = new HashMap<>();
private SimpleDesignerConfig(String name) {
this.name = name;
}
public static SimpleDesignerConfig getInstance(String name) {
SimpleDesignerConfig config = configs.get(name);
if (config == null) {
config = new SimpleDesignerConfig(name);
configs.put(name, config);
}
return config;
}
private String name = "";
private JSONObject content = new JSONObject();
public void addAttr(String key, String value) {
content.put(key, value);
}
public JSONObject getContent() {
return content;
}
public void setContent(JSONObject content) {
this.content = content;
}
@Override
public void readXML(XMLableReader reader) {
if (reader.isAttr()) {
String rawContent = reader.getAttrAsString("content", null);
if (StringUtils.isNotBlank(rawContent)) {
this.content = new JSONObject(rawContent);
}
}
}
@Override
public void writeXML(XMLPrintWriter writer) {
writer.startTAG(name);
if (this.content != null) {
writer.attr("content", this.content.toString());
}
writer.end();
}
@Override
public Object clone() throws CloneNotSupportedException {
SimpleDesignerConfig cloned = (SimpleDesignerConfig) super.clone();
if (this.content != null) {
cloned.content = new JSONObject(this.content.toString());
}
cloned.name = this.name;
return cloned;
}
public String getName() {
return name;
}
}

93
designer-base/src/main/java/com/fr/start/BaseDesigner.java

@ -38,6 +38,7 @@ import com.fr.workspace.base.WorkspaceStatus;
import java.awt.Window;
import java.lang.reflect.Method;
import java.util.concurrent.atomic.AtomicBoolean;
/**
* The main class of Report Designer.
@ -143,6 +144,45 @@ public abstract class BaseDesigner extends ToolBarMenuDock {
private boolean openFile(final DesignerFrame df, boolean isException, FILE file) {
AtomicBoolean isExWrapper = new AtomicBoolean(isException);
openTemplate(df, isExWrapper, file);
if (OperatingSystem.isMacOS()) {
enableFullScreenMode(df);
}
JTemplate<?, ?> selectedJTemplate = df.getSelectedJTemplate();
if (selectedJTemplate != null) {
selectedJTemplate.requestGridFocus();
}
return isExWrapper.get();
}
private void openTemplate(DesignerFrame df, AtomicBoolean isException, FILE file) {
// 如果是起始页启动中
if (openTemplateOnStartup(df, isException, file)) {
return;
}
openTemplate0(df, isException, file);
}
private void openTemplate0(DesignerFrame df, AtomicBoolean isException, FILE file) {
file = getExtraFILE(isException, file);
if (file != null && file.exists() && !isException.get()) {
df.openTemplate(file);
} else {
df.addAndActivateJTemplate();
// 如果没有模板,则需要确认一下
MutilTempalteTabPane.getInstance().setTemTemplate(HistoryTemplateListPane.getInstance().getCurrentEditingTemplate());
}
}
private FILE getExtraFILE(AtomicBoolean isException, FILE file) {
//启动时打开指定文件的接口
DesignerStartOpenFileProcessor processor = ExtraDesignClassManager.getInstance().getSingle(DesignerStartOpenFileProcessor.XML_TAG);
// 如果插件没有,且又开启了启动时打开空文件,则使用启动时打开空文件
@ -154,53 +194,50 @@ public abstract class BaseDesigner extends ToolBarMenuDock {
if (f != null) {
file = f;//避免null
} else {
isException = true;//此时有文件nullpointer异常,执行打开空文件
}
isException.set(true);//此时有文件nullpointer异常,执行打开空文件
}
openTemplate(df, isException, file);
if (OperatingSystem.isMacOS()) {
enableFullScreenMode(df);
}
JTemplate<?, ?> selectedJTemplate = df.getSelectedJTemplate();
if (selectedJTemplate != null) {
selectedJTemplate.requestGridFocus();
}
return isException;
return file;
}
private void openTemplate(DesignerFrame df, boolean isException, FILE file) {
private boolean openTemplateOnStartup(DesignerFrame df, AtomicBoolean isException, FILE file) {
boolean onStartup = DesignerStartupContext.getInstance().isSupport();
if (onStartup) {
DesignerStartupContext context = DesignerStartupContext.getInstance();
if (context.isCreateNew()) {
df.addAndActivateJTemplate();
// 如果没有模板,则需要确认一下
MutilTempalteTabPane.getInstance().setTemTemplate(HistoryTemplateListPane.getInstance().getCurrentEditingTemplate());
return;
}
if (context.isOpenLastFile()) {
if (file != null && file.exists() && !isException) {
df.openTemplate(file);
return;
return createNewTemplate(df);
}
if (isOpenTemplate(isException, file, context)) {
return openTemplate(df, file);
}
if (context.isOpenEmpty()) {
df.showEmptyJTemplate();
return;
return openEmpty(df);
}
}
return false;
}
private boolean isOpenTemplate(AtomicBoolean isException, FILE file, DesignerStartupContext context) {
return context.isOpenLastFile() && file != null && file.exists() && !isException.get();
}
private boolean openEmpty(DesignerFrame df) {
df.showEmptyJTemplate();
return true;
}
if (file != null && file.exists() && !isException) {
private boolean openTemplate(DesignerFrame df, FILE file) {
df.openTemplate(file);
} else {
return true;
}
private boolean createNewTemplate(DesignerFrame df) {
df.addAndActivateJTemplate();
// 如果没有模板,则需要确认一下
MutilTempalteTabPane.getInstance().setTemTemplate(HistoryTemplateListPane.getInstance().getCurrentEditingTemplate());
}
return true;
}
private void enableFullScreenMode(Window window) {

2
designer-base/src/main/java/com/fr/start/common/DesignerOpenEmptyPanel.java

@ -68,7 +68,7 @@ public class DesignerOpenEmptyPanel extends JPanel {
this.body.add(createIcon, BorderLayout.NORTH);
this.body.add(createButtonPanel, BorderLayout.SOUTH);
setLayout(FRGUIPaneFactory.createCenterLayout(this.body));
setLayout(FRGUIPaneFactory.createCenterLayout(this.body, 0.4d));
ColorUtils.syncBackground(this, Color.WHITE);

10
designer-base/src/main/java/com/fr/start/common/DesignerStartupExecutor.java

@ -1,15 +1,10 @@
package com.fr.start.common;
import java.util.ArrayList;
import java.util.List;
/**
* created by Harrison on 2022/07/03
**/
public class DesignerStartupExecutor {
private List<Runnable> warmupTasks = new ArrayList<>();
public void execute(Runnable runnable) {
if (!DesignerStartupContext.getInstance().onWarmup()) {
@ -17,11 +12,6 @@ public class DesignerStartupExecutor {
}
}
public void reset() {
warmupTasks.clear();
}
public static DesignerStartupExecutor getInstance() {
return DesignerStartupExecutorHolder.INSTANCE;
}

19
designer-base/src/main/java/com/fr/startup/ui/StartupPageModel.java

@ -3,10 +3,12 @@ package com.fr.startup.ui;
import com.fr.design.DesignerEnvManager;
import com.fr.design.env.DesignerWorkspaceInfo;
import com.fr.design.env.DesignerWorkspaceType;
import com.fr.stable.StringUtils;
import com.fr.third.guava.collect.Lists;
import com.fr.workspace.connect.WorkspaceConnectionInfo;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
@ -33,7 +35,10 @@ public class StartupPageModel {
public static StartupPageModel create() {
DesignerEnvManager envManager = DesignerEnvManager.getEnvManager();
String curEnvName = envManager.getCurEnvName();
Iterator<String> envNameIterator = envManager.getEnvNameIterator();
Comparator<StartupWorkspaceBean> startupWorkspaceBeanComparator = convertComparator(curEnvName);
List<StartupWorkspaceBean> infos = Lists.newArrayList(envNameIterator)
.stream()
.map((e) -> {
@ -45,6 +50,7 @@ public class StartupPageModel {
return new StartupWorkspaceBean(e, workspaceInfo.getPath(), workspaceInfo.getType());
}
})
.sorted(startupWorkspaceBeanComparator)
.collect(Collectors.toList());
Map<String, List<String>> recentFileMap = new HashMap<>();
for (StartupWorkspaceBean info : infos) {
@ -108,4 +114,17 @@ public class StartupPageModel {
public void setOpenEmptyTemplateRunnable(Runnable openEmptyTemplateRunnable) {
this.openEmptyTemplateRunnable = openEmptyTemplateRunnable;
}
private static Comparator<StartupWorkspaceBean> convertComparator(String curEnvName) {
return (o1, o2) -> {
if (StringUtils.equals(curEnvName, o1.getName())) {
return -1;
}
if (StringUtils.equals(curEnvName, o2.getName())) {
return 1;
}
return 0;
};
}
}

32
designer-base/src/main/java/com/fr/startup/ui/StartupPageWindow.java

@ -12,7 +12,10 @@ import com.fr.design.layout.VerticalFlowLayout;
import com.fr.design.ui.util.UIUtil;
import com.fr.design.utils.ColorUtils;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.exit.DesignerExiter;
import com.fr.general.GeneralUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.ProductConstants;
import com.fr.stable.collections.CollectionUtils;
import org.jetbrains.annotations.NotNull;
@ -39,6 +42,8 @@ import java.awt.LayoutManager;
import java.awt.RenderingHints;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.util.List;
import java.util.Map;
@ -135,6 +140,8 @@ public class StartupPageWindow extends JFrame {
// Workspace-detail
setSize(SCREEN_SIZE);
setDefaultTitle();
addDefaultListeners();
repaint();
validate();
@ -143,6 +150,29 @@ public class StartupPageWindow extends JFrame {
GUICoreUtils.centerWindow(this);
}
private void addDefaultListeners() {
addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
DesignerExiter.getInstance().execute();
}
});
}
private void setDefaultTitle() {
StringBuilder sb = new StringBuilder();
sb.append(ProductConstants.APP_NAME);
sb.append(" ");
sb.append(GeneralUtils.getVersion());
sb.append(" ");
sb.append(ProductConstants.BRANCH);
sb.append(" ");
sb.append(Toolkit.i18nText("Fine-Design_Startup_Page_Title"));
setTitle(sb.toString());
}
private void patchUIAction(StartupPageModel pageModel) {
Runnable selectAndOpenLastTemplateRunnable = pageModel.getOpenLastTemplateRunnable();
@ -317,7 +347,7 @@ public class StartupPageWindow extends JFrame {
recentOpenGroupPanel.setPreferredSize(new Dimension(GROUP_WIDTH, (int) preferredSize.getHeight()));
if (needScroll) {
int scrollHeight = (int) Math.round(itemHeight * RECENT_FILE_LIMIT + ITEM_VERTICAL_GAP * (RECENT_FILE_SCROLL));
int scrollHeight = (int) Math.round(itemHeight * RECENT_FILE_LIMIT + ITEM_VERTICAL_GAP * (RECENT_FILE_LIMIT));
UIScrollPane scrollPane = new UIScrollPane(recentOpenGroupPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
scrollPane.setBorder(new EmptyBorder(0, 0, 0, 0));
scrollPane.setPreferredSize(new Dimension(GROUP_WIDTH, scrollHeight));

45
designer-base/src/main/java/com/fr/startup/ui/StartupPageWorkspacePanel.java

@ -63,7 +63,10 @@ public class StartupPageWorkspacePanel extends JPanel {
private static final Dimension PATH_DIMENSION = new Dimension(100, 20);
private static final Dimension SELECT_WORKSPACE_DIMENSION = new Dimension(210, 72);
private static final Dimension SELECT_CREATE_DIMENSION = new Dimension(60, 72);
public static final int COLUMN_LIMIT = 3;
private static final int COLUMN_LIMIT = 3;
private static final int DOUBLE_CLICK_COUNT = 2;
public static final int PARTITION_LIMIT = 2;
/* model */
@ -95,12 +98,14 @@ public class StartupPageWorkspacePanel extends JPanel {
this.contentPanel = generateLimitContentPanel(partitions);
this.add(contentPanel, BorderLayout.NORTH);
if (partitions.size() > PARTITION_LIMIT) {
this.tailPanel = generateTailPanel();
this.add(tailPanel, BorderLayout.SOUTH);
}
this.createNewTemplateRunnable = pageModel.getCreateNewTemplateRunnable();
this.openEmptyTemplateRunnable = pageModel.getOpenEmptyTemplateRunnable();
this.add(tailPanel, BorderLayout.SOUTH);
this.repaint();
}
@ -221,7 +226,7 @@ public class StartupPageWorkspacePanel extends JPanel {
layoutSelectWorkspacePanel(workspaceInfo, workspaceItemDesc);
layoutSelectAndCreatePanel(workspaceItemDesc);
layoutSelectAndCreatePanel(workspaceInfo, workspaceItemDesc);
partitionPanel.add(workspaceItemDesc);
@ -293,10 +298,8 @@ public class StartupPageWorkspacePanel extends JPanel {
int roundOffset = 15;
// 画一个圆角
int fixRoundWidth = getWidth() - rectOffset;
int fixRoundHeight = getHeight() - BORDER_THIN;
g2d.drawRoundRect(strokeOffset, strokeOffset, fixRoundWidth, fixRoundHeight, ARC_DIAMETER, ARC_DIAMETER);
// 画一个直角
g2d.drawRoundRect(getWidth() - roundOffset, strokeOffset, roundOffset - strokeOffset, getHeight() - BORDER_THIN, 0, 0);
int fixRoundHeight = getHeight() - BORDER_THIN * 2;
g2d.drawRoundRect(BORDER_THIN, BORDER_THIN, fixRoundWidth, fixRoundHeight, ARC_DIAMETER, ARC_DIAMETER);
g2d.setColor(backColor);
@ -306,8 +309,13 @@ public class StartupPageWorkspacePanel extends JPanel {
// 偏左一点的 fixedX
int fixedX = getWidth() - roundOffset - BORDER_THIN;
// 圆角和直角相交的区域
int coverWidth = 10;
int coverWidth = 15;
g2d.fillRect(fixedX, BORDER_THIN, coverWidth, coverHeight);
g2d.setColor(borderColor);
g2d.drawLine(getWidth() / 2, BORDER_THIN, getWidth(), BORDER_THIN);
g2d.drawLine(getWidth() / 2, getHeight() - BORDER_THIN, getWidth(), getHeight() - BORDER_THIN);
g2d.drawLine(getWidth() - strokeOffset, BORDER_THIN, getWidth() - strokeOffset, getHeight() - BORDER_THIN);
}
}
};
@ -335,6 +343,7 @@ public class StartupPageWorkspacePanel extends JPanel {
Font font = nameLabel.getFont();
Font newSizeFont = font.deriveFont(font.getStyle(), NAME_LABEL_SIZE);
nameLabel.setFont(newSizeFont);
nameLabel.setPreferredSize(PATH_DIMENSION);
Color nameForeground = nameLabel.getForeground();
simpleDescPanel.add(nameLabel,BorderLayout.NORTH);
@ -372,7 +381,7 @@ public class StartupPageWorkspacePanel extends JPanel {
public void mousePressed(MouseEvent e) {
int clickCount = e.getClickCount();
if (clickCount == BORDER_THIN) {
if (clickCount == DOUBLE_CLICK_COUNT) {
pageModel.setSelectWorkspaceInfo(workspaceInfo);
openEmptyTemplateRunnable.run();
return;
@ -420,7 +429,7 @@ public class StartupPageWorkspacePanel extends JPanel {
workspaceItemDesc.add(selectWorkspacePanel, BorderLayout.WEST);
}
private void layoutSelectAndCreatePanel(JPanel workspaceItemDesc) {
private void layoutSelectAndCreatePanel(StartupWorkspaceBean workspaceInfo, JPanel workspaceItemDesc) {
// 选择并新建
AtomicReference<Color> borderColorRef = new AtomicReference<>(null);
@ -450,12 +459,19 @@ public class StartupPageWorkspacePanel extends JPanel {
if (borderColor != null) {
g2d.setColor(borderColor);
g2d.setStroke(new BasicStroke(BORDER_THIN));
int borderOffset = BORDER_THIN * 2;
// 画画的笔触需要调整一下
g2d.drawRoundRect(strokeOffset, strokeOffset, getWidth() - rectOffset, getHeight() - BORDER_THIN, 0, 0);
g2d.drawRoundRect(getWidth() - fixedRoundOffset, strokeOffset, roundOffset - strokeOffset, getHeight() - BORDER_THIN, ARC_DIAMETER, ARC_DIAMETER);
//g2d.drawRoundRect(strokeOffset, strokeOffset, getWidth() - rectOffset, getHeight() - BORDER_THIN, 0, 0);
g2d.drawRoundRect(BORDER_THIN, BORDER_THIN, getWidth() - borderOffset, getHeight() - borderOffset, ARC_DIAMETER, ARC_DIAMETER);
g2d.setColor(backColor);
int fillWidth = 11;
g2d.fillRect(getWidth() - fixedRoundOffset - BORDER_THIN, BORDER_THIN, fillWidth, getHeight() - BORDER_THIN * 2);
int fillWidth = 15;
g2d.fillRect(0, 0, fillWidth, getHeight());
g2d.setColor(borderColor);
g2d.drawLine(BORDER_THIN, BORDER_THIN, fillWidth, BORDER_THIN);
g2d.drawLine(BORDER_THIN, getHeight() - BORDER_THIN, fillWidth, getHeight() - BORDER_THIN);
g2d.drawLine(BORDER_THIN, BORDER_THIN, BORDER_THIN, getHeight() - BORDER_THIN);
}
}
@ -484,6 +500,7 @@ public class StartupPageWorkspacePanel extends JPanel {
}
@Override
public void mousePressed(MouseEvent e) {
pageModel.setSelectWorkspaceInfo(workspaceInfo);
createNewTemplateRunnable.run();
}
});

14
designer-base/src/main/resources/com/fr/design/standard/system/error_tips.svg

@ -0,0 +1,14 @@
<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M1 32H29V0H1V32Z" fill="#DADADD"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M1 6H29V0H1V6Z" fill="#AEAEAE"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M31 23.5C31 28.194 27.194 32 22.5 32C17.806 32 14 28.194 14 23.5C14 18.806 17.806 15 22.5 15C27.194 15 31 18.806 31 23.5Z" fill="#EB1D1F"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M8 11H10V10H8V11Z" fill="#AEAEAE"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M11 11H13V10H11V11Z" fill="#AEAEAE"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M14 11H16V10H14V11Z" fill="#AEAEAE"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M17 11H19V10H17V11Z" fill="#AEAEAE"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M20 11H22V10H20V11Z" fill="#AEAEAE"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M6.66568 8.03027C6.79422 7.91375 7 8.00496 7 8.17845V12.8216C7 12.995 6.79422 13.0863 6.66568 12.9697L4.10454 10.6482C4.01697 10.5688 4.01697 10.4312 4.10454 10.3518L6.66568 8.03027Z" fill="#AEAEAE"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M23.3343 8.03027C23.2058 7.91375 23 8.00496 23 8.17845V12.8216C23 12.995 23.2058 13.0863 23.3343 12.9697L25.8955 10.6482C25.983 10.5688 25.983 10.4312 25.8955 10.3518L23.3343 8.03027Z" fill="#AEAEAE"/>
<path d="M19.4375 20.4375L25.5625 26.5625" stroke="white" stroke-width="1.5" stroke-linecap="round"/>
<path d="M25.5625 20.4375L19.4375 26.5625" stroke="white" stroke-width="1.5" stroke-linecap="round"/>
</svg>

After

Width:  |  Height:  |  Size: 1.6 KiB

8
designer-base/src/test/java/com/fr/startup/ui/StartupPageWindowTest.java

@ -16,13 +16,13 @@ public class StartupPageWindowTest {
@Override
public void run() {
HashMap<String, List<String>> recentOpenFileMap = new HashMap<>();
recentOpenFileMap.put("111", Lists.newArrayList("111.cpt", "222//3333.cpt","333.cpt", "444.cpt", "555.cpt", "666.cpt"));
recentOpenFileMap.put("111", Lists.newArrayList("111.cpt", "222//3333.cpt","333.cpt", "444.cpt", "555.cpt", "666.cpt", "777.cpt"));
StartupPageModel model = new StartupPageModel(Stream.of(
StartupWorkspaceBean.create("111", "222333344455556663333444555566633334445555666"), StartupWorkspaceBean.create("113", "222"),
StartupWorkspaceBean.create("114", "222"), StartupWorkspaceBean.create("115", "222"), StartupWorkspaceBean.create("116", "222"),
StartupWorkspaceBean.create("117", "222"), StartupWorkspaceBean.create("118", "222"), StartupWorkspaceBean.create("119", "222"),
StartupWorkspaceBean.create("121", "222"), StartupWorkspaceBean.create("122", "222"), StartupWorkspaceBean.create("123", "222"),
StartupWorkspaceBean.create("124", "222"), StartupWorkspaceBean.create("125", "222"), StartupWorkspaceBean.create("126", "222")
//StartupWorkspaceBean.create("117", "222"), StartupWorkspaceBean.create("118", "222"), StartupWorkspaceBean.create("119", "222"),
//StartupWorkspaceBean.create("121", "222"), StartupWorkspaceBean.create("122", "222"), StartupWorkspaceBean.create("123", "222"),
StartupWorkspaceBean.create("1245678888888", "222"), StartupWorkspaceBean.create("125", "222"), StartupWorkspaceBean.create("126", "222")
).collect(Collectors.toList()), recentOpenFileMap);
StartupPageWindow window = new StartupPageWindow(model);
window.setVisible(true);

27
designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/ColSelectedWithSummaryMethodEditor.java

@ -1,6 +1,10 @@
package com.fr.design.chart.series.SeriesCondition;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.ChartCommonCondition;
import com.fr.chart.chartattr.Plot;
import com.fr.chart.chartglyph.ConditionAttr;
import com.fr.chart.chartglyph.ConditionCollection;
import com.fr.data.DSColumnWithSummaryMethod;
import com.fr.data.util.function.AbstractDataFunction;
import com.fr.design.chart.ChartDataHelper;
@ -9,8 +13,11 @@ import com.fr.design.editor.editor.Editor;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.plugin.chart.attr.plot.VanChartPlot;
import com.fr.plugin.chart.custom.VanChartCustomPlot;
import com.fr.plugin.chart.custom.type.CustomPlotType;
import java.awt.Dimension;
import java.util.List;
import javax.swing.DefaultComboBoxModel;
public class ColSelectedWithSummaryMethodEditor extends Editor<DSColumnWithSummaryMethod> {
@ -88,4 +95,24 @@ public class ColSelectedWithSummaryMethodEditor extends Editor<DSColumnWithSumma
return object instanceof DSColumnWithSummaryMethod;
}
public static void update(int index, Plot plot) {
if (plot instanceof VanChartCustomPlot) {
List<VanChartPlot> list = ((VanChartCustomPlot) plot).getCustomPlotList();
VanChartPlot vanChartPlot = list.get(index);
ConditionCollection conditionCollection = vanChartPlot.getConditionCollection();
ConditionAttr[] conditionAttrs = conditionCollection.getAllConditionAttrList();
for (ConditionAttr conditionAttr : conditionAttrs) {
if (conditionAttr.getCondition() instanceof ChartCommonCondition) {
ChartCommonCondition chartCommonCondition = (ChartCommonCondition) conditionAttr.getCondition();
if (chartCommonCondition.getCompare().getValue() instanceof DSColumnWithSummaryMethod) {
DSColumnWithSummaryMethod dsColumnWithSummaryMethod = (DSColumnWithSummaryMethod) chartCommonCondition.getCompare().getValue();
columnNameComboBoxModel.setSelectedItem(dsColumnWithSummaryMethod.getFieldName());
summaryMethodComboBoxModel.setSelectedItem(ChartCommonCondition.FORMAT_MAP.get(String.valueOf(dsColumnWithSummaryMethod.getDataFunction().getFormula())));
return;
}
}
}
}
}
}

5
designer-chart/src/main/java/com/fr/van/chart/custom/other/VanChartCustomPlotConditionAttrTabPane.java

@ -93,9 +93,8 @@ public class VanChartCustomPlotConditionAttrTabPane extends VanChartCustomPlotTa
CustomPlotType plotType = CustomPlotFactory.getCustomType(chartPlot);
VanChartRichEditorPane.refreshCustomChartTableFieldNames(chart, plotType);
ColSelectedWithSummaryMethodEditor.refreshCustomChartTableFieldNames(chart, plotType);
JPanel selectedPane = paneList.get(index);
if (chart != null && chartPlot != null && selectedPane instanceof VanChartConditionAttrPane) {
((VanChartConditionAttrPane) selectedPane).populateBean(chartPlot);
if (chart != null) {
ColSelectedWithSummaryMethodEditor.update(index, chart.getPlot());
}
}
}

5
designer-realize/src/main/java/com/fr/start/DesignerSubListener.java

@ -8,6 +8,7 @@ import com.fr.exit.DesignerExiter;
import com.fr.process.engine.core.CarryMessageEvent;
import com.fr.process.engine.core.FineProcessContext;
import com.fr.process.engine.core.FineProcessEngineEvent;
import com.fr.start.common.DesignerStartupContext;
/**
* @author hades
@ -31,6 +32,10 @@ public class DesignerSubListener {
FineProcessContext.getParentPipe().listen(FineProcessEngineEvent.READY, new Listener<Null>() {
@Override
public void on(Event event, Null param) {
// 如果是在起始页的等待过程中
if (DesignerStartupContext.getInstance().isOnWaiting()) {
return;
}
if (DesignerContext.getDesignerFrame() == null || !DesignerContext.getDesignerFrame().isShowing()) {
DesignerExiter.getInstance().exitUnexpectedly(() -> {

25
designer-realize/src/main/java/com/fr/start/module/optimized/DesignUpdateActivator.java

@ -0,0 +1,25 @@
package com.fr.start.module.optimized;
import com.fr.start.common.DesignerStartupContext;
import com.fr.update.activator.BasicUpdateActivator;
import com.fr.update.base.FineUpdateUnit;
/**
* created by Harrison on 2022/08/11
**/
public class DesignUpdateActivator extends BasicUpdateActivator {
@Override
public void start() {
if (DesignerStartupContext.getInstance().onWarmup()) {
try {
prepare4Start();
FineUpdateUnit.makeNew();
} catch (Throwable ignore) {
}
} else {
super.start();
}
}
}

12
designer-realize/src/main/java/com/fr/start/module/optimized/DesignerStartupPageActivator.java

@ -1,5 +1,6 @@
package com.fr.start.module.optimized;
import com.fr.design.DesignerEnvManager;
import com.fr.design.ui.util.UIUtil;
import com.fr.log.FineLoggerFactory;
import com.fr.module.Activator;
@ -10,6 +11,7 @@ import com.fr.start.util.DesignerStartupPageUtil;
import com.fr.start.warmup.DesignerPreWarmTask;
import com.fr.startup.ui.StartupPageModel;
import com.fr.startup.ui.StartupPageWindow;
import com.fr.startup.ui.StartupWorkspaceBean;
import com.fr.third.org.apache.commons.lang3.time.StopWatch;
import com.fr.value.NotNullLazyValue;
import org.jetbrains.annotations.NotNull;
@ -66,18 +68,21 @@ public class DesignerStartupPageActivator extends Activator {
// selectAndOpenLast
model.setOpenLastTemplateRunnable(() -> {
context.setOpenLastFile(true);
handleModel(model);
launchAfterWarmup(warmTask);
});
// selectAndOpenEmpty
model.setOpenEmptyTemplateRunnable(() -> {
context.setOpenEmpty(true);
handleModel(model);
launchAfterWarmup(warmTask);
});
// selectAndCreateNew
model.setCreateNewTemplateRunnable(() -> {
context.setCreateNew(true);
handleModel(model);
launchAfterWarmup(warmTask);
});
@ -87,6 +92,13 @@ public class DesignerStartupPageActivator extends Activator {
});
}
private void handleModel(StartupPageModel model) {
// 将选中的环境设置为当前环境
StartupWorkspaceBean selectWorkspaceInfo = model.getSelectWorkspaceInfo();
DesignerEnvManager.getEnvManager().setCurEnvName(selectWorkspaceInfo.getName());
}
private void launchAfterWarmup(DesignerPreWarmTask warmTask) {
StopWatch stopWatch = StopWatch.createStarted();

Loading…
Cancel
Save