Browse Source

Merge branch 'release/11.0' of ssh://code.fineres.com:7999/~tommy/design into release/11.0

release/11.0
Tommy 2 years ago
parent
commit
3933e58ea0
  1. 18
      designer-base/src/main/java/com/fr/design/DesignerEnvManager.java
  2. 42
      designer-base/src/main/java/com/fr/design/data/MapCompareUtils.java
  3. 46
      designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java
  4. 3
      designer-base/src/main/java/com/fr/design/extra/exe/callback/InstallFromDiskCallback.java
  5. 3
      designer-base/src/main/java/com/fr/design/extra/exe/callback/InstallOnlineCallback.java
  6. 3
      designer-base/src/main/java/com/fr/design/extra/exe/callback/UpdateFromDiskCallback.java
  7. 3
      designer-base/src/main/java/com/fr/design/extra/exe/callback/UpdateOnlineCallback.java
  8. 70
      designer-base/src/main/java/com/fr/design/extra/exe/callback/handle/PluginCallBackHelper.java
  9. 86
      designer-base/src/main/java/com/fr/design/extra/exe/callback/handle/PluginTaskResultErrorDialog.java
  10. 83
      designer-base/src/main/java/com/fr/design/mainframe/simple/SimpleDesignerConfig.java
  11. 14
      designer-base/src/main/resources/com/fr/design/standard/system/error_tips.svg
  12. 27
      designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/ColSelectedWithSummaryMethodEditor.java
  13. 5
      designer-chart/src/main/java/com/fr/van/chart/custom/other/VanChartCustomPlotConditionAttrTabPane.java
  14. 4
      designer-realize/src/main/java/com/fr/design/sort/header/HeaderAreaPane.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.DesignerLoginType;
import com.fr.design.login.config.DesignerLoginConfigManager; import com.fr.design.login.config.DesignerLoginConfigManager;
import com.fr.design.mainframe.ComponentReuseNotifyUtil; 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.reuse.ComponentReuseNotificationInfo;
import com.fr.design.mainframe.vcs.VcsConfigManager; import com.fr.design.mainframe.vcs.VcsConfigManager;
import com.fr.design.notification.SnapChatConfig; import com.fr.design.notification.SnapChatConfig;
@ -226,6 +227,8 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
private boolean propertiesUsable; private boolean propertiesUsable;
private SimpleDesignerConfig fvsDesignerConfig = SimpleDesignerConfig.getInstance("FvsDesignerConfig");
/** /**
* DesignerEnvManager. * DesignerEnvManager.
*/ */
@ -1012,6 +1015,10 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
this.designerStartupConfig.setEnabled(enabled); this.designerStartupConfig.setEnabled(enabled);
} }
public SimpleDesignerConfig getFvsDesignerConfig() {
return fvsDesignerConfig;
}
/** /**
* 返回环境名称迭代器 * 返回环境名称迭代器
*/ */
@ -1863,6 +1870,8 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
readSnapChatConfig(reader); readSnapChatConfig(reader);
} else if (name.equals(DesignerLoginConfigManager.XML_TAG)) { } else if (name.equals(DesignerLoginConfigManager.XML_TAG)) {
readDesignerLoginAttr(reader); readDesignerLoginAttr(reader);
} else if (name.equals(fvsDesignerConfig.getName())) {
readFvsDesignerConfig(reader);
} else { } else {
readLayout(reader, name); readLayout(reader, name);
} }
@ -2113,6 +2122,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
writeSnapChatConfig(writer); writeSnapChatConfig(writer);
writeComponentReuseNotificationInfo(writer); writeComponentReuseNotificationInfo(writer);
writeDesignerLoginAttr(writer); writeDesignerLoginAttr(writer);
writeFvsDesignerConfig(writer);
writer.end(); writer.end();
} }
@ -2419,6 +2429,14 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
this.designerLoginConfigManager.writeXML(writer); this.designerLoginConfigManager.writeXML(writer);
} }
private void readFvsDesignerConfig(XMLableReader reader) {
reader.readXMLObject(fvsDesignerConfig);
}
private void writeFvsDesignerConfig(XMLPrintWriter writer) {
this.fvsDesignerConfig.writeXML(writer);
}
enum XmlHandler { enum XmlHandler {
Self; Self;

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

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

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

@ -1,13 +1,12 @@
package com.fr.design.data.datapane.connect; package com.fr.design.data.datapane.connect;
import com.fr.base.TemplateUtils;
import com.fr.config.RemoteConfigEvent; import com.fr.config.RemoteConfigEvent;
import com.fr.data.core.db.JDBCSecurityChecker;
import com.fr.data.impl.Connection; import com.fr.data.impl.Connection;
import com.fr.data.impl.ConnectionBean; import com.fr.data.impl.ConnectionBean;
import com.fr.data.impl.JDBCDatabaseConnection; import com.fr.data.impl.JDBCDatabaseConnection;
import com.fr.data.impl.JNDIDatabaseConnection; import com.fr.data.impl.JNDIDatabaseConnection;
import com.fr.data.metric.utils.DatabaseConnectionMetricHandler; import com.fr.data.metric.utils.DatabaseConnectionMetricHandler;
import com.fr.data.operator.DataOperator;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
import com.fr.design.data.MapCompareUtils; import com.fr.design.data.MapCompareUtils;
import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicDialog;
@ -187,30 +186,53 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh
case ADDED: case ADDED:
case UPDATED: case UPDATED:
addedOrUpdatedConnections.add(new ConnectionBean(s, StringUtils.EMPTY, connection)); addedOrUpdatedConnections.add(new ConnectionBean(s, StringUtils.EMPTY, connection));
if (connection instanceof JDBCDatabaseConnection){ if (connection instanceof JDBCDatabaseConnection) {
DatabaseConnectionMetricHandler.handleSaveConnection((JDBCDatabaseConnection) connection, null); DatabaseConnectionMetricHandler.handleSaveConnection((JDBCDatabaseConnection) connection, null);
} }
default: default:
break; 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.checkSecurity(addedOrUpdatedConnections); this.validateConnections(addedOrUpdatedConnections);
this.alterConnections(removedConnNames, addedOrUpdatedConnections); this.alterConnections(removedConnNames, addedOrUpdatedConnections);
} }
private void checkSecurity(List<ConnectionBean> addedOrUpdatedConnections) throws Exception { private void validateConnections(List<ConnectionBean> addedOrUpdatedConnections) throws Exception {
for (ConnectionBean connectionBean : addedOrUpdatedConnections) { for (ConnectionBean connectionBean : addedOrUpdatedConnections) {
Connection connection = connectionBean.getConnection(); Connection connection = connectionBean.getConnection();
if (connection instanceof JDBCDatabaseConnection) { try {
try { DataOperator.getInstance().validateConnectionSettings(connection);
JDBCSecurityChecker.checkURL(TemplateUtils.render(((JDBCDatabaseConnection) connection).getURL())); } catch (Exception e) {
JDBCSecurityChecker.checkValidationQuery(((JDBCDatabaseConnection) connection).getDbcpAttr().getValidationQuery()); throw new SQLException(Toolkit.i18nText("Fine-Design_Basic_Database_Connection_Invalid_Config", connectionBean.getName()) + ", " + e.getMessage(), e.getCause());
} catch (SQLException e) {
throw new SQLException(Toolkit.i18nText("Fine-Design_Basic_Database_Connection_Invalid_Config", connectionBean.getName()) + ", " + e.getMessage(), e.getCause());
}
} }
} }

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.bridge.exec.JSCallback;
import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.extra.PluginOperateUtils; import com.fr.design.extra.PluginOperateUtils;
import com.fr.design.extra.exe.callback.handle.PluginCallBackHelper;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
@ -73,7 +74,7 @@ public class InstallFromDiskCallback extends AbstractPluginTaskCallback {
}else { }else {
jsCallback.execute("failed"); jsCallback.execute("failed");
FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_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.bridge.exec.JSExecutor;
import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.extra.PluginOperateUtils; import com.fr.design.extra.PluginOperateUtils;
import com.fr.design.extra.exe.callback.handle.PluginCallBackHelper;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
@ -63,7 +64,7 @@ public class InstallOnlineCallback extends AbstractDealPreTaskCallback {
} else { } else {
jsCallback.execute("failed"); jsCallback.execute("failed");
FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_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.bridge.exec.JSCallback;
import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.extra.PluginOperateUtils; import com.fr.design.extra.PluginOperateUtils;
import com.fr.design.extra.exe.callback.handle.PluginCallBackHelper;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
@ -72,7 +73,7 @@ public class UpdateFromDiskCallback extends AbstractPluginTaskCallback {
}else { }else {
jsCallback.execute("failed"); jsCallback.execute("failed");
FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Basic_Plugin_Update_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.bridge.exec.JSCallback;
import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.extra.PluginOperateUtils; import com.fr.design.extra.PluginOperateUtils;
import com.fr.design.extra.exe.callback.handle.PluginCallBackHelper;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
@ -38,7 +39,7 @@ public class UpdateOnlineCallback extends AbstractDealPreTaskCallback {
} else { } else {
jsCallback.execute("failed"); jsCallback.execute("failed");
FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Basic_Plugin_Update_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);
}
}

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;
}
}

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

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; package com.fr.design.chart.series.SeriesCondition;
import com.fr.chart.chartattr.Chart; 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.DSColumnWithSummaryMethod;
import com.fr.data.util.function.AbstractDataFunction; import com.fr.data.util.function.AbstractDataFunction;
import com.fr.design.chart.ChartDataHelper; 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.gui.icombobox.UIComboBox;
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.plugin.chart.attr.plot.VanChartPlot;
import com.fr.plugin.chart.custom.VanChartCustomPlot;
import com.fr.plugin.chart.custom.type.CustomPlotType; import com.fr.plugin.chart.custom.type.CustomPlotType;
import java.awt.Dimension; import java.awt.Dimension;
import java.util.List;
import javax.swing.DefaultComboBoxModel; import javax.swing.DefaultComboBoxModel;
public class ColSelectedWithSummaryMethodEditor extends Editor<DSColumnWithSummaryMethod> { public class ColSelectedWithSummaryMethodEditor extends Editor<DSColumnWithSummaryMethod> {
@ -88,4 +95,24 @@ public class ColSelectedWithSummaryMethodEditor extends Editor<DSColumnWithSumma
return object instanceof DSColumnWithSummaryMethod; 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); CustomPlotType plotType = CustomPlotFactory.getCustomType(chartPlot);
VanChartRichEditorPane.refreshCustomChartTableFieldNames(chart, plotType); VanChartRichEditorPane.refreshCustomChartTableFieldNames(chart, plotType);
ColSelectedWithSummaryMethodEditor.refreshCustomChartTableFieldNames(chart, plotType); ColSelectedWithSummaryMethodEditor.refreshCustomChartTableFieldNames(chart, plotType);
JPanel selectedPane = paneList.get(index); if (chart != null) {
if (chart != null && chartPlot != null && selectedPane instanceof VanChartConditionAttrPane) { ColSelectedWithSummaryMethodEditor.update(index, chart.getPlot());
((VanChartConditionAttrPane) selectedPane).populateBean(chartPlot);
} }
} }
} }

4
designer-realize/src/main/java/com/fr/design/sort/header/HeaderAreaPane.java

@ -168,7 +168,9 @@ public class HeaderAreaPane extends JPanel {
public void populateBean(ColumnRow columnRow, boolean showHeaderArea, boolean enabled) { public void populateBean(ColumnRow columnRow, boolean showHeaderArea, boolean enabled) {
cellSelectionManager.build(cellElement, columnRow); cellSelectionManager.build(cellElement, columnRow);
columnRow = cellSelectionManager.buildCurrentCell(cellElement, columnRow); if(showHeaderArea){
columnRow = cellSelectionManager.buildCurrentCell(cellElement, columnRow);
}
columnRowPane.populateBean(columnRow, enabled, cellSelectionManager); columnRowPane.populateBean(columnRow, enabled, cellSelectionManager);
setSortColumnRowPaneShow(showHeaderArea); setSortColumnRowPaneShow(showHeaderArea);
uiComboBox.setSelectedIndex(showHeaderArea ? 1 : 0); uiComboBox.setSelectedIndex(showHeaderArea ? 1 : 0);

Loading…
Cancel
Save